Lines Matching defs:st

78 static void ad7091_convst(struct ad7476_state *st)
80 if (!st->convst_gpio)
83 gpiod_set_value(st->convst_gpio, 0);
85 gpiod_set_value(st->convst_gpio, 1);
93 struct ad7476_state *st = iio_priv(indio_dev);
96 ad7091_convst(st);
98 b_sent = spi_sync(st->spi, &st->msg);
102 iio_push_to_buffers_with_timestamp(indio_dev, st->data,
110 static void ad7091_reset(struct ad7476_state *st)
113 spi_read(st->spi, st->data, 1);
116 static int ad7476_scan_direct(struct ad7476_state *st)
120 ad7091_convst(st);
122 ret = spi_sync(st->spi, &st->msg);
126 return be16_to_cpup((__be16 *)st->data);
136 struct ad7476_state *st = iio_priv(indio_dev);
144 ret = ad7476_scan_direct(st);
149 *val = (ret >> st->chip_info->channel[0].scan_type.shift) &
150 GENMASK(st->chip_info->channel[0].scan_type.realbits - 1, 0);
153 if (st->ref_reg) {
154 scale_uv = regulator_get_voltage(st->ref_reg);
158 scale_uv = st->chip_info->int_vref_uv;
305 struct ad7476_state *st;
310 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
314 st = iio_priv(indio_dev);
315 st->chip_info =
331 if (!st->chip_info->int_vref_uv)
332 st->ref_reg = reg;
334 if (st->chip_info->has_vref) {
337 if (st->chip_info->int_vref_uv) {
357 st->ref_reg = reg;
366 st->ref_reg = NULL;
370 if (st->chip_info->has_vdrive) {
376 st->convst_gpio = devm_gpiod_get_optional(&spi->dev,
379 if (IS_ERR(st->convst_gpio))
380 return PTR_ERR(st->convst_gpio);
382 st->spi = spi;
386 indio_dev->channels = st->chip_info->channel;
390 if (st->convst_gpio)
391 indio_dev->channels = st->chip_info->convst_channel;
394 st->xfer.rx_buf = &st->data;
395 st->xfer.len = st->chip_info->channel[0].scan_type.storagebits / 8;
397 spi_message_init(&st->msg);
398 spi_message_add_tail(&st->xfer, &st->msg);
405 if (st->chip_info->reset)
406 st->chip_info->reset(st);