Lines Matching +full:adc +full:- +full:chan
1 // SPDX-License-Identifier: GPL-2.0
3 * ADC driver for Basin Cove PMIC
64 struct mrfld_adc *adc = iio_priv(indio_dev); in mrfld_adc_thread_isr() local
66 complete(&adc->completion); in mrfld_adc_thread_isr()
71 struct iio_chan_spec const *chan, in mrfld_adc_single_conv() argument
74 struct mrfld_adc *adc = iio_priv(indio_dev); in mrfld_adc_single_conv() local
75 struct regmap *regmap = adc->regmap; in mrfld_adc_single_conv()
81 reinit_completion(&adc->completion); in mrfld_adc_single_conv()
92 req = mrfld_adc_requests[chan->channel]; in mrfld_adc_single_conv()
97 timeout = wait_for_completion_interruptible_timeout(&adc->completion, in mrfld_adc_single_conv()
104 ret = -ETIMEDOUT; in mrfld_adc_single_conv()
108 ret = regmap_bulk_read(regmap, chan->address, &value, sizeof(value)); in mrfld_adc_single_conv()
123 struct iio_chan_spec const *chan, in mrfld_adc_read_raw() argument
126 struct mrfld_adc *adc = iio_priv(indio_dev); in mrfld_adc_read_raw() local
131 mutex_lock(&adc->lock); in mrfld_adc_read_raw()
132 ret = mrfld_adc_single_conv(indio_dev, chan, val); in mrfld_adc_read_raw()
133 mutex_unlock(&adc->lock); in mrfld_adc_read_raw()
136 return -EINVAL; in mrfld_adc_read_raw()
167 IIO_MAP("CH0", "bcove-battery", "VBATRSLT"),
168 IIO_MAP("CH1", "bcove-battery", "BATTID"),
169 IIO_MAP("CH2", "bcove-battery", "IBATRSLT"),
170 IIO_MAP("CH3", "bcove-temp", "PMICTEMP"),
171 IIO_MAP("CH4", "bcove-temp", "BATTEMP0"),
172 IIO_MAP("CH5", "bcove-temp", "BATTEMP1"),
173 IIO_MAP("CH6", "bcove-temp", "SYSTEMP0"),
174 IIO_MAP("CH7", "bcove-temp", "SYSTEMP1"),
175 IIO_MAP("CH8", "bcove-temp", "SYSTEMP2"),
181 struct device *dev = &pdev->dev; in mrfld_adc_probe()
182 struct intel_soc_pmic *pmic = dev_get_drvdata(dev->parent); in mrfld_adc_probe()
184 struct mrfld_adc *adc; in mrfld_adc_probe() local
190 return -ENOMEM; in mrfld_adc_probe()
192 adc = iio_priv(indio_dev); in mrfld_adc_probe()
194 mutex_init(&adc->lock); in mrfld_adc_probe()
195 init_completion(&adc->completion); in mrfld_adc_probe()
196 adc->regmap = pmic->regmap; in mrfld_adc_probe()
203 IRQF_ONESHOT | IRQF_SHARED, pdev->name, in mrfld_adc_probe()
210 indio_dev->name = pdev->name; in mrfld_adc_probe()
212 indio_dev->channels = mrfld_adc_channels; in mrfld_adc_probe()
213 indio_dev->num_channels = ARRAY_SIZE(mrfld_adc_channels); in mrfld_adc_probe()
214 indio_dev->info = &mrfld_adc_iio_info; in mrfld_adc_probe()
215 indio_dev->modes = INDIO_DIRECT_MODE; in mrfld_adc_probe()
260 MODULE_DESCRIPTION("ADC driver for Basin Cove PMIC");