Skip to contentSkip to conversation

Touchscreen support for sharp sl-5500

PATCH In review Pavel Machek 2 participants 4 messages Jul 23, 2005 Input drivers

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Touchscreen support for sharp sl-5500

This adds support for touchscreen on Sharp Zaurus sl-5500. Vojtech, please apply,

drivers/input/touchscreen/Kconfig +9 -0
@@ -36,6 +36,15 @@ config TOUCHSCREEN_CORGI
 	  To compile this driver as a module, choose M here: the
 	  module will be called ads7846_ts.
 
+config TOUCHSCREEN_COLLIE
+	tristate "Collie touchscreen (for Sharp SL-5500)"
+	depends on MCP_UCB1200
+	help
+	  Say Y here to enable the driver for the touchscreen on the 
+	  Sharp SL-5500 series of PDAs.
+
+	  If unsure, say N.
+
 config TOUCHSCREEN_GUNZE
 	tristate "Gunze AHL-51S touchscreen"
 	select SERIO
drivers/input/touchscreen/Makefile +1 -0
@@ -6,6 +6,7 @@
 
 obj-$(CONFIG_TOUCHSCREEN_BITSY)	+= h3600_ts_input.o
 obj-$(CONFIG_TOUCHSCREEN_CORGI)	+= corgi_ts.o
+obj-$(CONFIG_TOUCHSCREEN_COLLIE)+= collie_ts.o
 obj-$(CONFIG_TOUCHSCREEN_GUNZE)	+= gunze.o
 obj-$(CONFIG_TOUCHSCREEN_ELO)	+= elo.o
 obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o
drivers/input/touchscreen/collie_ts.c new file +377 -0

377 lines not on this page · raw message

Signature · 1 line
teflon -- maybe it is a trademark, but it should not be.
#1 lore raw
Quoted 2 lines · Pavel Machek

This adds support for touchscreen on Sharp Zaurus sl-5500. Vojtech, please apply,

I have couple more commnets...

drivers/input/touchscreen/collie_ts.c line 163

Quoted 8 lines
drivers/input/touchscreen/collie_ts.c new file +8 -0
+static int ucb1x00_thread(void *_ts)
+{
+	struct ucb1x00_ts *ts = _ts;
+	struct task_struct *tsk = current;
+	int valid;
+
+	ts->rtask = tsk;
+	allow_signal(SIGKILL);

This is not needed...

drivers/input/touchscreen/collie_ts.c line 173

Quoted 10 lines
drivers/input/touchscreen/collie_ts.c new file +10 -0
+
+	/*
+	 * We run as a real-time thread.  However, thus far
+	 * this doesn't seem to be necessary.
+	 */
+	tsk->policy = SCHED_FIFO;
+	tsk->rt_priority = 1;
+
+	complete(&ts->init_exit);
+

Neither this one - kthread_create does not return until thread is actually created and started.

drivers/input/touchscreen/collie_ts.c line 241

Quoted 3 lines
drivers/input/touchscreen/collie_ts.c new file +3 -0
+
+		if (signal_pending(tsk))
+			break;

if (kthread_should_stop(..))

	break;

drivers/input/touchscreen/collie_ts.c line 245

Quoted 4 lines
drivers/input/touchscreen/collie_ts.c new file +4 -0
+	}
+
+	ts->rtask = NULL;
+	complete_and_exit(&ts->init_exit, 0);

This is not needed.

drivers/input/touchscreen/collie_ts.c line 267

Quoted 9 lines
drivers/input/touchscreen/collie_ts.c new file +9 -0
+static int ucb1x00_ts_open(struct input_dev *idev)
+{
+	struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev;
+	int ret = 0;
+	struct task_struct *task;
+
+	if (ts->rtask)
+		panic("ucb1x00: rtask running?");
+

Do you really need to panic here???

drivers/input/touchscreen/collie_ts.c line 285

Quoted 5 lines
drivers/input/touchscreen/collie_ts.c new file +5 -0
+
+	init_completion(&ts->init_exit);
+	task = kthread_run(ucb1x00_thread, ts, "ktsd");
+	if (!IS_ERR(task)) {
+		wait_for_completion(&ts->init_exit);

Just call kthread_run() and kill that init_exit completion.

drivers/input/touchscreen/collie_ts.c line 305

Quoted 7 lines
drivers/input/touchscreen/collie_ts.c new file +7 -0
+static void ucb1x00_ts_close(struct input_dev *idev)
+{
+	struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev;
+
+	if (ts->rtask) {
+		send_sig(SIGKILL, ts->rtask, 1);
+		wait_for_completion(&ts->init_exit);

kthread_stop().

Signature · 1 line
Dmitry
#2 lore raw

This adds support for touchscreen on Sharp Zaurus sl-5500. Please apply,
Pavel

drivers/input/touchscreen/Kconfig +9 -0
@@ -36,6 +36,15 @@ config TOUCHSCREEN_CORGI
 	  To compile this driver as a module, choose M here: the
 	  module will be called ads7846_ts.
 
+config TOUCHSCREEN_COLLIE
+	tristate "Collie touchscreen (for Sharp SL-5500)"
+	depends on MCP_UCB1200
+	help
+	  Say Y here to enable the driver for the touchscreen on the 
+	  Sharp SL-5500 series of PDAs.
+
+	  If unsure, say N.
+
 config TOUCHSCREEN_GUNZE
 	tristate "Gunze AHL-51S touchscreen"
 	select SERIO
drivers/input/touchscreen/Makefile +1 -0
@@ -6,6 +6,7 @@
 
 obj-$(CONFIG_TOUCHSCREEN_BITSY)	+= h3600_ts_input.o
 obj-$(CONFIG_TOUCHSCREEN_CORGI)	+= corgi_ts.o
+obj-$(CONFIG_TOUCHSCREEN_COLLIE)+= collie_ts.o
 obj-$(CONFIG_TOUCHSCREEN_GUNZE)	+= gunze.o
 obj-$(CONFIG_TOUCHSCREEN_ELO)	+= elo.o
 obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o
drivers/input/touchscreen/collie_ts.c new file +367 -0

367 lines not on this page · raw message

Signature · 1 line
teflon -- maybe it is a trademark, but it should not be.
#3 lore raw
In reply to Dmitry Torokhov

Hi!

Quoted 4 lines
Quoted 2 lines

This adds support for touchscreen on Sharp Zaurus sl-5500. Vojtech, please apply,

I have couple more commnets...

Sorry, I never really worked with kthreads. Applied all those,

Quoted 11 lines

Review

Quoted 9 lines
(quoted diff) +9 -0
+static int ucb1x00_ts_open(struct input_dev *idev)
+{
+	struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev;
+	int ret = 0;
+	struct task_struct *task;
+
+	if (ts->rtask)
+		panic("ucb1x00: rtask running?");
+

Do you really need to panic here???

Does BUG_ON() seem better :-). We could also just return failure here, but I do not see how it could happen => I guess I'd better catch it with BUG().

Here's what I did, updated patch will follow.
Pavel

drivers/input/touchscreen/collie_ts.c +5 -15
@@ -41,7 +41,6 @@ struct ucb1x00_ts {
 	struct ucb1x00		*ucb;
 
 	struct semaphore	irq_wait;
-	struct completion	init_exit;
 	struct task_struct	*rtask;
 	u16			x_res;
 	u16			y_res;
@@ -160,7 +159,6 @@ static int ucb1x00_thread(void *_ts)
 	int valid;
 
 	ts->rtask = tsk;
-	allow_signal(SIGKILL);
 
 	/*
 	 * We run as a real-time thread.  However, thus far
@@ -169,10 +167,7 @@ static int ucb1x00_thread(void *_ts)
 	tsk->policy = SCHED_FIFO;
 	tsk->rt_priority = 1;
 
-	complete(&ts->init_exit);
-
 	valid = 0;
-
 	for (;;) {
 		unsigned int x, y, p, val;
 
@@ -237,12 +232,12 @@ static int ucb1x00_thread(void *_ts)
 			msleep_interruptible(10);
 		}
 
-		if (signal_pending(tsk))
+		if (kthread_should_stop())
 			break;
 	}
 
 	ts->rtask = NULL;
-	complete_and_exit(&ts->init_exit, 0);
+	return 0;
 }
 
 /*
@@ -262,8 +257,7 @@ static int ucb1x00_ts_open(struct input_
 	int ret = 0;
 	struct task_struct *task;
 
-	if (ts->rtask)
-		panic("ucb1x00: rtask running?");
+	BUG_ON(ts->rtask);
 
 	sema_init(&ts->irq_wait, 0);
 	ret = ucb1x00_hook_irq(ts->ucb, UCB_IRQ_TSPX, ucb1x00_ts_irq, ts);
@@ -279,10 +273,8 @@ static int ucb1x00_ts_open(struct input_
 	ts->y_res = ucb1x00_ts_read_yres(ts);
 	ucb1x00_adc_disable(ts->ucb);
 
-	init_completion(&ts->init_exit);
 	task = kthread_run(ucb1x00_thread, ts, "ktsd");
 	if (!IS_ERR(task)) {
-		wait_for_completion(&ts->init_exit);
 		ret = 0;
 	} else {
 		ucb1x00_free_irq(ts->ucb, UCB_IRQ_TSPX, ts);
@@ -300,10 +292,8 @@ static void ucb1x00_ts_close(struct inpu
 {
 	struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev;
 
-	if (ts->rtask) {
-		send_sig(SIGKILL, ts->rtask, 1);
-		wait_for_completion(&ts->init_exit);
-	}
+	if (ts->rtask)
+		kthread_stop(ts->rtask);
 
 	ucb1x00_enable(ts->ucb);
 	ucb1x00_free_irq(ts->ucb, UCB_IRQ_TSPX, ts);
Signature · 1 line
teflon -- maybe it is a trademark, but it should not be.