At Thu, 19 Mar 2015 11:51:23 +0100, Takashi Iwai wrote:
At Thu, 19 Mar 2015 16:40:18 +0800, Jie Yang wrote:
From: Liam Girdwood liam.r.girdwood@linux.intel.com
Currently the ALSA jack core registers only input devices for each jack registered. These jack input devices are not readable by userspace devices that run as non root.
This patch adds support for additionally registering jack kcontrol devices for every input jack registered. This allows non root userspace to read jack status.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com Modified-by: Jie Yang yang.jie@intel.com Signed-off-by: Jie Yang yang.jie@intel.com Reveiwed-by: Mark Brown broonie@kernel.org
include/sound/control.h | 2 ++ include/sound/jack.h | 2 ++ sound/core/jack.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 91 insertions(+), 2 deletions(-) mode change 100644 => 100755 sound/core/jack.c
diff --git a/include/sound/control.h b/include/sound/control.h index 75f3054..023b70a 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -66,6 +66,7 @@ struct snd_kcontrol_volatile {
struct snd_kcontrol { struct list_head list; /* list of controls */
- struct list_head jack_list; /* list of controls belong to the same jack*/ struct snd_ctl_elem_id id; unsigned int count; /* count of same elements */ snd_kcontrol_info_t *info;
@@ -75,6 +76,7 @@ struct snd_kcontrol { snd_kcontrol_tlv_rw_t *c; const unsigned int *p; } tlv;
- unsigned int jack_bit_idx; /*the corresponding jack type bit index */ unsigned long private_value; void *private_data; void (*private_free)(struct snd_kcontrol *kcontrol);
NAK for these additions. There must be a way to implement without such *generic* additions in kcontrol.
IOW, you can allocate its own record in kctl->private_data. Currently hda_jack.c is the only user of snd_kctl_jack_*(). So, if we remove these callers, we can assign kctl->private_data for jack's own purpose. There you'll allocate own record for keeping tracking the list and bitmap, etc.
Takashi