blob: ec8a45f9a06950f6bf1cfa0ea0d46ed3ca5200f0 [file] [log] [blame]
Richard Purdie808db4a2006-10-06 18:20:14 +02001/*
2 * linux/sound/soc-dapm.h -- ALSA SoC Dynamic Audio Power Management
3 *
4 * Author: Liam Girdwood
5 * Created: Aug 11th 2005
6 * Copyright: Wolfson Microelectronics. PLC.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __LINUX_SND_SOC_DAPM_H
14#define __LINUX_SND_SOC_DAPM_H
15
16#include <linux/device.h>
17#include <linux/types.h>
18#include <sound/control.h>
19#include <sound/soc.h>
20
21/* widget has no PM register bit */
22#define SND_SOC_NOPM -1
23
24/*
Joe Perchesb7d2a802007-12-18 13:14:21 +010025 * SoC dynamic audio power management
Richard Purdie808db4a2006-10-06 18:20:14 +020026 *
27 * We can have upto 4 power domains
28 * 1. Codec domain - VREF, VMID
29 * Usually controlled at codec probe/remove, although can be set
30 * at stream time if power is not needed for sidetone, etc.
31 * 2. Platform/Machine domain - physically connected inputs and outputs
32 * Is platform/machine and user action specific, is set in the machine
33 * driver and by userspace e.g when HP are inserted
34 * 3. Path domain - Internal codec path mixers
35 * Are automatically set when mixer and mux settings are
36 * changed by the user.
37 * 4. Stream domain - DAC's and ADC's.
38 * Enabled when stream playback/capture is started.
39 */
40
41/* codec domain */
42#define SND_SOC_DAPM_VMID(wname) \
43{ .id = snd_soc_dapm_vmid, .name = wname, .kcontrols = NULL, \
44 .num_kcontrols = 0}
45
46/* platform domain */
47#define SND_SOC_DAPM_INPUT(wname) \
48{ .id = snd_soc_dapm_input, .name = wname, .kcontrols = NULL, \
49 .num_kcontrols = 0}
50#define SND_SOC_DAPM_OUTPUT(wname) \
51{ .id = snd_soc_dapm_output, .name = wname, .kcontrols = NULL, \
52 .num_kcontrols = 0}
53#define SND_SOC_DAPM_MIC(wname, wevent) \
54{ .id = snd_soc_dapm_mic, .name = wname, .kcontrols = NULL, \
55 .num_kcontrols = 0, .event = wevent, \
56 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD}
57#define SND_SOC_DAPM_HP(wname, wevent) \
58{ .id = snd_soc_dapm_hp, .name = wname, .kcontrols = NULL, \
59 .num_kcontrols = 0, .event = wevent, \
60 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD}
61#define SND_SOC_DAPM_SPK(wname, wevent) \
62{ .id = snd_soc_dapm_spk, .name = wname, .kcontrols = NULL, \
63 .num_kcontrols = 0, .event = wevent, \
64 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD}
65#define SND_SOC_DAPM_LINE(wname, wevent) \
66{ .id = snd_soc_dapm_line, .name = wname, .kcontrols = NULL, \
67 .num_kcontrols = 0, .event = wevent, \
68 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD}
69
70/* path domain */
71#define SND_SOC_DAPM_PGA(wname, wreg, wshift, winvert,\
72 wcontrols, wncontrols) \
73{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \
74 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols}
75#define SND_SOC_DAPM_MIXER(wname, wreg, wshift, winvert, \
76 wcontrols, wncontrols)\
77{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
78 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols}
Ian Moltonca9c1aa2009-01-06 20:11:51 +000079#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}
Richard Purdie808db4a2006-10-06 18:20:14 +020084#define SND_SOC_DAPM_MICBIAS(wname, wreg, wshift, winvert) \
85{ .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \
86 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0}
87#define SND_SOC_DAPM_SWITCH(wname, wreg, wshift, winvert, wcontrols) \
88{ .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \
89 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1}
90#define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \
91{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \
92 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1}
Peter Ujfalusi2e72f8e2009-01-05 09:54:57 +020093#define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \
94{ .id = snd_soc_dapm_value_mux, .name = wname, .reg = wreg, \
95 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \
96 .num_kcontrols = 1}
Richard Purdie808db4a2006-10-06 18:20:14 +020097
98/* path domain with event - event handler must return 0 for success */
99#define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \
100 wncontrols, wevent, wflags) \
101{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \
102 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \
103 .event = wevent, .event_flags = wflags}
104#define SND_SOC_DAPM_MIXER_E(wname, wreg, wshift, winvert, wcontrols, \
105 wncontrols, wevent, wflags) \
106{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
107 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \
108 .event = wevent, .event_flags = wflags}
Ian Moltonca9c1aa2009-01-06 20:11:51 +0000109#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}
Richard Purdie808db4a2006-10-06 18:20:14 +0200114#define SND_SOC_DAPM_MICBIAS_E(wname, wreg, wshift, winvert, wevent, wflags) \
115{ .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \
116 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0, \
117 .event = wevent, .event_flags = wflags}
118#define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \
119 wevent, wflags) \
120{ .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \
Peter Ujfalusi43d50802009-01-23 10:08:35 +0200121 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \
Richard Purdie808db4a2006-10-06 18:20:14 +0200122 .event = wevent, .event_flags = wflags}
123#define SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, \
124 wevent, wflags) \
125{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \
126 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \
127 .event = wevent, .event_flags = wflags}
128
129/* events that are pre and post DAPM */
130#define SND_SOC_DAPM_PRE(wname, wevent) \
131{ .id = snd_soc_dapm_pre, .name = wname, .kcontrols = NULL, \
132 .num_kcontrols = 0, .event = wevent, \
133 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD}
134#define SND_SOC_DAPM_POST(wname, wevent) \
135{ .id = snd_soc_dapm_post, .name = wname, .kcontrols = NULL, \
136 .num_kcontrols = 0, .event = wevent, \
137 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD}
138
139/* stream domain */
140#define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \
141{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \
142 .shift = wshift, .invert = winvert}
Mark Brownf6d655a2009-04-13 11:27:03 +0100143#define SND_SOC_DAPM_DAC_E(wname, stname, wreg, wshift, winvert, \
144 wevent, wflags) \
145{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \
146 .shift = wshift, .invert = winvert, \
147 .event = wevent, .event_flags = wflags}
Richard Purdie808db4a2006-10-06 18:20:14 +0200148#define SND_SOC_DAPM_ADC(wname, stname, wreg, wshift, winvert) \
149{ .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \
150 .shift = wshift, .invert = winvert}
Mark Brownf6d655a2009-04-13 11:27:03 +0100151#define SND_SOC_DAPM_ADC_E(wname, stname, wreg, wshift, winvert, \
152 wevent, wflags) \
153{ .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \
154 .shift = wshift, .invert = winvert, \
155 .event = wevent, .event_flags = wflags}
Richard Purdie808db4a2006-10-06 18:20:14 +0200156
Mark Brown246d0a12009-04-22 18:24:55 +0100157/* generic widgets */
Jarkko Nikulae2be2cc2008-06-25 14:42:07 +0300158#define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \
159{ .id = wid, .name = wname, .kcontrols = NULL, .num_kcontrols = 0, \
160 .reg = -((wreg) + 1), .shift = wshift, .mask = wmask, \
161 .on_val = won_val, .off_val = woff_val, .event = dapm_reg_event, \
162 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD}
Mark Brown246d0a12009-04-22 18:24:55 +0100163#define SND_SOC_DAPM_SUPPLY(wname, wreg, wshift, winvert, wevent, wflags) \
164{ .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \
165 .shift = wshift, .invert = winvert, .event = wevent, \
166 .event_flags = wflags}
Jarkko Nikulae2be2cc2008-06-25 14:42:07 +0300167
Richard Purdie808db4a2006-10-06 18:20:14 +0200168/* dapm kcontrol types */
Philipp Zabela7a4ac82008-01-10 14:37:42 +0100169#define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \
Richard Purdie808db4a2006-10-06 18:20:14 +0200170{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
171 .info = snd_soc_info_volsw, \
172 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
Philipp Zabela7a4ac82008-01-10 14:37:42 +0100173 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
174#define SOC_DAPM_DOUBLE(xname, reg, shift_left, shift_right, max, invert, \
Richard Purdie808db4a2006-10-06 18:20:14 +0200175 power) \
176{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
177 .info = snd_soc_info_volsw, \
178 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
179 .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\
Philipp Zabela7a4ac82008-01-10 14:37:42 +0100180 ((max) << 16) | ((invert) << 24) }
181#define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
182{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
183 .info = snd_soc_info_volsw, \
184 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
185 .tlv.p = (tlv_array), \
186 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
187 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
188#define SOC_DAPM_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, \
189 power, tlv_array) \
190{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
191 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
192 .tlv.p = (tlv_array), \
193 .info = snd_soc_info_volsw, \
194 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
195 .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\
196 ((max) << 16) | ((invert) << 24) }
Richard Purdie808db4a2006-10-06 18:20:14 +0200197#define SOC_DAPM_ENUM(xname, xenum) \
198{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
199 .info = snd_soc_info_enum_double, \
200 .get = snd_soc_dapm_get_enum_double, \
201 .put = snd_soc_dapm_put_enum_double, \
202 .private_value = (unsigned long)&xenum }
Peter Ujfalusi2e72f8e2009-01-05 09:54:57 +0200203#define SOC_DAPM_VALUE_ENUM(xname, xenum) \
204{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
Peter Ujfalusi74155552009-01-08 13:34:29 +0200205 .info = snd_soc_info_enum_double, \
Peter Ujfalusi2e72f8e2009-01-05 09:54:57 +0200206 .get = snd_soc_dapm_get_value_enum_double, \
207 .put = snd_soc_dapm_put_value_enum_double, \
208 .private_value = (unsigned long)&xenum }
Mark Brown8b37dbd2009-02-28 21:14:20 +0000209#define SOC_DAPM_PIN_SWITCH(xname) \
210{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \
211 .info = snd_soc_dapm_info_pin_switch, \
212 .get = snd_soc_dapm_get_pin_switch, \
213 .put = snd_soc_dapm_put_pin_switch, \
214 .private_value = (unsigned long)xname }
Richard Purdie808db4a2006-10-06 18:20:14 +0200215
216/* dapm stream operations */
217#define SND_SOC_DAPM_STREAM_NOP 0x0
218#define SND_SOC_DAPM_STREAM_START 0x1
219#define SND_SOC_DAPM_STREAM_STOP 0x2
220#define SND_SOC_DAPM_STREAM_SUSPEND 0x4
221#define SND_SOC_DAPM_STREAM_RESUME 0x8
222#define SND_SOC_DAPM_STREAM_PAUSE_PUSH 0x10
223#define SND_SOC_DAPM_STREAM_PAUSE_RELEASE 0x20
224
225/* dapm event types */
226#define SND_SOC_DAPM_PRE_PMU 0x1 /* before widget power up */
227#define SND_SOC_DAPM_POST_PMU 0x2 /* after widget power up */
228#define SND_SOC_DAPM_PRE_PMD 0x4 /* before widget power down */
229#define SND_SOC_DAPM_POST_PMD 0x8 /* after widget power down */
230#define SND_SOC_DAPM_PRE_REG 0x10 /* before audio path setup */
231#define SND_SOC_DAPM_POST_REG 0x20 /* after audio path setup */
232
233/* convenience event type detection */
234#define SND_SOC_DAPM_EVENT_ON(e) \
235 (e & (SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU))
236#define SND_SOC_DAPM_EVENT_OFF(e) \
237 (e & (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD))
238
239struct snd_soc_dapm_widget;
240enum snd_soc_dapm_type;
241struct snd_soc_dapm_path;
242struct snd_soc_dapm_pin;
Mark Brown105f1c22008-05-13 14:52:19 +0200243struct snd_soc_dapm_route;
Richard Purdie808db4a2006-10-06 18:20:14 +0200244
Mark Brown11589412008-07-29 11:42:23 +0100245int dapm_reg_event(struct snd_soc_dapm_widget *w,
246 struct snd_kcontrol *kcontrol, int event);
247
Richard Purdie808db4a2006-10-06 18:20:14 +0200248/* dapm controls */
249int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
250 struct snd_ctl_elem_value *ucontrol);
251int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
252 struct snd_ctl_elem_value *ucontrol);
253int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
254 struct snd_ctl_elem_value *ucontrol);
255int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
256 struct snd_ctl_elem_value *ucontrol);
Peter Ujfalusi2e72f8e2009-01-05 09:54:57 +0200257int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol,
258 struct snd_ctl_elem_value *ucontrol);
259int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
260 struct snd_ctl_elem_value *ucontrol);
Mark Brown8b37dbd2009-02-28 21:14:20 +0000261int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol,
262 struct snd_ctl_elem_info *uinfo);
263int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
264 struct snd_ctl_elem_value *uncontrol);
265int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
266 struct snd_ctl_elem_value *uncontrol);
Richard Purdie808db4a2006-10-06 18:20:14 +0200267int snd_soc_dapm_new_control(struct snd_soc_codec *codec,
268 const struct snd_soc_dapm_widget *widget);
Mark Brown4ba13272008-05-13 14:51:19 +0200269int snd_soc_dapm_new_controls(struct snd_soc_codec *codec,
270 const struct snd_soc_dapm_widget *widget,
271 int num);
Richard Purdie808db4a2006-10-06 18:20:14 +0200272
273/* dapm path setup */
Richard Purdie808db4a2006-10-06 18:20:14 +0200274int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec);
275void snd_soc_dapm_free(struct snd_soc_device *socdev);
Mark Brown105f1c22008-05-13 14:52:19 +0200276int snd_soc_dapm_add_routes(struct snd_soc_codec *codec,
277 const struct snd_soc_dapm_route *route, int num);
Richard Purdie808db4a2006-10-06 18:20:14 +0200278
279/* dapm events */
280int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream,
281 int event);
Richard Purdie808db4a2006-10-06 18:20:14 +0200282
283/* dapm sys fs - used by the core */
284int snd_soc_dapm_sys_add(struct device *dev);
285
Liam Girdwooda5302182008-07-07 13:35:17 +0100286/* dapm audio pin control and status */
Mark Brown16499232009-01-07 18:25:13 +0000287int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin);
288int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin);
289int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin);
290int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin);
Liam Girdwooda5302182008-07-07 13:35:17 +0100291int snd_soc_dapm_sync(struct snd_soc_codec *codec);
Richard Purdie808db4a2006-10-06 18:20:14 +0200292
293/* dapm widget types */
294enum snd_soc_dapm_type {
295 snd_soc_dapm_input = 0, /* input pin */
296 snd_soc_dapm_output, /* output pin */
297 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */
Peter Ujfalusi2e72f8e2009-01-05 09:54:57 +0200298 snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */
Richard Purdie808db4a2006-10-06 18:20:14 +0200299 snd_soc_dapm_mixer, /* mixes several analog signals together */
Ian Moltonca9c1aa2009-01-06 20:11:51 +0000300 snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */
Richard Purdie808db4a2006-10-06 18:20:14 +0200301 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */
302 snd_soc_dapm_adc, /* analog to digital converter */
303 snd_soc_dapm_dac, /* digital to analog converter */
304 snd_soc_dapm_micbias, /* microphone bias (power) */
305 snd_soc_dapm_mic, /* microphone */
306 snd_soc_dapm_hp, /* headphones */
307 snd_soc_dapm_spk, /* speaker */
308 snd_soc_dapm_line, /* line input/output */
309 snd_soc_dapm_switch, /* analog switch */
310 snd_soc_dapm_vmid, /* codec bias/vmid - to minimise pops */
311 snd_soc_dapm_pre, /* machine specific pre widget - exec first */
312 snd_soc_dapm_post, /* machine specific post widget - exec last */
Mark Brown246d0a12009-04-22 18:24:55 +0100313 snd_soc_dapm_supply, /* power/clock supply */
Richard Purdie808db4a2006-10-06 18:20:14 +0200314};
315
Mark Brown105f1c22008-05-13 14:52:19 +0200316/*
317 * DAPM audio route definition.
318 *
319 * Defines an audio route originating at source via control and finishing
320 * at sink.
321 */
322struct snd_soc_dapm_route {
323 const char *sink;
324 const char *control;
325 const char *source;
326};
327
Richard Purdie808db4a2006-10-06 18:20:14 +0200328/* dapm audio path between two widgets */
329struct snd_soc_dapm_path {
330 char *name;
331 char *long_name;
332
333 /* source (input) and sink (output) widgets */
334 struct snd_soc_dapm_widget *source;
335 struct snd_soc_dapm_widget *sink;
336 struct snd_kcontrol *kcontrol;
337
338 /* status */
339 u32 connect:1; /* source and sink widgets are connected */
340 u32 walked:1; /* path has been walked */
341
342 struct list_head list_source;
343 struct list_head list_sink;
344 struct list_head list;
345};
346
347/* dapm widget */
348struct snd_soc_dapm_widget {
349 enum snd_soc_dapm_type id;
350 char *name; /* widget name */
351 char *sname; /* stream name */
352 struct snd_soc_codec *codec;
353 struct list_head list;
354
355 /* dapm control */
356 short reg; /* negative reg = no direct dapm */
357 unsigned char shift; /* bits to shift */
358 unsigned int saved_value; /* widget saved value */
359 unsigned int value; /* widget current value */
Jarkko Nikulae2be2cc2008-06-25 14:42:07 +0300360 unsigned int mask; /* non-shifted mask */
361 unsigned int on_val; /* on state value */
362 unsigned int off_val; /* off state value */
Richard Purdie808db4a2006-10-06 18:20:14 +0200363 unsigned char power:1; /* block power status */
364 unsigned char invert:1; /* invert the power bit */
365 unsigned char active:1; /* active stream on DAC, ADC's */
366 unsigned char connected:1; /* connected codec pin */
367 unsigned char new:1; /* cnew complete */
368 unsigned char ext:1; /* has external widgets */
369 unsigned char muted:1; /* muted for pop reduction */
370 unsigned char suspend:1; /* was active before suspend */
371 unsigned char pmdown:1; /* waiting for timeout */
372
Mark Brownb75576d2009-04-20 17:56:13 +0100373 int (*power_check)(struct snd_soc_dapm_widget *w);
374
Richard Purdie808db4a2006-10-06 18:20:14 +0200375 /* external events */
376 unsigned short event_flags; /* flags to specify event types */
Laim Girdwood9af6d952008-01-10 14:41:02 +0100377 int (*event)(struct snd_soc_dapm_widget*, struct snd_kcontrol *, int);
Richard Purdie808db4a2006-10-06 18:20:14 +0200378
379 /* kcontrols that relate to this widget */
380 int num_kcontrols;
381 const struct snd_kcontrol_new *kcontrols;
382
383 /* widget input and outputs */
384 struct list_head sources;
385 struct list_head sinks;
Mark Brown6d3ddc82009-05-16 17:47:29 +0100386
387 /* used during DAPM updates */
388 struct list_head power_list;
Richard Purdie808db4a2006-10-06 18:20:14 +0200389};
390
391#endif