All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
@ 2009-09-23  5:39 Manoj Iyer
  2009-09-23  5:50   ` Takashi Iwai
  0 siblings, 1 reply; 22+ messages in thread
From: Manoj Iyer @ 2009-09-23  5:39 UTC (permalink / raw)
  To: tiwai, perex; +Cc: alsa-devel, linux-kernel


>From c96629e96fecbe59de7124ec913019ed378d0029 Mon Sep 17 00:00:00 2001
From: Manoj Iyer <manoj.iyer@canonical.com>
Date: Tue, 22 Sep 2009 18:33:29 -0500
Subject: [PATCH] [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200

Patch was tested on Toshiba NB200 and is found to enable sound.

Signed-off-by: Manoj Iyer <manoj.iyer@canonical.com>
Cc: stable@kernel.org
---
  sound/pci/hda/patch_realtek.c |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 30eeb30..713bf69 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -16876,6 +16876,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
  	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
  	SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
  		      ALC662_3ST_6ch_DIG),
+	SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
  	SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
  	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
  		      ALC662_3ST_6ch_DIG),
-- 
1.6.3.3


--- manjo

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
  2009-09-23  5:39 [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200 Manoj Iyer
@ 2009-09-23  5:50   ` Takashi Iwai
  0 siblings, 0 replies; 22+ messages in thread
From: Takashi Iwai @ 2009-09-23  5:50 UTC (permalink / raw)
  To: Manoj Iyer; +Cc: perex, alsa-devel, linux-kernel

At Wed, 23 Sep 2009 00:39:45 -0500 (CDT),
Manoj Iyer wrote:
> 
> 
> >From c96629e96fecbe59de7124ec913019ed378d0029 Mon Sep 17 00:00:00 2001
> From: Manoj Iyer <manoj.iyer@canonical.com>
> Date: Tue, 22 Sep 2009 18:33:29 -0500
> Subject: [PATCH] [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
> 
> Patch was tested on Toshiba NB200 and is found to enable sound.

So, it doesn't work without the model quirk?
Could you give alsa-info.sh output (run with --no-upload option)?


thanks,

Takashi

> 
> Signed-off-by: Manoj Iyer <manoj.iyer@canonical.com>
> Cc: stable@kernel.org
> ---
>   sound/pci/hda/patch_realtek.c |    1 +
>   1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index 30eeb30..713bf69 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -16876,6 +16876,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
>   	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
>   	SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
>   		      ALC662_3ST_6ch_DIG),
> +	SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
>   	SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
>   	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
>   		      ALC662_3ST_6ch_DIG),
> -- 
> 1.6.3.3
> 
> 
> --- manjo
> 

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
@ 2009-09-23  5:50   ` Takashi Iwai
  0 siblings, 0 replies; 22+ messages in thread
From: Takashi Iwai @ 2009-09-23  5:50 UTC (permalink / raw)
  To: Manoj Iyer; +Cc: alsa-devel, linux-kernel

At Wed, 23 Sep 2009 00:39:45 -0500 (CDT),
Manoj Iyer wrote:
> 
> 
> >From c96629e96fecbe59de7124ec913019ed378d0029 Mon Sep 17 00:00:00 2001
> From: Manoj Iyer <manoj.iyer@canonical.com>
> Date: Tue, 22 Sep 2009 18:33:29 -0500
> Subject: [PATCH] [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
> 
> Patch was tested on Toshiba NB200 and is found to enable sound.

So, it doesn't work without the model quirk?
Could you give alsa-info.sh output (run with --no-upload option)?


thanks,

Takashi

> 
> Signed-off-by: Manoj Iyer <manoj.iyer@canonical.com>
> Cc: stable@kernel.org
> ---
>   sound/pci/hda/patch_realtek.c |    1 +
>   1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index 30eeb30..713bf69 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -16876,6 +16876,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
>   	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
>   	SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
>   		      ALC662_3ST_6ch_DIG),
> +	SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
>   	SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
>   	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
>   		      ALC662_3ST_6ch_DIG),
> -- 
> 1.6.3.3
> 
> 
> --- manjo
> 

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
  2009-09-23  5:50   ` Takashi Iwai
  (?)
@ 2009-09-28 15:30   ` manoj.iyer
  2009-09-29  7:23       ` Takashi Iwai
  -1 siblings, 1 reply; 22+ messages in thread
From: manoj.iyer @ 2009-09-28 15:30 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Manoj Iyer, perex, alsa-devel, linux-kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1654 bytes --]


Takashi,

Please find attached also-info output after the patch was applied. Also, 
uploaded to:

http://www.alsa-project.org/db/?f=8e97e173ae5364a7e015c173bc2adadb7a20605e

--- manjo

On Wed, 23 Sep 2009, Takashi Iwai wrote:

> At Wed, 23 Sep 2009 00:39:45 -0500 (CDT),
> Manoj Iyer wrote:
>>
>>
>>> From c96629e96fecbe59de7124ec913019ed378d0029 Mon Sep 17 00:00:00 2001
>> From: Manoj Iyer <manoj.iyer@canonical.com>
>> Date: Tue, 22 Sep 2009 18:33:29 -0500
>> Subject: [PATCH] [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
>>
>> Patch was tested on Toshiba NB200 and is found to enable sound.
>
> So, it doesn't work without the model quirk?
> Could you give alsa-info.sh output (run with --no-upload option)?
>
>
> thanks,
>
> Takashi
>
>>
>> Signed-off-by: Manoj Iyer <manoj.iyer@canonical.com>
>> Cc: stable@kernel.org
>> ---
>>   sound/pci/hda/patch_realtek.c |    1 +
>>   1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
>> index 30eeb30..713bf69 100644
>> --- a/sound/pci/hda/patch_realtek.c
>> +++ b/sound/pci/hda/patch_realtek.c
>> @@ -16876,6 +16876,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
>>   	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
>>   	SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
>>   		      ALC662_3ST_6ch_DIG),
>> +	SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
>>   	SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
>>   	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
>>   		      ALC662_3ST_6ch_DIG),
>> --
>> 1.6.3.3
>>
>>
>> --- manjo
>>
>

[-- Attachment #2: Type: TEXT/PLAIN, Size: 22496 bytes --]

upload=true&script=true&cardinfo=
!!################################
!!ALSA Information Script v 0.4.58
!!################################

!!Script ran on: Mon Sep 28 15:22:09 UTC 2009


!!Linux Distribution
!!------------------

Ubuntu karmic (development branch) \n \l DISTRIB_ID=Ubuntu DISTRIB_DESCRIPTION="Ubuntu karmic (development branch)"


!!DMI Information
!!---------------

Manufacturer:      TOSHIBA
Product Name:      *


!!Kernel Information
!!------------------

Kernel release:    2.6.31-10-generic
Operating System:  GNU/Linux
Architecture:      i686
Processor:         unknown
SMP Enabled:       Yes


!!ALSA Version
!!------------

Driver version:     1.0.20
Library version:    1.0.20
Utilities version:  1.0.20


!!Loaded ALSA modules
!!-------------------

snd_hda_intel


!!Sound Servers on this system
!!----------------------------

Pulseaudio:
      Installed - Yes (/usr/bin/pulseaudio)
      Running - Yes

ESound Daemon:
      Installed - Yes (/usr/bin/esd)
      Running - No


!!Soundcards recognised by ALSA
!!-----------------------------

 0 [Intel          ]: HDA-Intel - HDA Intel
                      HDA Intel at 0xf0440000 irq 22


!!PCI Soundcards installed in the system
!!--------------------------------------

00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 02)


!!Advanced information - PCI Vendor/Device/Susbsystem ID's
!!--------------------------------------------------------

00:1b.0 0403: 8086:27d8 (rev 02)
	Subsystem: 1179:ff6e


!!Modprobe options (Sound related)
!!--------------------------------

snd-atiixp-modem: index=-2
snd-intel8x0m: index=-2
snd-via82xx-modem: index=-2
snd-usb-audio: index=-2
snd-usb-us122l: index=-2
snd-usb-usx2y: index=-2
snd-usb-caiaq: index=-2
snd-cmipci: mpu_port=0x330 fm_port=0x388
snd-pcsp: index=-2
snd-hda-intel: power_save=10


!!Loaded sound module options
!!--------------------------

!!Module: snd_hda_intel
	bdl_pos_adj : 1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
	enable : Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y
	enable_msi : 0
	id : <NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>
	index : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
	model : <NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>,<NULL>
	position_fix : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	power_save : 10
	power_save_controller : Y
	probe_mask : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
	probe_only : N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
	single_cmd : N


!!HDA-Intel Codec information
!!---------------------------
--startcollapse--

Codec: Realtek ALC272
Address: 0
Function Id: 0x1
Vendor Id: 0x10ec0272
Subsystem Id: 0x1179ff6e
Revision Id: 0x100001
No Modem Function Group found
Default PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
GPIO: io=2, o=0, i=0, unsolicited=1, wake=0
  IO[0]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
  IO[1]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
Node 0x02 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Amp-Out caps: ofs=0x40, nsteps=0x40, stepsize=0x03, mute=0
  Amp-Out vals:  [0x3f 0x3f]
  Converter: stream=0, channel=0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power: setting=D0, actual=D0
Node 0x03 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Amp-Out caps: ofs=0x40, nsteps=0x40, stepsize=0x03, mute=0
  Amp-Out vals:  [0x40 0x40]
  Converter: stream=0, channel=0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power: setting=D0, actual=D0
Node 0x04 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Amp-Out caps: ofs=0x40, nsteps=0x40, stepsize=0x03, mute=0
  Amp-Out vals:  [0x3f 0x3f]
  Converter: stream=0, channel=0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power: setting=D0, actual=D0
Node 0x05 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x06 [Audio Output] wcaps 0x611: Stereo Digital
  Converter: stream=0, channel=0
  Digital:
  Digital category: 0x0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power: setting=D0, actual=D0
Node 0x07 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x08 [Audio Input] wcaps 0x10051b: Stereo Amp-In
  Amp-In caps: ofs=0x0b, nsteps=0x1f, stepsize=0x05, mute=1
  Amp-In vals:  [0x8b 0x8b]
  Converter: stream=0, channel=0
  SDI-Select: 0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power: setting=D0, actual=D0
  Connection: 1
     0x23
Node 0x09 [Audio Input] wcaps 0x10051b: Stereo Amp-In
  Amp-In caps: ofs=0x0b, nsteps=0x1f, stepsize=0x05, mute=1
  Amp-In vals:  [0x13 0x13]
  Converter: stream=0, channel=0
  SDI-Select: 0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power: setting=D0, actual=D0
  Connection: 1
     0x22
Node 0x0a [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x0b [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
  Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1
  Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x97 0x97] [0x97 0x97] [0x97 0x97]
  Connection: 8
     0x18 0x19 0x1a 0x1b 0x1d 0x14 0x15 0x16
Node 0x0c [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x00 0x00] [0x00 0x00]
  Connection: 2
     0x02 0x0b
Node 0x0d [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x00 0x00] [0x00 0x00]
  Connection: 2
     0x03 0x0b
Node 0x0e [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x00 0x00] [0x00 0x00]
  Connection: 2
     0x04 0x0b
Node 0x0f [Audio Mixer] wcaps 0x20010a: Mono Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x00] [0x80]
  Connection: 2
     0x02 0x0b
Node 0x10 [Audio Output] wcaps 0x611: Stereo Digital
  Converter: stream=0, channel=0
  Digital:
  Digital category: 0x0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power: setting=D0, actual=D0
Node 0x11 [Pin Complex] wcaps 0x400700: Mono Digital
  Pincap 0x00000010: OUT
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Power: setting=D0, actual=D0
  Connection: 1
     0x10
Node 0x12 [Pin Complex] wcaps 0x400401: Stereo
  Pincap 0x00000020: IN
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00:
  Power: setting=D0, actual=D0
Node 0x13 [Pin Complex] wcaps 0x400401: Stereo
  Pincap 0x00000020: IN
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00:
  Power: setting=D0, actual=D0
Node 0x14 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0001003c: IN OUT HP EAPD Detect
  EAPD 0x2: EAPD
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=00, enabled=0
  Power: setting=D0, actual=D0
  Connection: 2
     0x0c* 0x0d
Node 0x15 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0001003c: IN OUT HP EAPD Detect
  EAPD 0x2: EAPD
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=00, enabled=0
  Power: setting=D0, actual=D0
  Connection: 2
     0x0c* 0x0d
Node 0x16 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x00000034: IN OUT Detect
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=00, enabled=0
  Power: setting=D0, actual=D0
  Connection: 1
     0x0e
Node 0x17 [Pin Complex] wcaps 0x40050c: Mono Amp-Out
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x80]
  Pincap 0x00000010: OUT
  Pin Default 0x99130110: [Fixed] Speaker at Int ATAPI
    Conn = ATAPI, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00:
  Power: setting=D0, actual=D0
  Connection: 1
     0x0f
Node 0x18 [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
  Amp-In vals:  [0x00 0x00]
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x80 0x80]
  Pincap 0x00001734: IN OUT Detect
    Vref caps: HIZ 50 GRD 80
  Pin Default 0x03a11c30: [Jack] Mic at Ext Left
    Conn = 1/8, Color = Black
    DefAssociation = 0x3, Sequence = 0x0
  Pin-ctls: 0x24: IN VREF_80
  Unsolicited: tag=08, enabled=1
  Power: setting=D0, actual=D0
  Connection: 1
     0x0e
Node 0x19 [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
  Amp-In vals:  [0x00 0x00]
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x80 0x80]
  Pincap 0x0000173c: IN OUT HP Detect
    Vref caps: HIZ 50 GRD 80
  Pin Default 0x99a3093f: [Fixed] Mic at Int ATAPI
    Conn = ATAPI, Color = Unknown
    DefAssociation = 0x3, Sequence = 0xf
    Misc = NO_PRESENCE
  Pin-ctls: 0x24: IN VREF_80
  Unsolicited: tag=00, enabled=0
  Power: setting=D0, actual=D0
  Connection: 3
     0x0c* 0x0d 0x0e
Node 0x1a [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
  Amp-In vals:  [0x00 0x00]
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x80 0x80]
  Pincap 0x00001734: IN OUT Detect
    Vref caps: HIZ 50 GRD 80
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x20: IN VREF_HIZ
  Unsolicited: tag=00, enabled=0
  Power: setting=D0, actual=D0
  Connection: 1
     0x0d
Node 0x1b [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
  Amp-In vals:  [0x00 0x00]
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0000173c: IN OUT HP Detect
    Vref caps: HIZ 50 GRD 80
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0xc0: OUT HP VREF_HIZ
  Unsolicited: tag=00, enabled=0
  Power: setting=D0, actual=D0
  Connection: 3
     0x0c* 0x0d 0x0e
Node 0x1c [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x1d [Pin Complex] wcaps 0x400400: Mono
  Pincap 0x00000020: IN
  Pin Default 0x40178e2d: [N/A] Speaker at Ext N/A
    Conn = Analog, Color = Purple
    DefAssociation = 0x2, Sequence = 0xd
  Pin-ctls: 0x20: IN
  Power: setting=D0, actual=D0
Node 0x1e [Pin Complex] wcaps 0x400780: Mono Digital
  Pincap 0x00000014: OUT Detect
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=00, enabled=0
  Power: setting=D0, actual=D0
  Connection: 1
     0x06
Node 0x1f [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x20 [Vendor Defined Widget] wcaps 0xf00040: Mono
  Processing caps: benign=0, ncoeff=17
  Processing Coefficient: 0x80
  Coefficient Index: 0x06
Node 0x21 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0000001c: OUT HP Detect
  Pin Default 0x03211420: [Jack] HP Out at Ext Left
    Conn = 1/8, Color = Black
    DefAssociation = 0x2, Sequence = 0x0
  Pin-ctls: 0xc0: OUT HP
  Unsolicited: tag=04, enabled=1
  Power: setting=D0, actual=D0
  Connection: 3
     0x0c 0x0d* 0x0e
Node 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x80 0x80] [0x00 0x00] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80]
  Connection: 10
     0x18 0x19 0x1a 0x1b 0x1d 0x14 0x15 0x16 0x0b 0x12
Node 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x80 0x80] [0x00 0x00] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80]
  Connection: 10
     0x18 0x19 0x1a 0x1b 0x1d 0x14 0x15 0x16 0x0b 0x13
--endcollapse--


!!ALSA Device nodes
!!-----------------

crw-rw----+ 1 root audio 116, 7 Sep 28 09:17 /dev/snd/controlC0
crw-rw----+ 1 root audio 116, 6 Sep 28 09:20 /dev/snd/pcmC0D0c
crw-rw----+ 1 root audio 116, 5 Sep 28 09:20 /dev/snd/pcmC0D0p
crw-rw----+ 1 root audio 116, 4 Sep 28 09:20 /dev/snd/pcmC0D1p
crw-rw----+ 1 root audio 116, 3 Sep 28 09:17 /dev/snd/seq
crw-rw----+ 1 root audio 116, 2 Sep 28 09:17 /dev/snd/timer

/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root  60 Sep 28 09:17 .
drwxr-xr-x 3 root root 180 Sep 28 09:17 ..
lrwxrwxrwx 1 root root  12 Sep 28 09:17 pci-0000:00:1b.0 -> ../controlC0


!!Aplay/Arecord output
!!------------

APLAY

**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC272 Analog [ALC272 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC272 Digital [ALC272 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

ARECORD

**** List of CAPTURE Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC272 Analog [ALC272 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

!!Amixer output
!!-------------

!!-------Mixer controls for card 0 [Intel]

Card hw:0 'Intel'/'HDA Intel at 0xf0440000 irq 22'
  Mixer name	: 'Realtek ALC272'
  Components	: 'HDA:10ec0272,1179ff6e,00100001'
  Controls      : 16
  Simple ctrls  : 8
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 64
  Mono:
  Front Left: Playback 63 [98%] [-1.00dB] [on]
  Front Right: Playback 63 [98%] [-1.00dB] [on]
Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 64
  Mono:
  Front Left: Playback 64 [100%] [0.00dB] [on]
  Front Right: Playback 64 [100%] [0.00dB] [on]
Simple mixer control 'PCM',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 252 [99%] [0.60dB]
  Front Right: Playback 252 [99%] [0.60dB]
Simple mixer control 'Mic',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'IEC958',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'IEC958 Default PCM',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 31
  Front Left: Capture 19 [61%] [12.00dB] [on]
  Front Right: Capture 19 [61%] [12.00dB] [on]
Simple mixer control 'Beep',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]


!!Alsactl output
!!-------------

--startcollapse--
state.Intel {
	control.1 {
		comment.access 'read write'
		comment.type INTEGER
		comment.count 2
		comment.range '0 - 64'
		comment.dbmin -6400
		comment.dbmax 0
		iface MIXER
		name 'Master Playback Volume'
		value.0 63
		value.1 63
	}
	control.2 {
		comment.access 'read write'
		comment.type BOOLEAN
		comment.count 2
		iface MIXER
		name 'Master Playback Switch'
		value.0 true
		value.1 true
	}
	control.3 {
		comment.access 'read write'
		comment.type INTEGER
		comment.count 2
		comment.range '0 - 64'
		comment.dbmin -6400
		comment.dbmax 0
		iface MIXER
		name 'Headphone Playback Volume'
		value.0 64
		value.1 64
	}
	control.4 {
		comment.access 'read write'
		comment.type BOOLEAN
		comment.count 2
		iface MIXER
		name 'Headphone Playback Switch'
		value.0 true
		value.1 true
	}
	control.5 {
		comment.access 'read write'
		comment.type INTEGER
		comment.count 2
		comment.range '0 - 31'
		comment.dbmin -3450
		comment.dbmax 1200
		iface MIXER
		name 'Mic Playback Volume'
		value.0 0
		value.1 0
	}
	control.6 {
		comment.access 'read write'
		comment.type BOOLEAN
		comment.count 2
		iface MIXER
		name 'Mic Playback Switch'
		value.0 false
		value.1 false
	}
	control.7 {
		comment.access 'read write'
		comment.type INTEGER
		comment.count 2
		comment.range '0 - 31'
		comment.dbmin -1650
		comment.dbmax 3000
		iface MIXER
		name 'Capture Volume'
		value.0 19
		value.1 19
	}
	control.8 {
		comment.access 'read write'
		comment.type BOOLEAN
		comment.count 2
		iface MIXER
		name 'Capture Switch'
		value.0 true
		value.1 true
	}
	control.9 {
		comment.access read
		comment.type IEC958
		comment.count 1
		iface MIXER
		name 'IEC958 Playback Con Mask'
		value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
	}
	control.10 {
		comment.access read
		comment.type IEC958
		comment.count 1
		iface MIXER
		name 'IEC958 Playback Pro Mask'
		value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
	}
	control.11 {
		comment.access 'read write'
		comment.type IEC958
		comment.count 1
		iface MIXER
		name 'IEC958 Playback Default'
		value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
	}
	control.12 {
		comment.access 'read write'
		comment.type BOOLEAN
		comment.count 1
		iface MIXER
		name 'IEC958 Playback Switch'
		value false
	}
	control.13 {
		comment.access 'read write'
		comment.type BOOLEAN
		comment.count 1
		iface MIXER
		name 'IEC958 Default PCM Playback Switch'
		value true
	}
	control.14 {
		comment.access 'read write'
		comment.type INTEGER
		comment.count 2
		comment.range '0 - 31'
		comment.dbmin -3450
		comment.dbmax 1200
		iface MIXER
		name 'Beep Playback Volume'
		value.0 0
		value.1 0
	}
	control.15 {
		comment.access 'read write'
		comment.type BOOLEAN
		comment.count 2
		iface MIXER
		name 'Beep Playback Switch'
		value.0 false
		value.1 false
	}
	control.16 {
		comment.access 'read write user'
		comment.type INTEGER
		comment.count 2
		comment.range '0 - 255'
		comment.tlv '0000000100000008ffffec1400000014'
		comment.dbmin -5100
		comment.dbmax 0
		iface MIXER
		name 'PCM Playback Volume'
		value.0 252
		value.1 252
	}
}
--endcollapse--


!!All Loaded Modules
!!------------------

Module
binfmt_misc
ppdev
fbcon
tileblit
font
bitblit
softcursor
joydev
snd_hda_codec_realtek
snd_hda_intel
snd_hda_codec
snd_pcm_oss
snd_mixer_oss
snd_pcm
snd_seq_dummy
snd_seq_oss
snd_seq_midi
snd_rawmidi
iptable_filter
arc4
ecb
ip_tables
snd_seq_midi_event
x_tables
snd_seq
snd_timer
snd_seq_device
i915
uvcvideo
videodev
v4l1_compat
ath9k
mac80211
led_class
ath
snd
intel_agp
psmouse
serio_raw
drm
i2c_algo_bit
soundcore
cfg80211
agpgart
snd_page_alloc
video
output
lp
parport
r8169
mii


!!ALSA/HDA dmesg
!!------------------

[   91.322069]   alloc kstat_irqs on node -1
[   91.322087] HDA Intel 0000:00:1b.0: PCI INT A -> GSI 22 (level, low) -> IRQ 22
[   91.322175] HDA Intel 0000:00:1b.0: setting latency timer to 64
[   91.425083] input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/input/input7
[   91.609531] input: PS/2 Mouse as /devices/platform/i8042/serio1/input/input8



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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
  2009-09-28 15:30   ` manoj.iyer
@ 2009-09-29  7:23       ` Takashi Iwai
  0 siblings, 0 replies; 22+ messages in thread
From: Takashi Iwai @ 2009-09-29  7:23 UTC (permalink / raw)
  To: manoj.iyer; +Cc: perex, alsa-devel, linux-kernel

At Mon, 28 Sep 2009 10:30:22 -0500 (CDT),
manoj.iyer@canonical.com wrote:
> 
> 
> Takashi,
> 
> Please find attached also-info output after the patch was applied. Also, 
> uploaded to:
> 
> http://www.alsa-project.org/db/?f=8e97e173ae5364a7e015c173bc2adadb7a20605e

Thanks.  And what about my first question?
Doesn't the latest driver work without your change?
Try alsa-driver-snapshot tarball below if not tested yet.
  ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz

Or sound git tree master / for-next branches if you prefer kernel GIT:
  git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git


Takashi

> 
> --- manjo
> 
> On Wed, 23 Sep 2009, Takashi Iwai wrote:
> 
> > At Wed, 23 Sep 2009 00:39:45 -0500 (CDT),
> > Manoj Iyer wrote:
> >>
> >>
> >>> From c96629e96fecbe59de7124ec913019ed378d0029 Mon Sep 17 00:00:00 2001
> >> From: Manoj Iyer <manoj.iyer@canonical.com>
> >> Date: Tue, 22 Sep 2009 18:33:29 -0500
> >> Subject: [PATCH] [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
> >>
> >> Patch was tested on Toshiba NB200 and is found to enable sound.
> >
> > So, it doesn't work without the model quirk?
> > Could you give alsa-info.sh output (run with --no-upload option)?
> >
> >
> > thanks,
> >
> > Takashi
> >
> >>
> >> Signed-off-by: Manoj Iyer <manoj.iyer@canonical.com>
> >> Cc: stable@kernel.org
> >> ---
> >>   sound/pci/hda/patch_realtek.c |    1 +
> >>   1 files changed, 1 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> >> index 30eeb30..713bf69 100644
> >> --- a/sound/pci/hda/patch_realtek.c
> >> +++ b/sound/pci/hda/patch_realtek.c
> >> @@ -16876,6 +16876,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
> >>   	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
> >>   	SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
> >>   		      ALC662_3ST_6ch_DIG),
> >> +	SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
> >>   	SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
> >>   	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
> >>   		      ALC662_3ST_6ch_DIG),
> >> --
> >> 1.6.3.3
> >>
> >>
> >> --- manjo
> >>
> >

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
@ 2009-09-29  7:23       ` Takashi Iwai
  0 siblings, 0 replies; 22+ messages in thread
From: Takashi Iwai @ 2009-09-29  7:23 UTC (permalink / raw)
  To: manoj.iyer; +Cc: alsa-devel, linux-kernel

At Mon, 28 Sep 2009 10:30:22 -0500 (CDT),
manoj.iyer@canonical.com wrote:
> 
> 
> Takashi,
> 
> Please find attached also-info output after the patch was applied. Also, 
> uploaded to:
> 
> http://www.alsa-project.org/db/?f=8e97e173ae5364a7e015c173bc2adadb7a20605e

Thanks.  And what about my first question?
Doesn't the latest driver work without your change?
Try alsa-driver-snapshot tarball below if not tested yet.
  ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz

Or sound git tree master / for-next branches if you prefer kernel GIT:
  git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git


Takashi

> 
> --- manjo
> 
> On Wed, 23 Sep 2009, Takashi Iwai wrote:
> 
> > At Wed, 23 Sep 2009 00:39:45 -0500 (CDT),
> > Manoj Iyer wrote:
> >>
> >>
> >>> From c96629e96fecbe59de7124ec913019ed378d0029 Mon Sep 17 00:00:00 2001
> >> From: Manoj Iyer <manoj.iyer@canonical.com>
> >> Date: Tue, 22 Sep 2009 18:33:29 -0500
> >> Subject: [PATCH] [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
> >>
> >> Patch was tested on Toshiba NB200 and is found to enable sound.
> >
> > So, it doesn't work without the model quirk?
> > Could you give alsa-info.sh output (run with --no-upload option)?
> >
> >
> > thanks,
> >
> > Takashi
> >
> >>
> >> Signed-off-by: Manoj Iyer <manoj.iyer@canonical.com>
> >> Cc: stable@kernel.org
> >> ---
> >>   sound/pci/hda/patch_realtek.c |    1 +
> >>   1 files changed, 1 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> >> index 30eeb30..713bf69 100644
> >> --- a/sound/pci/hda/patch_realtek.c
> >> +++ b/sound/pci/hda/patch_realtek.c
> >> @@ -16876,6 +16876,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
> >>   	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
> >>   	SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
> >>   		      ALC662_3ST_6ch_DIG),
> >> +	SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
> >>   	SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
> >>   	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
> >>   		      ALC662_3ST_6ch_DIG),
> >> --
> >> 1.6.3.3
> >>
> >>
> >> --- manjo
> >>
> >

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
  2009-09-29  7:23       ` Takashi Iwai
  (?)
@ 2009-09-30  0:23       ` manoj.iyer
  2009-09-30  5:33           ` Takashi Iwai
  -1 siblings, 1 reply; 22+ messages in thread
From: manoj.iyer @ 2009-09-30  0:23 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: manoj.iyer, perex, alsa-devel, linux-kernel



> Thanks.  And what about my first question?

No, without the change sound does not work, and I can confirm this on 
NB200, NB205, and I hear that NB210 hass also the same hardware.

> Doesn't the latest driver work without your change?
> Try alsa-driver-snapshot tarball below if not tested yet.
>  ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz
>
> Or sound git tree master / for-next branches if you prefer kernel GIT:
>  git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git
>

I was not able to build the sound tree, but I installed the mainline 
kernel build (29th sept):

http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.31.1/

and sound does not work with that either.

>
> Takashi
>
>>
>> --- manjo
>>
>> On Wed, 23 Sep 2009, Takashi Iwai wrote:
>>
>>> At Wed, 23 Sep 2009 00:39:45 -0500 (CDT),
>>> Manoj Iyer wrote:
>>>>
>>>>
>>>>> From c96629e96fecbe59de7124ec913019ed378d0029 Mon Sep 17 00:00:00 2001
>>>> From: Manoj Iyer <manoj.iyer@canonical.com>
>>>> Date: Tue, 22 Sep 2009 18:33:29 -0500
>>>> Subject: [PATCH] [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
>>>>
>>>> Patch was tested on Toshiba NB200 and is found to enable sound.
>>>
>>> So, it doesn't work without the model quirk?
>>> Could you give alsa-info.sh output (run with --no-upload option)?
>>>
>>>
>>> thanks,
>>>
>>> Takashi
>>>
>>>>
>>>> Signed-off-by: Manoj Iyer <manoj.iyer@canonical.com>
>>>> Cc: stable@kernel.org
>>>> ---
>>>>   sound/pci/hda/patch_realtek.c |    1 +
>>>>   1 files changed, 1 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
>>>> index 30eeb30..713bf69 100644
>>>> --- a/sound/pci/hda/patch_realtek.c
>>>> +++ b/sound/pci/hda/patch_realtek.c
>>>> @@ -16876,6 +16876,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
>>>>   	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
>>>>   	SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
>>>>   		      ALC662_3ST_6ch_DIG),
>>>> +	SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
>>>>   	SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
>>>>   	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
>>>>   		      ALC662_3ST_6ch_DIG),
>>>> --
>>>> 1.6.3.3
>>>>
>>>>
>>>> --- manjo
>>>>
>>>
>

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
  2009-09-30  0:23       ` manoj.iyer
@ 2009-09-30  5:33           ` Takashi Iwai
  0 siblings, 0 replies; 22+ messages in thread
From: Takashi Iwai @ 2009-09-30  5:33 UTC (permalink / raw)
  To: manoj.iyer; +Cc: perex, alsa-devel, linux-kernel

At Tue, 29 Sep 2009 19:23:27 -0500 (CDT),
manoj.iyer@canonical.com wrote:
> 
> 
> 
> > Thanks.  And what about my first question?
> 
> No, without the change sound does not work, and I can confirm this on 
> NB200, NB205, and I hear that NB210 hass also the same hardware.

OK.

> > Doesn't the latest driver work without your change?
> > Try alsa-driver-snapshot tarball below if not tested yet.
> >  ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz
> >
> > Or sound git tree master / for-next branches if you prefer kernel GIT:
> >  git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git
> >
> 
> I was not able to build the sound tree, but I installed the mainline 
> kernel build (29th sept):
> 
> http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.31.1/
> 
> and sound does not work with that either.

2.6.31.x is way too old for testing the new stuff :)
Any chance to test 2.6.32-rc1?


thanks,

Takashi

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
@ 2009-09-30  5:33           ` Takashi Iwai
  0 siblings, 0 replies; 22+ messages in thread
From: Takashi Iwai @ 2009-09-30  5:33 UTC (permalink / raw)
  To: manoj.iyer; +Cc: alsa-devel, linux-kernel

At Tue, 29 Sep 2009 19:23:27 -0500 (CDT),
manoj.iyer@canonical.com wrote:
> 
> 
> 
> > Thanks.  And what about my first question?
> 
> No, without the change sound does not work, and I can confirm this on 
> NB200, NB205, and I hear that NB210 hass also the same hardware.

OK.

> > Doesn't the latest driver work without your change?
> > Try alsa-driver-snapshot tarball below if not tested yet.
> >  ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz
> >
> > Or sound git tree master / for-next branches if you prefer kernel GIT:
> >  git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git
> >
> 
> I was not able to build the sound tree, but I installed the mainline 
> kernel build (29th sept):
> 
> http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.31.1/
> 
> and sound does not work with that either.

2.6.31.x is way too old for testing the new stuff :)
Any chance to test 2.6.32-rc1?


thanks,

Takashi

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
  2009-09-30  5:33           ` Takashi Iwai
  (?)
@ 2009-10-01  7:11           ` manoj.iyer
  2009-10-01  8:26               ` Takashi Iwai
  -1 siblings, 1 reply; 22+ messages in thread
From: manoj.iyer @ 2009-10-01  7:11 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: manoj.iyer, perex, alsa-devel, linux-kernel, Joey Stanford

> 2.6.31.x is way too old for testing the new stuff :)
> Any chance to test 2.6.32-rc1?

http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32-rc1/

I tried the 2.6.32-rc1 today, and sound does not work for me on the NB200.

--- manjo

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
  2009-10-01  7:11           ` manoj.iyer
@ 2009-10-01  8:26               ` Takashi Iwai
  0 siblings, 0 replies; 22+ messages in thread
From: Takashi Iwai @ 2009-10-01  8:26 UTC (permalink / raw)
  To: manoj.iyer; +Cc: perex, alsa-devel, linux-kernel, Joey Stanford

At Thu, 1 Oct 2009 02:11:35 -0500 (CDT),
manoj.iyer@canonical.com wrote:
> 
> > 2.6.31.x is way too old for testing the new stuff :)
> > Any chance to test 2.6.32-rc1?
> 
> http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32-rc1/
> 
> I tried the 2.6.32-rc1 today, and sound does not work for me on the NB200.

OK, thanks for checking.
After looking at the code a bit more deeply, it turned out that the
BIOS auto-parser doesn't work with this particular configuration (the
speaker with mono pin 0x17).

I'm going to fix it later, but I applied your patch as the quick fix
for the time being.


Takashi

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
@ 2009-10-01  8:26               ` Takashi Iwai
  0 siblings, 0 replies; 22+ messages in thread
From: Takashi Iwai @ 2009-10-01  8:26 UTC (permalink / raw)
  To: manoj.iyer; +Cc: alsa-devel, linux-kernel, Joey Stanford

At Thu, 1 Oct 2009 02:11:35 -0500 (CDT),
manoj.iyer@canonical.com wrote:
> 
> > 2.6.31.x is way too old for testing the new stuff :)
> > Any chance to test 2.6.32-rc1?
> 
> http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32-rc1/
> 
> I tried the 2.6.32-rc1 today, and sound does not work for me on the NB200.

OK, thanks for checking.
After looking at the code a bit more deeply, it turned out that the
BIOS auto-parser doesn't work with this particular configuration (the
speaker with mono pin 0x17).

I'm going to fix it later, but I applied your patch as the quick fix
for the time being.


Takashi

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
  2009-10-01  8:26               ` Takashi Iwai
@ 2009-10-01 19:28                 ` Takashi Iwai
  -1 siblings, 0 replies; 22+ messages in thread
From: Takashi Iwai @ 2009-10-01 19:28 UTC (permalink / raw)
  To: manoj.iyer; +Cc: perex, alsa-devel, linux-kernel, Joey Stanford

At Thu, 01 Oct 2009 10:26:05 +0200,
I wrote:
> 
> At Thu, 1 Oct 2009 02:11:35 -0500 (CDT),
> manoj.iyer@canonical.com wrote:
> > 
> > > 2.6.31.x is way too old for testing the new stuff :)
> > > Any chance to test 2.6.32-rc1?
> > 
> > http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32-rc1/
> > 
> > I tried the 2.6.32-rc1 today, and sound does not work for me on the NB200.
> 
> OK, thanks for checking.
> After looking at the code a bit more deeply, it turned out that the
> BIOS auto-parser doesn't work with this particular configuration (the
> speaker with mono pin 0x17).
> 
> I'm going to fix it later, but I applied your patch as the quick fix
> for the time being.

Could you try the patch below with model=auto?
This will make the auto-parser working, hopefully.


thanks,

Takashi

---
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 87da5e8..7810d3d 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -17146,70 +17146,145 @@ static struct alc_config_preset alc662_presets[] = {
  * BIOS auto configuration
  */
 
+/* convert from MIX nid to DAC */
+static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
+{
+	if (nid == 0x0f)
+		return 0x02;
+	else if (nid >= 0x0c && nid <= 0x0e)
+		return nid - 0x0c + 0x02;
+	else
+		return 0;
+}
+
+/* get MIX nid connected to the given pin targeted to DAC */
+static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
+				   hda_nid_t dac)
+{
+	hda_nid_t mix[4];
+	int i, num;
+
+	num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
+	for (i = 0; i < num; i++) {
+		if (alc662_mix_to_dac(mix[i]) == dac)
+			return mix[i];
+	}
+	return 0;
+}
+
+/* look for an empty DAC slot */
+static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
+{
+	struct alc_spec *spec = codec->spec;
+	hda_nid_t srcs[5];
+	int i, j, num;
+
+	num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
+	if (num < 0)
+		return 0;
+	for (i = 0; i < num; i++) {
+		hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
+		if (!nid)
+			continue;
+		for (j = 0; j < spec->multiout.num_dacs; j++)
+			if (spec->multiout.dac_nids[j] == nid)
+				break;
+		if (j >= spec->multiout.num_dacs)
+			return nid;
+	}
+	return 0;
+}
+
+/* fill in the dac_nids table from the parsed pin configuration */
+static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
+				     const struct auto_pin_cfg *cfg)
+{
+	struct alc_spec *spec = codec->spec;
+	int i;
+	hda_nid_t dac;
+
+	spec->multiout.dac_nids = spec->private_dac_nids;
+	for (i = 0; i < cfg->line_outs; i++) {
+		dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
+		if (!dac)
+			continue;
+		spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
+	}
+	return 0;
+}
+
+static int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
+			      hda_nid_t nid, unsigned int chs)
+{
+	char name[32];
+	sprintf(name, "%s Playback Volume", pfx);
+	return add_control(spec, ALC_CTL_WIDGET_VOL, name,
+			   HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
+}
+
+static int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
+			     hda_nid_t nid, unsigned int chs)
+{
+	char name[32];
+	sprintf(name, "%s Playback Switch", pfx);
+	return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
+			   HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
+}
+
+#define alc662_add_stereo_vol(spec, pfx, nid) \
+	alc662_add_vol_ctl(spec, pfx, nid, 3)
+#define alc662_add_stereo_sw(spec, pfx, nid) \
+	alc662_add_sw_ctl(spec, pfx, nid, 3)
+
 /* add playback controls from the parsed DAC table */
-static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
+static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
 					     const struct auto_pin_cfg *cfg)
 {
-	char name[32];
+	struct alc_spec *spec = codec->spec;
 	static const char *chname[4] = {
 		"Front", "Surround", NULL /*CLFE*/, "Side"
 	};
-	hda_nid_t nid;
+	hda_nid_t nid, mix;
 	int i, err;
 
 	for (i = 0; i < cfg->line_outs; i++) {
-		if (!spec->multiout.dac_nids[i])
+		nid = spec->multiout.dac_nids[i];
+		if (!nid)
+			continue;
+		mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
+		if (!mix)
 			continue;
-		nid = alc880_idx_to_dac(i);
 		if (i == 2) {
 			/* Center/LFE */
-			err = add_control(spec, ALC_CTL_WIDGET_VOL,
-					  "Center Playback Volume",
-					  HDA_COMPOSE_AMP_VAL(nid, 1, 0,
-							      HDA_OUTPUT));
+			err = alc662_add_vol_ctl(spec, "Center", nid, 1);
 			if (err < 0)
 				return err;
-			err = add_control(spec, ALC_CTL_WIDGET_VOL,
-					  "LFE Playback Volume",
-					  HDA_COMPOSE_AMP_VAL(nid, 2, 0,
-							      HDA_OUTPUT));
+			err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
 			if (err < 0)
 				return err;
-			err = add_control(spec, ALC_CTL_WIDGET_MUTE,
-					  "Center Playback Switch",
-					  HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
-							      HDA_INPUT));
+			err = alc662_add_sw_ctl(spec, "Center", mix, 1);
 			if (err < 0)
 				return err;
-			err = add_control(spec, ALC_CTL_WIDGET_MUTE,
-					  "LFE Playback Switch",
-					  HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
-							      HDA_INPUT));
+			err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
 			if (err < 0)
 				return err;
 		} else {
 			const char *pfx;
 			if (cfg->line_outs == 1 &&
 			    cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
-				if (!cfg->hp_pins)
+				if (cfg->hp_outs)
 					pfx = "Speaker";
 				else
 					pfx = "PCM";
 			} else
 				pfx = chname[i];
-			sprintf(name, "%s Playback Volume", pfx);
-			err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
-					  HDA_COMPOSE_AMP_VAL(nid, 3, 0,
-							      HDA_OUTPUT));
+			err = alc662_add_vol_ctl(spec, pfx, nid, 3);
 			if (err < 0)
 				return err;
 			if (cfg->line_outs == 1 &&
 			    cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
 				pfx = "Speaker";
-			sprintf(name, "%s Playback Switch", pfx);
-			err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
-				HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
-						    3, 0, HDA_INPUT));
+			err = alc662_add_sw_ctl(spec, pfx, mix, 3);
 			if (err < 0)
 				return err;
 		}
@@ -17218,54 +17293,38 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
 }
 
 /* add playback controls for speaker and HP outputs */
-static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
+/* return DAC nid if any new DAC is assigned */
+static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
 					const char *pfx)
 {
-	hda_nid_t nid;
+	struct alc_spec *spec = codec->spec;
+	hda_nid_t nid, mix;
 	int err;
-	char name[32];
 
 	if (!pin)
 		return 0;
-
-	if (pin == 0x17) {
-		/* ALC663 has a mono output pin on 0x17 */
+	nid = alc662_look_for_dac(codec, pin);
+	if (!nid) {
+		char name[32];
+		/* the corresponding DAC is already occupied */
+		if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
+			return 0; /* no way */
+		/* create a switch only */
 		sprintf(name, "%s Playback Switch", pfx);
-		err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
-				  HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
-		return err;
+		return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
+				   HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
 	}
 
-	if (alc880_is_fixed_pin(pin)) {
-		nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
-		/* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
-		/* specify the DAC as the extra output */
-		if (!spec->multiout.hp_nid)
-			spec->multiout.hp_nid = nid;
-		else
-			spec->multiout.extra_out_nid[0] = nid;
-		/* control HP volume/switch on the output mixer amp */
-		nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
-		sprintf(name, "%s Playback Volume", pfx);
-		err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
-				  HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
-		if (err < 0)
-			return err;
-		sprintf(name, "%s Playback Switch", pfx);
-		err = add_control(spec, ALC_CTL_BIND_MUTE, name,
-				  HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
-		if (err < 0)
-			return err;
-	} else if (alc880_is_multi_pin(pin)) {
-		/* set manual connection */
-		/* we have only a switch on HP-out PIN */
-		sprintf(name, "%s Playback Switch", pfx);
-		err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
-				  HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
-		if (err < 0)
-			return err;
-	}
-	return 0;
+	mix = alc662_dac_to_mix(codec, pin, nid);
+	if (!mix)
+		return 0;
+	err = alc662_add_vol_ctl(spec, pfx, nid, 3);
+	if (err < 0)
+		return err;
+	err = alc662_add_sw_ctl(spec, pfx, mix, 3);
+	if (err < 0)
+		return err;
+	return nid;
 }
 
 /* create playback/capture controls for input pins */
@@ -17274,30 +17333,35 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
 
 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
 					      hda_nid_t nid, int pin_type,
-					      int dac_idx)
+					      hda_nid_t dac)
 {
+	int i, num;
+	hda_nid_t srcs[4];
+
 	alc_set_pin_output(codec, nid, pin_type);
 	/* need the manual connection? */
-	if (alc880_is_multi_pin(nid)) {
-		struct alc_spec *spec = codec->spec;
-		int idx = alc880_multi_pin_idx(nid);
-		snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
-				    AC_VERB_SET_CONNECT_SEL,
-				    alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
+	num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
+	if (num <= 1)
+		return;
+	for (i = 0; i < num; i++) {
+		if (alc662_mix_to_dac(srcs[i]) != dac)
+			continue;
+		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
+		return;
 	}
 }
 
 static void alc662_auto_init_multi_out(struct hda_codec *codec)
 {
 	struct alc_spec *spec = codec->spec;
+	int pin_type = get_pin_type(spec->autocfg.line_out_type);
 	int i;
 
 	for (i = 0; i <= HDA_SIDE; i++) {
 		hda_nid_t nid = spec->autocfg.line_out_pins[i];
-		int pin_type = get_pin_type(spec->autocfg.line_out_type);
 		if (nid)
 			alc662_auto_set_output_and_unmute(codec, nid, pin_type,
-							  i);
+					spec->multiout.dac_nids[i]);
 	}
 }
 
@@ -17307,12 +17371,13 @@ static void alc662_auto_init_hp_out(struct hda_codec *codec)
 	hda_nid_t pin;
 
 	pin = spec->autocfg.hp_pins[0];
-	if (pin) /* connect to front */
-		/* use dac 0 */
-		alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
+	if (pin)
+		alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
+						  spec->multiout.hp_nid);
 	pin = spec->autocfg.speaker_pins[0];
 	if (pin)
-		alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
+		alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
+					spec->multiout.extra_out_nid[0]);
 }
 
 #define ALC662_PIN_CD_NID		ALC880_PIN_CD_NID
@@ -17350,21 +17415,25 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
 	if (!spec->autocfg.line_outs)
 		return 0; /* can't find valid BIOS pin config */
 
-	err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
+	err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
 	if (err < 0)
 		return err;
-	err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
+	err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
 	if (err < 0)
 		return err;
-	err = alc662_auto_create_extra_out(spec,
+	err = alc662_auto_create_extra_out(codec,
 					   spec->autocfg.speaker_pins[0],
 					   "Speaker");
 	if (err < 0)
 		return err;
-	err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
+	if (err)
+		spec->multiout.extra_out_nid[0] = err;
+	err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
 					   "Headphone");
 	if (err < 0)
 		return err;
+	if (err)
+		spec->multiout.hp_nid = err;
 	err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
 	if (err < 0)
 		return err;

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
@ 2009-10-01 19:28                 ` Takashi Iwai
  0 siblings, 0 replies; 22+ messages in thread
From: Takashi Iwai @ 2009-10-01 19:28 UTC (permalink / raw)
  To: manoj.iyer; +Cc: alsa-devel, linux-kernel, Joey Stanford

At Thu, 01 Oct 2009 10:26:05 +0200,
I wrote:
> 
> At Thu, 1 Oct 2009 02:11:35 -0500 (CDT),
> manoj.iyer@canonical.com wrote:
> > 
> > > 2.6.31.x is way too old for testing the new stuff :)
> > > Any chance to test 2.6.32-rc1?
> > 
> > http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32-rc1/
> > 
> > I tried the 2.6.32-rc1 today, and sound does not work for me on the NB200.
> 
> OK, thanks for checking.
> After looking at the code a bit more deeply, it turned out that the
> BIOS auto-parser doesn't work with this particular configuration (the
> speaker with mono pin 0x17).
> 
> I'm going to fix it later, but I applied your patch as the quick fix
> for the time being.

Could you try the patch below with model=auto?
This will make the auto-parser working, hopefully.


thanks,

Takashi

---
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 87da5e8..7810d3d 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -17146,70 +17146,145 @@ static struct alc_config_preset alc662_presets[] = {
  * BIOS auto configuration
  */
 
+/* convert from MIX nid to DAC */
+static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
+{
+	if (nid == 0x0f)
+		return 0x02;
+	else if (nid >= 0x0c && nid <= 0x0e)
+		return nid - 0x0c + 0x02;
+	else
+		return 0;
+}
+
+/* get MIX nid connected to the given pin targeted to DAC */
+static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
+				   hda_nid_t dac)
+{
+	hda_nid_t mix[4];
+	int i, num;
+
+	num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
+	for (i = 0; i < num; i++) {
+		if (alc662_mix_to_dac(mix[i]) == dac)
+			return mix[i];
+	}
+	return 0;
+}
+
+/* look for an empty DAC slot */
+static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
+{
+	struct alc_spec *spec = codec->spec;
+	hda_nid_t srcs[5];
+	int i, j, num;
+
+	num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
+	if (num < 0)
+		return 0;
+	for (i = 0; i < num; i++) {
+		hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
+		if (!nid)
+			continue;
+		for (j = 0; j < spec->multiout.num_dacs; j++)
+			if (spec->multiout.dac_nids[j] == nid)
+				break;
+		if (j >= spec->multiout.num_dacs)
+			return nid;
+	}
+	return 0;
+}
+
+/* fill in the dac_nids table from the parsed pin configuration */
+static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
+				     const struct auto_pin_cfg *cfg)
+{
+	struct alc_spec *spec = codec->spec;
+	int i;
+	hda_nid_t dac;
+
+	spec->multiout.dac_nids = spec->private_dac_nids;
+	for (i = 0; i < cfg->line_outs; i++) {
+		dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
+		if (!dac)
+			continue;
+		spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
+	}
+	return 0;
+}
+
+static int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
+			      hda_nid_t nid, unsigned int chs)
+{
+	char name[32];
+	sprintf(name, "%s Playback Volume", pfx);
+	return add_control(spec, ALC_CTL_WIDGET_VOL, name,
+			   HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
+}
+
+static int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
+			     hda_nid_t nid, unsigned int chs)
+{
+	char name[32];
+	sprintf(name, "%s Playback Switch", pfx);
+	return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
+			   HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
+}
+
+#define alc662_add_stereo_vol(spec, pfx, nid) \
+	alc662_add_vol_ctl(spec, pfx, nid, 3)
+#define alc662_add_stereo_sw(spec, pfx, nid) \
+	alc662_add_sw_ctl(spec, pfx, nid, 3)
+
 /* add playback controls from the parsed DAC table */
-static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
+static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
 					     const struct auto_pin_cfg *cfg)
 {
-	char name[32];
+	struct alc_spec *spec = codec->spec;
 	static const char *chname[4] = {
 		"Front", "Surround", NULL /*CLFE*/, "Side"
 	};
-	hda_nid_t nid;
+	hda_nid_t nid, mix;
 	int i, err;
 
 	for (i = 0; i < cfg->line_outs; i++) {
-		if (!spec->multiout.dac_nids[i])
+		nid = spec->multiout.dac_nids[i];
+		if (!nid)
+			continue;
+		mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
+		if (!mix)
 			continue;
-		nid = alc880_idx_to_dac(i);
 		if (i == 2) {
 			/* Center/LFE */
-			err = add_control(spec, ALC_CTL_WIDGET_VOL,
-					  "Center Playback Volume",
-					  HDA_COMPOSE_AMP_VAL(nid, 1, 0,
-							      HDA_OUTPUT));
+			err = alc662_add_vol_ctl(spec, "Center", nid, 1);
 			if (err < 0)
 				return err;
-			err = add_control(spec, ALC_CTL_WIDGET_VOL,
-					  "LFE Playback Volume",
-					  HDA_COMPOSE_AMP_VAL(nid, 2, 0,
-							      HDA_OUTPUT));
+			err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
 			if (err < 0)
 				return err;
-			err = add_control(spec, ALC_CTL_WIDGET_MUTE,
-					  "Center Playback Switch",
-					  HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
-							      HDA_INPUT));
+			err = alc662_add_sw_ctl(spec, "Center", mix, 1);
 			if (err < 0)
 				return err;
-			err = add_control(spec, ALC_CTL_WIDGET_MUTE,
-					  "LFE Playback Switch",
-					  HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
-							      HDA_INPUT));
+			err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
 			if (err < 0)
 				return err;
 		} else {
 			const char *pfx;
 			if (cfg->line_outs == 1 &&
 			    cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
-				if (!cfg->hp_pins)
+				if (cfg->hp_outs)
 					pfx = "Speaker";
 				else
 					pfx = "PCM";
 			} else
 				pfx = chname[i];
-			sprintf(name, "%s Playback Volume", pfx);
-			err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
-					  HDA_COMPOSE_AMP_VAL(nid, 3, 0,
-							      HDA_OUTPUT));
+			err = alc662_add_vol_ctl(spec, pfx, nid, 3);
 			if (err < 0)
 				return err;
 			if (cfg->line_outs == 1 &&
 			    cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
 				pfx = "Speaker";
-			sprintf(name, "%s Playback Switch", pfx);
-			err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
-				HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
-						    3, 0, HDA_INPUT));
+			err = alc662_add_sw_ctl(spec, pfx, mix, 3);
 			if (err < 0)
 				return err;
 		}
@@ -17218,54 +17293,38 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
 }
 
 /* add playback controls for speaker and HP outputs */
-static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
+/* return DAC nid if any new DAC is assigned */
+static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
 					const char *pfx)
 {
-	hda_nid_t nid;
+	struct alc_spec *spec = codec->spec;
+	hda_nid_t nid, mix;
 	int err;
-	char name[32];
 
 	if (!pin)
 		return 0;
-
-	if (pin == 0x17) {
-		/* ALC663 has a mono output pin on 0x17 */
+	nid = alc662_look_for_dac(codec, pin);
+	if (!nid) {
+		char name[32];
+		/* the corresponding DAC is already occupied */
+		if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
+			return 0; /* no way */
+		/* create a switch only */
 		sprintf(name, "%s Playback Switch", pfx);
-		err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
-				  HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
-		return err;
+		return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
+				   HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
 	}
 
-	if (alc880_is_fixed_pin(pin)) {
-		nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
-		/* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
-		/* specify the DAC as the extra output */
-		if (!spec->multiout.hp_nid)
-			spec->multiout.hp_nid = nid;
-		else
-			spec->multiout.extra_out_nid[0] = nid;
-		/* control HP volume/switch on the output mixer amp */
-		nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
-		sprintf(name, "%s Playback Volume", pfx);
-		err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
-				  HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
-		if (err < 0)
-			return err;
-		sprintf(name, "%s Playback Switch", pfx);
-		err = add_control(spec, ALC_CTL_BIND_MUTE, name,
-				  HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
-		if (err < 0)
-			return err;
-	} else if (alc880_is_multi_pin(pin)) {
-		/* set manual connection */
-		/* we have only a switch on HP-out PIN */
-		sprintf(name, "%s Playback Switch", pfx);
-		err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
-				  HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
-		if (err < 0)
-			return err;
-	}
-	return 0;
+	mix = alc662_dac_to_mix(codec, pin, nid);
+	if (!mix)
+		return 0;
+	err = alc662_add_vol_ctl(spec, pfx, nid, 3);
+	if (err < 0)
+		return err;
+	err = alc662_add_sw_ctl(spec, pfx, mix, 3);
+	if (err < 0)
+		return err;
+	return nid;
 }
 
 /* create playback/capture controls for input pins */
@@ -17274,30 +17333,35 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
 
 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
 					      hda_nid_t nid, int pin_type,
-					      int dac_idx)
+					      hda_nid_t dac)
 {
+	int i, num;
+	hda_nid_t srcs[4];
+
 	alc_set_pin_output(codec, nid, pin_type);
 	/* need the manual connection? */
-	if (alc880_is_multi_pin(nid)) {
-		struct alc_spec *spec = codec->spec;
-		int idx = alc880_multi_pin_idx(nid);
-		snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
-				    AC_VERB_SET_CONNECT_SEL,
-				    alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
+	num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
+	if (num <= 1)
+		return;
+	for (i = 0; i < num; i++) {
+		if (alc662_mix_to_dac(srcs[i]) != dac)
+			continue;
+		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
+		return;
 	}
 }
 
 static void alc662_auto_init_multi_out(struct hda_codec *codec)
 {
 	struct alc_spec *spec = codec->spec;
+	int pin_type = get_pin_type(spec->autocfg.line_out_type);
 	int i;
 
 	for (i = 0; i <= HDA_SIDE; i++) {
 		hda_nid_t nid = spec->autocfg.line_out_pins[i];
-		int pin_type = get_pin_type(spec->autocfg.line_out_type);
 		if (nid)
 			alc662_auto_set_output_and_unmute(codec, nid, pin_type,
-							  i);
+					spec->multiout.dac_nids[i]);
 	}
 }
 
@@ -17307,12 +17371,13 @@ static void alc662_auto_init_hp_out(struct hda_codec *codec)
 	hda_nid_t pin;
 
 	pin = spec->autocfg.hp_pins[0];
-	if (pin) /* connect to front */
-		/* use dac 0 */
-		alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
+	if (pin)
+		alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
+						  spec->multiout.hp_nid);
 	pin = spec->autocfg.speaker_pins[0];
 	if (pin)
-		alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
+		alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
+					spec->multiout.extra_out_nid[0]);
 }
 
 #define ALC662_PIN_CD_NID		ALC880_PIN_CD_NID
@@ -17350,21 +17415,25 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
 	if (!spec->autocfg.line_outs)
 		return 0; /* can't find valid BIOS pin config */
 
-	err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
+	err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
 	if (err < 0)
 		return err;
-	err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
+	err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
 	if (err < 0)
 		return err;
-	err = alc662_auto_create_extra_out(spec,
+	err = alc662_auto_create_extra_out(codec,
 					   spec->autocfg.speaker_pins[0],
 					   "Speaker");
 	if (err < 0)
 		return err;
-	err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
+	if (err)
+		spec->multiout.extra_out_nid[0] = err;
+	err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
 					   "Headphone");
 	if (err < 0)
 		return err;
+	if (err)
+		spec->multiout.hp_nid = err;
 	err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
 	if (err < 0)
 		return err;

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
  2009-10-01 19:28                 ` Takashi Iwai
  (?)
@ 2009-10-02 20:44                 ` manoj.iyer
  -1 siblings, 0 replies; 22+ messages in thread
From: manoj.iyer @ 2009-10-02 20:44 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: manoj.iyer, perex, alsa-devel, linux-kernel, Joey Stanford


Sure, I will try this over the weekend and report the results back here.

On Thu, 1 Oct 2009, Takashi Iwai wrote:

> At Thu, 01 Oct 2009 10:26:05 +0200,
> I wrote:
>>
>> At Thu, 1 Oct 2009 02:11:35 -0500 (CDT),
>> manoj.iyer@canonical.com wrote:
>>>
>>>> 2.6.31.x is way too old for testing the new stuff :)
>>>> Any chance to test 2.6.32-rc1?
>>>
>>> http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32-rc1/
>>>
>>> I tried the 2.6.32-rc1 today, and sound does not work for me on the NB200.
>>
>> OK, thanks for checking.
>> After looking at the code a bit more deeply, it turned out that the
>> BIOS auto-parser doesn't work with this particular configuration (the
>> speaker with mono pin 0x17).
>>
>> I'm going to fix it later, but I applied your patch as the quick fix
>> for the time being.
>
> Could you try the patch below with model=auto?
> This will make the auto-parser working, hopefully.
>
>
> thanks,
>
> Takashi
>
> ---
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index 87da5e8..7810d3d 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -17146,70 +17146,145 @@ static struct alc_config_preset alc662_presets[] = {
>  * BIOS auto configuration
>  */
>
> +/* convert from MIX nid to DAC */
> +static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
> +{
> +	if (nid == 0x0f)
> +		return 0x02;
> +	else if (nid >= 0x0c && nid <= 0x0e)
> +		return nid - 0x0c + 0x02;
> +	else
> +		return 0;
> +}
> +
> +/* get MIX nid connected to the given pin targeted to DAC */
> +static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
> +				   hda_nid_t dac)
> +{
> +	hda_nid_t mix[4];
> +	int i, num;
> +
> +	num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
> +	for (i = 0; i < num; i++) {
> +		if (alc662_mix_to_dac(mix[i]) == dac)
> +			return mix[i];
> +	}
> +	return 0;
> +}
> +
> +/* look for an empty DAC slot */
> +static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
> +{
> +	struct alc_spec *spec = codec->spec;
> +	hda_nid_t srcs[5];
> +	int i, j, num;
> +
> +	num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
> +	if (num < 0)
> +		return 0;
> +	for (i = 0; i < num; i++) {
> +		hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
> +		if (!nid)
> +			continue;
> +		for (j = 0; j < spec->multiout.num_dacs; j++)
> +			if (spec->multiout.dac_nids[j] == nid)
> +				break;
> +		if (j >= spec->multiout.num_dacs)
> +			return nid;
> +	}
> +	return 0;
> +}
> +
> +/* fill in the dac_nids table from the parsed pin configuration */
> +static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
> +				     const struct auto_pin_cfg *cfg)
> +{
> +	struct alc_spec *spec = codec->spec;
> +	int i;
> +	hda_nid_t dac;
> +
> +	spec->multiout.dac_nids = spec->private_dac_nids;
> +	for (i = 0; i < cfg->line_outs; i++) {
> +		dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
> +		if (!dac)
> +			continue;
> +		spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
> +	}
> +	return 0;
> +}
> +
> +static int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
> +			      hda_nid_t nid, unsigned int chs)
> +{
> +	char name[32];
> +	sprintf(name, "%s Playback Volume", pfx);
> +	return add_control(spec, ALC_CTL_WIDGET_VOL, name,
> +			   HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
> +}
> +
> +static int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
> +			     hda_nid_t nid, unsigned int chs)
> +{
> +	char name[32];
> +	sprintf(name, "%s Playback Switch", pfx);
> +	return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> +			   HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
> +}
> +
> +#define alc662_add_stereo_vol(spec, pfx, nid) \
> +	alc662_add_vol_ctl(spec, pfx, nid, 3)
> +#define alc662_add_stereo_sw(spec, pfx, nid) \
> +	alc662_add_sw_ctl(spec, pfx, nid, 3)
> +
> /* add playback controls from the parsed DAC table */
> -static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
> +static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
> 					     const struct auto_pin_cfg *cfg)
> {
> -	char name[32];
> +	struct alc_spec *spec = codec->spec;
> 	static const char *chname[4] = {
> 		"Front", "Surround", NULL /*CLFE*/, "Side"
> 	};
> -	hda_nid_t nid;
> +	hda_nid_t nid, mix;
> 	int i, err;
>
> 	for (i = 0; i < cfg->line_outs; i++) {
> -		if (!spec->multiout.dac_nids[i])
> +		nid = spec->multiout.dac_nids[i];
> +		if (!nid)
> +			continue;
> +		mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
> +		if (!mix)
> 			continue;
> -		nid = alc880_idx_to_dac(i);
> 		if (i == 2) {
> 			/* Center/LFE */
> -			err = add_control(spec, ALC_CTL_WIDGET_VOL,
> -					  "Center Playback Volume",
> -					  HDA_COMPOSE_AMP_VAL(nid, 1, 0,
> -							      HDA_OUTPUT));
> +			err = alc662_add_vol_ctl(spec, "Center", nid, 1);
> 			if (err < 0)
> 				return err;
> -			err = add_control(spec, ALC_CTL_WIDGET_VOL,
> -					  "LFE Playback Volume",
> -					  HDA_COMPOSE_AMP_VAL(nid, 2, 0,
> -							      HDA_OUTPUT));
> +			err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
> 			if (err < 0)
> 				return err;
> -			err = add_control(spec, ALC_CTL_WIDGET_MUTE,
> -					  "Center Playback Switch",
> -					  HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
> -							      HDA_INPUT));
> +			err = alc662_add_sw_ctl(spec, "Center", mix, 1);
> 			if (err < 0)
> 				return err;
> -			err = add_control(spec, ALC_CTL_WIDGET_MUTE,
> -					  "LFE Playback Switch",
> -					  HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
> -							      HDA_INPUT));
> +			err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
> 			if (err < 0)
> 				return err;
> 		} else {
> 			const char *pfx;
> 			if (cfg->line_outs == 1 &&
> 			    cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
> -				if (!cfg->hp_pins)
> +				if (cfg->hp_outs)
> 					pfx = "Speaker";
> 				else
> 					pfx = "PCM";
> 			} else
> 				pfx = chname[i];
> -			sprintf(name, "%s Playback Volume", pfx);
> -			err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
> -					  HDA_COMPOSE_AMP_VAL(nid, 3, 0,
> -							      HDA_OUTPUT));
> +			err = alc662_add_vol_ctl(spec, pfx, nid, 3);
> 			if (err < 0)
> 				return err;
> 			if (cfg->line_outs == 1 &&
> 			    cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
> 				pfx = "Speaker";
> -			sprintf(name, "%s Playback Switch", pfx);
> -			err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> -				HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
> -						    3, 0, HDA_INPUT));
> +			err = alc662_add_sw_ctl(spec, pfx, mix, 3);
> 			if (err < 0)
> 				return err;
> 		}
> @@ -17218,54 +17293,38 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
> }
>
> /* add playback controls for speaker and HP outputs */
> -static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
> +/* return DAC nid if any new DAC is assigned */
> +static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
> 					const char *pfx)
> {
> -	hda_nid_t nid;
> +	struct alc_spec *spec = codec->spec;
> +	hda_nid_t nid, mix;
> 	int err;
> -	char name[32];
>
> 	if (!pin)
> 		return 0;
> -
> -	if (pin == 0x17) {
> -		/* ALC663 has a mono output pin on 0x17 */
> +	nid = alc662_look_for_dac(codec, pin);
> +	if (!nid) {
> +		char name[32];
> +		/* the corresponding DAC is already occupied */
> +		if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
> +			return 0; /* no way */
> +		/* create a switch only */
> 		sprintf(name, "%s Playback Switch", pfx);
> -		err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> -				  HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
> -		return err;
> +		return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> +				   HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
> 	}
>
> -	if (alc880_is_fixed_pin(pin)) {
> -		nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
> -		/* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
> -		/* specify the DAC as the extra output */
> -		if (!spec->multiout.hp_nid)
> -			spec->multiout.hp_nid = nid;
> -		else
> -			spec->multiout.extra_out_nid[0] = nid;
> -		/* control HP volume/switch on the output mixer amp */
> -		nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
> -		sprintf(name, "%s Playback Volume", pfx);
> -		err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
> -				  HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
> -		if (err < 0)
> -			return err;
> -		sprintf(name, "%s Playback Switch", pfx);
> -		err = add_control(spec, ALC_CTL_BIND_MUTE, name,
> -				  HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
> -		if (err < 0)
> -			return err;
> -	} else if (alc880_is_multi_pin(pin)) {
> -		/* set manual connection */
> -		/* we have only a switch on HP-out PIN */
> -		sprintf(name, "%s Playback Switch", pfx);
> -		err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> -				  HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
> -		if (err < 0)
> -			return err;
> -	}
> -	return 0;
> +	mix = alc662_dac_to_mix(codec, pin, nid);
> +	if (!mix)
> +		return 0;
> +	err = alc662_add_vol_ctl(spec, pfx, nid, 3);
> +	if (err < 0)
> +		return err;
> +	err = alc662_add_sw_ctl(spec, pfx, mix, 3);
> +	if (err < 0)
> +		return err;
> +	return nid;
> }
>
> /* create playback/capture controls for input pins */
> @@ -17274,30 +17333,35 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
>
> static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
> 					      hda_nid_t nid, int pin_type,
> -					      int dac_idx)
> +					      hda_nid_t dac)
> {
> +	int i, num;
> +	hda_nid_t srcs[4];
> +
> 	alc_set_pin_output(codec, nid, pin_type);
> 	/* need the manual connection? */
> -	if (alc880_is_multi_pin(nid)) {
> -		struct alc_spec *spec = codec->spec;
> -		int idx = alc880_multi_pin_idx(nid);
> -		snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
> -				    AC_VERB_SET_CONNECT_SEL,
> -				    alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
> +	num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
> +	if (num <= 1)
> +		return;
> +	for (i = 0; i < num; i++) {
> +		if (alc662_mix_to_dac(srcs[i]) != dac)
> +			continue;
> +		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
> +		return;
> 	}
> }
>
> static void alc662_auto_init_multi_out(struct hda_codec *codec)
> {
> 	struct alc_spec *spec = codec->spec;
> +	int pin_type = get_pin_type(spec->autocfg.line_out_type);
> 	int i;
>
> 	for (i = 0; i <= HDA_SIDE; i++) {
> 		hda_nid_t nid = spec->autocfg.line_out_pins[i];
> -		int pin_type = get_pin_type(spec->autocfg.line_out_type);
> 		if (nid)
> 			alc662_auto_set_output_and_unmute(codec, nid, pin_type,
> -							  i);
> +					spec->multiout.dac_nids[i]);
> 	}
> }
>
> @@ -17307,12 +17371,13 @@ static void alc662_auto_init_hp_out(struct hda_codec *codec)
> 	hda_nid_t pin;
>
> 	pin = spec->autocfg.hp_pins[0];
> -	if (pin) /* connect to front */
> -		/* use dac 0 */
> -		alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
> +	if (pin)
> +		alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
> +						  spec->multiout.hp_nid);
> 	pin = spec->autocfg.speaker_pins[0];
> 	if (pin)
> -		alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
> +		alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
> +					spec->multiout.extra_out_nid[0]);
> }
>
> #define ALC662_PIN_CD_NID		ALC880_PIN_CD_NID
> @@ -17350,21 +17415,25 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
> 	if (!spec->autocfg.line_outs)
> 		return 0; /* can't find valid BIOS pin config */
>
> -	err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
> +	err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
> 	if (err < 0)
> 		return err;
> -	err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
> +	err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
> 	if (err < 0)
> 		return err;
> -	err = alc662_auto_create_extra_out(spec,
> +	err = alc662_auto_create_extra_out(codec,
> 					   spec->autocfg.speaker_pins[0],
> 					   "Speaker");
> 	if (err < 0)
> 		return err;
> -	err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
> +	if (err)
> +		spec->multiout.extra_out_nid[0] = err;
> +	err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
> 					   "Headphone");
> 	if (err < 0)
> 		return err;
> +	if (err)
> +		spec->multiout.hp_nid = err;
> 	err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
> 	if (err < 0)
> 		return err;
>

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
  2009-10-01 19:28                 ` Takashi Iwai
  (?)
  (?)
@ 2009-10-06  0:13                 ` manoj.iyer
  2009-10-06  5:45                     ` Takashi Iwai
  -1 siblings, 1 reply; 22+ messages in thread
From: manoj.iyer @ 2009-10-06  0:13 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: manoj.iyer, perex, alsa-devel, linux-kernel, Joey Stanford



I am a little puzzled. The patch did not apply cleanly to the karmic 
source tree, so I had to hand patch it. But, even with the quirk I 
submitted, the patch you pointed me to killed sound again. Could I have 
done something wrong?

--- manjo

On Thu, 1 Oct 2009, Takashi Iwai wrote:

> At Thu, 01 Oct 2009 10:26:05 +0200,
> I wrote:
>>
>> At Thu, 1 Oct 2009 02:11:35 -0500 (CDT),
>> manoj.iyer@canonical.com wrote:
>>>
>>>> 2.6.31.x is way too old for testing the new stuff :)
>>>> Any chance to test 2.6.32-rc1?
>>>
>>> http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32-rc1/
>>>
>>> I tried the 2.6.32-rc1 today, and sound does not work for me on the NB200.
>>
>> OK, thanks for checking.
>> After looking at the code a bit more deeply, it turned out that the
>> BIOS auto-parser doesn't work with this particular configuration (the
>> speaker with mono pin 0x17).
>>
>> I'm going to fix it later, but I applied your patch as the quick fix
>> for the time being.
>
> Could you try the patch below with model=auto?
> This will make the auto-parser working, hopefully.
>
>
> thanks,
>
> Takashi
>
> ---
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index 87da5e8..7810d3d 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -17146,70 +17146,145 @@ static struct alc_config_preset alc662_presets[] = {
>  * BIOS auto configuration
>  */
>
> +/* convert from MIX nid to DAC */
> +static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
> +{
> +	if (nid == 0x0f)
> +		return 0x02;
> +	else if (nid >= 0x0c && nid <= 0x0e)
> +		return nid - 0x0c + 0x02;
> +	else
> +		return 0;
> +}
> +
> +/* get MIX nid connected to the given pin targeted to DAC */
> +static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
> +				   hda_nid_t dac)
> +{
> +	hda_nid_t mix[4];
> +	int i, num;
> +
> +	num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
> +	for (i = 0; i < num; i++) {
> +		if (alc662_mix_to_dac(mix[i]) == dac)
> +			return mix[i];
> +	}
> +	return 0;
> +}
> +
> +/* look for an empty DAC slot */
> +static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
> +{
> +	struct alc_spec *spec = codec->spec;
> +	hda_nid_t srcs[5];
> +	int i, j, num;
> +
> +	num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
> +	if (num < 0)
> +		return 0;
> +	for (i = 0; i < num; i++) {
> +		hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
> +		if (!nid)
> +			continue;
> +		for (j = 0; j < spec->multiout.num_dacs; j++)
> +			if (spec->multiout.dac_nids[j] == nid)
> +				break;
> +		if (j >= spec->multiout.num_dacs)
> +			return nid;
> +	}
> +	return 0;
> +}
> +
> +/* fill in the dac_nids table from the parsed pin configuration */
> +static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
> +				     const struct auto_pin_cfg *cfg)
> +{
> +	struct alc_spec *spec = codec->spec;
> +	int i;
> +	hda_nid_t dac;
> +
> +	spec->multiout.dac_nids = spec->private_dac_nids;
> +	for (i = 0; i < cfg->line_outs; i++) {
> +		dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
> +		if (!dac)
> +			continue;
> +		spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
> +	}
> +	return 0;
> +}
> +
> +static int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
> +			      hda_nid_t nid, unsigned int chs)
> +{
> +	char name[32];
> +	sprintf(name, "%s Playback Volume", pfx);
> +	return add_control(spec, ALC_CTL_WIDGET_VOL, name,
> +			   HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
> +}
> +
> +static int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
> +			     hda_nid_t nid, unsigned int chs)
> +{
> +	char name[32];
> +	sprintf(name, "%s Playback Switch", pfx);
> +	return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> +			   HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
> +}
> +
> +#define alc662_add_stereo_vol(spec, pfx, nid) \
> +	alc662_add_vol_ctl(spec, pfx, nid, 3)
> +#define alc662_add_stereo_sw(spec, pfx, nid) \
> +	alc662_add_sw_ctl(spec, pfx, nid, 3)
> +
> /* add playback controls from the parsed DAC table */
> -static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
> +static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
> 					     const struct auto_pin_cfg *cfg)
> {
> -	char name[32];
> +	struct alc_spec *spec = codec->spec;
> 	static const char *chname[4] = {
> 		"Front", "Surround", NULL /*CLFE*/, "Side"
> 	};
> -	hda_nid_t nid;
> +	hda_nid_t nid, mix;
> 	int i, err;
>
> 	for (i = 0; i < cfg->line_outs; i++) {
> -		if (!spec->multiout.dac_nids[i])
> +		nid = spec->multiout.dac_nids[i];
> +		if (!nid)
> +			continue;
> +		mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
> +		if (!mix)
> 			continue;
> -		nid = alc880_idx_to_dac(i);
> 		if (i == 2) {
> 			/* Center/LFE */
> -			err = add_control(spec, ALC_CTL_WIDGET_VOL,
> -					  "Center Playback Volume",
> -					  HDA_COMPOSE_AMP_VAL(nid, 1, 0,
> -							      HDA_OUTPUT));
> +			err = alc662_add_vol_ctl(spec, "Center", nid, 1);
> 			if (err < 0)
> 				return err;
> -			err = add_control(spec, ALC_CTL_WIDGET_VOL,
> -					  "LFE Playback Volume",
> -					  HDA_COMPOSE_AMP_VAL(nid, 2, 0,
> -							      HDA_OUTPUT));
> +			err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
> 			if (err < 0)
> 				return err;
> -			err = add_control(spec, ALC_CTL_WIDGET_MUTE,
> -					  "Center Playback Switch",
> -					  HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
> -							      HDA_INPUT));
> +			err = alc662_add_sw_ctl(spec, "Center", mix, 1);
> 			if (err < 0)
> 				return err;
> -			err = add_control(spec, ALC_CTL_WIDGET_MUTE,
> -					  "LFE Playback Switch",
> -					  HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
> -							      HDA_INPUT));
> +			err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
> 			if (err < 0)
> 				return err;
> 		} else {
> 			const char *pfx;
> 			if (cfg->line_outs == 1 &&
> 			    cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
> -				if (!cfg->hp_pins)
> +				if (cfg->hp_outs)
> 					pfx = "Speaker";
> 				else
> 					pfx = "PCM";
> 			} else
> 				pfx = chname[i];
> -			sprintf(name, "%s Playback Volume", pfx);
> -			err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
> -					  HDA_COMPOSE_AMP_VAL(nid, 3, 0,
> -							      HDA_OUTPUT));
> +			err = alc662_add_vol_ctl(spec, pfx, nid, 3);
> 			if (err < 0)
> 				return err;
> 			if (cfg->line_outs == 1 &&
> 			    cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
> 				pfx = "Speaker";
> -			sprintf(name, "%s Playback Switch", pfx);
> -			err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> -				HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
> -						    3, 0, HDA_INPUT));
> +			err = alc662_add_sw_ctl(spec, pfx, mix, 3);
> 			if (err < 0)
> 				return err;
> 		}
> @@ -17218,54 +17293,38 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
> }
>
> /* add playback controls for speaker and HP outputs */
> -static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
> +/* return DAC nid if any new DAC is assigned */
> +static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
> 					const char *pfx)
> {
> -	hda_nid_t nid;
> +	struct alc_spec *spec = codec->spec;
> +	hda_nid_t nid, mix;
> 	int err;
> -	char name[32];
>
> 	if (!pin)
> 		return 0;
> -
> -	if (pin == 0x17) {
> -		/* ALC663 has a mono output pin on 0x17 */
> +	nid = alc662_look_for_dac(codec, pin);
> +	if (!nid) {
> +		char name[32];
> +		/* the corresponding DAC is already occupied */
> +		if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
> +			return 0; /* no way */
> +		/* create a switch only */
> 		sprintf(name, "%s Playback Switch", pfx);
> -		err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> -				  HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
> -		return err;
> +		return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> +				   HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
> 	}
>
> -	if (alc880_is_fixed_pin(pin)) {
> -		nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
> -		/* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
> -		/* specify the DAC as the extra output */
> -		if (!spec->multiout.hp_nid)
> -			spec->multiout.hp_nid = nid;
> -		else
> -			spec->multiout.extra_out_nid[0] = nid;
> -		/* control HP volume/switch on the output mixer amp */
> -		nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
> -		sprintf(name, "%s Playback Volume", pfx);
> -		err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
> -				  HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
> -		if (err < 0)
> -			return err;
> -		sprintf(name, "%s Playback Switch", pfx);
> -		err = add_control(spec, ALC_CTL_BIND_MUTE, name,
> -				  HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
> -		if (err < 0)
> -			return err;
> -	} else if (alc880_is_multi_pin(pin)) {
> -		/* set manual connection */
> -		/* we have only a switch on HP-out PIN */
> -		sprintf(name, "%s Playback Switch", pfx);
> -		err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> -				  HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
> -		if (err < 0)
> -			return err;
> -	}
> -	return 0;
> +	mix = alc662_dac_to_mix(codec, pin, nid);
> +	if (!mix)
> +		return 0;
> +	err = alc662_add_vol_ctl(spec, pfx, nid, 3);
> +	if (err < 0)
> +		return err;
> +	err = alc662_add_sw_ctl(spec, pfx, mix, 3);
> +	if (err < 0)
> +		return err;
> +	return nid;
> }
>
> /* create playback/capture controls for input pins */
> @@ -17274,30 +17333,35 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
>
> static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
> 					      hda_nid_t nid, int pin_type,
> -					      int dac_idx)
> +					      hda_nid_t dac)
> {
> +	int i, num;
> +	hda_nid_t srcs[4];
> +
> 	alc_set_pin_output(codec, nid, pin_type);
> 	/* need the manual connection? */
> -	if (alc880_is_multi_pin(nid)) {
> -		struct alc_spec *spec = codec->spec;
> -		int idx = alc880_multi_pin_idx(nid);
> -		snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
> -				    AC_VERB_SET_CONNECT_SEL,
> -				    alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
> +	num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
> +	if (num <= 1)
> +		return;
> +	for (i = 0; i < num; i++) {
> +		if (alc662_mix_to_dac(srcs[i]) != dac)
> +			continue;
> +		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
> +		return;
> 	}
> }
>
> static void alc662_auto_init_multi_out(struct hda_codec *codec)
> {
> 	struct alc_spec *spec = codec->spec;
> +	int pin_type = get_pin_type(spec->autocfg.line_out_type);
> 	int i;
>
> 	for (i = 0; i <= HDA_SIDE; i++) {
> 		hda_nid_t nid = spec->autocfg.line_out_pins[i];
> -		int pin_type = get_pin_type(spec->autocfg.line_out_type);
> 		if (nid)
> 			alc662_auto_set_output_and_unmute(codec, nid, pin_type,
> -							  i);
> +					spec->multiout.dac_nids[i]);
> 	}
> }
>
> @@ -17307,12 +17371,13 @@ static void alc662_auto_init_hp_out(struct hda_codec *codec)
> 	hda_nid_t pin;
>
> 	pin = spec->autocfg.hp_pins[0];
> -	if (pin) /* connect to front */
> -		/* use dac 0 */
> -		alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
> +	if (pin)
> +		alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
> +						  spec->multiout.hp_nid);
> 	pin = spec->autocfg.speaker_pins[0];
> 	if (pin)
> -		alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
> +		alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
> +					spec->multiout.extra_out_nid[0]);
> }
>
> #define ALC662_PIN_CD_NID		ALC880_PIN_CD_NID
> @@ -17350,21 +17415,25 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
> 	if (!spec->autocfg.line_outs)
> 		return 0; /* can't find valid BIOS pin config */
>
> -	err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
> +	err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
> 	if (err < 0)
> 		return err;
> -	err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
> +	err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
> 	if (err < 0)
> 		return err;
> -	err = alc662_auto_create_extra_out(spec,
> +	err = alc662_auto_create_extra_out(codec,
> 					   spec->autocfg.speaker_pins[0],
> 					   "Speaker");
> 	if (err < 0)
> 		return err;
> -	err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
> +	if (err)
> +		spec->multiout.extra_out_nid[0] = err;
> +	err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
> 					   "Headphone");
> 	if (err < 0)
> 		return err;
> +	if (err)
> +		spec->multiout.hp_nid = err;
> 	err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
> 	if (err < 0)
> 		return err;
>

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
  2009-10-06  0:13                 ` manoj.iyer
@ 2009-10-06  5:45                     ` Takashi Iwai
  0 siblings, 0 replies; 22+ messages in thread
From: Takashi Iwai @ 2009-10-06  5:45 UTC (permalink / raw)
  To: manoj.iyer; +Cc: perex, alsa-devel, linux-kernel, Joey Stanford

At Mon, 5 Oct 2009 19:13:47 -0500 (CDT),
manoj.iyer@canonical.com wrote:
> 
> 
> 
> I am a little puzzled. The patch did not apply cleanly to the karmic 
> source tree, so I had to hand patch it. But, even with the quirk I 
> submitted, the patch you pointed me to killed sound again. Could I have 
> done something wrong?

Try 2.6.32-rc3 kernel at best.  It already includes this fix.
No reason to stick with the modified kernel just for testing.

(And compiling a kernel won't take time if you set up kconfig properly.
 Even on a recent netbook, it's about 10 minutes.)


thanks,

Takashi

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
@ 2009-10-06  5:45                     ` Takashi Iwai
  0 siblings, 0 replies; 22+ messages in thread
From: Takashi Iwai @ 2009-10-06  5:45 UTC (permalink / raw)
  To: manoj.iyer; +Cc: alsa-devel, linux-kernel, Joey Stanford

At Mon, 5 Oct 2009 19:13:47 -0500 (CDT),
manoj.iyer@canonical.com wrote:
> 
> 
> 
> I am a little puzzled. The patch did not apply cleanly to the karmic 
> source tree, so I had to hand patch it. But, even with the quirk I 
> submitted, the patch you pointed me to killed sound again. Could I have 
> done something wrong?

Try 2.6.32-rc3 kernel at best.  It already includes this fix.
No reason to stick with the modified kernel just for testing.

(And compiling a kernel won't take time if you set up kconfig properly.
 Even on a recent netbook, it's about 10 minutes.)


thanks,

Takashi

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
  2009-10-06  5:45                     ` Takashi Iwai
  (?)
@ 2009-10-06 22:06                     ` manoj.iyer
  -1 siblings, 0 replies; 22+ messages in thread
From: manoj.iyer @ 2009-10-06 22:06 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: manoj.iyer, perex, alsa-devel, linux-kernel, Joey Stanford


I can confirm that patch fixes broken mic on HP mini. It is labeled as 
"LineIn".

On Tue, 6 Oct 2009, Takashi Iwai wrote:

> At Mon, 5 Oct 2009 19:13:47 -0500 (CDT),
> manoj.iyer@canonical.com wrote:
>>
>>
>>
>> I am a little puzzled. The patch did not apply cleanly to the karmic
>> source tree, so I had to hand patch it. But, even with the quirk I
>> submitted, the patch you pointed me to killed sound again. Could I have
>> done something wrong?
>
> Try 2.6.32-rc3 kernel at best.  It already includes this fix.
> No reason to stick with the modified kernel just for testing.
>
> (And compiling a kernel won't take time if you set up kconfig properly.
> Even on a recent netbook, it's about 10 minutes.)
>
>
> thanks,
>
> Takashi
>

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
  2009-10-01 19:28                 ` Takashi Iwai
                                   ` (2 preceding siblings ...)
  (?)
@ 2009-10-07 20:34                 ` manoj.iyer
  2009-10-08  5:27                     ` Takashi Iwai
  -1 siblings, 1 reply; 22+ messages in thread
From: manoj.iyer @ 2009-10-07 20:34 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: manoj.iyer, perex, alsa-devel, linux-kernel, Joey Stanford


Takashi San,

Like I reported earlier, the patch you mailed me (See patch below) breaks 
sound on Toshiba NB200/205 again, even with my quirk. Any chance that we 
can work on getting this fixed? If you point me in the right direction I 
can dig into this some, also, mainline 
http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32-rc1/ does not work. 
iirc, you mentioned that this patch made it into mainline as well.

Thanks

On Thu, 1 Oct 2009, Takashi Iwai wrote:

> At Thu, 01 Oct 2009 10:26:05 +0200,
> I wrote:
>>
>> At Thu, 1 Oct 2009 02:11:35 -0500 (CDT),
>> manoj.iyer@canonical.com wrote:
>>>
>>>> 2.6.31.x is way too old for testing the new stuff :)
>>>> Any chance to test 2.6.32-rc1?
>>>
>>> http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32-rc1/
>>>
>>> I tried the 2.6.32-rc1 today, and sound does not work for me on the NB200.
>>
>> OK, thanks for checking.
>> After looking at the code a bit more deeply, it turned out that the
>> BIOS auto-parser doesn't work with this particular configuration (the
>> speaker with mono pin 0x17).
>>
>> I'm going to fix it later, but I applied your patch as the quick fix
>> for the time being.
>
> Could you try the patch below with model=auto?
> This will make the auto-parser working, hopefully.
>
>
> thanks,
>
> Takashi
>
> ---
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index 87da5e8..7810d3d 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -17146,70 +17146,145 @@ static struct alc_config_preset alc662_presets[] = {
>  * BIOS auto configuration
>  */
>
> +/* convert from MIX nid to DAC */
> +static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
> +{
> +	if (nid == 0x0f)
> +		return 0x02;
> +	else if (nid >= 0x0c && nid <= 0x0e)
> +		return nid - 0x0c + 0x02;
> +	else
> +		return 0;
> +}
> +
> +/* get MIX nid connected to the given pin targeted to DAC */
> +static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
> +				   hda_nid_t dac)
> +{
> +	hda_nid_t mix[4];
> +	int i, num;
> +
> +	num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
> +	for (i = 0; i < num; i++) {
> +		if (alc662_mix_to_dac(mix[i]) == dac)
> +			return mix[i];
> +	}
> +	return 0;
> +}
> +
> +/* look for an empty DAC slot */
> +static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
> +{
> +	struct alc_spec *spec = codec->spec;
> +	hda_nid_t srcs[5];
> +	int i, j, num;
> +
> +	num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
> +	if (num < 0)
> +		return 0;
> +	for (i = 0; i < num; i++) {
> +		hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
> +		if (!nid)
> +			continue;
> +		for (j = 0; j < spec->multiout.num_dacs; j++)
> +			if (spec->multiout.dac_nids[j] == nid)
> +				break;
> +		if (j >= spec->multiout.num_dacs)
> +			return nid;
> +	}
> +	return 0;
> +}
> +
> +/* fill in the dac_nids table from the parsed pin configuration */
> +static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
> +				     const struct auto_pin_cfg *cfg)
> +{
> +	struct alc_spec *spec = codec->spec;
> +	int i;
> +	hda_nid_t dac;
> +
> +	spec->multiout.dac_nids = spec->private_dac_nids;
> +	for (i = 0; i < cfg->line_outs; i++) {
> +		dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
> +		if (!dac)
> +			continue;
> +		spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
> +	}
> +	return 0;
> +}
> +
> +static int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
> +			      hda_nid_t nid, unsigned int chs)
> +{
> +	char name[32];
> +	sprintf(name, "%s Playback Volume", pfx);
> +	return add_control(spec, ALC_CTL_WIDGET_VOL, name,
> +			   HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
> +}
> +
> +static int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
> +			     hda_nid_t nid, unsigned int chs)
> +{
> +	char name[32];
> +	sprintf(name, "%s Playback Switch", pfx);
> +	return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> +			   HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
> +}
> +
> +#define alc662_add_stereo_vol(spec, pfx, nid) \
> +	alc662_add_vol_ctl(spec, pfx, nid, 3)
> +#define alc662_add_stereo_sw(spec, pfx, nid) \
> +	alc662_add_sw_ctl(spec, pfx, nid, 3)
> +
> /* add playback controls from the parsed DAC table */
> -static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
> +static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
> 					     const struct auto_pin_cfg *cfg)
> {
> -	char name[32];
> +	struct alc_spec *spec = codec->spec;
> 	static const char *chname[4] = {
> 		"Front", "Surround", NULL /*CLFE*/, "Side"
> 	};
> -	hda_nid_t nid;
> +	hda_nid_t nid, mix;
> 	int i, err;
>
> 	for (i = 0; i < cfg->line_outs; i++) {
> -		if (!spec->multiout.dac_nids[i])
> +		nid = spec->multiout.dac_nids[i];
> +		if (!nid)
> +			continue;
> +		mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
> +		if (!mix)
> 			continue;
> -		nid = alc880_idx_to_dac(i);
> 		if (i == 2) {
> 			/* Center/LFE */
> -			err = add_control(spec, ALC_CTL_WIDGET_VOL,
> -					  "Center Playback Volume",
> -					  HDA_COMPOSE_AMP_VAL(nid, 1, 0,
> -							      HDA_OUTPUT));
> +			err = alc662_add_vol_ctl(spec, "Center", nid, 1);
> 			if (err < 0)
> 				return err;
> -			err = add_control(spec, ALC_CTL_WIDGET_VOL,
> -					  "LFE Playback Volume",
> -					  HDA_COMPOSE_AMP_VAL(nid, 2, 0,
> -							      HDA_OUTPUT));
> +			err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
> 			if (err < 0)
> 				return err;
> -			err = add_control(spec, ALC_CTL_WIDGET_MUTE,
> -					  "Center Playback Switch",
> -					  HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
> -							      HDA_INPUT));
> +			err = alc662_add_sw_ctl(spec, "Center", mix, 1);
> 			if (err < 0)
> 				return err;
> -			err = add_control(spec, ALC_CTL_WIDGET_MUTE,
> -					  "LFE Playback Switch",
> -					  HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
> -							      HDA_INPUT));
> +			err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
> 			if (err < 0)
> 				return err;
> 		} else {
> 			const char *pfx;
> 			if (cfg->line_outs == 1 &&
> 			    cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
> -				if (!cfg->hp_pins)
> +				if (cfg->hp_outs)
> 					pfx = "Speaker";
> 				else
> 					pfx = "PCM";
> 			} else
> 				pfx = chname[i];
> -			sprintf(name, "%s Playback Volume", pfx);
> -			err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
> -					  HDA_COMPOSE_AMP_VAL(nid, 3, 0,
> -							      HDA_OUTPUT));
> +			err = alc662_add_vol_ctl(spec, pfx, nid, 3);
> 			if (err < 0)
> 				return err;
> 			if (cfg->line_outs == 1 &&
> 			    cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
> 				pfx = "Speaker";
> -			sprintf(name, "%s Playback Switch", pfx);
> -			err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> -				HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
> -						    3, 0, HDA_INPUT));
> +			err = alc662_add_sw_ctl(spec, pfx, mix, 3);
> 			if (err < 0)
> 				return err;
> 		}
> @@ -17218,54 +17293,38 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
> }
>
> /* add playback controls for speaker and HP outputs */
> -static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
> +/* return DAC nid if any new DAC is assigned */
> +static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
> 					const char *pfx)
> {
> -	hda_nid_t nid;
> +	struct alc_spec *spec = codec->spec;
> +	hda_nid_t nid, mix;
> 	int err;
> -	char name[32];
>
> 	if (!pin)
> 		return 0;
> -
> -	if (pin == 0x17) {
> -		/* ALC663 has a mono output pin on 0x17 */
> +	nid = alc662_look_for_dac(codec, pin);
> +	if (!nid) {
> +		char name[32];
> +		/* the corresponding DAC is already occupied */
> +		if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
> +			return 0; /* no way */
> +		/* create a switch only */
> 		sprintf(name, "%s Playback Switch", pfx);
> -		err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> -				  HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
> -		return err;
> +		return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> +				   HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
> 	}
>
> -	if (alc880_is_fixed_pin(pin)) {
> -		nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
> -		/* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
> -		/* specify the DAC as the extra output */
> -		if (!spec->multiout.hp_nid)
> -			spec->multiout.hp_nid = nid;
> -		else
> -			spec->multiout.extra_out_nid[0] = nid;
> -		/* control HP volume/switch on the output mixer amp */
> -		nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
> -		sprintf(name, "%s Playback Volume", pfx);
> -		err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
> -				  HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
> -		if (err < 0)
> -			return err;
> -		sprintf(name, "%s Playback Switch", pfx);
> -		err = add_control(spec, ALC_CTL_BIND_MUTE, name,
> -				  HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
> -		if (err < 0)
> -			return err;
> -	} else if (alc880_is_multi_pin(pin)) {
> -		/* set manual connection */
> -		/* we have only a switch on HP-out PIN */
> -		sprintf(name, "%s Playback Switch", pfx);
> -		err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> -				  HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
> -		if (err < 0)
> -			return err;
> -	}
> -	return 0;
> +	mix = alc662_dac_to_mix(codec, pin, nid);
> +	if (!mix)
> +		return 0;
> +	err = alc662_add_vol_ctl(spec, pfx, nid, 3);
> +	if (err < 0)
> +		return err;
> +	err = alc662_add_sw_ctl(spec, pfx, mix, 3);
> +	if (err < 0)
> +		return err;
> +	return nid;
> }
>
> /* create playback/capture controls for input pins */
> @@ -17274,30 +17333,35 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
>
> static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
> 					      hda_nid_t nid, int pin_type,
> -					      int dac_idx)
> +					      hda_nid_t dac)
> {
> +	int i, num;
> +	hda_nid_t srcs[4];
> +
> 	alc_set_pin_output(codec, nid, pin_type);
> 	/* need the manual connection? */
> -	if (alc880_is_multi_pin(nid)) {
> -		struct alc_spec *spec = codec->spec;
> -		int idx = alc880_multi_pin_idx(nid);
> -		snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
> -				    AC_VERB_SET_CONNECT_SEL,
> -				    alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
> +	num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
> +	if (num <= 1)
> +		return;
> +	for (i = 0; i < num; i++) {
> +		if (alc662_mix_to_dac(srcs[i]) != dac)
> +			continue;
> +		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
> +		return;
> 	}
> }
>
> static void alc662_auto_init_multi_out(struct hda_codec *codec)
> {
> 	struct alc_spec *spec = codec->spec;
> +	int pin_type = get_pin_type(spec->autocfg.line_out_type);
> 	int i;
>
> 	for (i = 0; i <= HDA_SIDE; i++) {
> 		hda_nid_t nid = spec->autocfg.line_out_pins[i];
> -		int pin_type = get_pin_type(spec->autocfg.line_out_type);
> 		if (nid)
> 			alc662_auto_set_output_and_unmute(codec, nid, pin_type,
> -							  i);
> +					spec->multiout.dac_nids[i]);
> 	}
> }
>
> @@ -17307,12 +17371,13 @@ static void alc662_auto_init_hp_out(struct hda_codec *codec)
> 	hda_nid_t pin;
>
> 	pin = spec->autocfg.hp_pins[0];
> -	if (pin) /* connect to front */
> -		/* use dac 0 */
> -		alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
> +	if (pin)
> +		alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
> +						  spec->multiout.hp_nid);
> 	pin = spec->autocfg.speaker_pins[0];
> 	if (pin)
> -		alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
> +		alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
> +					spec->multiout.extra_out_nid[0]);
> }
>
> #define ALC662_PIN_CD_NID		ALC880_PIN_CD_NID
> @@ -17350,21 +17415,25 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
> 	if (!spec->autocfg.line_outs)
> 		return 0; /* can't find valid BIOS pin config */
>
> -	err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
> +	err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
> 	if (err < 0)
> 		return err;
> -	err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
> +	err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
> 	if (err < 0)
> 		return err;
> -	err = alc662_auto_create_extra_out(spec,
> +	err = alc662_auto_create_extra_out(codec,
> 					   spec->autocfg.speaker_pins[0],
> 					   "Speaker");
> 	if (err < 0)
> 		return err;
> -	err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
> +	if (err)
> +		spec->multiout.extra_out_nid[0] = err;
> +	err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
> 					   "Headphone");
> 	if (err < 0)
> 		return err;
> +	if (err)
> +		spec->multiout.hp_nid = err;
> 	err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
> 	if (err < 0)
> 		return err;
>

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
  2009-10-07 20:34                 ` manoj.iyer
@ 2009-10-08  5:27                     ` Takashi Iwai
  0 siblings, 0 replies; 22+ messages in thread
From: Takashi Iwai @ 2009-10-08  5:27 UTC (permalink / raw)
  To: manoj.iyer; +Cc: perex, alsa-devel, linux-kernel, Joey Stanford

At Wed, 7 Oct 2009 15:34:59 -0500 (CDT),
manoj.iyer@canonical.com wrote:
> 
> 
> Takashi San,
> 
> Like I reported earlier, the patch you mailed me (See patch below) breaks 
> sound on Toshiba NB200/205 again, even with my quirk.

This can't be.  The patch I sent changes only the auto-parser, so with
the quirk it must be skipped.

> Any chance that we 
> can work on getting this fixed? If you point me in the right direction I 
> can dig into this some, also, mainline 
> http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32-rc1/ does not work. 
> iirc, you mentioned that this patch made it into mainline as well.

Try 2.6.32-rc3 as is.  If it doesn't work, please give alsa-info.sh
output back.


thanks,

Takashi

> 
> Thanks
> 
> On Thu, 1 Oct 2009, Takashi Iwai wrote:
> 
> > At Thu, 01 Oct 2009 10:26:05 +0200,
> > I wrote:
> >>
> >> At Thu, 1 Oct 2009 02:11:35 -0500 (CDT),
> >> manoj.iyer@canonical.com wrote:
> >>>
> >>>> 2.6.31.x is way too old for testing the new stuff :)
> >>>> Any chance to test 2.6.32-rc1?
> >>>
> >>> http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32-rc1/
> >>>
> >>> I tried the 2.6.32-rc1 today, and sound does not work for me on the NB200.
> >>
> >> OK, thanks for checking.
> >> After looking at the code a bit more deeply, it turned out that the
> >> BIOS auto-parser doesn't work with this particular configuration (the
> >> speaker with mono pin 0x17).
> >>
> >> I'm going to fix it later, but I applied your patch as the quick fix
> >> for the time being.
> >
> > Could you try the patch below with model=auto?
> > This will make the auto-parser working, hopefully.
> >
> >
> > thanks,
> >
> > Takashi
> >
> > ---
> > diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> > index 87da5e8..7810d3d 100644
> > --- a/sound/pci/hda/patch_realtek.c
> > +++ b/sound/pci/hda/patch_realtek.c
> > @@ -17146,70 +17146,145 @@ static struct alc_config_preset alc662_presets[] = {
> >  * BIOS auto configuration
> >  */
> >
> > +/* convert from MIX nid to DAC */
> > +static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
> > +{
> > +	if (nid == 0x0f)
> > +		return 0x02;
> > +	else if (nid >= 0x0c && nid <= 0x0e)
> > +		return nid - 0x0c + 0x02;
> > +	else
> > +		return 0;
> > +}
> > +
> > +/* get MIX nid connected to the given pin targeted to DAC */
> > +static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
> > +				   hda_nid_t dac)
> > +{
> > +	hda_nid_t mix[4];
> > +	int i, num;
> > +
> > +	num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
> > +	for (i = 0; i < num; i++) {
> > +		if (alc662_mix_to_dac(mix[i]) == dac)
> > +			return mix[i];
> > +	}
> > +	return 0;
> > +}
> > +
> > +/* look for an empty DAC slot */
> > +static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
> > +{
> > +	struct alc_spec *spec = codec->spec;
> > +	hda_nid_t srcs[5];
> > +	int i, j, num;
> > +
> > +	num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
> > +	if (num < 0)
> > +		return 0;
> > +	for (i = 0; i < num; i++) {
> > +		hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
> > +		if (!nid)
> > +			continue;
> > +		for (j = 0; j < spec->multiout.num_dacs; j++)
> > +			if (spec->multiout.dac_nids[j] == nid)
> > +				break;
> > +		if (j >= spec->multiout.num_dacs)
> > +			return nid;
> > +	}
> > +	return 0;
> > +}
> > +
> > +/* fill in the dac_nids table from the parsed pin configuration */
> > +static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
> > +				     const struct auto_pin_cfg *cfg)
> > +{
> > +	struct alc_spec *spec = codec->spec;
> > +	int i;
> > +	hda_nid_t dac;
> > +
> > +	spec->multiout.dac_nids = spec->private_dac_nids;
> > +	for (i = 0; i < cfg->line_outs; i++) {
> > +		dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
> > +		if (!dac)
> > +			continue;
> > +		spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
> > +	}
> > +	return 0;
> > +}
> > +
> > +static int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
> > +			      hda_nid_t nid, unsigned int chs)
> > +{
> > +	char name[32];
> > +	sprintf(name, "%s Playback Volume", pfx);
> > +	return add_control(spec, ALC_CTL_WIDGET_VOL, name,
> > +			   HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
> > +}
> > +
> > +static int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
> > +			     hda_nid_t nid, unsigned int chs)
> > +{
> > +	char name[32];
> > +	sprintf(name, "%s Playback Switch", pfx);
> > +	return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> > +			   HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
> > +}
> > +
> > +#define alc662_add_stereo_vol(spec, pfx, nid) \
> > +	alc662_add_vol_ctl(spec, pfx, nid, 3)
> > +#define alc662_add_stereo_sw(spec, pfx, nid) \
> > +	alc662_add_sw_ctl(spec, pfx, nid, 3)
> > +
> > /* add playback controls from the parsed DAC table */
> > -static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
> > +static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
> > 					     const struct auto_pin_cfg *cfg)
> > {
> > -	char name[32];
> > +	struct alc_spec *spec = codec->spec;
> > 	static const char *chname[4] = {
> > 		"Front", "Surround", NULL /*CLFE*/, "Side"
> > 	};
> > -	hda_nid_t nid;
> > +	hda_nid_t nid, mix;
> > 	int i, err;
> >
> > 	for (i = 0; i < cfg->line_outs; i++) {
> > -		if (!spec->multiout.dac_nids[i])
> > +		nid = spec->multiout.dac_nids[i];
> > +		if (!nid)
> > +			continue;
> > +		mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
> > +		if (!mix)
> > 			continue;
> > -		nid = alc880_idx_to_dac(i);
> > 		if (i == 2) {
> > 			/* Center/LFE */
> > -			err = add_control(spec, ALC_CTL_WIDGET_VOL,
> > -					  "Center Playback Volume",
> > -					  HDA_COMPOSE_AMP_VAL(nid, 1, 0,
> > -							      HDA_OUTPUT));
> > +			err = alc662_add_vol_ctl(spec, "Center", nid, 1);
> > 			if (err < 0)
> > 				return err;
> > -			err = add_control(spec, ALC_CTL_WIDGET_VOL,
> > -					  "LFE Playback Volume",
> > -					  HDA_COMPOSE_AMP_VAL(nid, 2, 0,
> > -							      HDA_OUTPUT));
> > +			err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
> > 			if (err < 0)
> > 				return err;
> > -			err = add_control(spec, ALC_CTL_WIDGET_MUTE,
> > -					  "Center Playback Switch",
> > -					  HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
> > -							      HDA_INPUT));
> > +			err = alc662_add_sw_ctl(spec, "Center", mix, 1);
> > 			if (err < 0)
> > 				return err;
> > -			err = add_control(spec, ALC_CTL_WIDGET_MUTE,
> > -					  "LFE Playback Switch",
> > -					  HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
> > -							      HDA_INPUT));
> > +			err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
> > 			if (err < 0)
> > 				return err;
> > 		} else {
> > 			const char *pfx;
> > 			if (cfg->line_outs == 1 &&
> > 			    cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
> > -				if (!cfg->hp_pins)
> > +				if (cfg->hp_outs)
> > 					pfx = "Speaker";
> > 				else
> > 					pfx = "PCM";
> > 			} else
> > 				pfx = chname[i];
> > -			sprintf(name, "%s Playback Volume", pfx);
> > -			err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
> > -					  HDA_COMPOSE_AMP_VAL(nid, 3, 0,
> > -							      HDA_OUTPUT));
> > +			err = alc662_add_vol_ctl(spec, pfx, nid, 3);
> > 			if (err < 0)
> > 				return err;
> > 			if (cfg->line_outs == 1 &&
> > 			    cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
> > 				pfx = "Speaker";
> > -			sprintf(name, "%s Playback Switch", pfx);
> > -			err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> > -				HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
> > -						    3, 0, HDA_INPUT));
> > +			err = alc662_add_sw_ctl(spec, pfx, mix, 3);
> > 			if (err < 0)
> > 				return err;
> > 		}
> > @@ -17218,54 +17293,38 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
> > }
> >
> > /* add playback controls for speaker and HP outputs */
> > -static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
> > +/* return DAC nid if any new DAC is assigned */
> > +static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
> > 					const char *pfx)
> > {
> > -	hda_nid_t nid;
> > +	struct alc_spec *spec = codec->spec;
> > +	hda_nid_t nid, mix;
> > 	int err;
> > -	char name[32];
> >
> > 	if (!pin)
> > 		return 0;
> > -
> > -	if (pin == 0x17) {
> > -		/* ALC663 has a mono output pin on 0x17 */
> > +	nid = alc662_look_for_dac(codec, pin);
> > +	if (!nid) {
> > +		char name[32];
> > +		/* the corresponding DAC is already occupied */
> > +		if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
> > +			return 0; /* no way */
> > +		/* create a switch only */
> > 		sprintf(name, "%s Playback Switch", pfx);
> > -		err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> > -				  HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
> > -		return err;
> > +		return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> > +				   HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
> > 	}
> >
> > -	if (alc880_is_fixed_pin(pin)) {
> > -		nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
> > -		/* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
> > -		/* specify the DAC as the extra output */
> > -		if (!spec->multiout.hp_nid)
> > -			spec->multiout.hp_nid = nid;
> > -		else
> > -			spec->multiout.extra_out_nid[0] = nid;
> > -		/* control HP volume/switch on the output mixer amp */
> > -		nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
> > -		sprintf(name, "%s Playback Volume", pfx);
> > -		err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
> > -				  HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
> > -		if (err < 0)
> > -			return err;
> > -		sprintf(name, "%s Playback Switch", pfx);
> > -		err = add_control(spec, ALC_CTL_BIND_MUTE, name,
> > -				  HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
> > -		if (err < 0)
> > -			return err;
> > -	} else if (alc880_is_multi_pin(pin)) {
> > -		/* set manual connection */
> > -		/* we have only a switch on HP-out PIN */
> > -		sprintf(name, "%s Playback Switch", pfx);
> > -		err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> > -				  HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
> > -		if (err < 0)
> > -			return err;
> > -	}
> > -	return 0;
> > +	mix = alc662_dac_to_mix(codec, pin, nid);
> > +	if (!mix)
> > +		return 0;
> > +	err = alc662_add_vol_ctl(spec, pfx, nid, 3);
> > +	if (err < 0)
> > +		return err;
> > +	err = alc662_add_sw_ctl(spec, pfx, mix, 3);
> > +	if (err < 0)
> > +		return err;
> > +	return nid;
> > }
> >
> > /* create playback/capture controls for input pins */
> > @@ -17274,30 +17333,35 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
> >
> > static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
> > 					      hda_nid_t nid, int pin_type,
> > -					      int dac_idx)
> > +					      hda_nid_t dac)
> > {
> > +	int i, num;
> > +	hda_nid_t srcs[4];
> > +
> > 	alc_set_pin_output(codec, nid, pin_type);
> > 	/* need the manual connection? */
> > -	if (alc880_is_multi_pin(nid)) {
> > -		struct alc_spec *spec = codec->spec;
> > -		int idx = alc880_multi_pin_idx(nid);
> > -		snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
> > -				    AC_VERB_SET_CONNECT_SEL,
> > -				    alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
> > +	num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
> > +	if (num <= 1)
> > +		return;
> > +	for (i = 0; i < num; i++) {
> > +		if (alc662_mix_to_dac(srcs[i]) != dac)
> > +			continue;
> > +		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
> > +		return;
> > 	}
> > }
> >
> > static void alc662_auto_init_multi_out(struct hda_codec *codec)
> > {
> > 	struct alc_spec *spec = codec->spec;
> > +	int pin_type = get_pin_type(spec->autocfg.line_out_type);
> > 	int i;
> >
> > 	for (i = 0; i <= HDA_SIDE; i++) {
> > 		hda_nid_t nid = spec->autocfg.line_out_pins[i];
> > -		int pin_type = get_pin_type(spec->autocfg.line_out_type);
> > 		if (nid)
> > 			alc662_auto_set_output_and_unmute(codec, nid, pin_type,
> > -							  i);
> > +					spec->multiout.dac_nids[i]);
> > 	}
> > }
> >
> > @@ -17307,12 +17371,13 @@ static void alc662_auto_init_hp_out(struct hda_codec *codec)
> > 	hda_nid_t pin;
> >
> > 	pin = spec->autocfg.hp_pins[0];
> > -	if (pin) /* connect to front */
> > -		/* use dac 0 */
> > -		alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
> > +	if (pin)
> > +		alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
> > +						  spec->multiout.hp_nid);
> > 	pin = spec->autocfg.speaker_pins[0];
> > 	if (pin)
> > -		alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
> > +		alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
> > +					spec->multiout.extra_out_nid[0]);
> > }
> >
> > #define ALC662_PIN_CD_NID		ALC880_PIN_CD_NID
> > @@ -17350,21 +17415,25 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
> > 	if (!spec->autocfg.line_outs)
> > 		return 0; /* can't find valid BIOS pin config */
> >
> > -	err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
> > +	err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
> > 	if (err < 0)
> > 		return err;
> > -	err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
> > +	err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
> > 	if (err < 0)
> > 		return err;
> > -	err = alc662_auto_create_extra_out(spec,
> > +	err = alc662_auto_create_extra_out(codec,
> > 					   spec->autocfg.speaker_pins[0],
> > 					   "Speaker");
> > 	if (err < 0)
> > 		return err;
> > -	err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
> > +	if (err)
> > +		spec->multiout.extra_out_nid[0] = err;
> > +	err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
> > 					   "Headphone");
> > 	if (err < 0)
> > 		return err;
> > +	if (err)
> > +		spec->multiout.hp_nid = err;
> > 	err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
> > 	if (err < 0)
> > 		return err;
> >
> 

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

* Re: [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200
@ 2009-10-08  5:27                     ` Takashi Iwai
  0 siblings, 0 replies; 22+ messages in thread
From: Takashi Iwai @ 2009-10-08  5:27 UTC (permalink / raw)
  To: manoj.iyer; +Cc: alsa-devel, linux-kernel, Joey Stanford

At Wed, 7 Oct 2009 15:34:59 -0500 (CDT),
manoj.iyer@canonical.com wrote:
> 
> 
> Takashi San,
> 
> Like I reported earlier, the patch you mailed me (See patch below) breaks 
> sound on Toshiba NB200/205 again, even with my quirk.

This can't be.  The patch I sent changes only the auto-parser, so with
the quirk it must be skipped.

> Any chance that we 
> can work on getting this fixed? If you point me in the right direction I 
> can dig into this some, also, mainline 
> http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32-rc1/ does not work. 
> iirc, you mentioned that this patch made it into mainline as well.

Try 2.6.32-rc3 as is.  If it doesn't work, please give alsa-info.sh
output back.


thanks,

Takashi

> 
> Thanks
> 
> On Thu, 1 Oct 2009, Takashi Iwai wrote:
> 
> > At Thu, 01 Oct 2009 10:26:05 +0200,
> > I wrote:
> >>
> >> At Thu, 1 Oct 2009 02:11:35 -0500 (CDT),
> >> manoj.iyer@canonical.com wrote:
> >>>
> >>>> 2.6.31.x is way too old for testing the new stuff :)
> >>>> Any chance to test 2.6.32-rc1?
> >>>
> >>> http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32-rc1/
> >>>
> >>> I tried the 2.6.32-rc1 today, and sound does not work for me on the NB200.
> >>
> >> OK, thanks for checking.
> >> After looking at the code a bit more deeply, it turned out that the
> >> BIOS auto-parser doesn't work with this particular configuration (the
> >> speaker with mono pin 0x17).
> >>
> >> I'm going to fix it later, but I applied your patch as the quick fix
> >> for the time being.
> >
> > Could you try the patch below with model=auto?
> > This will make the auto-parser working, hopefully.
> >
> >
> > thanks,
> >
> > Takashi
> >
> > ---
> > diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> > index 87da5e8..7810d3d 100644
> > --- a/sound/pci/hda/patch_realtek.c
> > +++ b/sound/pci/hda/patch_realtek.c
> > @@ -17146,70 +17146,145 @@ static struct alc_config_preset alc662_presets[] = {
> >  * BIOS auto configuration
> >  */
> >
> > +/* convert from MIX nid to DAC */
> > +static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
> > +{
> > +	if (nid == 0x0f)
> > +		return 0x02;
> > +	else if (nid >= 0x0c && nid <= 0x0e)
> > +		return nid - 0x0c + 0x02;
> > +	else
> > +		return 0;
> > +}
> > +
> > +/* get MIX nid connected to the given pin targeted to DAC */
> > +static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
> > +				   hda_nid_t dac)
> > +{
> > +	hda_nid_t mix[4];
> > +	int i, num;
> > +
> > +	num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
> > +	for (i = 0; i < num; i++) {
> > +		if (alc662_mix_to_dac(mix[i]) == dac)
> > +			return mix[i];
> > +	}
> > +	return 0;
> > +}
> > +
> > +/* look for an empty DAC slot */
> > +static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
> > +{
> > +	struct alc_spec *spec = codec->spec;
> > +	hda_nid_t srcs[5];
> > +	int i, j, num;
> > +
> > +	num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
> > +	if (num < 0)
> > +		return 0;
> > +	for (i = 0; i < num; i++) {
> > +		hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
> > +		if (!nid)
> > +			continue;
> > +		for (j = 0; j < spec->multiout.num_dacs; j++)
> > +			if (spec->multiout.dac_nids[j] == nid)
> > +				break;
> > +		if (j >= spec->multiout.num_dacs)
> > +			return nid;
> > +	}
> > +	return 0;
> > +}
> > +
> > +/* fill in the dac_nids table from the parsed pin configuration */
> > +static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
> > +				     const struct auto_pin_cfg *cfg)
> > +{
> > +	struct alc_spec *spec = codec->spec;
> > +	int i;
> > +	hda_nid_t dac;
> > +
> > +	spec->multiout.dac_nids = spec->private_dac_nids;
> > +	for (i = 0; i < cfg->line_outs; i++) {
> > +		dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
> > +		if (!dac)
> > +			continue;
> > +		spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
> > +	}
> > +	return 0;
> > +}
> > +
> > +static int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
> > +			      hda_nid_t nid, unsigned int chs)
> > +{
> > +	char name[32];
> > +	sprintf(name, "%s Playback Volume", pfx);
> > +	return add_control(spec, ALC_CTL_WIDGET_VOL, name,
> > +			   HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
> > +}
> > +
> > +static int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
> > +			     hda_nid_t nid, unsigned int chs)
> > +{
> > +	char name[32];
> > +	sprintf(name, "%s Playback Switch", pfx);
> > +	return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> > +			   HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
> > +}
> > +
> > +#define alc662_add_stereo_vol(spec, pfx, nid) \
> > +	alc662_add_vol_ctl(spec, pfx, nid, 3)
> > +#define alc662_add_stereo_sw(spec, pfx, nid) \
> > +	alc662_add_sw_ctl(spec, pfx, nid, 3)
> > +
> > /* add playback controls from the parsed DAC table */
> > -static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
> > +static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
> > 					     const struct auto_pin_cfg *cfg)
> > {
> > -	char name[32];
> > +	struct alc_spec *spec = codec->spec;
> > 	static const char *chname[4] = {
> > 		"Front", "Surround", NULL /*CLFE*/, "Side"
> > 	};
> > -	hda_nid_t nid;
> > +	hda_nid_t nid, mix;
> > 	int i, err;
> >
> > 	for (i = 0; i < cfg->line_outs; i++) {
> > -		if (!spec->multiout.dac_nids[i])
> > +		nid = spec->multiout.dac_nids[i];
> > +		if (!nid)
> > +			continue;
> > +		mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
> > +		if (!mix)
> > 			continue;
> > -		nid = alc880_idx_to_dac(i);
> > 		if (i == 2) {
> > 			/* Center/LFE */
> > -			err = add_control(spec, ALC_CTL_WIDGET_VOL,
> > -					  "Center Playback Volume",
> > -					  HDA_COMPOSE_AMP_VAL(nid, 1, 0,
> > -							      HDA_OUTPUT));
> > +			err = alc662_add_vol_ctl(spec, "Center", nid, 1);
> > 			if (err < 0)
> > 				return err;
> > -			err = add_control(spec, ALC_CTL_WIDGET_VOL,
> > -					  "LFE Playback Volume",
> > -					  HDA_COMPOSE_AMP_VAL(nid, 2, 0,
> > -							      HDA_OUTPUT));
> > +			err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
> > 			if (err < 0)
> > 				return err;
> > -			err = add_control(spec, ALC_CTL_WIDGET_MUTE,
> > -					  "Center Playback Switch",
> > -					  HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
> > -							      HDA_INPUT));
> > +			err = alc662_add_sw_ctl(spec, "Center", mix, 1);
> > 			if (err < 0)
> > 				return err;
> > -			err = add_control(spec, ALC_CTL_WIDGET_MUTE,
> > -					  "LFE Playback Switch",
> > -					  HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
> > -							      HDA_INPUT));
> > +			err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
> > 			if (err < 0)
> > 				return err;
> > 		} else {
> > 			const char *pfx;
> > 			if (cfg->line_outs == 1 &&
> > 			    cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
> > -				if (!cfg->hp_pins)
> > +				if (cfg->hp_outs)
> > 					pfx = "Speaker";
> > 				else
> > 					pfx = "PCM";
> > 			} else
> > 				pfx = chname[i];
> > -			sprintf(name, "%s Playback Volume", pfx);
> > -			err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
> > -					  HDA_COMPOSE_AMP_VAL(nid, 3, 0,
> > -							      HDA_OUTPUT));
> > +			err = alc662_add_vol_ctl(spec, pfx, nid, 3);
> > 			if (err < 0)
> > 				return err;
> > 			if (cfg->line_outs == 1 &&
> > 			    cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
> > 				pfx = "Speaker";
> > -			sprintf(name, "%s Playback Switch", pfx);
> > -			err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> > -				HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
> > -						    3, 0, HDA_INPUT));
> > +			err = alc662_add_sw_ctl(spec, pfx, mix, 3);
> > 			if (err < 0)
> > 				return err;
> > 		}
> > @@ -17218,54 +17293,38 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
> > }
> >
> > /* add playback controls for speaker and HP outputs */
> > -static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
> > +/* return DAC nid if any new DAC is assigned */
> > +static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
> > 					const char *pfx)
> > {
> > -	hda_nid_t nid;
> > +	struct alc_spec *spec = codec->spec;
> > +	hda_nid_t nid, mix;
> > 	int err;
> > -	char name[32];
> >
> > 	if (!pin)
> > 		return 0;
> > -
> > -	if (pin == 0x17) {
> > -		/* ALC663 has a mono output pin on 0x17 */
> > +	nid = alc662_look_for_dac(codec, pin);
> > +	if (!nid) {
> > +		char name[32];
> > +		/* the corresponding DAC is already occupied */
> > +		if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
> > +			return 0; /* no way */
> > +		/* create a switch only */
> > 		sprintf(name, "%s Playback Switch", pfx);
> > -		err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> > -				  HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
> > -		return err;
> > +		return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> > +				   HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
> > 	}
> >
> > -	if (alc880_is_fixed_pin(pin)) {
> > -		nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
> > -		/* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
> > -		/* specify the DAC as the extra output */
> > -		if (!spec->multiout.hp_nid)
> > -			spec->multiout.hp_nid = nid;
> > -		else
> > -			spec->multiout.extra_out_nid[0] = nid;
> > -		/* control HP volume/switch on the output mixer amp */
> > -		nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
> > -		sprintf(name, "%s Playback Volume", pfx);
> > -		err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
> > -				  HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
> > -		if (err < 0)
> > -			return err;
> > -		sprintf(name, "%s Playback Switch", pfx);
> > -		err = add_control(spec, ALC_CTL_BIND_MUTE, name,
> > -				  HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
> > -		if (err < 0)
> > -			return err;
> > -	} else if (alc880_is_multi_pin(pin)) {
> > -		/* set manual connection */
> > -		/* we have only a switch on HP-out PIN */
> > -		sprintf(name, "%s Playback Switch", pfx);
> > -		err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
> > -				  HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
> > -		if (err < 0)
> > -			return err;
> > -	}
> > -	return 0;
> > +	mix = alc662_dac_to_mix(codec, pin, nid);
> > +	if (!mix)
> > +		return 0;
> > +	err = alc662_add_vol_ctl(spec, pfx, nid, 3);
> > +	if (err < 0)
> > +		return err;
> > +	err = alc662_add_sw_ctl(spec, pfx, mix, 3);
> > +	if (err < 0)
> > +		return err;
> > +	return nid;
> > }
> >
> > /* create playback/capture controls for input pins */
> > @@ -17274,30 +17333,35 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
> >
> > static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
> > 					      hda_nid_t nid, int pin_type,
> > -					      int dac_idx)
> > +					      hda_nid_t dac)
> > {
> > +	int i, num;
> > +	hda_nid_t srcs[4];
> > +
> > 	alc_set_pin_output(codec, nid, pin_type);
> > 	/* need the manual connection? */
> > -	if (alc880_is_multi_pin(nid)) {
> > -		struct alc_spec *spec = codec->spec;
> > -		int idx = alc880_multi_pin_idx(nid);
> > -		snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
> > -				    AC_VERB_SET_CONNECT_SEL,
> > -				    alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
> > +	num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
> > +	if (num <= 1)
> > +		return;
> > +	for (i = 0; i < num; i++) {
> > +		if (alc662_mix_to_dac(srcs[i]) != dac)
> > +			continue;
> > +		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
> > +		return;
> > 	}
> > }
> >
> > static void alc662_auto_init_multi_out(struct hda_codec *codec)
> > {
> > 	struct alc_spec *spec = codec->spec;
> > +	int pin_type = get_pin_type(spec->autocfg.line_out_type);
> > 	int i;
> >
> > 	for (i = 0; i <= HDA_SIDE; i++) {
> > 		hda_nid_t nid = spec->autocfg.line_out_pins[i];
> > -		int pin_type = get_pin_type(spec->autocfg.line_out_type);
> > 		if (nid)
> > 			alc662_auto_set_output_and_unmute(codec, nid, pin_type,
> > -							  i);
> > +					spec->multiout.dac_nids[i]);
> > 	}
> > }
> >
> > @@ -17307,12 +17371,13 @@ static void alc662_auto_init_hp_out(struct hda_codec *codec)
> > 	hda_nid_t pin;
> >
> > 	pin = spec->autocfg.hp_pins[0];
> > -	if (pin) /* connect to front */
> > -		/* use dac 0 */
> > -		alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
> > +	if (pin)
> > +		alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
> > +						  spec->multiout.hp_nid);
> > 	pin = spec->autocfg.speaker_pins[0];
> > 	if (pin)
> > -		alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
> > +		alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
> > +					spec->multiout.extra_out_nid[0]);
> > }
> >
> > #define ALC662_PIN_CD_NID		ALC880_PIN_CD_NID
> > @@ -17350,21 +17415,25 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
> > 	if (!spec->autocfg.line_outs)
> > 		return 0; /* can't find valid BIOS pin config */
> >
> > -	err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
> > +	err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
> > 	if (err < 0)
> > 		return err;
> > -	err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
> > +	err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
> > 	if (err < 0)
> > 		return err;
> > -	err = alc662_auto_create_extra_out(spec,
> > +	err = alc662_auto_create_extra_out(codec,
> > 					   spec->autocfg.speaker_pins[0],
> > 					   "Speaker");
> > 	if (err < 0)
> > 		return err;
> > -	err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
> > +	if (err)
> > +		spec->multiout.extra_out_nid[0] = err;
> > +	err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
> > 					   "Headphone");
> > 	if (err < 0)
> > 		return err;
> > +	if (err)
> > +		spec->multiout.hp_nid = err;
> > 	err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
> > 	if (err < 0)
> > 		return err;
> >
> 

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

end of thread, other threads:[~2009-10-08  5:28 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-23  5:39 [PATCH REALTEK] Added quirk to enable sound on Toshiba NB200 Manoj Iyer
2009-09-23  5:50 ` Takashi Iwai
2009-09-23  5:50   ` Takashi Iwai
2009-09-28 15:30   ` manoj.iyer
2009-09-29  7:23     ` Takashi Iwai
2009-09-29  7:23       ` Takashi Iwai
2009-09-30  0:23       ` manoj.iyer
2009-09-30  5:33         ` Takashi Iwai
2009-09-30  5:33           ` Takashi Iwai
2009-10-01  7:11           ` manoj.iyer
2009-10-01  8:26             ` Takashi Iwai
2009-10-01  8:26               ` Takashi Iwai
2009-10-01 19:28               ` Takashi Iwai
2009-10-01 19:28                 ` Takashi Iwai
2009-10-02 20:44                 ` manoj.iyer
2009-10-06  0:13                 ` manoj.iyer
2009-10-06  5:45                   ` Takashi Iwai
2009-10-06  5:45                     ` Takashi Iwai
2009-10-06 22:06                     ` manoj.iyer
2009-10-07 20:34                 ` manoj.iyer
2009-10-08  5:27                   ` Takashi Iwai
2009-10-08  5:27                     ` 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.