Lines Matching +full:input +full:- +full:analog +full:- +full:gain
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright 2003 Vivien Chappelier <vivien.chappelier@linux-mips.org>
35 ad1843_PDNO = { 0, 14, 1 }, /* Converter Power-Down Flag */
37 ad1843_RIG = { 2, 0, 4 }, /* Right ADC Input Gain */
38 ad1843_RMGE = { 2, 4, 1 }, /* Right ADC Mic Gain Enable */
40 ad1843_LIG = { 2, 8, 4 }, /* Left ADC Input Gain */
41 ad1843_LMGE = { 2, 12, 1 }, /* Left ADC Mic Gain Enable */
43 ad1843_RD2M = { 3, 0, 5 }, /* Right DAC 2 Mix Gain/Atten */
45 ad1843_LD2M = { 3, 8, 5 }, /* Left DAC 2 Mix Gain/Atten */
47 ad1843_RX1M = { 4, 0, 5 }, /* Right Aux 1 Mix Gain/Atten */
49 ad1843_LX1M = { 4, 8, 5 }, /* Left Aux 1 Mix Gain/Atten */
51 ad1843_RX2M = { 5, 0, 5 }, /* Right Aux 2 Mix Gain/Atten */
53 ad1843_LX2M = { 5, 8, 5 }, /* Left Aux 2 Mix Gain/Atten */
55 ad1843_RMCM = { 7, 0, 5 }, /* Right Mic Mix Gain/Atten */
57 ad1843_LMCM = { 7, 8, 5 }, /* Left Mic Mix Gain/Atten */
62 ad1843_RDA1G = { 9, 0, 6 }, /* Right DAC1 Analog/Digital Gain */
63 ad1843_RDA1GM = { 9, 7, 1 }, /* Right DAC1 Analog Mute */
64 ad1843_LDA1G = { 9, 8, 6 }, /* Left DAC1 Analog/Digital Gain */
65 ad1843_LDA1GM = { 9, 15, 1 }, /* Left DAC1 Analog Mute */
66 ad1843_RDA2G = { 10, 0, 6 }, /* Right DAC2 Analog/Digital Gain */
67 ad1843_RDA2GM = { 10, 7, 1 }, /* Right DAC2 Analog Mute */
68 ad1843_LDA2G = { 10, 8, 6 }, /* Left DAC2 Analog/Digital Gain */
69 ad1843_LDA2GM = { 10, 15, 1 }, /* Left DAC2 Analog Mute */
95 ad1843_AAMEN = { 27, 4, 1 }, /* Analog to Analog Mix Enable */
96 ad1843_ANAEN = { 27, 7, 1 }, /* Analog Channel Enable */
107 * specifying gain. The ad1843_gain structure parameterizes the
112 int negative; /* nonzero if gain is negative. */
177 w = ad1843->read(ad1843->chip, field->reg); in ad1843_read_bits()
178 return w >> field->lo_bit & ((1 << field->nbits) - 1); in ad1843_read_bits()
191 w = ad1843->read(ad1843->chip, field->reg); in ad1843_write_bits()
192 mask = ((1 << field->nbits) - 1) << field->lo_bit; in ad1843_write_bits()
193 oldval = (w & mask) >> field->lo_bit; in ad1843_write_bits()
194 newbits = (newval << field->lo_bit) & mask; in ad1843_write_bits()
196 ad1843->write(ad1843->chip, field->reg, w); in ad1843_write_bits()
218 int w = 0, mask, *value, reg = -1; in ad1843_read_multi()
221 while (--argcount >= 0) { in ad1843_read_multi()
224 if (reg == -1) { in ad1843_read_multi()
225 reg = fp->reg; in ad1843_read_multi()
226 w = ad1843->read(ad1843->chip, reg); in ad1843_read_multi()
229 mask = (1 << fp->nbits) - 1; in ad1843_read_multi()
230 *value = w >> fp->lo_bit & mask; in ad1843_read_multi()
256 reg = -1; in ad1843_write_multi()
259 while (--argcount >= 0) { in ad1843_write_multi()
262 if (reg == -1) in ad1843_write_multi()
263 reg = fp->reg; in ad1843_write_multi()
265 WARN_ON(reg != fp->reg); in ad1843_write_multi()
266 m = ((1 << fp->nbits) - 1) << fp->lo_bit; in ad1843_write_multi()
268 bits |= (value << fp->lo_bit) & m; in ad1843_write_multi()
273 w = ad1843->read(ad1843->chip, reg); in ad1843_write_multi()
277 ad1843->write(ad1843->chip, reg, w); in ad1843_write_multi()
285 ret = (1 << gp->lfield->nbits); in ad1843_get_gain_max()
286 if (!gp->lmute) in ad1843_get_gain_max()
287 ret -= 1; in ad1843_get_gain_max()
292 * ad1843_get_gain reads the specified register and extracts the gain value
293 * using the supplied gain type.
300 unsigned short mask = (1 << gp->lfield->nbits) - 1; in ad1843_get_gain()
302 ad1843_read_multi(ad1843, 2, gp->lfield, &lg, gp->rfield, &rg); in ad1843_get_gain()
303 if (gp->negative) { in ad1843_get_gain()
304 lg = mask - lg; in ad1843_get_gain()
305 rg = mask - rg; in ad1843_get_gain()
307 if (gp->lmute) { in ad1843_get_gain()
308 ad1843_read_multi(ad1843, 2, gp->lmute, &lm, gp->rmute, &rm); in ad1843_get_gain()
318 * Set an audio channel's gain.
320 * Returns the new gain, which may be lower than the old gain.
326 unsigned short mask = (1 << gp->lfield->nbits) - 1; in ad1843_set_gain()
333 if (gp->negative) { in ad1843_set_gain()
334 lg = mask - lg; in ad1843_set_gain()
335 rg = mask - rg; in ad1843_set_gain()
337 if (gp->lmute) in ad1843_set_gain()
338 ad1843_write_multi(ad1843, 2, gp->lmute, lm, gp->rmute, rm); in ad1843_set_gain()
339 ad1843_write_multi(ad1843, 2, gp->lfield, lg, gp->rfield, rg); in ad1843_set_gain()
360 * Returns newsrc on success, -errno on failure.
366 return -EINVAL; in ad1843_set_recsrc()
462 * sheet, section "START-UP SEQUENCE". The numbered comments are
464 * 52-54, for more info.
466 * return 0 on success, -errno on failure. */
474 return -EIO; in ad1843_init()
487 return -EIO; in ad1843_init()
520 /* set gain to 0 for all channels */ in ad1843_init()
535 * mic gain to +20 dB. in ad1843_init()
540 /* Set Speaker Out level to +/- 4V and unmute it. */ in ad1843_init()