aboutsummaryrefslogtreecommitdiffstats
path: root/sound/ppc/daca.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/ppc/daca.c')
-rw-r--r--sound/ppc/daca.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c
index c5a1f0be6a4d..8432c16cd6ff 100644
--- a/sound/ppc/daca.c
+++ b/sound/ppc/daca.c
@@ -19,7 +19,6 @@
19 */ 19 */
20 20
21 21
22#include <sound/driver.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/i2c.h> 23#include <linux/i2c.h>
25#include <linux/kmod.h> 24#include <linux/kmod.h>
@@ -115,7 +114,7 @@ static int daca_put_deemphasis(struct snd_kcontrol *kcontrol,
115 return -ENODEV; 114 return -ENODEV;
116 change = mix->deemphasis != ucontrol->value.integer.value[0]; 115 change = mix->deemphasis != ucontrol->value.integer.value[0];
117 if (change) { 116 if (change) {
118 mix->deemphasis = ucontrol->value.integer.value[0]; 117 mix->deemphasis = !!ucontrol->value.integer.value[0];
119 daca_set_volume(mix); 118 daca_set_volume(mix);
120 } 119 }
121 return change; 120 return change;
@@ -149,15 +148,20 @@ static int daca_put_volume(struct snd_kcontrol *kcontrol,
149{ 148{
150 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 149 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
151 struct pmac_daca *mix; 150 struct pmac_daca *mix;
151 unsigned int vol[2];
152 int change; 152 int change;
153 153
154 if (! (mix = chip->mixer_data)) 154 if (! (mix = chip->mixer_data))
155 return -ENODEV; 155 return -ENODEV;
156 change = mix->left_vol != ucontrol->value.integer.value[0] || 156 vol[0] = ucontrol->value.integer.value[0];
157 mix->right_vol != ucontrol->value.integer.value[1]; 157 vol[1] = ucontrol->value.integer.value[1];
158 if (vol[0] > DACA_VOL_MAX || vol[1] > DACA_VOL_MAX)
159 return -EINVAL;
160 change = mix->left_vol != vol[0] ||
161 mix->right_vol != vol[1];
158 if (change) { 162 if (change) {
159 mix->left_vol = ucontrol->value.integer.value[0]; 163 mix->left_vol = vol[0];
160 mix->right_vol = ucontrol->value.integer.value[1]; 164 mix->right_vol = vol[1];
161 daca_set_volume(mix); 165 daca_set_volume(mix);
162 } 166 }
163 return change; 167 return change;
@@ -188,7 +192,7 @@ static int daca_put_amp(struct snd_kcontrol *kcontrol,
188 return -ENODEV; 192 return -ENODEV;
189 change = mix->amp_on != ucontrol->value.integer.value[0]; 193 change = mix->amp_on != ucontrol->value.integer.value[0];
190 if (change) { 194 if (change) {
191 mix->amp_on = ucontrol->value.integer.value[0]; 195 mix->amp_on = !!ucontrol->value.integer.value[0];
192 i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_GCFG, 196 i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_GCFG,
193 mix->amp_on ? 0x05 : 0x04); 197 mix->amp_on ? 0x05 : 0x04);
194 } 198 }