aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/xonar_dg.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/oxygen/xonar_dg.c')
-rw-r--r--sound/pci/oxygen/xonar_dg.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/sound/pci/oxygen/xonar_dg.c b/sound/pci/oxygen/xonar_dg.c
index e1fa602eba79..bc6eb58be380 100644
--- a/sound/pci/oxygen/xonar_dg.c
+++ b/sound/pci/oxygen/xonar_dg.c
@@ -24,6 +24,11 @@
24 * 24 *
25 * SPI 0 -> CS4245 25 * SPI 0 -> CS4245
26 * 26 *
27 * I²S 1 -> CS4245
28 * I²S 2 -> CS4361 (center/LFE)
29 * I²S 3 -> CS4361 (surround)
30 * I²S 4 -> CS4361 (front)
31 *
27 * GPIO 3 <- ? 32 * GPIO 3 <- ?
28 * GPIO 4 <- headphone detect 33 * GPIO 4 <- headphone detect
29 * GPIO 5 -> route input jack to line-in (0) or mic-in (1) 34 * GPIO 5 -> route input jack to line-in (0) or mic-in (1)
@@ -36,6 +41,7 @@
36 * input 1 <- aux 41 * input 1 <- aux
37 * input 2 <- front mic 42 * input 2 <- front mic
38 * input 4 <- line/mic 43 * input 4 <- line/mic
44 * DAC out -> headphones
39 * aux out -> front panel headphones 45 * aux out -> front panel headphones
40 */ 46 */
41 47
@@ -207,6 +213,35 @@ static void set_cs4245_adc_params(struct oxygen *chip,
207 cs4245_write_cached(chip, CS4245_ADC_CTRL, value); 213 cs4245_write_cached(chip, CS4245_ADC_CTRL, value);
208} 214}
209 215
216static inline unsigned int shift_bits(unsigned int value,
217 unsigned int shift_from,
218 unsigned int shift_to,
219 unsigned int mask)
220{
221 if (shift_from < shift_to)
222 return (value << (shift_to - shift_from)) & mask;
223 else
224 return (value >> (shift_from - shift_to)) & mask;
225}
226
227static unsigned int adjust_dg_dac_routing(struct oxygen *chip,
228 unsigned int play_routing)
229{
230 return (play_routing & OXYGEN_PLAY_DAC0_SOURCE_MASK) |
231 shift_bits(play_routing,
232 OXYGEN_PLAY_DAC2_SOURCE_SHIFT,
233 OXYGEN_PLAY_DAC1_SOURCE_SHIFT,
234 OXYGEN_PLAY_DAC1_SOURCE_MASK) |
235 shift_bits(play_routing,
236 OXYGEN_PLAY_DAC1_SOURCE_SHIFT,
237 OXYGEN_PLAY_DAC2_SOURCE_SHIFT,
238 OXYGEN_PLAY_DAC2_SOURCE_MASK) |
239 shift_bits(play_routing,
240 OXYGEN_PLAY_DAC0_SOURCE_SHIFT,
241 OXYGEN_PLAY_DAC3_SOURCE_SHIFT,
242 OXYGEN_PLAY_DAC3_SOURCE_MASK);
243}
244
210static int output_switch_info(struct snd_kcontrol *ctl, 245static int output_switch_info(struct snd_kcontrol *ctl,
211 struct snd_ctl_elem_info *info) 246 struct snd_ctl_elem_info *info)
212{ 247{
@@ -557,6 +592,7 @@ struct oxygen_model model_xonar_dg = {
557 .resume = dg_resume, 592 .resume = dg_resume,
558 .set_dac_params = set_cs4245_dac_params, 593 .set_dac_params = set_cs4245_dac_params,
559 .set_adc_params = set_cs4245_adc_params, 594 .set_adc_params = set_cs4245_adc_params,
595 .adjust_dac_routing = adjust_dg_dac_routing,
560 .dump_registers = dump_cs4245_registers, 596 .dump_registers = dump_cs4245_registers,
561 .model_data_size = sizeof(struct dg), 597 .model_data_size = sizeof(struct dg),
562 .device_config = PLAYBACK_0_TO_I2S | 598 .device_config = PLAYBACK_0_TO_I2S |