| OLD | NEW |
| 1 /* | 1 /* |
| 2 * linux/sound/soc-dapm.h -- ALSA SoC Dynamic Audio Power Management | 2 * linux/sound/soc-dapm.h -- ALSA SoC Dynamic Audio Power Management |
| 3 * | 3 * |
| 4 * Author: Liam Girdwood | 4 * Author: Liam Girdwood |
| 5 * Created: Aug 11th 2005 | 5 * Created: Aug 11th 2005 |
| 6 * Copyright: Wolfson Microelectronics. PLC. | 6 * Copyright: Wolfson Microelectronics. PLC. |
| 7 * | 7 * |
| 8 * This program is free software; you can redistribute it and/or modify | 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 | 9 * it under the terms of the GNU General Public License version 2 as |
| 10 * published by the Free Software Foundation. | 10 * published by the Free Software Foundation. |
| 11 */ | 11 */ |
| 12 | 12 |
| 13 #ifndef __LINUX_SND_SOC_DAPM_H | 13 #ifndef __LINUX_SND_SOC_DAPM_H |
| 14 #define __LINUX_SND_SOC_DAPM_H | 14 #define __LINUX_SND_SOC_DAPM_H |
| 15 | 15 |
| 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 |
| 23 | 22 |
| 24 /* | 23 /* |
| 25 * SoC dynamic audio power management | 24 * SoC dynamic audio power management |
| 26 * | 25 * |
| 27 * We can have upto 4 power domains | 26 * We can have upto 4 power domains |
| 28 * 1. Codec domain - VREF, VMID | 27 * 1. Codec domain - VREF, VMID |
| 29 * Usually controlled at codec probe/remove, although can be set | 28 * Usually controlled at codec probe/remove, although can be set |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 #define SND_SOC_DAPM_LINE(wname, wevent) \ | 64 #define SND_SOC_DAPM_LINE(wname, wevent) \ |
| 66 { .id = snd_soc_dapm_line, .name = wname, .kcontrols = NULL, \ | 65 { .id = snd_soc_dapm_line, .name = wname, .kcontrols = NULL, \ |
| 67 .num_kcontrols = 0, .event = wevent, \ | 66 .num_kcontrols = 0, .event = wevent, \ |
| 68 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD} | 67 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD} |
| 69 | 68 |
| 70 /* path domain */ | 69 /* path domain */ |
| 71 #define SND_SOC_DAPM_PGA(wname, wreg, wshift, winvert,\ | 70 #define SND_SOC_DAPM_PGA(wname, wreg, wshift, winvert,\ |
| 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, \ |
| 78 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols} | 81 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols} |
| 79 #define SND_SOC_DAPM_MIXER_NAMED_CTL(wname, wreg, wshift, winvert, \ | 82 #define SND_SOC_DAPM_MIXER_NAMED_CTL(wname, wreg, wshift, winvert, \ |
| 80 wcontrols, wncontrols)\ | 83 wcontrols, wncontrols)\ |
| 81 { .id = snd_soc_dapm_mixer_named_ctl, .name = wname, .reg = wreg, \ | 84 { .id = snd_soc_dapm_mixer_named_ctl, .name = wname, .reg = wreg, \ |
| 82 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \ | 85 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \ |
| 83 .num_kcontrols = wncontrols} | 86 .num_kcontrols = wncontrols} |
| 84 #define SND_SOC_DAPM_MICBIAS(wname, wreg, wshift, winvert) \ | 87 #define SND_SOC_DAPM_MICBIAS(wname, wreg, wshift, winvert) \ |
| 85 { .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift,
\ | 88 { .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift,
\ |
| 86 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0} | 89 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0} |
| 87 #define SND_SOC_DAPM_SWITCH(wname, wreg, wshift, winvert, wcontrols) \ | 90 #define SND_SOC_DAPM_SWITCH(wname, wreg, wshift, winvert, wcontrols) \ |
| 88 { .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift,
\ | 91 { .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift,
\ |
| 89 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1} | 92 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1} |
| 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, \ |
| 96 .num_kcontrols = 1} | 102 .num_kcontrols = 1} |
| 97 | 103 |
| 98 /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontro
ls) */ | 104 /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontro
ls) */ |
| 99 #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ | 105 #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ |
| 100 wcontrols) \ | 106 wcontrols) \ |
| 101 { .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ | 107 { .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ |
| 102 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(w
controls)} | 108 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(w
controls)} |
| 103 #define SOC_MIXER_ARRAY(wname, wreg, wshift, winvert, \ | 109 #define SOC_MIXER_ARRAY(wname, wreg, wshift, winvert, \ |
| 104 wcontrols)\ | 110 wcontrols)\ |
| 105 { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ | 111 { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ |
| 106 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(w
controls)} | 112 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(w
controls)} |
| 107 #define SOC_MIXER_NAMED_CTL_ARRAY(wname, wreg, wshift, winvert, \ | 113 #define SOC_MIXER_NAMED_CTL_ARRAY(wname, wreg, wshift, winvert, \ |
| 108 wcontrols)\ | 114 wcontrols)\ |
| 109 { .id = snd_soc_dapm_mixer_named_ctl, .name = wname, .reg = wreg, \ | 115 { .id = snd_soc_dapm_mixer_named_ctl, .name = wname, .reg = wreg, \ |
| 110 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \ | 116 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \ |
| 111 .num_kcontrols = ARRAY_SIZE(wcontrols)} | 117 .num_kcontrols = ARRAY_SIZE(wcontrols)} |
| 112 | 118 |
| 113 /* path domain with event - event handler must return 0 for success */ | 119 /* path domain with event - event handler must return 0 for success */ |
| 114 #define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \ | 120 #define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \ |
| 115 wncontrols, wevent, wflags) \ | 121 wncontrols, wevent, wflags) \ |
| 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, \ |
| 122 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols,
\ | 133 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols,
\ |
| 123 .event = wevent, .event_flags = wflags} | 134 .event = wevent, .event_flags = wflags} |
| 124 #define SND_SOC_DAPM_MIXER_NAMED_CTL_E(wname, wreg, wshift, winvert, \ | 135 #define SND_SOC_DAPM_MIXER_NAMED_CTL_E(wname, wreg, wshift, winvert, \ |
| 125 wcontrols, wncontrols, wevent, wflags) \ | 136 wcontrols, wncontrols, wevent, wflags) \ |
| 126 { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ | 137 { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ |
| 127 .invert = winvert, .kcontrols = wcontrols, \ | 138 .invert = winvert, .kcontrols = wcontrols, \ |
| 128 .num_kcontrols = wncontrols, .event = wevent, .event_flags = wflags} | 139 .num_kcontrols = wncontrols, .event = wevent, .event_flags = wflags} |
| 129 #define SND_SOC_DAPM_MICBIAS_E(wname, wreg, wshift, winvert, wevent, wflags) \ | 140 #define SND_SOC_DAPM_MICBIAS_E(wname, wreg, wshift, winvert, wevent, wflags) \ |
| 130 { .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift,
\ | 141 { .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift,
\ |
| 131 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0, \ | 142 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0, \ |
| 132 .event = wevent, .event_flags = wflags} | 143 .event = wevent, .event_flags = wflags} |
| 133 #define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \ | 144 #define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \ |
| 134 wevent, wflags) \ | 145 wevent, wflags) \ |
| 135 { .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift,
\ | 146 { .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift,
\ |
| 136 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \ | 147 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \ |
| 137 .event = wevent, .event_flags = wflags} | 148 .event = wevent, .event_flags = wflags} |
| 138 #define SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, \ | 149 #define SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, \ |
| 139 wevent, wflags) \ | 150 wevent, wflags) \ |
| 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} |
| 159 |
| 160 /* additional sequencing control within an event type */ |
| 161 #define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \ |
| 162 wevent, wflags) \ |
| 163 { .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ |
| 164 .invert = winvert, .event = wevent, .event_flags = wflags, \ |
| 165 .subseq = wsubseq} |
| 166 #define SND_SOC_DAPM_SUPPLY_S(wname, wsubseq, wreg, wshift, winvert, wevent, \ |
| 167 wflags) \ |
| 168 { .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \ |
| 169 .shift = wshift, .invert = winvert, .event = wevent, \ |
| 170 .event_flags = wflags, .subseq = wsubseq} |
| 143 | 171 |
| 144 /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontro
ls) */ | 172 /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontro
ls) */ |
| 145 #define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \ | 173 #define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \ |
| 146 wevent, wflags) \ | 174 wevent, wflags) \ |
| 147 { .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ | 175 { .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ |
| 148 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(w
controls), \ | 176 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(w
controls), \ |
| 149 .event = wevent, .event_flags = wflags} | 177 .event = wevent, .event_flags = wflags} |
| 150 #define SOC_MIXER_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \ | 178 #define SOC_MIXER_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \ |
| 151 wevent, wflags) \ | 179 wevent, wflags) \ |
| 152 { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ | 180 { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 { .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \ | 240 { .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \ |
| 213 .shift = wshift, .invert = winvert, .event = wevent, \ | 241 .shift = wshift, .invert = winvert, .event = wevent, \ |
| 214 .event_flags = wflags} | 242 .event_flags = wflags} |
| 215 | 243 |
| 216 /* dapm kcontrol types */ | 244 /* dapm kcontrol types */ |
| 217 #define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \ | 245 #define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \ |
| 218 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 246 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
| 219 .info = snd_soc_info_volsw, \ | 247 .info = snd_soc_info_volsw, \ |
| 220 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ | 248 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ |
| 221 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } | 249 .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) \ | 250 #define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ |
| 230 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 251 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
| 231 .info = snd_soc_info_volsw, \ | 252 .info = snd_soc_info_volsw, \ |
| 232 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRI
TE,\ | 253 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRI
TE,\ |
| 233 .tlv.p = (tlv_array), \ | 254 .tlv.p = (tlv_array), \ |
| 234 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ | 255 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ |
| 235 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } | 256 .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_READWRI
TE,\ | |
| 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) \ | 257 #define SOC_DAPM_ENUM(xname, xenum) \ |
| 246 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 258 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
| 247 .info = snd_soc_info_enum_double, \ | 259 .info = snd_soc_info_enum_double, \ |
| 248 .get = snd_soc_dapm_get_enum_double, \ | 260 .get = snd_soc_dapm_get_enum_double, \ |
| 249 .put = snd_soc_dapm_put_enum_double, \ | 261 .put = snd_soc_dapm_put_enum_double, \ |
| 250 .private_value = (unsigned long)&xenum } | 262 .private_value = (unsigned long)&xenum } |
| 251 #define SOC_DAPM_ENUM_VIRT(xname, xenum) \ | 263 #define SOC_DAPM_ENUM_VIRT(xname, xenum) \ |
| 252 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 264 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
| 253 .info = snd_soc_info_enum_double, \ | 265 .info = snd_soc_info_enum_double, \ |
| 254 .get = snd_soc_dapm_get_enum_virt, \ | 266 .get = snd_soc_dapm_get_enum_virt, \ |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 #define SND_SOC_DAPM_EVENT_ON(e) \ | 302 #define SND_SOC_DAPM_EVENT_ON(e) \ |
| 291 (e & (SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU)) | 303 (e & (SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU)) |
| 292 #define SND_SOC_DAPM_EVENT_OFF(e) \ | 304 #define SND_SOC_DAPM_EVENT_OFF(e) \ |
| 293 (e & (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)) | 305 (e & (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)) |
| 294 | 306 |
| 295 struct snd_soc_dapm_widget; | 307 struct snd_soc_dapm_widget; |
| 296 enum snd_soc_dapm_type; | 308 enum snd_soc_dapm_type; |
| 297 struct snd_soc_dapm_path; | 309 struct snd_soc_dapm_path; |
| 298 struct snd_soc_dapm_pin; | 310 struct snd_soc_dapm_pin; |
| 299 struct snd_soc_dapm_route; | 311 struct snd_soc_dapm_route; |
| 312 struct snd_soc_dapm_context; |
| 300 | 313 |
| 301 int dapm_reg_event(struct snd_soc_dapm_widget *w, | 314 int dapm_reg_event(struct snd_soc_dapm_widget *w, |
| 302 struct snd_kcontrol *kcontrol, int event); | 315 struct snd_kcontrol *kcontrol, int event); |
| 303 | 316 |
| 304 /* dapm controls */ | 317 /* dapm controls */ |
| 305 int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, | 318 int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, |
| 306 struct snd_ctl_elem_value *ucontrol); | 319 struct snd_ctl_elem_value *ucontrol); |
| 307 int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol, | 320 int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol, |
| 308 struct snd_ctl_elem_value *ucontrol); | 321 struct snd_ctl_elem_value *ucontrol); |
| 309 int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, | 322 int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, |
| 310 struct snd_ctl_elem_value *ucontrol); | 323 struct snd_ctl_elem_value *ucontrol); |
| 311 int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, | 324 int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, |
| 312 struct snd_ctl_elem_value *ucontrol); | 325 struct snd_ctl_elem_value *ucontrol); |
| 313 int snd_soc_dapm_get_enum_virt(struct snd_kcontrol *kcontrol, | 326 int snd_soc_dapm_get_enum_virt(struct snd_kcontrol *kcontrol, |
| 314 struct snd_ctl_elem_value *ucontrol); | 327 struct snd_ctl_elem_value *ucontrol); |
| 315 int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, | 328 int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, |
| 316 struct snd_ctl_elem_value *ucontrol); | 329 struct snd_ctl_elem_value *ucontrol); |
| 317 int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol, | 330 int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol, |
| 318 struct snd_ctl_elem_value *ucontrol); | 331 struct snd_ctl_elem_value *ucontrol); |
| 319 int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, | 332 int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, |
| 320 struct snd_ctl_elem_value *ucontrol); | 333 struct snd_ctl_elem_value *ucontrol); |
| 321 int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol, | 334 int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol, |
| 322 struct snd_ctl_elem_info *uinfo); | 335 struct snd_ctl_elem_info *uinfo); |
| 323 int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol, | 336 int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol, |
| 324 struct snd_ctl_elem_value *uncontrol); | 337 struct snd_ctl_elem_value *uncontrol); |
| 325 int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, | 338 int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, |
| 326 struct snd_ctl_elem_value *uncontrol); | 339 struct snd_ctl_elem_value *uncontrol); |
| 327 int snd_soc_dapm_new_control(struct snd_soc_codec *codec, | 340 int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, |
| 328 const struct snd_soc_dapm_widget *widget); | 341 const struct snd_soc_dapm_widget *widget); |
| 329 int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, | 342 int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm, |
| 330 const struct snd_soc_dapm_widget *widget, | 343 const struct snd_soc_dapm_widget *widget, |
| 331 int num); | 344 int num); |
| 332 | 345 |
| 333 /* dapm path setup */ | 346 /* dapm path setup */ |
| 334 int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec); | 347 int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm); |
| 335 void snd_soc_dapm_free(struct snd_soc_codec *codec); | 348 void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm); |
| 336 int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, | 349 int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm, |
| 337 const struct snd_soc_dapm_route *route, int num); | 350 const struct snd_soc_dapm_route *route, int num); |
| 338 | 351 |
| 339 /* dapm events */ | 352 /* dapm events */ |
| 340 int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, | 353 int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, |
| 341 const char *stream, int event); | 354 const char *stream, int event); |
| 342 void snd_soc_dapm_shutdown(struct snd_soc_card *card); | 355 void snd_soc_dapm_shutdown(struct snd_soc_card *card); |
| 343 | 356 |
| 344 /* dapm sys fs - used by the core */ | 357 /* dapm sys fs - used by the core */ |
| 345 int snd_soc_dapm_sys_add(struct device *dev); | 358 int snd_soc_dapm_sys_add(struct device *dev); |
| 346 void snd_soc_dapm_debugfs_init(struct snd_soc_codec *codec); | 359 void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm); |
| 347 | 360 |
| 348 /* dapm audio pin control and status */ | 361 /* dapm audio pin control and status */ |
| 349 int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin); | 362 int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, |
| 350 int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin); | 363 » » » const char *pin); |
| 351 int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin); | 364 int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, |
| 352 int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin); | 365 » » » const char *pin); |
| 353 int snd_soc_dapm_sync(struct snd_soc_codec *codec); | 366 int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin); |
| 354 int snd_soc_dapm_force_enable_pin(struct snd_soc_codec *codec, | 367 int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm, |
| 368 » » » » const char *pin); |
| 369 int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm); |
| 370 int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, |
| 355 const char *pin); | 371 const char *pin); |
| 356 int snd_soc_dapm_ignore_suspend(struct snd_soc_codec *codec, const char *pin); | 372 int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, |
| 373 » » » » const char *pin); |
| 357 | 374 |
| 358 /* dapm widget types */ | 375 /* dapm widget types */ |
| 359 enum snd_soc_dapm_type { | 376 enum snd_soc_dapm_type { |
| 360 snd_soc_dapm_input = 0, /* input pin */ | 377 snd_soc_dapm_input = 0, /* input pin */ |
| 361 snd_soc_dapm_output, /* output pin */ | 378 snd_soc_dapm_output, /* output pin */ |
| 362 snd_soc_dapm_mux, /* selects 1 analog signal from
many inputs */ | 379 snd_soc_dapm_mux, /* selects 1 analog signal from
many inputs */ |
| 380 snd_soc_dapm_virt_mux, /* virtual version of snd_soc_da
pm_mux */ |
| 363 snd_soc_dapm_value_mux, /* selects 1 analog signal from
many inputs */ | 381 snd_soc_dapm_value_mux, /* selects 1 analog signal from
many inputs */ |
| 364 snd_soc_dapm_mixer, /* mixes several analog signals
together */ | 382 snd_soc_dapm_mixer, /* mixes several analog signals
together */ |
| 365 snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ | 383 snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ |
| 366 snd_soc_dapm_pga, /* programmable gain/attenuation
(volume) */ | 384 snd_soc_dapm_pga, /* programmable gain/attenuation
(volume) */ |
| 385 snd_soc_dapm_out_drv, /* output driver */ |
| 367 snd_soc_dapm_adc, /* analog to digital converter *
/ | 386 snd_soc_dapm_adc, /* analog to digital converter *
/ |
| 368 snd_soc_dapm_dac, /* digital to analog converter *
/ | 387 snd_soc_dapm_dac, /* digital to analog converter *
/ |
| 369 snd_soc_dapm_micbias, /* microphone bias (power) */ | 388 snd_soc_dapm_micbias, /* microphone bias (power) */ |
| 370 snd_soc_dapm_mic, /* microphone */ | 389 snd_soc_dapm_mic, /* microphone */ |
| 371 snd_soc_dapm_hp, /* headphones */ | 390 snd_soc_dapm_hp, /* headphones */ |
| 372 snd_soc_dapm_spk, /* speaker */ | 391 snd_soc_dapm_spk, /* speaker */ |
| 373 snd_soc_dapm_line, /* line input/output */ | 392 snd_soc_dapm_line, /* line input/output */ |
| 374 snd_soc_dapm_switch, /* analog switch */ | 393 snd_soc_dapm_switch, /* analog switch */ |
| 375 snd_soc_dapm_vmid, /* codec bias/vmid - to minimise
pops */ | 394 snd_soc_dapm_vmid, /* codec bias/vmid - to minimise
pops */ |
| 376 snd_soc_dapm_pre, /* machine specific pre widget -
exec first */ | 395 snd_soc_dapm_pre, /* machine specific pre widget -
exec first */ |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 struct list_head list; | 437 struct list_head list; |
| 419 }; | 438 }; |
| 420 | 439 |
| 421 /* dapm widget */ | 440 /* dapm widget */ |
| 422 struct snd_soc_dapm_widget { | 441 struct snd_soc_dapm_widget { |
| 423 enum snd_soc_dapm_type id; | 442 enum snd_soc_dapm_type id; |
| 424 char *name; /* widget name */ | 443 char *name; /* widget name */ |
| 425 char *sname; /* stream name */ | 444 char *sname; /* stream name */ |
| 426 struct snd_soc_codec *codec; | 445 struct snd_soc_codec *codec; |
| 427 struct list_head list; | 446 struct list_head list; |
| 447 struct snd_soc_dapm_context *dapm; |
| 428 | 448 |
| 429 /* dapm control */ | 449 /* dapm control */ |
| 430 short reg; /* negative reg
= no direct dapm */ | 450 short reg; /* negative reg
= no direct dapm */ |
| 431 unsigned char shift; /* bits to shift */ | 451 unsigned char shift; /* bits to shift */ |
| 432 unsigned int saved_value; /* widget saved value */ | 452 unsigned int saved_value; /* widget saved value */ |
| 433 unsigned int value; /* widget current value
*/ | 453 unsigned int value; /* widget current value
*/ |
| 434 unsigned int mask; /* non-shifted mask */ | 454 unsigned int mask; /* non-shifted mask */ |
| 435 unsigned int on_val; /* on state value */ | 455 unsigned int on_val; /* on state value */ |
| 436 unsigned int off_val; /* off state value */ | 456 unsigned int off_val; /* off state value */ |
| 437 unsigned char power:1; /* block power status */ | 457 unsigned char power:1; /* block power status */ |
| 438 unsigned char invert:1; /* invert the power bit */ | 458 unsigned char invert:1; /* invert the power bit */ |
| 439 unsigned char active:1; /* active stream on DAC, ADC's *
/ | 459 unsigned char active:1; /* active stream on DAC, ADC's *
/ |
| 440 unsigned char connected:1; /* connected codec pin */ | 460 unsigned char connected:1; /* connected codec pin */ |
| 441 unsigned char new:1; /* cnew complete */ | 461 unsigned char new:1; /* cnew complete */ |
| 442 unsigned char ext:1; /* has external widgets */ | 462 unsigned char ext:1; /* has external widgets */ |
| 443 unsigned char force:1; /* force state */ | 463 unsigned char force:1; /* force state */ |
| 444 unsigned char ignore_suspend:1; /* kept enabled over suspend */ | 464 unsigned char ignore_suspend:1; /* kept enabled over suspend */ |
| 465 int subseq; /* sort within widget type */ |
| 445 | 466 |
| 446 int (*power_check)(struct snd_soc_dapm_widget *w); | 467 int (*power_check)(struct snd_soc_dapm_widget *w); |
| 447 | 468 |
| 448 /* external events */ | 469 /* external events */ |
| 449 unsigned short event_flags; /* flags to specify event types
*/ | 470 unsigned short event_flags; /* flags to specify event types
*/ |
| 450 int (*event)(struct snd_soc_dapm_widget*, struct snd_kcontrol *, int); | 471 int (*event)(struct snd_soc_dapm_widget*, struct snd_kcontrol *, int); |
| 451 | 472 |
| 452 /* kcontrols that relate to this widget */ | 473 /* kcontrols that relate to this widget */ |
| 453 int num_kcontrols; | 474 int num_kcontrols; |
| 454 const struct snd_kcontrol_new *kcontrols; | 475 const struct snd_kcontrol_new *kcontrols; |
| 455 | 476 |
| 456 /* widget input and outputs */ | 477 /* widget input and outputs */ |
| 457 struct list_head sources; | 478 struct list_head sources; |
| 458 struct list_head sinks; | 479 struct list_head sinks; |
| 459 | 480 |
| 460 /* used during DAPM updates */ | 481 /* used during DAPM updates */ |
| 461 struct list_head power_list; | 482 struct list_head power_list; |
| 462 }; | 483 }; |
| 463 | 484 |
| 485 struct snd_soc_dapm_update { |
| 486 struct snd_soc_dapm_widget *widget; |
| 487 struct snd_kcontrol *kcontrol; |
| 488 int reg; |
| 489 int mask; |
| 490 int val; |
| 491 }; |
| 492 |
| 493 /* DAPM context */ |
| 494 struct snd_soc_dapm_context { |
| 495 int n_widgets; /* number of widgets in this context */ |
| 496 enum snd_soc_bias_level bias_level; |
| 497 enum snd_soc_bias_level suspend_bias_level; |
| 498 struct delayed_work delayed_work; |
| 499 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */ |
| 500 |
| 501 struct snd_soc_dapm_update *update; |
| 502 |
| 503 void (*seq_notifier)(struct snd_soc_dapm_context *, |
| 504 enum snd_soc_dapm_type, int); |
| 505 |
| 506 struct device *dev; /* from parent - for debug */ |
| 507 struct snd_soc_codec *codec; /* parent codec */ |
| 508 struct snd_soc_card *card; /* parent card */ |
| 509 |
| 510 /* used during DAPM updates */ |
| 511 int dev_power; |
| 512 struct list_head list; |
| 513 |
| 514 #ifdef CONFIG_DEBUG_FS |
| 515 struct dentry *debugfs_dapm; |
| 464 #endif | 516 #endif |
| 517 }; |
| 518 |
| 519 #endif |
| OLD | NEW |