1041f26b6SRoman Volkov /* 2041f26b6SRoman Volkov * Mixer controls for the Xonar DG/DGX 3041f26b6SRoman Volkov * 4041f26b6SRoman Volkov * Copyright (c) Clemens Ladisch <clemens@ladisch.de> 5041f26b6SRoman Volkov * Copyright (c) Roman Volkov <v1ron@mail.ru> 6041f26b6SRoman Volkov * 7041f26b6SRoman Volkov * This driver is free software; you can redistribute it and/or modify 8041f26b6SRoman Volkov * it under the terms of the GNU General Public License, version 2. 9041f26b6SRoman Volkov * 10041f26b6SRoman Volkov * This driver is distributed in the hope that it will be useful, 11041f26b6SRoman Volkov * but WITHOUT ANY WARRANTY; without even the implied warranty of 12041f26b6SRoman Volkov * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13041f26b6SRoman Volkov * GNU General Public License for more details. 14041f26b6SRoman Volkov * 15041f26b6SRoman Volkov * You should have received a copy of the GNU General Public License 16041f26b6SRoman Volkov * along with this driver; if not, see <http://www.gnu.org/licenses/>. 17041f26b6SRoman Volkov */ 18041f26b6SRoman Volkov 19041f26b6SRoman Volkov #include <linux/pci.h> 20041f26b6SRoman Volkov #include <linux/delay.h> 21041f26b6SRoman Volkov #include <sound/control.h> 22041f26b6SRoman Volkov #include <sound/core.h> 23041f26b6SRoman Volkov #include <sound/info.h> 24041f26b6SRoman Volkov #include <sound/pcm.h> 25041f26b6SRoman Volkov #include <sound/tlv.h> 26041f26b6SRoman Volkov #include "oxygen.h" 27041f26b6SRoman Volkov #include "xonar_dg.h" 28041f26b6SRoman Volkov #include "cs4245.h" 29041f26b6SRoman Volkov 30*2809cb84SRoman Volkov /* analog output select */ 31*2809cb84SRoman Volkov 32*2809cb84SRoman Volkov static int output_select_apply(struct oxygen *chip) 33*2809cb84SRoman Volkov { 34*2809cb84SRoman Volkov struct dg *data = chip->model_data; 35*2809cb84SRoman Volkov 36*2809cb84SRoman Volkov data->cs4245_shadow[CS4245_SIGNAL_SEL] &= ~CS4245_A_OUT_SEL_MASK; 37*2809cb84SRoman Volkov if (data->output_sel == PLAYBACK_DST_HP) { 38*2809cb84SRoman Volkov /* mute FP (aux output) amplifier, switch rear jack to CS4245 */ 39*2809cb84SRoman Volkov oxygen_set_bits8(chip, OXYGEN_GPIO_DATA, GPIO_HP_REAR); 40*2809cb84SRoman Volkov } else if (data->output_sel == PLAYBACK_DST_HP_FP) { 41*2809cb84SRoman Volkov /* 42*2809cb84SRoman Volkov * Unmute FP amplifier, switch rear jack to CS4361; 43*2809cb84SRoman Volkov * I2S channels 2,3,4 should be inactive. 44*2809cb84SRoman Volkov */ 45*2809cb84SRoman Volkov oxygen_clear_bits8(chip, OXYGEN_GPIO_DATA, GPIO_HP_REAR); 46*2809cb84SRoman Volkov data->cs4245_shadow[CS4245_SIGNAL_SEL] |= CS4245_A_OUT_SEL_DAC; 47*2809cb84SRoman Volkov } else { 48*2809cb84SRoman Volkov /* 49*2809cb84SRoman Volkov * 2.0, 4.0, 5.1: switch to CS4361, mute FP amp., 50*2809cb84SRoman Volkov * and change playback routing. 51*2809cb84SRoman Volkov */ 52*2809cb84SRoman Volkov oxygen_clear_bits8(chip, OXYGEN_GPIO_DATA, GPIO_HP_REAR); 53*2809cb84SRoman Volkov } 54*2809cb84SRoman Volkov return cs4245_write_spi(chip, CS4245_SIGNAL_SEL); 55*2809cb84SRoman Volkov } 56*2809cb84SRoman Volkov 57*2809cb84SRoman Volkov static int output_select_info(struct snd_kcontrol *ctl, 58041f26b6SRoman Volkov struct snd_ctl_elem_info *info) 59041f26b6SRoman Volkov { 60041f26b6SRoman Volkov static const char *const names[3] = { 61*2809cb84SRoman Volkov "Stereo Headphones", 62*2809cb84SRoman Volkov "Stereo Headphones FP", 63*2809cb84SRoman Volkov "Multichannel", 64041f26b6SRoman Volkov }; 65041f26b6SRoman Volkov 66041f26b6SRoman Volkov return snd_ctl_enum_info(info, 1, 3, names); 67041f26b6SRoman Volkov } 68041f26b6SRoman Volkov 69*2809cb84SRoman Volkov static int output_select_get(struct snd_kcontrol *ctl, 70041f26b6SRoman Volkov struct snd_ctl_elem_value *value) 71041f26b6SRoman Volkov { 72041f26b6SRoman Volkov struct oxygen *chip = ctl->private_data; 73041f26b6SRoman Volkov struct dg *data = chip->model_data; 74041f26b6SRoman Volkov 75041f26b6SRoman Volkov mutex_lock(&chip->mutex); 76041f26b6SRoman Volkov value->value.enumerated.item[0] = data->output_sel; 77041f26b6SRoman Volkov mutex_unlock(&chip->mutex); 78041f26b6SRoman Volkov return 0; 79041f26b6SRoman Volkov } 80041f26b6SRoman Volkov 81*2809cb84SRoman Volkov static int output_select_put(struct snd_kcontrol *ctl, 82041f26b6SRoman Volkov struct snd_ctl_elem_value *value) 83041f26b6SRoman Volkov { 84041f26b6SRoman Volkov struct oxygen *chip = ctl->private_data; 85041f26b6SRoman Volkov struct dg *data = chip->model_data; 86*2809cb84SRoman Volkov unsigned int new = value->value.enumerated.item[0]; 87*2809cb84SRoman Volkov int changed = 0; 88*2809cb84SRoman Volkov int ret; 89041f26b6SRoman Volkov 90041f26b6SRoman Volkov mutex_lock(&chip->mutex); 91*2809cb84SRoman Volkov if (data->output_sel != new) { 92*2809cb84SRoman Volkov data->output_sel = new; 93*2809cb84SRoman Volkov ret = output_select_apply(chip); 94*2809cb84SRoman Volkov changed = ret >= 0 ? 1 : ret; 95*2809cb84SRoman Volkov oxygen_update_dac_routing(chip); 96041f26b6SRoman Volkov } 97041f26b6SRoman Volkov mutex_unlock(&chip->mutex); 98*2809cb84SRoman Volkov 99041f26b6SRoman Volkov return changed; 100041f26b6SRoman Volkov } 101041f26b6SRoman Volkov 102041f26b6SRoman Volkov static int hp_volume_offset_info(struct snd_kcontrol *ctl, 103041f26b6SRoman Volkov struct snd_ctl_elem_info *info) 104041f26b6SRoman Volkov { 105041f26b6SRoman Volkov static const char *const names[3] = { 106041f26b6SRoman Volkov "< 64 ohms", "64-150 ohms", "150-300 ohms" 107041f26b6SRoman Volkov }; 108041f26b6SRoman Volkov 109041f26b6SRoman Volkov return snd_ctl_enum_info(info, 1, 3, names); 110041f26b6SRoman Volkov } 111041f26b6SRoman Volkov 112041f26b6SRoman Volkov static int hp_volume_offset_get(struct snd_kcontrol *ctl, 113041f26b6SRoman Volkov struct snd_ctl_elem_value *value) 114041f26b6SRoman Volkov { 115041f26b6SRoman Volkov struct oxygen *chip = ctl->private_data; 116041f26b6SRoman Volkov struct dg *data = chip->model_data; 117041f26b6SRoman Volkov 118041f26b6SRoman Volkov mutex_lock(&chip->mutex); 119041f26b6SRoman Volkov if (data->hp_vol_att > 2 * 7) 120041f26b6SRoman Volkov value->value.enumerated.item[0] = 0; 121041f26b6SRoman Volkov else if (data->hp_vol_att > 0) 122041f26b6SRoman Volkov value->value.enumerated.item[0] = 1; 123041f26b6SRoman Volkov else 124041f26b6SRoman Volkov value->value.enumerated.item[0] = 2; 125041f26b6SRoman Volkov mutex_unlock(&chip->mutex); 126041f26b6SRoman Volkov return 0; 127041f26b6SRoman Volkov } 128041f26b6SRoman Volkov 129041f26b6SRoman Volkov static int hp_volume_offset_put(struct snd_kcontrol *ctl, 130041f26b6SRoman Volkov struct snd_ctl_elem_value *value) 131041f26b6SRoman Volkov { 132041f26b6SRoman Volkov static const s8 atts[3] = { 2 * 16, 2 * 7, 0 }; 133041f26b6SRoman Volkov struct oxygen *chip = ctl->private_data; 134041f26b6SRoman Volkov struct dg *data = chip->model_data; 135041f26b6SRoman Volkov s8 att; 136041f26b6SRoman Volkov int changed; 137041f26b6SRoman Volkov 138041f26b6SRoman Volkov if (value->value.enumerated.item[0] > 2) 139041f26b6SRoman Volkov return -EINVAL; 140041f26b6SRoman Volkov att = atts[value->value.enumerated.item[0]]; 141041f26b6SRoman Volkov mutex_lock(&chip->mutex); 142041f26b6SRoman Volkov changed = att != data->hp_vol_att; 143041f26b6SRoman Volkov if (changed) { 144041f26b6SRoman Volkov data->hp_vol_att = att; 145041f26b6SRoman Volkov if (data->output_sel) { 146041f26b6SRoman Volkov cs4245_write_cached(chip, CS4245_DAC_A_CTRL, att); 147041f26b6SRoman Volkov cs4245_write_cached(chip, CS4245_DAC_B_CTRL, att); 148041f26b6SRoman Volkov } 149041f26b6SRoman Volkov } 150041f26b6SRoman Volkov mutex_unlock(&chip->mutex); 151041f26b6SRoman Volkov return changed; 152041f26b6SRoman Volkov } 153041f26b6SRoman Volkov 154041f26b6SRoman Volkov static int input_vol_info(struct snd_kcontrol *ctl, 155041f26b6SRoman Volkov struct snd_ctl_elem_info *info) 156041f26b6SRoman Volkov { 157041f26b6SRoman Volkov info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 158041f26b6SRoman Volkov info->count = 2; 159041f26b6SRoman Volkov info->value.integer.min = 2 * -12; 160041f26b6SRoman Volkov info->value.integer.max = 2 * 12; 161041f26b6SRoman Volkov return 0; 162041f26b6SRoman Volkov } 163041f26b6SRoman Volkov 164041f26b6SRoman Volkov static int input_vol_get(struct snd_kcontrol *ctl, 165041f26b6SRoman Volkov struct snd_ctl_elem_value *value) 166041f26b6SRoman Volkov { 167041f26b6SRoman Volkov struct oxygen *chip = ctl->private_data; 168041f26b6SRoman Volkov struct dg *data = chip->model_data; 169041f26b6SRoman Volkov unsigned int idx = ctl->private_value; 170041f26b6SRoman Volkov 171041f26b6SRoman Volkov mutex_lock(&chip->mutex); 172041f26b6SRoman Volkov value->value.integer.value[0] = data->input_vol[idx][0]; 173041f26b6SRoman Volkov value->value.integer.value[1] = data->input_vol[idx][1]; 174041f26b6SRoman Volkov mutex_unlock(&chip->mutex); 175041f26b6SRoman Volkov return 0; 176041f26b6SRoman Volkov } 177041f26b6SRoman Volkov 178041f26b6SRoman Volkov static int input_vol_put(struct snd_kcontrol *ctl, 179041f26b6SRoman Volkov struct snd_ctl_elem_value *value) 180041f26b6SRoman Volkov { 181041f26b6SRoman Volkov struct oxygen *chip = ctl->private_data; 182041f26b6SRoman Volkov struct dg *data = chip->model_data; 183041f26b6SRoman Volkov unsigned int idx = ctl->private_value; 184041f26b6SRoman Volkov int changed = 0; 185041f26b6SRoman Volkov 186041f26b6SRoman Volkov if (value->value.integer.value[0] < 2 * -12 || 187041f26b6SRoman Volkov value->value.integer.value[0] > 2 * 12 || 188041f26b6SRoman Volkov value->value.integer.value[1] < 2 * -12 || 189041f26b6SRoman Volkov value->value.integer.value[1] > 2 * 12) 190041f26b6SRoman Volkov return -EINVAL; 191041f26b6SRoman Volkov mutex_lock(&chip->mutex); 192041f26b6SRoman Volkov changed = data->input_vol[idx][0] != value->value.integer.value[0] || 193041f26b6SRoman Volkov data->input_vol[idx][1] != value->value.integer.value[1]; 194041f26b6SRoman Volkov if (changed) { 195041f26b6SRoman Volkov data->input_vol[idx][0] = value->value.integer.value[0]; 196041f26b6SRoman Volkov data->input_vol[idx][1] = value->value.integer.value[1]; 197041f26b6SRoman Volkov if (idx == data->input_sel) { 198041f26b6SRoman Volkov cs4245_write_cached(chip, CS4245_PGA_A_CTRL, 199041f26b6SRoman Volkov data->input_vol[idx][0]); 200041f26b6SRoman Volkov cs4245_write_cached(chip, CS4245_PGA_B_CTRL, 201041f26b6SRoman Volkov data->input_vol[idx][1]); 202041f26b6SRoman Volkov } 203041f26b6SRoman Volkov } 204041f26b6SRoman Volkov mutex_unlock(&chip->mutex); 205041f26b6SRoman Volkov return changed; 206041f26b6SRoman Volkov } 207041f26b6SRoman Volkov 208041f26b6SRoman Volkov static DECLARE_TLV_DB_SCALE(cs4245_pga_db_scale, -1200, 50, 0); 209041f26b6SRoman Volkov 210041f26b6SRoman Volkov static int input_sel_info(struct snd_kcontrol *ctl, 211041f26b6SRoman Volkov struct snd_ctl_elem_info *info) 212041f26b6SRoman Volkov { 213041f26b6SRoman Volkov static const char *const names[4] = { 214041f26b6SRoman Volkov "Mic", "Aux", "Front Mic", "Line" 215041f26b6SRoman Volkov }; 216041f26b6SRoman Volkov 217041f26b6SRoman Volkov return snd_ctl_enum_info(info, 1, 4, names); 218041f26b6SRoman Volkov } 219041f26b6SRoman Volkov 220041f26b6SRoman Volkov static int input_sel_get(struct snd_kcontrol *ctl, 221041f26b6SRoman Volkov struct snd_ctl_elem_value *value) 222041f26b6SRoman Volkov { 223041f26b6SRoman Volkov struct oxygen *chip = ctl->private_data; 224041f26b6SRoman Volkov struct dg *data = chip->model_data; 225041f26b6SRoman Volkov 226041f26b6SRoman Volkov mutex_lock(&chip->mutex); 227041f26b6SRoman Volkov value->value.enumerated.item[0] = data->input_sel; 228041f26b6SRoman Volkov mutex_unlock(&chip->mutex); 229041f26b6SRoman Volkov return 0; 230041f26b6SRoman Volkov } 231041f26b6SRoman Volkov 232041f26b6SRoman Volkov static int input_sel_put(struct snd_kcontrol *ctl, 233041f26b6SRoman Volkov struct snd_ctl_elem_value *value) 234041f26b6SRoman Volkov { 235041f26b6SRoman Volkov static const u8 sel_values[4] = { 236041f26b6SRoman Volkov CS4245_SEL_MIC, 237041f26b6SRoman Volkov CS4245_SEL_INPUT_1, 238041f26b6SRoman Volkov CS4245_SEL_INPUT_2, 239041f26b6SRoman Volkov CS4245_SEL_INPUT_4 240041f26b6SRoman Volkov }; 241041f26b6SRoman Volkov struct oxygen *chip = ctl->private_data; 242041f26b6SRoman Volkov struct dg *data = chip->model_data; 243041f26b6SRoman Volkov int changed; 244041f26b6SRoman Volkov 245041f26b6SRoman Volkov if (value->value.enumerated.item[0] > 3) 246041f26b6SRoman Volkov return -EINVAL; 247041f26b6SRoman Volkov 248041f26b6SRoman Volkov mutex_lock(&chip->mutex); 249041f26b6SRoman Volkov changed = value->value.enumerated.item[0] != data->input_sel; 250041f26b6SRoman Volkov if (changed) { 251041f26b6SRoman Volkov data->input_sel = value->value.enumerated.item[0]; 252041f26b6SRoman Volkov 253041f26b6SRoman Volkov cs4245_write(chip, CS4245_ANALOG_IN, 254041f26b6SRoman Volkov (data->cs4245_shadow[CS4245_ANALOG_IN] & 255041f26b6SRoman Volkov ~CS4245_SEL_MASK) | 256041f26b6SRoman Volkov sel_values[data->input_sel]); 257041f26b6SRoman Volkov 258041f26b6SRoman Volkov cs4245_write_cached(chip, CS4245_PGA_A_CTRL, 259041f26b6SRoman Volkov data->input_vol[data->input_sel][0]); 260041f26b6SRoman Volkov cs4245_write_cached(chip, CS4245_PGA_B_CTRL, 261041f26b6SRoman Volkov data->input_vol[data->input_sel][1]); 262041f26b6SRoman Volkov 263041f26b6SRoman Volkov oxygen_write16_masked(chip, OXYGEN_GPIO_DATA, 264041f26b6SRoman Volkov data->input_sel ? 0 : GPIO_INPUT_ROUTE, 265041f26b6SRoman Volkov GPIO_INPUT_ROUTE); 266041f26b6SRoman Volkov } 267041f26b6SRoman Volkov mutex_unlock(&chip->mutex); 268041f26b6SRoman Volkov return changed; 269041f26b6SRoman Volkov } 270041f26b6SRoman Volkov 271041f26b6SRoman Volkov static int hpf_info(struct snd_kcontrol *ctl, struct snd_ctl_elem_info *info) 272041f26b6SRoman Volkov { 273041f26b6SRoman Volkov static const char *const names[2] = { "Active", "Frozen" }; 274041f26b6SRoman Volkov 275041f26b6SRoman Volkov return snd_ctl_enum_info(info, 1, 2, names); 276041f26b6SRoman Volkov } 277041f26b6SRoman Volkov 278041f26b6SRoman Volkov static int hpf_get(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value) 279041f26b6SRoman Volkov { 280041f26b6SRoman Volkov struct oxygen *chip = ctl->private_data; 281041f26b6SRoman Volkov struct dg *data = chip->model_data; 282041f26b6SRoman Volkov 283041f26b6SRoman Volkov value->value.enumerated.item[0] = 284041f26b6SRoman Volkov !!(data->cs4245_shadow[CS4245_ADC_CTRL] & CS4245_HPF_FREEZE); 285041f26b6SRoman Volkov return 0; 286041f26b6SRoman Volkov } 287041f26b6SRoman Volkov 288041f26b6SRoman Volkov static int hpf_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value) 289041f26b6SRoman Volkov { 290041f26b6SRoman Volkov struct oxygen *chip = ctl->private_data; 291041f26b6SRoman Volkov struct dg *data = chip->model_data; 292041f26b6SRoman Volkov u8 reg; 293041f26b6SRoman Volkov int changed; 294041f26b6SRoman Volkov 295041f26b6SRoman Volkov mutex_lock(&chip->mutex); 296041f26b6SRoman Volkov reg = data->cs4245_shadow[CS4245_ADC_CTRL] & ~CS4245_HPF_FREEZE; 297041f26b6SRoman Volkov if (value->value.enumerated.item[0]) 298041f26b6SRoman Volkov reg |= CS4245_HPF_FREEZE; 299041f26b6SRoman Volkov changed = reg != data->cs4245_shadow[CS4245_ADC_CTRL]; 300041f26b6SRoman Volkov if (changed) 301041f26b6SRoman Volkov cs4245_write(chip, CS4245_ADC_CTRL, reg); 302041f26b6SRoman Volkov mutex_unlock(&chip->mutex); 303041f26b6SRoman Volkov return changed; 304041f26b6SRoman Volkov } 305041f26b6SRoman Volkov 306041f26b6SRoman Volkov #define INPUT_VOLUME(xname, index) { \ 307041f26b6SRoman Volkov .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 308041f26b6SRoman Volkov .name = xname, \ 309041f26b6SRoman Volkov .info = input_vol_info, \ 310041f26b6SRoman Volkov .get = input_vol_get, \ 311041f26b6SRoman Volkov .put = input_vol_put, \ 312041f26b6SRoman Volkov .tlv = { .p = cs4245_pga_db_scale }, \ 313041f26b6SRoman Volkov .private_value = index, \ 314041f26b6SRoman Volkov } 315041f26b6SRoman Volkov static const struct snd_kcontrol_new dg_controls[] = { 316041f26b6SRoman Volkov { 317041f26b6SRoman Volkov .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 318041f26b6SRoman Volkov .name = "Analog Output Playback Enum", 319*2809cb84SRoman Volkov .info = output_select_info, 320*2809cb84SRoman Volkov .get = output_select_get, 321*2809cb84SRoman Volkov .put = output_select_put, 322041f26b6SRoman Volkov }, 323041f26b6SRoman Volkov { 324041f26b6SRoman Volkov .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 325041f26b6SRoman Volkov .name = "Headphones Impedance Playback Enum", 326041f26b6SRoman Volkov .info = hp_volume_offset_info, 327041f26b6SRoman Volkov .get = hp_volume_offset_get, 328041f26b6SRoman Volkov .put = hp_volume_offset_put, 329041f26b6SRoman Volkov }, 330041f26b6SRoman Volkov INPUT_VOLUME("Mic Capture Volume", 0), 331041f26b6SRoman Volkov INPUT_VOLUME("Aux Capture Volume", 1), 332041f26b6SRoman Volkov INPUT_VOLUME("Front Mic Capture Volume", 2), 333041f26b6SRoman Volkov INPUT_VOLUME("Line Capture Volume", 3), 334041f26b6SRoman Volkov { 335041f26b6SRoman Volkov .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 336041f26b6SRoman Volkov .name = "Capture Source", 337041f26b6SRoman Volkov .info = input_sel_info, 338041f26b6SRoman Volkov .get = input_sel_get, 339041f26b6SRoman Volkov .put = input_sel_put, 340041f26b6SRoman Volkov }, 341041f26b6SRoman Volkov { 342041f26b6SRoman Volkov .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 343041f26b6SRoman Volkov .name = "ADC High-pass Filter Capture Enum", 344041f26b6SRoman Volkov .info = hpf_info, 345041f26b6SRoman Volkov .get = hpf_get, 346041f26b6SRoman Volkov .put = hpf_put, 347041f26b6SRoman Volkov }, 348041f26b6SRoman Volkov }; 349041f26b6SRoman Volkov 350041f26b6SRoman Volkov static int dg_control_filter(struct snd_kcontrol_new *template) 351041f26b6SRoman Volkov { 352041f26b6SRoman Volkov if (!strncmp(template->name, "Master Playback ", 16)) 353041f26b6SRoman Volkov return 1; 354041f26b6SRoman Volkov return 0; 355041f26b6SRoman Volkov } 356041f26b6SRoman Volkov 357041f26b6SRoman Volkov static int dg_mixer_init(struct oxygen *chip) 358041f26b6SRoman Volkov { 359041f26b6SRoman Volkov unsigned int i; 360041f26b6SRoman Volkov int err; 361041f26b6SRoman Volkov 362041f26b6SRoman Volkov for (i = 0; i < ARRAY_SIZE(dg_controls); ++i) { 363041f26b6SRoman Volkov err = snd_ctl_add(chip->card, 364041f26b6SRoman Volkov snd_ctl_new1(&dg_controls[i], chip)); 365041f26b6SRoman Volkov if (err < 0) 366041f26b6SRoman Volkov return err; 367041f26b6SRoman Volkov } 368041f26b6SRoman Volkov return 0; 369041f26b6SRoman Volkov } 370041f26b6SRoman Volkov 371041f26b6SRoman Volkov struct oxygen_model model_xonar_dg = { 372041f26b6SRoman Volkov .longname = "C-Media Oxygen HD Audio", 373041f26b6SRoman Volkov .chip = "CMI8786", 374041f26b6SRoman Volkov .init = dg_init, 375041f26b6SRoman Volkov .control_filter = dg_control_filter, 376041f26b6SRoman Volkov .mixer_init = dg_mixer_init, 377041f26b6SRoman Volkov .cleanup = dg_cleanup, 378041f26b6SRoman Volkov .suspend = dg_suspend, 379041f26b6SRoman Volkov .resume = dg_resume, 380041f26b6SRoman Volkov .set_dac_params = set_cs4245_dac_params, 381041f26b6SRoman Volkov .set_adc_params = set_cs4245_adc_params, 382041f26b6SRoman Volkov .adjust_dac_routing = adjust_dg_dac_routing, 383041f26b6SRoman Volkov .dump_registers = dump_cs4245_registers, 384041f26b6SRoman Volkov .model_data_size = sizeof(struct dg), 385041f26b6SRoman Volkov .device_config = PLAYBACK_0_TO_I2S | 386041f26b6SRoman Volkov PLAYBACK_1_TO_SPDIF | 3873dd77654SRoman Volkov CAPTURE_0_FROM_I2S_1 | 388041f26b6SRoman Volkov CAPTURE_1_FROM_SPDIF, 389041f26b6SRoman Volkov .dac_channels_pcm = 6, 390041f26b6SRoman Volkov .dac_channels_mixer = 0, 391041f26b6SRoman Volkov .function_flags = OXYGEN_FUNCTION_SPI, 392041f26b6SRoman Volkov .dac_mclks = OXYGEN_MCLKS(256, 128, 128), 393041f26b6SRoman Volkov .adc_mclks = OXYGEN_MCLKS(256, 128, 128), 394041f26b6SRoman Volkov .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, 395041f26b6SRoman Volkov .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, 396041f26b6SRoman Volkov }; 397