]>
Commit | Line | Data |
---|---|---|
9883b64d GKH |
1 | From 86bf7f3ef7e961e91e16dceb31ae0f583483b204 Mon Sep 17 00:00:00 2001 |
2 | From: Kristina Martšenko <kristina.martsenko@gmail.com> | |
3 | Date: Sun, 25 Jan 2015 18:28:20 +0200 | |
4 | Subject: iio: mxs-lradc: make ADC reads not disable touchscreen interrupts | |
5 | MIME-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ||
9 | From: Kristina Martšenko <kristina.martsenko@gmail.com> | |
10 | ||
11 | commit 86bf7f3ef7e961e91e16dceb31ae0f583483b204 upstream. | |
12 | ||
13 | Reading a channel through sysfs, or starting a buffered capture, will | |
14 | currently turn off the touchscreen. This is because the read_raw() and | |
15 | buffer preenable()/postdisable() callbacks disable interrupts for all | |
16 | LRADC channels, including those the touchscreen uses. | |
17 | ||
18 | So make the callbacks only disable interrupts for the channels they use. | |
19 | This means channel 0 for read_raw() and channels 0-5 for the buffer (if | |
20 | the touchscreen is enabled). Since the touchscreen uses different | |
21 | channels (6 and 7), it no longer gets turned off. | |
22 | ||
23 | Note that only i.MX28 is affected by this issue, i.MX23 should be fine. | |
24 | ||
25 | Signed-off-by: Kristina Martšenko <kristina.martsenko@gmail.com> | |
26 | Reviewed-by: Marek Vasut <marex@denx.de> | |
27 | Signed-off-by: Jonathan Cameron <jic23@kernel.org> | |
28 | Signed-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); |