Lines Matching +full:dac +full:- +full:mode +full:- +full:mask
1 // SPDX-License-Identifier: GPL-2.0-only
21 * The BD79703 uses 12-bit SPI commands. First four bits (high bits) define
22 * channel(s) which are operated on, and also the mode. The mode can be to set
23 * a DAC word only, or set DAC word and output. The data-sheet is not very
24 * specific on how a previously set DAC word can be 'taken in to use'. Thus
25 * this driver only uses the 'set DAC and output it' -mode.
27 * The BD79703 latches last 12-bits when the chip-select is toggled. Thus we
28 * can use 16-bit transfers which should be widely supported. To simplify this
30 * address. This allows us to separate channels/mode by address and treat the
31 * 8-bit register value as DAC word. The highest 4 bits of address will be
48 int *val2, long mask) in bd79703_read_raw() argument
52 if (mask != IIO_CHAN_INFO_SCALE) in bd79703_read_raw()
53 return -EINVAL; in bd79703_read_raw()
55 *val = data->vfs / 1000; in bd79703_read_raw()
63 int val2, long mask) in bd79703_write_raw() argument
68 return -EINVAL; in bd79703_write_raw()
70 return regmap_write(data->regmap, chan->channel + 1, val); in bd79703_write_raw()
99 struct device *dev = &spi->dev; in bd79703_probe()
106 return -ENOMEM; in bd79703_probe()
110 data->regmap = devm_regmap_init_spi(spi, &bd79703_regmap_config); in bd79703_probe()
111 if (IS_ERR(data->regmap)) in bd79703_probe()
112 return dev_err_probe(dev, PTR_ERR(data->regmap), in bd79703_probe()
123 data->vfs = ret; in bd79703_probe()
124 idev->channels = bd79703_channels; in bd79703_probe()
125 idev->num_channels = ARRAY_SIZE(bd79703_channels); in bd79703_probe()
126 idev->modes = INDIO_DIRECT_MODE; in bd79703_probe()
127 idev->info = &bd79703_info; in bd79703_probe()
128 idev->name = "bd79703"; in bd79703_probe()
131 ret = regmap_write(data->regmap, BD79703_REG_OUT_ALL, 0); in bd79703_probe()
161 MODULE_DESCRIPTION("ROHM BD79703 DAC driver");