Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: adc: ab8500-gpadc: Support non-hw-conversion

The hardware conversion mode only exists in the AB8500
version of the chip, as it is lacking in the AB8505 it
will not be in the device tree and we should just not
even try to obtain it.

The driver already contains code to avoid using a
non-existing hardware conversion IRQ at conversion time.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20201218222013.383704-1-linus.walleij@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Linus Walleij and committed by
Jonathan Cameron
cef49e5e 138daca3

+18 -12
+18 -12
drivers/iio/adc/ab8500-gpadc.c
··· 1108 1108 return gpadc->irq_sw; 1109 1109 } 1110 1110 1111 - gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END"); 1112 - if (gpadc->irq_hw < 0) { 1113 - dev_err(dev, "failed to get platform hw_conv_end irq\n"); 1114 - return gpadc->irq_hw; 1111 + if (is_ab8500(gpadc->ab8500)) { 1112 + gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END"); 1113 + if (gpadc->irq_hw < 0) { 1114 + dev_err(dev, "failed to get platform hw_conv_end irq\n"); 1115 + return gpadc->irq_hw; 1116 + } 1117 + } else { 1118 + gpadc->irq_hw = 0; 1115 1119 } 1116 1120 1117 1121 /* Initialize completion used to notify completion of conversion */ ··· 1132 1128 return ret; 1133 1129 } 1134 1130 1135 - ret = devm_request_threaded_irq(dev, gpadc->irq_hw, NULL, 1136 - ab8500_bm_gpadcconvend_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT, 1137 - "ab8500-gpadc-hw", gpadc); 1138 - if (ret < 0) { 1139 - dev_err(dev, 1140 - "Failed to request hw conversion irq: %d\n", 1141 - gpadc->irq_hw); 1142 - return ret; 1131 + if (gpadc->irq_hw) { 1132 + ret = devm_request_threaded_irq(dev, gpadc->irq_hw, NULL, 1133 + ab8500_bm_gpadcconvend_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT, 1134 + "ab8500-gpadc-hw", gpadc); 1135 + if (ret < 0) { 1136 + dev_err(dev, 1137 + "Failed to request hw conversion irq: %d\n", 1138 + gpadc->irq_hw); 1139 + return ret; 1140 + } 1143 1141 } 1144 1142 1145 1143 /* The VTVout LDO used to power the AB8500 GPADC */