diff mbox

[v6,4/6] ASoC: jack: create kctls according to jack pins info

Message ID 1429351460-15932-5-git-send-email-yang.jie@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jie, Yang April 18, 2015, 10:04 a.m. UTC
In the new jack kctls design, we can create kctls according to
pins info:

1. during jack creating, snd_jack_new() with NULL jack_kctl;
2. for each pin, call snd_jack_add_kctls() to add one kctl
(it will call snd_ctl_add() to add kctl to card);

Signed-off-by: Jie Yang <yang.jie@intel.com>
---
 sound/soc/soc-jack.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mark Brown April 20, 2015, 9:20 p.m. UTC | #1
On Sat, Apr 18, 2015 at 06:04:18PM +0800, Jie Yang wrote:
> In the new jack kctls design, we can create kctls according to
> pins info:
> 
> 1. during jack creating, snd_jack_new() with NULL jack_kctl;
> 2. for each pin, call snd_jack_add_kctls() to add one kctl
> (it will call snd_ctl_add() to add kctl to card);

I'm a little confused why this isn't done by the jack core?
Jie, Yang April 21, 2015, 1:16 a.m. UTC | #2
> -----Original Message-----
> From: Mark Brown [mailto:broonie@kernel.org]
> Sent: Tuesday, April 21, 2015 5:21 AM
> To: Jie, Yang
> Cc: tiwai@suse.de; alsa-devel@alsa-project.org; Girdwood, Liam R;
> tanu.kaskinen@linux.intel.com
> Subject: Re: [PATCH v6 4/6] ASoC: jack: create kctls according to jack pins info
> 
> On Sat, Apr 18, 2015 at 06:04:18PM +0800, Jie Yang wrote:
> > In the new jack kctls design, we can create kctls according to pins
> > info:
> >
> > 1. during jack creating, snd_jack_new() with NULL jack_kctl; 2. for
> > each pin, call snd_jack_add_kctls() to add one kctl (it will call
> > snd_ctl_add() to add kctl to card);
> 
> I'm a little confused why this isn't done by the jack core?
 
The kctl creating and adding to jack is actually done by the jack core(inside
snd_jack_add_kctls()).

Mark, do you mean that you prefer doing this inside snd_jack_new()?

For we may need create multiple kctls for a jack, and I found we can reuse
the pins' info for those kctls' creating. 

For example, in broadwell.c, the jack broadwell_headset have 2 pins:
"Mic Jack" and "Headphone Jack", then 2 kctls with same names will be
created, and they are visible for PA, can be switched on/off by PA separately.

~Keyon
diff mbox

Patch

diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index 836368b..44b3c8c 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -197,6 +197,7 @@  int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
 
 		INIT_LIST_HEAD(&pins[i].list);
 		list_add(&(pins[i].list), &jack->pins);
+		snd_jack_add_new_kctls(jack->jack, pins[i].pin, pins[i].mask);
 	}
 
 	/* Update to reflect the last reported status; canned jack