aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorRoman Volkov <v1ron@mail.ru>2014-01-24 07:18:20 -0500
committerClemens Ladisch <clemens@ladisch.de>2014-01-29 14:45:53 -0500
commit3f49a66f6ceff1c87b49858644771c17763902ab (patch)
tree7f483ae4302e890874e6c9aa32580de330f9828d /sound/pci
parentfc114e9fbaf555e2d7fbfe144dac716142e22331 (diff)
ALSA: oxygen: Xonar DG(X): cleanup and minor changes
Remove old SPI control functions, change anti-pop init sequence, remove some garbage from structures. The 'Apply' functions must be called at the mixer initialization, otherwise mixer settings sometimes will not be applied at startup. Signed-off-by: Roman Volkov <v1ron@mail.ru> Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/oxygen/xonar_dg.c36
-rw-r--r--sound/pci/oxygen/xonar_dg.h3
-rw-r--r--sound/pci/oxygen/xonar_dg_mixer.c5
3 files changed, 11 insertions, 33 deletions
diff --git a/sound/pci/oxygen/xonar_dg.c b/sound/pci/oxygen/xonar_dg.c
index 6cec934e6628..ed6f199f8a38 100644
--- a/sound/pci/oxygen/xonar_dg.c
+++ b/sound/pci/oxygen/xonar_dg.c
@@ -123,29 +123,6 @@ int cs4245_shadow_control(struct oxygen *chip, enum cs4245_shadow_operation op)
123 return 0; 123 return 0;
124} 124}
125 125
126void cs4245_write(struct oxygen *chip, unsigned int reg, u8 value)
127{
128 struct dg *data = chip->model_data;
129
130 oxygen_write_spi(chip, OXYGEN_SPI_TRIGGER |
131 OXYGEN_SPI_DATA_LENGTH_3 |
132 OXYGEN_SPI_CLOCK_1280 |
133 (0 << OXYGEN_SPI_CODEC_SHIFT) |
134 OXYGEN_SPI_CEN_LATCH_CLOCK_HI,
135 CS4245_SPI_ADDRESS_S |
136 CS4245_SPI_WRITE_S |
137 (reg << 8) | value);
138 data->cs4245_shadow[reg] = value;
139}
140
141void cs4245_write_cached(struct oxygen *chip, unsigned int reg, u8 value)
142{
143 struct dg *data = chip->model_data;
144
145 if (value != data->cs4245_shadow[reg])
146 cs4245_write(chip, reg, value);
147}
148
149static void cs4245_init(struct oxygen *chip) 126static void cs4245_init(struct oxygen *chip)
150{ 127{
151 struct dg *data = chip->model_data; 128 struct dg *data = chip->model_data;
@@ -171,8 +148,8 @@ static void cs4245_init(struct oxygen *chip)
171 CS4245_PGA_SOFT | CS4245_PGA_ZERO; 148 CS4245_PGA_SOFT | CS4245_PGA_ZERO;
172 data->cs4245_shadow[CS4245_PGA_B_CTRL] = 0; 149 data->cs4245_shadow[CS4245_PGA_B_CTRL] = 0;
173 data->cs4245_shadow[CS4245_PGA_A_CTRL] = 0; 150 data->cs4245_shadow[CS4245_PGA_A_CTRL] = 0;
174 data->cs4245_shadow[CS4245_DAC_A_CTRL] = 4; 151 data->cs4245_shadow[CS4245_DAC_A_CTRL] = 8;
175 data->cs4245_shadow[CS4245_DAC_B_CTRL] = 4; 152 data->cs4245_shadow[CS4245_DAC_B_CTRL] = 8;
176 153
177 cs4245_shadow_control(chip, CS4245_LOAD_FROM_SHADOW); 154 cs4245_shadow_control(chip, CS4245_LOAD_FROM_SHADOW);
178 snd_component_add(chip->card, "CS4245"); 155 snd_component_add(chip->card, "CS4245");
@@ -182,15 +159,14 @@ void dg_init(struct oxygen *chip)
182{ 159{
183 struct dg *data = chip->model_data; 160 struct dg *data = chip->model_data;
184 161
185 data->output_sel = 0; 162 data->output_sel = PLAYBACK_DST_HP_FP;
186 data->input_sel = 3; 163 data->input_sel = CAPTURE_SRC_MIC;
187 data->hp_vol_att = 2 * 16;
188 164
189 cs4245_init(chip); 165 cs4245_init(chip);
190 oxygen_write16(chip, OXYGEN_GPIO_CONTROL, 166 oxygen_write16(chip, OXYGEN_GPIO_CONTROL,
191 GPIO_OUTPUT_ENABLE | GPIO_HP_REAR | GPIO_INPUT_ROUTE); 167 GPIO_OUTPUT_ENABLE | GPIO_HP_REAR | GPIO_INPUT_ROUTE);
192 oxygen_write16(chip, OXYGEN_GPIO_DATA, GPIO_INPUT_ROUTE); 168 /* anti-pop delay, wait some time before enabling the output */
193 msleep(2500); /* anti-pop delay */ 169 msleep(2500);
194 oxygen_write16(chip, OXYGEN_GPIO_DATA, 170 oxygen_write16(chip, OXYGEN_GPIO_DATA,
195 GPIO_OUTPUT_ENABLE | GPIO_INPUT_ROUTE); 171 GPIO_OUTPUT_ENABLE | GPIO_INPUT_ROUTE);
196} 172}
diff --git a/sound/pci/oxygen/xonar_dg.h b/sound/pci/oxygen/xonar_dg.h
index d900323f73d0..d461df357aa1 100644
--- a/sound/pci/oxygen/xonar_dg.h
+++ b/sound/pci/oxygen/xonar_dg.h
@@ -32,7 +32,6 @@ struct dg {
32 char input_vol[4][2]; 32 char input_vol[4][2];
33 /* input select: mic/fp mic/line/aux */ 33 /* input select: mic/fp mic/line/aux */
34 unsigned char input_sel; 34 unsigned char input_sel;
35 u8 hp_vol_att;
36}; 35};
37 36
38/* Xonar DG control routines */ 37/* Xonar DG control routines */
@@ -51,8 +50,6 @@ void dump_cs4245_registers(struct oxygen *chip,
51void dg_suspend(struct oxygen *chip); 50void dg_suspend(struct oxygen *chip);
52void dg_resume(struct oxygen *chip); 51void dg_resume(struct oxygen *chip);
53void dg_cleanup(struct oxygen *chip); 52void dg_cleanup(struct oxygen *chip);
54void cs4245_write(struct oxygen *chip, unsigned int reg, u8 value);
55void cs4245_write_cached(struct oxygen *chip, unsigned int reg, u8 value);
56 53
57extern struct oxygen_model model_xonar_dg; 54extern struct oxygen_model model_xonar_dg;
58 55
diff --git a/sound/pci/oxygen/xonar_dg_mixer.c b/sound/pci/oxygen/xonar_dg_mixer.c
index dfdfc991f8e6..b885dac28a09 100644
--- a/sound/pci/oxygen/xonar_dg_mixer.c
+++ b/sound/pci/oxygen/xonar_dg_mixer.c
@@ -435,12 +435,17 @@ static int dg_mixer_init(struct oxygen *chip)
435 unsigned int i; 435 unsigned int i;
436 int err; 436 int err;
437 437
438 output_select_apply(chip);
439 input_source_apply(chip);
440 oxygen_update_dac_routing(chip);
441
438 for (i = 0; i < ARRAY_SIZE(dg_controls); ++i) { 442 for (i = 0; i < ARRAY_SIZE(dg_controls); ++i) {
439 err = snd_ctl_add(chip->card, 443 err = snd_ctl_add(chip->card,
440 snd_ctl_new1(&dg_controls[i], chip)); 444 snd_ctl_new1(&dg_controls[i], chip));
441 if (err < 0) 445 if (err < 0)
442 return err; 446 return err;
443 } 447 }
448
444 return 0; 449 return 0;
445} 450}
446 451