aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorJon Smirl <jonsmirl@gmail.com>2008-07-29 06:42:26 -0400
committerJaroslav Kysela <perex@perex.cz>2008-07-29 15:32:16 -0400
commit4eaa9819dc08d7bfd1065ce530e31b18a119dcaf (patch)
tree022aa2195b94f0d886851c3cbcad818a13967644 /sound/soc/soc-dapm.c
parent58cd33c0f375578cfda25a52ed280caa888b6254 (diff)
ALSA: ASoC: Convert bitfields in ASoC into full int width
Convert bitfields in ASoC into full int width. This is a simple mechanical conversion. Two places in the DAPM code were fixed to properly use mask. Signed-off-by: Jon Smirl <jonsmirl@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index f9d100bc8479..bbdca0dacba6 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -104,10 +104,13 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
104 case snd_soc_dapm_switch: 104 case snd_soc_dapm_switch:
105 case snd_soc_dapm_mixer: { 105 case snd_soc_dapm_mixer: {
106 int val; 106 int val;
107 int reg = w->kcontrols[i].private_value & 0xff; 107 struct soc_mixer_control *mc = (struct soc_mixer_control *)
108 int shift = (w->kcontrols[i].private_value >> 8) & 0x0f; 108 w->kcontrols[i].private_value;
109 int mask = (w->kcontrols[i].private_value >> 16) & 0xff; 109 uint reg = mc->reg;
110 int invert = (w->kcontrols[i].private_value >> 24) & 0x01; 110 uint shift = mc->shift;
111 int max = mc->max;
112 uint mask = (1 << fls(max)) - 1;
113 uint invert = mc->invert;
111 114
112 val = snd_soc_read(w->codec, reg); 115 val = snd_soc_read(w->codec, reg);
113 val = (val >> shift) & mask; 116 val = (val >> shift) & mask;
@@ -247,16 +250,19 @@ static int dapm_set_pga(struct snd_soc_dapm_widget *widget, int power)
247 return 0; 250 return 0;
248 251
249 if (widget->num_kcontrols && k) { 252 if (widget->num_kcontrols && k) {
250 int reg = k->private_value & 0xff; 253 struct soc_mixer_control *mc =
251 int shift = (k->private_value >> 8) & 0x0f; 254 (struct soc_mixer_control *)k->private_value;
252 int mask = (k->private_value >> 16) & 0xff; 255 uint reg = mc->reg;
253 int invert = (k->private_value >> 24) & 0x01; 256 uint shift = mc->shift;
257 int max = mc->max;
258 uint mask = (1 << fls(max)) - 1;
259 uint invert = mc->invert;
254 260
255 if (power) { 261 if (power) {
256 int i; 262 int i;
257 /* power up has happended, increase volume to last level */ 263 /* power up has happended, increase volume to last level */
258 if (invert) { 264 if (invert) {
259 for (i = mask; i > widget->saved_value; i--) 265 for (i = max; i > widget->saved_value; i--)
260 snd_soc_update_bits(widget->codec, reg, mask, i); 266 snd_soc_update_bits(widget->codec, reg, mask, i);
261 } else { 267 } else {
262 for (i = 0; i < widget->saved_value; i++) 268 for (i = 0; i < widget->saved_value; i++)
@@ -1133,12 +1139,14 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
1133 struct snd_ctl_elem_value *ucontrol) 1139 struct snd_ctl_elem_value *ucontrol)
1134{ 1140{
1135 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); 1141 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
1136 int reg = kcontrol->private_value & 0xff; 1142 struct soc_mixer_control *mc =
1137 int shift = (kcontrol->private_value >> 8) & 0x0f; 1143 (struct soc_mixer_control *)kcontrol->private_value;
1138 int rshift = (kcontrol->private_value >> 12) & 0x0f; 1144 uint reg = mc->reg;
1139 int max = (kcontrol->private_value >> 16) & 0xff; 1145 uint shift = mc->shift;
1140 int invert = (kcontrol->private_value >> 24) & 0x01; 1146 uint rshift = mc->rshift;
1141 int mask = (1 << fls(max)) - 1; 1147 int max = mc->max;
1148 uint invert = mc->invert;
1149 uint mask = (1 << fls(max)) - 1;
1142 1150
1143 /* return the saved value if we are powered down */ 1151 /* return the saved value if we are powered down */
1144 if (widget->id == snd_soc_dapm_pga && !widget->power) { 1152 if (widget->id == snd_soc_dapm_pga && !widget->power) {
@@ -1176,12 +1184,14 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
1176 struct snd_ctl_elem_value *ucontrol) 1184 struct snd_ctl_elem_value *ucontrol)
1177{ 1185{
1178 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); 1186 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
1179 int reg = kcontrol->private_value & 0xff; 1187 struct soc_mixer_control *mc =
1180 int shift = (kcontrol->private_value >> 8) & 0x0f; 1188 (struct soc_mixer_control *)kcontrol->private_value;
1181 int rshift = (kcontrol->private_value >> 12) & 0x0f; 1189 uint reg = mc->reg;
1182 int max = (kcontrol->private_value >> 16) & 0xff; 1190 uint shift = mc->shift;
1183 int mask = (1 << fls(max)) - 1; 1191 uint rshift = mc->rshift;
1184 int invert = (kcontrol->private_value >> 24) & 0x01; 1192 int max = mc->max;
1193 uint mask = (1 << fls(max)) - 1;
1194 uint invert = mc->invert;
1185 unsigned short val, val2, val_mask; 1195 unsigned short val, val2, val_mask;
1186 int ret; 1196 int ret;
1187 1197