From 64fa3632bef9cdb8639aedb761201222c2ea41f0 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Wed, 17 May 2017 09:45:17 -0700 Subject: 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 Acked-by: Marcel Ziswiler --- drivers/staging/iio/adc/stmpe-adc.c | 8 +++++--- 1 file 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; -- cgit v1.2.3