From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>,
agross@kernel.org, bjorn.andersson@linaro.org,
lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org,
plai@codeaurora.org, bgoswami@codeaurora.org, perex@perex.cz,
tiwai@suse.com, rohitkr@codeaurora.org,
linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: qcom: lpass-cpu: Remove bit clock state check
Date: Wed, 27 Jan 2021 09:51:35 +0000 [thread overview]
Message-ID: <16199fa8-7a87-6e7f-9db6-1d5cd8493d4c@linaro.org> (raw)
In-Reply-To: <20210127063038.1399-1-srivasam@codeaurora.org>
On 27/01/2021 06:30, Srinivasa Rao Mandadapu wrote:
> No need of BCLK state maintenance from driver side as
> clock_enable and clk_disable API's maintaing state counter.
>
> One of the major issue was spotted when Headset jack inserted
> while playback continues, due to same PCM device node opens twice
> for playaback/capture and closes once for capture and playback continues.
>
> It can resolve the errors in such scenarios.
>
> Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Thanks for the cleanup, yes clk core will take care of this by
enable_count check!
You should add
Fixes: b1824968221c ("ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF
invalid state")
> ---
> sound/soc/qcom/lpass-cpu.c | 22 ++++++++--------------
> sound/soc/qcom/lpass-lpaif-reg.h | 3 ---
> sound/soc/qcom/lpass.h | 1 -
> 3 files changed, 8 insertions(+), 18 deletions(-)
>
> diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
> index ae8efbc89af2..a669202e0001 100644
> --- a/sound/soc/qcom/lpass-cpu.c
> +++ b/sound/soc/qcom/lpass-cpu.c
> @@ -286,16 +286,12 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
> dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
> ret);
>
> - if (drvdata->bit_clk_state[id] == LPAIF_BIT_CLK_DISABLE) {
> - ret = clk_enable(drvdata->mi2s_bit_clk[id]);
> - if (ret) {
> - dev_err(dai->dev, "error in enabling mi2s bit clk: %d\n", ret);
> - clk_disable(drvdata->mi2s_osr_clk[id]);
> - return ret;
> - }
> - drvdata->bit_clk_state[id] = LPAIF_BIT_CLK_ENABLE;
> + ret = clk_enable(drvdata->mi2s_bit_clk[id]);
> + if (ret) {
> + dev_err(dai->dev, "error in enabling mi2s bit clk: %d\n", ret);
> + clk_disable(drvdata->mi2s_osr_clk[id]);
Can you also remove this unnecessary disable here!
-srini
> + return ret;
> }
> -
> break;
> case SNDRV_PCM_TRIGGER_STOP:
> case SNDRV_PCM_TRIGGER_SUSPEND:
> @@ -310,10 +306,9 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
> if (ret)
> dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
> ret);
> - if (drvdata->bit_clk_state[id] == LPAIF_BIT_CLK_ENABLE) {
> - clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]);
> - drvdata->bit_clk_state[id] = LPAIF_BIT_CLK_DISABLE;
> - }
> +
> + clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]);
> +
> break;
> }
>
> @@ -861,7 +856,6 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
> PTR_ERR(drvdata->mi2s_bit_clk[dai_id]));
> return PTR_ERR(drvdata->mi2s_bit_clk[dai_id]);
> }
> - drvdata->bit_clk_state[dai_id] = LPAIF_BIT_CLK_DISABLE;
> }
>
> /* Allocation for i2sctl regmap fields */
> diff --git a/sound/soc/qcom/lpass-lpaif-reg.h b/sound/soc/qcom/lpass-lpaif-reg.h
> index 405542832e99..c8e1d75340b2 100644
> --- a/sound/soc/qcom/lpass-lpaif-reg.h
> +++ b/sound/soc/qcom/lpass-lpaif-reg.h
> @@ -60,9 +60,6 @@
> #define LPAIF_I2SCTL_BITWIDTH_24 1
> #define LPAIF_I2SCTL_BITWIDTH_32 2
>
> -#define LPAIF_BIT_CLK_DISABLE 0
> -#define LPAIF_BIT_CLK_ENABLE 1
> -
> #define LPAIF_I2SCTL_RESET_STATE 0x003C0004
> #define LPAIF_DMACTL_RESET_STATE 0x00200000
>
> diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
> index 2d68af0da34d..83b2e08ade06 100644
> --- a/sound/soc/qcom/lpass.h
> +++ b/sound/soc/qcom/lpass.h
> @@ -68,7 +68,6 @@ struct lpass_data {
> unsigned int mi2s_playback_sd_mode[LPASS_MAX_MI2S_PORTS];
> unsigned int mi2s_capture_sd_mode[LPASS_MAX_MI2S_PORTS];
> int hdmi_port_enable;
> - int bit_clk_state[LPASS_MAX_MI2S_PORTS];
>
> /* low-power audio interface (LPAIF) registers */
> void __iomem *lpaif;
>
next prev parent reply other threads:[~2021-01-27 9:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-27 6:30 Srinivasa Rao Mandadapu
2021-01-27 9:51 ` Srinivas Kandagatla [this message]
2021-01-27 10:54 ` Srinivasa Rao Mandadapu
2021-01-27 10:56 ` Srinivas Kandagatla
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=16199fa8-7a87-6e7f-9db6-1d5cd8493d4c@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=agross@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=bgoswami@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=plai@codeaurora.org \
--cc=robh+dt@kernel.org \
--cc=rohitkr@codeaurora.org \
--cc=srivasam@codeaurora.org \
--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
all inboxes | Powered by JetHome®