Commit 86bf7f3e authored by Kristina Martšenko's avatar Kristina Martšenko Committed by Jonathan Cameron

iio: mxs-lradc: make ADC reads not disable touchscreen interrupts

Reading a channel through sysfs, or starting a buffered capture, will
currently turn off the touchscreen. This is because the read_raw() and
buffer preenable()/postdisable() callbacks disable interrupts for all
LRADC channels, including those the touchscreen uses.

So make the callbacks only disable interrupts for the channels they use.
This means channel 0 for read_raw() and channels 0-5 for the buffer (if
the touchscreen is enabled). Since the touchscreen uses different
channels (6 and 7), it no longer gets turned off.

Note that only i.MX28 is affected by this issue, i.MX23 should be fine.
Signed-off-by: default avatarKristina Martšenko <kristina.martsenko@gmail.com>
Reviewed-by: default avatarMarek Vasut <marex@denx.de>
Cc: Stable@vger.kernel.org
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent f81197b8
...@@ -220,6 +220,9 @@ struct mxs_lradc { ...@@ -220,6 +220,9 @@ struct mxs_lradc {
*/ */
#define TOUCHSCREEN_VCHANNEL1 7 #define TOUCHSCREEN_VCHANNEL1 7
#define TOUCHSCREEN_VCHANNEL2 6 #define TOUCHSCREEN_VCHANNEL2 6
#define BUFFER_VCHANS_LIMITED 0x3f
#define BUFFER_VCHANS_ALL 0xff
u8 buffer_vchans;
/* /*
* Furthermore, certain LRADC channels are shared between touchscreen * Furthermore, certain LRADC channels are shared between touchscreen
...@@ -819,7 +822,7 @@ static int mxs_lradc_read_single(struct iio_dev *iio_dev, int chan, int *val) ...@@ -819,7 +822,7 @@ static int mxs_lradc_read_single(struct iio_dev *iio_dev, int chan, int *val)
* used if doing raw sampling. * used if doing raw sampling.
*/ */
if (lradc->soc == IMX28_LRADC) if (lradc->soc == IMX28_LRADC)
mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0),
LRADC_CTRL1); LRADC_CTRL1);
mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
...@@ -1266,8 +1269,9 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio) ...@@ -1266,8 +1269,9 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio)
} }
if (lradc->soc == IMX28_LRADC) if (lradc->soc == IMX28_LRADC)
mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, mxs_lradc_reg_clear(lradc,
LRADC_CTRL1); lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET,
LRADC_CTRL1);
mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) { for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) {
...@@ -1303,8 +1307,9 @@ static int mxs_lradc_buffer_postdisable(struct iio_dev *iio) ...@@ -1303,8 +1307,9 @@ static int mxs_lradc_buffer_postdisable(struct iio_dev *iio)
mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
if (lradc->soc == IMX28_LRADC) if (lradc->soc == IMX28_LRADC)
mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, mxs_lradc_reg_clear(lradc,
LRADC_CTRL1); lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET,
LRADC_CTRL1);
kfree(lradc->buffer); kfree(lradc->buffer);
mutex_unlock(&lradc->lock); mutex_unlock(&lradc->lock);
...@@ -1542,6 +1547,11 @@ static int mxs_lradc_probe(struct platform_device *pdev) ...@@ -1542,6 +1547,11 @@ static int mxs_lradc_probe(struct platform_device *pdev)
touch_ret = mxs_lradc_probe_touchscreen(lradc, node); touch_ret = mxs_lradc_probe_touchscreen(lradc, node);
if (touch_ret == 0)
lradc->buffer_vchans = BUFFER_VCHANS_LIMITED;
else
lradc->buffer_vchans = BUFFER_VCHANS_ALL;
/* Grab all IRQ sources */ /* Grab all IRQ sources */
for (i = 0; i < of_cfg->irq_count; i++) { for (i = 0; i < of_cfg->irq_count; i++) {
lradc->irq[i] = platform_get_irq(pdev, i); lradc->irq[i] = platform_get_irq(pdev, i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment