diff options
Diffstat (limited to 'include/sound/soc.h')
-rw-r--r-- | include/sound/soc.h | 69 |
1 files changed, 68 insertions, 1 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index 24593ac3ea19..a40bc6f316fc 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/workqueue.h> | 18 | #include <linux/workqueue.h> |
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/kernel.h> | ||
19 | #include <sound/core.h> | 21 | #include <sound/core.h> |
20 | #include <sound/pcm.h> | 22 | #include <sound/pcm.h> |
21 | #include <sound/control.h> | 23 | #include <sound/control.h> |
@@ -154,6 +156,8 @@ enum snd_soc_bias_level { | |||
154 | SND_SOC_BIAS_OFF, | 156 | SND_SOC_BIAS_OFF, |
155 | }; | 157 | }; |
156 | 158 | ||
159 | struct snd_jack; | ||
160 | struct snd_soc_card; | ||
157 | struct snd_soc_device; | 161 | struct snd_soc_device; |
158 | struct snd_soc_pcm_stream; | 162 | struct snd_soc_pcm_stream; |
159 | struct snd_soc_ops; | 163 | struct snd_soc_ops; |
@@ -164,6 +168,11 @@ struct snd_soc_platform; | |||
164 | struct snd_soc_codec; | 168 | struct snd_soc_codec; |
165 | struct soc_enum; | 169 | struct soc_enum; |
166 | struct snd_soc_ac97_ops; | 170 | struct snd_soc_ac97_ops; |
171 | struct snd_soc_jack; | ||
172 | struct snd_soc_jack_pin; | ||
173 | #ifdef CONFIG_GPIOLIB | ||
174 | struct snd_soc_jack_gpio; | ||
175 | #endif | ||
167 | 176 | ||
168 | typedef int (*hw_write_t)(void *,const char* ,int); | 177 | typedef int (*hw_write_t)(void *,const char* ,int); |
169 | typedef int (*hw_read_t)(void *,char* ,int); | 178 | typedef int (*hw_read_t)(void *,char* ,int); |
@@ -184,6 +193,19 @@ int snd_soc_init_card(struct snd_soc_device *socdev); | |||
184 | int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, | 193 | int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, |
185 | const struct snd_pcm_hardware *hw); | 194 | const struct snd_pcm_hardware *hw); |
186 | 195 | ||
196 | /* Jack reporting */ | ||
197 | int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type, | ||
198 | struct snd_soc_jack *jack); | ||
199 | void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask); | ||
200 | int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, | ||
201 | struct snd_soc_jack_pin *pins); | ||
202 | #ifdef CONFIG_GPIOLIB | ||
203 | int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, | ||
204 | struct snd_soc_jack_gpio *gpios); | ||
205 | void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, | ||
206 | struct snd_soc_jack_gpio *gpios); | ||
207 | #endif | ||
208 | |||
187 | /* codec IO */ | 209 | /* codec IO */ |
188 | #define snd_soc_read(codec, reg) codec->read(codec, reg) | 210 | #define snd_soc_read(codec, reg) codec->read(codec, reg) |
189 | #define snd_soc_write(codec, reg, value) codec->write(codec, reg, value) | 211 | #define snd_soc_write(codec, reg, value) codec->write(codec, reg, value) |
@@ -203,6 +225,8 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); | |||
203 | */ | 225 | */ |
204 | struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, | 226 | struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, |
205 | void *data, char *long_name); | 227 | void *data, char *long_name); |
228 | int snd_soc_add_controls(struct snd_soc_codec *codec, | ||
229 | const struct snd_kcontrol_new *controls, int num_controls); | ||
206 | int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, | 230 | int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, |
207 | struct snd_ctl_elem_info *uinfo); | 231 | struct snd_ctl_elem_info *uinfo); |
208 | int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol, | 232 | int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol, |
@@ -237,6 +261,48 @@ int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol, | |||
237 | int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, | 261 | int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, |
238 | struct snd_ctl_elem_value *ucontrol); | 262 | struct snd_ctl_elem_value *ucontrol); |
239 | 263 | ||
264 | /** | ||
265 | * struct snd_soc_jack_pin - Describes a pin to update based on jack detection | ||
266 | * | ||
267 | * @pin: name of the pin to update | ||
268 | * @mask: bits to check for in reported jack status | ||
269 | * @invert: if non-zero then pin is enabled when status is not reported | ||
270 | */ | ||
271 | struct snd_soc_jack_pin { | ||
272 | struct list_head list; | ||
273 | const char *pin; | ||
274 | int mask; | ||
275 | bool invert; | ||
276 | }; | ||
277 | |||
278 | /** | ||
279 | * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection | ||
280 | * | ||
281 | * @gpio: gpio number | ||
282 | * @name: gpio name | ||
283 | * @report: value to report when jack detected | ||
284 | * @invert: report presence in low state | ||
285 | * @debouce_time: debouce time in ms | ||
286 | */ | ||
287 | #ifdef CONFIG_GPIOLIB | ||
288 | struct snd_soc_jack_gpio { | ||
289 | unsigned int gpio; | ||
290 | const char *name; | ||
291 | int report; | ||
292 | int invert; | ||
293 | int debounce_time; | ||
294 | struct snd_soc_jack *jack; | ||
295 | struct work_struct work; | ||
296 | }; | ||
297 | #endif | ||
298 | |||
299 | struct snd_soc_jack { | ||
300 | struct snd_jack *jack; | ||
301 | struct snd_soc_card *card; | ||
302 | struct list_head pins; | ||
303 | int status; | ||
304 | }; | ||
305 | |||
240 | /* SoC PCM stream information */ | 306 | /* SoC PCM stream information */ |
241 | struct snd_soc_pcm_stream { | 307 | struct snd_soc_pcm_stream { |
242 | char *stream_name; | 308 | char *stream_name; |
@@ -384,6 +450,8 @@ struct snd_soc_card { | |||
384 | 450 | ||
385 | struct snd_soc_device *socdev; | 451 | struct snd_soc_device *socdev; |
386 | 452 | ||
453 | struct snd_soc_codec *codec; | ||
454 | |||
387 | struct snd_soc_platform *platform; | 455 | struct snd_soc_platform *platform; |
388 | struct delayed_work delayed_work; | 456 | struct delayed_work delayed_work; |
389 | struct work_struct deferred_resume_work; | 457 | struct work_struct deferred_resume_work; |
@@ -393,7 +461,6 @@ struct snd_soc_card { | |||
393 | struct snd_soc_device { | 461 | struct snd_soc_device { |
394 | struct device *dev; | 462 | struct device *dev; |
395 | struct snd_soc_card *card; | 463 | struct snd_soc_card *card; |
396 | struct snd_soc_codec *codec; | ||
397 | struct snd_soc_codec_device *codec_dev; | 464 | struct snd_soc_codec_device *codec_dev; |
398 | void *codec_data; | 465 | void *codec_data; |
399 | }; | 466 | }; |