Lines Matching refs:indio_dev
134 static int ad5421_write_unlocked(struct iio_dev *indio_dev, in ad5421_write_unlocked() argument
137 struct ad5421_state *st = iio_priv(indio_dev); in ad5421_write_unlocked()
144 static int ad5421_write(struct iio_dev *indio_dev, unsigned int reg, in ad5421_write() argument
147 struct ad5421_state *st = iio_priv(indio_dev); in ad5421_write()
151 ret = ad5421_write_unlocked(indio_dev, reg, val); in ad5421_write()
157 static int ad5421_read(struct iio_dev *indio_dev, unsigned int reg) in ad5421_read() argument
159 struct ad5421_state *st = iio_priv(indio_dev); in ad5421_read()
185 static int ad5421_update_ctrl(struct iio_dev *indio_dev, unsigned int set, in ad5421_update_ctrl() argument
188 struct ad5421_state *st = iio_priv(indio_dev); in ad5421_update_ctrl()
196 ret = ad5421_write_unlocked(indio_dev, AD5421_REG_CTRL, st->ctrl); in ad5421_update_ctrl()
205 struct iio_dev *indio_dev = data; in ad5421_fault_handler() local
206 struct ad5421_state *st = iio_priv(indio_dev); in ad5421_fault_handler()
211 fault = ad5421_read(indio_dev, AD5421_REG_FAULT); in ad5421_fault_handler()
220 ad5421_update_ctrl(indio_dev, 0, 0); in ad5421_fault_handler()
242 iio_push_event(indio_dev, in ad5421_fault_handler()
247 iio_get_time_ns(indio_dev)); in ad5421_fault_handler()
251 iio_push_event(indio_dev, in ad5421_fault_handler()
256 iio_get_time_ns(indio_dev)); in ad5421_fault_handler()
260 iio_push_event(indio_dev, in ad5421_fault_handler()
265 iio_get_time_ns(indio_dev)); in ad5421_fault_handler()
269 fault = ad5421_read(indio_dev, AD5421_REG_FAULT); in ad5421_fault_handler()
314 static int ad5421_read_raw(struct iio_dev *indio_dev, in ad5421_read_raw() argument
317 struct ad5421_state *st = iio_priv(indio_dev); in ad5421_read_raw()
326 ret = ad5421_read(indio_dev, AD5421_REG_DAC_DATA); in ad5421_read_raw()
340 ret = ad5421_read(indio_dev, AD5421_REG_OFFSET); in ad5421_read_raw()
346 ret = ad5421_read(indio_dev, AD5421_REG_GAIN); in ad5421_read_raw()
356 static int ad5421_write_raw(struct iio_dev *indio_dev, in ad5421_write_raw() argument
366 return ad5421_write(indio_dev, AD5421_REG_DAC_DATA, val); in ad5421_write_raw()
372 return ad5421_write(indio_dev, AD5421_REG_OFFSET, val); in ad5421_write_raw()
377 return ad5421_write(indio_dev, AD5421_REG_GAIN, val); in ad5421_write_raw()
385 static int ad5421_write_event_config(struct iio_dev *indio_dev, in ad5421_write_event_config() argument
389 struct ad5421_state *st = iio_priv(indio_dev); in ad5421_write_event_config()
416 static int ad5421_read_event_config(struct iio_dev *indio_dev, in ad5421_read_event_config() argument
420 struct ad5421_state *st = iio_priv(indio_dev); in ad5421_read_event_config()
440 static int ad5421_read_event_value(struct iio_dev *indio_dev, in ad5421_read_event_value() argument
449 ret = ad5421_read(indio_dev, AD5421_REG_DAC_DATA); in ad5421_read_event_value()
475 struct iio_dev *indio_dev; in ad5421_probe() local
479 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); in ad5421_probe()
480 if (indio_dev == NULL) { in ad5421_probe()
485 st = iio_priv(indio_dev); in ad5421_probe()
486 spi_set_drvdata(spi, indio_dev); in ad5421_probe()
490 indio_dev->name = "ad5421"; in ad5421_probe()
491 indio_dev->info = &ad5421_info; in ad5421_probe()
492 indio_dev->modes = INDIO_DIRECT_MODE; in ad5421_probe()
493 indio_dev->channels = ad5421_channels; in ad5421_probe()
494 indio_dev->num_channels = ARRAY_SIZE(ad5421_channels); in ad5421_probe()
510 ad5421_update_ctrl(indio_dev, 0, 0); in ad5421_probe()
518 indio_dev); in ad5421_probe()
523 return devm_iio_device_register(&spi->dev, indio_dev); in ad5421_probe()