Support for touchscreen on sharp zaurus sl-5500
Subsystems (2)
RFC PATCH 1/1 Support for touchscreen on sharp zaurus sl-5500
Hi!
This adds support for touchscreen of sharp zaurus sl-5500. I got the patches from John Lenz <[email protected]>, but lots of copyrights are Russell King. To do so, it needs to add quite a bit of infrastructure. If there's better place for some code, please let me know (I already moved touchscreen parts to drivers/input).
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 && INPUT + 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 +437 -0
437 lines not on this page · raw message
drivers/misc/Kconfig +17 -0
@@ -30,3 +30,20 @@ config IBM_ASM endmenu +menu "Multimedia Capabilities Port drivers" + +config MCP + tristate + +# Interface drivers +config MCP_SA1100 + tristate "Support SA1100 MCP interface" + depends on ARCH_SA1100 + select MCP + +# Chip drivers +config MCP_UCB1200 + tristate "Support for UCB1200 / UCB1300" + depends on MCP + +endmenu
drivers/misc/Makefile +8 -0
@@ -5,3 +5,11 @@ obj- := misc.o # Dummy rule to force bui obj-$(CONFIG_IBM_ASM) += ibmasm/ obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/ + +obj-$(CONFIG_MCP) += mcp-core.o +obj-$(CONFIG_MCP_UCB1200) += ucb1x00-core.o + +obj-$(CONFIG_MCP_SA1100) += mcp-sa1100.o + +ucb1400-core-y := ucb1x00-core.o mcp-ac97.o +obj-$(CONFIG_UCB1400_TS) += ucb1400-core.o ucb1x00-ts.o
drivers/misc/mcp-core.c new file +257 -0
257 lines not on this page · raw message
drivers/misc/mcp-sa1100.c new file +287 -0
287 lines not on this page · raw message
drivers/misc/ucb1x00-core.c new file +638 -0
638 lines not on this page · raw message
include/asm-arm/arch-sa1100/mcp.h new file +65 -0
65 lines not on this page · raw message
include/asm-arm/arch-sa1100/ucb1x00.h new file +270 -0
270 lines not on this page · raw message
Signature · 1 line
teflon -- maybe it is a trademark, but it should not be.
Hi,
drivers/input/touchscreen/Kconfig config TOUCHSCREEN_CORGI · line 41
Quoted 4 lines · Pavel Machek
drivers/input/touchscreen/Kconfig +3
-0+config TOUCHSCREEN_COLLIE + tristate "Collie touchscreen (for Sharp SL-5500)" + depends on MCP_UCB1200 && INPUT
I don't think you need && INPUT here.
Quoted 4 lines
obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o
obj-$(CONFIG_TOUCHSCREEN_CORGI) += corgi_ts.o
+obj-$(CONFIG_TOUCHSCREEN_COLLIE)+= collie_ts.o
A tab would be nice.
Quoted 9 lines
drivers/input/touchscreen/collie_ts.c new file +9
-0+ +/* +* This is a RT kernel thread that handles the ADC accesses +* (mainly so we can use semaphores in the UCB1200 core code +* to serialise accesses to the ADC). The UCB1400 access +* functions are expected to be able to sleep as well. +*/ +static int ucb1x00_thread (void *_ts) +{
drivers/input/touchscreen/collie_ts.c line 184
Quoted 10 lines
drivers/input/touchscreen/collie_ts.c new file +10
-0+struct ucb1x00_ts *ts = _ts; +struct task_struct *tsk = current; +int valid; + + ts->rtask = tsk; + +daemonize ("ktsd" ); +/* only want to receive SIGKILL */ +allow_signal (SIGKILL ); +
This should be converted to kthread interface.
drivers/input/touchscreen/collie_ts.c line 289
Quoted 11 lines
drivers/input/touchscreen/collie_ts.c new file +11
-0+static int ucb1x00_ts_open (struct input_dev *idev) +{ +struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev; +int ret =0 ; + +if (down_interruptible (&ts->sem)) +return -EINTR ; + +if (ts->use_count++ !=0 ) + goto out; +
Please kill both ts->sem and ts->use_count - input core already serializes input_open and input_close.
Quoted 15 lines
drivers/input/touchscreen/collie_ts.c new file +15
-0+if (ts->rtask) +panic ("ucb1x00: rtask running?" ); + +sema_init (&ts->irq_wait,0 ); + ret =ucb1x00_hook_irq (ts->ucb,UCB_IRQ_TSPX , ucb1x00_ts_irq, ts); +if (ret <0 ) + goto out; + +/* +* If we do this at all, we should allow the user to +* measure and read the X and Y resistance at any time. +*/ +ucb1x00_adc_enable (ts->ucb); + ts->x_res =ucb1x00_ts_read_xres (ts); + ts->y_res =ucb1x00_ts_read_yres (ts);
drivers/input/touchscreen/collie_ts.c line 314
Quoted 10 lines
drivers/input/touchscreen/collie_ts.c new file +10
-0+ucb1x00_adc_disable (ts->ucb); + +init_completion (&ts->init_exit); + ret =kernel_thread (ucb1x00_thread, ts,CLONE_KERNEL ); +if (ret >=0 ) { +wait_for_completion (&ts->init_exit); + ret =0 ; + }else { +ucb1x00_free_irq (ts->ucb,UCB_IRQ_TSPX , ts); + }
kthread_run(ucb1x00_thread, ts, "ktsd")...
drivers/input/touchscreen/collie_ts.c line 428
Quoted 3 lines
drivers/input/touchscreen/collie_ts.c new file +3
-0+ +MODULE_PARM (adcsync,"i" ); +MODULE_PARM_DESC (adcsync,"Enable use of ADCSYNC signal" );
Die, MODULE_PARM, die!
Signature · 1 line
Dmitry
Hi!
Quoted 5 lines
drivers/input/touchscreen/Kconfig config TOUCHSCREEN_CORGI · line 41
Quoted 3 lines
drivers/input/touchscreen/Kconfig +3
-0+config TOUCHSCREEN_COLLIE + tristate "Collie touchscreen (for Sharp SL-5500)" + depends on MCP_UCB1200 && INPUTI don't think you need && INPUT here.
Fixed.
Quoted 5 lines
Quoted 3 lines
obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o
obj-$(CONFIG_TOUCHSCREEN_CORGI) += corgi_ts.o
+obj-$(CONFIG_TOUCHSCREEN_COLLIE)+= collie_ts.oA tab would be nice.
Actually, that would break lining-up. But you have to look at resulting file, not a patch.
Quoted 6 lines
Quoted 6 lines
drivers/input/touchscreen/collie_ts.c new file +6
-0+static int ucb1x00_ts_open (struct input_dev *idev) +{ +struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev; +int ret =0 ; + +if (down_interruptible (&ts->sem))
Quoted 8 lines
drivers/input/touchscreen/collie_ts.c line 289
Quoted 5 lines
drivers/input/touchscreen/collie_ts.c new file +5
-0+return -EINTR ; + +if (ts->use_count++ !=0 ) + goto out; +Please kill both
ts->semandts->use_count- input core already serializesinput_openandinput_close.
Done. Still have to do the kthread conversion.
Quoted 5 lines
drivers/input/touchscreen/collie_ts.c line 428
Quoted 3 lines
drivers/input/touchscreen/collie_ts.c new file +3
-0+ +MODULE_PARM (adcsync,"i" ); +MODULE_PARM_DESC (adcsync,"Enable use of ADCSYNC signal" );Die,
MODULE_PARM, die!
Dead :-).
Pavel
Signature · 1 line
Boycott Kodak -- for their patent abuse against Java.
Quoted 7 lines · Pavel Machek
Hi!
This adds support for touchscreen of sharp zaurus sl-5500. I got the patches from John Lenz <[email protected]>, but lots of copyrights are Russell King. To do so, it needs to add quite a bit of infrastructure. If there's better place for some code, please let me know (I already moved touchscreen parts to
drivers/input).
<snip>
Quoted 5 lines
drivers/input/touchscreen/collie_ts.c new file +0
-0
<snip>
Quoted 34 lines
drivers/input/touchscreen/collie_ts.c new file +34
-0+static int ucb1x00_thread (void *_ts) +{ +struct ucb1x00_ts *ts = _ts; +struct task_struct *tsk = current; +int valid; + + ts->rtask = tsk; + +daemonize ("ktsd" ); +/* only want to receive SIGKILL */ +allow_signal (SIGKILL ); + +/* +* 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); + + valid =0 ; + +for (;;) { +unsigned int x, y, p, val; + + ts->restart =0 ; + +ucb1x00_adc_enable (ts->ucb); + + x =ucb1x00_ts_read_xpos (ts); + y =ucb1x00_ts_read_ypos (ts); + p =ucb1x00_ts_read_pressure (ts); +
drivers/input/touchscreen/collie_ts.c line 216
Quoted 10 lines
drivers/input/touchscreen/collie_ts.c new file +10
-0+/* +* Switch back to interrupt mode. +*/ +ucb1x00_ts_mode_int (ts); +ucb1x00_adc_disable (ts->ucb); + +set_task_state (tsk,TASK_UNINTERRUPTIBLE ); +schedule_timeout (HZ /100 ); +if (signal_pending (tsk)) +break ;
You specifically allow SIGKILL, but then sleep uninterruptibly? And then you check if signal_pending() :) I think you may want TASK_INTERRUPTIBLE? Or, go one better and use msleep_interruptible(), as I don't see any wait-queues in the immediate area of this code...
<snip>
drivers/input/touchscreen/collie_ts.c line 261
Quoted 6 lines
drivers/input/touchscreen/collie_ts.c new file +6
-0+set_task_state (tsk,TASK_INTERRUPTIBLE ); +schedule_timeout (HZ /100 ); + } + +if (signal_pending (tsk)) +break ;
Then you use INTERRUPTIBLE and check signal_pending() again, so I'm pretty sure you wanted INTERRUPTIBLE above...But this sleep can be msleep_interruptible(), as well?
<snip>
Quoted 4 lines
drivers/misc/ucb1x00-core.c new file +0
-0
<snip>
Quoted 9 lines
+/**
+ * ucb1x00_adc_read - read the specified ADC channel + * @ucb: UCB1x00 structure describing chip + * @adc_channel: ADC channel mask + * @sync: wait for syncronisation pulse. + * + * Start an ADC conversion and wait for the result. Note that + * synchronised ADC conversions (via the ADCSYNC pin) must wait + * until the trigger is asserted and the conversion is finished.
Quoted 3 lines
+ *
+ * This function currently spins waiting for the conversion to
+ * complete (2 frames max without sync).
You technically sleep (schedule_timeout()), not spin...
Quoted 12 lines
+ *
+ * If called for a synchronised ADC conversion, it may sleep
+ * with the ADC semaphore held.
+ */drivers/misc/ucb1x00-core.c new file +8
-0+unsigned int ucb1x00_adc_read (struct ucb1x00 *ucb,int adc_channel,int sync) +{ +unsigned int val; + +if (sync) + adc_channel |=UCB_ADC_SYNC_ENA ; + +ucb1x00_reg_write (ucb,UCB_ADC_CR , ucb->adc_cr | adc_channel);
drivers/misc/ucb1x00-core.c line 175
Quoted 10 lines
drivers/misc/ucb1x00-core.c new file +10
-0+ucb1x00_reg_write (ucb,UCB_ADC_CR , ucb->adc_cr | adc_channel |UCB_ADC_START ); + +for (;;) { + val =ucb1x00_reg_read (ucb,UCB_ADC_DATA ); +if (val &UCB_ADC_DAT_VAL ) +break ; +/* yield to other processes */ +set_current_state (TASK_INTERRUPTIBLE ); +schedule_timeout (1 ); + }
If I ever add a poll_event() interface to the kernel, this would be a good user. You don't check if signal_pending(), though, even though you are in INTERRUPTIBLE state... Maybe this case can use UNINTERRUPTIBLE?
Thanks,
Nish
Hi!
Quoted 9 lines
drivers/input/touchscreen/collie_ts.c line 216
Quoted 4 lines
drivers/input/touchscreen/collie_ts.c new file +4
-0+set_task_state (tsk,TASK_UNINTERRUPTIBLE ); +schedule_timeout (HZ /100 ); +if (signal_pending (tsk)) +break ;You specifically allow SIGKILL, but then sleep uninterruptibly? And then you check if
signal_pending():) I think you may wantTASK_INTERRUPTIBLE? Or, go one better and usemsleep_interruptible(), as I don't see any wait-queues in the immediate area of this code...
Okay, I think this should be uninterruptible. The signal can be delivered during next interruptible sleep. Fixes.
Quoted 13 lines
Quoted 9 lines
+/**
+ * ucb1x00_adc_read - read the specified ADC channel + * @ucb: UCB1x00 structure describing chip + * @adc_channel: ADC channel mask + * @sync: wait for syncronisation pulse. + * + * Start an ADC conversion and wait for the result. Note that + * synchronised ADC conversions (via the ADCSYNC pin) must wait + * until the trigger is asserted and the conversion is finished.Quoted 3 lines
+ *
+ * This function currently spins waiting for the conversion to
+ * complete (2 frames max without sync).
Quoted 1 line
You technically sleep (
schedule_timeout()), not spin...
Well, it also spins :-).
Quoted 9 lines
drivers/misc/ucb1x00-core.c line 175
Quoted 8 lines
drivers/misc/ucb1x00-core.c new file +8
-0+for (;;) { + val =ucb1x00_reg_read (ucb,UCB_ADC_DATA ); +if (val &UCB_ADC_DAT_VAL ) +break ; +/* yield to other processes */ +set_current_state (TASK_INTERRUPTIBLE ); +schedule_timeout (1 ); + }
Quoted 4 lines
If I ever add a
poll_event()interface to the kernel, this would be a good user. You don't check ifsignal_pending(), though, even though you are in INTERRUPTIBLE state... Maybe this case can use UNINTERRUPTIBLE?
Ok, UNINTERRUPTIBLE here...
Pavel
Signature · 1 line
Boycott Kodak -- for their patent abuse against Java.
Quoted 7 lines · Pavel Machek
Hi!
Quoted 5 lines
Quoted 4 lines
drivers/input/touchscreen/collie_ts.c new file +4
-0+set_task_state (tsk,TASK_UNINTERRUPTIBLE ); +schedule_timeout (HZ /100 ); +if (signal_pending (tsk)) +break ;
Quoted 7 lines
Quoted 4 lines
You specifically allow SIGKILL, but then sleep uninterruptibly? And then you check if
signal_pending():) I think you may wantTASK_INTERRUPTIBLE? Or, go one better and usemsleep_interruptible(), as I don't see any wait-queues in the immediate area of this code...Okay, I think this should be uninterruptible. The signal can be delivered during next interruptible sleep. Fixes.
Good point. But the signal_pending() check after that interruptible sleep (which deterministically comes after this one) takes care of the break, doesn't it? I guess you can (maybe already have done so...) get rid of the signal_pending() check after the uninterruptible sleep. And then go ahead and make this an msleep(10) call and the other one (in the same function) an msleep_interruptible() call ;)
Thanks,
Nish