* [PATCH] ASoC: mediatek: mt6358: support DMIC one-wire mode
@ 2020-05-29 11:04 Jiaxin Yu
2020-05-29 11:09 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Jiaxin Yu @ 2020-05-29 11:04 UTC (permalink / raw)
To: lgirdwood, broonie, tiwai, matthias.bgg, hariprasad.kelam
Cc: alsa-devel, howie.huang, linux-kernel, Jiaxin Yu, tzungbi,
linux-mediatek, linux-arm-kernel
Supports DMIC one-wire mode. Adds a mixer control to enable and disable.
Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
---
sound/soc/codecs/mt6358.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/mt6358.c b/sound/soc/codecs/mt6358.c
index 1b830ea..ca7628d 100644
--- a/sound/soc/codecs/mt6358.c
+++ b/sound/soc/codecs/mt6358.c
@@ -95,6 +95,8 @@ struct mt6358_priv {
struct regulator *avdd_reg;
int wov_enabled;
+
+ int dmic_one_wire_mode;
};
int mt6358_set_mtkaif_protocol(struct snd_soc_component *cmpnt,
@@ -566,6 +568,28 @@ static int mt6358_put_wov(struct snd_kcontrol *kcontrol,
return 0;
}
+static int mt6358_dmic_one_wire_mode_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+ struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt);
+
+ ucontrol->value.integer.value[0] = priv->dmic_one_wire_mode;
+
+ return 0;
+}
+
+static int mt6358_dmic_one_wire_mode_set(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+ struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt);
+
+ priv->dmic_one_wire_mode = ucontrol->value.integer.value[0];
+
+ return 0;
+}
+
static const DECLARE_TLV_DB_SCALE(playback_tlv, -1000, 100, 0);
static const DECLARE_TLV_DB_SCALE(pga_tlv, 0, 600, 0);
@@ -588,6 +612,10 @@ static int mt6358_put_wov(struct snd_kcontrol *kcontrol,
SOC_SINGLE_BOOL_EXT("Wake-on-Voice Phase2 Switch", 0,
mt6358_get_wov, mt6358_put_wov),
+
+ SOC_SINGLE_BOOL_EXT("Dmic One Wire Mode", 0,
+ mt6358_dmic_one_wire_mode_get,
+ mt6358_dmic_one_wire_mode_set),
};
/* MUX */
@@ -1740,7 +1768,10 @@ static int mt6358_amic_enable(struct mt6358_priv *priv)
mt6358_mtkaif_tx_enable(priv);
/* UL dmic setting off */
- regmap_write(priv->regmap, MT6358_AFE_UL_SRC_CON0_H, 0x0000);
+ if (priv->dmic_one_wire_mode)
+ regmap_write(priv->regmap, MT6358_AFE_UL_SRC_CON0_H, 0x0400);
+ else
+ regmap_write(priv->regmap, MT6358_AFE_UL_SRC_CON0_H, 0x0080);
/* UL turn on */
regmap_write(priv->regmap, MT6358_AFE_UL_SRC_CON0_L, 0x0001);
--
1.8.1.1.dirty
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: mediatek: mt6358: support DMIC one-wire mode
2020-05-29 11:04 [PATCH] ASoC: mediatek: mt6358: support DMIC one-wire mode Jiaxin Yu
@ 2020-05-29 11:09 ` Mark Brown
2020-05-29 11:22 ` Tzung-Bi Shih
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2020-05-29 11:09 UTC (permalink / raw)
To: Jiaxin Yu
Cc: hariprasad.kelam, alsa-devel, linux-kernel, howie.huang,
lgirdwood, tiwai, tzungbi, linux-mediatek, matthias.bgg,
linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 229 bytes --]
On Fri, May 29, 2020 at 07:04:53PM +0800, Jiaxin Yu wrote:
> Supports DMIC one-wire mode. Adds a mixer control to enable and disable.
What is DMIC one wire mode? This doesn't sound like something I'd
expect to vary at runtime.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: mediatek: mt6358: support DMIC one-wire mode
2020-05-29 11:09 ` Mark Brown
@ 2020-05-29 11:22 ` Tzung-Bi Shih
2020-05-29 13:05 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Tzung-Bi Shih @ 2020-05-29 11:22 UTC (permalink / raw)
To: Mark Brown
Cc: Hariprasad Kelam, Linux Kernel Mailing List, howie.huang,
Takashi Iwai, ALSA development, Jiaxin Yu, Liam Girdwood,
linux-mediatek, Matthias Brugger, linux-arm-kernel
On Fri, May 29, 2020 at 7:09 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Fri, May 29, 2020 at 07:04:53PM +0800, Jiaxin Yu wrote:
> > Supports DMIC one-wire mode. Adds a mixer control to enable and disable.
>
> What is DMIC one wire mode? This doesn't sound like something I'd
> expect to vary at runtime.
It means: 1 PDM data wire carries 2 channel data (rising edge for left
and falling edge for right).
The setting shouldn't and won't change at runtime. Would you suggest
putting it into DTS binding?
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: mediatek: mt6358: support DMIC one-wire mode
2020-05-29 11:22 ` Tzung-Bi Shih
@ 2020-05-29 13:05 ` Mark Brown
2020-05-29 17:26 ` Tzung-Bi Shih
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2020-05-29 13:05 UTC (permalink / raw)
To: Tzung-Bi Shih
Cc: Hariprasad Kelam, Linux Kernel Mailing List, howie.huang,
Takashi Iwai, ALSA development, Jiaxin Yu, Liam Girdwood,
linux-mediatek, Matthias Brugger, linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 548 bytes --]
On Fri, May 29, 2020 at 07:22:43PM +0800, Tzung-Bi Shih wrote:
> On Fri, May 29, 2020 at 7:09 PM Mark Brown <broonie@kernel.org> wrote:
> > What is DMIC one wire mode? This doesn't sound like something I'd
> > expect to vary at runtime.
> It means: 1 PDM data wire carries 2 channel data (rising edge for left
> and falling edge for right).
I thought that was normal for DMICs - is this selecting between left and
right or something?
> The setting shouldn't and won't change at runtime. Would you suggest
> putting it into DTS binding?
Yes.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: mediatek: mt6358: support DMIC one-wire mode
2020-05-29 13:05 ` Mark Brown
@ 2020-05-29 17:26 ` Tzung-Bi Shih
2020-05-29 18:16 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Tzung-Bi Shih @ 2020-05-29 17:26 UTC (permalink / raw)
To: Mark Brown
Cc: Hariprasad Kelam, Linux Kernel Mailing List, howie.huang,
Takashi Iwai, ALSA development, Jiaxin Yu, Liam Girdwood,
linux-mediatek, Matthias Brugger, linux-arm-kernel
On Fri, May 29, 2020 at 9:05 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Fri, May 29, 2020 at 07:22:43PM +0800, Tzung-Bi Shih wrote:
> > On Fri, May 29, 2020 at 7:09 PM Mark Brown <broonie@kernel.org> wrote:
>
> > > What is DMIC one wire mode? This doesn't sound like something I'd
> > > expect to vary at runtime.
>
> > It means: 1 PDM data wire carries 2 channel data (rising edge for left
> > and falling edge for right).
>
> I thought that was normal for DMICs - is this selecting between left and
> right or something?
Not sure what is the common name but use the same context here.
MT6358 accepts up to 2 PDM wires for 2 DMICs.
If one wire mode is on, MT6358 only accepts 1 PDM wire.
If one wire mode is off, MT6358 merges L/R from 2 PDM wires into 1
I2S-like to SoC.
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: mediatek: mt6358: support DMIC one-wire mode
2020-05-29 17:26 ` Tzung-Bi Shih
@ 2020-05-29 18:16 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2020-05-29 18:16 UTC (permalink / raw)
To: Tzung-Bi Shih
Cc: Hariprasad Kelam, Linux Kernel Mailing List, howie.huang,
Takashi Iwai, ALSA development, Jiaxin Yu, Liam Girdwood,
linux-mediatek, Matthias Brugger, linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 657 bytes --]
On Sat, May 30, 2020 at 01:26:20AM +0800, Tzung-Bi Shih wrote:
> On Fri, May 29, 2020 at 9:05 PM Mark Brown <broonie@kernel.org> wrote:
> > I thought that was normal for DMICs - is this selecting between left and
> > right or something?
> Not sure what is the common name but use the same context here.
> MT6358 accepts up to 2 PDM wires for 2 DMICs.
> If one wire mode is on, MT6358 only accepts 1 PDM wire.
> If one wire mode is off, MT6358 merges L/R from 2 PDM wires into 1
> I2S-like to SoC.
Oh, interesting - so it's essentially a mixer? Not seen that before but
makes sense. In any case this definitely seems like a good fit for a DT
property.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-05-29 18:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29 11:04 [PATCH] ASoC: mediatek: mt6358: support DMIC one-wire mode Jiaxin Yu
2020-05-29 11:09 ` Mark Brown
2020-05-29 11:22 ` Tzung-Bi Shih
2020-05-29 13:05 ` Mark Brown
2020-05-29 17:26 ` Tzung-Bi Shih
2020-05-29 18:16 ` 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).