Lines Matching +full:analog +full:- +full:pass

1 // SPDX-License-Identifier: GPL-2.0-only
20 /* analog output select */
24 struct dg *data = chip->model_data; in output_select_apply()
26 data->cs4245_shadow[CS4245_SIGNAL_SEL] &= ~CS4245_A_OUT_SEL_MASK; in output_select_apply()
27 if (data->output_sel == PLAYBACK_DST_HP) { in output_select_apply()
30 } else if (data->output_sel == PLAYBACK_DST_HP_FP) { in output_select_apply()
36 data->cs4245_shadow[CS4245_SIGNAL_SEL] |= CS4245_A_OUT_SEL_DAC; in output_select_apply()
62 struct oxygen *chip = ctl->private_data; in output_select_get()
63 struct dg *data = chip->model_data; in output_select_get()
65 mutex_lock(&chip->mutex); in output_select_get()
66 value->value.enumerated.item[0] = data->output_sel; in output_select_get()
67 mutex_unlock(&chip->mutex); in output_select_get()
74 struct oxygen *chip = ctl->private_data; in output_select_put()
75 struct dg *data = chip->model_data; in output_select_put()
76 unsigned int new = value->value.enumerated.item[0]; in output_select_put()
80 mutex_lock(&chip->mutex); in output_select_put()
81 if (data->output_sel != new) { in output_select_put()
82 data->output_sel = new; in output_select_put()
87 mutex_unlock(&chip->mutex); in output_select_put()
97 info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in hp_stereo_volume_info()
98 info->count = 2; in hp_stereo_volume_info()
99 info->value.integer.min = 0; in hp_stereo_volume_info()
100 info->value.integer.max = 255; in hp_stereo_volume_info()
107 struct oxygen *chip = ctl->private_data; in hp_stereo_volume_get()
108 struct dg *data = chip->model_data; in hp_stereo_volume_get()
111 mutex_lock(&chip->mutex); in hp_stereo_volume_get()
112 tmp = (~data->cs4245_shadow[CS4245_DAC_A_CTRL]) & 255; in hp_stereo_volume_get()
113 val->value.integer.value[0] = tmp; in hp_stereo_volume_get()
114 tmp = (~data->cs4245_shadow[CS4245_DAC_B_CTRL]) & 255; in hp_stereo_volume_get()
115 val->value.integer.value[1] = tmp; in hp_stereo_volume_get()
116 mutex_unlock(&chip->mutex); in hp_stereo_volume_get()
123 struct oxygen *chip = ctl->private_data; in hp_stereo_volume_put()
124 struct dg *data = chip->model_data; in hp_stereo_volume_put()
127 long new1 = val->value.integer.value[0]; in hp_stereo_volume_put()
128 long new2 = val->value.integer.value[1]; in hp_stereo_volume_put()
131 return -EINVAL; in hp_stereo_volume_put()
133 mutex_lock(&chip->mutex); in hp_stereo_volume_put()
134 if ((data->cs4245_shadow[CS4245_DAC_A_CTRL] != ~new1) || in hp_stereo_volume_put()
135 (data->cs4245_shadow[CS4245_DAC_B_CTRL] != ~new2)) { in hp_stereo_volume_put()
136 data->cs4245_shadow[CS4245_DAC_A_CTRL] = ~new1; in hp_stereo_volume_put()
137 data->cs4245_shadow[CS4245_DAC_B_CTRL] = ~new2; in hp_stereo_volume_put()
143 mutex_unlock(&chip->mutex); in hp_stereo_volume_put()
153 struct oxygen *chip = ctl->private_data; in hp_mute_get()
154 struct dg *data = chip->model_data; in hp_mute_get()
156 mutex_lock(&chip->mutex); in hp_mute_get()
157 val->value.integer.value[0] = in hp_mute_get()
158 !(data->cs4245_shadow[CS4245_DAC_CTRL_1] & CS4245_MUTE_DAC); in hp_mute_get()
159 mutex_unlock(&chip->mutex); in hp_mute_get()
166 struct oxygen *chip = ctl->private_data; in hp_mute_put()
167 struct dg *data = chip->model_data; in hp_mute_put()
171 if (val->value.integer.value[0] > 1) in hp_mute_put()
172 return -EINVAL; in hp_mute_put()
173 mutex_lock(&chip->mutex); in hp_mute_put()
174 data->cs4245_shadow[CS4245_DAC_CTRL_1] &= ~CS4245_MUTE_DAC; in hp_mute_put()
175 data->cs4245_shadow[CS4245_DAC_CTRL_1] |= in hp_mute_put()
176 (~val->value.integer.value[0] << 2) & CS4245_MUTE_DAC; in hp_mute_put()
179 mutex_unlock(&chip->mutex); in hp_mute_put()
187 struct dg *data = chip->model_data; in input_volume_apply()
190 data->cs4245_shadow[CS4245_PGA_A_CTRL] = left; in input_volume_apply()
191 data->cs4245_shadow[CS4245_PGA_B_CTRL] = right; in input_volume_apply()
201 info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in input_vol_info()
202 info->count = 2; in input_vol_info()
203 info->value.integer.min = 2 * -12; in input_vol_info()
204 info->value.integer.max = 2 * 12; in input_vol_info()
211 struct oxygen *chip = ctl->private_data; in input_vol_get()
212 struct dg *data = chip->model_data; in input_vol_get()
213 unsigned int idx = ctl->private_value; in input_vol_get()
215 mutex_lock(&chip->mutex); in input_vol_get()
216 value->value.integer.value[0] = data->input_vol[idx][0]; in input_vol_get()
217 value->value.integer.value[1] = data->input_vol[idx][1]; in input_vol_get()
218 mutex_unlock(&chip->mutex); in input_vol_get()
225 struct oxygen *chip = ctl->private_data; in input_vol_put()
226 struct dg *data = chip->model_data; in input_vol_put()
227 unsigned int idx = ctl->private_value; in input_vol_put()
231 if (value->value.integer.value[0] < 2 * -12 || in input_vol_put()
232 value->value.integer.value[0] > 2 * 12 || in input_vol_put()
233 value->value.integer.value[1] < 2 * -12 || in input_vol_put()
234 value->value.integer.value[1] > 2 * 12) in input_vol_put()
235 return -EINVAL; in input_vol_put()
236 mutex_lock(&chip->mutex); in input_vol_put()
237 changed = data->input_vol[idx][0] != value->value.integer.value[0] || in input_vol_put()
238 data->input_vol[idx][1] != value->value.integer.value[1]; in input_vol_put()
240 data->input_vol[idx][0] = value->value.integer.value[0]; in input_vol_put()
241 data->input_vol[idx][1] = value->value.integer.value[1]; in input_vol_put()
242 if (idx == data->input_sel) { in input_vol_put()
244 data->input_vol[idx][0], in input_vol_put()
245 data->input_vol[idx][1]); in input_vol_put()
249 mutex_unlock(&chip->mutex); in input_vol_put()
257 struct dg *data = chip->model_data; in input_source_apply()
259 data->cs4245_shadow[CS4245_ANALOG_IN] &= ~CS4245_SEL_MASK; in input_source_apply()
260 if (data->input_sel == CAPTURE_SRC_FP_MIC) in input_source_apply()
261 data->cs4245_shadow[CS4245_ANALOG_IN] |= CS4245_SEL_INPUT_2; in input_source_apply()
262 else if (data->input_sel == CAPTURE_SRC_LINE) in input_source_apply()
263 data->cs4245_shadow[CS4245_ANALOG_IN] |= CS4245_SEL_INPUT_4; in input_source_apply()
264 else if (data->input_sel != CAPTURE_SRC_MIC) in input_source_apply()
265 data->cs4245_shadow[CS4245_ANALOG_IN] |= CS4245_SEL_INPUT_1; in input_source_apply()
282 struct oxygen *chip = ctl->private_data; in input_sel_get()
283 struct dg *data = chip->model_data; in input_sel_get()
285 mutex_lock(&chip->mutex); in input_sel_get()
286 value->value.enumerated.item[0] = data->input_sel; in input_sel_get()
287 mutex_unlock(&chip->mutex); in input_sel_get()
294 struct oxygen *chip = ctl->private_data; in input_sel_put()
295 struct dg *data = chip->model_data; in input_sel_put()
299 if (value->value.enumerated.item[0] > 3) in input_sel_put()
300 return -EINVAL; in input_sel_put()
302 mutex_lock(&chip->mutex); in input_sel_put()
303 changed = value->value.enumerated.item[0] != data->input_sel; in input_sel_put()
305 data->input_sel = value->value.enumerated.item[0]; in input_sel_put()
310 data->input_vol[data->input_sel][0], in input_sel_put()
311 data->input_vol[data->input_sel][1]); in input_sel_put()
314 mutex_unlock(&chip->mutex); in input_sel_put()
318 /* ADC high-pass filter */
329 struct oxygen *chip = ctl->private_data; in hpf_get()
330 struct dg *data = chip->model_data; in hpf_get()
332 value->value.enumerated.item[0] = in hpf_get()
333 !!(data->cs4245_shadow[CS4245_ADC_CTRL] & CS4245_HPF_FREEZE); in hpf_get()
339 struct oxygen *chip = ctl->private_data; in hpf_put()
340 struct dg *data = chip->model_data; in hpf_put()
344 mutex_lock(&chip->mutex); in hpf_put()
345 reg = data->cs4245_shadow[CS4245_ADC_CTRL] & ~CS4245_HPF_FREEZE; in hpf_put()
346 if (value->value.enumerated.item[0]) in hpf_put()
348 changed = reg != data->cs4245_shadow[CS4245_ADC_CTRL]; in hpf_put()
350 data->cs4245_shadow[CS4245_ADC_CTRL] = reg; in hpf_put()
353 mutex_unlock(&chip->mutex); in hpf_put()
368 static const DECLARE_TLV_DB_MINMAX(hp_db_scale, -12550, 0);
369 static const DECLARE_TLV_DB_MINMAX(pga_db_scale, -1200, 1200);
373 .name = "Analog Output Playback Enum",
409 .name = "ADC High-pass Filter Capture Enum",
418 if (!strncmp(template->name, "Master Playback ", 16)) in dg_control_filter()
433 err = snd_ctl_add(chip->card, in dg_mixer_init()
443 .longname = "C-Media Oxygen HD Audio",