From: Takashi Iwai Subject: Re: [PATCH] ALSA: jack: create jack kcontrols for every jack input device Date: Thu, 19 Mar 2015 13:01:30 +0100 Message-ID: References: <1426754418-13477-1-git-send-email-yang.jie@intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id EA5EC260417 for ; Thu, 19 Mar 2015 13:01:31 +0100 (CET) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Jie Yang Cc: Liam Girdwood , alsa-devel@alsa-project.org, broonie@kernel.org, liam.r.girdwood@intel.com List-Id: alsa-devel@alsa-project.org 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 > > > > 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 > > Modified-by: Jie Yang > > Signed-off-by: Jie Yang > > Reveiwed-by: Mark Brown > > --- > > 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