[alsa-devel] [PATCH] ALSA: jack: create jack kcontrols for every jack input device

Jie, Yang yang.jie at intel.com
Thu Mar 19 14:53:17 CET 2015


> -----Original Message-----
> From: Takashi Iwai [mailto:tiwai at suse.de]
> Sent: Thursday, March 19, 2015 6:51 PM
> To: Jie, Yang
> Cc: perex at perex.cz; broonie at kernel.org; alsa-devel at alsa-project.org;
> Girdwood, Liam R; Liam Girdwood
> Subject: Re: [PATCH] ALSA: jack: create jack kcontrols for every jack input
> device
> 
> At Thu, 19 Mar 2015 16:40:18 +0800,
> Jie Yang wrote:
> >
> > From: Liam Girdwood <liam.r.girdwood at 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 at linux.intel.com>
> > Modified-by: Jie Yang <yang.jie at intel.com>
> > Signed-off-by: Jie Yang <yang.jie at intel.com>
> > Reveiwed-by: Mark Brown <broonie at 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.
[Keyon] how about define another struct jack_kcontrol in jack.h like below?

struct jack_kcontrol {
	struct snd_kcontrol * kctl;
	struct list_head jack_list;		/* list of controls belong to
 the same jack*/
	unsigned int jack_bit_idx;	/*the corresponding jack type bit
 index */
}

> 
> 
> Takashi


More information about the Alsa-devel mailing list