ad7949_adc         60 drivers/iio/adc/ad7949.c static int ad7949_spi_write_cfg(struct ad7949_adc_chip *ad7949_adc, u16 val,
ad7949_adc         64 drivers/iio/adc/ad7949.c 	int bits_per_word = ad7949_adc->resolution;
ad7949_adc         69 drivers/iio/adc/ad7949.c 			.tx_buf = &ad7949_adc->buffer,
ad7949_adc         75 drivers/iio/adc/ad7949.c 	ad7949_adc->cfg = (val & mask) | (ad7949_adc->cfg & ~mask);
ad7949_adc         76 drivers/iio/adc/ad7949.c 	ad7949_adc->buffer = ad7949_adc->cfg << shift;
ad7949_adc         78 drivers/iio/adc/ad7949.c 	ret = spi_sync(ad7949_adc->spi, &msg);
ad7949_adc         88 drivers/iio/adc/ad7949.c static int ad7949_spi_read_channel(struct ad7949_adc_chip *ad7949_adc, int *val,
ad7949_adc         93 drivers/iio/adc/ad7949.c 	int bits_per_word = ad7949_adc->resolution;
ad7949_adc         94 drivers/iio/adc/ad7949.c 	int mask = GENMASK(ad7949_adc->resolution, 0);
ad7949_adc         98 drivers/iio/adc/ad7949.c 			.rx_buf = &ad7949_adc->buffer,
ad7949_adc        111 drivers/iio/adc/ad7949.c 		ret = ad7949_spi_write_cfg(ad7949_adc,
ad7949_adc        116 drivers/iio/adc/ad7949.c 		if (channel == ad7949_adc->current_channel)
ad7949_adc        121 drivers/iio/adc/ad7949.c 	ad7949_adc->buffer = 0;
ad7949_adc        123 drivers/iio/adc/ad7949.c 	ret = spi_sync(ad7949_adc->spi, &msg);
ad7949_adc        133 drivers/iio/adc/ad7949.c 	ad7949_adc->current_channel = channel;
ad7949_adc        135 drivers/iio/adc/ad7949.c 	*val = ad7949_adc->buffer & mask;
ad7949_adc        163 drivers/iio/adc/ad7949.c 	struct ad7949_adc_chip *ad7949_adc = iio_priv(indio_dev);
ad7949_adc        171 drivers/iio/adc/ad7949.c 		mutex_lock(&ad7949_adc->lock);
ad7949_adc        172 drivers/iio/adc/ad7949.c 		ret = ad7949_spi_read_channel(ad7949_adc, val, chan->channel);
ad7949_adc        173 drivers/iio/adc/ad7949.c 		mutex_unlock(&ad7949_adc->lock);
ad7949_adc        181 drivers/iio/adc/ad7949.c 		ret = regulator_get_voltage(ad7949_adc->vref);
ad7949_adc        196 drivers/iio/adc/ad7949.c 	struct ad7949_adc_chip *ad7949_adc = iio_priv(indio_dev);
ad7949_adc        200 drivers/iio/adc/ad7949.c 		*readval = ad7949_adc->cfg;
ad7949_adc        202 drivers/iio/adc/ad7949.c 		ret = ad7949_spi_write_cfg(ad7949_adc,
ad7949_adc        213 drivers/iio/adc/ad7949.c static int ad7949_spi_init(struct ad7949_adc_chip *ad7949_adc)
ad7949_adc        219 drivers/iio/adc/ad7949.c 	ad7949_adc->current_channel = 0;
ad7949_adc        220 drivers/iio/adc/ad7949.c 	ret = ad7949_spi_write_cfg(ad7949_adc, 0x3C79, AD7949_MASK_TOTAL);
ad7949_adc        226 drivers/iio/adc/ad7949.c 	ad7949_spi_read_channel(ad7949_adc, &val, ad7949_adc->current_channel);
ad7949_adc        227 drivers/iio/adc/ad7949.c 	ad7949_spi_read_channel(ad7949_adc, &val, ad7949_adc->current_channel);
ad7949_adc        236 drivers/iio/adc/ad7949.c 	struct ad7949_adc_chip *ad7949_adc;
ad7949_adc        240 drivers/iio/adc/ad7949.c 	indio_dev = devm_iio_device_alloc(dev, sizeof(*ad7949_adc));
ad7949_adc        254 drivers/iio/adc/ad7949.c 	ad7949_adc = iio_priv(indio_dev);
ad7949_adc        255 drivers/iio/adc/ad7949.c 	ad7949_adc->indio_dev = indio_dev;
ad7949_adc        256 drivers/iio/adc/ad7949.c 	ad7949_adc->spi = spi;
ad7949_adc        260 drivers/iio/adc/ad7949.c 	ad7949_adc->resolution = spec->resolution;
ad7949_adc        262 drivers/iio/adc/ad7949.c 	ad7949_adc->vref = devm_regulator_get(dev, "vref");
ad7949_adc        263 drivers/iio/adc/ad7949.c 	if (IS_ERR(ad7949_adc->vref)) {
ad7949_adc        265 drivers/iio/adc/ad7949.c 		return PTR_ERR(ad7949_adc->vref);
ad7949_adc        268 drivers/iio/adc/ad7949.c 	ret = regulator_enable(ad7949_adc->vref);
ad7949_adc        274 drivers/iio/adc/ad7949.c 	mutex_init(&ad7949_adc->lock);
ad7949_adc        276 drivers/iio/adc/ad7949.c 	ret = ad7949_spi_init(ad7949_adc);
ad7949_adc        291 drivers/iio/adc/ad7949.c 	mutex_destroy(&ad7949_adc->lock);
ad7949_adc        292 drivers/iio/adc/ad7949.c 	regulator_disable(ad7949_adc->vref);
ad7949_adc        300 drivers/iio/adc/ad7949.c 	struct ad7949_adc_chip *ad7949_adc = iio_priv(indio_dev);
ad7949_adc        303 drivers/iio/adc/ad7949.c 	mutex_destroy(&ad7949_adc->lock);
ad7949_adc        304 drivers/iio/adc/ad7949.c 	regulator_disable(ad7949_adc->vref);