Lines Matching +full:reg +full:- +full:data
1 // SPDX-License-Identifier: GPL-2.0-only
10 * -----------
14 * I²C <-> CS4398 (addr 1001111) (front)
15 * <-> CS4362A (addr 0011000) (surround, center/LFE, back)
17 * GPI 0 <- external power present (DX only)
19 * GPIO 0 -> enable output to speakers
20 * GPIO 1 -> route output to front panel
21 * GPIO 2 -> M0 of CS5361
22 * GPIO 3 -> M1 of CS5361
23 * GPIO 6 -> ?
24 * GPIO 7 -> ?
25 * GPIO 8 -> route input jack to line-in (0) or mic-in (1)
29 * LINE_OUT -> input of ADC
31 * AUX_IN <- aux
32 * MIC_IN <- mic
33 * FMIC_IN <- front mic
35 * GPO 0 -> route line-in (0) or AC97 output (1) to CS5361 input
66 static void cs4398_write(struct oxygen *chip, u8 reg, u8 value) in cs4398_write() argument
68 struct xonar_cs43xx *data = chip->model_data; in cs4398_write() local
70 oxygen_write_i2c(chip, I2C_DEVICE_CS4398, reg, value); in cs4398_write()
71 if (reg < ARRAY_SIZE(data->cs4398_regs)) in cs4398_write()
72 data->cs4398_regs[reg] = value; in cs4398_write()
75 static void cs4398_write_cached(struct oxygen *chip, u8 reg, u8 value) in cs4398_write_cached() argument
77 struct xonar_cs43xx *data = chip->model_data; in cs4398_write_cached() local
79 if (value != data->cs4398_regs[reg]) in cs4398_write_cached()
80 cs4398_write(chip, reg, value); in cs4398_write_cached()
83 static void cs4362a_write(struct oxygen *chip, u8 reg, u8 value) in cs4362a_write() argument
85 struct xonar_cs43xx *data = chip->model_data; in cs4362a_write() local
87 oxygen_write_i2c(chip, I2C_DEVICE_CS4362A, reg, value); in cs4362a_write()
88 if (reg < ARRAY_SIZE(data->cs4362a_regs)) in cs4362a_write()
89 data->cs4362a_regs[reg] = value; in cs4362a_write()
92 static void cs4362a_write_cached(struct oxygen *chip, u8 reg, u8 value) in cs4362a_write_cached() argument
94 struct xonar_cs43xx *data = chip->model_data; in cs4362a_write_cached() local
96 if (value != data->cs4362a_regs[reg]) in cs4362a_write_cached()
97 cs4362a_write(chip, reg, value); in cs4362a_write_cached()
102 struct xonar_cs43xx *data = chip->model_data; in cs43xx_registers_init() local
109 cs4398_write(chip, 2, data->cs4398_regs[2]); in cs43xx_registers_init()
111 cs4398_write(chip, 4, data->cs4398_regs[4]); in cs43xx_registers_init()
112 cs4398_write(chip, 5, data->cs4398_regs[5]); in cs43xx_registers_init()
113 cs4398_write(chip, 6, data->cs4398_regs[6]); in cs43xx_registers_init()
114 cs4398_write(chip, 7, data->cs4398_regs[7]); in cs43xx_registers_init()
118 cs4362a_write(chip, 0x04, data->cs4362a_regs[0x04]); in cs43xx_registers_init()
121 cs4362a_write(chip, i, data->cs4362a_regs[i]); in cs43xx_registers_init()
129 struct xonar_cs43xx *data = chip->model_data; in xonar_d1_init() local
131 data->generic.anti_pop_delay = 800; in xonar_d1_init()
132 data->generic.output_enable_bit = GPIO_D1_OUTPUT_ENABLE; in xonar_d1_init()
133 data->cs4398_regs[2] = in xonar_d1_init()
135 data->cs4398_regs[4] = CS4398_MUTEP_LOW | in xonar_d1_init()
137 data->cs4398_regs[5] = 60 * 2; in xonar_d1_init()
138 data->cs4398_regs[6] = 60 * 2; in xonar_d1_init()
139 data->cs4398_regs[7] = CS4398_RMP_DN | CS4398_RMP_UP | in xonar_d1_init()
141 data->cs4362a_regs[4] = CS4362A_RMP_DN | CS4362A_DEM_NONE; in xonar_d1_init()
142 data->cs4362a_regs[6] = CS4362A_FM_SINGLE | in xonar_d1_init()
144 data->cs4362a_regs[7] = 60 | CS4362A_MUTE; in xonar_d1_init()
145 data->cs4362a_regs[8] = 60 | CS4362A_MUTE; in xonar_d1_init()
146 data->cs4362a_regs[9] = data->cs4362a_regs[6]; in xonar_d1_init()
147 data->cs4362a_regs[10] = 60 | CS4362A_MUTE; in xonar_d1_init()
148 data->cs4362a_regs[11] = 60 | CS4362A_MUTE; in xonar_d1_init()
149 data->cs4362a_regs[12] = data->cs4362a_regs[6]; in xonar_d1_init()
150 data->cs4362a_regs[13] = 60 | CS4362A_MUTE; in xonar_d1_init()
151 data->cs4362a_regs[14] = 60 | CS4362A_MUTE; in xonar_d1_init()
170 snd_component_add(chip->card, "CS4398"); in xonar_d1_init()
171 snd_component_add(chip->card, "CS4362A"); in xonar_d1_init()
172 snd_component_add(chip->card, "CS5361"); in xonar_d1_init()
177 struct xonar_cs43xx *data = chip->model_data; in xonar_dx_init() local
179 data->generic.ext_power_reg = OXYGEN_GPI_DATA; in xonar_dx_init()
180 data->generic.ext_power_int_reg = OXYGEN_GPI_INTERRUPT_MASK; in xonar_dx_init()
181 data->generic.ext_power_bit = GPI_EXT_POWER; in xonar_dx_init()
209 struct xonar_cs43xx *data = chip->model_data; in set_cs43xx_params() local
224 cs4362a_fm |= data->cs4362a_regs[6] & ~CS4362A_FM_MASK; in set_cs43xx_params()
228 cs4362a_fm |= data->cs4362a_regs[9] & ~CS4362A_FM_MASK; in set_cs43xx_params()
237 mute = chip->dac_mute ? CS4362A_MUTE : 0; in update_cs4362a_volumes()
240 (127 - chip->dac_volume[2 + i]) | mute); in update_cs4362a_volumes()
245 cs4398_write_cached(chip, 5, (127 - chip->dac_volume[0]) * 2); in update_cs43xx_volume()
246 cs4398_write_cached(chip, 6, (127 - chip->dac_volume[1]) * 2); in update_cs43xx_volume()
252 u8 reg; in update_cs43xx_mute() local
254 reg = CS4398_MUTEP_LOW | CS4398_PAMUTE; in update_cs43xx_mute()
255 if (chip->dac_mute) in update_cs43xx_mute()
256 reg |= CS4398_MUTE_B | CS4398_MUTE_A; in update_cs43xx_mute()
257 cs4398_write_cached(chip, 4, reg); in update_cs43xx_mute()
263 struct xonar_cs43xx *data = chip->model_data; in update_cs43xx_center_lfe_mix() local
264 u8 reg; in update_cs43xx_center_lfe_mix() local
266 reg = data->cs4362a_regs[9] & ~CS4362A_ATAPI_MASK; in update_cs43xx_center_lfe_mix()
268 reg |= CS4362A_ATAPI_B_LR | CS4362A_ATAPI_A_LR; in update_cs43xx_center_lfe_mix()
270 reg |= CS4362A_ATAPI_B_R | CS4362A_ATAPI_A_L; in update_cs43xx_center_lfe_mix()
271 cs4362a_write_cached(chip, 9, reg); in update_cs43xx_center_lfe_mix()
287 "Fast Roll-off", "Slow Roll-off" in rolloff_info()
296 struct oxygen *chip = ctl->private_data; in rolloff_get()
297 struct xonar_cs43xx *data = chip->model_data; in rolloff_get() local
299 value->value.enumerated.item[0] = in rolloff_get()
300 (data->cs4398_regs[7] & CS4398_FILT_SEL) != 0; in rolloff_get()
307 struct oxygen *chip = ctl->private_data; in rolloff_put()
308 struct xonar_cs43xx *data = chip->model_data; in rolloff_put() local
310 u8 reg; in rolloff_put() local
312 mutex_lock(&chip->mutex); in rolloff_put()
313 reg = data->cs4398_regs[7]; in rolloff_put()
314 if (value->value.enumerated.item[0]) in rolloff_put()
315 reg |= CS4398_FILT_SEL; in rolloff_put()
317 reg &= ~CS4398_FILT_SEL; in rolloff_put()
318 changed = reg != data->cs4398_regs[7]; in rolloff_put()
320 cs4398_write(chip, 7, reg); in rolloff_put()
321 if (reg & CS4398_FILT_SEL) in rolloff_put()
322 reg = data->cs4362a_regs[0x04] | CS4362A_FILT_SEL; in rolloff_put()
324 reg = data->cs4362a_regs[0x04] & ~CS4362A_FILT_SEL; in rolloff_put()
325 cs4362a_write(chip, 0x04, reg); in rolloff_put()
327 mutex_unlock(&chip->mutex); in rolloff_put()
340 unsigned int reg, unsigned int mute) in xonar_d1_line_mic_ac97_switch() argument
342 if (reg == AC97_LINE) { in xonar_d1_line_mic_ac97_switch()
343 spin_lock_irq(&chip->reg_lock); in xonar_d1_line_mic_ac97_switch()
347 spin_unlock_irq(&chip->reg_lock); in xonar_d1_line_mic_ac97_switch()
351 static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -6000, 100, 0);
357 err = snd_ctl_add(chip->card, snd_ctl_new1(&front_panel_switch, chip)); in xonar_d1_mixer_init()
360 err = snd_ctl_add(chip->card, snd_ctl_new1(&rolloff_control, chip)); in xonar_d1_mixer_init()
366 static void dump_cs4362a_registers(struct xonar_cs43xx *data, in dump_cs4362a_registers() argument
373 snd_iprintf(buffer, " %02x", data->cs4362a_regs[i]); in dump_cs4362a_registers()
380 struct xonar_cs43xx *data = chip->model_data; in dump_d1_registers() local
385 snd_iprintf(buffer, " %02x", data->cs4398_regs[i]); in dump_d1_registers()
387 dump_cs4362a_registers(data, buffer); in dump_d1_registers()
414 .dac_volume_min = 127 - 60,
426 switch (id->subdevice) { in get_xonar_cs43xx_model()
428 chip->model = model_xonar_d1; in get_xonar_cs43xx_model()
429 chip->model.shortname = "Xonar D1"; in get_xonar_cs43xx_model()
433 chip->model = model_xonar_d1; in get_xonar_cs43xx_model()
434 chip->model.shortname = "Xonar DX"; in get_xonar_cs43xx_model()
435 chip->model.init = xonar_dx_init; in get_xonar_cs43xx_model()
438 return -EINVAL; in get_xonar_cs43xx_model()