LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2] ASoC: qcom: apq8016_sbc: Add SEC_MI2S support
@ 2021-08-06 11:41 Vincent Knecht
  2021-08-06 12:06 ` Srinivas Kandagatla
  2021-08-09 13:06 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Vincent Knecht @ 2021-08-06 11:41 UTC (permalink / raw)
  To: tiwai, perex
  Cc: alsa-devel, linux-kernel, broonie, lgirdwood, bgoswami,
	srinivas.kandagatla, stephan, Vincent Knecht

This patch adds external codec support on secondary mi2s.
It is used for headphones on some devices, eg. alcatel-idol347.

Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org>
---
v1->v2: thanks Srinivas for the review, and Stephan for guidance
- Add _SEC suffix to defines to highlight usage for secondary mi2s
- Clear TLMM_WS_OUT_SEL and TLMM_WS_EN_SEL fields before setting value
---
 sound/soc/qcom/apq8016_sbc.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c
index 08a05f0ecad7..ba2a98268ee4 100644
--- a/sound/soc/qcom/apq8016_sbc.c
+++ b/sound/soc/qcom/apq8016_sbc.c
@@ -30,6 +30,13 @@ struct apq8016_sbc_data {
 #define MIC_CTRL_QUA_WS_SLAVE_SEL_10	BIT(17)
 #define MIC_CTRL_TLMM_SCLK_EN		BIT(1)
 #define	SPKR_CTL_PRI_WS_SLAVE_SEL_11	(BIT(17) | BIT(16))
+#define SPKR_CTL_TLMM_MCLK_EN		BIT(1)
+#define SPKR_CTL_TLMM_SCLK_EN		BIT(2)
+#define SPKR_CTL_TLMM_DATA1_EN		BIT(3)
+#define SPKR_CTL_TLMM_WS_OUT_SEL_MASK	GENMASK(7, 6)
+#define SPKR_CTL_TLMM_WS_OUT_SEL_SEC	BIT(6)
+#define SPKR_CTL_TLMM_WS_EN_SEL_MASK	GENMASK(19, 18)
+#define SPKR_CTL_TLMM_WS_EN_SEL_SEC	BIT(18)
 #define DEFAULT_MCLK_RATE		9600000
 
 static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
@@ -40,6 +47,7 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
 	struct snd_soc_card *card = rtd->card;
 	struct apq8016_sbc_data *pdata = snd_soc_card_get_drvdata(card);
 	int i, rval;
+	u32 value;
 
 	switch (cpu_dai->id) {
 	case MI2S_PRIMARY:
@@ -53,6 +61,15 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
 			MIC_CTRL_TLMM_SCLK_EN,
 			pdata->mic_iomux);
 		break;
+	case MI2S_SECONDARY:
+		/* Clear TLMM_WS_OUT_SEL and TLMM_WS_EN_SEL fields */
+		value = readl(pdata->spkr_iomux) &
+			~(SPKR_CTL_TLMM_WS_OUT_SEL_MASK | SPKR_CTL_TLMM_WS_EN_SEL_MASK);
+		/* Configure the Sec MI2S to TLMM */
+		writel(value | SPKR_CTL_TLMM_MCLK_EN | SPKR_CTL_TLMM_SCLK_EN |
+			SPKR_CTL_TLMM_DATA1_EN | SPKR_CTL_TLMM_WS_OUT_SEL_SEC |
+			SPKR_CTL_TLMM_WS_EN_SEL_SEC, pdata->spkr_iomux);
+		break;
 	case MI2S_TERTIARY:
 		writel(readl(pdata->mic_iomux) | MIC_CTRL_TER_WS_SLAVE_SEL |
 			MIC_CTRL_TLMM_SCLK_EN,
-- 
2.31.1




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ASoC: qcom: apq8016_sbc: Add SEC_MI2S support
  2021-08-06 11:41 [PATCH v2] ASoC: qcom: apq8016_sbc: Add SEC_MI2S support Vincent Knecht
@ 2021-08-06 12:06 ` Srinivas Kandagatla
  2021-08-09 13:06 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Srinivas Kandagatla @ 2021-08-06 12:06 UTC (permalink / raw)
  To: Vincent Knecht, tiwai, perex
  Cc: alsa-devel, linux-kernel, broonie, lgirdwood, bgoswami, stephan



On 06/08/2021 12:41, Vincent Knecht wrote:
> This patch adds external codec support on secondary mi2s.
> It is used for headphones on some devices, eg. alcatel-idol347.
> 
> Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org>

Thanks for rework, LGTM.

Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

> ---
> v1->v2: thanks Srinivas for the review, and Stephan for guidance
> - Add _SEC suffix to defines to highlight usage for secondary mi2s
> - Clear TLMM_WS_OUT_SEL and TLMM_WS_EN_SEL fields before setting value
> ---
>   sound/soc/qcom/apq8016_sbc.c | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
> 
> diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c
> index 08a05f0ecad7..ba2a98268ee4 100644
> --- a/sound/soc/qcom/apq8016_sbc.c
> +++ b/sound/soc/qcom/apq8016_sbc.c
> @@ -30,6 +30,13 @@ struct apq8016_sbc_data {
>   #define MIC_CTRL_QUA_WS_SLAVE_SEL_10	BIT(17)
>   #define MIC_CTRL_TLMM_SCLK_EN		BIT(1)
>   #define	SPKR_CTL_PRI_WS_SLAVE_SEL_11	(BIT(17) | BIT(16))
> +#define SPKR_CTL_TLMM_MCLK_EN		BIT(1)
> +#define SPKR_CTL_TLMM_SCLK_EN		BIT(2)
> +#define SPKR_CTL_TLMM_DATA1_EN		BIT(3)
> +#define SPKR_CTL_TLMM_WS_OUT_SEL_MASK	GENMASK(7, 6)
> +#define SPKR_CTL_TLMM_WS_OUT_SEL_SEC	BIT(6)
> +#define SPKR_CTL_TLMM_WS_EN_SEL_MASK	GENMASK(19, 18)
> +#define SPKR_CTL_TLMM_WS_EN_SEL_SEC	BIT(18)
>   #define DEFAULT_MCLK_RATE		9600000
>   
>   static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
> @@ -40,6 +47,7 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
>   	struct snd_soc_card *card = rtd->card;
>   	struct apq8016_sbc_data *pdata = snd_soc_card_get_drvdata(card);
>   	int i, rval;
> +	u32 value;
>   
>   	switch (cpu_dai->id) {
>   	case MI2S_PRIMARY:
> @@ -53,6 +61,15 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
>   			MIC_CTRL_TLMM_SCLK_EN,
>   			pdata->mic_iomux);
>   		break;
> +	case MI2S_SECONDARY:
> +		/* Clear TLMM_WS_OUT_SEL and TLMM_WS_EN_SEL fields */
> +		value = readl(pdata->spkr_iomux) &
> +			~(SPKR_CTL_TLMM_WS_OUT_SEL_MASK | SPKR_CTL_TLMM_WS_EN_SEL_MASK);
> +		/* Configure the Sec MI2S to TLMM */
> +		writel(value | SPKR_CTL_TLMM_MCLK_EN | SPKR_CTL_TLMM_SCLK_EN |
> +			SPKR_CTL_TLMM_DATA1_EN | SPKR_CTL_TLMM_WS_OUT_SEL_SEC |
> +			SPKR_CTL_TLMM_WS_EN_SEL_SEC, pdata->spkr_iomux);
> +		break;
>   	case MI2S_TERTIARY:
>   		writel(readl(pdata->mic_iomux) | MIC_CTRL_TER_WS_SLAVE_SEL |
>   			MIC_CTRL_TLMM_SCLK_EN,
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ASoC: qcom: apq8016_sbc: Add SEC_MI2S support
  2021-08-06 11:41 [PATCH v2] ASoC: qcom: apq8016_sbc: Add SEC_MI2S support Vincent Knecht
  2021-08-06 12:06 ` Srinivas Kandagatla
@ 2021-08-09 13:06 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-08-09 13:06 UTC (permalink / raw)
  To: perex, tiwai, Vincent Knecht
  Cc: Mark Brown, linux-kernel, lgirdwood, bgoswami,
	srinivas.kandagatla, stephan, alsa-devel

On Fri, 6 Aug 2021 13:41:16 +0200, Vincent Knecht wrote:
> This patch adds external codec support on secondary mi2s.
> It is used for headphones on some devices, eg. alcatel-idol347.
> 
> 
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: qcom: apq8016_sbc: Add SEC_MI2S support
      commit: 1e2c7845421b785282c098712a81556a2b8917a5

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-09 13:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 11:41 [PATCH v2] ASoC: qcom: apq8016_sbc: Add SEC_MI2S support Vincent Knecht
2021-08-06 12:06 ` Srinivas Kandagatla
2021-08-09 13:06 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).