Tests of the hda-jack branch
Hi Takashi,
I've done some more tests of your branch now, and the new names seems to work for my machine here.
I'm attaching two patches - one adds a "device index" for mapping against pcm devices on HDMI, the other one is a backport for the driver-build tree.
What are your thoughts on how to proceed, when do you think this is ready to be merged into the topic/hda branch?
// David
Quoted 1 line
From
0f14d27ffebf72b636c765e95003c780a1cb8c07Mon Sep 17 00:00:00 2001
From: David Henningsson <[email protected]>
Date: Tue, 29 Nov 2011 19:41:27 +0100
Subject: [PATCH] alsa-driver-build: Make new jack API compile on older
kernels
--- acore/ctljack.c | 4 ++++ pci/hda/hda_jack.c | 3 +++ 2 files changed, 7 insertions(+), 0 deletions(-) create mode 100644 acore/ctljack.c create mode 100644 pci/hda/hda_jack.c
acore/ctljack.c new file +4 -0
@@ -0,0 +1,4 @@ +#define __NO_VERSION__ +#include "adriver.h" +#include "../alsa-kernel/core/ctljack.c" +
pci/hda/hda_jack.c new file +3 -0
@@ -0,0 +1,3 @@ +#include "adriver.h" +#include "../../alsa-kernel/pci/hda/hda_jack.c" +
Signature · 1 line
1.7.5.4
Quoted 1 line
From
4b4c17927eb05b460a9788d9dfc9a03ace5d160eMon Sep 17 00:00:00 2001
From: David Henningsson <[email protected]>
Date: Tue, 29 Nov 2011 20:19:56 +0100
Subject: [PATCH] ALSA: HDA/Jack: Make device indices for HDMI
Make sure we can associate HDMI Jacks with the correct PCM devices.
--- sound/pci/hda/hda_jack.c | 5 +++-- sound/pci/hda/hda_jack.h | 2 +- sound/pci/hda/patch_hdmi.c | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-)
sound/pci/hda/hda_jack.c +3 -2
@@ -210,7 +210,7 @@ EXPORT_SYMBOL_HDA(snd_hda_jack_report_sync);* will have the given name and index. */ int snd_hda_jack_add_kctl (struct hda_codec *codec,hda_nid_t nid, -const char *name,int idx) +const char *name,int idx,int device) {struct hda_jack_tbl *jack;struct snd_kcontrol *kctl;
@@ -223,6 +223,7 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, kctl =snd_kctl_jack_new (name, idx, codec);if (!kctl)return -ENOMEM ; + kctl->id.device = device;if (snd_hda_ctl_add (codec, nid, kctl) <0 )return -ENOMEM ; jack->kctl = kctl;
@@ -249,7 +250,7 @@ static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid,return 0 ;snd_hda_get_pin_label (codec, nid, cfg, name,sizeof (name), &idx); - err =snd_hda_jack_add_kctl (codec, nid, name, idx); + err =snd_hda_jack_add_kctl (codec, nid, name, idx,0 );if (err <0 )return err;return snd_hda_jack_detect_enable (codec, nid,0 );
sound/pci/hda/hda_jack.h +1 -1
@@ -76,7 +76,7 @@ static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) }int snd_hda_jack_add_kctl (struct hda_codec *codec,hda_nid_t nid, -const char *name,int idx); +const char *name,int idx,int device);int snd_hda_jack_add_kctls (struct hda_codec *codec,const struct auto_pin_cfg *cfg);
sound/pci/hda/patch_hdmi.c +2 -1
@@ -1277,7 +1277,8 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)if (err <0 )return err; err =snd_hda_jack_add_kctl (codec, per_pin->pin_nid, -"HDMI" , pin_idx); +"HDMI" , pin_idx, + spec->pcm_rec[pin_idx].device);if (err <0 )return err; }
Signature · 1 line
1.7.5.4
Quoted 2 lines · David Henningsson
What are your thoughts on how to proceed, when do you think this is ready to be merged into the topic/hda branch?
I'm still rather sad that this infrastructure is all totally separate to the existing jack infrastructure, one of the goals of having common infrastructure was to insulate drivers from having to deal with changes in the APIs used for reporting and I certainly don't want to have to have all the drivers individually reporting via all the APIs (especially not with the multiswitch API coming along too).
I've not really reviewed the code beyond noticing that, I'd been waiting for it to turn up on the list.
At Tue, 29 Nov 2011 20:03:51 +0000,
Quoted 6 lines · Mark Brown
Quoted 2 lines · David Henningsson
What are your thoughts on how to proceed, when do you think this is ready to be merged into the topic/hda branch?
Quoted 6 lines
I'm still rather sad that this infrastructure is all totally separate to the existing jack infrastructure, one of the goals of having common infrastructure was to insulate drivers from having to deal with changes in the APIs used for reporting and I certainly don't want to have to have all the drivers individually reporting via all the APIs (especially not with the multiswitch API coming along too).
That'll happen later. I haven't done yet just because I couldn't
spend my time for this in these weeks. I need to complete the feature in HD-audio side at first before breaking all in ASoC.
BTW, how will the multiswitch API look like?
Takashi
Quoted 1 line · Takashi Iwai
BTW, how will the multiswitch API look like?
It's taken the Android switch API as a starting point so the main reporting mechanism is uevents.
Review
Quoted 4 lines · David Henningsson
... two patches - one adds a "device index" for mapping against pcm devices on HDMI,
(quoted diff) +1
-0+ kctl->id.device = device;
In the general case, there is not always a 1:1 mapping between jacks and PCM devices, so I fear that a jack belonging to device 0 cannot be distinguished from a jack that has no specific device.
There is a convention that id.device is a valid PCM device number if and only if id.iface is IFACE_PCM. However, it might be useful to map controls with IFACE_MIXER to PCM devices, so I'd propose a new TLV, like in the incomplete patch below.
Regards,
Clemens
include/sound/tlv.h +6 -0
@@ -37,6 +37,7 @@#define SNDRV_CTL_TLVT_DB_RANGE 3/* dB range container */ #define SNDRV_CTL_TLVT_DB_MINMAX 4/* dB scale with min/max */ #define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5/* dB scale with min/max with mute */ +#define SNDRV_CTL_TLVT_PCM_DEVICE 6/* jack (or other control?) maps to this device */ #define _TLV_ITEM (type, ...) \ (type), _TLV_LENGTH(__VA_ARGS__), __VA_ARGS__
@@ -81,4 +82,9 @@#define TLV_DB_GAIN_MUTE -9999999 +#define TLB_PCM_DEVICE_NUMBER_ITEM (devno) \ + SNDRV_CTL_TLVT_PCM_DEVICE, 1 * sizeof(unsigned int), (devno) +#define DECLARE_TLV_PCM_DEVICE_NUMBER (name, devno) \ + unsigned int name[] = { TLV_PCM_DEVICE_NUMBER_ITEM(devno) } +#endif /* __SOUND_TLV_H */
sound/pci/hda/hda_jack.c +8 -2
@@ -15,6 +15,7 @@#include <sound/core.h> #include <sound/control.h> #include <sound/jack.h> +#include <sound/tlv.h> #include "hda_codec.h" #include "hda_local.h" #include "hda_jack.h"
@@ -210,7 +211,7 @@ EXPORT_SYMBOL_HDA(snd_hda_jack_report_sync);* will have the given name and index. */ int snd_hda_jack_add_kctl (struct hda_codec *codec,hda_nid_t nid, -const char *name,int idx) +const char *name,int idx,int device) {struct hda_jack_tbl *jack;struct snd_kcontrol *kctl;
@@ -223,6 +224,11 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, kctl =snd_kctl_jack_new (name, idx, codec);if (!kctl)return -ENOMEM ; + jack->tlv[0 ] =SNDRV_CTL_TLVT_PCM_DEVICE ; + jack->tlv[1 ] =1 *sizeof (unsigned int ); + jack->tlv[2 ] = device; + kctl->tlv.p = jack->tlv; + kctl->access |=SNDRV_CTL_ELEM_ACCESS_TLV_READ ;if (snd_hda_ctl_add (codec, nid, kctl) <0 )return -ENOMEM ; jack->kctl = kctl;
@@ -249,7 +255,7 @@ static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid,return 0 ;snd_hda_get_pin_label (codec, nid, cfg, name,sizeof (name), &idx); - err =snd_hda_jack_add_kctl (codec, nid, name, idx); + err =snd_hda_jack_add_kctl (codec, nid, name, idx,0 );if (err <0 )return err;return snd_hda_jack_detect_enable (codec, nid,0 );
sound/pci/hda/hda_jack.h +2 -1
@@ -22,6 +22,7 @@ struct hda_jack_tbl { unsigned int jack_detect:1; /* capable of jack-detection? */ unsigned int jack_dirty:1; /* needs to update? */struct snd_kcontrol *kctl;/* assigned kctl for jack-detection */ +unsigned int tlv[3 ];#ifdef CONFIG_SND_HDA_INPUT_JACK int type;struct snd_jack *jack;
@@ -76,7 +77,7 @@ static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) }int snd_hda_jack_add_kctl (struct hda_codec *codec,hda_nid_t nid, -const char *name,int idx); +const char *name,int idx,int device);int snd_hda_jack_add_kctls (struct hda_codec *codec,const struct auto_pin_cfg *cfg);
2011/11/30 Clemens Ladisch <[email protected]>:
Quoted 91 lines
Quoted 4 lines · David Henningsson
... two patches - one adds a "device index" for mapping against pcm devices on HDMI,
+
kctl->id.device= device;In the general case, there is not always a 1:1 mapping between jacks and PCM devices, so I fear that a jack belonging to device 0 cannot be distinguished from a jack that has no specific device.
There is a convention that id.device is a valid PCM device number if and only if id.iface is
IFACE_PCM. However, it might be useful to map controls withIFACE_MIXERto PCM devices, so I'd propose a new TLV, like in the incomplete patch below.Regards,
Clemensinclude/sound/tlv.h +1
-0@@ -37,6 +37,7 @@ #define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */ #define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */ #define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */ +#define SNDRV_CTL_TLVT_PCM_DEVICE 6/* jack (or other control?) maps to this device */ #define _TLV_ITEM(type, ...) \(type),
_TLV_LENGTH(__VA_ARGS__),__VA_ARGS__include/sound/tlv.h +5
-0@@ -81,4 +82,9 @@ #define TLV_DB_GAIN_MUTE -9999999 +#define TLB_PCM_DEVICE_NUMBER_ITEM (devno) \ + SNDRV_CTL_TLVT_PCM_DEVICE, 1 * sizeof(unsigned int), (devno) +#define DECLARE_TLV_PCM_DEVICE_NUMBER (name, devno) \ + unsigned int name[] = { TLV_PCM_DEVICE_NUMBER_ITEM(devno) } + #endif /* __SOUND_TLV_H */sound/pci/hda/hda_jack.c +8
-2@@ -15,6 +15,7 @@ #include <sound/core.h> #include <sound/control.h> #include <sound/jack.h> +#include <sound/tlv.h> #include "hda_codec.h" #include "hda_local.h" #include "hda_jack.h"@@ -210,7 +211,7 @@ EXPORT_SYMBOL_HDA(snd_hda_jack_report_sync);* will have the given name and index. */ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, - const char *name, int idx) + const char *name, int idx, int device) { struct hda_jack_tbl *jack; struct snd_kcontrol *kctl;@@ -223,6 +224,11 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, kctl = snd_kctl_jack_new(name, idx, codec); if (!kctl) return -ENOMEM; + jack->tlv[0] = SNDRV_CTL_TLVT_PCM_DEVICE; + jack->tlv[1] = 1 * sizeof(unsigned int); + jack->tlv[2] = device; + kctl->tlv.p = jack->tlv; + kctl->access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; if (snd_hda_ctl_add(codec, nid, kctl) < 0) return -ENOMEM; jack->kctl = kctl;@@ -249,7 +255,7 @@ static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid, return 0; snd_hda_get_pin_label(codec, nid, cfg, name, sizeof(name), &idx); - err = snd_hda_jack_add_kctl(codec, nid, name, idx); + err = snd_hda_jack_add_kctl(codec, nid, name, idx, 0); if (err < 0) return err; return snd_hda_jack_detect_enable(codec, nid, 0);sound/pci/hda/hda_jack.h +0
-0@@ -22,6 +22,7 @@ struct hda_jack_tbl {unsigned int jack_detect:1; /* capable of jack-detection? */ unsigned int jack_dirty:1; /* needs to update? */ struct
snd_kcontrol*kctl; /* assigned kctl for jack-detection */
+ unsigned int tlv[3];
#ifdefCONFIG_SND_HDA_INPUT_JACK
int type;
structsnd_jack*jack;
sound/pci/hda/hda_jack.h static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) · line 83
Quoted 8 lines
sound/pci/hda/hda_jack.h +1
-1@@ -76,7 +77,7 @@ static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) } int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, - const char *name, int idx); + const char *name, int idx, int device); int snd_hda_jack_add_kctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg);
Does this solve the problem of selecting the correct capture source when the codec have more than one adc
1) realek codec with two adc , capture and alt_capture device
ARECORD
**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 2: ALC892 Analog [ALC892 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
Simple mixer control 'Input Source',0
Capabilities: cenum
Items: 'Mic' 'Internal Mic' 'Line'
Item0: 'Internal Mic'
Simple mixer control 'Input Source',1
Capabilities: cenum
Items: 'Mic' 'Internal Mic' 'Line'
Item0: 'Mic'
2) ad198x codec with 3 adc and 3 capture subdevices
Line-Out Front Jack
Line-Out Surround Jack
Line-Out CLFE Jack
Line-Out Side Jack
Front Headphone Jack
Front Mic Jack
Rear Mic Jack
Line Jack
card 1: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]
Subdevices: 3/3
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Simple mixer control 'Input Source',0
Capabilities: cenum
Items: 'Mix' 'Front Mic' 'Rear Mic' 'Line' 'CD'
Item0: 'Front Mic'
Simple mixer control 'Input Source',1
Capabilities: cenum
Items: 'Mix' 'Front Mic' 'Rear Mic' 'Line' 'CD'
Item0: 'Front Mic'
Simple mixer control 'Input Source',2
Capabilities: cenum
Items: 'Mix' 'Front Mic' 'Rear Mic' 'Line' 'CD'
Item0: 'Line'
Quoted 10 lines · Clemens Ladisch
Review
Quoted 4 lines · David Henningsson
... two patches - one adds a "device index" for mapping against pcm devices on HDMI,
(quoted diff) +1
-0+ kctl->id.device = device;In the general case, there is not always a 1:1 mapping between jacks and PCM devices, so I fear that a jack belonging to device 0 cannot be distinguished from a jack that has no specific device.
Quoted 3 lines
There is a convention that id.device is a valid PCM device number if and only if id.iface is
IFACE_PCM. However, it might be useful to map controls withIFACE_MIXERto PCM devices, so I'd propose a new TLV,
Er, the point was for the TLV to be optional; please ignore the previous patch. :)
--8<---------------------------------------------------------------->8--
ALSA: hda/jack: add PCM device TLV for jack controls
Allow to add a new TLV to jack kcontrols so that HDMI jacks can be associated with the correct PCM devices.
--- include/sound/tlv.h | 6 ++++++ sound/pci/hda/hda_jack.c | 12 ++++++++++-- sound/pci/hda/hda_jack.h | 3 ++- sound/pci/hda/patch_hdmi.c | 3 ++- 4 files changed, 20 insertions(+), 4 deletions(-)
include/sound/tlv.h +6 -0
@@ -37,6 +37,7 @@#define SNDRV_CTL_TLVT_DB_RANGE 3/* dB range container */ #define SNDRV_CTL_TLVT_DB_MINMAX 4/* dB scale with min/max */ #define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5/* dB scale with min/max with mute */ +#define SNDRV_CTL_TLVT_PCM_DEVICE 6/* (jack) control maps to this device */ #define TLV_DB_SCALE_MASK 0xffff#define TLV_DB_SCALE_MUTE 0x10000
@@ -73,4 +74,9 @@#define TLV_DB_GAIN_MUTE -9999999 +#define TLV_PCM_DEVICE_NUMBER_ITEM (devno) \ + SNDRV_CTL_TLVT_PCM_DEVICE, 1 * sizeof(unsigned int), (devno) +#define DECLARE_TLV_PCM_DEVICE_NUMBER (name, devno) \ + unsigned int name[] = { TLV_PCM_DEVICE_NUMBER_ITEM(devno) } +#endif /* __SOUND_TLV_H */
sound/pci/hda/hda_jack.c +10 -2
@@ -15,6 +15,7 @@#include <sound/core.h> #include <sound/control.h> #include <sound/jack.h> +#include <sound/tlv.h> #include "hda_codec.h" #include "hda_local.h" #include "hda_jack.h"
@@ -210,7 +211,7 @@ EXPORT_SYMBOL_HDA(snd_hda_jack_report_sync);* will have the given name and index. */ int snd_hda_jack_add_kctl (struct hda_codec *codec,hda_nid_t nid, -const char *name,int idx) +const char *name,int idx,int device) {struct hda_jack_tbl *jack;struct snd_kcontrol *kctl;
@@ -223,6 +224,13 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, kctl =snd_kctl_jack_new (name, idx, codec);if (!kctl)return -ENOMEM ; +if (device >=0 ) { + jack->tlv[0 ] =SNDRV_CTL_TLVT_PCM_DEVICE ; + jack->tlv[1 ] =1 *sizeof (unsigned int ); + jack->tlv[2 ] = device; + kctl->tlv.p = jack->tlv; + kctl->vd[0 ].access |=SNDRV_CTL_ELEM_ACCESS_TLV_READ ; + }if (snd_hda_ctl_add (codec, nid, kctl) <0 )return -ENOMEM ; jack->kctl = kctl;
@@ -249,7 +257,7 @@ static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid,return 0 ;snd_hda_get_pin_label (codec, nid, cfg, name,sizeof (name), &idx); - err =snd_hda_jack_add_kctl (codec, nid, name, idx); + err =snd_hda_jack_add_kctl (codec, nid, name, idx,-1 );if (err <0 )return err;return snd_hda_jack_detect_enable (codec, nid,0 );
sound/pci/hda/hda_jack.h +2 -1
@@ -22,6 +22,7 @@ struct hda_jack_tbl { unsigned int jack_detect:1; /* capable of jack-detection? */ unsigned int jack_dirty:1; /* needs to update? */struct snd_kcontrol *kctl;/* assigned kctl for jack-detection */ +unsigned int tlv[3 ];#ifdef CONFIG_SND_HDA_INPUT_JACK int type;struct snd_jack *jack;
@@ -76,7 +77,7 @@ static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) }int snd_hda_jack_add_kctl (struct hda_codec *codec,hda_nid_t nid, -const char *name,int idx); +const char *name,int idx,int device);int snd_hda_jack_add_kctls (struct hda_codec *codec,const struct auto_pin_cfg *cfg);
sound/pci/hda/patch_hdmi.c +2 -1
@@ -1277,7 +1277,8 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)if (err <0 )return err; err =snd_hda_jack_add_kctl (codec, per_pin->pin_nid, -"HDMI" , pin_idx); +"HDMI" , pin_idx, + spec->pcm_rec[pin_idx].device);if (err <0 )return err; }
At Tue, 29 Nov 2011 21:51:45 +0100,
Quoted 10 lines · Clemens Ladisch
Review
Quoted 4 lines · David Henningsson
... two patches - one adds a "device index" for mapping against pcm devices on HDMI,
(quoted diff) +1
-0+ kctl->id.device = device;In the general case, there is not always a 1:1 mapping between jacks and PCM devices, so I fear that a jack belonging to device 0 cannot be distinguished from a jack that has no specific device.
Hm, a good point.
Quoted 4 lines
There is a convention that id.device is a valid PCM device number if and only if id.iface is
IFACE_PCM. However, it might be useful to map controls withIFACE_MIXERto PCM devices, so I'd propose a new TLV, like in the incomplete patch below.
Yes, I had a similar idea. My original idea was to implement PCM mappings like this and dependency-mapping between control elements (e.g. master -> front -> speaker) via TLV.
Takashi
Quoted 85 lines
Regards,
Clemensinclude/sound/tlv.h +6
-0@@ -37,6 +37,7 @@#define SNDRV_CTL_TLVT_DB_RANGE 3/* dB range container */ #define SNDRV_CTL_TLVT_DB_MINMAX 4/* dB scale with min/max */ #define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5/* dB scale with min/max with mute */ +#define SNDRV_CTL_TLVT_PCM_DEVICE 6/* jack (or other control?) maps to this device */ #define _TLV_ITEM (type, ...) \ (type), _TLV_LENGTH(__VA_ARGS__), __VA_ARGS__@@ -81,4 +82,9 @@#define TLV_DB_GAIN_MUTE -9999999 +#define TLB_PCM_DEVICE_NUMBER_ITEM (devno) \ + SNDRV_CTL_TLVT_PCM_DEVICE, 1 * sizeof(unsigned int), (devno) +#define DECLARE_TLV_PCM_DEVICE_NUMBER (name, devno) \ + unsigned int name[] = { TLV_PCM_DEVICE_NUMBER_ITEM(devno) } +#endif /* __SOUND_TLV_H */ sound/pci/hda/hda_jack.c +8
-2@@ -15,6 +15,7 @@#include <sound/core.h> #include <sound/control.h> #include <sound/jack.h> +#include <sound/tlv.h> #include "hda_codec.h" #include "hda_local.h" #include "hda_jack.h" @@ -210,7 +211,7 @@ EXPORT_SYMBOL_HDA(snd_hda_jack_report_sync);* will have the given name and index. */ int snd_hda_jack_add_kctl (struct hda_codec *codec,hda_nid_t nid, -const char *name,int idx) +const char *name,int idx,int device) {struct hda_jack_tbl *jack;struct snd_kcontrol *kctl;@@ -223,6 +224,11 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, kctl =snd_kctl_jack_new (name, idx, codec);if (!kctl)return -ENOMEM ; + jack->tlv[0 ] =SNDRV_CTL_TLVT_PCM_DEVICE ; + jack->tlv[1 ] =1 *sizeof (unsigned int ); + jack->tlv[2 ] = device; + kctl->tlv.p = jack->tlv; + kctl->access |=SNDRV_CTL_ELEM_ACCESS_TLV_READ ;if (snd_hda_ctl_add (codec, nid, kctl) <0 )return -ENOMEM ; jack->kctl = kctl;@@ -249,7 +255,7 @@ static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid,return 0 ;snd_hda_get_pin_label (codec, nid, cfg, name,sizeof (name), &idx); - err =snd_hda_jack_add_kctl (codec, nid, name, idx); + err =snd_hda_jack_add_kctl (codec, nid, name, idx,0 );if (err <0 )return err;return snd_hda_jack_detect_enable (codec, nid,0 );sound/pci/hda/hda_jack.h +2
-1@@ -22,6 +22,7 @@ struct hda_jack_tbl { unsigned int jack_detect:1; /* capable of jack-detection? */ unsigned int jack_dirty:1; /* needs to update? */struct snd_kcontrol *kctl;/* assigned kctl for jack-detection */ +unsigned int tlv[3 ];#ifdef CONFIG_SND_HDA_INPUT_JACK int type;struct snd_jack *jack;@@ -76,7 +77,7 @@ static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) }int snd_hda_jack_add_kctl (struct hda_codec *codec,hda_nid_t nid, -const char *name,int idx); +const char *name,int idx,int device);int snd_hda_jack_add_kctls (struct hda_codec *codec,const struct auto_pin_cfg *cfg);
2011/11/30 David Henningsson <[email protected]>:
Quoted 5 lines
Hi Takashi,
I've done some more tests of your branch now, and the new names seems to work for my machine here.
Quoted 8 lines
I'm attaching two patches - one adds a "device index" for mapping against pcm devices on HDMI, the other one is a backport for the driver-build tree.
What are your thoughts on how to proceed, when do you think this is ready to be merged into the topic/hda branch?
// David
Does it handle "Independent HP" ?
VIA codecs
----------
* Independent HP
When this enum control is enabled, the headphone output is routed from an individual stream (the third PCM such as hw:0,2) instead of the primary stream. In the case the headphone DAC is shared with a side or a CLFE-channel DAC, the DAC is switched to the headphone automatically.
Analog codecs
--------------
* Independent HP
When this enum control is enabled, the headphone output is routed from an individual stream (the third PCM such as hw:0,2) instead of the primary stream.
Quoted 12 lines · Raymond Yau
2011/11/30 David Henningsson<[email protected]>:
Quoted 11 lines
Hi Takashi,
I've done some more tests of your branch now, and the new names seems to work for my machine here.
I'm attaching two patches - one adds a "device index" for mapping against pcm devices on HDMI, the other one is a backport for the driver-build tree.
What are your thoughts on how to proceed, when do you think this is ready to be merged into the topic/hda branch?
Quoted 6 lines
Quoted 2 lines
// David
Does it handle "Independent HP" ?
Not currently, my patch is concerned with HDMI only.
You're correct in that if "Independent HP" is on, it wouldn't hurt for the Headphone jack to also have such a device index.
Signature · 2 lines
David Henningsson, Canonical Ltd. http://launchpad.net/~diwic
At Tue, 29 Nov 2011 20:43:06 +0100,
Quoted 9 lines · David Henningsson
Hi Takashi,
I've done some more tests of your branch now, and the new names seems to work for my machine here.
I'm attaching two patches - one adds a "device index" for mapping against pcm devices on HDMI, the other one is a backport for the driver-build tree.
Thanks, the alsa-driver-build one was already found in alsa-driver-build-unstable tree. Actually the branch is included in sound-unstable tree, too.
Quoted 2 lines
What are your thoughts on how to proceed, when do you think this is ready to be merged into the topic/hda branch?
We still need to think of PCM and control-NID mapping. At least, decide what to be done.
thanks,
Takashi
Quoted 118 lines
// David
[2 0001-alsa-driver-build-Make-new-jack-API-compile-on-older.patch <text/x-patch (7bit)>]
Quoted 1 line
From
0f14d27ffebf72b636c765e95003c780a1cb8c07Mon Sep 17 00:00:00 2001From: David Henningsson <[email protected]>
Date: Tue, 29 Nov 2011 19:41:27 +0100
Subject: [PATCH] alsa-driver-build: Make new jack API compile on older
kernelsSigned-off-by David Henningsson <[email protected]>--- acore/ctljack.c | 4 ++++ pci/hda/hda_jack.c | 3 +++ 2 files changed, 7 insertions(+), 0 deletions(-) create mode 100644 acore/ctljack.c create mode 100644 pci/hda/hda_jack.cacore/ctljack.c new file +4
-0@@ -0,0 +1,4 @@ +#define __NO_VERSION__ +#include "adriver.h" +#include "../alsa-kernel/core/ctljack.c" +pci/hda/hda_jack.c new file +3
-0@@ -0,0 +1,3 @@ +#include "adriver.h" +#include "../../alsa-kernel/pci/hda/hda_jack.c" +Signature · 5 lines
1.7.5.4 [3 0001-ALSA-HDA-Jack-Make-device-indices-for-HDMI.patch <text/x-patch (7bit)>]Quoted 1 line
From
4b4c17927eb05b460a9788d9dfc9a03ace5d160eMon Sep 17 00:00:00 2001From: David Henningsson <[email protected]>
Date: Tue, 29 Nov 2011 20:19:56 +0100
Subject: [PATCH] ALSA: HDA/Jack: Make device indices for HDMIMake sure we can associate HDMI Jacks with the correct PCM devices.
Signed-off-by David Henningsson <[email protected]>--- sound/pci/hda/hda_jack.c | 5 +++-- sound/pci/hda/hda_jack.h | 2 +- sound/pci/hda/patch_hdmi.c | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-)sound/pci/hda/hda_jack.c +3
-2@@ -210,7 +210,7 @@ EXPORT_SYMBOL_HDA(snd_hda_jack_report_sync);* will have the given name and index. */ int snd_hda_jack_add_kctl (struct hda_codec *codec,hda_nid_t nid, -const char *name,int idx) +const char *name,int idx,int device) {struct hda_jack_tbl *jack;struct snd_kcontrol *kctl;@@ -223,6 +223,7 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, kctl =snd_kctl_jack_new (name, idx, codec);if (!kctl)return -ENOMEM ; + kctl->id.device = device;if (snd_hda_ctl_add (codec, nid, kctl) <0 )return -ENOMEM ; jack->kctl = kctl;@@ -249,7 +250,7 @@ static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid,return 0 ;snd_hda_get_pin_label (codec, nid, cfg, name,sizeof (name), &idx); - err =snd_hda_jack_add_kctl (codec, nid, name, idx); + err =snd_hda_jack_add_kctl (codec, nid, name, idx,0 );if (err <0 )return err;return snd_hda_jack_detect_enable (codec, nid,0 );sound/pci/hda/hda_jack.h +1
-1@@ -76,7 +76,7 @@ static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) }int snd_hda_jack_add_kctl (struct hda_codec *codec,hda_nid_t nid, -const char *name,int idx); +const char *name,int idx,int device);int snd_hda_jack_add_kctls (struct hda_codec *codec,const struct auto_pin_cfg *cfg);sound/pci/hda/patch_hdmi.c +2
-1@@ -1277,7 +1277,8 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)if (err <0 )return err; err =snd_hda_jack_add_kctl (codec, per_pin->pin_nid, -"HDMI" , pin_idx); +"HDMI" , pin_idx, + spec->pcm_rec[pin_idx].device);if (err <0 )return err; }Signature · 1 line
1.7.5.4