All of lore.kernel.org
 help / color / mirror / Atom feed
* Cherry Trail + RT5645 devices analog microphone not working.
@ 2017-12-24 10:42 Hans de Goede
  2017-12-25  2:15 ` Bard Liao
  0 siblings, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2017-12-24 10:42 UTC (permalink / raw)
  To: Bard Liao; +Cc: alsa-devel, Pierre-Louis Bossart

Hi Bard,

I've been looking into getting the microphone to work on
some Cherry Trail + RT5645 devices with what appears to
be a simple analog microphone.

You can see the microphone on one of the models I'm trying
to get it to work on soldered onto the right side of the PCB
here: https://i.imgur.com/bJzBQWe.jpg

I'm using this ucm config:

https://fedorapeople.org/~jwrdegoede/chtrt5645/

Which is basically Pierre-Louis Bossart's config from:
https://github.com/plbossart/UCM

Adjusted because the devices all have a mono speaker.

I've been trying to get this to work myself and I can get
some sound while recording by adding:

                 cset "name='RECMIXL BST2 Switch' on"
                 cset "name='RECMIXR BST2 Switch' on"

But then I mainly get noise, I do get some sound from the
microphone if I talk really really loudly, but it is
barely above the noise-floor. I've the feeling that BST2
is only picking up the microphone via cross-talk and
that BST1 indeed is the correct input, but for some reason
I get complete silence when recording when only BST1 is
selected in the RECMIXR, and yes I've checked / set the
"IN1 boost volume".

TL;DR: I'm trying to get an analog mic to work on 3
different models Cherry Trail + RT5645 devices and I've
been unable to get this to work. I've put a registerdump
of the rt5645 with gnome-sound-recorder running here:
https://fedorapeople.org/~jwrdegoede/rt5645-mic-red.dump

Any insights / help with this would be very much
welcome.

Regards,

Hans

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

* Re: Cherry Trail + RT5645 devices analog microphone not working.
  2017-12-24 10:42 Cherry Trail + RT5645 devices analog microphone not working Hans de Goede
@ 2017-12-25  2:15 ` Bard Liao
  2017-12-25 12:02   ` Hans de Goede
  0 siblings, 1 reply; 11+ messages in thread
From: Bard Liao @ 2017-12-25  2:15 UTC (permalink / raw)
  To: Hans de Goede; +Cc: alsa-devel, Pierre-Louis Bossart

> -----Original Message-----
> From: Hans de Goede [mailto:hdegoede@redhat.com]
> Sent: Sunday, December 24, 2017 6:43 PM
> To: Bard Liao
> Cc: Pierre-Louis Bossart; alsa-devel@alsa-project.org
> Subject: Cherry Trail + RT5645 devices analog microphone not working.
> 
> Hi Bard,
> 
> I've been looking into getting the microphone to work on
> some Cherry Trail + RT5645 devices with what appears to
> be a simple analog microphone.
> 
> You can see the microphone on one of the models I'm trying
> to get it to work on soldered onto the right side of the PCB
> here: https://i.imgur.com/bJzBQWe.jpg
> 
> I'm using this ucm config:
> 
> https://fedorapeople.org/~jwrdegoede/chtrt5645/
> 
> Which is basically Pierre-Louis Bossart's config from:
> https://github.com/plbossart/UCM
> 
> Adjusted because the devices all have a mono speaker.
> 
> I've been trying to get this to work myself and I can get
> some sound while recording by adding:
> 
>                  cset "name='RECMIXL BST2 Switch' on"
>                  cset "name='RECMIXR BST2 Switch' on"
> 
> But then I mainly get noise, I do get some sound from the
> microphone if I talk really really loudly, but it is
> barely above the noise-floor. I've the feeling that BST2
> is only picking up the microphone via cross-talk and
> that BST1 indeed is the correct input, but for some reason
> I get complete silence when recording when only BST1 is
> selected in the RECMIXR, and yes I've checked / set the
> "IN1 boost volume".
> 
> TL;DR: I'm trying to get an analog mic to work on 3
> different models Cherry Trail + RT5645 devices and I've
> been unable to get this to work. I've put a registerdump
> of the rt5645 with gnome-sound-recorder running here:
> https://fedorapeople.org/~jwrdegoede/rt5645-mic-red.dump
> 
> Any insights / help with this would be very much
> welcome.

I don't have the schematic, but I think you probably need micbias
for the capture. Please add both "micbias1" and "micbias2" in
the audio route since I don't know which one is needed.
for example
static const struct snd_soc_dapm_route cht_rt5645_audio_map[] = {
...
	{"Int Mic", NULL, "micbias1"},
	{"Int Mic", NULL, "micbias2"},
...
};


> 
> Regards,
> 
> Hans
> 
> ------Please consider the environment before printing this e-mail.

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

* Re: Cherry Trail + RT5645 devices analog microphone not working.
  2017-12-25  2:15 ` Bard Liao
@ 2017-12-25 12:02   ` Hans de Goede
  2017-12-26  5:29     ` Bard Liao
  0 siblings, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2017-12-25 12:02 UTC (permalink / raw)
  To: Bard Liao; +Cc: alsa-devel, Pierre-Louis Bossart

Hi,

On 25-12-17 03:15, Bard Liao wrote:
>> -----Original Message-----
>> From: Hans de Goede [mailto:hdegoede@redhat.com]
>> Sent: Sunday, December 24, 2017 6:43 PM
>> To: Bard Liao
>> Cc: Pierre-Louis Bossart; alsa-devel@alsa-project.org
>> Subject: Cherry Trail + RT5645 devices analog microphone not working.
>>
>> Hi Bard,
>>
>> I've been looking into getting the microphone to work on
>> some Cherry Trail + RT5645 devices with what appears to
>> be a simple analog microphone.
>>
>> You can see the microphone on one of the models I'm trying
>> to get it to work on soldered onto the right side of the PCB
>> here: https://i.imgur.com/bJzBQWe.jpg
>>
>> I'm using this ucm config:
>>
>> https://fedorapeople.org/~jwrdegoede/chtrt5645/
>>
>> Which is basically Pierre-Louis Bossart's config from:
>> https://github.com/plbossart/UCM
>>
>> Adjusted because the devices all have a mono speaker.
>>
>> I've been trying to get this to work myself and I can get
>> some sound while recording by adding:
>>
>>                   cset "name='RECMIXL BST2 Switch' on"
>>                   cset "name='RECMIXR BST2 Switch' on"
>>
>> But then I mainly get noise, I do get some sound from the
>> microphone if I talk really really loudly, but it is
>> barely above the noise-floor. I've the feeling that BST2
>> is only picking up the microphone via cross-talk and
>> that BST1 indeed is the correct input, but for some reason
>> I get complete silence when recording when only BST1 is
>> selected in the RECMIXR, and yes I've checked / set the
>> "IN1 boost volume".
>>
>> TL;DR: I'm trying to get an analog mic to work on 3
>> different models Cherry Trail + RT5645 devices and I've
>> been unable to get this to work. I've put a registerdump
>> of the rt5645 with gnome-sound-recorder running here:
>> https://fedorapeople.org/~jwrdegoede/rt5645-mic-red.dump
>>
>> Any insights / help with this would be very much
>> welcome.
> 
> I don't have the schematic, but I think you probably need micbias
> for the capture. Please add both "micbias1" and "micbias2" in
> the audio route since I don't know which one is needed.
> for example
> static const struct snd_soc_dapm_route cht_rt5645_audio_map[] = {
> ...
> 	{"Int Mic", NULL, "micbias1"},
> 	{"Int Mic", NULL, "micbias2"},
> ...
> };

Thank you for your reply. I've tested this, but unfortunately it
does not help.

Do you perhaps have a cherrytrail device withrt5645 codec where you
can test an analog mic input with the upstream driver + latest ucm
file from Pierre-Louis with yourself ? I've the feeling that this is
not specific to the 3 devices I've access to but a general problem
in the driver and/or the ucm files.

Regards,

Hans

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

* Re: Cherry Trail + RT5645 devices analog microphone not working.
  2017-12-25 12:02   ` Hans de Goede
@ 2017-12-26  5:29     ` Bard Liao
  2017-12-27 19:12       ` Hans de Goede
  0 siblings, 1 reply; 11+ messages in thread
From: Bard Liao @ 2017-12-26  5:29 UTC (permalink / raw)
  To: Hans de Goede; +Cc: alsa-devel, Pierre-Louis Bossart

[-- Attachment #1: Type: text/plain, Size: 3551 bytes --]

> -----Original Message-----
> From: Hans de Goede [mailto:hdegoede@redhat.com]
> Sent: Monday, December 25, 2017 8:03 PM
> To: Bard Liao
> Cc: Pierre-Louis Bossart; alsa-devel@alsa-project.org
> Subject: Re: Cherry Trail + RT5645 devices analog microphone not working.
> 
> Hi,
> 
> On 25-12-17 03:15, Bard Liao wrote:
> >> -----Original Message-----
> >> From: Hans de Goede [mailto:hdegoede@redhat.com]
> >> Sent: Sunday, December 24, 2017 6:43 PM
> >> To: Bard Liao
> >> Cc: Pierre-Louis Bossart; alsa-devel@alsa-project.org
> >> Subject: Cherry Trail + RT5645 devices analog microphone not working.
> >>
> >> Hi Bard,
> >>
> >> I've been looking into getting the microphone to work on
> >> some Cherry Trail + RT5645 devices with what appears to
> >> be a simple analog microphone.
> >>
> >> You can see the microphone on one of the models I'm trying
> >> to get it to work on soldered onto the right side of the PCB
> >> here: https://i.imgur.com/bJzBQWe.jpg
> >>
> >> I'm using this ucm config:
> >>
> >> https://fedorapeople.org/~jwrdegoede/chtrt5645/
> >>
> >> Which is basically Pierre-Louis Bossart's config from:
> >> https://github.com/plbossart/UCM
> >>
> >> Adjusted because the devices all have a mono speaker.
> >>
> >> I've been trying to get this to work myself and I can get
> >> some sound while recording by adding:
> >>
> >>                   cset "name='RECMIXL BST2 Switch' on"
> >>                   cset "name='RECMIXR BST2 Switch' on"
> >>
> >> But then I mainly get noise, I do get some sound from the
> >> microphone if I talk really really loudly, but it is
> >> barely above the noise-floor. I've the feeling that BST2
> >> is only picking up the microphone via cross-talk and
> >> that BST1 indeed is the correct input, but for some reason
> >> I get complete silence when recording when only BST1 is
> >> selected in the RECMIXR, and yes I've checked / set the
> >> "IN1 boost volume".
> >>
> >> TL;DR: I'm trying to get an analog mic to work on 3
> >> different models Cherry Trail + RT5645 devices and I've
> >> been unable to get this to work. I've put a registerdump
> >> of the rt5645 with gnome-sound-recorder running here:
> >> https://fedorapeople.org/~jwrdegoede/rt5645-mic-red.dump
> >>
> >> Any insights / help with this would be very much
> >> welcome.
> >
> > I don't have the schematic, but I think you probably need micbias
> > for the capture. Please add both "micbias1" and "micbias2" in
> > the audio route since I don't know which one is needed.
> > for example
> > static const struct snd_soc_dapm_route cht_rt5645_audio_map[] = {
> > ...
> > 	{"Int Mic", NULL, "micbias1"},
> > 	{"Int Mic", NULL, "micbias2"},
> > ...
> > };
> 
> Thank you for your reply. I've tested this, but unfortunately it
> does not help.
> 
> Do you perhaps have a cherrytrail device withrt5645 codec where you
> can test an analog mic input with the upstream driver + latest ucm
> file from Pierre-Louis with yourself ? I've the feeling that this is
> not specific to the 3 devices I've access to but a general problem
> in the driver and/or the ucm files.

Please try the attached patch. I don't have any cherrytrail device with
rt5645 codec. But I verified the register settings on my rt5645 EVB.
If the patch doesn't work, please dump register for me.
Note that adding "micbias1" and "micbias2 in the audio route is also
needed.

> 
> Regards,
> 
> Hans
> 
> ------Please consider the environment before printing this e-mail.

[-- Attachment #2: 0001-ASoC-rt5645-add-micbias-power-control-select.patch --]
[-- Type: application/octet-stream, Size: 3563 bytes --]

From ac31131da72867e6fb14b6e16aab1f439c6f33fd Mon Sep 17 00:00:00 2001
From: Bard Liao <bardliao@realtek.com>
Date: Tue, 26 Dec 2017 11:36:45 +0800
Subject: [PATCH] ASoC: rt5645: add micbias power control select.

We need to set a corresponding control bit before powering micbias up.

Signed-off-by: Bard Liao <bardliao@realtek.com>
---
 sound/soc/codecs/rt5645.c | 58 +++++++++++++++++++++++++++++++++++++++++++++--
 sound/soc/codecs/rt5645.h |  6 +++++
 2 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 27a3d3d..f556cb8 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -1941,6 +1941,58 @@ static int rt5650_hp_event(struct snd_soc_dapm_widget *w,
 	return 0;
 }
 
+static int rt5645_set_micbias1_event(struct snd_soc_dapm_widget *w,
+		struct snd_kcontrol *k, int  event)
+{
+	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+	struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec);
+
+	switch (event) {
+	case SND_SOC_DAPM_PRE_PMU:
+		snd_soc_update_bits(codec, RT5645_GEN_CTRL2,
+			RT5645_MICBIAS1_POW_CTRL_SEL_MASK,
+			RT5645_MICBIAS1_POW_CTRL_SEL_M);
+		break;
+
+	case SND_SOC_DAPM_POST_PMD:
+		snd_soc_update_bits(codec, RT5645_GEN_CTRL2,
+			RT5645_MICBIAS1_POW_CTRL_SEL_MASK,
+			RT5645_MICBIAS1_POW_CTRL_SEL_A);
+		break;
+
+	default:
+		return 0;
+	}
+
+	return 0;
+}
+
+static int rt5645_set_micbias2_event(struct snd_soc_dapm_widget *w,
+		struct snd_kcontrol *k, int  event)
+{
+	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+	struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec);
+
+	switch (event) {
+	case SND_SOC_DAPM_PRE_PMU:
+		snd_soc_update_bits(codec, RT5645_GEN_CTRL2,
+			RT5645_MICBIAS2_POW_CTRL_SEL_MASK,
+			RT5645_MICBIAS2_POW_CTRL_SEL_M);
+		break;
+
+	case SND_SOC_DAPM_POST_PMD:
+		snd_soc_update_bits(codec, RT5645_GEN_CTRL2,
+			RT5645_MICBIAS2_POW_CTRL_SEL_MASK,
+			RT5645_MICBIAS2_POW_CTRL_SEL_A);
+		break;
+
+	default:
+		return 0;
+	}
+
+	return 0;
+}
+
 static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = {
 	SND_SOC_DAPM_SUPPLY("LDO2", RT5645_PWR_MIXER,
 		RT5645_PWR_LDO2_BIT, 0, NULL, 0),
@@ -1979,9 +2031,11 @@ static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = {
 	/* Input Side */
 	/* micbias */
 	SND_SOC_DAPM_SUPPLY("micbias1", RT5645_PWR_ANLG2,
-			RT5645_PWR_MB1_BIT, 0, NULL, 0),
+			RT5645_PWR_MB1_BIT, 0, rt5645_set_micbias1_event,
+			SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
 	SND_SOC_DAPM_SUPPLY("micbias2", RT5645_PWR_ANLG2,
-			RT5645_PWR_MB2_BIT, 0, NULL, 0),
+			RT5645_PWR_MB2_BIT, 0, rt5645_set_micbias2_event,
+			SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
 	/* Input Lines */
 	SND_SOC_DAPM_INPUT("DMIC L1"),
 	SND_SOC_DAPM_INPUT("DMIC R1"),
diff --git a/sound/soc/codecs/rt5645.h b/sound/soc/codecs/rt5645.h
index cfc5f97..940325b 100644
--- a/sound/soc/codecs/rt5645.h
+++ b/sound/soc/codecs/rt5645.h
@@ -2117,6 +2117,12 @@ enum {
 #define RT5645_RXDC_SRC_STO			(0x0 << 7)
 #define RT5645_RXDC_SRC_MONO			(0x1 << 7)
 #define RT5645_RXDC_SRC_SFT			(7)
+#define RT5645_MICBIAS1_POW_CTRL_SEL_MASK	(0x1 << 5)
+#define RT5645_MICBIAS1_POW_CTRL_SEL_A		(0x0 << 5)
+#define RT5645_MICBIAS1_POW_CTRL_SEL_M		(0x1 << 5)
+#define RT5645_MICBIAS2_POW_CTRL_SEL_MASK	(0x1 << 4)
+#define RT5645_MICBIAS2_POW_CTRL_SEL_A		(0x0 << 4)
+#define RT5645_MICBIAS2_POW_CTRL_SEL_M		(0x1 << 4)
 #define RT5645_RXDP2_SEL_MASK			(0x1 << 3)
 #define RT5645_RXDP2_SEL_IF2			(0x0 << 3)
 #define RT5645_RXDP2_SEL_ADC			(0x1 << 3)
-- 
2.7.4


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



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

* Re: Cherry Trail + RT5645 devices analog microphone not working.
  2017-12-26  5:29     ` Bard Liao
@ 2017-12-27 19:12       ` Hans de Goede
  2017-12-28  3:05         ` Bard Liao
  0 siblings, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2017-12-27 19:12 UTC (permalink / raw)
  To: Bard Liao; +Cc: alsa-devel, Pierre-Louis Bossart

[-- Attachment #1: Type: text/plain, Size: 4684 bytes --]

Hi,

On 26-12-17 06:29, Bard Liao wrote:
>> -----Original Message-----
>> From: Hans de Goede [mailto:hdegoede@redhat.com]
>> Sent: Monday, December 25, 2017 8:03 PM
>> To: Bard Liao
>> Cc: Pierre-Louis Bossart; alsa-devel@alsa-project.org
>> Subject: Re: Cherry Trail + RT5645 devices analog microphone not working.
>>
>> Hi,
>>
>> On 25-12-17 03:15, Bard Liao wrote:
>>>> -----Original Message-----
>>>> From: Hans de Goede [mailto:hdegoede@redhat.com]
>>>> Sent: Sunday, December 24, 2017 6:43 PM
>>>> To: Bard Liao
>>>> Cc: Pierre-Louis Bossart; alsa-devel@alsa-project.org
>>>> Subject: Cherry Trail + RT5645 devices analog microphone not working.
>>>>
>>>> Hi Bard,
>>>>
>>>> I've been looking into getting the microphone to work on
>>>> some Cherry Trail + RT5645 devices with what appears to
>>>> be a simple analog microphone.
>>>>
>>>> You can see the microphone on one of the models I'm trying
>>>> to get it to work on soldered onto the right side of the PCB
>>>> here: https://i.imgur.com/bJzBQWe.jpg
>>>>
>>>> I'm using this ucm config:
>>>>
>>>> https://fedorapeople.org/~jwrdegoede/chtrt5645/
>>>>
>>>> Which is basically Pierre-Louis Bossart's config from:
>>>> https://github.com/plbossart/UCM
>>>>
>>>> Adjusted because the devices all have a mono speaker.
>>>>
>>>> I've been trying to get this to work myself and I can get
>>>> some sound while recording by adding:
>>>>
>>>>                    cset "name='RECMIXL BST2 Switch' on"
>>>>                    cset "name='RECMIXR BST2 Switch' on"
>>>>
>>>> But then I mainly get noise, I do get some sound from the
>>>> microphone if I talk really really loudly, but it is
>>>> barely above the noise-floor. I've the feeling that BST2
>>>> is only picking up the microphone via cross-talk and
>>>> that BST1 indeed is the correct input, but for some reason
>>>> I get complete silence when recording when only BST1 is
>>>> selected in the RECMIXR, and yes I've checked / set the
>>>> "IN1 boost volume".
>>>>
>>>> TL;DR: I'm trying to get an analog mic to work on 3
>>>> different models Cherry Trail + RT5645 devices and I've
>>>> been unable to get this to work. I've put a registerdump
>>>> of the rt5645 with gnome-sound-recorder running here:
>>>> https://fedorapeople.org/~jwrdegoede/rt5645-mic-red.dump
>>>>
>>>> Any insights / help with this would be very much
>>>> welcome.
>>>
>>> I don't have the schematic, but I think you probably need micbias
>>> for the capture. Please add both "micbias1" and "micbias2" in
>>> the audio route since I don't know which one is needed.
>>> for example
>>> static const struct snd_soc_dapm_route cht_rt5645_audio_map[] = {
>>> ...
>>> 	{"Int Mic", NULL, "micbias1"},
>>> 	{"Int Mic", NULL, "micbias2"},
>>> ...
>>> };
>>
>> Thank you for your reply. I've tested this, but unfortunately it
>> does not help.
>>
>> Do you perhaps have a cherrytrail device withrt5645 codec where you
>> can test an analog mic input with the upstream driver + latest ucm
>> file from Pierre-Louis with yourself ? I've the feeling that this is
>> not specific to the 3 devices I've access to but a general problem
>> in the driver and/or the ucm files.
> 
> Please try the attached patch. I don't have any cherrytrail device with
> rt5645 codec. But I verified the register settings on my rt5645 EVB.
> If the patch doesn't work, please dump register for me.
> Note that adding "micbias1" and "micbias2 in the audio route is also
> needed.

Thank you, modifying the RT5645_GEN_CTRL2 reg seems to help, for
some reason the patch does not work and neither MB1 and MB2 in reg
0x64 nor the RT5645_GEN_CTRL2 changes happen, but after manually
applying these with i2cset I can actual use the mic, although there
is still quite a bit of white noise in the background.

Attached is a regdump after making the manual changes to reg 0x64 and
reg 0xfb.

I did add the micbias audio routes:

@@ -2297,6 +2297,9 @@ static const struct snd_soc_dapm_route rt5645_dapm_routes[] = {
  	{ "DMIC2", NULL, "DMIC L2" },
  	{ "DMIC2", NULL, "DMIC R2" },

+	{ "Int Mic", NULL, "micbias1" },
+	{ "Int Mic", NULL, "micbias2" },
+
  	{ "BST1", NULL, "IN1P" },
  	{ "BST1", NULL, "IN1N" },
  	{ "BST1", NULL, "JD Power" },

But I believe that your tree has some patches which are not upstream yet,
the last patch you attached expects the micbias1 and micbias2 lines
in the widget lists to be of the "SND_SOC_DAPM_SUPPLY" type, but here:
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/sound/soc/codecs/rt5645.c?h=topic/rt5645

They are still of the SND_SOC_DAPM_MICBIAS type.

Regards,

Hans


> 
>>
>> Regards,
>>
>> Hans
>>
>> ------Please consider the environment before printing this e-mail.

[-- Attachment #2: rt5645-mic-red.dump --]
[-- Type: text/plain, Size: 2570 bytes --]

000: 0000
001: 8888
002: c8c8
003: c8c8
004: c80a
005: 0000
006: 0000
007: 0000
008: 0000
009: 0000
00a: 7002
00b: 3827
00c: e000
00d: 0300
00e: 0000
00f: 0000
010: 0000
011: 0000
012: 0000
013: 0000
014: 3333
015: 0000
016: 4b00
017: 0000
018: 018b
019: afaf
01a: afaf
01b: 0011
01c: 3f3f
01d: 7f7f
01e: 5000
01f: 0000
020: a000
021: 0000
022: 0000
023: 0000
024: 0000
025: 0000
026: 0000
027: 3820
028: 3838
029: c0c0
02a: 1456
02b: 0404
02c: aaa0
02d: 0000
02e: 0000
02f: 1002
030: 0000
031: 5000
032: 0000
033: 0000
034: 0000
035: 0000
036: 0000
037: 0000
038: 0000
039: 0000
03a: 0000
03b: 0000
03c: 007b
03d: 0000
03e: 007b
03f: 0000
040: 001c
041: 0000
042: 001c
043: 0000
044: 0000
045: 5000
046: 0038
047: 0038
048: d806
049: 0000
04a: 0004
04b: 0000
04c: 031f
04d: 0000
04e: 0000
04f: 01ff
050: 0000
051: 0000
052: 01ff
053: f000
054: 0000
055: 0000
056: 0111
057: 0064
058: ef0e
059: f0f0
05a: ef0e
05b: f0f0
05c: ef0e
05d: f0f0
05e: f000
05f: 0000
060: 0000
061: 8006
062: e000
063: e8da
064: 4e24
065: 0c02
066: 0000
067: 0000
068: 0000
069: 0000
06a: 0000
06b: 0000
06c: 0aaa
06d: 0000
06e: 0000
06f: 0000
070: 8083
071: 8000
072: 8000
073: 1770
074: 3e00
075: 2409
076: 000a
077: 5800
078: 0000
079: 0123
07a: 8000
07b: 0000
07c: 0000
07d: 0000
07e: 0000
07f: 0000
080: 4000
081: 0f03
082: 3000
083: 0808
084: 1111
085: 0000
086: 0008
087: 0000
088: 0000
089: 0000
08a: 0120
08b: 0000
08c: 0003
08d: 0000
08e: 0004
08f: 1140
090: 0646
091: 0c06
092: 0000
093: 0108
094: 0222
095: 0000
096: 0000
097: 0000
098: 0000
099: 0000
09a: 2184
09b: 010a
09c: 0aea
09d: 000c
09e: 0400
09f: 0000
0a0: a0e8
0a1: 0059
0a2: 0001
0a3: 0000
0a4: 0000
0a5: 0000
0a6: 0000
0a7: 0000
0a8: 0000
0a9: 0000
0aa: 0000
0ab: 0000
0ac: 0000
0ad: 0000
0ae: 6000
0af: 0000
0b0: 6000
0b1: 0000
0b2: 0000
0b3: 001f
0b4: 020c
0b5: 1f00
0b6: 0000
0b7: 4000
0b8: 0000
0b9: 0000
0ba: 0000
0bb: 0000
0bc: 0000
0bd: 0200
0be: 0100
0bf: 1180
0c0: 8000
0c1: 0000
0c2: 0000
0c3: 2000
0c4: 0000
0c5: 0000
0c6: 0000
0c7: 0000
0c8: 0000
0c9: 0000
0ca: 0000
0cb: 0000
0cc: 0000
0cd: 0000
0ce: 0000
0cf: 1814
0d0: 0690
0d1: 1c17
0d2: 0000
0d3: b320
0d4: 0000
0d5: 0000
0d6: 0400
0d7: 0000
0d8: 0000
0d9: 0809
0da: 0000
0db: 0003
0dc: 0049
0dd: 001b
0de: 0000
0df: 0000
0e0: 0000
0e1: 0000
0e2: 0000
0e3: 0000
0e4: 0000
0e5: 0000
0e6: 8000
0e7: 0700
0e8: 8000
0e9: 0700
0ea: 0f20
0eb: 0000
0ec: b300
0ed: 0000
0ee: 0000
0ef: 0000
0f0: 001f
0f1: 020c
0f2: 1f00
0f3: 0000
0f4: 4000
0f5: 0000
0f6: 0000
0f7: 0000
0f8: 0000
0f9: 0000
0fa: 2061
0fb: 4070
0fc: 1800
0fd: 0004
0fe: 10ec
0ff: 6308
100: 0000

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



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

* Re: Cherry Trail + RT5645 devices analog microphone not working.
  2017-12-27 19:12       ` Hans de Goede
@ 2017-12-28  3:05         ` Bard Liao
  2017-12-29  0:22           ` Hans de Goede
  0 siblings, 1 reply; 11+ messages in thread
From: Bard Liao @ 2017-12-28  3:05 UTC (permalink / raw)
  To: Hans de Goede; +Cc: alsa-devel, Pierre-Louis Bossart

[-- Attachment #1: Type: text/plain, Size: 6022 bytes --]

> -----Original Message-----
> From: Hans de Goede [mailto:hdegoede@redhat.com]
> Sent: Thursday, December 28, 2017 3:13 AM
> To: Bard Liao
> Cc: Pierre-Louis Bossart; alsa-devel@alsa-project.org
> Subject: Re: Cherry Trail + RT5645 devices analog microphone not working.
> 
> Hi,
> 
> On 26-12-17 06:29, Bard Liao wrote:
> >> -----Original Message-----
> >> From: Hans de Goede [mailto:hdegoede@redhat.com]
> >> Sent: Monday, December 25, 2017 8:03 PM
> >> To: Bard Liao
> >> Cc: Pierre-Louis Bossart; alsa-devel@alsa-project.org
> >> Subject: Re: Cherry Trail + RT5645 devices analog microphone not working.
> >>
> >> Hi,
> >>
> >> On 25-12-17 03:15, Bard Liao wrote:
> >>>> -----Original Message-----
> >>>> From: Hans de Goede [mailto:hdegoede@redhat.com]
> >>>> Sent: Sunday, December 24, 2017 6:43 PM
> >>>> To: Bard Liao
> >>>> Cc: Pierre-Louis Bossart; alsa-devel@alsa-project.org
> >>>> Subject: Cherry Trail + RT5645 devices analog microphone not working.
> >>>>
> >>>> Hi Bard,
> >>>>
> >>>> I've been looking into getting the microphone to work on
> >>>> some Cherry Trail + RT5645 devices with what appears to
> >>>> be a simple analog microphone.
> >>>>
> >>>> You can see the microphone on one of the models I'm trying
> >>>> to get it to work on soldered onto the right side of the PCB
> >>>> here: https://i.imgur.com/bJzBQWe.jpg
> >>>>
> >>>> I'm using this ucm config:
> >>>>
> >>>> https://fedorapeople.org/~jwrdegoede/chtrt5645/
> >>>>
> >>>> Which is basically Pierre-Louis Bossart's config from:
> >>>> https://github.com/plbossart/UCM
> >>>>
> >>>> Adjusted because the devices all have a mono speaker.
> >>>>
> >>>> I've been trying to get this to work myself and I can get
> >>>> some sound while recording by adding:
> >>>>
> >>>>                    cset "name='RECMIXL BST2 Switch' on"
> >>>>                    cset "name='RECMIXR BST2 Switch' on"
> >>>>
> >>>> But then I mainly get noise, I do get some sound from the
> >>>> microphone if I talk really really loudly, but it is
> >>>> barely above the noise-floor. I've the feeling that BST2
> >>>> is only picking up the microphone via cross-talk and
> >>>> that BST1 indeed is the correct input, but for some reason
> >>>> I get complete silence when recording when only BST1 is
> >>>> selected in the RECMIXR, and yes I've checked / set the
> >>>> "IN1 boost volume".
> >>>>
> >>>> TL;DR: I'm trying to get an analog mic to work on 3
> >>>> different models Cherry Trail + RT5645 devices and I've
> >>>> been unable to get this to work. I've put a registerdump
> >>>> of the rt5645 with gnome-sound-recorder running here:
> >>>> https://fedorapeople.org/~jwrdegoede/rt5645-mic-red.dump
> >>>>
> >>>> Any insights / help with this would be very much
> >>>> welcome.
> >>>
> >>> I don't have the schematic, but I think you probably need micbias
> >>> for the capture. Please add both "micbias1" and "micbias2" in
> >>> the audio route since I don't know which one is needed.
> >>> for example
> >>> static const struct snd_soc_dapm_route cht_rt5645_audio_map[] = {
> >>> ...
> >>> 	{"Int Mic", NULL, "micbias1"},
> >>> 	{"Int Mic", NULL, "micbias2"},
> >>> ...
> >>> };
> >>
> >> Thank you for your reply. I've tested this, but unfortunately it
> >> does not help.
> >>
> >> Do you perhaps have a cherrytrail device withrt5645 codec where you
> >> can test an analog mic input with the upstream driver + latest ucm
> >> file from Pierre-Louis with yourself ? I've the feeling that this is
> >> not specific to the 3 devices I've access to but a general problem
> >> in the driver and/or the ucm files.
> >
> > Please try the attached patch. I don't have any cherrytrail device with
> > rt5645 codec. But I verified the register settings on my rt5645 EVB.
> > If the patch doesn't work, please dump register for me.
> > Note that adding "micbias1" and "micbias2 in the audio route is also
> > needed.
> 
> Thank you, modifying the RT5645_GEN_CTRL2 reg seems to help, for
> some reason the patch does not work and neither MB1 and MB2 in reg
> 0x64 nor the RT5645_GEN_CTRL2 changes happen, but after manually
> applying these with i2cset I can actual use the mic, although there
> is still quite a bit of white noise in the background.

I think the reason why the patch didn't work is because "micbias1"
and "micbias2" are not connected to the audio route. The white
noise probably because the gain is too high. And if you are using a
differential mic, please set rt5645->pdata.in2_diff = true;

> 
> Attached is a regdump after making the manual changes to reg 0x64 and
> reg 0xfb.
> 
> I did add the micbias audio routes:
> 
> @@ -2297,6 +2297,9 @@ static const struct snd_soc_dapm_route
> rt5645_dapm_routes[] = {
>   	{ "DMIC2", NULL, "DMIC L2" },
>   	{ "DMIC2", NULL, "DMIC R2" },
> 
> +	{ "Int Mic", NULL, "micbias1" },
> +	{ "Int Mic", NULL, "micbias2" },
> +
>   	{ "BST1", NULL, "IN1P" },
>   	{ "BST1", NULL, "IN1N" },
>   	{ "BST1", NULL, "JD Power" },

 +	{ "Int Mic", NULL, "micbias1" },
 +	{ "Int Mic", NULL, "micbias2" },
should add in machine driver.
Please make sure "Int Mic" is registered and its connected to
"IN1P" and "IN1N". Like
{"IN1P", NULL, "Int Mic"},
{"IN1N", NULL, "Int Mic"},
Or you can share your machine driver so I can check it.

> 
> But I believe that your tree has some patches which are not upstream yet,
> the last patch you attached expects the micbias1 and micbias2 lines
> in the widget lists to be of the "SND_SOC_DAPM_SUPPLY" type, but here:
> https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/sound/
> soc/codecs/rt5645.c?h=topic/rt5645
> 
> They are still of the SND_SOC_DAPM_MICBIAS type.

Sorry, I forget to send the attached patch to upstream.
Please apply it first.

> 
> Regards,
> 
> Hans
> 
> 
> >
> >>
> >> Regards,
> >>
> >> Hans
> >>
> >> ------Please consider the environment before printing this e-mail.

[-- Attachment #2: 0001-ASoC-rt5645-change-micbias-widget-type-to-supply.patch --]
[-- Type: application/octet-stream, Size: 1161 bytes --]

From 28f4e76ca76129d8e5f547cdbb36ac3f56207455 Mon Sep 17 00:00:00 2001
From: Bard Liao <bardliao@realtek.com>
Date: Thu, 31 Aug 2017 13:34:57 +0800
Subject: [PATCH] ASoC: rt5645: change micbias widget type to supply.

Register "micbias1" and "micbias2" to supply widegts as modern drivers do.

Signed-off-by: Bard Liao <bardliao@realtek.com>
---
 sound/soc/codecs/rt5645.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index cd82302..8f37afd 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -1977,10 +1977,10 @@ static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = {
 
 	/* Input Side */
 	/* micbias */
-	SND_SOC_DAPM_MICBIAS("micbias1", RT5645_PWR_ANLG2,
-			RT5645_PWR_MB1_BIT, 0),
-	SND_SOC_DAPM_MICBIAS("micbias2", RT5645_PWR_ANLG2,
-			RT5645_PWR_MB2_BIT, 0),
+	SND_SOC_DAPM_SUPPLY("micbias1", RT5645_PWR_ANLG2,
+			RT5645_PWR_MB1_BIT, 0, NULL, 0),
+	SND_SOC_DAPM_SUPPLY("micbias2", RT5645_PWR_ANLG2,
+			RT5645_PWR_MB2_BIT, 0, NULL, 0),
 	/* Input Lines */
 	SND_SOC_DAPM_INPUT("DMIC L1"),
 	SND_SOC_DAPM_INPUT("DMIC R1"),
-- 
2.7.4


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



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

* Re: Cherry Trail + RT5645 devices analog microphone not working.
  2017-12-28  3:05         ` Bard Liao
@ 2017-12-29  0:22           ` Hans de Goede
  2017-12-29  2:10             ` Bard Liao
  0 siblings, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2017-12-29  0:22 UTC (permalink / raw)
  To: Bard Liao; +Cc: alsa-devel, Pierre-Louis Bossart

Hi,

On 28-12-17 04:05, Bard Liao wrote:
>> -----Original Message-----
>> From: Hans de Goede [mailto:hdegoede@redhat.com]
>> Sent: Thursday, December 28, 2017 3:13 AM
>> To: Bard Liao
>> Cc: Pierre-Louis Bossart; alsa-devel@alsa-project.org
>> Subject: Re: Cherry Trail + RT5645 devices analog microphone not working.
>>
>> Hi,
>>
>> On 26-12-17 06:29, Bard Liao wrote:
>>>> -----Original Message-----
>>>> From: Hans de Goede [mailto:hdegoede@redhat.com]
>>>> Sent: Monday, December 25, 2017 8:03 PM
>>>> To: Bard Liao
>>>> Cc: Pierre-Louis Bossart; alsa-devel@alsa-project.org
>>>> Subject: Re: Cherry Trail + RT5645 devices analog microphone not working.
>>>>
>>>> Hi,
>>>>
>>>> On 25-12-17 03:15, Bard Liao wrote:
>>>>>> -----Original Message-----
>>>>>> From: Hans de Goede [mailto:hdegoede@redhat.com]
>>>>>> Sent: Sunday, December 24, 2017 6:43 PM
>>>>>> To: Bard Liao
>>>>>> Cc: Pierre-Louis Bossart; alsa-devel@alsa-project.org
>>>>>> Subject: Cherry Trail + RT5645 devices analog microphone not working.
>>>>>>
>>>>>> Hi Bard,
>>>>>>
>>>>>> I've been looking into getting the microphone to work on
>>>>>> some Cherry Trail + RT5645 devices with what appears to
>>>>>> be a simple analog microphone.
>>>>>>
>>>>>> You can see the microphone on one of the models I'm trying
>>>>>> to get it to work on soldered onto the right side of the PCB
>>>>>> here: https://i.imgur.com/bJzBQWe.jpg
>>>>>>
>>>>>> I'm using this ucm config:
>>>>>>
>>>>>> https://fedorapeople.org/~jwrdegoede/chtrt5645/
>>>>>>
>>>>>> Which is basically Pierre-Louis Bossart's config from:
>>>>>> https://github.com/plbossart/UCM
>>>>>>
>>>>>> Adjusted because the devices all have a mono speaker.
>>>>>>
>>>>>> I've been trying to get this to work myself and I can get
>>>>>> some sound while recording by adding:
>>>>>>
>>>>>>                     cset "name='RECMIXL BST2 Switch' on"
>>>>>>                     cset "name='RECMIXR BST2 Switch' on"
>>>>>>
>>>>>> But then I mainly get noise, I do get some sound from the
>>>>>> microphone if I talk really really loudly, but it is
>>>>>> barely above the noise-floor. I've the feeling that BST2
>>>>>> is only picking up the microphone via cross-talk and
>>>>>> that BST1 indeed is the correct input, but for some reason
>>>>>> I get complete silence when recording when only BST1 is
>>>>>> selected in the RECMIXR, and yes I've checked / set the
>>>>>> "IN1 boost volume".
>>>>>>
>>>>>> TL;DR: I'm trying to get an analog mic to work on 3
>>>>>> different models Cherry Trail + RT5645 devices and I've
>>>>>> been unable to get this to work. I've put a registerdump
>>>>>> of the rt5645 with gnome-sound-recorder running here:
>>>>>> https://fedorapeople.org/~jwrdegoede/rt5645-mic-red.dump
>>>>>>
>>>>>> Any insights / help with this would be very much
>>>>>> welcome.
>>>>>
>>>>> I don't have the schematic, but I think you probably need micbias
>>>>> for the capture. Please add both "micbias1" and "micbias2" in
>>>>> the audio route since I don't know which one is needed.
>>>>> for example
>>>>> static const struct snd_soc_dapm_route cht_rt5645_audio_map[] = {
>>>>> ...
>>>>> 	{"Int Mic", NULL, "micbias1"},
>>>>> 	{"Int Mic", NULL, "micbias2"},
>>>>> ...
>>>>> };
>>>>
>>>> Thank you for your reply. I've tested this, but unfortunately it
>>>> does not help.
>>>>
>>>> Do you perhaps have a cherrytrail device withrt5645 codec where you
>>>> can test an analog mic input with the upstream driver + latest ucm
>>>> file from Pierre-Louis with yourself ? I've the feeling that this is
>>>> not specific to the 3 devices I've access to but a general problem
>>>> in the driver and/or the ucm files.
>>>
>>> Please try the attached patch. I don't have any cherrytrail device with
>>> rt5645 codec. But I verified the register settings on my rt5645 EVB.
>>> If the patch doesn't work, please dump register for me.
>>> Note that adding "micbias1" and "micbias2 in the audio route is also
>>> needed.
>>
>> Thank you, modifying the RT5645_GEN_CTRL2 reg seems to help, for
>> some reason the patch does not work and neither MB1 and MB2 in reg
>> 0x64 nor the RT5645_GEN_CTRL2 changes happen, but after manually
>> applying these with i2cset I can actual use the mic, although there
>> is still quite a bit of white noise in the background.
> 
> I think the reason why the patch didn't work is because "micbias1"
> and "micbias2" are not connected to the audio route. The white
> noise probably because the gain is too high. And if you are using a
> differential mic, please set rt5645->pdata.in2_diff = true;
> 
>>
>> Attached is a regdump after making the manual changes to reg 0x64 and
>> reg 0xfb.
>>
>> I did add the micbias audio routes:
>>
>> @@ -2297,6 +2297,9 @@ static const struct snd_soc_dapm_route
>> rt5645_dapm_routes[] = {
>>    	{ "DMIC2", NULL, "DMIC L2" },
>>    	{ "DMIC2", NULL, "DMIC R2" },
>>
>> +	{ "Int Mic", NULL, "micbias1" },
>> +	{ "Int Mic", NULL, "micbias2" },
>> +
>>    	{ "BST1", NULL, "IN1P" },
>>    	{ "BST1", NULL, "IN1N" },
>>    	{ "BST1", NULL, "JD Power" },
> 
>   +	{ "Int Mic", NULL, "micbias1" },
>   +	{ "Int Mic", NULL, "micbias2" },
> should add in machine driver.
> Please make sure "Int Mic" is registered and its connected to
> "IN1P" and "IN1N". Like
> {"IN1P", NULL, "Int Mic"},
> {"IN1N", NULL, "Int Mic"},
> Or you can share your machine driver so I can check it.

Ah yes, adding these in the machine driver instead of
the codec driver did the trick.

Actually I ended up making some changes, as mentioned
before the BST2 input seemed to be the one which had the mic,
so I ended up doing this:

--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -126,6 +126,8 @@ static const struct snd_soc_dapm_widget cht_dapm_widgets[] =
  static const struct snd_soc_dapm_route cht_rt5645_audio_map[] = {
         {"IN1P", NULL, "Headset Mic"},
         {"IN1N", NULL, "Headset Mic"},
+       {"IN2P", NULL, "Int Mic"},
+       {"IN2N", NULL, "Int Mic"},
         {"DMIC L1", NULL, "Int Mic"},
         {"DMIC R1", NULL, "Int Mic"},
         {"Headphone", NULL, "HPOL"},
@@ -135,6 +137,7 @@ static const struct snd_soc_dapm_route cht_rt5645_audio_map[
         {"Headphone", NULL, "Platform Clock"},
         {"Headset Mic", NULL, "Platform Clock"},
         {"Int Mic", NULL, "Platform Clock"},
+       {"Int Mic", NULL, "micbias2"},
         {"Ext Spk", NULL, "Platform Clock"},
  };


As you can see I only need micbas2 and I routed IN2P and IN2N to Int Mic,
not IN1P and IN2P, this combined with changing the ucm file to
enable disable BST2 rather then BST1 in RECMIXL/R makes the analog
microphone work on one of my devices (I've not yet tested the others).

When I've some more time for this I will also try this on the 2 other
cht + rt5645 devices I've and I will also try the headphone mic input,
I guess that that may need micbias1 enabling.

Some questions for you:

1) I think enabling micbias2 may be a problem on devices with a DMIC,
could this be a problem?  Currently the codec driver itself contains
quirks for dmic pin-mapping, maybe we should leave micbias2 disabled
if dmic pin-mapping is specified through a quirk?

2) Do headset mics normally need a bias current? Could this be headset
dependent?

Regards,

Hans



> 
>>
>> But I believe that your tree has some patches which are not upstream yet,
>> the last patch you attached expects the micbias1 and micbias2 lines
>> in the widget lists to be of the "SND_SOC_DAPM_SUPPLY" type, but here:
>> https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/sound/
>> soc/codecs/rt5645.c?h=topic/rt5645
>>
>> They are still of the SND_SOC_DAPM_MICBIAS type.
> 
> Sorry, I forget to send the attached patch to upstream.
> Please apply it first.
> 
>>
>> Regards,
>>
>> Hans
>>
>>
>>>
>>>>
>>>> Regards,
>>>>
>>>> Hans
>>>>
>>>> ------Please consider the environment before printing this e-mail.

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

* Re: Cherry Trail + RT5645 devices analog microphone not working.
  2017-12-29  0:22           ` Hans de Goede
@ 2017-12-29  2:10             ` Bard Liao
  2018-01-01 12:31               ` Hans de Goede
  0 siblings, 1 reply; 11+ messages in thread
From: Bard Liao @ 2017-12-29  2:10 UTC (permalink / raw)
  To: Hans de Goede; +Cc: alsa-devel, Pierre-Louis Bossart

> Some questions for you:
> 
> 1) I think enabling micbias2 may be a problem on devices with a DMIC,
> could this be a problem?  Currently the codec driver itself contains
> quirks for dmic pin-mapping, maybe we should leave micbias2 disabled
> if dmic pin-mapping is specified through a quirk?

No, micbias2 and DMIC are independent and micbias2 will not be enabled
if we don't add it in the audio route. So I don't think we need to disable it
if dmic pin-mapping is specified.

> 
> 2) Do headset mics normally need a bias current? Could this be headset
> dependent?

Yes, but we don't need to set specific register for that. It means you don't
need to add "micbias1" in the audio route for headset mic.
I think all headset mic will need a bias current.

> 
> Regards,
> 
> Hans
> 

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

* Re: Cherry Trail + RT5645 devices analog microphone not working.
  2017-12-29  2:10             ` Bard Liao
@ 2018-01-01 12:31               ` Hans de Goede
  2018-01-02  2:41                 ` Bard Liao
  0 siblings, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2018-01-01 12:31 UTC (permalink / raw)
  To: Bard Liao; +Cc: alsa-devel, Pierre-Louis Bossart

Hi,

On 29-12-17 03:10, Bard Liao wrote:
>> Some questions for you:
>>
>> 1) I think enabling micbias2 may be a problem on devices with a DMIC,
>> could this be a problem?  Currently the codec driver itself contains
>> quirks for dmic pin-mapping, maybe we should leave micbias2 disabled
>> if dmic pin-mapping is specified through a quirk?
> 
> No, micbias2 and DMIC are independent and micbias2 will not be enabled
> if we don't add it in the audio route. So I don't think we need to disable it
> if dmic pin-mapping is specified.

Right, but currently we use the "Int Mic" switch in both the DMIC and analog
mic paths, and the changes to the machine driver enable micbias2 when Int Mic
gets turned on. After my changes the machine driver has:

	{"IN2P", NULL, "Int Mic"},
	{"IN2N", NULL, "Int Mic"},
  	{"DMIC L1", NULL, "Int Mic"},
  	{"DMIC R1", NULL, "Int Mic"},
...
	{"Int Mic", NULL, "micbias2"},

Since the analog mic is currently not working anyways, maybe we should
use Int Mic2 for the analog mic, so make the above:

	{"IN2P", NULL, "Int Mic2"},
	{"IN2N", NULL, "Int Mic2"},
  	{"DMIC L1", NULL, "Int Mic"},
  	{"DMIC R1", NULL, "Int Mic"},
...
	{"Int Mic2", NULL, "micbias2"},

And then use

	cset "name='Int Mic Switch2' on"

In the ucm file in the analog mic enable sequence?

This way the already working dmic support stays unchanged and the
analog mic support I'm adding does not enable micbias2 when using
dmic inputs.

?

Regards,

Hans

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

* Re: Cherry Trail + RT5645 devices analog microphone not working.
  2018-01-01 12:31               ` Hans de Goede
@ 2018-01-02  2:41                 ` Bard Liao
  2018-01-02 19:23                   ` Hans de Goede
  0 siblings, 1 reply; 11+ messages in thread
From: Bard Liao @ 2018-01-02  2:41 UTC (permalink / raw)
  To: Hans de Goede; +Cc: alsa-devel, Pierre-Louis Bossart

> -----Original Message-----
> From: Hans de Goede [mailto:hdegoede@redhat.com]
> Sent: Monday, January 01, 2018 8:32 PM
> To: Bard Liao
> Cc: Pierre-Louis Bossart; alsa-devel@alsa-project.org
> Subject: Re: Cherry Trail + RT5645 devices analog microphone not working.
> 
> Hi,
> 
> On 29-12-17 03:10, Bard Liao wrote:
> >> Some questions for you:
> >>
> >> 1) I think enabling micbias2 may be a problem on devices with a DMIC,
> >> could this be a problem?  Currently the codec driver itself contains
> >> quirks for dmic pin-mapping, maybe we should leave micbias2 disabled
> >> if dmic pin-mapping is specified through a quirk?
> >
> > No, micbias2 and DMIC are independent and micbias2 will not be enabled
> > if we don't add it in the audio route. So I don't think we need to disable it
> > if dmic pin-mapping is specified.
> 
> Right, but currently we use the "Int Mic" switch in both the DMIC and analog
> mic paths, and the changes to the machine driver enable micbias2 when Int
> Mic
> gets turned on. After my changes the machine driver has:
> 
> 	{"IN2P", NULL, "Int Mic"},
> 	{"IN2N", NULL, "Int Mic"},
>   	{"DMIC L1", NULL, "Int Mic"},
>   	{"DMIC R1", NULL, "Int Mic"},
> ...
> 	{"Int Mic", NULL, "micbias2"},
> 
> Since the analog mic is currently not working anyways, maybe we should
> use Int Mic2 for the analog mic, so make the above:

Do you mean the analog mic doesn't work with above change?
Could you dump registers for me?

> 
> 	{"IN2P", NULL, "Int Mic2"},
> 	{"IN2N", NULL, "Int Mic2"},
>   	{"DMIC L1", NULL, "Int Mic"},
>   	{"DMIC R1", NULL, "Int Mic"},
> ...
> 	{"Int Mic2", NULL, "micbias2"},
> 
> And then use
> 
> 	cset "name='Int Mic Switch2' on"

It will be cset "name='Int Mic2 Switch' on"
And you will also need to add "Int Mic2" in cht_mc_controls[].

> 
> In the ucm file in the analog mic enable sequence?
> 
> This way the already working dmic support stays unchanged and the
> analog mic support I'm adding does not enable micbias2 when using
> dmic inputs.

If you are using dmic inputs, you will need to set below switches on
"Sto1 ADC MIXL ADC2 Switch"
"Sto1 ADC MIXR ADC2 Switch"
And below switches are for analog mics
"Sto1 ADC MIXL ADC1 Switch"
"Sto1 ADC MIXR ADC1 Switch"
So you can select dmic or amic by rt5645's mixer.
But, anyway it's a good idea to add a new widget for analog mic.
However, it is better to have a more specific name for it.
Something like "Int A Mic" and "Int D Mic".

> 
> ?
> 
> Regards,
> 
> Hans
> 
> ------Please consider the environment before printing this e-mail.

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

* Re: Cherry Trail + RT5645 devices analog microphone not working.
  2018-01-02  2:41                 ` Bard Liao
@ 2018-01-02 19:23                   ` Hans de Goede
  0 siblings, 0 replies; 11+ messages in thread
From: Hans de Goede @ 2018-01-02 19:23 UTC (permalink / raw)
  To: Bard Liao; +Cc: alsa-devel, Pierre-Louis Bossart

Hi Bard,

On 02-01-18 03:41, Bard Liao wrote:
>> -----Original Message-----
>> From: Hans de Goede [mailto:hdegoede@redhat.com]
>> Sent: Monday, January 01, 2018 8:32 PM
>> To: Bard Liao
>> Cc: Pierre-Louis Bossart; alsa-devel@alsa-project.org
>> Subject: Re: Cherry Trail + RT5645 devices analog microphone not working.
>>
>> Hi,
>>
>> On 29-12-17 03:10, Bard Liao wrote:
>>>> Some questions for you:
>>>>
>>>> 1) I think enabling micbias2 may be a problem on devices with a DMIC,
>>>> could this be a problem?  Currently the codec driver itself contains
>>>> quirks for dmic pin-mapping, maybe we should leave micbias2 disabled
>>>> if dmic pin-mapping is specified through a quirk?
>>>
>>> No, micbias2 and DMIC are independent and micbias2 will not be enabled
>>> if we don't add it in the audio route. So I don't think we need to disable it
>>> if dmic pin-mapping is specified.
>>
>> Right, but currently we use the "Int Mic" switch in both the DMIC and analog
>> mic paths, and the changes to the machine driver enable micbias2 when Int
>> Mic
>> gets turned on. After my changes the machine driver has:
>>
>> 	{"IN2P", NULL, "Int Mic"},
>> 	{"IN2N", NULL, "Int Mic"},
>>    	{"DMIC L1", NULL, "Int Mic"},
>>    	{"DMIC R1", NULL, "Int Mic"},
>> ...
>> 	{"Int Mic", NULL, "micbias2"},
>>
>> Since the analog mic is currently not working anyways, maybe we should
>> use Int Mic2 for the analog mic, so make the above:
> 
> Do you mean the analog mic doesn't work with above change?

It does work with the above changes, what I mean is that it does
not work without the patch series which I've just send out, sorry
for the confusion.

What I was trying to say is that using a new dapm widget with a
new name for the analog mic will NOT break existing ucm files
since on older kernels, without the latest patches it will not
work because of the lacking patches.

> Could you dump registers for me?

No need, everything works now, also see the series I just send
out thank you for all your help!

>> 	{"IN2P", NULL, "Int Mic2"},
>> 	{"IN2N", NULL, "Int Mic2"},
>>    	{"DMIC L1", NULL, "Int Mic"},
>>    	{"DMIC R1", NULL, "Int Mic"},
>> ...
>> 	{"Int Mic2", NULL, "micbias2"},
>>
>> And then use
>>
>> 	cset "name='Int Mic Switch2' on"
> 
> It will be cset "name='Int Mic2 Switch' on"
> And you will also need to add "Int Mic2" in cht_mc_controls[].
> 
>>
>> In the ucm file in the analog mic enable sequence?
>>
>> This way the already working dmic support stays unchanged and the
>> analog mic support I'm adding does not enable micbias2 when using
>> dmic inputs.
> 
> If you are using dmic inputs, you will need to set below switches on
> "Sto1 ADC MIXL ADC2 Switch"
> "Sto1 ADC MIXR ADC2 Switch"
> And below switches are for analog mics
> "Sto1 ADC MIXL ADC1 Switch"
> "Sto1 ADC MIXR ADC1 Switch"
> So you can select dmic or amic by rt5645's mixer.



> But, anyway it's a good idea to add a new widget for analog mic.

Ok, I've just send out a patch series with your fixes to the codec
driver + a patch to sound/soc/intel/boards/cht_bsw_rt5645.c
adding a new "Int Analog Mic" DAPM widget for this.

Regards,

Hans

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

end of thread, other threads:[~2018-01-02 19:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-24 10:42 Cherry Trail + RT5645 devices analog microphone not working Hans de Goede
2017-12-25  2:15 ` Bard Liao
2017-12-25 12:02   ` Hans de Goede
2017-12-26  5:29     ` Bard Liao
2017-12-27 19:12       ` Hans de Goede
2017-12-28  3:05         ` Bard Liao
2017-12-29  0:22           ` Hans de Goede
2017-12-29  2:10             ` Bard Liao
2018-01-01 12:31               ` Hans de Goede
2018-01-02  2:41                 ` Bard Liao
2018-01-02 19:23                   ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.