Lines Matching +full:adc +full:- +full:battery
1 // SPDX-License-Identifier: GPL-2.0
3 * ADC driver for Basin Cove PMIC
65 struct mrfld_adc *adc = iio_priv(indio_dev); in mrfld_adc_thread_isr() local
67 complete(&adc->completion); in mrfld_adc_thread_isr()
75 struct mrfld_adc *adc = iio_priv(indio_dev); in mrfld_adc_single_conv() local
76 struct regmap *regmap = adc->regmap; in mrfld_adc_single_conv()
82 reinit_completion(&adc->completion); in mrfld_adc_single_conv()
93 req = mrfld_adc_requests[chan->channel]; in mrfld_adc_single_conv()
98 timeout = wait_for_completion_interruptible_timeout(&adc->completion, in mrfld_adc_single_conv()
105 ret = -ETIMEDOUT; in mrfld_adc_single_conv()
109 ret = regmap_bulk_read(regmap, chan->address, &value, sizeof(value)); in mrfld_adc_single_conv()
127 struct mrfld_adc *adc = iio_priv(indio_dev); in mrfld_adc_read_raw() local
132 mutex_lock(&adc->lock); in mrfld_adc_read_raw()
134 mutex_unlock(&adc->lock); in mrfld_adc_read_raw()
137 return -EINVAL; in mrfld_adc_read_raw()
168 IIO_MAP("CH0", "bcove-battery", "VBATRSLT"),
169 IIO_MAP("CH1", "bcove-battery", "BATTID"),
170 IIO_MAP("CH2", "bcove-battery", "IBATRSLT"),
171 IIO_MAP("CH3", "bcove-temp", "PMICTEMP"),
172 IIO_MAP("CH4", "bcove-temp", "BATTEMP0"),
173 IIO_MAP("CH5", "bcove-temp", "BATTEMP1"),
174 IIO_MAP("CH6", "bcove-temp", "SYSTEMP0"),
175 IIO_MAP("CH7", "bcove-temp", "SYSTEMP1"),
176 IIO_MAP("CH8", "bcove-temp", "SYSTEMP2"),
182 struct device *dev = &pdev->dev; in mrfld_adc_probe()
183 struct intel_soc_pmic *pmic = dev_get_drvdata(dev->parent); in mrfld_adc_probe()
185 struct mrfld_adc *adc; in mrfld_adc_probe() local
191 return -ENOMEM; in mrfld_adc_probe()
193 adc = iio_priv(indio_dev); in mrfld_adc_probe()
195 mutex_init(&adc->lock); in mrfld_adc_probe()
196 init_completion(&adc->completion); in mrfld_adc_probe()
197 adc->regmap = pmic->regmap; in mrfld_adc_probe()
204 IRQF_ONESHOT | IRQF_SHARED, pdev->name, in mrfld_adc_probe()
209 indio_dev->name = pdev->name; in mrfld_adc_probe()
211 indio_dev->channels = mrfld_adc_channels; in mrfld_adc_probe()
212 indio_dev->num_channels = ARRAY_SIZE(mrfld_adc_channels); in mrfld_adc_probe()
213 indio_dev->info = &mrfld_adc_iio_info; in mrfld_adc_probe()
214 indio_dev->modes = INDIO_DIRECT_MODE; in mrfld_adc_probe()
241 MODULE_DESCRIPTION("ADC driver for Basin Cove PMIC");