aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/oxygen.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2008-05-13 03:21:48 -0400
committerJaroslav Kysela <perex@perex.cz>2008-05-19 07:19:16 -0400
commitbbbfb5526650cb9d01c5c230a4e3cbbc18474c41 (patch)
treee4e210c41214d6018dd2a623b19f65236d634b51 /sound/pci/oxygen/oxygen.c
parente58aee95806c9d2bbcfc84cb85ce958e360165ef (diff)
[ALSA] oxygen: simplify DAC volume initialization
When initializing the DAC volume registers, we can just use the generic volume update functions instead of setting the registers manually. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/oxygen/oxygen.c')
-rw-r--r--sound/pci/oxygen/oxygen.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index 8287ac28fe78..ad8d950fddc6 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -112,6 +112,18 @@ static void wm8785_write(struct oxygen *chip, u8 reg, unsigned int value)
112 data->saved_wm8785_registers[reg] = value; 112 data->saved_wm8785_registers[reg] = value;
113} 113}
114 114
115static void update_ak4396_volume(struct oxygen *chip)
116{
117 unsigned int i;
118
119 for (i = 0; i < 4; ++i) {
120 ak4396_write(chip, i,
121 AK4396_LCH_ATT, chip->dac_volume[i * 2]);
122 ak4396_write(chip, i,
123 AK4396_RCH_ATT, chip->dac_volume[i * 2 + 1]);
124 }
125}
126
115static void ak4396_init(struct oxygen *chip) 127static void ak4396_init(struct oxygen *chip)
116{ 128{
117 struct generic_data *data = chip->model_data; 129 struct generic_data *data = chip->model_data;
@@ -125,9 +137,8 @@ static void ak4396_init(struct oxygen *chip)
125 AK4396_CONTROL_2, data->ak4396_ctl2); 137 AK4396_CONTROL_2, data->ak4396_ctl2);
126 ak4396_write(chip, i, 138 ak4396_write(chip, i,
127 AK4396_CONTROL_3, AK4396_PCM); 139 AK4396_CONTROL_3, AK4396_PCM);
128 ak4396_write(chip, i, AK4396_LCH_ATT, 0);
129 ak4396_write(chip, i, AK4396_RCH_ATT, 0);
130 } 140 }
141 update_ak4396_volume(chip);
131 snd_component_add(chip->card, "AK4396"); 142 snd_component_add(chip->card, "AK4396");
132} 143}
133 144
@@ -194,18 +205,6 @@ static void set_ak4396_params(struct oxygen *chip,
194 } 205 }
195} 206}
196 207
197static void update_ak4396_volume(struct oxygen *chip)
198{
199 unsigned int i;
200
201 for (i = 0; i < 4; ++i) {
202 ak4396_write(chip, i,
203 AK4396_LCH_ATT, chip->dac_volume[i * 2]);
204 ak4396_write(chip, i,
205 AK4396_RCH_ATT, chip->dac_volume[i * 2 + 1]);
206 }
207}
208
209static void update_ak4396_mute(struct oxygen *chip) 208static void update_ak4396_mute(struct oxygen *chip)
210{ 209{
211 struct generic_data *data = chip->model_data; 210 struct generic_data *data = chip->model_data;