aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/soc-dapm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound/soc-dapm.h')
-rw-r--r--include/sound/soc-dapm.h99
1 files changed, 69 insertions, 30 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 8fd3b41b763f..8031769ac485 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -16,7 +16,6 @@
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <sound/control.h> 18#include <sound/control.h>
19#include <sound/soc.h>
20 19
21/* widget has no PM register bit */ 20/* widget has no PM register bit */
22#define SND_SOC_NOPM -1 21#define SND_SOC_NOPM -1
@@ -72,6 +71,10 @@
72 wcontrols, wncontrols) \ 71 wcontrols, wncontrols) \
73{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ 72{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \
74 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols} 73 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols}
74#define SND_SOC_DAPM_OUT_DRV(wname, wreg, wshift, winvert,\
75 wcontrols, wncontrols) \
76{ .id = snd_soc_dapm_out_drv, .name = wname, .reg = wreg, .shift = wshift, \
77 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols}
75#define SND_SOC_DAPM_MIXER(wname, wreg, wshift, winvert, \ 78#define SND_SOC_DAPM_MIXER(wname, wreg, wshift, winvert, \
76 wcontrols, wncontrols)\ 79 wcontrols, wncontrols)\
77{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 80{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
@@ -90,6 +93,9 @@
90#define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \ 93#define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \
91{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \ 94{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \
92 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1} 95 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1}
96#define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \
97{ .id = snd_soc_dapm_virt_mux, .name = wname, .reg = wreg, .shift = wshift, \
98 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1}
93#define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \ 99#define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \
94{ .id = snd_soc_dapm_value_mux, .name = wname, .reg = wreg, \ 100{ .id = snd_soc_dapm_value_mux, .name = wname, .reg = wreg, \
95 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \ 101 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \
@@ -116,6 +122,11 @@
116{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ 122{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \
117 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \ 123 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \
118 .event = wevent, .event_flags = wflags} 124 .event = wevent, .event_flags = wflags}
125#define SND_SOC_DAPM_OUT_DRV_E(wname, wreg, wshift, winvert, wcontrols, \
126 wncontrols, wevent, wflags) \
127{ .id = snd_soc_dapm_out_drv, .name = wname, .reg = wreg, .shift = wshift, \
128 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \
129 .event = wevent, .event_flags = wflags}
119#define SND_SOC_DAPM_MIXER_E(wname, wreg, wshift, winvert, wcontrols, \ 130#define SND_SOC_DAPM_MIXER_E(wname, wreg, wshift, winvert, wcontrols, \
120 wncontrols, wevent, wflags) \ 131 wncontrols, wevent, wflags) \
121{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 132{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
@@ -140,6 +151,11 @@
140{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \ 151{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \
141 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \ 152 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \
142 .event = wevent, .event_flags = wflags} 153 .event = wevent, .event_flags = wflags}
154#define SND_SOC_DAPM_VIRT_MUX_E(wname, wreg, wshift, winvert, wcontrols, \
155 wevent, wflags) \
156{ .id = snd_soc_dapm_virt_mux, .name = wname, .reg = wreg, .shift = wshift, \
157 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \
158 .event = wevent, .event_flags = wflags}
143 159
144/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ 160/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
145#define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \ 161#define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \
@@ -219,13 +235,6 @@
219 .info = snd_soc_info_volsw, \ 235 .info = snd_soc_info_volsw, \
220 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 236 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
221 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 237 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
222#define SOC_DAPM_DOUBLE(xname, reg, shift_left, shift_right, max, invert, \
223 power) \
224{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
225 .info = snd_soc_info_volsw, \
226 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
227 .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\
228 ((max) << 16) | ((invert) << 24) }
229#define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ 238#define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
230{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 239{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
231 .info = snd_soc_info_volsw, \ 240 .info = snd_soc_info_volsw, \
@@ -233,15 +242,6 @@
233 .tlv.p = (tlv_array), \ 242 .tlv.p = (tlv_array), \
234 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 243 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
235 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 244 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
236#define SOC_DAPM_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, \
237 power, tlv_array) \
238{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
239 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
240 .tlv.p = (tlv_array), \
241 .info = snd_soc_info_volsw, \
242 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
243 .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\
244 ((max) << 16) | ((invert) << 24) }
245#define SOC_DAPM_ENUM(xname, xenum) \ 245#define SOC_DAPM_ENUM(xname, xenum) \
246{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 246{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
247 .info = snd_soc_info_enum_double, \ 247 .info = snd_soc_info_enum_double, \
@@ -297,6 +297,7 @@ enum snd_soc_dapm_type;
297struct snd_soc_dapm_path; 297struct snd_soc_dapm_path;
298struct snd_soc_dapm_pin; 298struct snd_soc_dapm_pin;
299struct snd_soc_dapm_route; 299struct snd_soc_dapm_route;
300struct snd_soc_dapm_context;
300 301
301int dapm_reg_event(struct snd_soc_dapm_widget *w, 302int dapm_reg_event(struct snd_soc_dapm_widget *w,
302 struct snd_kcontrol *kcontrol, int event); 303 struct snd_kcontrol *kcontrol, int event);
@@ -324,16 +325,16 @@ int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
324 struct snd_ctl_elem_value *uncontrol); 325 struct snd_ctl_elem_value *uncontrol);
325int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, 326int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
326 struct snd_ctl_elem_value *uncontrol); 327 struct snd_ctl_elem_value *uncontrol);
327int snd_soc_dapm_new_control(struct snd_soc_codec *codec, 328int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
328 const struct snd_soc_dapm_widget *widget); 329 const struct snd_soc_dapm_widget *widget);
329int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, 330int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
330 const struct snd_soc_dapm_widget *widget, 331 const struct snd_soc_dapm_widget *widget,
331 int num); 332 int num);
332 333
333/* dapm path setup */ 334/* dapm path setup */
334int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec); 335int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm);
335void snd_soc_dapm_free(struct snd_soc_codec *codec); 336void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm);
336int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, 337int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
337 const struct snd_soc_dapm_route *route, int num); 338 const struct snd_soc_dapm_route *route, int num);
338 339
339/* dapm events */ 340/* dapm events */
@@ -343,27 +344,33 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card);
343 344
344/* dapm sys fs - used by the core */ 345/* dapm sys fs - used by the core */
345int snd_soc_dapm_sys_add(struct device *dev); 346int snd_soc_dapm_sys_add(struct device *dev);
346void snd_soc_dapm_debugfs_init(struct snd_soc_codec *codec); 347void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm);
347 348
348/* dapm audio pin control and status */ 349/* dapm audio pin control and status */
349int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin); 350int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm,
350int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin); 351 const char *pin);
351int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin); 352int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm,
352int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin); 353 const char *pin);
353int snd_soc_dapm_sync(struct snd_soc_codec *codec); 354int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin);
354int snd_soc_dapm_force_enable_pin(struct snd_soc_codec *codec, 355int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm,
356 const char *pin);
357int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm);
358int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
355 const char *pin); 359 const char *pin);
356int snd_soc_dapm_ignore_suspend(struct snd_soc_codec *codec, const char *pin); 360int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
361 const char *pin);
357 362
358/* dapm widget types */ 363/* dapm widget types */
359enum snd_soc_dapm_type { 364enum snd_soc_dapm_type {
360 snd_soc_dapm_input = 0, /* input pin */ 365 snd_soc_dapm_input = 0, /* input pin */
361 snd_soc_dapm_output, /* output pin */ 366 snd_soc_dapm_output, /* output pin */
362 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ 367 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */
368 snd_soc_dapm_virt_mux, /* virtual version of snd_soc_dapm_mux */
363 snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */ 369 snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */
364 snd_soc_dapm_mixer, /* mixes several analog signals together */ 370 snd_soc_dapm_mixer, /* mixes several analog signals together */
365 snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ 371 snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */
366 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ 372 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */
373 snd_soc_dapm_out_drv, /* output driver */
367 snd_soc_dapm_adc, /* analog to digital converter */ 374 snd_soc_dapm_adc, /* analog to digital converter */
368 snd_soc_dapm_dac, /* digital to analog converter */ 375 snd_soc_dapm_dac, /* digital to analog converter */
369 snd_soc_dapm_micbias, /* microphone bias (power) */ 376 snd_soc_dapm_micbias, /* microphone bias (power) */
@@ -425,6 +432,7 @@ struct snd_soc_dapm_widget {
425 char *sname; /* stream name */ 432 char *sname; /* stream name */
426 struct snd_soc_codec *codec; 433 struct snd_soc_codec *codec;
427 struct list_head list; 434 struct list_head list;
435 struct snd_soc_dapm_context *dapm;
428 436
429 /* dapm control */ 437 /* dapm control */
430 short reg; /* negative reg = no direct dapm */ 438 short reg; /* negative reg = no direct dapm */
@@ -461,4 +469,35 @@ struct snd_soc_dapm_widget {
461 struct list_head power_list; 469 struct list_head power_list;
462}; 470};
463 471
472struct snd_soc_dapm_update {
473 struct snd_soc_dapm_widget *widget;
474 struct snd_kcontrol *kcontrol;
475 int reg;
476 int mask;
477 int val;
478};
479
480/* DAPM context */
481struct snd_soc_dapm_context {
482 int n_widgets; /* number of widgets in this context */
483 enum snd_soc_bias_level bias_level;
484 enum snd_soc_bias_level suspend_bias_level;
485 struct delayed_work delayed_work;
486 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
487
488 struct snd_soc_dapm_update *update;
489
490 struct device *dev; /* from parent - for debug */
491 struct snd_soc_codec *codec; /* parent codec */
492 struct snd_soc_card *card; /* parent card */
493
494 /* used during DAPM updates */
495 int dev_power;
496 struct list_head list;
497
498#ifdef CONFIG_DEBUG_FS
499 struct dentry *debugfs_dapm;
500#endif
501};
502
464#endif 503#endif