Lines Matching refs:st
88 struct ad5449 *st = iio_priv(indio_dev); in ad5449_write() local
92 st->data[0] = cpu_to_be16((addr << 12) | val); in ad5449_write()
93 ret = spi_write(st->spi, st->data, 2); in ad5449_write()
102 struct ad5449 *st = iio_priv(indio_dev); in ad5449_read() local
106 .tx_buf = &st->data[0], in ad5449_read()
110 .tx_buf = &st->data[1], in ad5449_read()
111 .rx_buf = &st->data[1], in ad5449_read()
117 st->data[0] = cpu_to_be16(addr << 12); in ad5449_read()
118 st->data[1] = cpu_to_be16(AD5449_CMD_NOOP); in ad5449_read()
120 ret = spi_sync_transfer(st->spi, t, ARRAY_SIZE(t)); in ad5449_read()
124 *val = be16_to_cpu(st->data[1]); in ad5449_read()
134 struct ad5449 *st = iio_priv(indio_dev); in ad5449_read_raw() local
141 if (st->has_sdo) { in ad5449_read_raw()
148 *val = st->dac_cache[chan->address]; in ad5449_read_raw()
153 reg = &st->vref_reg[chan->channel]; in ad5449_read_raw()
172 struct ad5449 *st = iio_priv(indio_dev); in ad5449_write_raw() local
184 st->dac_cache[chan->address] = val; in ad5449_write_raw()
258 static const char *ad5449_vref_name(struct ad5449 *st, int n) in ad5449_vref_name() argument
260 if (st->chip_info->num_channels == 1) in ad5449_vref_name()
274 struct ad5449 *st; in ad5449_spi_probe() local
278 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); in ad5449_spi_probe()
282 st = iio_priv(indio_dev); in ad5449_spi_probe()
285 st->chip_info = &ad5449_chip_info[id->driver_data]; in ad5449_spi_probe()
286 st->spi = spi; in ad5449_spi_probe()
288 for (i = 0; i < st->chip_info->num_channels; ++i) in ad5449_spi_probe()
289 st->vref_reg[i].supply = ad5449_vref_name(st, i); in ad5449_spi_probe()
291 ret = devm_regulator_bulk_get(&spi->dev, st->chip_info->num_channels, in ad5449_spi_probe()
292 st->vref_reg); in ad5449_spi_probe()
296 ret = regulator_bulk_enable(st->chip_info->num_channels, st->vref_reg); in ad5449_spi_probe()
304 indio_dev->channels = st->chip_info->channels; in ad5449_spi_probe()
305 indio_dev->num_channels = st->chip_info->num_channels; in ad5449_spi_probe()
307 if (st->chip_info->has_ctrl) { in ad5449_spi_probe()
313 st->has_sdo = pdata->sdo_mode != AD5449_SDO_DISABLED; in ad5449_spi_probe()
315 st->has_sdo = true; in ad5449_spi_probe()
327 regulator_bulk_disable(st->chip_info->num_channels, st->vref_reg); in ad5449_spi_probe()
335 struct ad5449 *st = iio_priv(indio_dev); in ad5449_spi_remove() local
339 regulator_bulk_disable(st->chip_info->num_channels, st->vref_reg); in ad5449_spi_remove()