Lines Matching +full:oversampling +full:- +full:ratio
1 // SPDX-License-Identifier: GPL-2.0-or-later
50 /* clock ratio identifiers for snd_wm8776_set_rate() */
83 snd_vt1724_write_i2c(ice, wm->addr, in wm8776_write()
86 wm->regs[reg] = val; in wm8776_write()
96 val |= wm->regs[reg] & ~mask; in wm8776_write_bits()
97 if (val != wm->regs[reg]) { in wm8776_write_bits()
113 unsigned short offset; /* zero-value offset */
126 .update = 0x180, /* update and zero-cross enable */
134 .update = 0x100, /* zero-cross enable */
150 /* headphone output: mute, -73..+6db (1db step) */
151 static const DECLARE_TLV_DB_SCALE(db_scale_hp, -7400, 100, 1);
152 /* DAC output: mute, -127..0db (0.5db step) */
153 static const DECLARE_TLV_DB_SCALE(db_scale_dac, -12750, 50, 1);
154 /* ADC gain: mute, -21..+24db (0.5db step) */
155 static const DECLARE_TLV_DB_SCALE(db_scale_adc, -2100, 50, 1);
160 unsigned int idx = kcontrol->private_value; in maya_vol_info()
163 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in maya_vol_info()
164 uinfo->count = 2; in maya_vol_info()
165 uinfo->value.integer.min = 0; in maya_vol_info()
166 uinfo->value.integer.max = vol->maxval; in maya_vol_info()
175 &chip->wm[snd_ctl_get_ioff(kcontrol, &ucontrol->id)]; in maya_vol_get()
176 unsigned int idx = kcontrol->private_value; in maya_vol_get()
178 mutex_lock(&chip->mutex); in maya_vol_get()
179 ucontrol->value.integer.value[0] = wm->volumes[idx][0]; in maya_vol_get()
180 ucontrol->value.integer.value[1] = wm->volumes[idx][1]; in maya_vol_get()
181 mutex_unlock(&chip->mutex); in maya_vol_get()
190 &chip->wm[snd_ctl_get_ioff(kcontrol, &ucontrol->id)]; in maya_vol_put()
191 unsigned int idx = kcontrol->private_value; in maya_vol_put()
196 mutex_lock(&chip->mutex); in maya_vol_put()
198 val = ucontrol->value.integer.value[ch]; in maya_vol_put()
199 if (val > vol->maxval) in maya_vol_put()
200 val = vol->maxval; in maya_vol_put()
201 if (val == wm->volumes[idx][ch]) in maya_vol_put()
204 data = vol->mute; in maya_vol_put()
206 data = (val - 1) + vol->offset; in maya_vol_put()
207 data |= vol->update; in maya_vol_put()
208 changed |= wm8776_write_bits(chip->ice, wm, vol->regs[ch], in maya_vol_put()
209 vol->mask | vol->update, data); in maya_vol_put()
210 if (vol->mux_bits[ch]) in maya_vol_put()
211 wm8776_write_bits(chip->ice, wm, WM8776_REG_ADC_MUX, in maya_vol_put()
212 vol->mux_bits[ch], in maya_vol_put()
213 val ? 0 : vol->mux_bits[ch]); in maya_vol_put()
214 wm->volumes[idx][ch] = val; in maya_vol_put()
216 mutex_unlock(&chip->mutex); in maya_vol_put()
236 &chip->wm[snd_ctl_get_ioff(kcontrol, &ucontrol->id)]; in maya_sw_get()
237 unsigned int idx = GET_SW_VAL_IDX(kcontrol->private_value); in maya_sw_get()
239 ucontrol->value.integer.value[0] = (wm->switch_bits >> idx) & 1; in maya_sw_get()
248 &chip->wm[snd_ctl_get_ioff(kcontrol, &ucontrol->id)]; in maya_sw_put()
249 unsigned int idx = GET_SW_VAL_IDX(kcontrol->private_value); in maya_sw_put()
253 mutex_lock(&chip->mutex); in maya_sw_put()
255 wm->switch_bits &= ~mask; in maya_sw_put()
256 val = ucontrol->value.integer.value[0]; in maya_sw_put()
258 wm->switch_bits |= mask; in maya_sw_put()
259 mask = GET_SW_VAL_MASK(kcontrol->private_value); in maya_sw_put()
260 changed = wm8776_write_bits(chip->ice, wm, in maya_sw_put()
261 GET_SW_VAL_REG(kcontrol->private_value), in maya_sw_put()
263 mutex_unlock(&chip->mutex); in maya_sw_put()
300 unsigned int shift = GET_GPIO_VAL_SHIFT(kcontrol->private_value); in maya_gpio_sw_get()
303 val = (snd_ice1712_gpio_read(chip->ice) >> shift) & 1; in maya_gpio_sw_get()
304 if (GET_GPIO_VAL_INV(kcontrol->private_value)) in maya_gpio_sw_get()
306 ucontrol->value.integer.value[0] = val; in maya_gpio_sw_get()
314 unsigned int shift = GET_GPIO_VAL_SHIFT(kcontrol->private_value); in maya_gpio_sw_put()
318 mutex_lock(&chip->mutex); in maya_gpio_sw_put()
320 val = ucontrol->value.integer.value[0]; in maya_gpio_sw_put()
321 if (GET_GPIO_VAL_INV(kcontrol->private_value)) in maya_gpio_sw_put()
324 changed = maya_set_gpio_bits(chip->ice, mask, val); in maya_gpio_sw_put()
325 mutex_unlock(&chip->mutex); in maya_gpio_sw_put()
333 /* known working input slots (0-4) */
334 #define MAYA_LINE_IN 1 /* in-2 */
335 #define MAYA_MIC_IN 3 /* in-4 */
339 wm8776_write_bits(chip->ice, &chip->wm[idx], WM8776_REG_ADC_MUX, in wm8776_select_input()
357 if (snd_ice1712_gpio_read(chip->ice) & (1 << GPIO_MIC_RELAY)) in maya_rec_src_get()
361 ucontrol->value.enumerated.item[0] = sel; in maya_rec_src_get()
369 int sel = ucontrol->value.enumerated.item[0]; in maya_rec_src_put()
372 mutex_lock(&chip->mutex); in maya_rec_src_put()
373 changed = maya_set_gpio_bits(chip->ice, 1 << GPIO_MIC_RELAY, in maya_rec_src_put()
376 mutex_unlock(&chip->mutex); in maya_rec_src_put()
406 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in maya_pb_route_get()
407 ucontrol->value.enumerated.item[0] = in maya_pb_route_get()
408 snd_ice1724_get_route_val(chip->ice, maya_pb_route_shift(idx)); in maya_pb_route_get()
416 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in maya_pb_route_put()
417 return snd_ice1724_put_route_val(chip->ice, in maya_pb_route_put()
418 ucontrol->value.enumerated.item[0], in maya_pb_route_put()
513 .count = 4, /* FIXME: do controls 5-9 have any meaning? */
522 err = snd_ctl_add(ice->card, snd_ctl_new1(&maya_controls[i], in maya44_add_controls()
523 ice->spec)); in maya44_add_controls()
567 wm->addr = addr; in wm8776_init()
569 wm->switch_bits = (1 << WM_SW_DAC); in wm8776_init()
589 struct snd_maya44 *chip = ice->spec; in set_rate()
590 unsigned int ratio, adc_ratio, val; in set_rate() local
595 ratio = WM8776_CLOCK_RATIO_128FS; in set_rate()
598 ratio = WM8776_CLOCK_RATIO_128FS; in set_rate()
601 ratio = WM8776_CLOCK_RATIO_256FS; in set_rate()
604 ratio = WM8776_CLOCK_RATIO_384FS; in set_rate()
607 ratio = WM8776_CLOCK_RATIO_512FS; in set_rate()
610 ratio = WM8776_CLOCK_RATIO_512FS; in set_rate()
613 ratio = WM8776_CLOCK_RATIO_768FS; in set_rate()
616 /* no hint - S/PDIF input is master, simply return */ in set_rate()
626 * oversampling to 64x, as recommended by WM8776 datasheet. in set_rate()
629 adc_ratio = ratio; in set_rate()
636 val |= ratio << 4; in set_rate()
638 mutex_lock(&chip->mutex); in set_rate()
640 wm8776_write_bits(ice, &chip->wm[i], in set_rate()
643 mutex_unlock(&chip->mutex); in set_rate()
679 return -ENOMEM; in maya44_init()
680 mutex_init(&chip->mutex); in maya44_init()
681 chip->ice = ice; in maya44_init()
682 ice->spec = chip; in maya44_init()
685 ice->num_total_dacs = 4; in maya44_init()
686 ice->num_total_adcs = 4; in maya44_init()
687 ice->akm_codecs = 0; in maya44_init()
690 wm8776_init(ice, &chip->wm[i], wm8776_addr[i]); in maya44_init()
695 ice->hw_rates = &dac_rates; in maya44_init()
698 ice->gpio.set_pro_rate = set_rate; in maya44_init()
701 ice->force_rdma1 = 1; in maya44_init()
704 ice->own_routing = 1; in maya44_init()
723 /* enable spdif out, spdif out supp, spdif-in, ext spdif out */