From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Inha Song <ideal.song@samsung.com>
Cc: broonie@kernel.org, alsa-devel@alsa-project.org,
patches@opensource.wolfsonmicro.com,
linux-kernel@vger.kernel.org, nikesh@opensource.wolfsonmicro.com,
lars@metafoo.de, lgirdwood@gmail.com, perex@perex.cz,
tiwai@suse.de, Li.Xiubo@freescale.com, sachin.kamat@samsung.com,
cw00.choi@samsung.com
Subject: Re: [alsa-devel] [PATCH v2] ASoC: wm8994: Manage wm8994's MCLK in codec driver
Date: Mon, 16 Mar 2015 15:08:14 +0000 [thread overview]
Message-ID: <20150316150814.GK17136@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1426157181-6403-1-git-send-email-ideal.song@samsung.com>
On Thu, Mar 12, 2015 at 07:46:21PM +0900, Inha Song wrote:
> Previously, When we use wm8994 codec, we should control its MCLK in machine driver.
> But, It should be managed by wm8994 codec driver, not machine driver.
>
> This patch add MCLK clock DT parsing logic and control own MCLK.
>
> Signed-off-by: Inha Song <ideal.song@samsung.com>
> ---
> sound/soc/codecs/wm8994.c | 22 +++++++++++++++++++++-
> sound/soc/codecs/wm8994.h | 1 +
> 2 files changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
> index 4fbc768..acb6b44 100644
> --- a/sound/soc/codecs/wm8994.c
> +++ b/sound/soc/codecs/wm8994.c
> @@ -16,6 +16,7 @@
> #include <linux/init.h>
> #include <linux/delay.h>
> #include <linux/pm.h>
> +#include <linux/clk.h>
> #include <linux/gcd.h>
> #include <linux/i2c.h>
> #include <linux/platform_device.h>
> @@ -2471,6 +2472,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
> {
> struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
> struct wm8994 *control = wm8994->wm8994;
> + int i;
>
> wm_hubs_set_bias_level(codec, level);
>
> @@ -2492,8 +2494,15 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
> break;
> }
>
> - if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY)
> + if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) {
> + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++)
> + clk_prepare_enable(wm8994->clk_mclk[i]);
This still looks like you need some response to Mark's comments.
> +
> active_reference(codec);
> + } else if (codec->dapm.bias_level == SND_SOC_BIAS_ON) {
> + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++)
> + clk_disable_unprepare(wm8994->clk_mclk[i]);
> + }
> break;
>
> case SND_SOC_BIAS_STANDBY:
> @@ -4449,6 +4458,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 = {
> static int wm8994_probe(struct platform_device *pdev)
> {
> struct wm8994_priv *wm8994;
> + int i;
>
> wm8994 = devm_kzalloc(&pdev->dev, sizeof(struct wm8994_priv),
> GFP_KERNEL);
> @@ -4460,6 +4470,16 @@ static int wm8994_probe(struct platform_device *pdev)
>
> wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent);
>
> + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) {
> + char mclk_name[] = "MCLKx";
> +
> + snprintf(mclk_name, sizeof(mclk_name), "MCLK%d", i + 1);
> +
> + wm8994->clk_mclk[i] = devm_clk_get(pdev->dev.parent, mclk_name);
> + if (IS_ERR(wm8994->clk_mclk[i]))
> + wm8994->clk_mclk[i] = NULL;
This still looks wrong, devm_clk_get will return an -ENOENT if it
can't find a clock, but any other error is surely an actual error
that we should fail on?
Thanks,
Charles
prev parent reply other threads:[~2015-03-16 15:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-12 10:46 [alsa-devel] [PATCH v2] ASoC: wm8994: Manage wm8994's MCLK in codec driver Inha Song
2015-03-16 15:08 ` Charles Keepax [this message]
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=20150316150814.GK17136@opensource.wolfsonmicro.com \
--to=ckeepax@opensource.wolfsonmicro.com \
--cc=Li.Xiubo@freescale.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=cw00.choi@samsung.com \
--cc=ideal.song@samsung.com \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nikesh@opensource.wolfsonmicro.com \
--cc=patches@opensource.wolfsonmicro.com \
--cc=perex@perex.cz \
--cc=sachin.kamat@samsung.com \
--cc=tiwai@suse.de \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox