summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2017-05-17 09:45:17 -0700
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2017-06-30 18:10:40 +0200
commit64fa3632bef9cdb8639aedb761201222c2ea41f0 (patch)
tree21cf45cfd6f2cd54ea1bda71074c43668457129b
parentd54941999b4af8c290d965543e3c24002f552302 (diff)
iio: adc: fix number of channels when not using TS block
The number of channels registered when not using the touchscreen block has been wrong. This did not allow to access all channels in case where touchscreen is not used. By default Apalis and Colibri T30 do use the touchscreen block, so the bug has not affected the products when used with default platform data. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-rw-r--r--drivers/staging/iio/adc/stmpe-adc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/staging/iio/adc/stmpe-adc.c b/drivers/staging/iio/adc/stmpe-adc.c
index 3a9d6bee558d..34035c1b05ba 100644
--- a/drivers/staging/iio/adc/stmpe-adc.c
+++ b/drivers/staging/iio/adc/stmpe-adc.c
@@ -253,11 +253,13 @@ static int __devinit stmpe_adc_probe(struct platform_device *pdev)
indio_dev->modes = INDIO_DIRECT_MODE;
/* Register TS-Channels only if they are available */
- if (stmpe->pdata->blocks & STMPE_BLOCK_TOUCHSCREEN)
+ if (stmpe->pdata->blocks & STMPE_BLOCK_TOUCHSCREEN) {
indio_dev->channels = stmpe_adc_iio_channels;
- else
+ indio_dev->num_channels = ARRAY_SIZE(stmpe_adc_iio_channels);
+ } else {
indio_dev->channels = stmpe_adc_all_iio_channels;
- indio_dev->num_channels = ARRAY_SIZE(stmpe_adc_iio_channels);
+ indio_dev->num_channels = ARRAY_SIZE(stmpe_adc_all_iio_channels);
+ }
if (pdata)
adc_pdata = pdata->adc;