Lines Matching +full:adc +full:- +full:reserved +full:- +full:channels

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright 2003 Vivien Chappelier <vivien.chappelier@linux-mips.org>
9 * Copyright 1999 Silicon Graphics, Inc. All rights reserved.
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 */
39 ad1843_RSS = { 2, 5, 3 }, /* Right ADC Source Select */
40 ad1843_LIG = { 2, 8, 4 }, /* Left ADC Input Gain */
41 ad1843_LMGE = { 2, 12, 1 }, /* Left ADC Mic Gain Enable */
42 ad1843_LSS = { 2, 13, 3 }, /* Left ADC Source Select */
74 ad1843_ADLC = { 15, 0, 2 }, /* ADC Left Sample Rate Source */
75 ad1843_ADRC = { 15, 2, 2 }, /* ADC Right Sample Rate Source */
81 ad1843_DAADL = { 25, 4, 2 }, /* Digital ADC Left Source Select */
82 ad1843_DAADR = { 25, 6, 2 }, /* Digital ADC Right Source Select */
85 ad1843_ADLF = { 26, 0, 2 }, /* ADC Left Channel Data Format */
86 ad1843_ADRF = { 26, 2, 2 }, /* ADC Right Channel Data Format */
87 ad1843_ADTLK = { 26, 4, 1 }, /* ADC Transmit Lock Mode Select */
93 ad1843_ADLEN = { 27, 0, 1 }, /* ADC Left Channel Enable */
94 ad1843_ADREN = { 27, 1, 1 }, /* ADC Right Channel Enable */
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()
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()
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()
378 unsigned int channels) in ad1843_setup_dac() argument
402 switch (channels) { in ad1843_setup_dac()
437 unsigned int channels) in ad1843_setup_adc() argument
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()
500 /* DAC1/2 use clock 1/2 as source, ADC uses clock 3. Always. */ in ad1843_init()
520 /* set gain to 0 for all channels */ in ad1843_init()
528 /* Unmute all channels. */ in ad1843_init()
540 /* Set Speaker Out level to +/- 4V and unmute it. */ in ad1843_init()