]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.19.2/iio-mxs-lradc-make-adc-reads-not-disable-touchscreen-interrupts.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.19.2 / iio-mxs-lradc-make-adc-reads-not-disable-touchscreen-interrupts.patch
CommitLineData
9883b64d
GKH
1From 86bf7f3ef7e961e91e16dceb31ae0f583483b204 Mon Sep 17 00:00:00 2001
2From: Kristina Martšenko <kristina.martsenko@gmail.com>
3Date: Sun, 25 Jan 2015 18:28:20 +0200
4Subject: iio: mxs-lradc: make ADC reads not disable touchscreen interrupts
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9From: Kristina Martšenko <kristina.martsenko@gmail.com>
10
11commit 86bf7f3ef7e961e91e16dceb31ae0f583483b204 upstream.
12
13Reading a channel through sysfs, or starting a buffered capture, will
14currently turn off the touchscreen. This is because the read_raw() and
15buffer preenable()/postdisable() callbacks disable interrupts for all
16LRADC channels, including those the touchscreen uses.
17
18So make the callbacks only disable interrupts for the channels they use.
19This means channel 0 for read_raw() and channels 0-5 for the buffer (if
20the touchscreen is enabled). Since the touchscreen uses different
21channels (6 and 7), it no longer gets turned off.
22
23Note that only i.MX28 is affected by this issue, i.MX23 should be fine.
24
25Signed-off-by: Kristina Martšenko <kristina.martsenko@gmail.com>
26Reviewed-by: Marek Vasut <marex@denx.de>
27Signed-off-by: Jonathan Cameron <jic23@kernel.org>
28Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29
30---
31 drivers/staging/iio/adc/mxs-lradc.c | 20 +++++++++++++++-----
32 1 file changed, 15 insertions(+), 5 deletions(-)
33
34--- a/drivers/staging/iio/adc/mxs-lradc.c
35+++ b/drivers/staging/iio/adc/mxs-lradc.c
36@@ -220,6 +220,9 @@ struct mxs_lradc {
37 */
38 #define TOUCHSCREEN_VCHANNEL1 7
39 #define TOUCHSCREEN_VCHANNEL2 6
40+#define BUFFER_VCHANS_LIMITED 0x3f
41+#define BUFFER_VCHANS_ALL 0xff
42+ u8 buffer_vchans;
43
44 /*
45 * Furthermore, certain LRADC channels are shared between touchscreen
46@@ -819,7 +822,7 @@ static int mxs_lradc_read_single(struct
47 * used if doing raw sampling.
48 */
49 if (lradc->soc == IMX28_LRADC)
50- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
51+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0),
52 LRADC_CTRL1);
53 mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
54
55@@ -1266,8 +1269,9 @@ static int mxs_lradc_buffer_preenable(st
56 }
57
58 if (lradc->soc == IMX28_LRADC)
59- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
60- LRADC_CTRL1);
61+ mxs_lradc_reg_clear(lradc,
62+ lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET,
63+ LRADC_CTRL1);
64 mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
65
66 for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) {
67@@ -1303,8 +1307,9 @@ static int mxs_lradc_buffer_postdisable(
68
69 mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
70 if (lradc->soc == IMX28_LRADC)
71- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
72- LRADC_CTRL1);
73+ mxs_lradc_reg_clear(lradc,
74+ lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET,
75+ LRADC_CTRL1);
76
77 kfree(lradc->buffer);
78 mutex_unlock(&lradc->lock);
79@@ -1549,6 +1554,11 @@ static int mxs_lradc_probe(struct platfo
80
81 touch_ret = mxs_lradc_probe_touchscreen(lradc, node);
82
83+ if (touch_ret == 0)
84+ lradc->buffer_vchans = BUFFER_VCHANS_LIMITED;
85+ else
86+ lradc->buffer_vchans = BUFFER_VCHANS_ALL;
87+
88 /* Grab all IRQ sources */
89 for (i = 0; i < of_cfg->irq_count; i++) {
90 lradc->irq[i] = platform_get_irq(pdev, i);