diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-03-23 19:35:53 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-03-23 19:35:53 -0400 |
commit | b5c784894c90042f4fc6348aedc7524e899df281 (patch) | |
tree | 0db86a93d73e4aabca04e361d7e6807aa4c1d307 /include/sound | |
parent | ff4fc3656e489ed6ee575959b0510286aefe1e20 (diff) | |
parent | 1f2186951e02f2a5bcda9459f63136918932385a (diff) |
Merge branch 'topic/asoc' into for-linus
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/pxa2xx-lib.h | 15 | ||||
-rw-r--r-- | include/sound/soc-dai.h | 2 | ||||
-rw-r--r-- | include/sound/soc-dapm.h | 31 | ||||
-rw-r--r-- | include/sound/soc.h | 69 |
4 files changed, 111 insertions, 6 deletions
diff --git a/include/sound/pxa2xx-lib.h b/include/sound/pxa2xx-lib.h index 2fd3d251d9a5..2c894b600e5b 100644 --- a/include/sound/pxa2xx-lib.h +++ b/include/sound/pxa2xx-lib.h | |||
@@ -42,4 +42,19 @@ extern int pxa2xx_ac97_hw_resume(void); | |||
42 | extern int pxa2xx_ac97_hw_probe(struct platform_device *dev); | 42 | extern int pxa2xx_ac97_hw_probe(struct platform_device *dev); |
43 | extern void pxa2xx_ac97_hw_remove(struct platform_device *dev); | 43 | extern void pxa2xx_ac97_hw_remove(struct platform_device *dev); |
44 | 44 | ||
45 | /* AC97 platform_data */ | ||
46 | /** | ||
47 | * struct pxa2xx_ac97_platform_data - pxa ac97 platform data | ||
48 | * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95) | ||
49 | * a -1 value means no gpio will be used for reset | ||
50 | * | ||
51 | * Platform data should only be specified for pxa27x CPUs where a silicon bug | ||
52 | * prevents correct operation of the reset line. If not specified, the default | ||
53 | * behaviour is to consider gpio 113 as the AC97 reset line, which is the | ||
54 | * default on most boards. | ||
55 | */ | ||
56 | struct pxa2xx_ac97_platform_data { | ||
57 | int reset_gpio; | ||
58 | }; | ||
59 | |||
45 | #endif | 60 | #endif |
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 24247f763608..13676472ddfc 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h | |||
@@ -203,7 +203,7 @@ struct snd_soc_dai { | |||
203 | int (*resume)(struct snd_soc_dai *dai); | 203 | int (*resume)(struct snd_soc_dai *dai); |
204 | 204 | ||
205 | /* ops */ | 205 | /* ops */ |
206 | struct snd_soc_dai_ops ops; | 206 | struct snd_soc_dai_ops *ops; |
207 | 207 | ||
208 | /* DAI capabilities */ | 208 | /* DAI capabilities */ |
209 | struct snd_soc_pcm_stream capture; | 209 | struct snd_soc_pcm_stream capture; |
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index dfa804958820..a7def6a9a030 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, \ |
@@ -182,6 +192,12 @@ | |||
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 } |
195 | #define SOC_DAPM_PIN_SWITCH(xname) \ | ||
196 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \ | ||
197 | .info = snd_soc_dapm_info_pin_switch, \ | ||
198 | .get = snd_soc_dapm_get_pin_switch, \ | ||
199 | .put = snd_soc_dapm_put_pin_switch, \ | ||
200 | .private_value = (unsigned long)xname } | ||
185 | 201 | ||
186 | /* dapm stream operations */ | 202 | /* dapm stream operations */ |
187 | #define SND_SOC_DAPM_STREAM_NOP 0x0 | 203 | #define SND_SOC_DAPM_STREAM_NOP 0x0 |
@@ -228,6 +244,12 @@ int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol, | |||
228 | struct snd_ctl_elem_value *ucontrol); | 244 | struct snd_ctl_elem_value *ucontrol); |
229 | int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, | 245 | int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, |
230 | struct snd_ctl_elem_value *ucontrol); | 246 | struct snd_ctl_elem_value *ucontrol); |
247 | int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol, | ||
248 | struct snd_ctl_elem_info *uinfo); | ||
249 | int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol, | ||
250 | struct snd_ctl_elem_value *uncontrol); | ||
251 | int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, | ||
252 | struct snd_ctl_elem_value *uncontrol); | ||
231 | int snd_soc_dapm_new_control(struct snd_soc_codec *codec, | 253 | int snd_soc_dapm_new_control(struct snd_soc_codec *codec, |
232 | const struct snd_soc_dapm_widget *widget); | 254 | const struct snd_soc_dapm_widget *widget); |
233 | int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, | 255 | int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, |
@@ -250,10 +272,10 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev, | |||
250 | int snd_soc_dapm_sys_add(struct device *dev); | 272 | int snd_soc_dapm_sys_add(struct device *dev); |
251 | 273 | ||
252 | /* dapm audio pin control and status */ | 274 | /* dapm audio pin control and status */ |
253 | int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, char *pin); | 275 | 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); | 276 | 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); | 277 | 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); | 278 | 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); | 279 | int snd_soc_dapm_sync(struct snd_soc_codec *codec); |
258 | 280 | ||
259 | /* dapm widget types */ | 281 | /* dapm widget types */ |
@@ -263,6 +285,7 @@ enum snd_soc_dapm_type { | |||
263 | snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ | 285 | snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ |
264 | snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */ | 286 | snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */ |
265 | snd_soc_dapm_mixer, /* mixes several analog signals together */ | 287 | snd_soc_dapm_mixer, /* mixes several analog signals together */ |
288 | snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ | ||
266 | snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ | 289 | snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ |
267 | snd_soc_dapm_adc, /* analog to digital converter */ | 290 | snd_soc_dapm_adc, /* analog to digital converter */ |
268 | snd_soc_dapm_dac, /* digital to analog converter */ | 291 | snd_soc_dapm_dac, /* digital to analog converter */ |
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 | }; |