All of lore.kernel.org
 help / color / mirror / Atom feed
* Conexant 5051 lenovo-x200 fixes
@ 2011-08-18  0:45 Ulo Mets
  2011-08-18 10:08 ` Takashi Iwai
  0 siblings, 1 reply; 15+ messages in thread
From: Ulo Mets @ 2011-08-18  0:45 UTC (permalink / raw)
  To: alsa-devel

Hi,
I am not a kernel developer, but occasionally dig into it if something gets in my way.
On Lenovo X200 Tablet none of the mixers showed Mic Boost adjustments, but HDA-Analyzer found them
and adjusted properly. So I inserted the corresponding controls, and it worked.
Then, during testing I found that the labels of External and Docking Mic are swapped,
so I exchanged these too. Since I could not test it on other hardware, I put it all on lenovo-x200 branch.
The patch applies to 3.1-rc2, I hope it is sufficiently recent.
The Mic Switches don't have any effect on my unit (X200T without modem)

With best regards,

Ulo Mets

Signed-off-by: Ulo Mets<umets at osa.pri.ee>

---b/sound/pci/hda/patch_conexant.c	2011-08-01 12:45:32.302640276 +0300
+++ a/sound/pci/hda/patch_conexant.c	2011-08-01 12:50:22.003141176 +0300
@@ -1785,6 +1785,19 @@
  	{}
  };

+static const struct snd_kcontrol_new cxt5051_lenovo_x200_mixers[] = {
+	HDA_CODEC_VOLUME("Int Mic Volume", 0x14, 0x00, HDA_INPUT),
+	HDA_CODEC_MUTE("Int Mic Switch", 0x14, 0x00, HDA_INPUT),
+	HDA_CODEC_VOLUME("Dock Mic Volume", 0x14, 0x01, HDA_INPUT),
+	HDA_CODEC_MUTE("Dock Mic Switch", 0x14, 0x01, HDA_INPUT),
+	HDA_CODEC_VOLUME("Ext Mic Volume", 0x15, 0x00, HDA_INPUT),
+	HDA_CODEC_MUTE("Ext Mic Switch", 0x15, 0x00, HDA_INPUT),
+	HDA_CODEC_VOLUME("Int Mic Boost", 0x1d, 0x00, HDA_INPUT),
+	HDA_CODEC_VOLUME("Dock Mic Boost", 0x17, 0x00, HDA_INPUT),
+	HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0x00, HDA_INPUT),
+	{}
+};
+
  static const struct snd_kcontrol_new cxt5051_hp_mixers[] = {
  	HDA_CODEC_VOLUME("Internal Mic Volume", 0x14, 0x00, HDA_INPUT),
  	HDA_CODEC_MUTE("Internal Mic Switch", 0x14, 0x00, HDA_INPUT),
@@ -2055,6 +2079,7 @@
  		break;
  	case CXT5051_LENOVO_X200:
  		spec->init_verbs[0] = cxt5051_lenovo_x200_init_verbs;
+		spec->mixers[0] = cxt5051_lenovo_x200_mixers;
  		/* Thinkpad X301 does not have S/PDIF wired and no ability
  		   to use a docking station. */
  		if (codec->subsystem_id == 0x17aa211f)

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

* Re: Conexant 5051 lenovo-x200 fixes
  2011-08-18  0:45 Conexant 5051 lenovo-x200 fixes Ulo Mets
@ 2011-08-18 10:08 ` Takashi Iwai
  2011-08-19  0:00   ` Ulo Mets
  0 siblings, 1 reply; 15+ messages in thread
From: Takashi Iwai @ 2011-08-18 10:08 UTC (permalink / raw)
  To: Ulo Mets; +Cc: alsa-devel

At Thu, 18 Aug 2011 03:45:33 +0300,
Ulo Mets wrote:
> 
> Hi,
> I am not a kernel developer, but occasionally dig into it if something gets in my way.
> On Lenovo X200 Tablet none of the mixers showed Mic Boost adjustments, but HDA-Analyzer found them
> and adjusted properly. So I inserted the corresponding controls, and it worked.
> Then, during testing I found that the labels of External and Docking Mic are swapped,
> so I exchanged these too. Since I could not test it on other hardware, I put it all on lenovo-x200 branch.
> The patch applies to 3.1-rc2, I hope it is sufficiently recent.
> The Mic Switches don't have any effect on my unit (X200T without modem)

Could you try model=auto instead of patching?
The recent auto-parser should work better.


Takashi

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

* Re: Conexant 5051 lenovo-x200 fixes
  2011-08-18 10:08 ` Takashi Iwai
@ 2011-08-19  0:00   ` Ulo Mets
  2011-08-19  5:43     ` Takashi Iwai
  0 siblings, 1 reply; 15+ messages in thread
From: Ulo Mets @ 2011-08-19  0:00 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On 08/18/2011 01:08 PM, Takashi Iwai wrote:
> At Thu, 18 Aug 2011 03:45:33 +0300,
> Ulo Mets wrote:
>> Hi,
>> I am not a kernel developer, but occasionally dig into it if something gets in my way.
>> On Lenovo X200 Tablet none of the mixers showed Mic Boost adjustments, but HDA-Analyzer found them
>> and adjusted properly. So I inserted the corresponding controls, and it worked.
>> Then, during testing I found that the labels of External and Docking Mic are swapped,
>> so I exchanged these too. Since I could not test it on other hardware, I put it all on lenovo-x200 branch.
>> The patch applies to 3.1-rc2, I hope it is sufficiently recent.
>> The Mic Switches don't have any effect on my unit (X200T without modem)
> Could you try model=auto instead of patching?
> The recent auto-parser should work better.
Model=auto seems to give a very generic configuration, which indeed does 
include working
Mic boost for Internal Mic. (Ext?) Mic Boost and gain are also present, 
but jack sensing does not work,
so these cannot be tested.
Also, the Dock Microphone is not detected, so I would conclude that for 
X200T "auto" does not work.

It would be surprising if Auto was better than dedicated model. (X200 
and X200T accept
same part numbers for audio card).
The kernel version that I used for this latest testing is 3.0-ARCH

It would be nice to get the mute switches to work as well.

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

* Re: Conexant 5051 lenovo-x200 fixes
  2011-08-19  0:00   ` Ulo Mets
@ 2011-08-19  5:43     ` Takashi Iwai
  2011-08-20 15:14       ` Ülo Mets
  0 siblings, 1 reply; 15+ messages in thread
From: Takashi Iwai @ 2011-08-19  5:43 UTC (permalink / raw)
  To: Ulo Mets; +Cc: alsa-devel

At Fri, 19 Aug 2011 03:00:58 +0300,
Ulo Mets wrote:
> 
> On 08/18/2011 01:08 PM, Takashi Iwai wrote:
> > At Thu, 18 Aug 2011 03:45:33 +0300,
> > Ulo Mets wrote:
> >> Hi,
> >> I am not a kernel developer, but occasionally dig into it if something gets in my way.
> >> On Lenovo X200 Tablet none of the mixers showed Mic Boost adjustments, but HDA-Analyzer found them
> >> and adjusted properly. So I inserted the corresponding controls, and it worked.
> >> Then, during testing I found that the labels of External and Docking Mic are swapped,
> >> so I exchanged these too. Since I could not test it on other hardware, I put it all on lenovo-x200 branch.
> >> The patch applies to 3.1-rc2, I hope it is sufficiently recent.
> >> The Mic Switches don't have any effect on my unit (X200T without modem)
> > Could you try model=auto instead of patching?
> > The recent auto-parser should work better.
> Model=auto seems to give a very generic configuration, which indeed does 
> include working
> Mic boost for Internal Mic. (Ext?) Mic Boost and gain are also present, 
> but jack sensing does not work,
> so these cannot be tested.

The automatic mic-switch by jack-sensing works without model=auto,
right?  Then we need to fix it.  Could you give alsa-info.sh output?

> Also, the Dock Microphone is not detected, so I would conclude that for 
> X200T "auto" does not work.

OK, it means that BIOS doesn't set up the pins for docking-station.

> It would be surprising if Auto was better than dedicated model. (X200 
> and X200T accept
> same part numbers for audio card).

The auto-parser is nowadays much better than the model specific
quirks.  I'm going to reduce model quirks as much as possible now.
So, basically, I won't add a model fix any more unless it's
unavoidable.  In your case, we'll need to fix pin configurations (like
in patch_sigmatel.c or patch_realtek.c) and fix the auto-parser.

> The kernel version that I used for this latest testing is 3.0-ARCH
> 
> It would be nice to get the mute switches to work as well.

Which mute switch do you mean exactly?


thanks,

Takashi

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

* Re: Conexant 5051 lenovo-x200 fixes
  2011-08-19  5:43     ` Takashi Iwai
@ 2011-08-20 15:14       ` Ülo Mets
  2011-08-22 12:00         ` Takashi Iwai
  0 siblings, 1 reply; 15+ messages in thread
From: Ülo Mets @ 2011-08-20 15:14 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

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

On 08/19/2011 08:43 AM, Takashi Iwai wrote:

> At Fri, 19 Aug 2011 03:00:58 +0300,
> Ulo Mets wrote:
>> On 08/18/2011 01:08 PM, Takashi Iwai wrote:
>>> At Thu, 18 Aug 2011 03:45:33 +0300,
>>> Ulo Mets wrote:
>>>> Hi,
>>>> I am not a kernel developer, but occasionally dig into it if something gets in my way.
>>>> On Lenovo X200 Tablet none of the mixers showed Mic Boost adjustments, but HDA-Analyzer found them
>>>> and adjusted properly. So I inserted the corresponding controls, and it worked.
>>>> Then, during testing I found that the labels of External and Docking Mic are swapped,
>>>> so I exchanged these too. Since I could not test it on other hardware, I put it all on lenovo-x200 branch.
>>>> The patch applies to 3.1-rc2, I hope it is sufficiently recent.
>>>> The Mic Switches don't have any effect on my unit (X200T without modem)
>>> Could you try model=auto instead of patching?
>>> The recent auto-parser should work better.
>> Model=auto seems to give a very generic configuration, which indeed does 
>> include working
>> Mic boost for Internal Mic. (Ext?) Mic Boost and gain are also present, 
>> but jack sensing does not work,
>> so these cannot be tested.
> The automatic mic-switch by jack-sensing works without model=auto,
> right?  Then we need to fix it.  Could you give alsa-info.sh output?
>
Right. The alsa-info.sh output is attached.

>> It would be nice to get the mute switches to work as well.
> Which mute switch do you mean exactly?
I see the "Mic Switch" controls in the input nodes 0x14 and 0x15, and some Mute controls

with hda-analyzer. But it may well be just wishful thinking. I wonder if anybody has seen the 
datasheet of CX20561?

Regards,

Ulo


[-- Attachment #2: alsa-info-x200t.txt.gz --]
[-- Type: application/x-gzip, Size: 4330 bytes --]

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



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

* Re: Conexant 5051 lenovo-x200 fixes
  2011-08-20 15:14       ` Ülo Mets
@ 2011-08-22 12:00         ` Takashi Iwai
  2011-08-23 11:32           ` Ulo Mets
  0 siblings, 1 reply; 15+ messages in thread
From: Takashi Iwai @ 2011-08-22 12:00 UTC (permalink / raw)
  To: Ülo Mets; +Cc: alsa-devel

At Sat, 20 Aug 2011 18:14:20 +0300,
Ülo Mets wrote:
> 
> On 08/19/2011 08:43 AM, Takashi Iwai wrote:
> 
> > At Fri, 19 Aug 2011 03:00:58 +0300,
> > Ulo Mets wrote:
> >> On 08/18/2011 01:08 PM, Takashi Iwai wrote:
> >>> At Thu, 18 Aug 2011 03:45:33 +0300,
> >>> Ulo Mets wrote:
> >>>> Hi,
> >>>> I am not a kernel developer, but occasionally dig into it if something gets in my way.
> >>>> On Lenovo X200 Tablet none of the mixers showed Mic Boost adjustments, but HDA-Analyzer found them
> >>>> and adjusted properly. So I inserted the corresponding controls, and it worked.
> >>>> Then, during testing I found that the labels of External and Docking Mic are swapped,
> >>>> so I exchanged these too. Since I could not test it on other hardware, I put it all on lenovo-x200 branch.
> >>>> The patch applies to 3.1-rc2, I hope it is sufficiently recent.
> >>>> The Mic Switches don't have any effect on my unit (X200T without modem)
> >>> Could you try model=auto instead of patching?
> >>> The recent auto-parser should work better.
> >> Model=auto seems to give a very generic configuration, which indeed does 
> >> include working
> >> Mic boost for Internal Mic. (Ext?) Mic Boost and gain are also present, 
> >> but jack sensing does not work,
> >> so these cannot be tested.
> > The automatic mic-switch by jack-sensing works without model=auto,
> > right?  Then we need to fix it.  Could you give alsa-info.sh output?
> >
> Right. The alsa-info.sh output is attached.

Thanks.

> >> It would be nice to get the mute switches to work as well.
> > Which mute switch do you mean exactly?
> I see the "Mic Switch" controls in the input nodes 0x14 and 0x15, and some Mute controls
> 
> with hda-analyzer. But it may well be just wishful thinking. I wonder if anybody has seen the 
> datasheet of CX20561?

Google is your friend :)
But you can figure out almost all things in the codec proc file.

What you should test is to check which I/O the pins 0x16, 0x17, 0x18
and 0x19 correspond.  I suppose 0x16 = HP, 0x17 = mic-jack, 0x18 =
dock-mic, 0x19 = dock-HP.

An easy way would be to test the jack-detection via hda-verb.

	# hda-verb /dev/snd/hwC0D0 0x16 GET_PIN_SENSE 0

When any jack corresponds to the pin 0x16, it'll report 0x80000000
upon plugged.

When you finish figuring out these pins, please let me know.


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: Conexant 5051 lenovo-x200 fixes
  2011-08-22 12:00         ` Takashi Iwai
@ 2011-08-23 11:32           ` Ulo Mets
  2011-08-23 13:10             ` Takashi Iwai
  0 siblings, 1 reply; 15+ messages in thread
From: Ulo Mets @ 2011-08-23 11:32 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On 8/22/2011 3:00 PM, Takashi Iwai wrote:
> At Sat, 20 Aug 2011 18:14:20 +0300,
> Ülo Mets wrote:
>> On 08/19/2011 08:43 AM, Takashi Iwai wrote:
>>
>>> At Fri, 19 Aug 2011 03:00:58 +0300,
>>> Ulo Mets wrote:
>>>> On 08/18/2011 01:08 PM, Takashi Iwai wrote:
>>>>> At Thu, 18 Aug 2011 03:45:33 +0300,
>>>>> Ulo Mets wrote:
>>>>>> Hi,
>>>>>> I am not a kernel developer, but occasionally dig into it if something gets in my way.
>>>>>> On Lenovo X200 Tablet none of the mixers showed Mic Boost adjustments, but HDA-Analyzer found them
>>>>>> and adjusted properly. So I inserted the corresponding controls, and it worked.
>>>>>> Then, during testing I found that the labels of External and Docking Mic are swapped,
>>>>>> so I exchanged these too. Since I could not test it on other hardware, I put it all on lenovo-x200 branch.
>>>>>> The patch applies to 3.1-rc2, I hope it is sufficiently recent.
>>>>>> The Mic Switches don't have any effect on my unit (X200T without modem)
>>>>> Could you try model=auto instead of patching?
>>>>> The recent auto-parser should work better.
>>>> Model=auto seems to give a very generic configuration, which indeed does
>>>> include working
>>>> Mic boost for Internal Mic. (Ext?) Mic Boost and gain are also present,
>>>> but jack sensing does not work,
>>>> so these cannot be tested.
>>> The automatic mic-switch by jack-sensing works without model=auto,
>>> right?  Then we need to fix it.  Could you give alsa-info.sh output?
>>>
>> Right. The alsa-info.sh output is attached.
> Thanks.
>
>>>> It would be nice to get the mute switches to work as well.
>>> Which mute switch do you mean exactly?
>> I see the "Mic Switch" controls in the input nodes 0x14 and 0x15, and some Mute controls
>>
>> with hda-analyzer. But it may well be just wishful thinking. I wonder if anybody has seen the
>> datasheet of CX20561?
> Google is your friend :)
Is that so? I'll give you $100 for a set of keywords that leads to the datasheet. BTW, the chip revision
in question is -15Z

> But you can figure out almost all things in the codec proc file.
Yes, the Pin Defaults are correct in the proc file, and the control names in 0x14 and 0x15 contradict these.
That's why it was so easy to fix.

> What you should test is to check which I/O the pins 0x16, 0x17, 0x18
> and 0x19 correspond.  I suppose 0x16 = HP, 0x17 = mic-jack, 0x18 =
> dock-mic, 0x19 = dock-HP.
Almost. 0x16 = HP, 0x17 = dock-mic, 0x18 = ext-mic, 0x19 = dock-HP

> An easy way would be to test the jack-detection via hda-verb.
> 	# hda-verb /dev/snd/hwC0D0 0x16 GET_PIN_SENSE 0
>
> When any jack corresponds to the pin 0x16, it'll report 0x80000000
> upon plugged.
Nice tool. But ver. 0.3 reports 0xffffffff when plugged and 0x7fffffff when unplugged.

> When you finish figuring out these pins, please let me know.
>
> Takashi

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: Conexant 5051 lenovo-x200 fixes
  2011-08-23 11:32           ` Ulo Mets
@ 2011-08-23 13:10             ` Takashi Iwai
  2011-08-24  2:45               ` Ulo Mets
  2011-08-24  3:25               ` Ulo Mets
  0 siblings, 2 replies; 15+ messages in thread
From: Takashi Iwai @ 2011-08-23 13:10 UTC (permalink / raw)
  To: Ulo Mets; +Cc: alsa-devel

At Tue, 23 Aug 2011 14:32:21 +0300,
Ulo Mets wrote:
> 
> On 8/22/2011 3:00 PM, Takashi Iwai wrote:
> > At Sat, 20 Aug 2011 18:14:20 +0300,
> > Ülo Mets wrote:
> >> On 08/19/2011 08:43 AM, Takashi Iwai wrote:
> >>
> >>> At Fri, 19 Aug 2011 03:00:58 +0300,
> >>> Ulo Mets wrote:
> >>>> On 08/18/2011 01:08 PM, Takashi Iwai wrote:
> >>>>> At Thu, 18 Aug 2011 03:45:33 +0300,
> >>>>> Ulo Mets wrote:
> >>>>>> Hi,
> >>>>>> I am not a kernel developer, but occasionally dig into it if something gets in my way.
> >>>>>> On Lenovo X200 Tablet none of the mixers showed Mic Boost adjustments, but HDA-Analyzer found them
> >>>>>> and adjusted properly. So I inserted the corresponding controls, and it worked.
> >>>>>> Then, during testing I found that the labels of External and Docking Mic are swapped,
> >>>>>> so I exchanged these too. Since I could not test it on other hardware, I put it all on lenovo-x200 branch.
> >>>>>> The patch applies to 3.1-rc2, I hope it is sufficiently recent.
> >>>>>> The Mic Switches don't have any effect on my unit (X200T without modem)
> >>>>> Could you try model=auto instead of patching?
> >>>>> The recent auto-parser should work better.
> >>>> Model=auto seems to give a very generic configuration, which indeed does
> >>>> include working
> >>>> Mic boost for Internal Mic. (Ext?) Mic Boost and gain are also present,
> >>>> but jack sensing does not work,
> >>>> so these cannot be tested.
> >>> The automatic mic-switch by jack-sensing works without model=auto,
> >>> right?  Then we need to fix it.  Could you give alsa-info.sh output?
> >>>
> >> Right. The alsa-info.sh output is attached.
> > Thanks.
> >
> >>>> It would be nice to get the mute switches to work as well.
> >>> Which mute switch do you mean exactly?
> >> I see the "Mic Switch" controls in the input nodes 0x14 and 0x15, and some Mute controls
> >>
> >> with hda-analyzer. But it may well be just wishful thinking. I wonder if anybody has seen the
> >> datasheet of CX20561?
> > Google is your friend :)
> Is that so? I'll give you $100 for a set of keywords that leads to the datasheet.

Then it has been removed.  Ask Conexant if you still need it.

> BTW, the chip revision in question is -15Z

It should be compatible no matter which revision is.

> > But you can figure out almost all things in the codec proc file.
> Yes, the Pin Defaults are correct in the proc file, and the control names in 0x14 and 0x15 contradict these.
> That's why it was so easy to fix.
> 
> > What you should test is to check which I/O the pins 0x16, 0x17, 0x18
> > and 0x19 correspond.  I suppose 0x16 = HP, 0x17 = mic-jack, 0x18 =
> > dock-mic, 0x19 = dock-HP.
> Almost. 0x16 = HP, 0x17 = dock-mic, 0x18 = ext-mic, 0x19 = dock-HP

OK.

> > An easy way would be to test the jack-detection via hda-verb.
> > 	# hda-verb /dev/snd/hwC0D0 0x16 GET_PIN_SENSE 0
> >
> > When any jack corresponds to the pin 0x16, it'll report 0x80000000
> > upon plugged.
> Nice tool. But ver. 0.3 reports 0xffffffff when plugged and 0x7fffffff when unplugged.

It doesn't matter.  The only meaningful bit is the bit 31.

For making auto-parser working, apply the patch below.
It fixes the multi-headphone assignment case.

Then, put lines below to /lib/firmware/x200t-pincfg file.

----------------------------------------------------------------
0x16 0x042140ff
0x17 0x23a11040
0x18 0x04a190f0
0x19 0x2121103f
0x1a 0x901701f0
0x1d 0x90a601f0
----------------------------------------------------------------

After creating the file, pass "patch=x200t-pincfg model=auto" module
options to snd-hda-intel driver.  Now the driver will be set up using
the auto-parser with the given pin-configuration table.

Let me know if this works.  Once after confirming it's working, we can
add a static configuration in the driver itself.


thanks,

Takashi

---
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: hda - Fix double-headphone/speaker paths for Cxt
 auto-parser

When multiple headphones or speakers are assigned but no individual
DACs are available, the driver should take the first HP/SPK DAC instead
of another primary output.  The patch adds a bit-flag to dac field of
struct pin_dac_pair indicating that it's a slave DAC.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_conexant.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 502fc94..4c462c3 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3348,6 +3348,8 @@ static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t pin,
 
 #define MAX_AUTO_DACS	5
 
+#define DAC_SLAVE_FLAG	0x8000	/* filled dac is a slave */
+
 /* fill analog DAC list from the widget tree */
 static int fill_cx_auto_dacs(struct hda_codec *codec, hda_nid_t *dacs)
 {
@@ -3379,6 +3381,8 @@ static int fill_dacs_for_pins(struct hda_codec *codec, hda_nid_t *pins,
 		filled[nums].pin = pins[i];
 		filled[nums].type = type;
 		filled[nums].dac = get_unassigned_dac(codec, pins[i], dacs, rest);
+		if (!filled[nums].dac && i > 0 && filled[0].dac)
+			filled[nums].dac = filled[0].dac | DAC_SLAVE_FLAG;
 		nums++;
 	}
 	return nums;
@@ -3407,7 +3411,7 @@ static void cx_auto_parse_output(struct hda_codec *codec)
 	/* fill multiout struct */
 	for (i = 0; i < nums; i++) {
 		hda_nid_t dac = spec->dac_info[i].dac;
-		if (!dac)
+		if (!dac || (dac & DAC_SLAVE_FLAG))
 			continue;
 		switch (spec->dac_info[i].type) {
 		case AUTO_PIN_LINE_OUT:
@@ -4035,6 +4039,8 @@ static void cx_auto_init_output(struct hda_codec *codec)
 		nid = spec->dac_info[i].dac;
 		if (!nid)
 			nid = spec->multiout.dac_nids[0];
+		else if (nid & DAC_SLAVE_FLAG)
+			nid &= ~DAC_SLAVE_FLAG;
 		select_connection(codec, spec->dac_info[i].pin, nid);
 	}
 	if (spec->auto_mute) {
@@ -4191,7 +4197,8 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
 	for (i = 0; i < spec->dac_info_filled; i++) {
 		const char *label;
 		int idx, type;
-		if (!spec->dac_info[i].dac)
+		hda_nid_t dac = spec->dac_info[i].dac;
+		if (!dac || (dac & DAC_SLAVE_FLAG))
 			continue;
 		type = spec->dac_info[i].type;
 		if (type == AUTO_PIN_LINE_OUT)
@@ -4211,7 +4218,7 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
 			idx = num_spk++;
 			break;
 		}
-		err = try_add_pb_volume(codec, spec->dac_info[i].dac,
+		err = try_add_pb_volume(codec, dac,
 					spec->dac_info[i].pin,
 					label, idx);
 		if (err < 0)
-- 
1.7.6

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: Conexant 5051 lenovo-x200 fixes
  2011-08-23 13:10             ` Takashi Iwai
@ 2011-08-24  2:45               ` Ulo Mets
  2011-08-24  3:25               ` Ulo Mets
  1 sibling, 0 replies; 15+ messages in thread
From: Ulo Mets @ 2011-08-24  2:45 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On 08/23/2011 04:10 PM, Takashi Iwai wrote:
> At Tue, 23 Aug 2011 14:32:21 +0300,
> Ulo Mets wrote:
>> On 8/22/2011 3:00 PM, Takashi Iwai wrote:
>>> At Sat, 20 Aug 2011 18:14:20 +0300,
>>> Ülo Mets wrote:
>>>> On 08/19/2011 08:43 AM, Takashi Iwai wrote:
>>>>
>>>>> At Fri, 19 Aug 2011 03:00:58 +0300,
>>>>> Ulo Mets wrote:
>>>>>> On 08/18/2011 01:08 PM, Takashi Iwai wrote:
>>>>>>> At Thu, 18 Aug 2011 03:45:33 +0300,
>>>>>>> Ulo Mets wrote:
>>>>>>>> Hi,
>>>>>>>> I am not a kernel developer, but occasionally dig into it if something gets in my way.
>>>>>>>> On Lenovo X200 Tablet none of the mixers showed Mic Boost adjustments, but HDA-Analyzer found them
>>>>>>>> and adjusted properly. So I inserted the corresponding controls, and it worked.
>>>>>>>> Then, during testing I found that the labels of External and Docking Mic are swapped,
>>>>>>>> so I exchanged these too. Since I could not test it on other hardware, I put it all on lenovo-x200 branch.
>>>>>>>> The patch applies to 3.1-rc2, I hope it is sufficiently recent.
>>>>>>>> The Mic Switches don't have any effect on my unit (X200T without modem)
>>>>>>> Could you try model=auto instead of patching?
>>>>>>> The recent auto-parser should work better.
>>>>>> Model=auto seems to give a very generic configuration, which indeed does
>>>>>> include working
>>>>>> Mic boost for Internal Mic. (Ext?) Mic Boost and gain are also present,
>>>>>> but jack sensing does not work,
>>>>>> so these cannot be tested.
>>>>> The automatic mic-switch by jack-sensing works without model=auto,
>>>>> right?  Then we need to fix it.  Could you give alsa-info.sh output?
>>>>>
>>>> Right. The alsa-info.sh output is attached.
>>> Thanks.
>>>
>>>>>> It would be nice to get the mute switches to work as well.
>>>>> Which mute switch do you mean exactly?
>>>> I see the "Mic Switch" controls in the input nodes 0x14 and 0x15, and some Mute controls
>>>>
>>>> with hda-analyzer. But it may well be just wishful thinking. I wonder if anybody has seen the
>>>> datasheet of CX20561?
>>> Google is your friend :)
>> Is that so? I'll give you $100 for a set of keywords that leads to the datasheet.
> Then it has been removed.  Ask Conexant if you still need it.
>
>> BTW, the chip revision in question is -15Z
> It should be compatible no matter which revision is.
>
>>> But you can figure out almost all things in the codec proc file.
>> Yes, the Pin Defaults are correct in the proc file, and the control names in 0x14 and 0x15 contradict these.
>> That's why it was so easy to fix.
>>
>>> What you should test is to check which I/O the pins 0x16, 0x17, 0x18
>>> and 0x19 correspond.  I suppose 0x16 = HP, 0x17 = mic-jack, 0x18 =
>>> dock-mic, 0x19 = dock-HP.
>> Almost. 0x16 = HP, 0x17 = dock-mic, 0x18 = ext-mic, 0x19 = dock-HP
> OK.
>
>>> An easy way would be to test the jack-detection via hda-verb.
>>> 	# hda-verb /dev/snd/hwC0D0 0x16 GET_PIN_SENSE 0
>>>
>>> When any jack corresponds to the pin 0x16, it'll report 0x80000000
>>> upon plugged.
>> Nice tool. But ver. 0.3 reports 0xffffffff when plugged and 0x7fffffff when unplugged.
> It doesn't matter.  The only meaningful bit is the bit 31.
>
> For making auto-parser working, apply the patch below.
> It fixes the multi-headphone assignment case.
>
> Then, put lines below to /lib/firmware/x200t-pincfg file.
>
> ----------------------------------------------------------------
> 0x16 0x042140ff
> 0x17 0x23a11040
> 0x18 0x04a190f0
> 0x19 0x2121103f
> 0x1a 0x901701f0
> 0x1d 0x90a601f0
> ----------------------------------------------------------------
>
> After creating the file, pass "patch=x200t-pincfg model=auto" module
> options to snd-hda-intel driver.  Now the driver will be set up using
> the auto-parser with the given pin-configuration table.
>
> Let me know if this works.  Once after confirming it's working, we can
> add a static configuration in the driver itself.
>
I only replaced the snd-hda-codec-conexant module, I hope this is enough.
Loading of x200t-pincfg and BIOS autoconfig was reported in syslog.

There is only one difference from the stock module with model=auto:
in the new version the dock headphone is correctly adjusted with headphone volume,
while in stock version it is adjusted by speaker volume.

The right side headphone is adjusted with headphone control in both cases, and also the
speaker is muted properly.

The microphone autosensing does not work, the internal microphone remains active when
cables are plugged to either of mic jacks.
The dock microphone is not seen by the mixer (alsamixer).

Is there anything specific that I can test or do?

with best regards,

Ulo

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: Conexant 5051 lenovo-x200 fixes
  2011-08-23 13:10             ` Takashi Iwai
  2011-08-24  2:45               ` Ulo Mets
@ 2011-08-24  3:25               ` Ulo Mets
  2011-08-24  5:53                 ` Takashi Iwai
  1 sibling, 1 reply; 15+ messages in thread
From: Ulo Mets @ 2011-08-24  3:25 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On 08/23/2011 04:10 PM, Takashi Iwai wrote:
> For making auto-parser working, apply the patch below.
> It fixes the multi-headphone assignment case.
>
> Then, put lines below to /lib/firmware/x200t-pincfg file.
>
> ----------------------------------------------------------------
> 0x16 0x042140ff
> 0x17 0x23a11040
> 0x18 0x04a190f0
> 0x19 0x2121103f
> 0x1a 0x901701f0
> 0x1d 0x90a601f0
> ----------------------------------------------------------------
>
> After creating the file, pass "patch=x200t-pincfg model=auto" module
> options to snd-hda-intel driver.  Now the driver will be set up using
> the auto-parser with the given pin-configuration table.
>
> Let me know if this works.  Once after confirming it's working, we can
> add a static configuration in the driver itself.
>
Please disregard my last message.
I amended the x200t-pincfg file with [codec] section and added [pincfg] header, now it works much better.

In Rec screen of Alsamixer all three mic volume and boost controls are present.
Autosensing of Dock Mic works, and so do its controls. Internal mic works too, but
autosensing of Ext mic does not.
(Internal Mic Boost is so long name that it does not want to fit in its space)

In Playback screen the three Mic Boost controls are present, which is perhaps not necessary.
There is also an Auto-Mute Mode on/off control, which does not seem to do anything.
The headphone sensing and controls work as expected.

Regards,

Ulo

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

* Re: Conexant 5051 lenovo-x200 fixes
  2011-08-24  3:25               ` Ulo Mets
@ 2011-08-24  5:53                 ` Takashi Iwai
  2011-08-24  8:59                   ` Takashi Iwai
  0 siblings, 1 reply; 15+ messages in thread
From: Takashi Iwai @ 2011-08-24  5:53 UTC (permalink / raw)
  To: Ulo Mets; +Cc: alsa-devel

At Wed, 24 Aug 2011 06:25:58 +0300,
Ulo Mets wrote:
> 
> On 08/23/2011 04:10 PM, Takashi Iwai wrote:
> > For making auto-parser working, apply the patch below.
> > It fixes the multi-headphone assignment case.
> >
> > Then, put lines below to /lib/firmware/x200t-pincfg file.
> >
> > ----------------------------------------------------------------
> > 0x16 0x042140ff
> > 0x17 0x23a11040
> > 0x18 0x04a190f0
> > 0x19 0x2121103f
> > 0x1a 0x901701f0
> > 0x1d 0x90a601f0
> > ----------------------------------------------------------------
> >
> > After creating the file, pass "patch=x200t-pincfg model=auto" module
> > options to snd-hda-intel driver.  Now the driver will be set up using
> > the auto-parser with the given pin-configuration table.
> >
> > Let me know if this works.  Once after confirming it's working, we can
> > add a static configuration in the driver itself.
> >
> Please disregard my last message.
> I amended the x200t-pincfg file with [codec] section and added [pincfg] header, now it works much better.

Oh yeah, sorry, I forgot to add that.

> In Rec screen of Alsamixer all three mic volume and boost controls are present.
> Autosensing of Dock Mic works, and so do its controls. Internal mic works too, but
> autosensing of Ext mic does not.

Does ext-mic pin (0x18) jack-sense work with hda-emu at all?
When this pin is selected, the recording is done via another ADC
(0x15) instead of the one for int-mic and dock-mic (0x14).
Try to reopen the recording stream when you plug the ext-mic.
It might be a bug in the dynamic ADC-switching of the running stream.

> (Internal Mic Boost is so long name that it does not want to fit in its space)
> 
> In Playback screen the three Mic Boost controls are present, which is perhaps not necessary.

This is an issue in alsa-lib (and remaining intentionally), no driver
problem.

> There is also an Auto-Mute Mode on/off control, which does not seem to do anything.

It should change the headphone auto-mute behavior.
The speaker will be always turned on.


thanks,

Takashi

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

* Re: Conexant 5051 lenovo-x200 fixes
  2011-08-24  5:53                 ` Takashi Iwai
@ 2011-08-24  8:59                   ` Takashi Iwai
  2011-08-24 11:26                     ` Ulo Mets
  0 siblings, 1 reply; 15+ messages in thread
From: Takashi Iwai @ 2011-08-24  8:59 UTC (permalink / raw)
  To: Ulo Mets; +Cc: alsa-devel

At Wed, 24 Aug 2011 07:53:00 +0200,
Takashi Iwai wrote:
> 
> > In Rec screen of Alsamixer all three mic volume and boost controls are present.
> > Autosensing of Dock Mic works, and so do its controls. Internal mic works too, but
> > autosensing of Ext mic does not.
> 
> Does ext-mic pin (0x18) jack-sense work with hda-emu at all?
> When this pin is selected, the recording is done via another ADC
> (0x15) instead of the one for int-mic and dock-mic (0x14).
> Try to reopen the recording stream when you plug the ext-mic.
> It might be a bug in the dynamic ADC-switching of the running stream.

The patch below should fix the ADC-switching behavior.


Takashi

---
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: hda/conexant - Enable ADC-switching for auto-mic mode,
 too

The ADC-switching can work also in the auto-mic mode, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_conexant.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 4c462c3..5616444 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3866,7 +3866,7 @@ static void cx_auto_parse_input(struct hda_codec *codec)
 	}
 	if (imux->num_items >= 2 && cfg->num_inputs == imux->num_items)
 		cx_auto_check_auto_mic(codec);
-	if (imux->num_items > 1 && !spec->auto_mic) {
+	if (imux->num_items > 1) {
 		for (i = 1; i < imux->num_items; i++) {
 			if (spec->imux_info[i].adc != spec->imux_info[0].adc) {
 				spec->adc_switching = 1;
-- 
1.7.6

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

* Re: Conexant 5051 lenovo-x200 fixes
  2011-08-24  8:59                   ` Takashi Iwai
@ 2011-08-24 11:26                     ` Ulo Mets
  2011-08-24 11:58                       ` Takashi Iwai
  0 siblings, 1 reply; 15+ messages in thread
From: Ulo Mets @ 2011-08-24 11:26 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On 08/24/2011 11:59 AM, Takashi Iwai wrote:
> At Wed, 24 Aug 2011 07:53:00 +0200,
> Takashi Iwai wrote:
>>> In Rec screen of Alsamixer all three mic volume and boost controls are present.
>>> Autosensing of Dock Mic works, and so do its controls. Internal mic works too, but
>>> autosensing of Ext mic does not.
>> Does ext-mic pin (0x18) jack-sense work with hda-emu at all?
>> When this pin is selected, the recording is done via another ADC
>> (0x15) instead of the one for int-mic and dock-mic (0x14).
>> Try to reopen the recording stream when you plug the ext-mic.
>> It might be a bug in the dynamic ADC-switching of the running stream.
> The patch below should fix the ADC-switching behavior.
Thank you so much! Recording side works also great now.
The only remaining issue seems to be that the Auto-Mute Mode control
has no effeect on speaker muting. It is always muted.
The speaker mute button on the keyboard also mutes the speaker, and the volume buttons unmute it.
The Beep volume also works, but Beep mute only affects the treble content of the beep.

And then the most important part: in proc file, both Dock connectors are described as black,
and the Dock Mic location states "at sep Left", while it should be "sep Rear" I believe.

If you need to test anything else on X200t, or T420, I'll be happy to help.

Thanks once more!
With best regards,

Ulo

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

* Re: Conexant 5051 lenovo-x200 fixes
  2011-08-24 11:26                     ` Ulo Mets
@ 2011-08-24 11:58                       ` Takashi Iwai
  2011-08-24 16:33                         ` Takashi Iwai
  0 siblings, 1 reply; 15+ messages in thread
From: Takashi Iwai @ 2011-08-24 11:58 UTC (permalink / raw)
  To: Ulo Mets; +Cc: alsa-devel

At Wed, 24 Aug 2011 14:26:51 +0300,
Ulo Mets wrote:
> 
> On 08/24/2011 11:59 AM, Takashi Iwai wrote:
> > At Wed, 24 Aug 2011 07:53:00 +0200,
> > Takashi Iwai wrote:
> >>> In Rec screen of Alsamixer all three mic volume and boost controls are present.
> >>> Autosensing of Dock Mic works, and so do its controls. Internal mic works too, but
> >>> autosensing of Ext mic does not.
> >> Does ext-mic pin (0x18) jack-sense work with hda-emu at all?
> >> When this pin is selected, the recording is done via another ADC
> >> (0x15) instead of the one for int-mic and dock-mic (0x14).
> >> Try to reopen the recording stream when you plug the ext-mic.
> >> It might be a bug in the dynamic ADC-switching of the running stream.
> > The patch below should fix the ADC-switching behavior.
> Thank you so much! Recording side works also great now.
> The only remaining issue seems to be that the Auto-Mute Mode control
> has no effeect on speaker muting. It is always muted.
> The speaker mute button on the keyboard also mutes the speaker, and the volume buttons unmute it.

It might be the thinkpad_acpi stuff?  Some ThinkPads have another layer
of the speaker-mute, and it works independently from the sound device.

> The Beep volume also works, but Beep mute only affects the treble content of the beep.
> 
> And then the most important part: in proc file, both Dock connectors are described as black,
> and the Dock Mic location states "at sep Left", while it should be "sep Rear" I believe.

It doesn't matter as long as it works.  You can rotate the device :)
If it's important, just adjust the pin-config value as you like.


Takashi

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

* Re: Conexant 5051 lenovo-x200 fixes
  2011-08-24 11:58                       ` Takashi Iwai
@ 2011-08-24 16:33                         ` Takashi Iwai
  0 siblings, 0 replies; 15+ messages in thread
From: Takashi Iwai @ 2011-08-24 16:33 UTC (permalink / raw)
  To: Ulo Mets; +Cc: alsa-devel

At Wed, 24 Aug 2011 13:58:27 +0200,
Takashi Iwai wrote:
> 
> At Wed, 24 Aug 2011 14:26:51 +0300,
> Ulo Mets wrote:
> > 
> > On 08/24/2011 11:59 AM, Takashi Iwai wrote:
> > > At Wed, 24 Aug 2011 07:53:00 +0200,
> > > Takashi Iwai wrote:
> > >>> In Rec screen of Alsamixer all three mic volume and boost controls are present.
> > >>> Autosensing of Dock Mic works, and so do its controls. Internal mic works too, but
> > >>> autosensing of Ext mic does not.
> > >> Does ext-mic pin (0x18) jack-sense work with hda-emu at all?
> > >> When this pin is selected, the recording is done via another ADC
> > >> (0x15) instead of the one for int-mic and dock-mic (0x14).
> > >> Try to reopen the recording stream when you plug the ext-mic.
> > >> It might be a bug in the dynamic ADC-switching of the running stream.
> > > The patch below should fix the ADC-switching behavior.
> > Thank you so much! Recording side works also great now.
> > The only remaining issue seems to be that the Auto-Mute Mode control
> > has no effeect on speaker muting. It is always muted.
> > The speaker mute button on the keyboard also mutes the speaker, and the volume buttons unmute it.
> 
> It might be the thinkpad_acpi stuff?  Some ThinkPads have another layer
> of the speaker-mute, and it works independently from the sound device.
> 
> > The Beep volume also works, but Beep mute only affects the treble content of the beep.
> > 
> > And then the most important part: in proc file, both Dock connectors are described as black,
> > and the Dock Mic location states "at sep Left", while it should be "sep Rear" I believe.
> 
> It doesn't matter as long as it works.  You can rotate the device :)
> If it's important, just adjust the pin-config value as you like.

FWIW, the patch below is the implementation of static configuration.
With this, the driver should work as is (at least for 3.1 kernel).
For 3.0 kernel, you'd need to pass model=auto.


Takashi

---
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: hda - Rewrite Lenovo X200 quirk with pincfg-fix using
 auto-parser

Introduce the pincfg table to patch_conexant.c for fixing up the extra
pin-configuration for auto-parser.  As an example, Lenovo X200 model is
replaced with this new mechanism.  (This also fixes the wrong mixer
elements for docking-station I/O in the previous model quirk
automagically.)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 Documentation/sound/alsa/HD-Audio-Models.txt |    1 -
 sound/pci/hda/patch_conexant.c               |   93 ++++++++++++++------------
 2 files changed, 50 insertions(+), 44 deletions(-)

diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt
index 57e80eb..7085436 100644
--- a/Documentation/sound/alsa/HD-Audio-Models.txt
+++ b/Documentation/sound/alsa/HD-Audio-Models.txt
@@ -237,7 +237,6 @@ Conexant 5051
   hp-dv6736	HP dv6736
   hp-f700	HP Compaq Presario F700
   ideapad	Lenovo IdeaPad laptop
-  lenovo-x200	Lenovo X200 laptop
   toshiba	Toshiba Satellite M300
 
 Conexant 5066
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 5616444..197ad93 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -1867,39 +1867,6 @@ static const struct hda_verb cxt5051_hp_dv6736_init_verbs[] = {
 	{ } /* end */
 };
 
-static const struct hda_verb cxt5051_lenovo_x200_init_verbs[] = {
-	/* Line in, Mic */
-	{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
-	{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
-	{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
-	{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
-	{0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
-	{0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
-	/* SPK  */
-	{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
-	{0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
-	/* HP, Amp  */
-	{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
-	{0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
-	/* Docking HP */
-	{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
-	{0x19, AC_VERB_SET_CONNECT_SEL, 0x00},
-	/* DAC1 */
-	{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
-	/* Record selector: Internal mic */
-	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x44},
-	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1) | 0x44},
-	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x44},
-	/* SPDIF route: PCM */
-	{0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* needed for W500 Advanced Mini Dock 250410 */
-	{0x1c, AC_VERB_SET_CONNECT_SEL, 0x0},
-	/* EAPD */
-	{0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */
-	{0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT},
-	{0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT},
-	{ } /* end */
-};
-
 static const struct hda_verb cxt5051_f700_init_verbs[] = {
 	/* Line in, Mic */
 	{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
@@ -1968,7 +1935,6 @@ enum {
 	CXT5051_LAPTOP,	 /* Laptops w/ EAPD support */
 	CXT5051_HP,	/* no docking */
 	CXT5051_HP_DV6736,	/* HP without mic switch */
-	CXT5051_LENOVO_X200,	/* Lenovo X200 laptop, also used for Advanced Mini Dock 250410 */
 	CXT5051_F700,       /* HP Compaq Presario F700 */
 	CXT5051_TOSHIBA,	/* Toshiba M300 & co */
 	CXT5051_IDEAPAD,	/* Lenovo IdeaPad Y430 */
@@ -1980,7 +1946,6 @@ static const char *const cxt5051_models[CXT5051_MODELS] = {
 	[CXT5051_LAPTOP]	= "laptop",
 	[CXT5051_HP]		= "hp",
 	[CXT5051_HP_DV6736]	= "hp-dv6736",
-	[CXT5051_LENOVO_X200]	= "lenovo-x200",
 	[CXT5051_F700]          = "hp-700",
 	[CXT5051_TOSHIBA]	= "toshiba",
 	[CXT5051_IDEAPAD]	= "ideapad",
@@ -1995,7 +1960,6 @@ static const struct snd_pci_quirk cxt5051_cfg_tbl[] = {
 	SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board",
 		      CXT5051_LAPTOP),
 	SND_PCI_QUIRK(0x14f1, 0x5051, "HP Spartan 1.1", CXT5051_HP),
-	SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT5051_LENOVO_X200),
 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo IdeaPad", CXT5051_IDEAPAD),
 	{}
 };
@@ -2053,13 +2017,6 @@ static int patch_cxt5051(struct hda_codec *codec)
 		spec->mixers[0] = cxt5051_hp_dv6736_mixers;
 		spec->auto_mic = 0;
 		break;
-	case CXT5051_LENOVO_X200:
-		spec->init_verbs[0] = cxt5051_lenovo_x200_init_verbs;
-		/* Thinkpad X301 does not have S/PDIF wired and no ability
-		   to use a docking station. */
-		if (codec->subsystem_id == 0x17aa211f)
-			spec->multiout.dig_out_nid = 0;
-		break;
 	case CXT5051_F700:
 		spec->init_verbs[0] = cxt5051_f700_init_verbs;
 		spec->mixers[0] = cxt5051_f700_mixers;
@@ -4385,6 +4342,53 @@ static const struct hda_codec_ops cx_auto_patch_ops = {
 	.reboot_notify = snd_hda_shutup_pins,
 };
 
+/*
+ * pin fix-up
+ */
+struct cxt_pincfg {
+	hda_nid_t nid;
+	u32 val;
+};
+
+static void apply_pincfg(struct hda_codec *codec, const struct cxt_pincfg *cfg)
+{
+	for (; cfg->nid; cfg++)
+		snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
+
+}
+
+static void apply_pin_fixup(struct hda_codec *codec,
+			    const struct snd_pci_quirk *quirk,
+			    const struct cxt_pincfg **table)
+{
+	quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
+	if (quirk) {
+		snd_printdd(KERN_INFO "hda_codec: applying pincfg for %s\n",
+			    quirk->name);
+		apply_pincfg(codec, table[quirk->value]);
+	}
+}
+
+enum {
+	CXT_PINCFG_LENOVO_X200,
+};
+
+static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = {
+	{ 0x16, 0x042140ff }, /* HP (seq# overridden) */
+	{ 0x17, 0x21a11000 }, /* dock-mic */
+	{ 0x19, 0x2121103f }, /* dock-HP */
+	{}
+};
+
+static const struct cxt_pincfg *cxt_pincfg_tbl[] = {
+	[CXT_PINCFG_LENOVO_X200] = cxt_pincfg_lenovo_x200,
+};
+
+static const struct snd_pci_quirk cxt_fixups[] = {
+	SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200),
+	{}
+};
+
 static int patch_conexant_auto(struct hda_codec *codec)
 {
 	struct conexant_spec *spec;
@@ -4398,6 +4402,9 @@ static int patch_conexant_auto(struct hda_codec *codec)
 		return -ENOMEM;
 	codec->spec = spec;
 	codec->pin_amp_workaround = 1;
+
+	apply_pin_fixup(codec, cxt_fixups, cxt_pincfg_tbl);
+
 	err = cx_auto_search_adcs(codec);
 	if (err < 0)
 		return err;
-- 
1.7.6

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

end of thread, other threads:[~2011-08-24 16:33 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-18  0:45 Conexant 5051 lenovo-x200 fixes Ulo Mets
2011-08-18 10:08 ` Takashi Iwai
2011-08-19  0:00   ` Ulo Mets
2011-08-19  5:43     ` Takashi Iwai
2011-08-20 15:14       ` Ülo Mets
2011-08-22 12:00         ` Takashi Iwai
2011-08-23 11:32           ` Ulo Mets
2011-08-23 13:10             ` Takashi Iwai
2011-08-24  2:45               ` Ulo Mets
2011-08-24  3:25               ` Ulo Mets
2011-08-24  5:53                 ` Takashi Iwai
2011-08-24  8:59                   ` Takashi Iwai
2011-08-24 11:26                     ` Ulo Mets
2011-08-24 11:58                       ` Takashi Iwai
2011-08-24 16:33                         ` Takashi Iwai

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.