Lines Matching refs:st
127 struct ad5764_state *st = iio_priv(indio_dev); in ad5764_write() local
131 st->data[0].d32 = cpu_to_be32((reg << 16) | val); in ad5764_write()
133 ret = spi_write(st->spi, &st->data[0].d8[1], 3); in ad5764_write()
142 struct ad5764_state *st = iio_priv(indio_dev); in ad5764_read() local
146 .tx_buf = &st->data[0].d8[1], in ad5764_read()
150 .rx_buf = &st->data[1].d8[1], in ad5764_read()
157 st->data[0].d32 = cpu_to_be32((1 << 23) | (reg << 16)); in ad5764_read()
159 ret = spi_sync_transfer(st->spi, t, ARRAY_SIZE(t)); in ad5764_read()
161 *val = be32_to_cpu(st->data[1].d32) & 0xffff; in ad5764_read()
212 static int ad5764_get_channel_vref(struct ad5764_state *st, in ad5764_get_channel_vref() argument
215 if (st->chip_info->int_vref) in ad5764_get_channel_vref()
216 return st->chip_info->int_vref; in ad5764_get_channel_vref()
218 return regulator_get_voltage(st->vref_reg[channel / 2].consumer); in ad5764_get_channel_vref()
224 struct ad5764_state *st = iio_priv(indio_dev); in ad5764_read_raw() local
253 vref = ad5764_get_channel_vref(st, chan->channel); in ad5764_read_raw()
278 struct ad5764_state *st; in ad5764_probe() local
281 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); in ad5764_probe()
287 st = iio_priv(indio_dev); in ad5764_probe()
290 st->spi = spi; in ad5764_probe()
291 st->chip_info = &ad5764_chip_infos[type]; in ad5764_probe()
298 indio_dev->channels = st->chip_info->channels; in ad5764_probe()
300 if (st->chip_info->int_vref == 0) { in ad5764_probe()
301 st->vref_reg[0].supply = "vrefAB"; in ad5764_probe()
302 st->vref_reg[1].supply = "vrefCD"; in ad5764_probe()
304 ret = devm_regulator_bulk_get(&st->spi->dev, in ad5764_probe()
305 ARRAY_SIZE(st->vref_reg), st->vref_reg); in ad5764_probe()
312 ret = regulator_bulk_enable(ARRAY_SIZE(st->vref_reg), in ad5764_probe()
313 st->vref_reg); in ad5764_probe()
330 if (st->chip_info->int_vref == 0) in ad5764_probe()
331 regulator_bulk_disable(ARRAY_SIZE(st->vref_reg), st->vref_reg); in ad5764_probe()
338 struct ad5764_state *st = iio_priv(indio_dev); in ad5764_remove() local
342 if (st->chip_info->int_vref == 0) in ad5764_remove()
343 regulator_bulk_disable(ARRAY_SIZE(st->vref_reg), st->vref_reg); in ad5764_remove()