Skip to contentSkip to conversation

ucb1x00: touchscreen cleanups

PATCH In review Pavel Machek 4 participants 14 messages Jul 26, 2005 – Aug 1, 2005 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ucb1x00: touchscreen cleanups

These are small ucb1x00-ts cleanups, as suggested by Vojtech, Dmitri and the lists.

Cleanups suggested by Dmitri, Vojtech and lists.

---
commit 79c98a2279c45098d102ba69ecf940c00da3dfee tree f15a3d27de9a84694f4588374a5e383938866a54 parent 080578bff89927c0f5aeddd588bc2f5f7373f232 author <pavel@amd.(none)> Tue, 26 Jul 2005 09:44:33 +0200 committer <pavel@amd.(none)> Tue, 26 Jul 2005 09:44:33 +0200

 drivers/misc/ucb1x00-ts.c |   87 ++++++++++++---------------------------------
 1 files changed, 23 insertions(+), 64 deletions(-)
drivers/misc/ucb1x00-ts.c +23 -64
@@ -1,7 +1,8 @@
 /*
- *  linux/drivers/misc/ucb1x00-ts.c
+ *  Touchscreen driver for UCB1x00-based touchscreens
  *
  *  Copyright (C) 2001 Russell King, All Rights Reserved.
+ *  Copyright (C) 2005 Pavel Machek
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -30,6 +31,7 @@
 #include <linux/device.h>
 #include <linux/suspend.h>
 #include <linux/slab.h>
+#include <linux/kthread.h>
 
 #include <asm/dma.h>
 #include <asm/semaphore.h>
@@ -42,10 +44,7 @@ struct ucb1x00_ts {
 	struct ucb1x00		*ucb;
 
 	wait_queue_head_t	irq_wait;
-	struct semaphore	sem;
-	struct completion	init_exit;
 	struct task_struct	*rtask;
-	int			use_count;
 	u16			x_res;
 	u16			y_res;
 
@@ -55,20 +54,6 @@ struct ucb1x00_ts {
 
 static int adcsync;
 
-static inline void ucb1x00_ts_evt_add(struct ucb1x00_ts *ts, u16 pressure, u16 x, u16 y)
-{
-	input_report_abs(&ts->idev, ABS_X, x);
-	input_report_abs(&ts->idev, ABS_Y, y);
-	input_report_abs(&ts->idev, ABS_PRESSURE, pressure);
-	input_sync(&ts->idev);
-}
-
-static inline void ucb1x00_ts_event_release(struct ucb1x00_ts *ts)
-{
-	input_report_abs(&ts->idev, ABS_PRESSURE, 0);
-	input_sync(&ts->idev);
-}
-
 /*
  * Switch to interrupt mode.
  */
@@ -176,12 +161,6 @@ static int ucb1x00_thread(void *_ts)
 	DECLARE_WAITQUEUE(wait, tsk);
 	int valid;
 
-	ts->rtask = tsk;
-
-	daemonize("ktsd");
-	/* only want to receive SIGKILL */
-	allow_signal(SIGKILL);
-
 	/*
 	 * We could run as a real-time thread.  However, thus far
 	 * this doesn't seem to be necessary.
@@ -189,12 +168,10 @@ static int ucb1x00_thread(void *_ts)
 //	tsk->policy = SCHED_FIFO;
 //	tsk->rt_priority = 1;
 
-	complete(&ts->init_exit);
-
 	valid = 0;
 
 	add_wait_queue(&ts->irq_wait, &wait);
-	for (;;) {
+	while (!kthread_should_stop()) {
 		unsigned int x, y, p, val;
 		signed long timeout;
 
@@ -212,10 +189,7 @@ static int ucb1x00_thread(void *_ts)
 		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;
+		msleep(10);
 
 		ucb1x00_enable(ts->ucb);
 		val = ucb1x00_reg_read(ts->ucb, UCB_TS_CR);
@@ -231,7 +205,8 @@ static int ucb1x00_thread(void *_ts)
 			 * spit out a "pen off" sample here.
 			 */
 			if (valid) {
-				ucb1x00_ts_event_release(ts);
+				input_report_abs(&ts->idev, ABS_PRESSURE, 0);
+				input_sync(&ts->idev);
 				valid = 0;
 			}
 
@@ -245,7 +220,10 @@ static int ucb1x00_thread(void *_ts)
 			 * to do any filtering they please.
 			 */
 			if (!ts->restart) {
-				ucb1x00_ts_evt_add(ts, p, x, y);
+				input_report_abs(&ts->idev, ABS_X, x);
+				input_report_abs(&ts->idev, ABS_Y, y);
+				input_report_abs(&ts->idev, ABS_PRESSURE, p);
+				input_sync(&ts->idev);
 				valid = 1;
 			}
 
@@ -256,14 +234,12 @@ static int ucb1x00_thread(void *_ts)
 		try_to_freeze();
 
 		schedule_timeout(timeout);
-		if (signal_pending(tsk))
-			break;
 	}
 
 	remove_wait_queue(&ts->irq_wait, &wait);
 
 	ts->rtask = NULL;
-	complete_and_exit(&ts->init_exit, 0);
+	return 0;
 }
 
 /*
@@ -282,14 +258,7 @@ static int ucb1x00_ts_open(struct input_
 	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;
-
-	if (ts->rtask)
-		panic("ucb1x00: rtask running?");
+	BUG_ON(ts->rtask);
 
 	init_waitqueue_head(&ts->irq_wait);
 	ret = ucb1x00_hook_irq(ts->ucb, UCB_IRQ_TSPX, ucb1x00_ts_irq, ts);
@@ -305,19 +274,16 @@ 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);
-	ret = kernel_thread(ucb1x00_thread, ts, CLONE_KERNEL);
-	if (ret >= 0) {
-		wait_for_completion(&ts->init_exit);
+	ts->rtask = kthread_run(ucb1x00_thread, ts, "ktsd");
+	if (!IS_ERR(ts->rtask)) {
 		ret = 0;
 	} else {
 		ucb1x00_free_irq(ts->ucb, UCB_IRQ_TSPX, ts);
+		ts->rtask = NULL;
+		ret = -EFAULT;
 	}
 
  out:
-	if (ret)
-		ts->use_count--;
-	up(&ts->sem);
 	return ret;
 }
 
@@ -328,19 +294,13 @@ static void ucb1x00_ts_close(struct inpu
 {
 	struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev;
 
-	down(&ts->sem);
-	if (--ts->use_count == 0) {
-		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);
-		ucb1x00_reg_write(ts->ucb, UCB_TS_CR, 0);
-		ucb1x00_disable(ts->ucb);
-	}
-	up(&ts->sem);
+	ucb1x00_enable(ts->ucb);
+	ucb1x00_free_irq(ts->ucb, UCB_IRQ_TSPX, ts);
+	ucb1x00_reg_write(ts->ucb, UCB_TS_CR, 0);
+	ucb1x00_disable(ts->ucb);
 }
 
 #ifdef CONFIG_PM
@@ -379,7 +339,6 @@ static int ucb1x00_ts_add(struct ucb1x00
 
 	ts->ucb = dev->ucb;
 	ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC;
-	init_MUTEX(&ts->sem);
 
 	ts->idev.name       = "Touchscreen panel";
 	ts->idev.id.product = ts->ucb->id;
Signature · 1 line
teflon -- maybe it is a trademark, but it should not be.
#1 lore raw

Hi Pavel,

I am in the process of porting Linux 2.6.11.5 to the Helio PDA (MIPS R3912 based) and if I remember correctly it is using a UCB1x00 (or Toshiba clone). Please could you make sure your patches will work across arch. Now I have my kernel up and running (well mainly falling :-() my next task is to get write the frame buffer driver and then look at the UCB1x00 as I need it for sound and touch screen. So in a day or two I will start to try to integrate your work into my kernel.

Best Regards,

Mark

Quoted 197 lines · --- Pavel Machek

These are small ucb1x00-ts cleanups, as suggested by Vojtech, Dmitri
and the lists.

Cleanups suggested by Dmitri, Vojtech and lists.

---
commit 79c98a2279c45098d102ba69ecf940c00da3dfee tree f15a3d27de9a84694f4588374a5e383938866a54 parent 080578bff89927c0f5aeddd588bc2f5f7373f232 author <pavel@amd.(none)> Tue, 26 Jul 2005 09:44:33 +0200
committer <pavel@amd.(none)> Tue, 26 Jul 2005 09:44:33 +0200

 drivers/misc/ucb1x00-ts.c |   87
++++++++++++---------------------------------
 1 files changed, 23 insertions(+), 64 deletions(-)
drivers/misc/ucb1x00-ts.c +1 -1
@@ -1,7 +1,8 @@
 /*
- *  linux/drivers/misc/ucb1x00-ts.c
+ *  Touchscreen driver for UCB1x00-based

touchscreens
*
* Copyright (C) 2001 Russell King, All Rights
Reserved.
+ * Copyright (C) 2005 Pavel Machek
*
* This program is free software; you can
redistribute it and/or modify
* it under the terms of the GNU General Public
License version 2 as

drivers/misc/ucb1x00-ts.c +1 -17
@@ -30,6 +31,7 @@
 #include <linux/device.h>
 #include <linux/suspend.h>
 #include <linux/slab.h>
+#include <linux/kthread.h>
 
 #include <asm/dma.h>
 #include <asm/semaphore.h>
@@ -42,10 +44,7 @@ struct ucb1x00_ts {
 	struct ucb1x00		*ucb;
 
 	wait_queue_head_t	irq_wait;
-	struct semaphore	sem;
-	struct completion	init_exit;
 	struct task_struct	*rtask;
-	int			use_count;
 	u16			x_res;
 	u16			y_res;
 
@@ -55,20 +54,6 @@ struct ucb1x00_ts {
 
 static int adcsync;
 
-static inline void ucb1x00_ts_evt_add(struct
 ucb1x00_ts *ts, u16 pressure, u16 x, u16 y)
-{
-	input_report_abs(&ts->idev, ABS_X, x);
-	input_report_abs(&ts->idev, ABS_Y, y);
-	input_report_abs(&ts->idev, ABS_PRESSURE,
 pressure);
-	input_sync(&ts->idev);
-}
-
-static inline void ucb1x00_ts_event_release(struct
 ucb1x00_ts *ts)
-{
-	input_report_abs(&ts->idev, ABS_PRESSURE, 0);
-	input_sync(&ts->idev);
-}
-

/*
* Switch to interrupt mode.
*/

drivers/misc/ucb1x00-ts.c +0 -6
@@ -176,12 +161,6 @@ static int ucb1x00_thread(void
 *_ts)
 	DECLARE_WAITQUEUE(wait, tsk);
 	int valid;
 
-	ts->rtask = tsk;
-
-	daemonize("ktsd");
-	/* only want to receive SIGKILL */
-	allow_signal(SIGKILL);
-
 	/*
 	 * We could run as a real-time thread.  However,

thus far

drivers/misc/ucb1x00-ts.c +2 -7
 	 * this doesn't seem to be necessary.
@@ -189,12 +168,10 @@ static int ucb1x00_thread(void
 *_ts)
 //	tsk->policy = SCHED_FIFO;
 //	tsk->rt_priority = 1;
 
-	complete(&ts->init_exit);
-
 	valid = 0;
 
 	add_wait_queue(&ts->irq_wait, &wait);
-	for (;;) {
+	while (!kthread_should_stop()) {
 		unsigned int x, y, p, val;
 		signed long timeout;
@@ -212,10 +189,7 @@ static int ucb1x00_thread(void
 *_ts)
 		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;
+		msleep(10);
 
 		ucb1x00_enable(ts->ucb);
drivers/misc/ucb1x00-ts.c +7 -5
 		val = ucb1x00_reg_read(ts->ucb, UCB_TS_CR);
@@ -231,7 +205,8 @@ static int ucb1x00_thread(void
 *_ts)
 			 * spit out a "pen off" sample here.
 			 */
 			if (valid) {
-				ucb1x00_ts_event_release(ts);
+				input_report_abs(&ts->idev, ABS_PRESSURE, 0);
+				input_sync(&ts->idev);
 				valid = 0;
 			}
@@ -245,7 +220,10 @@ static int ucb1x00_thread(void
 *_ts)
 			 * to do any filtering they please.
 			 */
 			if (!ts->restart) {
-				ucb1x00_ts_evt_add(ts, p, x, y);
+				input_report_abs(&ts->idev, ABS_X, x);
+				input_report_abs(&ts->idev, ABS_Y, y);
+				input_report_abs(&ts->idev, ABS_PRESSURE, p);
+				input_sync(&ts->idev);
 				valid = 1;
 			}
@@ -256,14 +234,12 @@ static int ucb1x00_thread(void
 *_ts)
 		try_to_freeze();
 
 		schedule_timeout(timeout);
-		if (signal_pending(tsk))
-			break;
 	}
 
 	remove_wait_queue(&ts->irq_wait, &wait);
 
 	ts->rtask = NULL;
-	complete_and_exit(&ts->init_exit, 0);
+	return 0;
 }
 

/*

drivers/misc/ucb1x00-ts.c +0 -0
@@ -282,14 +258,7 @@ static int

ucb1x00_ts_open(struct input_

drivers/misc/ucb1x00-ts.c +1 -8
 	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;
-
-	if (ts->rtask)
-		panic("ucb1x00: rtask running?");
+	BUG_ON(ts->rtask);
 
 	init_waitqueue_head(&ts->irq_wait);
 	ret = ucb1x00_hook_irq(ts->ucb, UCB_IRQ_TSPX,

ucb1x00_ts_irq, ts);

drivers/misc/ucb1x00-ts.c +0 -0
@@ -305,19 +274,16 @@ static int

ucb1x00_ts_open(struct input_

drivers/misc/ucb1x00-ts.c +0 -2
 	ts->y_res = ucb1x00_ts_read_yres(ts);
 	ucb1x00_adc_disable(ts->ucb);
 
-	init_completion(&ts->init_exit);
-	ret = kernel_thread(ucb1x00_thread, ts,

CLONE_KERNEL);

drivers/misc/ucb1x00-ts.c +1 -2
-	if (ret >= 0) {
-		wait_for_completion(&ts->init_exit);
+	ts->rtask = kthread_run(ucb1x00_thread, ts,

"ktsd");

drivers/misc/ucb1x00-ts.c static int ucb1x00_ts_open(struct input_ · line 282

Quoted 5 lines
drivers/misc/ucb1x00-ts.c +2 -0
+	if (!IS_ERR(ts->rtask)) {
 		ret = 0;
 	} else {
 		ucb1x00_free_irq(ts->ucb, UCB_IRQ_TSPX, ts);
+		ts->rtask = NULL;

=== message truncated ===

___________________________________________________________
How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com

#2 lore raw

Hi!

Quoted 10 lines

I am in the process of porting Linux 2.6.11.5 to the Helio PDA (MIPS R3912 based) and if I remember correctly it is using a UCB1x00 (or Toshiba clone). Please could you make sure your patches will work across arch. Now I have my kernel up and running (well mainly falling :-() my next task is to get write the frame buffer driver and then look at the UCB1x00 as I need it for sound and touch screen. So in a day or two I will start to try to integrate your work into my kernel.

Well, without MIPS PDA to test on.... No, I do not think I broke anything... but you'll have to ensure testing yourself.
Pavel

Signature · 1 line
teflon -- maybe it is a trademark, but it should not be.
#3 lore raw
In reply to Mark Underwood
Quoted 5 lines · Mark Underwood

I am in the process of porting Linux 2.6.11.5 to the Helio PDA (MIPS R3912 based) and if I remember correctly it is using a UCB1x00 (or Toshiba clone). Please could you make sure your patches will work across arch.

Which UCB1x00 version? There's about three of them - 1200, 1300 and 1400. The 1200 and 1300 are non-AC'97 devices, which are targetted by this driver.

Quoted 6 lines

Now I have my kernel up and running (well mainly falling :-() my next task is to get write the frame buffer driver and then look at the UCB1x00 as I need it for sound and touch screen. So in a day or two I will start to try to integrate your work into my kernel.

Note that I'm maintaining the code and will be publishing a new set of patches for it based upon Pavel's fixes.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#4 lore raw
Quoted 7 lines · --- Russell King
Quoted 1 line · Mark Underwood

I am in the process of porting Linux 2.6.11.5 to

the

Quoted 2 lines

Helio PDA (MIPS R3912 based) and if I remember
correctly it is using a UCB1x00 (or Toshiba

clone).

Quoted 8 lines
Quoted 2 lines

Please could you make sure your patches will work
across arch.

Which UCB1x00 version? There's about three of them
- 1200, 1300 and
1400. The 1200 and 1300 are non-AC'97 devices, which are targetted
by this driver.

It is the UCB1200 (also known as the Toshiba TC35143F or Betty).

Quoted 6 lines
Quoted 3 lines

Now I have my kernel up and running (well
mainly falling :-() my next task is to get write

the

Quoted 1 line

frame buffer driver and then look at the UCB1x00

as I

Quoted 8 lines
Quoted 1 line

need it for sound and touch screen. So in a day or

two

Quoted 2 lines

I will start to try to integrate your work into my kernel.

Note that I'm maintaining the code and will be
publishing a new set
of patches for it based upon Pavel's fixes.

Thanks. I'll check them out then.

Quoted 7 lines
Signature · 5 lines
-- 
Russell King
 Linux kernel    2.6 ARM Linux   -
http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com

#5 lore raw
Quoted 7 lines · Mark Underwood
Quoted 7 lines
Quoted 2 lines

Now I have my kernel up and running (well
mainly falling :-() my next task is to get write

the

Quoted 1 line

frame buffer driver and then look at the UCB1x00

as I

Quoted 1 line

need it for sound and touch screen. So in a day or

two

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

I will start to try to integrate your work into my kernel.

Note that I'm maintaining the code and will be
publishing a new set
of patches for it based upon Pavel's fixes.

Thanks. I'll check them out then.

Since there appears to be some interest in these, I'll set about converting the audio bits to ALSA rather than Nico's SA11x0 audio driver. I thought no one was using these chips anymore, and the driver was dead!

I've recently edited the mcp structure which may make things less awkward for others, and I'll continue moving in that direction with this driver.

You can get the updated patches at:

http://zeniv.linux.org.uk/pub/people/rmk/ucb/

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#6 lore raw

Hi!

Quoted 11 lines
Quoted 5 lines
Quoted 3 lines

Note that I'm maintaining the code and will be
publishing a new set
of patches for it based upon Pavel's fixes.

Thanks. I'll check them out then.

Since there appears to be some interest in these, I'll set about converting the audio bits to ALSA rather than Nico's SA11x0 audio driver. I thought no one was using these chips anymore, and the driver was dead!

Quoted 7 lines

I've recently edited the mcp structure which may make things less awkward for others, and I'll continue moving in that direction with this driver.

You can get the updated patches at:

http://zeniv.linux.org.uk/pub/people/rmk/ucb/

Okay, what's the plan with mainstreaming those? Do they stay in drivers/misc?
Pavel

Signature · 1 line
if you have sharp zaurus hardware you don't need... you know my address
#7 lore raw
Quoted 17 lines · Pavel Machek

Hi!

Quoted 15 lines
Quoted 5 lines
Quoted 3 lines

Note that I'm maintaining the code and will be
publishing a new set
of patches for it based upon Pavel's fixes.

Thanks. I'll check them out then.

Since there appears to be some interest in these, I'll set about converting the audio bits to ALSA rather than Nico's SA11x0 audio driver. I thought no one was using these chips anymore, and the driver was dead!

I've recently edited the mcp structure which may make things less awkward for others, and I'll continue moving in that direction with this driver.

Quoted 6 lines
Quoted 3 lines

You can get the updated patches at:

http://zeniv.linux.org.uk/pub/people/rmk/ucb/

Okay, what's the plan with mainstreaming those? Do they stay in drivers/misc?

Let me put the second question a slightly different way: can anyone think of a better way to organise the files which makes more sense and doesn't end up with just a couple of files for the core UCB and MCP support in some random directory elsewhere?

Arjan? hch? any comments / good ideas?

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#8 lore raw
Quoted 41 lines · --- Russell King
Quoted 3 lines · Pavel Machek

Hi!

Quoted 1 line
Quoted 1 line
Quoted 1 line

Note that I'm maintaining the code and will

be

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

publishing a new set
of patches for it based upon Pavel's fixes.

Thanks. I'll check them out then.

Since there appears to be some interest in

these, I'll set about

Quoted 1 line
Quoted 1 line

converting the audio bits to ALSA rather than

Nico's SA11x0 audio

Quoted 1 line
Quoted 1 line

driver. I thought no one was using these chips

anymore, and the

Quoted 3 lines
Quoted 3 lines

driver was dead!

I've recently edited the mcp structure which may

make things less

Quoted 1 line
Quoted 1 line

awkward for others, and I'll continue moving in

that direction

Quoted 7 lines
Quoted 5 lines

with this driver.

You can get the updated patches at:

http://zeniv.linux.org.uk/pub/people/rmk/ucb/

Okay, what's the plan with mainstreaming those? Do

they stay in

Quoted 1 line

drivers/misc?

Let me put the second question a slightly different
way: can anyone
think of a better way to organise the files which makes more sense
and doesn't end up with just a couple of files for the core UCB
and MCP support in some random directory elsewhere?

Quoted 1 line

Arjan? hch? any comments / good ideas?

As this isn't the only chip of this sort (i.e. a multi-function chip not on the CPU bus) maybe we should store the bus driver in a common place. If needed we could have a very simple bus driver subsystem (this might already be in the kernel, I haven't looked at the bus stuff) in which you register a bus driver and client drivers register with the bus driver. Just an idea :-).

Mark

Quoted 14 lines
Signature · 12 lines
-- 
Russell King
 Linux kernel    2.6 ARM Linux   -
http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
-
To unsubscribe from this list: send the line
"unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at 
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

___________________________________________________________
How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com

#9 lore raw
Quoted 8 lines · Mark Underwood

As this isn't the only chip of this sort (i.e. a multi-function chip not on the CPU bus) maybe we should store the bus driver in a common place. If needed we could have a very simple bus driver subsystem (this might already be in the kernel, I haven't looked at the bus stuff) in which you register a bus driver and client drivers register with the bus driver. Just an idea :-).

This was the idea with the drivers/soc suggestion although I think that name is perhaps misleading.

How about drivers/mfd where mfd = Multi Functional Devices?

I think it would be acceptable (and in keeping with the other drivers e.g. pcmcia) to seeing the arch and platform specific modules with the main driver as long as the naming reflected it (like the existing mcp and ucb code does) i.e.:

mcp-core.c
mcp-sa1100.c
ucb1x00-code.c
ucb1x00-assabet.c
ucb1x00-collie.c

If code can be separated out into subsystems, I'm not so sure where they should go though. The existing policy would suggest drivers/input/touchscreen and sound/xxx for these...

ucb1x00-ts.c
ucb1x00-audio.c

Opinions/Comments?

Richard

#10 lore raw

Hi!

Quoted 25 lines
Quoted 8 lines

As this isn't the only chip of this sort (i.e. a multi-function chip not on the CPU bus) maybe we should store the bus driver in a common place. If needed we could have a very simple bus driver subsystem (this might already be in the kernel, I haven't looked at the bus stuff) in which you register a bus driver and client drivers register with the bus driver. Just an idea :-).

This was the idea with the drivers/soc suggestion although I think that name is perhaps misleading.

How about drivers/mfd where mfd = Multi Functional Devices?

I think it would be acceptable (and in keeping with the other drivers e.g. pcmcia) to seeing the arch and platform specific modules with the main driver as long as the naming reflected it (like the existing mcp and ucb code does) i.e.:

mcp-core.c
mcp-sa1100.c
ucb1x00-code.c
ucb1x00-assabet.c
ucb1x00-collie.c

Quoted 8 lines

If code can be separated out into subsystems, I'm not so sure where they should go though. The existing policy would suggest drivers/input/touchscreen and sound/xxx for these...

ucb1x00-ts.c
ucb1x00-audio.c

Opinions/Comments?

drivers/mfd sounds good, and yes, touchscreen and audio should go where they belong.
Pavel

Signature · 1 line
if you have sharp zaurus hardware you don't need... you know my address
#11 lore raw

How do we handle multi-function devices? [was Re: [patch] ucb1x00: touchscreen cleanups]

In reply to Richard Purdie
Quoted 11 lines · --- Richard Purdie
Quoted 6 lines · Mark Underwood

As this isn't the only chip of this sort (i.e. a multi-function chip not on the CPU bus) maybe we should store the bus driver in a common place. If needed we could have a very simple bus driver subsystem (this might already be in the kernel, I haven't looked at the bus stuff) in which you

register

Quoted 1 line

a bus driver and client drivers register with the

bus

Quoted 8 lines
Quoted 1 line

driver. Just an idea :-).

This was the idea with the drivers/soc suggestion
although I think that
name is perhaps misleading.

How about drivers/mfd where mfd = Multi Functional Devices?

I was thinking of something like driver/bus into which we might also be able to put the I2C and LL3 buses. The only problem is that this might leave some parts of the multi function chip homeless (if they can't find a home in other subsystems).

Quoted 9 lines

I think it would be acceptable (and in keeping with the other drivers
e.g. pcmcia) to seeing the arch and platform specific modules with the
main driver as long as the naming reflected it (like the existing mcp
and ucb code does) i.e.:

Quoted 5 lines

mcp-core.c
mcp-sa1100.c
ucb1x00-code.c
ucb1x00-assabet.c
ucb1x00-collie.c

Maybe, I haven't looked at pcmcia but the I2C subsystem manages to avoid any arch dependent stuff so couldn't we? I need to do more homework ;-), but surely we only need a bus driver (IP block specific, platform and arch independent), a core driver to register busses and clients, and client drivers.

Quoted 8 lines

If code can be separated out into subsystems, I'm not so sure where they
should go though. The existing policy would suggest drivers/input/touchscreen and sound/xxx for these...

ucb1x00-ts.c
ucb1x00-audio.c

Yes, any function of a multi function device that can live in a subsystem should do otherwise imagine the mess, for example, with a chip that has a USB master on it.

Mark

Quoted 6 lines

Opinions/Comments?

Richard

___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com

#12 lore raw
In reply to Pavel Machek
Quoted 8 lines · Pavel Machek
drivers/misc/ucb1x00-ts.c +0 -4
@@ -55,20 +54,6 @@ struct ucb1x00_ts {
 
 static int adcsync;
 
-static inline void ucb1x00_ts_evt_add(struct ucb1x00_ts *ts, u16 pressure, u16 x, u16 y)
-{
-	input_report_abs(&ts->idev, ABS_X, x);
-	input_report_abs(&ts->idev, ABS_Y, y);

drivers/misc/ucb1x00-ts.c struct ucb1x00_ts { · line 71

Quoted 10 lines
drivers/misc/ucb1x00-ts.c +0 -10
-	input_report_abs(&ts->idev, ABS_PRESSURE, pressure);
-	input_sync(&ts->idev);
-}
-
-static inline void ucb1x00_ts_event_release(struct ucb1x00_ts *ts)
-{
-	input_report_abs(&ts->idev, ABS_PRESSURE, 0);
-	input_sync(&ts->idev);
-}
-

Only one query: What's the reason for moving these? I think keeping them makes the code more readable.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#13 lore raw

Hi!

Quoted 13 lines
Quoted 13 lines
drivers/misc/ucb1x00-ts.c +0 -9
@@ -55,20 +54,6 @@ struct ucb1x00_ts {
 
 static int adcsync;
 
-static inline void ucb1x00_ts_evt_add(struct ucb1x00_ts *ts, u16 pressure, u16 x, u16 y)
-{
-	input_report_abs(&ts->idev, ABS_X, x);
-	input_report_abs(&ts->idev, ABS_Y, y);
-	input_report_abs(&ts->idev, ABS_PRESSURE, pressure);
-	input_sync(&ts->idev);
-}
-
-static inline void ucb1x00_ts_event_release(struct ucb1x00_ts *ts)
Quoted 8 lines

drivers/misc/ucb1x00-ts.c struct ucb1x00_ts { · line 71

Quoted 5 lines
drivers/misc/ucb1x00-ts.c +0 -5
-{
-	input_report_abs(&ts->idev, ABS_PRESSURE, 0);
-	input_sync(&ts->idev);
-}
-

Only one query: What's the reason for moving these? I think keeping them makes the code more readable.

Vojtech liked that better after moving, and it is few lines shorter, but I have no strong feelings about that.
Pavel

Signature · 1 line
teflon -- maybe it is a trademark, but it should not be.