aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/jack.h
diff options
context:
space:
mode:
authorJie Yang <yang.jie@intel.com>2015-04-27 09:20:56 -0400
committerTakashi Iwai <tiwai@suse.de>2015-04-27 15:37:40 -0400
commit9058cbe1eed29381f84dec9f96980f5a4ea1025f (patch)
treea2b6d9a24d69014b3dbec47acd1a9f3369b4ce3b /include/sound/jack.h
parentb787f68c36d49bb1d9236f403813641efa74a031 (diff)
ALSA: jack: implement kctl creating for jack devices
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 series will implement kctls inside the core jack part, including kctls creating, status changing report, for both HD-Audio and ASoC jack. This allows non root userspace to read jack status and act on it. This patch adds a new API called snd_jack_add_new_kctl(), which will create a kcontrol, add it to the card, and also attach it to the jack kctl list. This patch also initialises the jack kctl list after jack is newed, and reports kctl status when jack insertion/removal events occur. snd_jack_new() is updated in the following patches to also support creating phantom jacks and jack kcontrols. We then remove these duplicated features from HDA jack and have jack kctls handled by core throughout HDA and ASoC. 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> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound/jack.h')
-rw-r--r--include/sound/jack.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/sound/jack.h b/include/sound/jack.h
index 218235030ebc..433b13b89125 100644
--- a/include/sound/jack.h
+++ b/include/sound/jack.h
@@ -73,6 +73,8 @@ enum snd_jack_types {
73 73
74struct snd_jack { 74struct snd_jack {
75 struct input_dev *input_dev; 75 struct input_dev *input_dev;
76 struct list_head kctl_list;
77 struct snd_card *card;
76 int registered; 78 int registered;
77 int type; 79 int type;
78 const char *id; 80 const char *id;
@@ -86,6 +88,7 @@ struct snd_jack {
86 88
87int snd_jack_new(struct snd_card *card, const char *id, int type, 89int snd_jack_new(struct snd_card *card, const char *id, int type,
88 struct snd_jack **jack); 90 struct snd_jack **jack);
91int snd_jack_add_new_kctl(struct snd_jack *jack, const char * name, int mask);
89void snd_jack_set_parent(struct snd_jack *jack, struct device *parent); 92void snd_jack_set_parent(struct snd_jack *jack, struct device *parent);
90int snd_jack_set_key(struct snd_jack *jack, enum snd_jack_types type, 93int snd_jack_set_key(struct snd_jack *jack, enum snd_jack_types type,
91 int keytype); 94 int keytype);
@@ -93,13 +96,17 @@ int snd_jack_set_key(struct snd_jack *jack, enum snd_jack_types type,
93void snd_jack_report(struct snd_jack *jack, int status); 96void snd_jack_report(struct snd_jack *jack, int status);
94 97
95#else 98#else
96
97static inline int snd_jack_new(struct snd_card *card, const char *id, int type, 99static inline int snd_jack_new(struct snd_card *card, const char *id, int type,
98 struct snd_jack **jack) 100 struct snd_jack **jack)
99{ 101{
100 return 0; 102 return 0;
101} 103}
102 104
105static inline int snd_jack_add_new_kctl(struct snd_jack *jack, const char * name, int mask)
106{
107 return 0;
108}
109
103static inline void snd_jack_set_parent(struct snd_jack *jack, 110static inline void snd_jack_set_parent(struct snd_jack *jack,
104 struct device *parent) 111 struct device *parent)
105{ 112{