diff options
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/soc-dapm.h | 23 | ||||
-rw-r--r-- | include/sound/soc.h | 52 |
2 files changed, 54 insertions, 21 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 4af1083e3287..bb3a863ad14e 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -76,6 +76,11 @@ | |||
76 | wcontrols, wncontrols)\ | 76 | wcontrols, wncontrols)\ |
77 | { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ | 77 | { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ |
78 | .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols} | 78 | .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols} |
79 | #define SND_SOC_DAPM_MIXER_NAMED_CTL(wname, wreg, wshift, winvert, \ | ||
80 | wcontrols, wncontrols)\ | ||
81 | { .id = snd_soc_dapm_mixer_named_ctl, .name = wname, .reg = wreg, \ | ||
82 | .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \ | ||
83 | .num_kcontrols = wncontrols} | ||
79 | #define SND_SOC_DAPM_MICBIAS(wname, wreg, wshift, winvert) \ | 84 | #define SND_SOC_DAPM_MICBIAS(wname, wreg, wshift, winvert) \ |
80 | { .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \ | 85 | { .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \ |
81 | .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0} | 86 | .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0} |
@@ -101,6 +106,11 @@ | |||
101 | { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ | 106 | { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ |
102 | .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \ | 107 | .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \ |
103 | .event = wevent, .event_flags = wflags} | 108 | .event = wevent, .event_flags = wflags} |
109 | #define SND_SOC_DAPM_MIXER_NAMED_CTL_E(wname, wreg, wshift, winvert, \ | ||
110 | wcontrols, wncontrols, wevent, wflags) \ | ||
111 | { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ | ||
112 | .invert = winvert, .kcontrols = wcontrols, \ | ||
113 | .num_kcontrols = wncontrols, .event = wevent, .event_flags = wflags} | ||
104 | #define SND_SOC_DAPM_MICBIAS_E(wname, wreg, wshift, winvert, wevent, wflags) \ | 114 | #define SND_SOC_DAPM_MICBIAS_E(wname, wreg, wshift, winvert, wevent, wflags) \ |
105 | { .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \ | 115 | { .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \ |
106 | .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0, \ | 116 | .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0, \ |
@@ -108,7 +118,7 @@ | |||
108 | #define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \ | 118 | #define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \ |
109 | wevent, wflags) \ | 119 | wevent, wflags) \ |
110 | { .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \ | 120 | { .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \ |
111 | .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1 \ | 121 | .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \ |
112 | .event = wevent, .event_flags = wflags} | 122 | .event = wevent, .event_flags = wflags} |
113 | #define SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, \ | 123 | #define SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, \ |
114 | wevent, wflags) \ | 124 | wevent, wflags) \ |
@@ -178,7 +188,7 @@ | |||
178 | .private_value = (unsigned long)&xenum } | 188 | .private_value = (unsigned long)&xenum } |
179 | #define SOC_DAPM_VALUE_ENUM(xname, xenum) \ | 189 | #define SOC_DAPM_VALUE_ENUM(xname, xenum) \ |
180 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 190 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
181 | .info = snd_soc_info_value_enum_double, \ | 191 | .info = snd_soc_info_enum_double, \ |
182 | .get = snd_soc_dapm_get_value_enum_double, \ | 192 | .get = snd_soc_dapm_get_value_enum_double, \ |
183 | .put = snd_soc_dapm_put_value_enum_double, \ | 193 | .put = snd_soc_dapm_put_value_enum_double, \ |
184 | .private_value = (unsigned long)&xenum } | 194 | .private_value = (unsigned long)&xenum } |
@@ -250,10 +260,10 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev, | |||
250 | int snd_soc_dapm_sys_add(struct device *dev); | 260 | int snd_soc_dapm_sys_add(struct device *dev); |
251 | 261 | ||
252 | /* dapm audio pin control and status */ | 262 | /* dapm audio pin control and status */ |
253 | int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, char *pin); | 263 | int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin); |
254 | int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, char *pin); | 264 | int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin); |
255 | int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, char *pin); | 265 | int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin); |
256 | int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, char *pin); | 266 | int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin); |
257 | int snd_soc_dapm_sync(struct snd_soc_codec *codec); | 267 | int snd_soc_dapm_sync(struct snd_soc_codec *codec); |
258 | 268 | ||
259 | /* dapm widget types */ | 269 | /* dapm widget types */ |
@@ -263,6 +273,7 @@ enum snd_soc_dapm_type { | |||
263 | snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ | 273 | snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ |
264 | snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */ | 274 | snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */ |
265 | snd_soc_dapm_mixer, /* mixes several analog signals together */ | 275 | snd_soc_dapm_mixer, /* mixes several analog signals together */ |
276 | snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ | ||
266 | snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ | 277 | snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ |
267 | snd_soc_dapm_adc, /* analog to digital converter */ | 278 | snd_soc_dapm_adc, /* analog to digital converter */ |
268 | snd_soc_dapm_dac, /* digital to analog converter */ | 279 | snd_soc_dapm_dac, /* digital to analog converter */ |
diff --git a/include/sound/soc.h b/include/sound/soc.h index 9b930d342116..0e7735264169 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -106,7 +106,7 @@ | |||
106 | .private_value = (unsigned long)&xenum } | 106 | .private_value = (unsigned long)&xenum } |
107 | #define SOC_VALUE_ENUM(xname, xenum) \ | 107 | #define SOC_VALUE_ENUM(xname, xenum) \ |
108 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\ | 108 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\ |
109 | .info = snd_soc_info_value_enum_double, \ | 109 | .info = snd_soc_info_enum_double, \ |
110 | .get = snd_soc_get_value_enum_double, \ | 110 | .get = snd_soc_get_value_enum_double, \ |
111 | .put = snd_soc_put_value_enum_double, \ | 111 | .put = snd_soc_put_value_enum_double, \ |
112 | .private_value = (unsigned long)&xenum } | 112 | .private_value = (unsigned long)&xenum } |
@@ -154,6 +154,8 @@ enum snd_soc_bias_level { | |||
154 | SND_SOC_BIAS_OFF, | 154 | SND_SOC_BIAS_OFF, |
155 | }; | 155 | }; |
156 | 156 | ||
157 | struct snd_jack; | ||
158 | struct snd_soc_card; | ||
157 | struct snd_soc_device; | 159 | struct snd_soc_device; |
158 | struct snd_soc_pcm_stream; | 160 | struct snd_soc_pcm_stream; |
159 | struct snd_soc_ops; | 161 | struct snd_soc_ops; |
@@ -164,6 +166,8 @@ struct snd_soc_platform; | |||
164 | struct snd_soc_codec; | 166 | struct snd_soc_codec; |
165 | struct soc_enum; | 167 | struct soc_enum; |
166 | struct snd_soc_ac97_ops; | 168 | struct snd_soc_ac97_ops; |
169 | struct snd_soc_jack; | ||
170 | struct snd_soc_jack_pin; | ||
167 | 171 | ||
168 | typedef int (*hw_write_t)(void *,const char* ,int); | 172 | typedef int (*hw_write_t)(void *,const char* ,int); |
169 | typedef int (*hw_read_t)(void *,char* ,int); | 173 | typedef int (*hw_read_t)(void *,char* ,int); |
@@ -184,6 +188,13 @@ int snd_soc_init_card(struct snd_soc_device *socdev); | |||
184 | int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, | 188 | int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, |
185 | const struct snd_pcm_hardware *hw); | 189 | const struct snd_pcm_hardware *hw); |
186 | 190 | ||
191 | /* Jack reporting */ | ||
192 | int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type, | ||
193 | struct snd_soc_jack *jack); | ||
194 | void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask); | ||
195 | int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, | ||
196 | struct snd_soc_jack_pin *pins); | ||
197 | |||
187 | /* codec IO */ | 198 | /* codec IO */ |
188 | #define snd_soc_read(codec, reg) codec->read(codec, reg) | 199 | #define snd_soc_read(codec, reg) codec->read(codec, reg) |
189 | #define snd_soc_write(codec, reg, value) codec->write(codec, reg, value) | 200 | #define snd_soc_write(codec, reg, value) codec->write(codec, reg, value) |
@@ -203,6 +214,8 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); | |||
203 | */ | 214 | */ |
204 | struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, | 215 | struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, |
205 | void *data, char *long_name); | 216 | void *data, char *long_name); |
217 | int snd_soc_add_controls(struct snd_soc_codec *codec, | ||
218 | const struct snd_kcontrol_new *controls, int num_controls); | ||
206 | int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, | 219 | int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, |
207 | struct snd_ctl_elem_info *uinfo); | 220 | struct snd_ctl_elem_info *uinfo); |
208 | int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol, | 221 | int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol, |
@@ -211,8 +224,6 @@ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol, | |||
211 | struct snd_ctl_elem_value *ucontrol); | 224 | struct snd_ctl_elem_value *ucontrol); |
212 | int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, | 225 | int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, |
213 | struct snd_ctl_elem_value *ucontrol); | 226 | struct snd_ctl_elem_value *ucontrol); |
214 | int snd_soc_info_value_enum_double(struct snd_kcontrol *kcontrol, | ||
215 | struct snd_ctl_elem_info *uinfo); | ||
216 | int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol, | 227 | int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol, |
217 | struct snd_ctl_elem_value *ucontrol); | 228 | struct snd_ctl_elem_value *ucontrol); |
218 | int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol, | 229 | int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol, |
@@ -239,6 +250,27 @@ int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol, | |||
239 | int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, | 250 | int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, |
240 | struct snd_ctl_elem_value *ucontrol); | 251 | struct snd_ctl_elem_value *ucontrol); |
241 | 252 | ||
253 | /** | ||
254 | * struct snd_soc_jack_pin - Describes a pin to update based on jack detection | ||
255 | * | ||
256 | * @pin: name of the pin to update | ||
257 | * @mask: bits to check for in reported jack status | ||
258 | * @invert: if non-zero then pin is enabled when status is not reported | ||
259 | */ | ||
260 | struct snd_soc_jack_pin { | ||
261 | struct list_head list; | ||
262 | const char *pin; | ||
263 | int mask; | ||
264 | bool invert; | ||
265 | }; | ||
266 | |||
267 | struct snd_soc_jack { | ||
268 | struct snd_jack *jack; | ||
269 | struct snd_soc_card *card; | ||
270 | struct list_head pins; | ||
271 | int status; | ||
272 | }; | ||
273 | |||
242 | /* SoC PCM stream information */ | 274 | /* SoC PCM stream information */ |
243 | struct snd_soc_pcm_stream { | 275 | struct snd_soc_pcm_stream { |
244 | char *stream_name; | 276 | char *stream_name; |
@@ -386,6 +418,8 @@ struct snd_soc_card { | |||
386 | 418 | ||
387 | struct snd_soc_device *socdev; | 419 | struct snd_soc_device *socdev; |
388 | 420 | ||
421 | struct snd_soc_codec *codec; | ||
422 | |||
389 | struct snd_soc_platform *platform; | 423 | struct snd_soc_platform *platform; |
390 | struct delayed_work delayed_work; | 424 | struct delayed_work delayed_work; |
391 | struct work_struct deferred_resume_work; | 425 | struct work_struct deferred_resume_work; |
@@ -395,7 +429,6 @@ struct snd_soc_card { | |||
395 | struct snd_soc_device { | 429 | struct snd_soc_device { |
396 | struct device *dev; | 430 | struct device *dev; |
397 | struct snd_soc_card *card; | 431 | struct snd_soc_card *card; |
398 | struct snd_soc_codec *codec; | ||
399 | struct snd_soc_codec_device *codec_dev; | 432 | struct snd_soc_codec_device *codec_dev; |
400 | void *codec_data; | 433 | void *codec_data; |
401 | }; | 434 | }; |
@@ -419,17 +452,6 @@ struct soc_enum { | |||
419 | unsigned char shift_l; | 452 | unsigned char shift_l; |
420 | unsigned char shift_r; | 453 | unsigned char shift_r; |
421 | unsigned int max; | 454 | unsigned int max; |
422 | const char **texts; | ||
423 | void *dapm; | ||
424 | }; | ||
425 | |||
426 | /* semi enumerated kcontrol */ | ||
427 | struct soc_value_enum { | ||
428 | unsigned short reg; | ||
429 | unsigned short reg2; | ||
430 | unsigned char shift_l; | ||
431 | unsigned char shift_r; | ||
432 | unsigned int max; | ||
433 | unsigned int mask; | 455 | unsigned int mask; |
434 | const char **texts; | 456 | const char **texts; |
435 | const unsigned int *values; | 457 | const unsigned int *values; |