From: Sylwester Nawrocki <s.nawrocki@samsung.com> To: broonie@kernel.org, kgene@kernel.org Cc: padma.v@samsung.com, drake@endlessm.com, sbkim73@samsung.com, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sylwester Nawrocki <s.nawrocki@samsung.com> Subject: [PATCH V3 05/15] ASoC: samsung: i2s: Move clk enable to the platform driver probe() Date: Wed, 14 Jan 2015 19:42:32 +0100 [thread overview] Message-ID: <1421260962-16892-6-git-send-email-s.nawrocki@samsung.com> (raw) In-Reply-To: <1421260962-16892-1-git-send-email-s.nawrocki@samsung.com> The clk_prepare_enable() call on the "iis" clock is moved to happen earlier in the DAI platform device driver's probe() callback, so the I2S registers can be safely accessed through the clk API, after the clk supplier is registered in the platform device probe(). After this patch the "iis" clock is kept enabled since the (primary) I2S platform device probe() and until the platform device driver remove() call. This is similar to gating the clock in the snd_soc_dai probe() and remove() callbacks. Normally, in addition to that we should mark the device as PM runtime active, so if runtime PM is enabled it can idle the device by turning off the clock. Correcting this issue is left for a separate patch series, as we need to ensure the BUSCLK clock is always enabled when required. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> --- sound/soc/samsung/i2s.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index a854ffc..f75c19e 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -969,7 +969,6 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) { struct i2s_dai *i2s = to_info(dai); struct i2s_dai *other = i2s->pri_dai ? : i2s->sec_dai; - int ret; if (is_secondary(i2s)) { /* If this is probe on the secondary DAI */ samsung_asoc_init_dma_data(dai, &other->sec_dai->dma_playback, @@ -977,12 +976,6 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) goto probe_exit; } - ret = clk_prepare_enable(i2s->clk); - if (ret != 0) { - dev_err(&i2s->pdev->dev, "failed to enable clock: %d\n", ret); - return ret; - } - samsung_asoc_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture); if (i2s->quirks & QUIRK_NEED_RSTCLR) @@ -1014,18 +1007,12 @@ probe_exit: static int samsung_i2s_dai_remove(struct snd_soc_dai *dai) { struct i2s_dai *i2s = snd_soc_dai_get_drvdata(dai); - struct i2s_dai *other = i2s->pri_dai ? : i2s->sec_dai; - - if (!other || !other->clk) { + if (!is_secondary(i2s)) { if (i2s->quirks & QUIRK_NEED_RSTCLR) writel(0, i2s->addr + I2SCON); - - clk_disable_unprepare(i2s->clk); } - i2s->clk = NULL; - return 0; } @@ -1139,6 +1126,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) u32 regs_base, quirks = 0, idma_addr = 0; struct device_node *np = pdev->dev.of_node; const struct samsung_i2s_dai_data *i2s_dai_data; + int ret; /* Call during Seconday interface registration */ i2s_dai_data = samsung_i2s_get_driver_data(pdev); @@ -1216,6 +1204,12 @@ static int samsung_i2s_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Failed to get iis clock\n"); return PTR_ERR(pri_dai->clk); } + + ret = clk_prepare_enable(pri_dai->clk); + if (ret != 0) { + dev_err(&pdev->dev, "failed to enable clock: %d\n", ret); + return ret; + } pri_dai->dma_playback.dma_addr = regs_base + I2STXD; pri_dai->dma_capture.dma_addr = regs_base + I2SRXD; pri_dai->dma_playback.ch_name = "tx"; @@ -1286,6 +1280,9 @@ static int samsung_i2s_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); } + if (!is_secondary(i2s)) + clk_disable_unprepare(i2s->clk); + i2s->pri_dai = NULL; i2s->sec_dai = NULL; -- 1.7.9.5
WARNING: multiple messages have this Message-ID (diff)
From: s.nawrocki@samsung.com (Sylwester Nawrocki) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH V3 05/15] ASoC: samsung: i2s: Move clk enable to the platform driver probe() Date: Wed, 14 Jan 2015 19:42:32 +0100 [thread overview] Message-ID: <1421260962-16892-6-git-send-email-s.nawrocki@samsung.com> (raw) In-Reply-To: <1421260962-16892-1-git-send-email-s.nawrocki@samsung.com> The clk_prepare_enable() call on the "iis" clock is moved to happen earlier in the DAI platform device driver's probe() callback, so the I2S registers can be safely accessed through the clk API, after the clk supplier is registered in the platform device probe(). After this patch the "iis" clock is kept enabled since the (primary) I2S platform device probe() and until the platform device driver remove() call. This is similar to gating the clock in the snd_soc_dai probe() and remove() callbacks. Normally, in addition to that we should mark the device as PM runtime active, so if runtime PM is enabled it can idle the device by turning off the clock. Correcting this issue is left for a separate patch series, as we need to ensure the BUSCLK clock is always enabled when required. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> --- sound/soc/samsung/i2s.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index a854ffc..f75c19e 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -969,7 +969,6 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) { struct i2s_dai *i2s = to_info(dai); struct i2s_dai *other = i2s->pri_dai ? : i2s->sec_dai; - int ret; if (is_secondary(i2s)) { /* If this is probe on the secondary DAI */ samsung_asoc_init_dma_data(dai, &other->sec_dai->dma_playback, @@ -977,12 +976,6 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) goto probe_exit; } - ret = clk_prepare_enable(i2s->clk); - if (ret != 0) { - dev_err(&i2s->pdev->dev, "failed to enable clock: %d\n", ret); - return ret; - } - samsung_asoc_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture); if (i2s->quirks & QUIRK_NEED_RSTCLR) @@ -1014,18 +1007,12 @@ probe_exit: static int samsung_i2s_dai_remove(struct snd_soc_dai *dai) { struct i2s_dai *i2s = snd_soc_dai_get_drvdata(dai); - struct i2s_dai *other = i2s->pri_dai ? : i2s->sec_dai; - - if (!other || !other->clk) { + if (!is_secondary(i2s)) { if (i2s->quirks & QUIRK_NEED_RSTCLR) writel(0, i2s->addr + I2SCON); - - clk_disable_unprepare(i2s->clk); } - i2s->clk = NULL; - return 0; } @@ -1139,6 +1126,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) u32 regs_base, quirks = 0, idma_addr = 0; struct device_node *np = pdev->dev.of_node; const struct samsung_i2s_dai_data *i2s_dai_data; + int ret; /* Call during Seconday interface registration */ i2s_dai_data = samsung_i2s_get_driver_data(pdev); @@ -1216,6 +1204,12 @@ static int samsung_i2s_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Failed to get iis clock\n"); return PTR_ERR(pri_dai->clk); } + + ret = clk_prepare_enable(pri_dai->clk); + if (ret != 0) { + dev_err(&pdev->dev, "failed to enable clock: %d\n", ret); + return ret; + } pri_dai->dma_playback.dma_addr = regs_base + I2STXD; pri_dai->dma_capture.dma_addr = regs_base + I2SRXD; pri_dai->dma_playback.ch_name = "tx"; @@ -1286,6 +1280,9 @@ static int samsung_i2s_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); } + if (!is_secondary(i2s)) + clk_disable_unprepare(i2s->clk); + i2s->pri_dai = NULL; i2s->sec_dai = NULL; -- 1.7.9.5
next prev parent reply other threads:[~2015-01-14 18:42 UTC|newest] Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-01-14 18:42 [PATCH V3 00/15] ASoC: samsung: Add clk provider for I2S internal clocks Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki 2015-01-14 18:42 ` [PATCH V3 01/15] ASoC: samsung: i2s: samsung_i2s_get_driver_data() cleanup Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki 2015-01-14 18:42 ` [PATCH V3 02/15] ASoC: samsung: i2s: Add return value checks in probe() Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki 2015-01-14 18:42 ` [PATCH V3 03/15] ASoC: samsung: i2s: Request memory region in driver probe() Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki 2015-01-14 18:42 ` [PATCH V3 04/15] ASoC: samsung: i2s: Move clk_get() to platform " Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki [this message] 2015-01-14 18:42 ` [PATCH V3 05/15] ASoC: samsung: i2s: Move clk enable to the " Sylwester Nawrocki 2015-01-14 18:42 ` [PATCH V3 06/15] ASoC: samsung: i2s: Add get_other_dai helper function Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki 2015-01-14 18:42 ` [PATCH V3 07/15] ASoC: samsung: i2s: Remove an unneeded goto usage Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki 2015-01-14 18:42 ` [PATCH V3 08/15] ASoC: samsung: i2s: Add spinlock in place of local_irq_* calls Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki 2015-01-14 18:42 ` [PATCH V3 09/15] ASoC: samsung: i2s: Protect more registers with a spinlock Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki 2015-01-17 5:21 ` Tushar Behera 2015-01-17 5:21 ` Tushar Behera [not found] ` <CAC5m3BxTkS3KtwUC6itMRF=545PoWJw1gYV6av3p7QjtVMFXTQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2015-01-19 12:28 ` Sylwester Nawrocki 2015-01-19 12:28 ` Sylwester Nawrocki 2015-01-14 18:42 ` [PATCH V3 10/15] ASoC: samsung: odroidx2: Handle I2S CDCLK clock conditionally Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki 2015-01-14 18:42 ` [PATCH V3 11/15] ASoC: samsung: i2s: Add clk provider DT binding documentation Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki 2015-01-14 18:42 ` [PATCH V3 12/15] ASoC: samsung: i2s: Add clock provider for the I2S internal clocks Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki 2015-01-14 18:42 ` [PATCH V3 13/15] ARM: dts: Exynos4 and Odroid X2/U3 sound device nodes update Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki 2015-01-14 19:54 ` Mark Brown 2015-01-14 19:54 ` Mark Brown [not found] ` <20150114195452.GM3043-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> 2015-02-03 4:27 ` Kukjin Kim 2015-02-03 4:27 ` Kukjin Kim 2015-02-03 11:04 ` Sylwester Nawrocki 2015-02-03 11:04 ` Sylwester Nawrocki [not found] ` <54D0AB30.2010504-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 2015-02-03 13:11 ` Mark Brown 2015-02-03 13:11 ` Mark Brown 2015-02-03 14:05 ` Sylwester Nawrocki 2015-02-03 14:05 ` Sylwester Nawrocki 2015-02-03 16:19 ` Mark Brown 2015-02-03 16:19 ` Mark Brown 2015-01-14 18:42 ` [PATCH V3 14/15] ARM: dts: Switch Odroid X2/U2 to simple-audio-card Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki 2015-01-14 18:42 ` [PATCH V3 15/15] ARM: dts: Fix I2S1, I2S2 compatible for exynos4 SoCs Sylwester Nawrocki 2015-01-14 18:42 ` Sylwester Nawrocki 2015-01-14 19:49 ` [PATCH V3 00/15] ASoC: samsung: Add clk provider for I2S internal clocks Mark Brown 2015-01-14 19:49 ` Mark Brown
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1421260962-16892-6-git-send-email-s.nawrocki@samsung.com \ --to=s.nawrocki@samsung.com \ --cc=alsa-devel@alsa-project.org \ --cc=broonie@kernel.org \ --cc=devicetree@vger.kernel.org \ --cc=drake@endlessm.com \ --cc=kgene@kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-samsung-soc@vger.kernel.org \ --cc=padma.v@samsung.com \ --cc=sbkim73@samsung.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.