From: "Agrawal, Akshu" <Akshu.Agrawal@amd.com>
To: Daniel Kurtz <djkurtz@chromium.org>, Vijendar.Mukunda@amd.com
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
perex@perex.cz, tiwai@suse.com, alexander.deucher@amd.com,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] ASoC: AMD: Move clk enable from hw_params/free to startup/shutdown
Date: Wed, 25 Apr 2018 09:06:46 +0530 [thread overview]
Message-ID: <4c8cfac4-e67a-4457-0e27-2beb34b3d0cc@amd.com> (raw)
In-Reply-To: <CAGS+omDr8Jiwx0faMWZpASPrTUCcj97xSvG01JQX5Cj16vEeQw@mail.gmail.com>
On 4/24/2018 10:06 PM, Daniel Kurtz wrote:
> On Mon, Apr 23, 2018 at 9:03 PM Vijendar Mukunda <Vijendar.Mukunda@amd.com>
> wrote:
>
>> From: Akshu Agrawal <akshu.agrawal@amd.com>
>
>> hw_param can be called multiple times and thus we can have
>> more clk enable. The clk may not get diabled due to refcounting.
>> startup/shutdown ensures single clk enable/disable call.
>
>> Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
>> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
>> ---
>> sound/soc/amd/acp-da7219-max98357a.c | 54
> ++++++++++++++++++++++++------------
>> 1 file changed, 37 insertions(+), 17 deletions(-)
>
>> diff --git a/sound/soc/amd/acp-da7219-max98357a.c
> b/sound/soc/amd/acp-da7219-max98357a.c
>> index b205c78..0f16f6d 100644
>> --- a/sound/soc/amd/acp-da7219-max98357a.c
>> +++ b/sound/soc/amd/acp-da7219-max98357a.c
>> @@ -38,8 +38,7 @@
>> #include "../codecs/da7219.h"
>> #include "../codecs/da7219-aad.h"
>
>> -#define CZ_PLAT_CLK 24000000
>> -#define MCLK_RATE 24576000
>> +#define CZ_PLAT_CLK 25000000
>> #define DUAL_CHANNEL 2
>
>> static struct snd_soc_jack cz_jack;
>> @@ -62,7 +61,7 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime
> *rtd)
>> }
>
>> ret = snd_soc_dai_set_pll(codec_dai, 0, DA7219_SYSCLK_PLL,
>> - CZ_PLAT_CLK, MCLK_RATE);
>> + CZ_PLAT_CLK, DA7219_PLL_FREQ_OUT_98304);
>
> These are unrelated fixes that should be in their own patch.
>
Accepted. Will split it.
>> if (ret < 0) {
>> dev_err(rtd->dev, "can't set codec pll: %d\n", ret);
>> return ret;
>> @@ -85,8 +84,7 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime
> *rtd)
>> return 0;
>> }
>
>> -static int cz_da7219_hw_params(struct snd_pcm_substream *substream,
>> - struct snd_pcm_hw_params *params)
>> +static int da7219_clk_enable(struct snd_pcm_substream *substream)
>> {
>> int ret = 0;
>> struct snd_soc_pcm_runtime *rtd = substream->private_data;
>> @@ -100,11 +98,9 @@ static int cz_da7219_hw_params(struct
> snd_pcm_substream *substream,
>> return ret;
>> }
>
>> -static int cz_da7219_hw_free(struct snd_pcm_substream *substream)
>> +static void da7219_clk_disable(void)
>> {
>> clk_disable_unprepare(da7219_dai_clk);
>> -
>> - return 0;
>> }
>
>> static const unsigned int channels[] = {
>> @@ -127,7 +123,7 @@ static const struct snd_pcm_hw_constraint_list
> constraints_channels = {
>> .mask = 0,
>> };
>
>> -static int cz_fe_startup(struct snd_pcm_substream *substream)
>> +static int cz_da7219_startup(struct snd_pcm_substream *substream)
>> {
>> struct snd_pcm_runtime *runtime = substream->runtime;
>
>> @@ -141,23 +137,47 @@ static int cz_fe_startup(struct snd_pcm_substream
> *substream)
>> snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
>> &constraints_rates);
>
>> - return 0;
>> + return da7219_clk_enable(substream);
>> +}
>> +
>> +static void cz_da7219_shutdown(struct snd_pcm_substream *substream)
>> +{
>> + da7219_clk_disable();
>> +}
>> +
>> +static int cz_max_startup(struct snd_pcm_substream *substream)
>> +{
>> + return da7219_clk_enable(substream);
>> +}
>> +
>> +static void cz_max_shutdown(struct snd_pcm_substream *substream)
>> +{
>> + da7219_clk_disable();
>> +}
>> +
>> +static int cz_dmic_startup(struct snd_pcm_substream *substream)
>> +{
>> + return da7219_clk_enable(substream);
>> +}
>> +
>> +static void cz_dmic_shutdown(struct snd_pcm_substream *substream)
>> +{
>> + da7219_clk_disable();
>> }
>
> This is ok, or you could combine the common cz_max_* & cz_dmic_*.
>
>
Need to be separate as they have different cpu dai.
>> static struct snd_soc_ops cz_da7219_cap_ops = {
>
> I think these should all be "static const struct snd_soc_ops" (please fix
> in a separate patch).
>
Accepted. Will post another patch for same.
>> - .hw_params = cz_da7219_hw_params,
>> - .hw_free = cz_da7219_hw_free,
>> - .startup = cz_fe_startup,
>> + .startup = cz_da7219_startup,
>> + .shutdown = cz_da7219_shutdown,
>> };
>
>> static struct snd_soc_ops cz_max_play_ops = {
>> - .hw_params = cz_da7219_hw_params,
>> - .hw_free = cz_da7219_hw_free,
>> + .startup = cz_max_startup,
>> + .shutdown = cz_max_shutdown,
>> };
>
>> static struct snd_soc_ops cz_dmic_cap_ops = {
>> - .hw_params = cz_da7219_hw_params,
>> - .hw_free = cz_da7219_hw_free,
>> + .startup = cz_dmic_startup,
>> + .shutdown = cz_dmic_shutdown,
>> };
>
>> static struct snd_soc_dai_link cz_dai_7219_98357[] = {
>> --
>> 2.7.4
Thanks,
Akshu
next prev parent reply other threads:[~2018-04-25 3:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-24 3:04 [PATCH 1/3] ASoC: amd: acp dma driver code cleanup Vijendar Mukunda
2018-04-24 3:04 ` [PATCH 2/3] ASoC: AMD: Move clk enable from hw_params/free to startup/shutdown Vijendar Mukunda
2018-04-24 16:36 ` Daniel Kurtz
2018-04-25 3:36 ` Agrawal, Akshu [this message]
2018-04-24 3:04 ` [PATCH v3 3/3] ASoC: amd: dma driver changes for bt i2s instance Vijendar Mukunda
2018-04-24 6:05 ` [PATCH 1/3] ASoC: amd: acp dma driver code cleanup Daniel Kurtz
2018-04-24 7:06 ` Mukunda,Vijendar
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=4c8cfac4-e67a-4457-0e27-2beb34b3d0cc@amd.com \
--to=akshu.agrawal@amd.com \
--cc=Vijendar.Mukunda@amd.com \
--cc=alexander.deucher@amd.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=djkurtz@chromium.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.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: 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