All of lore.kernel.org
 help / color / mirror / Atom feed
* Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
@ 2015-04-25  0:50 Gabriele Martino
  2015-04-27  9:09 ` Takashi Iwai
  0 siblings, 1 reply; 21+ messages in thread
From: Gabriele Martino @ 2015-04-25  0:50 UTC (permalink / raw)
  To: alsa-devel

Hi,
the new Alienware 15 laptop (2015, not the M15x) has a Creative Sound
Core3D-EX Audio which seems to work with ca0132.
I'm using a 4.0.0 kernel with gentoo patchset, but with the default
configuration:
- the line out/headphone jack doesn't work, it only outputs some white noise
- alsamixer shows only "Master" and "PCM" channel, no "Front", "Line
Out" or similar
- alsamixer has a toggle switch for the "HP/Speaker" but no
headphone/line out switch
- the jack detection is enabled on the "line in" jack instead of the
"line out" (if I plug something on the "line in", the speakers are muted)
- if I play too much with these switches, the speakers stop working
until suspend/reboot

To fix the first issue I run "hdajacksensetest" to get the headphone
jack pin:
hdajacksensetest -c 1 -a
Pin 0x0b (Internal Speaker): present = Yes
Pin 0x0c (Not connected): present = No
Pin 0x0d (Not connected): present = No
Pin 0x0e (Not connected): present = No
Pin 0x0f (Not connected): present = Yes
Pin 0x10 (Not connected): present = No
Pin 0x11 (Black Line In, Left side): present = No
Pin 0x12 (Internal Mic, Mobile-In): present = No
Pin 0x13 (Not connected): present = No
Pin 0x18 (Not connected): present = No

and replaced the pin number:

--- /usr/src/linux-4.0.0-gentoo/sound/pci/hda/patch_ca0132.c.old       
2015-04-13 00:12:50.000000000 +0200
+++ /usr/src/linux-4.0.0-gentoo/sound/pci/hda/patch_ca0132.c   
2015-04-25 01:43:09.607531550 +0200
@@ -4625,7 +4625,7 @@
 
        spec->num_outputs = 2;
        spec->out_pins[0] = 0x0b; /* speaker out */
-       spec->out_pins[1] = 0x10; /* headphone out */
+       spec->out_pins[1] = 0x0f; /* default: 0x10 - headphone out -0x0f
on Alienware 15 2015 */
        spec->shared_out_nid = 0x2;
 
        spec->num_inputs = 3;

Now the "HP/Speaker Auto Detect" is ignored on both jacks, but I can
switch between headphones and speakers manually with the "HP/Speaker" item.

This is a dirty hack (and probably won't work on different cards), is
there a better way to fix this and get at least the jack detection working?

Regards,
Gabriele

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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-04-25  0:50 Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX Gabriele Martino
@ 2015-04-27  9:09 ` Takashi Iwai
  2015-04-27 18:08   ` Gabriele Martino
  0 siblings, 1 reply; 21+ messages in thread
From: Takashi Iwai @ 2015-04-27  9:09 UTC (permalink / raw)
  To: Gabriele Martino; +Cc: alsa-devel

At Sat, 25 Apr 2015 02:50:23 +0200,
Gabriele Martino wrote:
> 
> Hi,
> the new Alienware 15 laptop (2015, not the M15x) has a Creative Sound
> Core3D-EX Audio which seems to work with ca0132.
> I'm using a 4.0.0 kernel with gentoo patchset, but with the default
> configuration:
> - the line out/headphone jack doesn't work, it only outputs some white noise
> - alsamixer shows only "Master" and "PCM" channel, no "Front", "Line
> Out" or similar
> - alsamixer has a toggle switch for the "HP/Speaker" but no
> headphone/line out switch
> - the jack detection is enabled on the "line in" jack instead of the
> "line out" (if I plug something on the "line in", the speakers are muted)
> - if I play too much with these switches, the speakers stop working
> until suspend/reboot
> 
> To fix the first issue I run "hdajacksensetest" to get the headphone
> jack pin:
> hdajacksensetest -c 1 -a
> Pin 0x0b (Internal Speaker): present = Yes
> Pin 0x0c (Not connected): present = No
> Pin 0x0d (Not connected): present = No
> Pin 0x0e (Not connected): present = No
> Pin 0x0f (Not connected): present = Yes
> Pin 0x10 (Not connected): present = No
> Pin 0x11 (Black Line In, Left side): present = No
> Pin 0x12 (Internal Mic, Mobile-In): present = No
> Pin 0x13 (Not connected): present = No
> Pin 0x18 (Not connected): present = No
> 
> and replaced the pin number:
> 
> --- /usr/src/linux-4.0.0-gentoo/sound/pci/hda/patch_ca0132.c.old       
> 2015-04-13 00:12:50.000000000 +0200
> +++ /usr/src/linux-4.0.0-gentoo/sound/pci/hda/patch_ca0132.c   
> 2015-04-25 01:43:09.607531550 +0200
> @@ -4625,7 +4625,7 @@
>  
>         spec->num_outputs = 2;
>         spec->out_pins[0] = 0x0b; /* speaker out */
> -       spec->out_pins[1] = 0x10; /* headphone out */
> +       spec->out_pins[1] = 0x0f; /* default: 0x10 - headphone out -0x0f
> on Alienware 15 2015 */
>         spec->shared_out_nid = 0x2;
>  
>         spec->num_inputs = 3;
> 
> Now the "HP/Speaker Auto Detect" is ignored on both jacks, but I can
> switch between headphones and speakers manually with the "HP/Speaker" item.
> 
> This is a dirty hack (and probably won't work on different cards), is
> there a better way to fix this and get at least the jack detection working?

In general, we check either PCI or codec SSID to identify the model
and applies the quirk accordingly.  Does your board have also a unique
SSID?


Takashi

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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-04-27  9:09 ` Takashi Iwai
@ 2015-04-27 18:08   ` Gabriele Martino
  2015-04-27 18:51     ` Takashi Iwai
  0 siblings, 1 reply; 21+ messages in thread
From: Gabriele Martino @ 2015-04-27 18:08 UTC (permalink / raw)
  To: alsa-devel

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

On 27/04/2015 11:09, Takashi Iwai wrote:
> In general, we check either PCI or codec SSID to identify the model
> and applies the quirk accordingly.  Does your board have also a unique
> SSID?
Good question. How do I find it? I can't see any in alsa-info.

Regards,
Gabriele

[-- Attachment #2: alsa-info.txt --]
[-- Type: text/plain, Size: 45661 bytes --]

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

!!Script ran on: Mon Apr 27 17:52:38 UTC 2015


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

Gentoo Base System release 2.2 DISTRIB_ID="Gentoo" NAME=Gentoo ID=gentoo PRETTY_NAME="Gentoo/Linux" HOME_URL="http://www.gentoo.org/" SUPPORT_URL="http://www.gentoo.org/main/en/support.xml" BUG_REPORT_URL="https://bugs.gentoo.org/"


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

Manufacturer:      Alienware
Product Name:      Alienware 15
Product Version:   A02
Firmware Version:  A02


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

Kernel release:    4.0.0-wl-ath+
Operating System:  GNU/Linux
Architecture:      x86_64
Processor:         Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz
SMP Enabled:       Yes


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

Driver version:     k4.0.0-wl-ath+
Library version:    1.0.29
Utilities version:  1.0.29


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

snd_hda_intel
snd_hda_intel


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

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

Jack:
      Installed - Yes (/usr/bin/jackd)
      Running - No


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

 0 [HDMI           ]: HDA-Intel - HDA Intel HDMI
                      HDA Intel HDMI at 0xf751c000 irq 42
 1 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xf7518000 irq 41


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

00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller (rev 06)
00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 05)


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

00:03.0 0403: 8086:0c0c (rev 06)
	Subsystem: 1028:0685
--
00:1b.0 0403: 8086:8c20 (rev 05)
	Subsystem: 1028:0685


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

!!Module: snd_hda_intel
	align_buffer_size : -1
	bdl_pos_adj : 32,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
	enable : Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y
	enable_msi : -1
	id : (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
	jackpoll_ms : 0,0,0,0,0,0,0,0,0,0,0,0
	model : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
	patch : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
	position_fix : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
	power_save : 60
	power_save_controller : Y
	probe_mask : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
	probe_only : 0,0,0,0,0,0,0,0,0,0,0,0
	single_cmd : N
	snoop : -1

!!Module: snd_hda_intel
	align_buffer_size : -1
	bdl_pos_adj : 32,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
	enable : Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y
	enable_msi : -1
	id : (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
	jackpoll_ms : 0,0,0,0,0,0,0,0,0,0,0,0
	model : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
	patch : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
	position_fix : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
	power_save : 60
	power_save_controller : Y
	probe_mask : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
	probe_only : 0,0,0,0,0,0,0,0,0,0,0,0
	single_cmd : N
	snoop : -1


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

Codec: Intel Haswell HDMI
Address: 0
AFG Function Id: 0x1 (unsol 0)
Vendor Id: 0x80862807
Subsystem Id: 0x80860101
Revision Id: 0x100000
No Modem Function Group found
Default PCM:
    rates [0x0]:
    bits [0x0]:
    formats [0x0]:
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
State of AFG node 0x01:
  Power states:  D0 D3 CLKSTOP EPSS
  Power: setting=D0, actual=D0, Clock-stop-OK
GPIO: io=0, o=0, i=0, unsolicited=0, wake=0
Node 0x02 [Audio Output] wcaps 0x6611: 8-Channels Digital
  Converter: stream=1, channel=0
  Digital: Enabled GenLevel KAE
  Digital category: 0x2
  IEC Coding Type: 0x0
  PCM:
    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
    bits [0x1e]: 16 20 24 32
    formats [0x5]: PCM AC3
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x03 [Audio Output] wcaps 0x6611: 8-Channels Digital
  Converter: stream=0, channel=0
  Digital: Enabled KAE
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
    bits [0x1e]: 16 20 24 32
    formats [0x5]: PCM AC3
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x04 [Audio Output] wcaps 0x6611: 8-Channels Digital
  Converter: stream=0, channel=0
  Digital: Enabled KAE
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
    bits [0x1e]: 16 20 24 32
    formats [0x5]: PCM AC3
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x05 [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
  Control: name="HDMI/DP,pcm=3 Jack", index=0, device=0
  Control: name="IEC958 Playback Con Mask", index=0, device=0
  Control: name="IEC958 Playback Pro Mask", index=0, device=0
  Control: name="IEC958 Playback Default", index=0, device=0
  Control: name="IEC958 Playback Switch", index=0, device=0
  Control: name="ELD", index=0, device=3
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0b000094: OUT Detect HBR HDMI DP
  Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=01, enabled=1
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Devices: 0
  Connection: 0
  In-driver Connection: 3
     0x02 0x03 0x04
Node 0x06 [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
  Control: name="HDMI/DP,pcm=7 Jack", index=0, device=0
  Control: name="IEC958 Playback Con Mask", index=1, device=0
  Control: name="IEC958 Playback Pro Mask", index=1, device=0
  Control: name="IEC958 Playback Default", index=1, device=0
  Control: name="IEC958 Playback Switch", index=1, device=0
  Control: name="ELD", index=0, device=7
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0b000094: OUT Detect HBR HDMI DP
  Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=02, enabled=1
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Devices: 0
  Connection: 0
  In-driver Connection: 3
     0x02 0x03 0x04
Node 0x07 [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
  Control: name="HDMI/DP,pcm=8 Jack", index=0, device=0
  Control: name="IEC958 Playback Con Mask", index=2, device=0
  Control: name="IEC958 Playback Pro Mask", index=2, device=0
  Control: name="IEC958 Playback Default", index=2, device=0
  Control: name="IEC958 Playback Switch", index=2, device=0
  Control: name="ELD", index=0, device=8
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0b000094: OUT Detect HBR HDMI DP
  Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=03, enabled=1
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Devices: 0
  Connection: 0
  In-driver Connection: 3
     0x02 0x03 0x04
Node 0x08 [Vendor Defined Widget] wcaps 0xf00000: Mono
Codec: Creative CA0132
Address: 0
AFG Function Id: 0x1 (unsol 1)
Vendor Id: 0x11020011
Subsystem Id: 0x10280685
Revision Id: 0x100918
No Modem Function Group found
Default PCM:
    rates [0x0]:
    bits [0x0]:
    formats [0x0]:
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
State of AFG node 0x01:
  Power states:  D0 D3 D3cold S3D3cold CLKSTOP EPSS
  Power: setting=D0, actual=D0
GPIO: io=0, o=0, i=0, unsolicited=1, wake=1
Node 0x02 [Audio Output] wcaps 0x49d: Stereo Amp-Out
  Device: name="CA0132 Analog", type="Audio", device=0
  Amp-Out caps: ofs=0x5a, nsteps=0x63, stepsize=0x03, mute=1
  Amp-Out vals:  [0x39 0x39]
  Converter: stream=8, channel=0
  PCM:
    rates [0x5e4]: 16000 44100 48000 88200 96000 192000
    bits [0x1f]: 8 16 20 24 32
    formats [0x1]: PCM
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x03 [Audio Output] wcaps 0x49d: Stereo Amp-Out
  Amp-Out caps: ofs=0x5a, nsteps=0x63, stepsize=0x03, mute=1
  Amp-Out vals:  [0x5a 0x5a]
  Converter: stream=0, channel=0
  PCM:
    rates [0x5e4]: 16000 44100 48000 88200 96000 192000
    bits [0x1f]: 8 16 20 24 32
    formats [0x1]: PCM
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x04 [Audio Output] wcaps 0x49d: Stereo Amp-Out
  Amp-Out caps: ofs=0x5a, nsteps=0x63, stepsize=0x03, mute=1
  Amp-Out vals:  [0x5a 0x5a]
  Converter: stream=0, channel=0
  PCM:
    rates [0x5e4]: 16000 44100 48000 88200 96000 192000
    bits [0x1f]: 8 16 20 24 32
    formats [0x1]: PCM
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x05 [Audio Output] wcaps 0x691: Stereo Digital
  Control: name="IEC958 Playback Con Mask", index=0, device=0
  Control: name="IEC958 Playback Pro Mask", index=0, device=0
  Control: name="IEC958 Playback Default", index=0, device=0
  Control: name="IEC958 Playback Switch", index=0, device=0
  Control: name="IEC958 Default PCM Playback Switch", index=0, device=0
  Device: name="CA0132 Digital", type="SPDIF", device=1
  Converter: stream=0, channel=0
  Digital:
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0x1e]: 16 20 24 32
    formats [0x5]: PCM AC3
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x06 [Audio Output] wcaps 0x691: Stereo Digital
  Converter: stream=0, channel=0
  Digital:
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0x1e]: 16 20 24 32
    formats [0x5]: PCM AC3
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x07 [Audio Input] wcaps 0x100591: Stereo
  Device: name="CA0132 Analog", type="Audio", device=0
  Converter: stream=0, channel=0
  SDI-Select: 0
  PCM:
    rates [0x1e4]: 16000 44100 48000 88200 96000
    bits [0x1f]: 8 16 20 24 32
    formats [0x1]: PCM
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x12
Node 0x08 [Audio Input] wcaps 0x10059b: Stereo Amp-In
  Control: name="Analog-Mic2 Capture Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Control: name="Analog-Mic2 Capture Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Device: name="CA0132 Analog Mic-In2", type="Audio", device=2
  Amp-In caps: ofs=0x5a, nsteps=0x63, stepsize=0x03, mute=1
  Amp-In vals:  [0x5a 0x5a]
  Converter: stream=0, channel=0
  SDI-Select: 0
  PCM:
    rates [0x1e4]: 16000 44100 48000 88200 96000
    bits [0x1f]: 8 16 20 24 32
    formats [0x1]: PCM
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x11
Node 0x09 [Audio Input] wcaps 0x100791: Stereo Digital
  Control: name="IEC958 Capture Switch", index=0, device=0
  Control: name="IEC958 Capture Default", index=0, device=0
  Device: name="CA0132 Digital", type="SPDIF", device=1
  Converter: stream=0, channel=0
  SDI-Select: 0
  Digital:
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x1f0]: 32000 44100 48000 88200 96000
    bits [0x1a]: 16 24 32
    formats [0x1]: PCM
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x0e
Node 0x0a [Audio Input] wcaps 0x10079b: Stereo Digital Amp-In
  Control: name="What U Hear Capture Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Control: name="What U Hear Capture Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Device: name="CA0132 What U Hear", type="Audio", device=4
  Amp-In caps: ofs=0x5a, nsteps=0x63, stepsize=0x03, mute=1
  Amp-In vals:  [0x5a 0x5a]
  Converter: stream=0, channel=0
  SDI-Select: 0
  Digital:
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x1ec]: 16000 22050 44100 48000 88200 96000
    bits [0x1b]: 8 16 24 32
    formats [0x1]: PCM
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x13
Node 0x0b [Pin Complex] wcaps 0x400581: Stereo
  Control: name="Speaker Phantom Jack", index=0, device=0
  Pincap 0x00010014: OUT EAPD Detect
  EAPD 0x2: EAPD
  Pin Default 0x01014010: [Jack] Line Out at Ext Rear
    Conn = 1/8, Color = Green
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x02
Node 0x0c [Pin Complex] wcaps 0x400701: Stereo Digital
  Pincap 0x00000010: OUT
  Pin Default 0x014580f0: [Jack] SPDIF Out at Ext Rear
    Conn = Optical, Color = Purple
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00:
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x05
Node 0x0d [Pin Complex] wcaps 0x400701: Stereo Digital
  Pincap 0x00000010: OUT
  Pin Default 0x014570f0: [Jack] SPDIF Out at Ext Rear
    Conn = Optical, Color = Yellow
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00:
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x06
Node 0x0e [Pin Complex] wcaps 0x400681: Stereo Digital
  Pincap 0x00000020: IN
  Pin Default 0x01c530f0: [Jack] SPDIF In at Ext Rear
    Conn = Optical, Color = Blue
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x0f [Pin Complex] wcaps 0x400581: Stereo
  Pincap 0x0000001c: OUT HP Detect
  Pin Default 0x0221401f: [Jack] HP Out at Ext Front
    Conn = 1/8, Color = Green
    DefAssociation = 0x1, Sequence = 0xf
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x02
Node 0x10 [Pin Complex] wcaps 0x400581: Stereo
  Pincap 0x0000001c: OUT HP Detect
  Pin Default 0x02216011: [Jack] HP Out at Ext Front
    Conn = 1/8, Color = Orange
    DefAssociation = 0x1, Sequence = 0x1
  Pin-ctls: 0x00:
  Unsolicited: tag=01, enabled=1
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x03
Node 0x11 [Pin Complex] wcaps 0x40058b: Stereo Amp-In
  Control: name="Line Jack", index=0, device=0
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00000134: IN OUT Detect
    Vref caps: HIZ
  Pin Default 0x02012014: [Jack] Line Out at Ext Front
    Conn = 1/8, Color = Grey
    DefAssociation = 0x1, Sequence = 0x4
  Pin-ctls: 0x20: IN VREF_HIZ
  Unsolicited: tag=04, enabled=1
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x04
Node 0x12 [Pin Complex] wcaps 0x400481: Stereo
  Control: name="Mic1-Boost (30dB) Capture Switch", index=0, device=0
    ControlAmp: chs=1, dir=In, idx=0, ofs=0
  Control: name="Mic Phantom Jack", index=0, device=0
  Pincap 0x00003724: IN Detect
    Vref caps: HIZ 50 GRD 80 100
  Pin Default 0x37a791f0: [Jack] Mic at Oth Mobile-In
    Conn = Analog, Color = Pink
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x24: IN VREF_80
  Unsolicited: tag=02, enabled=1
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x13 [Pin Complex] wcaps 0x400681: Stereo Digital
  Pincap 0x00000020: IN
  Pin Default 0x908700f0: [Fixed] Line In at Int N/A
    Conn = Analog, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x20: IN
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x14 [Beep Generator Widget] wcaps 0x70040c: Mono Amp-Out
  Amp-Out caps: ofs=0x1f, nsteps=0x1f, stepsize=0x05, mute=1
  Amp-Out vals:  [0x1c]
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x15 [Vendor Defined Widget] wcaps 0xf00600: Mono Digital
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x16 [Vendor Defined Widget] wcaps 0xf00680: Mono Digital
  Unsolicited: tag=03, enabled=1
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x17 [Audio Output] wcaps 0x49d: Stereo Amp-Out
  Amp-Out caps: ofs=0x5a, nsteps=0x63, stepsize=0x03, mute=1
  Amp-Out vals:  [0x5a 0x5a]
  Converter: stream=0, channel=0
  PCM:
    rates [0x5ec]: 16000 22050 44100 48000 88200 96000 192000
    bits [0x1f]: 8 16 20 24 32
    formats [0x1]: PCM
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x18 [Pin Complex] wcaps 0x400581: Stereo
  Pincap 0x00000010: OUT
  Pin Default 0x500000f0: [N/A] Line Out at Int N/A
    Conn = Unknown, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x17
--endcollapse--


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

crw-rw----+ 1 root audio 116, 10 Apr 27 19:43 /dev/snd/controlC0
crw-rw----+ 1 root audio 116,  2 Apr 27 19:43 /dev/snd/controlC1
crw-rw----+ 1 root audio 116, 14 Apr 27 19:43 /dev/snd/hwC0D0
crw-rw----+ 1 root audio 116,  9 Apr 27 19:43 /dev/snd/hwC1D0
crw-rw----+ 1 root audio 116, 11 Apr 27 19:49 /dev/snd/pcmC0D3p
crw-rw----+ 1 root audio 116, 12 Apr 27 19:43 /dev/snd/pcmC0D7p
crw-rw----+ 1 root audio 116, 13 Apr 27 19:43 /dev/snd/pcmC0D8p
crw-rw----+ 1 root audio 116,  4 Apr 27 19:44 /dev/snd/pcmC1D0c
crw-rw----+ 1 root audio 116,  3 Apr 27 19:49 /dev/snd/pcmC1D0p
crw-rw----+ 1 root audio 116,  8 Apr 27 19:43 /dev/snd/pcmC1D1c
crw-rw----+ 1 root audio 116,  7 Apr 27 19:43 /dev/snd/pcmC1D1p
crw-rw----+ 1 root audio 116,  5 Apr 27 19:43 /dev/snd/pcmC1D2c
crw-rw----+ 1 root audio 116,  6 Apr 27 19:43 /dev/snd/pcmC1D4c
crw-rw----+ 1 root audio 116,  1 Apr 27 19:43 /dev/snd/seq
crw-rw----+ 1 root audio 116, 33 Apr 27 19:43 /dev/snd/timer

/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root  80 Apr 27 19:51 .
drwxr-xr-x 3 root root 360 Apr 27 19:51 ..
lrwxrwxrwx 1 root root  12 Apr 27 19:43 pci-0000:00:03.0 -> ../controlC0
lrwxrwxrwx 1 root root  12 Apr 27 19:43 pci-0000:00:1b.0 -> ../controlC1


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

APLAY

**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA Intel HDMI], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 0: CA0132 Analog [CA0132 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 1: CA0132 Digital [CA0132 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

ARECORD

**** List of CAPTURE Hardware Devices ****
card 1: PCH [HDA Intel PCH], device 0: CA0132 Analog [CA0132 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 1: CA0132 Digital [CA0132 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 2: CA0132 Analog Mic-In2 [CA0132 Analog Mic-In2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 4: CA0132 What U Hear [CA0132 What U Hear]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

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

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

Card hw:0 'HDMI'/'HDA Intel HDMI at 0xf751c000 irq 42'
  Mixer name	: 'Intel Haswell HDMI'
  Components	: 'HDA:80862807,80860101,00100000'
  Controls      : 21
  Simple ctrls  : 3
Simple mixer control 'IEC958',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'IEC958',1
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'IEC958',2
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]

!!-------Mixer controls for card 1 [PCH]

Card hw:1 'PCH'/'HDA Intel PCH at 0xf7518000 irq 41'
  Mixer name	: 'Creative CA0132'
  Components	: 'HDA:11020011,10280685,00100918'
  Controls      : 43
  Simple ctrls  : 25
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 99
  Mono:
  Front Left: Playback 57 [58%] [-33.00dB] [on]
  Front Right: Playback 57 [58%] [-33.00dB] [on]
Simple mixer control 'PCM',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 255 [100%] [0.00dB]
  Front Right: Playback 255 [100%] [0.00dB]
Simple mixer control 'Surround',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Mic SVM',0
  Capabilities: cswitch cswitch-joined
  Capture channels: Mono
  Mono: Capture [on]
Simple mixer control 'Mic1-Boost (30dB)',0
  Capabilities: cswitch cswitch-joined
  Capture channels: Mono
  Mono: Capture [off]
Simple mixer control 'IEC958',0
  Capabilities: pswitch pswitch-joined cswitch cswitch-joined
  Playback channels: Mono
  Capture channels: Mono
  Mono: Playback [off] Capture [off]
Simple mixer control 'IEC958 Default PCM',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 99
  Front Left: Capture 90 [91%] [0.00dB] [off]
  Front Right: Capture 90 [91%] [0.00dB] [off]
Simple mixer control 'AMic1/DMic',0
  Capabilities: cswitch cswitch-joined
  Capture channels: Mono
  Mono: Capture [off]
Simple mixer control 'AMic1/DMic Auto Detect',0
  Capabilities: cswitch cswitch-joined
  Capture channels: Mono
  Mono: Capture [off]
Simple mixer control 'Analog-Mic2',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 99
  Front Left: Capture 90 [91%] [0.00dB] [on]
  Front Right: Capture 90 [91%] [0.00dB] [on]
Simple mixer control 'CrystalVoice',0
  Capabilities: cswitch cswitch-joined
  Capture channels: Mono
  Mono: Capture [off]
Simple mixer control 'Crystalizer',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Dialog Plus',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Echo Cancellation',0
  Capabilities: cswitch cswitch-joined
  Capture channels: Mono
  Mono: Capture [off]
Simple mixer control 'Equalizer',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'HP/Speaker',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'HP/Speaker Auto Detect',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Noise Reduction',0
  Capabilities: cswitch cswitch-joined
  Capture channels: Mono
  Mono: Capture [on]
Simple mixer control 'PlayEnhancement',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Smart Volume',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Voice Focus',0
  Capabilities: cswitch cswitch-joined
  Capture channels: Mono
  Mono: Capture [on]
Simple mixer control 'VoiceFX',0
  Capabilities: cenum
  Items: 'Neutral' 'Female2Male' 'Male2Female' 'ScrappyKid' 'Elderly' 'Orc' 'Elf' 'Dwarf' 'AlienBrute' 'Robot' 'Marine' 'Emo' 'DeepVoice' 'Munchkin'
  Item0: 'Neutral'
Simple mixer control 'What U Hear',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 99
  Front Left: Capture 90 [91%] [0.00dB] [on]
  Front Right: Capture 90 [91%] [0.00dB] [on]
Simple mixer control 'X-Bass',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]


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

--startcollapse--
state.HDMI {
	control.1 {
		iface CARD
		name 'HDMI/DP,pcm=3 Jack'
		value false
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}
	control.2 {
		iface MIXER
		name 'IEC958 Playback Con Mask'
		value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.3 {
		iface MIXER
		name 'IEC958 Playback Pro Mask'
		value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.4 {
		iface MIXER
		name 'IEC958 Playback Default'
		value '0482000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access 'read write'
			type IEC958
			count 1
		}
	}
	control.5 {
		iface MIXER
		name 'IEC958 Playback Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.6 {
		iface PCM
		device 3
		name ELD
		value ''
		comment {
			access 'read volatile'
			type BYTES
			count 0
		}
	}
	control.7 {
		iface CARD
		name 'HDMI/DP,pcm=7 Jack'
		value false
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}
	control.8 {
		iface MIXER
		name 'IEC958 Playback Con Mask'
		index 1
		value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.9 {
		iface MIXER
		name 'IEC958 Playback Pro Mask'
		index 1
		value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.10 {
		iface MIXER
		name 'IEC958 Playback Default'
		index 1
		value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access 'read write'
			type IEC958
			count 1
		}
	}
	control.11 {
		iface MIXER
		name 'IEC958 Playback Switch'
		index 1
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.12 {
		iface PCM
		device 7
		name ELD
		value ''
		comment {
			access 'read volatile'
			type BYTES
			count 0
		}
	}
	control.13 {
		iface CARD
		name 'HDMI/DP,pcm=8 Jack'
		value false
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}
	control.14 {
		iface MIXER
		name 'IEC958 Playback Con Mask'
		index 2
		value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.15 {
		iface MIXER
		name 'IEC958 Playback Pro Mask'
		index 2
		value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.16 {
		iface MIXER
		name 'IEC958 Playback Default'
		index 2
		value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access 'read write'
			type IEC958
			count 1
		}
	}
	control.17 {
		iface MIXER
		name 'IEC958 Playback Switch'
		index 2
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.18 {
		iface PCM
		device 8
		name ELD
		value ''
		comment {
			access 'read volatile'
			type BYTES
			count 0
		}
	}
	control.19 {
		iface PCM
		device 3
		name 'Playback Channel Map'
		value.0 0
		value.1 0
		value.2 0
		value.3 0
		value.4 0
		value.5 0
		value.6 0
		value.7 0
		comment {
			access 'read write'
			type INTEGER
			count 8
			range '0 - 36'
		}
	}
	control.20 {
		iface PCM
		device 7
		name 'Playback Channel Map'
		value.0 0
		value.1 0
		value.2 0
		value.3 0
		value.4 0
		value.5 0
		value.6 0
		value.7 0
		comment {
			access 'read write'
			type INTEGER
			count 8
			range '0 - 36'
		}
	}
	control.21 {
		iface PCM
		device 8
		name 'Playback Channel Map'
		value.0 0
		value.1 0
		value.2 0
		value.3 0
		value.4 0
		value.5 0
		value.6 0
		value.7 0
		comment {
			access 'read write'
			type INTEGER
			count 8
			range '0 - 36'
		}
	}
}
state.PCH {
	control.1 {
		iface MIXER
		name 'Master Playback Volume'
		value.0 57
		value.1 57
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 99'
			dbmin -9000
			dbmax 900
			dbvalue.0 -3300
			dbvalue.1 -3300
		}
	}
	control.2 {
		iface MIXER
		name 'Master Playback Switch'
		value.0 true
		value.1 true
		comment {
			access 'read write'
			type BOOLEAN
			count 2
		}
	}
	control.3 {
		iface MIXER
		name 'Capture Volume'
		value.0 90
		value.1 90
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 99'
			dbmin -9000
			dbmax 900
			dbvalue.0 0
			dbvalue.1 0
		}
	}
	control.4 {
		iface MIXER
		name 'Capture Switch'
		value.0 false
		value.1 false
		comment {
			access 'read write'
			type BOOLEAN
			count 2
		}
	}
	control.5 {
		iface MIXER
		name 'Analog-Mic2 Capture Volume'
		value.0 90
		value.1 90
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 99'
			dbmin -9000
			dbmax 900
			dbvalue.0 0
			dbvalue.1 0
		}
	}
	control.6 {
		iface MIXER
		name 'Analog-Mic2 Capture Switch'
		value.0 true
		value.1 true
		comment {
			access 'read write'
			type BOOLEAN
			count 2
		}
	}
	control.7 {
		iface MIXER
		name 'What U Hear Capture Volume'
		value.0 90
		value.1 90
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 99'
			dbmin -9000
			dbmax 900
			dbvalue.0 0
			dbvalue.1 0
		}
	}
	control.8 {
		iface MIXER
		name 'What U Hear Capture Switch'
		value.0 true
		value.1 true
		comment {
			access 'read write'
			type BOOLEAN
			count 2
		}
	}
	control.9 {
		iface MIXER
		name 'Mic1-Boost (30dB) Capture Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.10 {
		iface MIXER
		name 'HP/Speaker Playback Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.11 {
		iface MIXER
		name 'AMic1/DMic Capture Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.12 {
		iface MIXER
		name 'HP/Speaker Auto Detect Playback Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.13 {
		iface MIXER
		name 'AMic1/DMic Auto Detect Capture Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.14 {
		iface MIXER
		name 'Surround Playback Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.15 {
		iface MIXER
		name 'Crystalizer Playback Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.16 {
		iface MIXER
		name 'Dialog Plus Playback Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.17 {
		iface MIXER
		name 'Smart Volume Playback Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.18 {
		iface MIXER
		name 'X-Bass Playback Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.19 {
		iface MIXER
		name 'Equalizer Playback Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.20 {
		iface MIXER
		name 'Echo Cancellation Capture Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.21 {
		iface MIXER
		name 'Voice Focus Capture Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.22 {
		iface MIXER
		name 'Mic SVM Capture Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.23 {
		iface MIXER
		name 'Noise Reduction Capture Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.24 {
		iface MIXER
		name 'PlayEnhancement Playback Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.25 {
		iface MIXER
		name 'CrystalVoice Capture Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.26 {
		iface MIXER
		name 'VoiceFX Capture Switch'
		value Neutral
		comment {
			access 'read write'
			type ENUMERATED
			count 1
			item.0 Neutral
			item.1 Female2Male
			item.2 Male2Female
			item.3 ScrappyKid
			item.4 Elderly
			item.5 Orc
			item.6 Elf
			item.7 Dwarf
			item.8 AlienBrute
			item.9 Robot
			item.10 Marine
			item.11 Emo
			item.12 DeepVoice
			item.13 Munchkin
		}
	}
	control.27 {
		iface CARD
		name 'Mic Phantom Jack'
		value true
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}
	control.28 {
		iface CARD
		name 'Line Jack'
		value false
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}
	control.29 {
		iface CARD
		name 'Speaker Phantom Jack'
		value true
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}
	control.30 {
		iface MIXER
		name 'IEC958 Playback Con Mask'
		value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.31 {
		iface MIXER
		name 'IEC958 Playback Pro Mask'
		value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.32 {
		iface MIXER
		name 'IEC958 Playback Default'
		value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access 'read write'
			type IEC958
			count 1
		}
	}
	control.33 {
		iface MIXER
		name 'IEC958 Playback Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.34 {
		iface MIXER
		name 'IEC958 Default PCM Playback Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.35 {
		iface MIXER
		name 'IEC958 Capture Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.36 {
		iface MIXER
		name 'IEC958 Capture Default'
		value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.37 {
		iface PCM
		name 'Playback Channel Map'
		value.0 3
		value.1 4
		comment {
			access read
			type INTEGER
			count 2
			range '0 - 36'
		}
	}
	control.38 {
		iface PCM
		name 'Capture Channel Map'
		value.0 0
		value.1 0
		comment {
			access read
			type INTEGER
			count 2
			range '0 - 36'
		}
	}
	control.39 {
		iface PCM
		device 2
		name 'Capture Channel Map'
		value.0 0
		value.1 0
		comment {
			access read
			type INTEGER
			count 2
			range '0 - 36'
		}
	}
	control.40 {
		iface PCM
		device 4
		name 'Capture Channel Map'
		value.0 0
		value.1 0
		comment {
			access read
			type INTEGER
			count 2
			range '0 - 36'
		}
	}
	control.41 {
		iface PCM
		device 1
		name 'Playback Channel Map'
		value.0 0
		value.1 0
		comment {
			access read
			type INTEGER
			count 2
			range '0 - 36'
		}
	}
	control.42 {
		iface PCM
		device 1
		name 'Capture Channel Map'
		value.0 0
		value.1 0
		comment {
			access read
			type INTEGER
			count 2
			range '0 - 36'
		}
	}
	control.43 {
		iface MIXER
		name 'PCM Playback Volume'
		value.0 255
		value.1 255
		comment {
			access 'read write user'
			type INTEGER
			count 2
			range '0 - 255'
			tlv '0000000100000008ffffec1400000014'
			dbmin -5100
			dbmax 0
			dbvalue.0 0
			dbvalue.1 0
		}
	}
}
--endcollapse--


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

Module
bbswitch
joydev
snd_usb_audio
snd_usbmidi_lib
snd_rawmidi
ath3k
btusb
bluetooth
uvcvideo
videobuf2_vmalloc
videobuf2_memops
videobuf2_core
hid_generic
snd_hda_codec_ca0132
snd_hda_codec_hdmi
iTCO_wdt
iTCO_vendor_support
rtsx_pci_sdmmc
rtsx_pci_ms
mmc_core
memstick
x86_pkg_temp_thermal
intel_powerclamp
kvm_intel
dell_wmi
sparse_keymap
kvm
crct10dif_pclmul
crc32_pclmul
crc32c_intel
ghash_clmulni_intel
aesni_intel
aes_x86_64
glue_helper
lrw
ablk_helper
snd_soc_rt5640
cryptd
snd_hda_intel
ath10k_pci
regmap_i2c
snd_hda_controller
snd_soc_rl6231
microcode
alx
snd_hda_codec
ath10k_core
snd_soc_core
psmouse
mdio
serio_raw
rtsx_pci
snd_compress
snd_hwdep
efivars
lpc_ich
ehci_pci
snd_pcm
int3403_thermal
int3402_thermal
ath
ehci_hcd
mfd_core
wmi
int340x_thermal_zone
i2c_designware_platform
spi_pxa2xx_platform
shpchp
i2c_designware_core
acpi_pad
evdev
int3400_thermal
acpi_thermal_rel
vboxnetflt
vboxnetadp
vboxdrv
snd_seq_oss
snd_seq_midi_event
snd_seq
snd_seq_device
snd_timer
snd
uinput
ftdi_sio
usbserial
coretemp
tun
efivarfs


!!Sysfs Files
!!-----------

/sys/class/sound/hwC0D0/init_pin_configs:
0x05 0x18560010
0x06 0x18560010
0x07 0x18560010

/sys/class/sound/hwC0D0/driver_pin_configs:

/sys/class/sound/hwC0D0/user_pin_configs:

/sys/class/sound/hwC0D0/init_verbs:

/sys/class/sound/hwC0D0/hints:

/sys/class/sound/hwC1D0/init_pin_configs:
0x0b 0x901701f0
0x0c 0x434510f0
0x0d 0x414510f0
0x0e 0x50c600f0
0x0f 0x432110f0
0x10 0x432110f0
0x11 0x038110f0
0x12 0xb7a601f0
0x13 0x50d000f0
0x18 0x500000f0

/sys/class/sound/hwC1D0/driver_pin_configs:

/sys/class/sound/hwC1D0/user_pin_configs:

/sys/class/sound/hwC1D0/init_verbs:

/sys/class/sound/hwC1D0/hints:


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

[    2.382711] hub 4-0:1.0: 2 ports detected
[    2.384378] snd_hda_intel 0000:00:03.0: enabling device (0000 -> 0002)
[    2.384591] snd_hda_intel 0000:00:03.0: bound 0000:00:02.0 (ops 0xffffffff81872ac0)
[    2.392654] snd_hda_intel 0000:00:1b.0: enabling device (0000 -> 0002)
[    2.395829] iTCO_vendor_support: vendor-support=0
--
[    2.408150] iTCO_wdt: initialized. heartbeat=30 sec (nowayout=0)
[    2.416384] sound hdaudioC1D0: autoconfig for CA0132: line_outs=1 (0xb/0x0/0x0/0x0/0x0) type:speaker
[    2.416387] sound hdaudioC1D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    2.416388] sound hdaudioC1D0:    hp_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    2.416389] sound hdaudioC1D0:    mono: mono_out=0x0
[    2.416390] sound hdaudioC1D0:    inputs:
[    2.416391] sound hdaudioC1D0:      Mic=0x12
[    2.416392] sound hdaudioC1D0:      Line=0x11
[    2.449249] hid-generic 0003:187C:0528.0001: hiddev0,hidraw0: USB HID v1.01 Device [Alienware AW1517] on usb-0000:00:14.0-4/input0
--
[    3.230416] usb 1-2.2.3.3: new low-speed USB device number 11 using xhci_hcd
[    3.259240] input: HDA Intel PCH Line as /devices/pci0000:00/0000:00:1b.0/sound/card1/input12
[    3.319711] usb 1-2.2.3.3: ep 0x81 - rounding interval to 128 microframes, ep desc says 192 microframes
--
[    3.384431] input: Gaming Keyboard G110 as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2/1-2.2.3/1-2.2.3.3/1-2.2.3.3:1.1/0003:046D:C22A.0005/input/input14
[    3.413847] input: HDA Intel HDMI HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.0/sound/card0/input15
[    3.418785] ath10k_pci 0000:03:00.0: qca6174 hw2.1 (0x05010000, 0x003405ff, 168c:003e:1a56:1525 fallback) fw killer-n1525-fw api 4 htt 3.0 wmi 4 cal otp max_sta 32
[    3.418788] ath10k_pci 0000:03:00.0: debug 1 debugfs 0 tracing 0 dfs 0 testmode 0
[    3.437485] input: HDA Intel HDMI HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.0/sound/card0/input16
[    3.437680] hid-generic 0003:046D:C22A.0005: input,hiddev0,hidraw4: USB HID v1.10 Device [Gaming Keyboard G110] on usb-0000:00:14.0-2.2.3.3/input1
[    3.437773] input: HDA Intel HDMI HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.0/sound/card0/input17
[    3.454972] EXT4-fs (sda3): mounted filesystem with writeback data mode. Opts: data=writeback
--
[    3.715256] hid-generic 0003:06A3:0CD5.0006: input,hidraw5: USB HID v1.11 Mouse [Saitek Cyborg R.A.T.5 Mouse] on usb-0000:00:14.0-2.2.3.4/input0
[    3.744363] usbcore: registered new interface driver snd-usb-audio
[    3.785101] input: SynPS/2 Synaptics TouchPad as /devices/platform/i8042/serio1/input/input7



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



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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-04-27 18:08   ` Gabriele Martino
@ 2015-04-27 18:51     ` Takashi Iwai
  2015-04-27 22:17       ` Gabriele Martino
  0 siblings, 1 reply; 21+ messages in thread
From: Takashi Iwai @ 2015-04-27 18:51 UTC (permalink / raw)
  To: Gabriele Martino; +Cc: alsa-devel

At Mon, 27 Apr 2015 20:08:52 +0200,
Gabriele Martino wrote:
> 
> On 27/04/2015 11:09, Takashi Iwai wrote:
> > In general, we check either PCI or codec SSID to identify the model
> > and applies the quirk accordingly.  Does your board have also a unique
> > SSID?
> Good question. How do I find it? I can't see any in alsa-info.
> 
> !!Advanced information - PCI Vendor/Device/Subsystem ID's
> !!-------------------------------------------------------
> 
> 00:03.0 0403: 8086:0c0c (rev 06)
> 	Subsystem: 1028:0685
> --
> 00:1b.0 0403: 8086:8c20 (rev 05)
> 	Subsystem: 1028:0685

PCI SSID is 1028:0685.

> Codec: Creative CA0132
> Address: 0
> AFG Function Id: 0x1 (unsol 1)
> Vendor Id: 0x11020011
> Subsystem Id: 0x10280685

Codec SSID is also 1028:0685.


Takashi

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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-04-27 18:51     ` Takashi Iwai
@ 2015-04-27 22:17       ` Gabriele Martino
  2015-04-28  6:15         ` Takashi Iwai
  0 siblings, 1 reply; 21+ messages in thread
From: Gabriele Martino @ 2015-04-27 22:17 UTC (permalink / raw)
  To: alsa-devel

On 27/04/2015 20:51, Takashi Iwai wrote:
> At Mon, 27 Apr 2015 20:08:52 +0200,
> Gabriele Martino wrote:
>> !!Advanced information - PCI Vendor/Device/Subsystem ID's
>> !!-------------------------------------------------------
>>
>> 00:03.0 0403: 8086:0c0c (rev 06)
>> 	Subsystem: 1028:0685
>> --
>> 00:1b.0 0403: 8086:8c20 (rev 05)
>> 	Subsystem: 1028:0685
> PCI SSID is 1028:0685.
>
>> Codec: Creative CA0132
>> Address: 0
>> AFG Function Id: 0x1 (unsol 1)
>> Vendor Id: 0x11020011
>> Subsystem Id: 0x10280685
> Codec SSID is also 1028:0685.
I couldn't find any occurrence of SND_PCI_QUIRK() to mess up with in
patch_ca0132.c.
I gave a look at patch_realtek.c and got something like:

enum {
    CA0132_FIXUP_CORE3D_EX
}

static const struct hda_fixup ca0132_fixups[] = {
    [CA0132_FIXUP_CORE3D_EX] = {
        .type = HDA_FIXUP_PINS,
        .v.pins = (const struct hda_pintbl[]) {
            { 0x0f, 0x032110f0 }, /* headphones */
            { }
        }
    },
    {}
}

static const struct snd_pci_quirk alc861_fixup_tbl[] = {
    SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15", CA0132_FIXUP_CORE3D_EX),
    {}
};

But I don't know how to load this on ca0132.
It there any simple documentation about quirks? I fear this is beyond my
capabilities.

Regards,
Gabriele

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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-04-27 22:17       ` Gabriele Martino
@ 2015-04-28  6:15         ` Takashi Iwai
  2015-04-28 22:47           ` Gabriele Martino
  0 siblings, 1 reply; 21+ messages in thread
From: Takashi Iwai @ 2015-04-28  6:15 UTC (permalink / raw)
  To: Gabriele Martino; +Cc: alsa-devel

At Tue, 28 Apr 2015 00:17:01 +0200,
Gabriele Martino wrote:
> 
> On 27/04/2015 20:51, Takashi Iwai wrote:
> > At Mon, 27 Apr 2015 20:08:52 +0200,
> > Gabriele Martino wrote:
> >> !!Advanced information - PCI Vendor/Device/Subsystem ID's
> >> !!-------------------------------------------------------
> >>
> >> 00:03.0 0403: 8086:0c0c (rev 06)
> >> 	Subsystem: 1028:0685
> >> --
> >> 00:1b.0 0403: 8086:8c20 (rev 05)
> >> 	Subsystem: 1028:0685
> > PCI SSID is 1028:0685.
> >
> >> Codec: Creative CA0132
> >> Address: 0
> >> AFG Function Id: 0x1 (unsol 1)
> >> Vendor Id: 0x11020011
> >> Subsystem Id: 0x10280685
> > Codec SSID is also 1028:0685.
> I couldn't find any occurrence of SND_PCI_QUIRK() to mess up with in
> patch_ca0132.c.
> I gave a look at patch_realtek.c and got something like:
> 
> enum {
>     CA0132_FIXUP_CORE3D_EX
> }
> 
> static const struct hda_fixup ca0132_fixups[] = {
>     [CA0132_FIXUP_CORE3D_EX] = {
>         .type = HDA_FIXUP_PINS,
>         .v.pins = (const struct hda_pintbl[]) {
>             { 0x0f, 0x032110f0 }, /* headphones */
>             { }
>         }
>     },
>     {}
> }
> 
> static const struct snd_pci_quirk alc861_fixup_tbl[] = {
>     SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15", CA0132_FIXUP_CORE3D_EX),
>     {}
> };
> 
> But I don't know how to load this on ca0132.
> It there any simple documentation about quirks? I fear this is beyond my
> capabilities.

snd_pci_quirk_lookup() just returns a value matching in the given
table.  Provide a table like:

enum {
	QUIRK_NONE,
	QUIRK_ALIENWARE,
};

static const struct snd_pci_quirk ca0132_quirks[] = {
	SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15", QUIRK_ALIENWARE),
	{}
};

then somewhere in the probe, check the table

	spec->quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks);

then refer it appropriately

	if (spec->quirk == QUIRK_ALIENWARE) {
		spec->out_pins[1] = 0x0f;
		....
	} else {
		spec->out_pins[1] = 0x10;
		....
	}

The current ca0132 code has way too may fixed assignment, so the pin
reassignment like other codec drivers doesn't work as is.  We'd need
to sort it out first.  So, start from the simple workaround.


Takashi

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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-04-28  6:15         ` Takashi Iwai
@ 2015-04-28 22:47           ` Gabriele Martino
  2015-04-29 13:38             ` Takashi Iwai
  2015-04-29 13:40             ` Takashi Iwai
  0 siblings, 2 replies; 21+ messages in thread
From: Gabriele Martino @ 2015-04-28 22:47 UTC (permalink / raw)
  To: alsa-devel

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

On 28/04/2015 08:15, Takashi Iwai wrote:
> snd_pci_quirk_lookup() just returns a value matching in the given
> table.  Provide a table like:
>
> enum {
> 	QUIRK_NONE,
> 	QUIRK_ALIENWARE,
> };
>
> static const struct snd_pci_quirk ca0132_quirks[] = {
> 	SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15", QUIRK_ALIENWARE),
> 	{}
> };
>
> then somewhere in the probe, check the table
>
> 	spec->quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks);
>
> then refer it appropriately
>
> 	if (spec->quirk == QUIRK_ALIENWARE) {
> 		spec->out_pins[1] = 0x0f;
> 		....
> 	} else {
> 		spec->out_pins[1] = 0x10;
> 		....
> 	}
>
> The current ca0132 code has way too may fixed assignment, so the pin
> reassignment like other codec drivers doesn't work as is.  We'd need
> to sort it out first.  So, start from the simple workaround.
Thank you for your explanation.
I managed to fix the pin address, but as I told before the jack
detection is totally messed up.
"hdajacksensetest" fails with:
Ioctl call failed with error 16

I can't understand why, as ca0132_select_out() already relies on
spec->out_pins[0] and spec->out_pins[1].

Regards,
Gabriele


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ca0132-alienware.patch --]
[-- Type: text/x-patch; name="ca0132-alienware.patch", Size: 1185 bytes --]

diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 4a4e7b2..c9b0211 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -748,10 +748,24 @@
 
 	struct hda_codec *codec;
 	struct delayed_work unsol_hp_work;
+	const struct snd_pci_quirk *quirk;
 
 #ifdef ENABLE_TUNING_CONTROLS
 	long cur_ctl_vals[TUNING_CTLS_COUNT];
 #endif
+};
+
+/*
+ * CA0132 quirks table
+ */
+enum {
+	QUIRK_NONE,
+	QUIRK_ALIENWARE,
+};
+
+static const struct snd_pci_quirk ca0132_quirks[] = {
+	SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15", QUIRK_ALIENWARE),
+	{}
 };
 
 /*
@@ -4653,6 +4667,7 @@
 		return -ENOMEM;
 	codec->spec = spec;
 	spec->codec = codec;
+	spec->quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks);
 
 	spec->dsp_state = DSP_DOWNLOAD_INIT;
 	spec->num_mixers = 1;
@@ -4670,6 +4685,12 @@
 
 	ca0132_config(codec);
 
+	/* Apply detected quirks */
+	if (spec->quirk->value == QUIRK_ALIENWARE) {
+		codec_dbg(codec, "QUIRK_ALIENWARE applied.\n\n");
+		spec->out_pins[1] = 0x0f;
+	}
+
 	err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL);
 	if (err < 0)
 		return err;

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



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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-04-28 22:47           ` Gabriele Martino
@ 2015-04-29 13:38             ` Takashi Iwai
  2015-04-29 15:42               ` Gabriele Martino
  2015-04-29 13:40             ` Takashi Iwai
  1 sibling, 1 reply; 21+ messages in thread
From: Takashi Iwai @ 2015-04-29 13:38 UTC (permalink / raw)
  To: Gabriele Martino; +Cc: alsa-devel

At Wed, 29 Apr 2015 00:47:16 +0200,
Gabriele Martino wrote:
> 
> On 28/04/2015 08:15, Takashi Iwai wrote:
> > snd_pci_quirk_lookup() just returns a value matching in the given
> > table.  Provide a table like:
> >
> > enum {
> > 	QUIRK_NONE,
> > 	QUIRK_ALIENWARE,
> > };
> >
> > static const struct snd_pci_quirk ca0132_quirks[] = {
> > 	SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15", QUIRK_ALIENWARE),
> > 	{}
> > };
> >
> > then somewhere in the probe, check the table
> >
> > 	spec->quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks);
> >
> > then refer it appropriately
> >
> > 	if (spec->quirk == QUIRK_ALIENWARE) {
> > 		spec->out_pins[1] = 0x0f;
> > 		....
> > 	} else {
> > 		spec->out_pins[1] = 0x10;
> > 		....
> > 	}
> >
> > The current ca0132 code has way too may fixed assignment, so the pin
> > reassignment like other codec drivers doesn't work as is.  We'd need
> > to sort it out first.  So, start from the simple workaround.
> Thank you for your explanation.
> I managed to fix the pin address, but as I told before the jack
> detection is totally messed up.
> "hdajacksensetest" fails with:
> Ioctl call failed with error 16

The error message looks irrelevant with the patch itself.
Did you build with proper kernel configs?
CONFIG_SND_HDA_HWDEP=y
CONFIG_SND_HDA_RECONFIG=y
CONFIG_SND_HDA_PATCH_LOADER=y


Takashi

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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-04-28 22:47           ` Gabriele Martino
  2015-04-29 13:38             ` Takashi Iwai
@ 2015-04-29 13:40             ` Takashi Iwai
  1 sibling, 0 replies; 21+ messages in thread
From: Takashi Iwai @ 2015-04-29 13:40 UTC (permalink / raw)
  To: Gabriele Martino; +Cc: alsa-devel

At Wed, 29 Apr 2015 00:47:16 +0200,
Gabriele Martino wrote:
> 
> @@ -4653,6 +4667,7 @@
>  		return -ENOMEM;
>  	codec->spec = spec;
>  	spec->codec = codec;
> +	spec->quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks);
>  
>  	spec->dsp_state = DSP_DOWNLOAD_INIT;
>  	spec->num_mixers = 1;
> @@ -4670,6 +4685,12 @@
>  
>  	ca0132_config(codec);
>  
> +	/* Apply detected quirks */
> +	if (spec->quirk->value == QUIRK_ALIENWARE) {

Add a NULL check.  Or, rather just record only quirk->value as
spec->quirk.

	quirk = snd_pci_quirk_lookup(pci, quirks);
	if (quirk)
		spec->quirk = quirk->value;

	....

	if (spec->quirk == QUIRK_ALIENWARE)
		....


Takashi

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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-04-29 13:38             ` Takashi Iwai
@ 2015-04-29 15:42               ` Gabriele Martino
  2015-04-29 18:42                 ` Takashi Iwai
  0 siblings, 1 reply; 21+ messages in thread
From: Gabriele Martino @ 2015-04-29 15:42 UTC (permalink / raw)
  To: alsa-devel

On 29/04/2015 15:38, Takashi Iwai wrote:
> At Wed, 29 Apr 2015 00:47:16 +0200,
> Gabriele Martino wrote:
>> Thank you for your explanation.
>> I managed to fix the pin address, but as I told before the jack
>> detection is totally messed up.
>> "hdajacksensetest" fails with:
>> Ioctl call failed with error 16
> The error message looks irrelevant with the patch itself.
> Did you build with proper kernel configs?
> CONFIG_SND_HDA_HWDEP=y
> CONFIG_SND_HDA_RECONFIG=y
> CONFIG_SND_HDA_PATCH_LOADER=y
It should be ok:

$ grep CONFIG_SND_HDA_ /usr/src/linux/.config | grep -v '^#'
CONFIG_SND_HDA_INTEL=m
CONFIG_SND_HDA_DSP_LOADER=y
CONFIG_SND_HDA_PREALLOC_SIZE=2048
CONFIG_SND_HDA_HWDEP=y
CONFIG_SND_HDA_RECONFIG=y
CONFIG_SND_HDA_INPUT_JACK=y
CONFIG_SND_HDA_PATCH_LOADER=y
CONFIG_SND_HDA_CODEC_HDMI=m
CONFIG_SND_HDA_I915=y
CONFIG_SND_HDA_CODEC_CA0132=m
CONFIG_SND_HDA_CODEC_CA0132_DSP=y
CONFIG_SND_HDA_GENERIC=m
CONFIG_SND_HDA_POWER_SAVE_DEFAULT=60

Regards,
Gabriele

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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-04-29 15:42               ` Gabriele Martino
@ 2015-04-29 18:42                 ` Takashi Iwai
  2015-04-29 23:40                   ` Gabriele Martino
  0 siblings, 1 reply; 21+ messages in thread
From: Takashi Iwai @ 2015-04-29 18:42 UTC (permalink / raw)
  To: Gabriele Martino; +Cc: alsa-devel

At Wed, 29 Apr 2015 17:42:55 +0200,
Gabriele Martino wrote:
> 
> On 29/04/2015 15:38, Takashi Iwai wrote:
> > At Wed, 29 Apr 2015 00:47:16 +0200,
> > Gabriele Martino wrote:
> >> Thank you for your explanation.
> >> I managed to fix the pin address, but as I told before the jack
> >> detection is totally messed up.
> >> "hdajacksensetest" fails with:
> >> Ioctl call failed with error 16
> > The error message looks irrelevant with the patch itself.
> > Did you build with proper kernel configs?
> > CONFIG_SND_HDA_HWDEP=y
> > CONFIG_SND_HDA_RECONFIG=y
> > CONFIG_SND_HDA_PATCH_LOADER=y
> It should be ok:
> 
> $ grep CONFIG_SND_HDA_ /usr/src/linux/.config | grep -v '^#'
> CONFIG_SND_HDA_INTEL=m
> CONFIG_SND_HDA_DSP_LOADER=y
> CONFIG_SND_HDA_PREALLOC_SIZE=2048
> CONFIG_SND_HDA_HWDEP=y
> CONFIG_SND_HDA_RECONFIG=y
> CONFIG_SND_HDA_INPUT_JACK=y
> CONFIG_SND_HDA_PATCH_LOADER=y
> CONFIG_SND_HDA_CODEC_HDMI=m
> CONFIG_SND_HDA_I915=y
> CONFIG_SND_HDA_CODEC_CA0132=m
> CONFIG_SND_HDA_CODEC_CA0132_DSP=y
> CONFIG_SND_HDA_GENERIC=m
> CONFIG_SND_HDA_POWER_SAVE_DEFAULT=60

OK, then it's something else.  Errno 16 is EBUSY, so something else
must be accessing the same device (e.g. hwdep) and blocking the
operation.

Are you sure that you never see this error when a kernel is without
the patch?


Takashi

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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-04-29 18:42                 ` Takashi Iwai
@ 2015-04-29 23:40                   ` Gabriele Martino
  2015-04-30  5:51                     ` Takashi Iwai
  0 siblings, 1 reply; 21+ messages in thread
From: Gabriele Martino @ 2015-04-29 23:40 UTC (permalink / raw)
  To: alsa-devel

On 29/04/2015 20:42, Takashi Iwai wrote:
> At Wed, 29 Apr 2015 17:42:55 +0200,
> Gabriele Martino wrote:
>> On 29/04/2015 15:38, Takashi Iwai wrote:
>>> At Wed, 29 Apr 2015 00:47:16 +0200,
>>> Gabriele Martino wrote:
>>>> Thank you for your explanation.
>>>> I managed to fix the pin address, but as I told before the jack
>>>> detection is totally messed up.
>>>> "hdajacksensetest" fails with:
>>>> Ioctl call failed with error 16
>>> The error message looks irrelevant with the patch itself.
>>> Did you build with proper kernel configs?
>>> CONFIG_SND_HDA_HWDEP=y
>>> CONFIG_SND_HDA_RECONFIG=y
>>> CONFIG_SND_HDA_PATCH_LOADER=y
>> It should be ok:
>>
>> $ grep CONFIG_SND_HDA_ /usr/src/linux/.config | grep -v '^#'
>> CONFIG_SND_HDA_INTEL=m
>> CONFIG_SND_HDA_DSP_LOADER=y
>> CONFIG_SND_HDA_PREALLOC_SIZE=2048
>> CONFIG_SND_HDA_HWDEP=y
>> CONFIG_SND_HDA_RECONFIG=y
>> CONFIG_SND_HDA_INPUT_JACK=y
>> CONFIG_SND_HDA_PATCH_LOADER=y
>> CONFIG_SND_HDA_CODEC_HDMI=m
>> CONFIG_SND_HDA_I915=y
>> CONFIG_SND_HDA_CODEC_CA0132=m
>> CONFIG_SND_HDA_CODEC_CA0132_DSP=y
>> CONFIG_SND_HDA_GENERIC=m
>> CONFIG_SND_HDA_POWER_SAVE_DEFAULT=60
> OK, then it's something else.  Errno 16 is EBUSY, so something else
> must be accessing the same device (e.g. hwdep) and blocking the
> operation.
>
> Are you sure that you never see this error when a kernel is without
> the patch?
It was an error on my part, my apologies.
I did a full kernel clean and rebuild, and the error 16 went away.
But the jack detection is still broken.

hdajacksensetest -c 1 -a
Pin 0x0b (Internal Speaker): present = Yes
Pin 0x0c (Not connected): present = No
Pin 0x0d (Not connected): present = No
Pin 0x0e (Not connected): present = No
Pin 0x0f (Not connected): present = Yes
Pin 0x10 (Not connected): present = No
Pin 0x11 (Black Line In, Left side): present = No
Pin 0x12 (Internal Mic, Mobile-In): present = No
Pin 0x13 (Not connected): present = No
Pin 0x18 (Not connected): present = No

Pin 0x0f is still reported as not connected, but correctly detects the
jack if plugged.
If I turn off and on the "HP/Speaker Auto Detect" in alsamixer while
"HP/Speaker" is off, the correct output is detected.
If "HP/Speaker" is on, the behaviour is inconsistent.

Is there a configuration file? Where can I find the metadata "Black Line
In, Left side"?
I don't know if it is related, but pavucontrol detects only the
"speakers" port.
On my previous laptop (with Creative Recon 3Di, another ca0132 card) I
could choose between "speakers and "headphones".

Regards,
Gabriele

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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-04-29 23:40                   ` Gabriele Martino
@ 2015-04-30  5:51                     ` Takashi Iwai
  2015-05-01  0:36                       ` Gabriele Martino
  2015-05-03 23:53                       ` Gabriele Martino
  0 siblings, 2 replies; 21+ messages in thread
From: Takashi Iwai @ 2015-04-30  5:51 UTC (permalink / raw)
  To: Gabriele Martino; +Cc: alsa-devel

At Thu, 30 Apr 2015 01:40:30 +0200,
Gabriele Martino wrote:
> 
> On 29/04/2015 20:42, Takashi Iwai wrote:
> > At Wed, 29 Apr 2015 17:42:55 +0200,
> > Gabriele Martino wrote:
> >> On 29/04/2015 15:38, Takashi Iwai wrote:
> >>> At Wed, 29 Apr 2015 00:47:16 +0200,
> >>> Gabriele Martino wrote:
> >>>> Thank you for your explanation.
> >>>> I managed to fix the pin address, but as I told before the jack
> >>>> detection is totally messed up.
> >>>> "hdajacksensetest" fails with:
> >>>> Ioctl call failed with error 16
> >>> The error message looks irrelevant with the patch itself.
> >>> Did you build with proper kernel configs?
> >>> CONFIG_SND_HDA_HWDEP=y
> >>> CONFIG_SND_HDA_RECONFIG=y
> >>> CONFIG_SND_HDA_PATCH_LOADER=y
> >> It should be ok:
> >>
> >> $ grep CONFIG_SND_HDA_ /usr/src/linux/.config | grep -v '^#'
> >> CONFIG_SND_HDA_INTEL=m
> >> CONFIG_SND_HDA_DSP_LOADER=y
> >> CONFIG_SND_HDA_PREALLOC_SIZE=2048
> >> CONFIG_SND_HDA_HWDEP=y
> >> CONFIG_SND_HDA_RECONFIG=y
> >> CONFIG_SND_HDA_INPUT_JACK=y
> >> CONFIG_SND_HDA_PATCH_LOADER=y
> >> CONFIG_SND_HDA_CODEC_HDMI=m
> >> CONFIG_SND_HDA_I915=y
> >> CONFIG_SND_HDA_CODEC_CA0132=m
> >> CONFIG_SND_HDA_CODEC_CA0132_DSP=y
> >> CONFIG_SND_HDA_GENERIC=m
> >> CONFIG_SND_HDA_POWER_SAVE_DEFAULT=60
> > OK, then it's something else.  Errno 16 is EBUSY, so something else
> > must be accessing the same device (e.g. hwdep) and blocking the
> > operation.
> >
> > Are you sure that you never see this error when a kernel is without
> > the patch?
> It was an error on my part, my apologies.
> I did a full kernel clean and rebuild, and the error 16 went away.
> But the jack detection is still broken.
> 
> hdajacksensetest -c 1 -a
> Pin 0x0b (Internal Speaker): present = Yes
> Pin 0x0c (Not connected): present = No
> Pin 0x0d (Not connected): present = No
> Pin 0x0e (Not connected): present = No
> Pin 0x0f (Not connected): present = Yes
> Pin 0x10 (Not connected): present = No
> Pin 0x11 (Black Line In, Left side): present = No
> Pin 0x12 (Internal Mic, Mobile-In): present = No
> Pin 0x13 (Not connected): present = No
> Pin 0x18 (Not connected): present = No
> 
> Pin 0x0f is still reported as not connected, but correctly detects the
> jack if plugged.
> If I turn off and on the "HP/Speaker Auto Detect" in alsamixer while
> "HP/Speaker" is off, the correct output is detected.
> If "HP/Speaker" is on, the behaviour is inconsistent.
> 
> Is there a configuration file? Where can I find the metadata "Black Line
> In, Left side"?
> I don't know if it is related, but pavucontrol detects only the
> "speakers" port.
> On my previous laptop (with Creative Recon 3Di, another ca0132 card) I
> could choose between "speakers and "headphones".

It implies that the whole pin config BIOS provides is buggy.   The
jack color, location, etc, all are parsed from 32bit pin configuration
value for each pin.

You need to correct the pin config and sets it statically in the
driver.  hdajackretask can give you the map and reload it
dynamically.


Takashi

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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-04-30  5:51                     ` Takashi Iwai
@ 2015-05-01  0:36                       ` Gabriele Martino
  2015-05-03 23:53                       ` Gabriele Martino
  1 sibling, 0 replies; 21+ messages in thread
From: Gabriele Martino @ 2015-05-01  0:36 UTC (permalink / raw)
  To: alsa-devel

On 30/04/2015 07:51, Takashi Iwai wrote:
> At Thu, 30 Apr 2015 01:40:30 +0200,
> Gabriele Martino wrote:
>> It was an error on my part, my apologies.
>> I did a full kernel clean and rebuild, and the error 16 went away.
>> But the jack detection is still broken.
>>
>> hdajacksensetest -c 1 -a
>> Pin 0x0b (Internal Speaker): present = Yes
>> Pin 0x0c (Not connected): present = No
>> Pin 0x0d (Not connected): present = No
>> Pin 0x0e (Not connected): present = No
>> Pin 0x0f (Not connected): present = Yes
>> Pin 0x10 (Not connected): present = No
>> Pin 0x11 (Black Line In, Left side): present = No
>> Pin 0x12 (Internal Mic, Mobile-In): present = No
>> Pin 0x13 (Not connected): present = No
>> Pin 0x18 (Not connected): present = No
>>
>> Pin 0x0f is still reported as not connected, but correctly detects the
>> jack if plugged.
>> If I turn off and on the "HP/Speaker Auto Detect" in alsamixer while
>> "HP/Speaker" is off, the correct output is detected.
>> If "HP/Speaker" is on, the behaviour is inconsistent.
>>
>> Is there a configuration file? Where can I find the metadata "Black Line
>> In, Left side"?
>> I don't know if it is related, but pavucontrol detects only the
>> "speakers" port.
>> On my previous laptop (with Creative Recon 3Di, another ca0132 card) I
>> could choose between "speakers and "headphones".
> It implies that the whole pin config BIOS provides is buggy.   The
> jack color, location, etc, all are parsed from 32bit pin configuration
> value for each pin.
>
> You need to correct the pin config and sets it statically in the
> driver.  hdajackretask can give you the map and reload it
> dynamically.
Ok, I overrided the pin 0x0f to:
-Connectivity: jack
-Device: headphones
and now it shows the ports "Speakers" and "Headphones" as it should.
It correctly switches from "Speakers" to "Headphones" when I plug the
jack, but the sound comes still from the speakers.
I have to mess with the alsamixer's switches to get the correct output
device, as I did before.

What is the meaning of "Channel group" and "Channel (in group)" controls
of in hdajackretask? I can't find any documentation.
The speakers are on channel group 15, channel in group "Front".
The headphones got as default value channel group 3, channel in group
"Channel 30 & 31".

Regards,
Gabriele

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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-04-30  5:51                     ` Takashi Iwai
  2015-05-01  0:36                       ` Gabriele Martino
@ 2015-05-03 23:53                       ` Gabriele Martino
  2015-05-04 12:30                         ` Takashi Iwai
  1 sibling, 1 reply; 21+ messages in thread
From: Gabriele Martino @ 2015-05-03 23:53 UTC (permalink / raw)
  To: alsa-devel

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

On 30/04/2015 07:51, Takashi Iwai wrote:
> At Thu, 30 Apr 2015 01:40:30 +0200,
> Gabriele Martino wrote:
>> hdajacksensetest -c 1 -a
>> Pin 0x0b (Internal Speaker): present = Yes
>> Pin 0x0c (Not connected): present = No
>> Pin 0x0d (Not connected): present = No
>> Pin 0x0e (Not connected): present = No
>> Pin 0x0f (Not connected): present = Yes
>> Pin 0x10 (Not connected): present = No
>> Pin 0x11 (Black Line In, Left side): present = No
>> Pin 0x12 (Internal Mic, Mobile-In): present = No
>> Pin 0x13 (Not connected): present = No
>> Pin 0x18 (Not connected): present = No
>>
>> Pin 0x0f is still reported as not connected, but correctly detects the
>> jack if plugged.
>> If I turn off and on the "HP/Speaker Auto Detect" in alsamixer while
>> "HP/Speaker" is off, the correct output is detected.
>> If "HP/Speaker" is on, the behaviour is inconsistent.
>>
>> Is there a configuration file? Where can I find the metadata "Black Line
>> In, Left side"?
>> I don't know if it is related, but pavucontrol detects only the
>> "speakers" port.
>> On my previous laptop (with Creative Recon 3Di, another ca0132 card) I
>> could choose between "speakers and "headphones".
> It implies that the whole pin config BIOS provides is buggy.   The
> jack color, location, etc, all are parsed from 32bit pin configuration
> value for each pin.
>
> You need to correct the pin config and sets it statically in the
> driver.  hdajackretask can give you the map and reload it
> dynamically.
>
Finally got it.
I'm not sure about overriding the BIOS configuration: there is a new
version which fixes all the unconnected pins.
There is only a small issue: the internal speakers are now marked as
"Line out", which seems to mess up the "Ports" section in Pulseaudio.

Regards,
Gabriele

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ca0132-quirks.patch --]
[-- Type: text/x-patch; name="ca0132-quirks.patch", Size: 3253 bytes --]

diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 4a4e7b2..04720ae 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -43,7 +43,7 @@
 #define FLOAT_TWO	0x40000000
 #define FLOAT_MINUS_5	0xc0a00000
 
-#define UNSOL_TAG_HP	0x10
+hda_nid_t UNSOL_TAG_HP = 0x10;
 #define UNSOL_TAG_AMIC1	0x12
 #define UNSOL_TAG_DSP	0x16
 
@@ -748,6 +748,7 @@ struct ca0132_spec {
 
 	struct hda_codec *codec;
 	struct delayed_work unsol_hp_work;
+	int quirk;
 
 #ifdef ENABLE_TUNING_CONTROLS
 	long cur_ctl_vals[TUNING_CTLS_COUNT];
@@ -755,6 +756,19 @@ struct ca0132_spec {
 };
 
 /*
+ * CA0132 quirks table
+ */
+enum {
+	QUIRK_NONE,
+	QUIRK_ALIENWARE,
+};
+
+static const struct snd_pci_quirk ca0132_quirks[] = {
+	SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15", QUIRK_ALIENWARE),
+	{}
+};
+
+/*
  * CA0132 codec access
  */
 static unsigned int codec_send_command(struct hda_codec *codec, hda_nid_t nid,
@@ -4479,8 +4493,19 @@ static struct hda_verb ca0132_init_verbs0[] = {
 	{}
 };
 
-static struct hda_verb ca0132_init_verbs1[] = {
-	{0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | UNSOL_TAG_HP},
+static struct hda_verb ca0132_init_verbs1_default[] = {
+	{0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x10}, /* UNSOL_TAG_HP is 0x10 */
+	{0x12, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | UNSOL_TAG_AMIC1},
+	/* config EAPD */
+	{0x0b, 0x78D, 0x00},
+	/*{0x0b, AC_VERB_SET_EAPD_BTLENABLE, 0x02},*/
+	/*{0x10, 0x78D, 0x02},*/
+	/*{0x10, AC_VERB_SET_EAPD_BTLENABLE, 0x02},*/
+	{}
+};
+
+static struct hda_verb ca0132_init_verbs1_alienware[] = {
+	{0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x0f}, /* UNSOL_TAG_HP is 0x0f */
 	{0x12, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | UNSOL_TAG_AMIC1},
 	/* config EAPD */
 	{0x0b, 0x78D, 0x00},
@@ -4617,7 +4642,13 @@ static void ca0132_config(struct hda_codec *codec)
 
 	spec->num_outputs = 2;
 	spec->out_pins[0] = 0x0b; /* speaker out */
-	spec->out_pins[1] = 0x10; /* headphone out */
+	if (spec->quirk == QUIRK_ALIENWARE) {
+		codec_dbg(codec, "ca0132_config: QUIRK_ALIENWARE applied.\n");
+		spec->out_pins[1] = 0x0f;
+	}
+	else{
+		spec->out_pins[1] = 0x10; /* headphone out */
+	}
 	spec->shared_out_nid = 0x2;
 
 	spec->num_inputs = 3;
@@ -4645,6 +4676,8 @@ static int patch_ca0132(struct hda_codec *codec)
 {
 	struct ca0132_spec *spec;
 	int err;
+	const struct snd_pci_quirk *quirk;
+	struct hda_verb *ca0132_init_verbs1;
 
 	codec_dbg(codec, "patch_ca0132\n");
 
@@ -4654,6 +4687,24 @@ static int patch_ca0132(struct hda_codec *codec)
 	codec->spec = spec;
 	spec->codec = codec;
 
+	quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks);
+	if (quirk) {
+		spec->quirk = quirk->value;
+	}
+	else{
+		spec->quirk = QUIRK_NONE;
+	}
+
+	/* Apply detected quirks */
+	if (spec->quirk == QUIRK_ALIENWARE) {
+		codec_dbg(codec, "patch_ca0132: QUIRK_ALIENWARE applied.\n");
+		UNSOL_TAG_HP = 0x0f;
+		ca0132_init_verbs1 = ca0132_init_verbs1_alienware;
+	}
+	else{
+		ca0132_init_verbs1 = ca0132_init_verbs1_default;
+	}
+
 	spec->dsp_state = DSP_DOWNLOAD_INIT;
 	spec->num_mixers = 1;
 	spec->mixers[0] = ca0132_mixer;

[-- Attachment #3: hda-jack-retask.fw --]
[-- Type: text/plain, Size: 216 bytes --]

[codec]
0x11020011 0x10280685 0

[pincfg]
0x0b 0x90174010
0x0c 0x014580f0
0x0d 0x014570f0
0x0e 0x01c530f0
0x0f 0x0221401f
0x10 0x02216011
0x11 0x02012014
0x12 0x37a791f0
0x13 0x908700f0
0x18 0x500000f0

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



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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-05-03 23:53                       ` Gabriele Martino
@ 2015-05-04 12:30                         ` Takashi Iwai
  2015-05-04 23:28                           ` Gabriele Martino
  2015-05-11 20:17                           ` Gabriele Martino
  0 siblings, 2 replies; 21+ messages in thread
From: Takashi Iwai @ 2015-05-04 12:30 UTC (permalink / raw)
  To: Gabriele Martino; +Cc: alsa-devel

At Mon, 04 May 2015 01:53:37 +0200,
Gabriele Martino wrote:
> 
> On 30/04/2015 07:51, Takashi Iwai wrote:
> > At Thu, 30 Apr 2015 01:40:30 +0200,
> > Gabriele Martino wrote:
> >> hdajacksensetest -c 1 -a
> >> Pin 0x0b (Internal Speaker): present = Yes
> >> Pin 0x0c (Not connected): present = No
> >> Pin 0x0d (Not connected): present = No
> >> Pin 0x0e (Not connected): present = No
> >> Pin 0x0f (Not connected): present = Yes
> >> Pin 0x10 (Not connected): present = No
> >> Pin 0x11 (Black Line In, Left side): present = No
> >> Pin 0x12 (Internal Mic, Mobile-In): present = No
> >> Pin 0x13 (Not connected): present = No
> >> Pin 0x18 (Not connected): present = No
> >>
> >> Pin 0x0f is still reported as not connected, but correctly detects the
> >> jack if plugged.
> >> If I turn off and on the "HP/Speaker Auto Detect" in alsamixer while
> >> "HP/Speaker" is off, the correct output is detected.
> >> If "HP/Speaker" is on, the behaviour is inconsistent.
> >>
> >> Is there a configuration file? Where can I find the metadata "Black Line
> >> In, Left side"?
> >> I don't know if it is related, but pavucontrol detects only the
> >> "speakers" port.
> >> On my previous laptop (with Creative Recon 3Di, another ca0132 card) I
> >> could choose between "speakers and "headphones".
> > It implies that the whole pin config BIOS provides is buggy.   The
> > jack color, location, etc, all are parsed from 32bit pin configuration
> > value for each pin.
> >
> > You need to correct the pin config and sets it statically in the
> > driver.  hdajackretask can give you the map and reload it
> > dynamically.
> >
> Finally got it.
> I'm not sure about overriding the BIOS configuration: there is a new
> version which fixes all the unconnected pins.
> There is only a small issue: the internal speakers are now marked as
> "Line out", which seems to mess up the "Ports" section in Pulseaudio.

Hm, this can be changed via a proper pin config?

In anyway, I'm traveling in this week and next week, so cannot debug
the things.  Will check it later once when I back from vacation.  Just
ping me.


thanks,

Takashi

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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-05-04 12:30                         ` Takashi Iwai
@ 2015-05-04 23:28                           ` Gabriele Martino
  2015-05-11 20:17                           ` Gabriele Martino
  1 sibling, 0 replies; 21+ messages in thread
From: Gabriele Martino @ 2015-05-04 23:28 UTC (permalink / raw)
  To: alsa-devel

On 04/05/2015 14:30, Takashi Iwai wrote:
> At Mon, 04 May 2015 01:53:37 +0200,
> Gabriele Martino wrote:
>> Finally got it.
>> I'm not sure about overriding the BIOS configuration: there is a new
>> version which fixes all the unconnected pins.
>> There is only a small issue: the internal speakers are now marked as
>> "Line out", which seems to mess up the "Ports" section in Pulseaudio.
> Hm, this can be changed via a proper pin config?
Sure, that's why I attached hda-jack-retask.fw.
> In anyway, I'm traveling in this week and next week, so cannot debug
> the things.  Will check it later once when I back from vacation.  Just
> ping me.
Enjoy your vacation, I'll try to tidy up the code and make a decent
patch in the meanwhile.

Regards,
Gabriele

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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-05-04 12:30                         ` Takashi Iwai
  2015-05-04 23:28                           ` Gabriele Martino
@ 2015-05-11 20:17                           ` Gabriele Martino
  2015-05-18  9:39                             ` Takashi Iwai
  1 sibling, 1 reply; 21+ messages in thread
From: Gabriele Martino @ 2015-05-11 20:17 UTC (permalink / raw)
  To: alsa-devel

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

On 04/05/2015 14:30, Takashi Iwai wrote:
> Hm, this can be changed via a proper pin config?
>
> In anyway, I'm traveling in this week and next week, so cannot debug
> the things.  Will check it later once when I back from vacation.  Just
> ping me.
Hi, this should be the final version.
There are some big changes:
- all the pin configuration is now performed in ca0132_config(), no more
static definitions
- some initialization verbs depend on the pin configuration, so they are
generated from the pin configuration
- the quirks management code now is a simple "if" in the pin configuration

I can't split the patch because the quirks part requires the dynamic
verbs generation.
I'm using this since 5 May without any trouble, so it shouldn't blow up
things.

Regards,
Gabriele

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ca0132-quirks-dynverbs.patch --]
[-- Type: text/x-patch; name="ca0132-quirks-dynverbs.patch", Size: 6906 bytes --]

diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 4a4e7b2..80e4b8d 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -43,8 +43,6 @@
 #define FLOAT_TWO	0x40000000
 #define FLOAT_MINUS_5	0xc0a00000
 
-#define UNSOL_TAG_HP	0x10
-#define UNSOL_TAG_AMIC1	0x12
 #define UNSOL_TAG_DSP	0x16
 
 #define DSP_DMA_WRITE_BUFLEN_INIT (1UL<<18)
@@ -703,8 +701,8 @@
 	unsigned int num_mixers;
 	const struct hda_verb *base_init_verbs;
 	const struct hda_verb *base_exit_verbs;
-	const struct hda_verb *init_verbs[5];
-	unsigned int num_init_verbs;  /* exclude base init verbs */
+	const struct hda_verb *chip_init_verbs;
+	struct hda_verb *spec_init_verbs;
 	struct auto_pin_cfg autocfg;
 
 	/* Nodes configurations */
@@ -719,6 +717,8 @@
 	unsigned int num_inputs;
 	hda_nid_t shared_mic_nid;
 	hda_nid_t shared_out_nid;
+	hda_nid_t unsol_tag_hp;
+	hda_nid_t unsol_tag_amic1;
 
 	/* chip access */
 	struct mutex chipio_mutex; /* chip access mutex */
@@ -748,10 +748,24 @@
 
 	struct hda_codec *codec;
 	struct delayed_work unsol_hp_work;
+	int quirk;
 
 #ifdef ENABLE_TUNING_CONTROLS
 	long cur_ctl_vals[TUNING_CTLS_COUNT];
 #endif
+};
+
+/*
+ * CA0132 quirks table
+ */
+enum {
+	QUIRK_NONE,
+	QUIRK_ALIENWARE,
+};
+
+static const struct snd_pci_quirk ca0132_quirks[] = {
+	SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15", QUIRK_ALIENWARE),
+	{}
 };
 
 /*
@@ -3227,7 +3241,7 @@
 	struct hda_jack_tbl *jack;
 
 	ca0132_select_out(spec->codec);
-	jack = snd_hda_jack_tbl_get(spec->codec, UNSOL_TAG_HP);
+	jack = snd_hda_jack_tbl_get(spec->codec, spec->unsol_tag_hp);
 	if (jack) {
 		jack->block_report = 0;
 		snd_hda_jack_report_sync(spec->codec);
@@ -4417,8 +4431,9 @@
 
 static void ca0132_init_unsol(struct hda_codec *codec)
 {
-	snd_hda_jack_detect_enable_callback(codec, UNSOL_TAG_HP, hp_callback);
-	snd_hda_jack_detect_enable_callback(codec, UNSOL_TAG_AMIC1,
+	struct ca0132_spec *spec = codec->spec;
+	snd_hda_jack_detect_enable_callback(codec, spec->unsol_tag_hp, hp_callback);
+	snd_hda_jack_detect_enable_callback(codec, spec->unsol_tag_amic1,
 					    amic_callback);
 	snd_hda_jack_detect_enable_callback(codec, UNSOL_TAG_DSP,
 					    ca0132_process_dsp_response);
@@ -4476,17 +4491,6 @@
 	{0x15, 0x5E8, 0xC9},
 	{0x15, 0x717, 0x0D},
 	{0x15, 0x718, 0x20},
-	{}
-};
-
-static struct hda_verb ca0132_init_verbs1[] = {
-	{0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | UNSOL_TAG_HP},
-	{0x12, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | UNSOL_TAG_AMIC1},
-	/* config EAPD */
-	{0x0b, 0x78D, 0x00},
-	/*{0x0b, AC_VERB_SET_EAPD_BTLENABLE, 0x02},*/
-	/*{0x10, 0x78D, 0x02},*/
-	/*{0x10, AC_VERB_SET_EAPD_BTLENABLE, 0x02},*/
 	{}
 };
 
@@ -4569,8 +4573,8 @@
 
 	init_input(codec, cfg->dig_in_pin, spec->dig_in);
 
-	for (i = 0; i < spec->num_init_verbs; i++)
-		snd_hda_sequence_write(codec, spec->init_verbs[i]);
+	snd_hda_sequence_write(codec, spec->chip_init_verbs);
+	snd_hda_sequence_write(codec, spec->spec_init_verbs);
 
 	ca0132_select_out(codec);
 	ca0132_select_mic(codec);
@@ -4591,6 +4595,7 @@
 	snd_hda_sequence_write(codec, spec->base_exit_verbs);
 	ca0132_exit_chip(codec);
 	snd_hda_power_down(codec);
+	kfree(spec->spec_init_verbs);
 	kfree(codec->spec);
 }
 
@@ -4617,18 +4622,26 @@
 
 	spec->num_outputs = 2;
 	spec->out_pins[0] = 0x0b; /* speaker out */
-	spec->out_pins[1] = 0x10; /* headphone out */
+	if (spec->quirk == QUIRK_ALIENWARE) {
+		codec_dbg(codec, "ca0132_config: QUIRK_ALIENWARE applied.\n");
+		spec->out_pins[1] = 0x0f;
+	}
+	else{
+		spec->out_pins[1] = 0x10; /* headphone out */
+	}
 	spec->shared_out_nid = 0x2;
+	spec->unsol_tag_hp = spec->out_pins[1];
 
-	spec->num_inputs = 3;
 	spec->adcs[0] = 0x7; /* digital mic / analog mic1 */
 	spec->adcs[1] = 0x8; /* analog mic2 */
 	spec->adcs[2] = 0xa; /* what u hear */
-	spec->shared_mic_nid = 0x7;
 
+	spec->num_inputs = 3;
 	spec->input_pins[0] = 0x12;
 	spec->input_pins[1] = 0x11;
 	spec->input_pins[2] = 0x13;
+	spec->shared_mic_nid = 0x7;
+	spec->unsol_tag_amic1 = spec->input_pins[0];
 
 	/* SPDIF I/O */
 	spec->dig_out = 0x05;
@@ -4641,10 +4654,58 @@
 	cfg->dig_in_type = HDA_PCM_TYPE_SPDIF;
 }
 
+static int ca0132_prepare_verbs(struct hda_codec *codec)
+{
+	struct ca0132_spec *spec = codec->spec;
+	static struct hda_verb empty_verb = {};
+#define NUM_SPEC_VERBS 4
+
+	spec->chip_init_verbs = ca0132_init_verbs0;
+	spec->spec_init_verbs = kzalloc(sizeof(struct hda_verb) * NUM_SPEC_VERBS, GFP_KERNEL);
+	if (!spec->spec_init_verbs)
+		return -ENOMEM;
+
+	/* HP jack autodetection */
+	spec->spec_init_verbs[0].nid = spec->unsol_tag_hp;
+	spec->spec_init_verbs[0].param = AC_VERB_SET_UNSOLICITED_ENABLE;
+	spec->spec_init_verbs[0].verb = AC_USRSP_EN | spec->unsol_tag_hp;
+
+	/* MIC1 jack autodetection */
+	spec->spec_init_verbs[1].nid = spec->unsol_tag_amic1;
+	spec->spec_init_verbs[1].param = AC_VERB_SET_UNSOLICITED_ENABLE;
+	spec->spec_init_verbs[1].verb = AC_USRSP_EN | spec->unsol_tag_amic1;
+
+	/* config EAPD */
+	spec->spec_init_verbs[2].nid = 0x0b;
+	spec->spec_init_verbs[2].param = 0x78D;
+	spec->spec_init_verbs[2].verb = 0x00;
+
+	/* Previously commented configuration */
+	/*
+	spec->spec_init_verbs[3].nid = 0x0b;
+	spec->spec_init_verbs[3].param = AC_VERB_SET_EAPD_BTLENABLE;
+	spec->spec_init_verbs[3].verb = 0x02;
+
+	spec->spec_init_verbs[4].nid = 0x10;
+	spec->spec_init_verbs[4].param = 0x78D;
+	spec->spec_init_verbs[4].verb = 0x02;
+
+	spec->spec_init_verbs[5].nid = 0x10;
+	spec->spec_init_verbs[5].param = AC_VERB_SET_EAPD_BTLENABLE;
+	spec->spec_init_verbs[5].verb = 0x02;
+	*/
+
+	/* Empty element */
+	spec->spec_init_verbs[NUM_SPEC_VERBS-1] = empty_verb;
+
+	return 0;
+}
+
 static int patch_ca0132(struct hda_codec *codec)
 {
 	struct ca0132_spec *spec;
 	int err;
+	const struct snd_pci_quirk *quirk;
 
 	codec_dbg(codec, "patch_ca0132\n");
 
@@ -4654,15 +4715,20 @@
 	codec->spec = spec;
 	spec->codec = codec;
 
+	quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks);
+	if (quirk) {
+		spec->quirk = quirk->value;
+	}
+	else{
+		spec->quirk = QUIRK_NONE;
+	}
+
 	spec->dsp_state = DSP_DOWNLOAD_INIT;
 	spec->num_mixers = 1;
 	spec->mixers[0] = ca0132_mixer;
 
 	spec->base_init_verbs = ca0132_base_init_verbs;
 	spec->base_exit_verbs = ca0132_base_exit_verbs;
-	spec->init_verbs[0] = ca0132_init_verbs0;
-	spec->init_verbs[1] = ca0132_init_verbs1;
-	spec->num_init_verbs = 2;
 
 	INIT_DELAYED_WORK(&spec->unsol_hp_work, ca0132_unsol_hp_delayed);
 
@@ -4670,6 +4736,10 @@
 
 	ca0132_config(codec);
 
+	err = ca0132_prepare_verbs(codec);
+	if (err < 0)
+		return err;
+
 	err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL);
 	if (err < 0)
 		return err;

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



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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-05-11 20:17                           ` Gabriele Martino
@ 2015-05-18  9:39                             ` Takashi Iwai
  2015-05-18 19:15                               ` Gabriele Martino
  0 siblings, 1 reply; 21+ messages in thread
From: Takashi Iwai @ 2015-05-18  9:39 UTC (permalink / raw)
  To: Gabriele Martino; +Cc: alsa-devel

At Mon, 11 May 2015 22:17:01 +0200,
Gabriele Martino wrote:
> 
> On 04/05/2015 14:30, Takashi Iwai wrote:
> > Hm, this can be changed via a proper pin config?
> >
> > In anyway, I'm traveling in this week and next week, so cannot debug
> > the things.  Will check it later once when I back from vacation.  Just
> > ping me.
> Hi, this should be the final version.
> There are some big changes:
> - all the pin configuration is now performed in ca0132_config(), no more
> static definitions
> - some initialization verbs depend on the pin configuration, so they are
> generated from the pin configuration
> - the quirks management code now is a simple "if" in the pin configuration
> 
> I can't split the patch because the quirks part requires the dynamic
> verbs generation.
> I'm using this since 5 May without any trouble, so it shouldn't blow up
> things.

The patch looks almost OK, but just a few things:

> +static int ca0132_prepare_verbs(struct hda_codec *codec)
> +{
> +	struct ca0132_spec *spec = codec->spec;
> +	static struct hda_verb empty_verb = {};
> +#define NUM_SPEC_VERBS 4
> +
> +	spec->chip_init_verbs = ca0132_init_verbs0;
> +	spec->spec_init_verbs = kzalloc(sizeof(struct hda_verb) * NUM_SPEC_VERBS, GFP_KERNEL);
> +	if (!spec->spec_init_verbs)
> +		return -ENOMEM;
> +
> +	/* HP jack autodetection */
> +	spec->spec_init_verbs[0].nid = spec->unsol_tag_hp;
> +	spec->spec_init_verbs[0].param = AC_VERB_SET_UNSOLICITED_ENABLE;
> +	spec->spec_init_verbs[0].verb = AC_USRSP_EN | spec->unsol_tag_hp;
> +
> +	/* MIC1 jack autodetection */
> +	spec->spec_init_verbs[1].nid = spec->unsol_tag_amic1;
> +	spec->spec_init_verbs[1].param = AC_VERB_SET_UNSOLICITED_ENABLE;
> +	spec->spec_init_verbs[1].verb = AC_USRSP_EN | spec->unsol_tag_amic1;
> +
> +	/* config EAPD */
> +	spec->spec_init_verbs[2].nid = 0x0b;
> +	spec->spec_init_verbs[2].param = 0x78D;
> +	spec->spec_init_verbs[2].verb = 0x00;
> +
> +	/* Previously commented configuration */
> +	/*
> +	spec->spec_init_verbs[3].nid = 0x0b;
> +	spec->spec_init_verbs[3].param = AC_VERB_SET_EAPD_BTLENABLE;
> +	spec->spec_init_verbs[3].verb = 0x02;
> +
> +	spec->spec_init_verbs[4].nid = 0x10;
> +	spec->spec_init_verbs[4].param = 0x78D;
> +	spec->spec_init_verbs[4].verb = 0x02;
> +
> +	spec->spec_init_verbs[5].nid = 0x10;
> +	spec->spec_init_verbs[5].param = AC_VERB_SET_EAPD_BTLENABLE;
> +	spec->spec_init_verbs[5].verb = 0x02;
> +	*/
> +
> +	/* Empty element */
> +	spec->spec_init_verbs[NUM_SPEC_VERBS-1] = empty_verb;

This line is superfluous when you allocated via kzalloc().

Could you fix it and give a proper patch changelog and your
signed-off-by tag?


thanks,

Takashi

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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-05-18  9:39                             ` Takashi Iwai
@ 2015-05-18 19:15                               ` Gabriele Martino
  2015-05-19  4:59                                 ` Takashi Iwai
  0 siblings, 1 reply; 21+ messages in thread
From: Gabriele Martino @ 2015-05-18 19:15 UTC (permalink / raw)
  To: alsa-devel

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

This patch adds quirks detection to the Creative CA0132 codec, and the
quirk for Alienware 15 (2015).
Some quirks may need different pin configuration, so the relevant
compile-time configuration has been removed.
The pin configuration and related initialization verbs are generated at
runtime instead, in ca0132_config() and ca0132_prepare_verbs().

Signed-off-by: Gabriele Martino <g.martino@gmx.com>


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ca0132-quirks-dynverbs.patch --]
[-- Type: text/x-patch; name="ca0132-quirks-dynverbs.patch", Size: 6902 bytes --]

diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 4a4e7b2..1c7a9ec 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -43,8 +43,6 @@
 #define FLOAT_TWO	0x40000000
 #define FLOAT_MINUS_5	0xc0a00000
 
-#define UNSOL_TAG_HP	0x10
-#define UNSOL_TAG_AMIC1	0x12
 #define UNSOL_TAG_DSP	0x16
 
 #define DSP_DMA_WRITE_BUFLEN_INIT (1UL<<18)
@@ -703,8 +701,8 @@
 	unsigned int num_mixers;
 	const struct hda_verb *base_init_verbs;
 	const struct hda_verb *base_exit_verbs;
-	const struct hda_verb *init_verbs[5];
-	unsigned int num_init_verbs;  /* exclude base init verbs */
+	const struct hda_verb *chip_init_verbs;
+	struct hda_verb *spec_init_verbs;
 	struct auto_pin_cfg autocfg;
 
 	/* Nodes configurations */
@@ -719,6 +717,8 @@
 	unsigned int num_inputs;
 	hda_nid_t shared_mic_nid;
 	hda_nid_t shared_out_nid;
+	hda_nid_t unsol_tag_hp;
+	hda_nid_t unsol_tag_amic1;
 
 	/* chip access */
 	struct mutex chipio_mutex; /* chip access mutex */
@@ -748,10 +748,24 @@
 
 	struct hda_codec *codec;
 	struct delayed_work unsol_hp_work;
+	int quirk;
 
 #ifdef ENABLE_TUNING_CONTROLS
 	long cur_ctl_vals[TUNING_CTLS_COUNT];
 #endif
+};
+
+/*
+ * CA0132 quirks table
+ */
+enum {
+	QUIRK_NONE,
+	QUIRK_ALIENWARE,
+};
+
+static const struct snd_pci_quirk ca0132_quirks[] = {
+	SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15", QUIRK_ALIENWARE),
+	{}
 };
 
 /*
@@ -3227,7 +3241,7 @@
 	struct hda_jack_tbl *jack;
 
 	ca0132_select_out(spec->codec);
-	jack = snd_hda_jack_tbl_get(spec->codec, UNSOL_TAG_HP);
+	jack = snd_hda_jack_tbl_get(spec->codec, spec->unsol_tag_hp);
 	if (jack) {
 		jack->block_report = 0;
 		snd_hda_jack_report_sync(spec->codec);
@@ -4417,8 +4431,9 @@
 
 static void ca0132_init_unsol(struct hda_codec *codec)
 {
-	snd_hda_jack_detect_enable_callback(codec, UNSOL_TAG_HP, hp_callback);
-	snd_hda_jack_detect_enable_callback(codec, UNSOL_TAG_AMIC1,
+	struct ca0132_spec *spec = codec->spec;
+	snd_hda_jack_detect_enable_callback(codec, spec->unsol_tag_hp, hp_callback);
+	snd_hda_jack_detect_enable_callback(codec, spec->unsol_tag_amic1,
 					    amic_callback);
 	snd_hda_jack_detect_enable_callback(codec, UNSOL_TAG_DSP,
 					    ca0132_process_dsp_response);
@@ -4476,17 +4491,6 @@
 	{0x15, 0x5E8, 0xC9},
 	{0x15, 0x717, 0x0D},
 	{0x15, 0x718, 0x20},
-	{}
-};
-
-static struct hda_verb ca0132_init_verbs1[] = {
-	{0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | UNSOL_TAG_HP},
-	{0x12, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | UNSOL_TAG_AMIC1},
-	/* config EAPD */
-	{0x0b, 0x78D, 0x00},
-	/*{0x0b, AC_VERB_SET_EAPD_BTLENABLE, 0x02},*/
-	/*{0x10, 0x78D, 0x02},*/
-	/*{0x10, AC_VERB_SET_EAPD_BTLENABLE, 0x02},*/
 	{}
 };
 
@@ -4569,8 +4573,8 @@
 
 	init_input(codec, cfg->dig_in_pin, spec->dig_in);
 
-	for (i = 0; i < spec->num_init_verbs; i++)
-		snd_hda_sequence_write(codec, spec->init_verbs[i]);
+	snd_hda_sequence_write(codec, spec->chip_init_verbs);
+	snd_hda_sequence_write(codec, spec->spec_init_verbs);
 
 	ca0132_select_out(codec);
 	ca0132_select_mic(codec);
@@ -4591,6 +4595,7 @@
 	snd_hda_sequence_write(codec, spec->base_exit_verbs);
 	ca0132_exit_chip(codec);
 	snd_hda_power_down(codec);
+	kfree(spec->spec_init_verbs);
 	kfree(codec->spec);
 }
 
@@ -4617,18 +4622,26 @@
 
 	spec->num_outputs = 2;
 	spec->out_pins[0] = 0x0b; /* speaker out */
-	spec->out_pins[1] = 0x10; /* headphone out */
+	if (spec->quirk == QUIRK_ALIENWARE) {
+		codec_dbg(codec, "ca0132_config: QUIRK_ALIENWARE applied.\n");
+		spec->out_pins[1] = 0x0f;
+	}
+	else{
+		spec->out_pins[1] = 0x10; /* headphone out */
+	}
 	spec->shared_out_nid = 0x2;
+	spec->unsol_tag_hp = spec->out_pins[1];
 
-	spec->num_inputs = 3;
 	spec->adcs[0] = 0x7; /* digital mic / analog mic1 */
 	spec->adcs[1] = 0x8; /* analog mic2 */
 	spec->adcs[2] = 0xa; /* what u hear */
-	spec->shared_mic_nid = 0x7;
 
+	spec->num_inputs = 3;
 	spec->input_pins[0] = 0x12;
 	spec->input_pins[1] = 0x11;
 	spec->input_pins[2] = 0x13;
+	spec->shared_mic_nid = 0x7;
+	spec->unsol_tag_amic1 = spec->input_pins[0];
 
 	/* SPDIF I/O */
 	spec->dig_out = 0x05;
@@ -4641,10 +4654,56 @@
 	cfg->dig_in_type = HDA_PCM_TYPE_SPDIF;
 }
 
+static int ca0132_prepare_verbs(struct hda_codec *codec)
+{
+/* Verbs + terminator (an empty element) */
+#define NUM_SPEC_VERBS 4
+	struct ca0132_spec *spec = codec->spec;
+
+	spec->chip_init_verbs = ca0132_init_verbs0;
+	spec->spec_init_verbs = kzalloc(sizeof(struct hda_verb) * NUM_SPEC_VERBS, GFP_KERNEL);
+	if (!spec->spec_init_verbs)
+		return -ENOMEM;
+
+	/* HP jack autodetection */
+	spec->spec_init_verbs[0].nid = spec->unsol_tag_hp;
+	spec->spec_init_verbs[0].param = AC_VERB_SET_UNSOLICITED_ENABLE;
+	spec->spec_init_verbs[0].verb = AC_USRSP_EN | spec->unsol_tag_hp;
+
+	/* MIC1 jack autodetection */
+	spec->spec_init_verbs[1].nid = spec->unsol_tag_amic1;
+	spec->spec_init_verbs[1].param = AC_VERB_SET_UNSOLICITED_ENABLE;
+	spec->spec_init_verbs[1].verb = AC_USRSP_EN | spec->unsol_tag_amic1;
+
+	/* config EAPD */
+	spec->spec_init_verbs[2].nid = 0x0b;
+	spec->spec_init_verbs[2].param = 0x78D;
+	spec->spec_init_verbs[2].verb = 0x00;
+
+	/* Previously commented configuration */
+	/*
+	spec->spec_init_verbs[3].nid = 0x0b;
+	spec->spec_init_verbs[3].param = AC_VERB_SET_EAPD_BTLENABLE;
+	spec->spec_init_verbs[3].verb = 0x02;
+
+	spec->spec_init_verbs[4].nid = 0x10;
+	spec->spec_init_verbs[4].param = 0x78D;
+	spec->spec_init_verbs[4].verb = 0x02;
+
+	spec->spec_init_verbs[5].nid = 0x10;
+	spec->spec_init_verbs[5].param = AC_VERB_SET_EAPD_BTLENABLE;
+	spec->spec_init_verbs[5].verb = 0x02;
+	*/
+
+	/* Terminator: spec->spec_init_verbs[NUM_SPEC_VERBS-1] */
+	return 0;
+}
+
 static int patch_ca0132(struct hda_codec *codec)
 {
 	struct ca0132_spec *spec;
 	int err;
+	const struct snd_pci_quirk *quirk;
 
 	codec_dbg(codec, "patch_ca0132\n");
 
@@ -4654,15 +4713,19 @@
 	codec->spec = spec;
 	spec->codec = codec;
 
+	/* Detect codec quirk */
+	quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks);
+	if (quirk)
+		spec->quirk = quirk->value;
+	else
+		spec->quirk = QUIRK_NONE;
+
 	spec->dsp_state = DSP_DOWNLOAD_INIT;
 	spec->num_mixers = 1;
 	spec->mixers[0] = ca0132_mixer;
 
 	spec->base_init_verbs = ca0132_base_init_verbs;
 	spec->base_exit_verbs = ca0132_base_exit_verbs;
-	spec->init_verbs[0] = ca0132_init_verbs0;
-	spec->init_verbs[1] = ca0132_init_verbs1;
-	spec->num_init_verbs = 2;
 
 	INIT_DELAYED_WORK(&spec->unsol_hp_work, ca0132_unsol_hp_delayed);
 
@@ -4670,6 +4733,10 @@
 
 	ca0132_config(codec);
 
+	err = ca0132_prepare_verbs(codec);
+	if (err < 0)
+		return err;
+
 	err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL);
 	if (err < 0)
 		return err;

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



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

* Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
  2015-05-18 19:15                               ` Gabriele Martino
@ 2015-05-19  4:59                                 ` Takashi Iwai
  0 siblings, 0 replies; 21+ messages in thread
From: Takashi Iwai @ 2015-05-19  4:59 UTC (permalink / raw)
  To: Gabriele Martino; +Cc: alsa-devel

At Mon, 18 May 2015 21:15:13 +0200,
Gabriele Martino wrote:
> 
> This patch adds quirks detection to the Creative CA0132 codec, and the
> quirk for Alienware 15 (2015).
> Some quirks may need different pin configuration, so the relevant
> compile-time configuration has been removed.
> The pin configuration and related initialization verbs are generated at
> runtime instead, in ca0132_config() and ca0132_prepare_verbs().
> 
> Signed-off-by: Gabriele Martino <g.martino@gmx.com>

Applied, thanks.


Takashi

> 
> diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
> index 4a4e7b2..1c7a9ec 100644
> --- a/sound/pci/hda/patch_ca0132.c
> +++ b/sound/pci/hda/patch_ca0132.c
> @@ -43,8 +43,6 @@
>  #define FLOAT_TWO	0x40000000
>  #define FLOAT_MINUS_5	0xc0a00000
>  
> -#define UNSOL_TAG_HP	0x10
> -#define UNSOL_TAG_AMIC1	0x12
>  #define UNSOL_TAG_DSP	0x16
>  
>  #define DSP_DMA_WRITE_BUFLEN_INIT (1UL<<18)
> @@ -703,8 +701,8 @@
>  	unsigned int num_mixers;
>  	const struct hda_verb *base_init_verbs;
>  	const struct hda_verb *base_exit_verbs;
> -	const struct hda_verb *init_verbs[5];
> -	unsigned int num_init_verbs;  /* exclude base init verbs */
> +	const struct hda_verb *chip_init_verbs;
> +	struct hda_verb *spec_init_verbs;
>  	struct auto_pin_cfg autocfg;
>  
>  	/* Nodes configurations */
> @@ -719,6 +717,8 @@
>  	unsigned int num_inputs;
>  	hda_nid_t shared_mic_nid;
>  	hda_nid_t shared_out_nid;
> +	hda_nid_t unsol_tag_hp;
> +	hda_nid_t unsol_tag_amic1;
>  
>  	/* chip access */
>  	struct mutex chipio_mutex; /* chip access mutex */
> @@ -748,10 +748,24 @@
>  
>  	struct hda_codec *codec;
>  	struct delayed_work unsol_hp_work;
> +	int quirk;
>  
>  #ifdef ENABLE_TUNING_CONTROLS
>  	long cur_ctl_vals[TUNING_CTLS_COUNT];
>  #endif
> +};
> +
> +/*
> + * CA0132 quirks table
> + */
> +enum {
> +	QUIRK_NONE,
> +	QUIRK_ALIENWARE,
> +};
> +
> +static const struct snd_pci_quirk ca0132_quirks[] = {
> +	SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15", QUIRK_ALIENWARE),
> +	{}
>  };
>  
>  /*
> @@ -3227,7 +3241,7 @@
>  	struct hda_jack_tbl *jack;
>  
>  	ca0132_select_out(spec->codec);
> -	jack = snd_hda_jack_tbl_get(spec->codec, UNSOL_TAG_HP);
> +	jack = snd_hda_jack_tbl_get(spec->codec, spec->unsol_tag_hp);
>  	if (jack) {
>  		jack->block_report = 0;
>  		snd_hda_jack_report_sync(spec->codec);
> @@ -4417,8 +4431,9 @@
>  
>  static void ca0132_init_unsol(struct hda_codec *codec)
>  {
> -	snd_hda_jack_detect_enable_callback(codec, UNSOL_TAG_HP, hp_callback);
> -	snd_hda_jack_detect_enable_callback(codec, UNSOL_TAG_AMIC1,
> +	struct ca0132_spec *spec = codec->spec;
> +	snd_hda_jack_detect_enable_callback(codec, spec->unsol_tag_hp, hp_callback);
> +	snd_hda_jack_detect_enable_callback(codec, spec->unsol_tag_amic1,
>  					    amic_callback);
>  	snd_hda_jack_detect_enable_callback(codec, UNSOL_TAG_DSP,
>  					    ca0132_process_dsp_response);
> @@ -4476,17 +4491,6 @@
>  	{0x15, 0x5E8, 0xC9},
>  	{0x15, 0x717, 0x0D},
>  	{0x15, 0x718, 0x20},
> -	{}
> -};
> -
> -static struct hda_verb ca0132_init_verbs1[] = {
> -	{0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | UNSOL_TAG_HP},
> -	{0x12, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | UNSOL_TAG_AMIC1},
> -	/* config EAPD */
> -	{0x0b, 0x78D, 0x00},
> -	/*{0x0b, AC_VERB_SET_EAPD_BTLENABLE, 0x02},*/
> -	/*{0x10, 0x78D, 0x02},*/
> -	/*{0x10, AC_VERB_SET_EAPD_BTLENABLE, 0x02},*/
>  	{}
>  };
>  
> @@ -4569,8 +4573,8 @@
>  
>  	init_input(codec, cfg->dig_in_pin, spec->dig_in);
>  
> -	for (i = 0; i < spec->num_init_verbs; i++)
> -		snd_hda_sequence_write(codec, spec->init_verbs[i]);
> +	snd_hda_sequence_write(codec, spec->chip_init_verbs);
> +	snd_hda_sequence_write(codec, spec->spec_init_verbs);
>  
>  	ca0132_select_out(codec);
>  	ca0132_select_mic(codec);
> @@ -4591,6 +4595,7 @@
>  	snd_hda_sequence_write(codec, spec->base_exit_verbs);
>  	ca0132_exit_chip(codec);
>  	snd_hda_power_down(codec);
> +	kfree(spec->spec_init_verbs);
>  	kfree(codec->spec);
>  }
>  
> @@ -4617,18 +4622,26 @@
>  
>  	spec->num_outputs = 2;
>  	spec->out_pins[0] = 0x0b; /* speaker out */
> -	spec->out_pins[1] = 0x10; /* headphone out */
> +	if (spec->quirk == QUIRK_ALIENWARE) {
> +		codec_dbg(codec, "ca0132_config: QUIRK_ALIENWARE applied.\n");
> +		spec->out_pins[1] = 0x0f;
> +	}
> +	else{
> +		spec->out_pins[1] = 0x10; /* headphone out */
> +	}
>  	spec->shared_out_nid = 0x2;
> +	spec->unsol_tag_hp = spec->out_pins[1];
>  
> -	spec->num_inputs = 3;
>  	spec->adcs[0] = 0x7; /* digital mic / analog mic1 */
>  	spec->adcs[1] = 0x8; /* analog mic2 */
>  	spec->adcs[2] = 0xa; /* what u hear */
> -	spec->shared_mic_nid = 0x7;
>  
> +	spec->num_inputs = 3;
>  	spec->input_pins[0] = 0x12;
>  	spec->input_pins[1] = 0x11;
>  	spec->input_pins[2] = 0x13;
> +	spec->shared_mic_nid = 0x7;
> +	spec->unsol_tag_amic1 = spec->input_pins[0];
>  
>  	/* SPDIF I/O */
>  	spec->dig_out = 0x05;
> @@ -4641,10 +4654,56 @@
>  	cfg->dig_in_type = HDA_PCM_TYPE_SPDIF;
>  }
>  
> +static int ca0132_prepare_verbs(struct hda_codec *codec)
> +{
> +/* Verbs + terminator (an empty element) */
> +#define NUM_SPEC_VERBS 4
> +	struct ca0132_spec *spec = codec->spec;
> +
> +	spec->chip_init_verbs = ca0132_init_verbs0;
> +	spec->spec_init_verbs = kzalloc(sizeof(struct hda_verb) * NUM_SPEC_VERBS, GFP_KERNEL);
> +	if (!spec->spec_init_verbs)
> +		return -ENOMEM;
> +
> +	/* HP jack autodetection */
> +	spec->spec_init_verbs[0].nid = spec->unsol_tag_hp;
> +	spec->spec_init_verbs[0].param = AC_VERB_SET_UNSOLICITED_ENABLE;
> +	spec->spec_init_verbs[0].verb = AC_USRSP_EN | spec->unsol_tag_hp;
> +
> +	/* MIC1 jack autodetection */
> +	spec->spec_init_verbs[1].nid = spec->unsol_tag_amic1;
> +	spec->spec_init_verbs[1].param = AC_VERB_SET_UNSOLICITED_ENABLE;
> +	spec->spec_init_verbs[1].verb = AC_USRSP_EN | spec->unsol_tag_amic1;
> +
> +	/* config EAPD */
> +	spec->spec_init_verbs[2].nid = 0x0b;
> +	spec->spec_init_verbs[2].param = 0x78D;
> +	spec->spec_init_verbs[2].verb = 0x00;
> +
> +	/* Previously commented configuration */
> +	/*
> +	spec->spec_init_verbs[3].nid = 0x0b;
> +	spec->spec_init_verbs[3].param = AC_VERB_SET_EAPD_BTLENABLE;
> +	spec->spec_init_verbs[3].verb = 0x02;
> +
> +	spec->spec_init_verbs[4].nid = 0x10;
> +	spec->spec_init_verbs[4].param = 0x78D;
> +	spec->spec_init_verbs[4].verb = 0x02;
> +
> +	spec->spec_init_verbs[5].nid = 0x10;
> +	spec->spec_init_verbs[5].param = AC_VERB_SET_EAPD_BTLENABLE;
> +	spec->spec_init_verbs[5].verb = 0x02;
> +	*/
> +
> +	/* Terminator: spec->spec_init_verbs[NUM_SPEC_VERBS-1] */
> +	return 0;
> +}
> +
>  static int patch_ca0132(struct hda_codec *codec)
>  {
>  	struct ca0132_spec *spec;
>  	int err;
> +	const struct snd_pci_quirk *quirk;
>  
>  	codec_dbg(codec, "patch_ca0132\n");
>  
> @@ -4654,15 +4713,19 @@
>  	codec->spec = spec;
>  	spec->codec = codec;
>  
> +	/* Detect codec quirk */
> +	quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks);
> +	if (quirk)
> +		spec->quirk = quirk->value;
> +	else
> +		spec->quirk = QUIRK_NONE;
> +
>  	spec->dsp_state = DSP_DOWNLOAD_INIT;
>  	spec->num_mixers = 1;
>  	spec->mixers[0] = ca0132_mixer;
>  
>  	spec->base_init_verbs = ca0132_base_init_verbs;
>  	spec->base_exit_verbs = ca0132_base_exit_verbs;
> -	spec->init_verbs[0] = ca0132_init_verbs0;
> -	spec->init_verbs[1] = ca0132_init_verbs1;
> -	spec->num_init_verbs = 2;
>  
>  	INIT_DELAYED_WORK(&spec->unsol_hp_work, ca0132_unsol_hp_delayed);
>  
> @@ -4670,6 +4733,10 @@
>  
>  	ca0132_config(codec);
>  
> +	err = ca0132_prepare_verbs(codec);
> +	if (err < 0)
> +		return err;
> +
>  	err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL);
>  	if (err < 0)
>  		return err;
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

end of thread, other threads:[~2015-05-19  4:59 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-25  0:50 Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX Gabriele Martino
2015-04-27  9:09 ` Takashi Iwai
2015-04-27 18:08   ` Gabriele Martino
2015-04-27 18:51     ` Takashi Iwai
2015-04-27 22:17       ` Gabriele Martino
2015-04-28  6:15         ` Takashi Iwai
2015-04-28 22:47           ` Gabriele Martino
2015-04-29 13:38             ` Takashi Iwai
2015-04-29 15:42               ` Gabriele Martino
2015-04-29 18:42                 ` Takashi Iwai
2015-04-29 23:40                   ` Gabriele Martino
2015-04-30  5:51                     ` Takashi Iwai
2015-05-01  0:36                       ` Gabriele Martino
2015-05-03 23:53                       ` Gabriele Martino
2015-05-04 12:30                         ` Takashi Iwai
2015-05-04 23:28                           ` Gabriele Martino
2015-05-11 20:17                           ` Gabriele Martino
2015-05-18  9:39                             ` Takashi Iwai
2015-05-18 19:15                               ` Gabriele Martino
2015-05-19  4:59                                 ` Takashi Iwai
2015-04-29 13:40             ` 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.