Skip to contentSkip to conversation

Input: ads7846: detect pen up from IRQ state

PATCH In review [email protected] 2 participants 6 messages Jul 3, 2006 – Jul 6, 2006 Input drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 Input: ads7846: detect pen up from IRQ state

We can't depend on the pressure value to determine when the pen was lifted, so use the IRQ line state instead.

---

 drivers/input/touchscreen/ads7846.c |  112 +++++++++++++++++++----------------
 1 files changed, 62 insertions(+), 50 deletions(-)

dfeac813257ad4941ac35a82f1996d3cd468a07e

drivers/input/touchscreen/ads7846.c +62 -50
index 4369845..94c36b1 100644
@@ -370,6 +370,39 @@ static DEVICE_ATTR(disable, 0664, ads784
 
 /*--------------------------------------------------------------------------*/
 
+static void ads7846_report_pen_state(struct ads7846 *ts, int down)
+{
+	struct input_dev	*input_dev = ts->input;
+
+	input_report_key(input_dev, BTN_TOUCH, down);
+	if (!down)
+		input_report_abs(input_dev, ABS_PRESSURE, 0);
+#ifdef VERBOSE
+	pr_debug("%s: %s\n", ts->spi->dev.bus_id, down ? "DOWN" : "UP");
+#endif
+}
+
+static void ads7846_report_pen_position(struct ads7846 *ts, int x, int y,
+					int pressure)
+{
+	struct input_dev	*input_dev = ts->input;
+
+	input_report_abs(input_dev, ABS_X, x);
+	input_report_abs(input_dev, ABS_Y, y);
+	input_report_abs(input_dev, ABS_PRESSURE, pressure);
+
+#ifdef VERBOSE
+	pr_debug("%s: %d/%d/%d\n", ts->spi->dev.bus_id, x, y, pressure);
+#endif
+}
+
+static void ads7846_sync_events(struct ads7846 *ts)
+{
+	struct input_dev	*input_dev = ts->input;
+
+	input_sync(input_dev);
+}
+
 /*
  * PENIRQ only kicks the timer.  The timer only reissues the SPI transfer,
  * to retrieve touchscreen status.
@@ -381,11 +414,8 @@ static DEVICE_ATTR(disable, 0664, ads784
 static void ads7846_rx(void *ads)
 {
 	struct ads7846		*ts = ads;
-	struct input_dev	*input_dev = ts->input;
 	unsigned		Rt;
-	unsigned		sync = 0;
 	u16			x, y, z1, z2;
-	unsigned long		flags;
 
 	/* adjust:  on-wire is a must-ignore bit, a BE12 value, then padding;
 	 * built from two 8 bit values written msb-first.
@@ -399,7 +429,7 @@ static void ads7846_rx(void *ads)
 	if (x == MAX_12BIT)
 		x = 0;
 
-	if (likely(x && z1 && !device_suspended(&ts->spi->dev))) {
+	if (likely(x && z1)) {
 		/* compute touch pressure resistance using equation #2 */
 		Rt = z2;
 		Rt -= z1;
@@ -414,51 +444,31 @@ static void ads7846_rx(void *ads)
 	* the maximum. Don't report it to user space, repeat at least
 	* once more the measurement */
 	if (ts->tc.ignore || Rt > ts->pressure_max) {
+#ifdef VERBOSE
+		pr_debug("%s: ignored %d pressure %d\n",
+			ts->spi->dev.bus_id, ts->tc.ignore, Rt);
+#endif
 		mod_timer(&ts->timer, jiffies + TS_POLL_PERIOD);
 		return;
 	}
 
-	/* NOTE:  "pendown" is inferred from pressure; we don't rely on
-	 * being able to check nPENIRQ status, or "friendly" trigger modes
-	 * (both-edges is much better than just-falling or low-level).
-	 *
-	 * REVISIT:  some boards may require reading nPENIRQ; it's
-	 * needed on 7843.  and 7845 reads pressure differently...
-	 *
-	 * REVISIT:  the touchscreen might not be connected; this code
-	 * won't notice that, even if nPENIRQ never fires ...
+	/* NOTE: We can't rely on the pressure to determine the pen down
+	 * state. The pressure value can fluctuate for quite a while
+	 * after lifting the pen and in some cases may not even settle at
+	 * the expected value. The only safe way to check for the pen up
+	 * condition is in the timer by reading the pen IRQ state.
 	 */
-	if (!ts->pendown && Rt != 0) {
-		input_report_key(input_dev, BTN_TOUCH, 1);
-		sync = 1;
-	} else if (ts->pendown && Rt == 0) {
-		input_report_key(input_dev, BTN_TOUCH, 0);
-		sync = 1;
-	}
-
 	if (Rt) {
-		input_report_abs(input_dev, ABS_X, x);
-		input_report_abs(input_dev, ABS_Y, y);
-		sync = 1;
-	}
-
-	if (sync) {
-		input_report_abs(input_dev, ABS_PRESSURE, Rt);
-		input_sync(input_dev);
+		if (!ts->pendown) {
+			ads7846_report_pen_state(ts, 1);
+			ts->pendown = 1;
+		}
+		ads7846_report_pen_position(ts, x, y, Rt);
+		ads7846_sync_events(ts);
 	}
 
-#ifdef	VERBOSE
-	if (Rt || ts->pendown)
-		pr_debug("%s: %d/%d/%d%s\n", ts->spi->dev.bus_id,
-			x, y, Rt, Rt ? "" : " UP");
-#endif
 
-	spin_lock_irqsave(&ts->lock, flags);
-
-	ts->pendown = (Rt != 0);
 	mod_timer(&ts->timer, jiffies + TS_POLL_PERIOD);
-
-	spin_unlock_irqrestore(&ts->lock, flags);
 }
 
 static void ads7846_debounce(void *ads)
@@ -472,7 +482,8 @@ static void ads7846_debounce(void *ads)
 	m = &ts->msg[ts->msg_idx];
 	t = list_entry(m->transfers.prev, struct spi_transfer, transfer_list);
 	val = (be16_to_cpu(*(__be16 *)t->rx_buf) >> 3) & 0x0fff;
-	if (!ts->read_cnt || (abs(ts->last_read - val) > ts->debounce_tol)) {
+	if (ts->debounce_max && (
+	    !ts->read_cnt || (abs(ts->last_read - val) > ts->debounce_tol))) {
 		/* Repeat it, if this was the first read or the read
 		 * wasn't consistent enough. */
 		if (ts->read_cnt < ts->debounce_max) {
@@ -519,14 +530,20 @@ static void ads7846_timer(unsigned long 
 
 	spin_lock_irq(&ts->lock);
 
-	if (unlikely(ts->msg_idx && !ts->pendown)) {
+	if (unlikely(!ts->get_pendown_state() ||
+		     device_suspended(&ts->spi->dev))) {
+		if (ts->pendown) {
+			ads7846_report_pen_state(ts, 0);
+			ads7846_sync_events(ts);
+			ts->pendown = 0;
+		}
+
 		/* measurment cycle ended */
 		if (!device_suspended(&ts->spi->dev)) {
 			ts->irq_disabled = 0;
 			enable_irq(ts->spi->irq);
 		}
 		ts->pending = 0;
-		ts->msg_idx = 0;
 	} else {
 		/* pen is still down, continue with the measurement */
 		ts->msg_idx = 0;
@@ -702,14 +719,9 @@ static int __devinit ads7846_probe(struc
 	ts->vref_delay_usecs = pdata->vref_delay_usecs ? : 100;
 	ts->x_plate_ohms = pdata->x_plate_ohms ? : 400;
 	ts->pressure_max = pdata->pressure_max ? : ~0;
-	if (pdata->debounce_max) {
-		ts->debounce_max = pdata->debounce_max;
-		ts->debounce_tol = pdata->debounce_tol;
-		ts->debounce_rep = pdata->debounce_rep;
-		if (ts->debounce_rep > ts->debounce_max + 1)
-			ts->debounce_rep = ts->debounce_max - 1;
-	} else
-		ts->debounce_tol = ~0;
+	ts->debounce_max = pdata->debounce_max;
+	ts->debounce_tol = pdata->debounce_tol;
+	ts->debounce_rep = pdata->debounce_rep;
 	ts->get_pendown_state = pdata->get_pendown_state;
 
 	snprintf(ts->phys, sizeof(ts->phys), "%s/input0", spi->dev.bus_id);
Signature · 1 line
1.2.3.g90cc1-dirty
#1 lore raw

Hi Imre,

Quoted 2 lines · [email protected] wrote:

We can't depend on the pressure value to determine when the pen was lifted, so use the IRQ line state instead.

Today, Tony pushed the "input: ads7846: can't disable filtering"

http://linux.omap.com/pipermail/linux-omap-open-source/2006-June/007358.html

fix from beginning of June.

Yesterday, you posted a new patchset "[PATCH 1/1-4] Input: ads7846:". As I understand it, this recent patch set is the clean version of ads7846 and is a replacement for the old workaround now pushed by Tony? Or is it an add on?

Wasn't able to test this patchset, somewhat impossible without framebuffer ;)

Best regards

Dirk

#2 lore raw
Quoted 6 lines · Dirk Behme

Hi Imre,

Quoted 2 lines · [email protected] wrote:

We can't depend on the pressure value to determine when the pen was lifted, so use the IRQ line state instead.

Quoted 6 lines

Today, Tony pushed the "input: ads7846: can't disable filtering"

http://linux.omap.com/pipermail/linux-omap-open-source/2006-June/007358.html

fix from beginning of June.

Uh, I forgot about that and noticed Tony's email about it too late.

Quoted 5 lines

Yesterday, you posted a new patchset "[PATCH 1/1-4] Input:
ads7846:". As I understand it, this recent patch set is the clean version of ads7846 and is a replacement for the old workaround now pushed by Tony? Or is it an add on?

The first patch of the set includes that fix. Now that it's pushed I'm posting an updated version of that first patch. The rest should apply ok.

Thanks,
Imre

[PATCH 1/4] Input: ads7846: detect pen up from IRQ state

We can't depend on the pressure value to determine when the pen was lifted, so use the IRQ line state instead.

---

drivers/input/touchscreen/ads7846.c +57 -41
index 4ec7875..94c36b1 100644
@@ -370,6 +370,39 @@ static DEVICE_ATTR(disable, 0664, ads784
 
 /*--------------------------------------------------------------------------*/
 
+static void ads7846_report_pen_state(struct ads7846 *ts, int down)
+{
+	struct input_dev	*input_dev = ts->input;
+
+	input_report_key(input_dev, BTN_TOUCH, down);
+	if (!down)
+		input_report_abs(input_dev, ABS_PRESSURE, 0);
+#ifdef VERBOSE
+	pr_debug("%s: %s\n", ts->spi->dev.bus_id, down ? "DOWN" : "UP");
+#endif
+}
+
+static void ads7846_report_pen_position(struct ads7846 *ts, int x, int y,
+					int pressure)
+{
+	struct input_dev	*input_dev = ts->input;
+
+	input_report_abs(input_dev, ABS_X, x);
+	input_report_abs(input_dev, ABS_Y, y);
+	input_report_abs(input_dev, ABS_PRESSURE, pressure);
+
+#ifdef VERBOSE
+	pr_debug("%s: %d/%d/%d\n", ts->spi->dev.bus_id, x, y, pressure);
+#endif
+}
+
+static void ads7846_sync_events(struct ads7846 *ts)
+{
+	struct input_dev	*input_dev = ts->input;
+
+	input_sync(input_dev);
+}
+
 /*
  * PENIRQ only kicks the timer.  The timer only reissues the SPI transfer,
  * to retrieve touchscreen status.
@@ -381,11 +414,8 @@ static DEVICE_ATTR(disable, 0664, ads784
 static void ads7846_rx(void *ads)
 {
 	struct ads7846		*ts = ads;
-	struct input_dev	*input_dev = ts->input;
 	unsigned		Rt;
-	unsigned		sync = 0;
 	u16			x, y, z1, z2;
-	unsigned long		flags;
 
 	/* adjust:  on-wire is a must-ignore bit, a BE12 value, then padding;
 	 * built from two 8 bit values written msb-first.
@@ -399,7 +429,7 @@ static void ads7846_rx(void *ads)
 	if (x == MAX_12BIT)
 		x = 0;
 
-	if (likely(x && z1 && !device_suspended(&ts->spi->dev))) {
+	if (likely(x && z1)) {
 		/* compute touch pressure resistance using equation #2 */
 		Rt = z2;
 		Rt -= z1;
@@ -414,51 +444,31 @@ static void ads7846_rx(void *ads)
 	* the maximum. Don't report it to user space, repeat at least
 	* once more the measurement */
 	if (ts->tc.ignore || Rt > ts->pressure_max) {
+#ifdef VERBOSE
+		pr_debug("%s: ignored %d pressure %d\n",
+			ts->spi->dev.bus_id, ts->tc.ignore, Rt);
+#endif
 		mod_timer(&ts->timer, jiffies + TS_POLL_PERIOD);
 		return;
 	}
 
-	/* NOTE:  "pendown" is inferred from pressure; we don't rely on
-	 * being able to check nPENIRQ status, or "friendly" trigger modes
-	 * (both-edges is much better than just-falling or low-level).
-	 *
-	 * REVISIT:  some boards may require reading nPENIRQ; it's
-	 * needed on 7843.  and 7845 reads pressure differently...
-	 *
-	 * REVISIT:  the touchscreen might not be connected; this code
-	 * won't notice that, even if nPENIRQ never fires ...
+	/* NOTE: We can't rely on the pressure to determine the pen down
+	 * state. The pressure value can fluctuate for quite a while
+	 * after lifting the pen and in some cases may not even settle at
+	 * the expected value. The only safe way to check for the pen up
+	 * condition is in the timer by reading the pen IRQ state.
 	 */
-	if (!ts->pendown && Rt != 0) {
-		input_report_key(input_dev, BTN_TOUCH, 1);
-		sync = 1;
-	} else if (ts->pendown && Rt == 0) {
-		input_report_key(input_dev, BTN_TOUCH, 0);
-		sync = 1;
-	}
-
 	if (Rt) {
-		input_report_abs(input_dev, ABS_X, x);
-		input_report_abs(input_dev, ABS_Y, y);
-		sync = 1;
-	}
-
-	if (sync) {
-		input_report_abs(input_dev, ABS_PRESSURE, Rt);
-		input_sync(input_dev);
+		if (!ts->pendown) {
+			ads7846_report_pen_state(ts, 1);
+			ts->pendown = 1;
+		}
+		ads7846_report_pen_position(ts, x, y, Rt);
+		ads7846_sync_events(ts);
 	}
 
-#ifdef	VERBOSE
-	if (Rt || ts->pendown)
-		pr_debug("%s: %d/%d/%d%s\n", ts->spi->dev.bus_id,
-			x, y, Rt, Rt ? "" : " UP");
-#endif
-
-	spin_lock_irqsave(&ts->lock, flags);
 
-	ts->pendown = (Rt != 0);
 	mod_timer(&ts->timer, jiffies + TS_POLL_PERIOD);
-
-	spin_unlock_irqrestore(&ts->lock, flags);
 }
 
 static void ads7846_debounce(void *ads)
@@ -520,14 +530,20 @@ static void ads7846_timer(unsigned long 
 
 	spin_lock_irq(&ts->lock);
 
-	if (unlikely(ts->msg_idx && !ts->pendown)) {
+	if (unlikely(!ts->get_pendown_state() ||
+		     device_suspended(&ts->spi->dev))) {
+		if (ts->pendown) {
+			ads7846_report_pen_state(ts, 0);
+			ads7846_sync_events(ts);
+			ts->pendown = 0;
+		}
+
 		/* measurment cycle ended */
 		if (!device_suspended(&ts->spi->dev)) {
 			ts->irq_disabled = 0;
 			enable_irq(ts->spi->irq);
 		}
 		ts->pending = 0;
-		ts->msg_idx = 0;
 	} else {
 		/* pen is still down, continue with the measurement */
 		ts->msg_idx = 0;
#3 lore raw
Quoted 10 lines · [email protected] wrote:
Quoted 9 lines · Dirk Behme
Quoted 2 lines · [email protected] wrote:

We can't depend on the pressure value to determine when the pen was lifted, so use the IRQ line state instead.

Today, Tony pushed the "input: ads7846: can't disable filtering"

http://linux.omap.com/pipermail/linux-omap-open-source/2006-June/007358.html

Quoted 8 lines
Quoted 1 line

fix from beginning of June.

Uh, I forgot about that and noticed Tony's email about it too late.

Quoted 1 line

Yesterday, you posted a new patchset "[PATCH 1/1-4] Input: ads7846:". As I understand it, this recent patch set is the clean version of ads7846 and is a replacement for the old workaround now pushed by Tony? Or is it an add on?

The first patch of the set includes that fix. Now that it's pushed I'm posting an updated version of that first patch. The rest should apply ok.

Just applied patch 1-4 to recent git and tried on OSK and get crash below at module load.

Cheers

dirk

Unable to handle kernel NULL pointer dereference at virtual address 0000003a
pgd = c1a64000
[0000003a] *pgd=11c73031, *pte=00000000, *ppte=00000000
Internal error: Oops: 0 [#1]
Modules linked in: ads7846 omap_uwire spi_bitbang omap_keypad evdev nfs lockd suni
CPU: 0
PC is at 0x3a
LR is at ads7846_probe+0x148/0x73c [ads7846]
pc : [<0000003a>]    lr : [<bf082e04>]    Not tainted

sp : c1c7be74 ip : 00000000 fp : c1c7bea8
r10: c1c57000 r9 : c1c7a000 r8 : c1abc600
r7 : 00000001 r6 : c01a7d18 r5 : c1fe9000 r4 : 00000000 r3 : 0000003b r2 : 0000ffff r1 : c1fe92d0 r0 : c01a7d18
Flags: nzCv IRQs on FIQs on Mode SVC_32 Segment user
Control: 5317F Table: 11A64000 DAC: 00000015 Process insmod (pid: 753, stack limit = 0xc1c7a198)

Stack: (0xc1c7be74 to 0xc1c7c000)

be60: c1c7be90 c01e3b80 c1fff8c0
be80: c1abc6cc c1abc600 00000000 bf0841a4 c0021fa4 c1c7a000 00000000 c1c7beb8
bea0: c1c7beac c0148f64 bf082ccc c1c7bed8 c1c7bebc c0130eac c0148f50 c1abc6cc
bec0: c1abc600 c0130f9c bf0841a4 c1c7bef0 c1c7bedc c0131020 c0130e40 00000000
bee0: c1c7bef4 c1c7bf1c c1c7bef4 c0130860 c0130fac c01e9b14 c01e9b14 c1abc648
bf00: bf0841b8 bf0841a4 c01e9a14 00000080 c1c7bf2c c1c7bf20 c0130dc0 c0130828
bf20: c1c7bf54 c1c7bf30 c01304bc c0130db0 bf0841a4 bf0842c0 40017000 00000080
bf40: c0021fa4 00000002 c1c7bf68 c1c7bf58 c0131320 c0130460 00002fe8 c1c7bf78
bf60: c1c7bf6c c0148da4 c013129c c1c7bf88 c1c7bf7c bf08603c c0148d64 c1c7bfa4
bf80: c1c7bf8c c0066120 bf086010 00000003 00000000 00000100 00000000 c1c7bfa8
bfa0: c0021e00 c0066080 00000000 00000100 00900080 40017000 00002fe8 0006e050
bfc0: 00000003 00000000 00000100 bebfbe94 bebfbf56 0000c7bc 00000002 00000000
bfe0: bebfbdd0 bebfbdc4 0001e6fc 40122390 60000010 00900080 e50b2028 e50b1024

Backtrace:
[<bf082cbc>] (ads7846_probe+0x0/0x73c [ads7846]) from [<c0148f64>] (spi_drv_probe)
[<c0148f40>] (spi_drv_probe+0x0/0x28) from [<c0130eac>] (driver_probe_device+0x7c)
[<c0130e30>] (driver_probe_device+0x0/0xcc) from [<c0131020>] (__driver_attach+0x)
 r7 = BF0841A4  r6 = C0130F9C  r5 = C1ABC600  r4 = C1ABC6CC
[<c0130f9c>] (__driver_attach+0x0/0xe4) from [<c0130860>] (bus_for_each_dev+0x48/)
 r5 = C1C7BEF4  r4 = 00000000
[<c0130818>] (bus_for_each_dev+0x0/0x80) from [<c0130dc0>] (driver_attach+0x20/0x)
 r7 = 00000080  r6 = C01E9A14  r5 = BF0841A4  r4 = BF0841B8
[<c0130da0>] (driver_attach+0x0/0x28) from [<c01304bc>] (bus_add_driver+0x6c/0x12)
[<c0130450>] (bus_add_driver+0x0/0x124) from [<c0131320>] (driver_register+0x94/0)
[<c013128c>] (driver_register+0x0/0xa4) from [<c0148da4>] (spi_register_driver+0x)
 r4 = 00002FE8
[<c0148d54>] (spi_register_driver+0x0/0x64) from [<bf08603c>] (ads7846_init+0x3c/)
[<bf086000>] (ads7846_init+0x0/0x44 [ads7846]) from [<c0066120>] (sys_init_module)
[<c0066070>] (sys_init_module+0x0/0x204) from [<c0021e00>] (ret_fast_syscall+0x0/)
 r6 = 00000100  r5 = 00000000  r4 = 00000003
Code: bad PC value.
 Segmentation fault

modprobe: failed to load module ads7846

#4 lore raw
Quoted 21 lines · Dirk Behme
Quoted 20 lines · [email protected] wrote:
Quoted 11 lines · Dirk Behme
Quoted 2 lines · [email protected] wrote:

We can't depend on the pressure value to determine when the pen was lifted, so use the IRQ line state instead.

Today, Tony pushed the "input: ads7846: can't disable filtering"

http://linux.omap.com/pipermail/linux-omap-open-source/2006-June/007358.html

fix from beginning of June.

Uh, I forgot about that and noticed Tony's email about it too late.

Quoted 4 lines

Yesterday, you posted a new patchset "[PATCH 1/1-4] Input:
ads7846:". As I understand it, this recent patch set is the clean version of ads7846 and is a replacement for the old workaround now pushed by Tony? Or is it an add on?

Quoted 5 lines
Quoted 2 lines

The first patch of the set includes that fix. Now that it's pushed I'm posting an updated version of that first patch. The rest should apply ok.

Just applied patch 1-4 to recent git and tried on OSK and get crash below at module load.

Just a wild guess, but did you update the kernel as well? The platform data struct changed..

--Imre

Quoted 81 lines

Cheers

dirk

Unable to handle kernel NULL pointer dereference at virtual 
address 0000003a
pgd = c1a64000
[0000003a] *pgd=11c73031, *pte=00000000, *ppte=00000000
Internal error: Oops: 0 [#1]
Modules linked in: ads7846 omap_uwire spi_bitbang 
omap_keypad evdev nfs lockd suni
CPU: 0
PC is at 0x3a
LR is at ads7846_probe+0x148/0x73c [ads7846]
pc : [<0000003a>]    lr : [<bf082e04>]    Not tainted

sp : c1c7be74 ip : 00000000 fp : c1c7bea8
r10: c1c57000 r9 : c1c7a000 r8 : c1abc600
r7 : 00000001 r6 : c01a7d18 r5 : c1fe9000 r4 : 00000000 r3 : 0000003b r2 : 0000ffff r1 : c1fe92d0 r0 : c01a7d18
Flags: nzCv IRQs on FIQs on Mode SVC_32 Segment user
Control: 5317F Table: 11A64000 DAC: 00000015 Process insmod (pid: 753, stack limit = 0xc1c7a198)

Stack: (0xc1c7be74 to 0xc1c7c000)

be60: c1c7be90
c01e3b80 c1fff8c0
be80: c1abc6cc c1abc600 00000000 bf0841a4 c0021fa4 c1c7a000 00000000 c1c7beb8
bea0: c1c7beac c0148f64 bf082ccc c1c7bed8 c1c7bebc c0130eac c0148f50 c1abc6cc
bec0: c1abc600 c0130f9c bf0841a4 c1c7bef0 c1c7bedc c0131020 c0130e40 00000000
bee0: c1c7bef4 c1c7bf1c c1c7bef4 c0130860 c0130fac c01e9b14 c01e9b14 c1abc648
bf00: bf0841b8 bf0841a4 c01e9a14 00000080 c1c7bf2c c1c7bf20 c0130dc0 c0130828
bf20: c1c7bf54 c1c7bf30 c01304bc c0130db0 bf0841a4 bf0842c0 40017000 00000080
bf40: c0021fa4 00000002 c1c7bf68 c1c7bf58 c0131320 c0130460 00002fe8 c1c7bf78
bf60: c1c7bf6c c0148da4 c013129c c1c7bf88 c1c7bf7c bf08603c c0148d64 c1c7bfa4
bf80: c1c7bf8c c0066120 bf086010 00000003 00000000 00000100 00000000 c1c7bfa8
bfa0: c0021e00 c0066080 00000000 00000100 00900080 40017000 00002fe8 0006e050
bfc0: 00000003 00000000 00000100 bebfbe94 bebfbf56 0000c7bc 00000002 00000000
bfe0: bebfbdd0 bebfbdc4 0001e6fc 40122390 60000010 00900080 e50b2028 e50b1024

Backtrace:
[<bf082cbc>] (ads7846_probe+0x0/0x73c [ads7846]) from 

[<c0148f64>] (spi_drv_probe)
[<c0148f40>] (spi_drv_probe+0x0/0x28) from [<c0130eac>] (driver_probe_device+0x7c)
[<c0130e30>] (driver_probe_device+0x0/0xcc) from [<c0131020>] (__driver_attach+0x)
r7 = BF0841A4 r6 = C0130F9C r5 = C1ABC600 r4 = C1ABC6CC
[<c0130f9c>] (__driver_attach+0x0/0xe4) from [<c0130860>] (bus_for_each_dev+0x48/)
r5 = C1C7BEF4 r4 = 00000000
[<c0130818>] (bus_for_each_dev+0x0/0x80) from [<c0130dc0>] (driver_attach+0x20/0x)
r7 = 00000080 r6 = C01E9A14 r5 = BF0841A4 r4 = BF0841B8
[<c0130da0>] (driver_attach+0x0/0x28) from [<c01304bc>] (bus_add_driver+0x6c/0x12)
[<c0130450>] (bus_add_driver+0x0/0x124) from [<c0131320>] (driver_register+0x94/0)
[<c013128c>] (driver_register+0x0/0xa4) from [<c0148da4>] (spi_register_driver+0x)
r4 = 00002FE8
[<c0148d54>] (spi_register_driver+0x0/0x64) from [<bf08603c>] (ads7846_init+0x3c/)
[<bf086000>] (ads7846_init+0x0/0x44 [ads7846]) from [<c0066120>] (sys_init_module)
[<c0066070>] (sys_init_module+0x0/0x204) from [<c0021e00>] (ret_fast_syscall+0x0/)
r6 = 00000100 r5 = 00000000 r4 = 00000003

Code: bad PC value.
 Segmentation fault

modprobe: failed to load module ads7846

#5 lore raw
Quoted 9 lines · [email protected] wrote:
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Yesterday, you posted a new patchset "[PATCH 1/1-4] Input: ads7846:". As I understand it, this recent patch set is the clean version of ads7846 and is a replacement for the old workaround now pushed by Tony? Or is it an add on?

The first patch of the set includes that fix. Now that it's pushed I'm posting an updated version of that first patch. The rest should apply ok.

Just applied patch 1-4 to recent git and tried on OSK and get crash below at module load.

Just a wild guess, but did you update the kernel as well? The platform data struct changed..

Uh, sometimes it can be so easy ;)

Many thanks for the hint

Dirk

P.S.: Works on OSK. I put this patchset on my pending patches list.