aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/soc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound/soc.h')
-rw-r--r--include/sound/soc.h69
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
159struct snd_jack;
160struct snd_soc_card;
157struct snd_soc_device; 161struct snd_soc_device;
158struct snd_soc_pcm_stream; 162struct snd_soc_pcm_stream;
159struct snd_soc_ops; 163struct snd_soc_ops;
@@ -164,6 +168,11 @@ struct snd_soc_platform;
164struct snd_soc_codec; 168struct snd_soc_codec;
165struct soc_enum; 169struct soc_enum;
166struct snd_soc_ac97_ops; 170struct snd_soc_ac97_ops;
171struct snd_soc_jack;
172struct snd_soc_jack_pin;
173#ifdef CONFIG_GPIOLIB
174struct snd_soc_jack_gpio;
175#endif
167 176
168typedef int (*hw_write_t)(void *,const char* ,int); 177typedef int (*hw_write_t)(void *,const char* ,int);
169typedef int (*hw_read_t)(void *,char* ,int); 178typedef int (*hw_read_t)(void *,char* ,int);
@@ -184,6 +193,19 @@ int snd_soc_init_card(struct snd_soc_device *socdev);
184int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, 193int 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 */
197int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type,
198 struct snd_soc_jack *jack);
199void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
200int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
201 struct snd_soc_jack_pin *pins);
202#ifdef CONFIG_GPIOLIB
203int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
204 struct snd_soc_jack_gpio *gpios);
205void 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 */
204struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, 226struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
205 void *data, char *long_name); 227 void *data, char *long_name);
228int snd_soc_add_controls(struct snd_soc_codec *codec,
229 const struct snd_kcontrol_new *controls, int num_controls);
206int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, 230int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
207 struct snd_ctl_elem_info *uinfo); 231 struct snd_ctl_elem_info *uinfo);
208int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol, 232int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
@@ -237,6 +261,48 @@ int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
237int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, 261int 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 */
271struct 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
288struct 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
299struct 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 */
241struct snd_soc_pcm_stream { 307struct 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 {
393struct snd_soc_device { 461struct 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};