Lines Matching +full:ch3 +full:- +full:0

1 // SPDX-License-Identifier: GPL-2.0
30 #define BCOVE_GPADCREQ 0xDC
31 #define BCOVE_GPADCREQ_BUSY BIT(0)
67 complete(&adc->completion); in mrfld_adc_thread_isr()
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 time_left = wait_for_completion_interruptible_timeout(&adc->completion, in mrfld_adc_single_conv()
100 if (time_left < 0) { in mrfld_adc_single_conv()
104 if (time_left == 0) { 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()
117 regmap_update_bits(regmap, BCOVE_MIRQLVL1, BCOVE_LVL1_ADC, 0xff); in mrfld_adc_single_conv()
118 regmap_update_bits(regmap, BCOVE_MADCIRQ, BCOVE_ADCIRQ_ALL, 0xff); in mrfld_adc_single_conv()
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()
156 BCOVE_ADC_CHANNEL(IIO_VOLTAGE, 0, "CH0", 0xE9),
157 BCOVE_ADC_CHANNEL(IIO_RESISTANCE, 1, "CH1", 0xEB),
158 BCOVE_ADC_CHANNEL(IIO_CURRENT, 2, "CH2", 0xED),
159 BCOVE_ADC_CHANNEL(IIO_TEMP, 3, "CH3", 0xCC),
160 BCOVE_ADC_CHANNEL(IIO_TEMP, 4, "CH4", 0xC8),
161 BCOVE_ADC_CHANNEL(IIO_TEMP, 5, "CH5", 0xCA),
162 BCOVE_ADC_CHANNEL(IIO_TEMP, 6, "CH6", 0xC2),
163 BCOVE_ADC_CHANNEL(IIO_TEMP, 7, "CH7", 0xC4),
164 BCOVE_ADC_CHANNEL(IIO_TEMP, 8, "CH8", 0xC6),
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()
191 return -ENOMEM; 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()
199 irq = platform_get_irq(pdev, 0); in mrfld_adc_probe()
200 if (irq < 0) 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()