Lines Matching refs:adc
88 struct rn5t618_adc_data *adc = data; in rn5t618_adc_irq() local
93 regmap_write(adc->rn5t618->regmap, RN5T618_IR_ADC1, 0); in rn5t618_adc_irq()
94 regmap_write(adc->rn5t618->regmap, RN5T618_IR_ADC2, 0); in rn5t618_adc_irq()
96 ret = regmap_read(adc->rn5t618->regmap, RN5T618_IR_ADC3, &r); in rn5t618_adc_irq()
98 dev_err(adc->dev, "failed to read IRQ status: %d\n", ret); in rn5t618_adc_irq()
100 regmap_write(adc->rn5t618->regmap, RN5T618_IR_ADC3, 0); in rn5t618_adc_irq()
103 complete(&adc->conv_completion); in rn5t618_adc_irq()
112 struct rn5t618_adc_data *adc = iio_priv(iio_dev); in rn5t618_adc_read() local
125 ret = regmap_update_bits(adc->rn5t618->regmap, RN5T618_ADCCNT3, in rn5t618_adc_read()
131 ret = regmap_write(adc->rn5t618->regmap, RN5T618_EN_ADCIR3, in rn5t618_adc_read()
136 ret = regmap_update_bits(adc->rn5t618->regmap, RN5T618_ADCCNT3, in rn5t618_adc_read()
143 init_completion(&adc->conv_completion); in rn5t618_adc_read()
145 ret = regmap_update_bits(adc->rn5t618->regmap, RN5T618_ADCCNT3, in rn5t618_adc_read()
151 ret = wait_for_completion_timeout(&adc->conv_completion, in rn5t618_adc_read()
154 dev_warn(adc->dev, "timeout waiting for adc result\n"); in rn5t618_adc_read()
158 ret = rn5t618_read_adc_reg(adc->rn5t618, in rn5t618_adc_read()
204 struct rn5t618_adc_data *adc; in rn5t618_adc_probe() local
207 iio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc)); in rn5t618_adc_probe()
213 adc = iio_priv(iio_dev); in rn5t618_adc_probe()
214 adc->dev = &pdev->dev; in rn5t618_adc_probe()
215 adc->rn5t618 = rn5t618; in rn5t618_adc_probe()
218 adc->irq = regmap_irq_get_virq(rn5t618->irq_data, in rn5t618_adc_probe()
221 if (adc->irq <= 0) { in rn5t618_adc_probe()
226 init_completion(&adc->conv_completion); in rn5t618_adc_probe()
241 ret = devm_request_threaded_irq(adc->dev, adc->irq, NULL, in rn5t618_adc_probe()
243 IRQF_ONESHOT, dev_name(adc->dev), in rn5t618_adc_probe()
244 adc); in rn5t618_adc_probe()
246 dev_err(adc->dev, "request irq %d failed: %d\n", adc->irq, ret); in rn5t618_adc_probe()
250 ret = devm_iio_map_array_register(adc->dev, iio_dev, rn5t618_maps); in rn5t618_adc_probe()
254 return devm_iio_device_register(adc->dev, iio_dev); in rn5t618_adc_probe()