colibri-pxa3xx: add touchscreen support
PATCH v2 5/5 colibri-pxa3xx: add touchscreen support
An embedded and charset-unspecified text was scrubbed...
Name: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100708/e131b414/attachment.ksh>
PATCH v2 5/5 colibri-pxa3xx: add touchscreen support
Dne ?t 8. ?ervence 2010 22:49:59 pieterg napsal(a):
Quoted 83 lines
Signed-off-by pieter <[email protected]>--- arch/arm/mach-pxa/colibri-pxa300.c | 2 + arch/arm/mach-pxa/colibri-pxa320.c | 1 + arch/arm/mach-pxa/colibri-pxa3xx.c | 31 ++++++++++++++++++++++++++++++ arch/arm/mach-pxa/include/mach/colibri.h | 6 +++++ 4 files changed, 40 insertions(+), 0 deletions(-)arch/arm/mach-pxa/colibri-pxa300.c +2
-0@@ -229,6 +229,8 @@ void __init colibri_pxa300_init(void) mfp_to_gpio(MFP_PIN_GPIO13));colibri_pxa300_init_uart ();colibri_pxa300_init_i2c (); +if (cpu_is_pxa310 ()) +colibri_pxa3xx_init_touchscreen (); }MACHINE_START (COLIBRI300 ,"Toradex Colibri PXA300" )arch/arm/mach-pxa/colibri-pxa320.c +1
-0@@ -229,6 +229,7 @@ void __init colibri_pxa320_init(void) mfp_to_gpio(MFP_PIN_GPIO28));colibri_pxa320_init_uart ();colibri_pxa320_init_i2c (); +colibri_pxa3xx_init_touchscreen (); }MACHINE_START (COLIBRI320 ,"Toradex Colibri PXA320" )arch/arm/mach-pxa/colibri-pxa3xx.c +31
-0@@ -198,3 +198,34 @@ void __init colibri_pxa3xx_init_nand(void) }#endif +#if defined(CONFIG_INPUT_TOUCHSCREEN ) + +#if defined(CONFIG_TOUCHSCREEN_WM97XX ) || \ + defined(CONFIG_TOUCHSCREEN_WM97XX_MODULE ) +static struct platform_device colibri_ts_wm97xx_device = { + .name ="wm97xx-ts" , + .id =-1 , +}; +#endif + +#if defined(CONFIG_TOUCHSCREEN_UCB1400 ) || \ + defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE ) +static struct platform_device colibri_ts_ucb1400_device = { + .name ="ucb1400_core" , + .id =-1 , +}; +#endif + +void __init colibri_pxa3xx_init_touchscreen (void ) +{ +#if defined(CONFIG_TOUCHSCREEN_WM97XX ) || \ + defined(CONFIG_TOUCHSCREEN_WM97XX_MODULE ) +platform_device_register (&colibri_ts_wm97xx_device); +#endif +#if defined(CONFIG_TOUCHSCREEN_UCB1400 ) || \ + defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE ) +platform_device_register (&colibri_ts_ucb1400_device); +#endif +} + +#endif arch/arm/mach-pxa/include/mach/colibri.h +0
-0@@ -30,6 +30,12 @@ extern void colibri_pxa3xx_init_nand(void);static inline void colibri_pxa3xx_init_nand (void ) {}
arch/arm/mach-pxa/include/mach/colibri.h extern void colibri_pxa3xx_init_nand(void); · line 40
Quoted 10 lines
arch/arm/mach-pxa/include/mach/colibri.h +6
-0#endif +#if defined(CONFIG_INPUT_TOUCHSCREEN ) +extern void colibri_pxa3xx_init_touchscreen (void ); +#else +static inline void colibri_pxa3xx_init_touchscreen (void ) {} +#endif +/* physical memory regions */ #define COLIBRI_SDRAM_BASE 0xa0000000/* SDRAM region */
What will happen if both of the TS devices are selected? You'd better figure out a way to enable that particular TSC chip based on hardware revision (the new colibri 320 v2.0 will have this information in the CPLD I believe).
PATCH v2 5/5 colibri-pxa3xx: add touchscreen support
Quoted 86 lines · On Friday 09 July 2010 01:03:14 Marek Vasut wrote:
Dne ?t 8. ?ervence 2010 22:49:59 pieterg napsal(a):
Quoted 85 lines
Signed-off-by pieter <[email protected]>--- arch/arm/mach-pxa/colibri-pxa300.c | 2 + arch/arm/mach-pxa/colibri-pxa320.c | 1 + arch/arm/mach-pxa/colibri-pxa3xx.c | 31 ++++++++++++++++++++++++++++++ arch/arm/mach-pxa/include/mach/colibri.h | 6 +++++ 4 files changed, 40 insertions(+), 0 deletions(-)arch/arm/mach-pxa/colibri-pxa300.c +2
-0@@ -229,6 +229,8 @@ void __init colibri_pxa300_init(void) mfp_to_gpio(MFP_PIN_GPIO13));colibri_pxa300_init_uart ();colibri_pxa300_init_i2c (); +if (cpu_is_pxa310 ()) +colibri_pxa3xx_init_touchscreen (); }MACHINE_START (COLIBRI300 ,"Toradex Colibri PXA300" )arch/arm/mach-pxa/colibri-pxa320.c +1
-0@@ -229,6 +229,7 @@ void __init colibri_pxa320_init(void) mfp_to_gpio(MFP_PIN_GPIO28));colibri_pxa320_init_uart ();colibri_pxa320_init_i2c (); +colibri_pxa3xx_init_touchscreen (); }MACHINE_START (COLIBRI320 ,"Toradex Colibri PXA320" )arch/arm/mach-pxa/colibri-pxa3xx.c +31
-0@@ -198,3 +198,34 @@ void __init colibri_pxa3xx_init_nand(void) }#endif +#if defined(CONFIG_INPUT_TOUCHSCREEN ) + +#if defined(CONFIG_TOUCHSCREEN_WM97XX ) || \ + defined(CONFIG_TOUCHSCREEN_WM97XX_MODULE ) +static struct platform_device colibri_ts_wm97xx_device = { + .name ="wm97xx-ts" , + .id =-1 , +}; +#endif + +#if defined(CONFIG_TOUCHSCREEN_UCB1400 ) || \ + defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE ) +static struct platform_device colibri_ts_ucb1400_device = { + .name ="ucb1400_core" , + .id =-1 , +}; +#endif + +void __init colibri_pxa3xx_init_touchscreen (void ) +{ +#if defined(CONFIG_TOUCHSCREEN_WM97XX ) || \ + defined(CONFIG_TOUCHSCREEN_WM97XX_MODULE ) +platform_device_register (&colibri_ts_wm97xx_device); +#endif +#if defined(CONFIG_TOUCHSCREEN_UCB1400 ) || \ + defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE ) +platform_device_register (&colibri_ts_ucb1400_device); +#endif +} + +#endif arch/arm/mach-pxa/include/mach/colibri.h +0
-0@@ -30,6 +30,12 @@ extern void colibri_pxa3xx_init_nand(void);static inline void colibri_pxa3xx_init_nand (void ) {}#endif
Quoted 10 lines
arch/arm/mach-pxa/include/mach/colibri.h extern void colibri_pxa3xx_init_nand(void); · line 40
Quoted 8 lines
arch/arm/mach-pxa/include/mach/colibri.h +6
-0+#if defined(CONFIG_INPUT_TOUCHSCREEN ) +extern void colibri_pxa3xx_init_touchscreen (void ); +#else +static inline void colibri_pxa3xx_init_touchscreen (void ) {} +#endif +/* physical memory regions */ #define COLIBRI_SDRAM_BASE 0xa0000000/* SDRAM region */ What will happen if both of the TS devices are selected?
That's no problem.
I actually have both configs enabled, so I can run the same kernel on the 310 (which is using wm97 for a while now) and the 320 (which still has ucb1400 at the moment)
Rgds, Pieter
PATCH v2 5/5 colibri-pxa3xx: add touchscreen support
Dne P? 9. ?ervence 2010 09:03:50 pieterg napsal(a):
Quoted 114 lines · On Friday 09 July 2010 01:03:14 Marek Vasut wrote:
Quoted 108 lines
Dne ?t 8. ?ervence 2010 22:49:59 pieterg napsal(a):
Quoted 107 lines
Signed-off-by pieter <[email protected]>---
arch/arm/mach-pxa/colibri-pxa300.c | 2 + arch/arm/mach-pxa/colibri-pxa320.c | 1 + arch/arm/mach-pxa/colibri-pxa3xx.c | 31++++++++++++++++++++++++++++++
arch/arm/mach-pxa/include/mach/colibri.h | 6 +++++ 4 files changed, 40 insertions(+), 0 deletions(-)arch/arm/mach-pxa/colibri-pxa300.c +2
-0@@ -229,6 +229,8 @@ void __init colibri_pxa300_init(void) mfp_to_gpio(MFP_PIN_GPIO13));colibri_pxa300_init_uart ();colibri_pxa300_init_i2c (); +if (cpu_is_pxa310 ()) +colibri_pxa3xx_init_touchscreen ();}
MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")arch/arm/mach-pxa/colibri-pxa320.c +1
-0@@ -229,6 +229,7 @@ void __init colibri_pxa320_init(void) mfp_to_gpio(MFP_PIN_GPIO28));colibri_pxa320_init_uart ();colibri_pxa320_init_i2c (); +colibri_pxa3xx_init_touchscreen ();}
MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")arch/arm/mach-pxa/colibri-pxa3xx.c +31
-0@@ -198,3 +198,34 @@ void __init colibri_pxa3xx_init_nand(void) }#endif +#if defined(CONFIG_INPUT_TOUCHSCREEN ) + +#if defined(CONFIG_TOUCHSCREEN_WM97XX ) || \ + defined(CONFIG_TOUCHSCREEN_WM97XX_MODULE ) +static struct platform_device colibri_ts_wm97xx_device = { + .name ="wm97xx-ts" , + .id =-1 , +}; +#endif + +#if defined(CONFIG_TOUCHSCREEN_UCB1400 ) || \ + defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE ) +static struct platform_device colibri_ts_ucb1400_device = { + .name ="ucb1400_core" , + .id =-1 , +}; +#endif + +void __init colibri_pxa3xx_init_touchscreen (void ) +{ +#if defined(CONFIG_TOUCHSCREEN_WM97XX ) || \ + defined(CONFIG_TOUCHSCREEN_WM97XX_MODULE ) +platform_device_register (&colibri_ts_wm97xx_device); +#endif +#if defined(CONFIG_TOUCHSCREEN_UCB1400 ) || \ + defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE ) +platform_device_register (&colibri_ts_ucb1400_device); +#endif +} + +#endif arch/arm/mach-pxa/include/mach/colibri.h +6
-0@@ -30,6 +30,12 @@ extern void colibri_pxa3xx_init_nand(void);static inline void colibri_pxa3xx_init_nand (void ) {}#endif +#if defined(CONFIG_INPUT_TOUCHSCREEN ) +extern void colibri_pxa3xx_init_touchscreen (void ); +#else +static inline void colibri_pxa3xx_init_touchscreen (void ) {} +#endif +Quoted 4 lines
Quoted 2 lines
arch/arm/mach-pxa/include/mach/colibri.h +0
-0/* physical memory regions */ #define
COLIBRI_SDRAM_BASE0xa0000000/* SDRAM region */What will happen if both of the TS devices are selected?
Quoted 4 lines
That's no problem.
I actually have both configs enabled, so I can run the same kernel on the 310 (which is using wm97 for a while now) and the 320 (which still has ucb1400 at the moment)
Ah ok then!
Quoted 2 lines
Rgds, Pieter
PATCH v2 5/5 colibri-pxa3xx: add touchscreen support
In reply to pietergQuoted 17 lines · pieterg
Quoted 6 lines
Quoted 6 lines
arch/arm/mach-pxa/include/mach/colibri.h +0
-0@@ -30,6 +30,12 @@ extern void colibri_pxa3xx_init_nand(void);static inline void colibri_pxa3xx_init_nand (void ) {}#endif Quoted 10 lines
arch/arm/mach-pxa/include/mach/colibri.h extern void colibri_pxa3xx_init_nand(void); · line 40
Quoted 8 lines
arch/arm/mach-pxa/include/mach/colibri.h +6
-0+#if defined(CONFIG_INPUT_TOUCHSCREEN ) +extern void colibri_pxa3xx_init_touchscreen (void ); +#else +static inline void colibri_pxa3xx_init_touchscreen (void ) {} +#endif +/* physical memory regions */ #define COLIBRI_SDRAM_BASE 0xa0000000/* SDRAM region */ What will happen if both of the TS devices are selected?
Quoted 4 lines
That's no problem.
I actually have both configs enabled, so I can run the same kernel on the 310 (which is using wm97 for a while now) and the 320 (which still has ucb1400 at the moment)
But doesn't the code still create both devices in /sys/devices/platform then? AFAICT, there is no runtime probing support to make sure you only register the device that is there.
Arnd
PATCH v2 5/5 colibri-pxa3xx: add touchscreen support
Quoted 18 lines · On Friday 09 July 2010 18:14:24 Arnd Bergmann wrote:
Quoted 17 lines · pieterg
Quoted 16 lines
Quoted 4 lines
arch/arm/mach-pxa/include/mach/colibri.h +0
-0@@ -30,6 +30,12 @@ extern void colibri_pxa3xx_init_nand(void);static inline void colibri_pxa3xx_init_nand (void ) {}arch/arm/mach-pxa/include/mach/colibri.h extern void colibri_pxa3xx_init_nand(void); · line 40
Quoted 10 lines
arch/arm/mach-pxa/include/mach/colibri.h +6
-0#endif +#if defined(CONFIG_INPUT_TOUCHSCREEN ) +extern void colibri_pxa3xx_init_touchscreen (void ); +#else +static inline void colibri_pxa3xx_init_touchscreen (void ) {} +#endif +/* physical memory regions */ #define COLIBRI_SDRAM_BASE 0xa0000000/* SDRAM region */ What will happen if both of the TS devices are selected?
Quoted 8 lines
Quoted 4 lines
That's no problem.
I actually have both configs enabled, so I can run the same kernel on the 310 (which is using wm97 for a while now) and the 320 (which still has ucb1400 at the moment)But doesn't the code still create both devices in
/sys/devices/platformthen? AFAICT, there is no runtime probing support to make sure you only register the device that is there.
Yes, they both show up. But at least the do not conflict, and only the detected device will register an input device.
PATCH v2 5/5 colibri-pxa3xx: add touchscreen support
Quoted 7 lines · pieterg
Quoted 4 lines
But doesn't the code still create both devices in
/sys/devices/platformthen? AFAICT, there is no runtime probing support to make sure you only register the device that is there.Yes, they both show up. But at least the do not conflict, and only the detected device will register an input device.
That's still putting the logic into the wrong place. If you have a way to detect the hardware, that should be done before creating the device, otherwise there is no point in having a platform device to start with and you could just detect it in your module_init function.
Arnd
PATCH v2 5/5 colibri-pxa3xx: add touchscreen support
Quoted 5 lines · On Friday 09 July 2010 18:53:41 Arnd Bergmann wrote:
Quoted 4 lines · pieterg
Quoted 3 lines
But doesn't the code still create both devices in
/sys/devices/platformthen? AFAICT, there is no runtime probing support to make sure you only register the device that is there.
Quoted 7 lines
Quoted 2 lines
Yes, they both show up. But at least the do not conflict, and only the detected device will register an input device.
That's still putting the logic into the wrong place. If you have a way to detect the hardware, that should be done before creating the device, otherwise there is no point in having a platform device to start with and you could just detect it in your
module_initfunction.
Note that this would not happen normally.
The concern was raised as to what would happen if the user accidentally put two different AC97/touchscreen controllers in the kernelconfig, while there is only one AC97 interface.
And my observation is that nothing serious happens in that case.
PATCH v2 5/5 colibri-pxa3xx: add touchscreen support
Quoted 5 lines · pieterg
Note that this would not happen normally.
The concern was raised as to what would happen if the user accidentally put two different AC97/touchscreen controllers in the kernelconfig, while there is only one AC97 interface.
And my observation is that nothing serious happens in that case.
Yes, I understand that it's not serious. I'm arguing instead that it's still wrong. If you ship a kernel with support for two dozen different controllers, you certainly wouldn't want to list them all as present devices and have to go through loading each driver at boot time, just to find that they are not actually present.
Arnd
PATCH v2 5/5 colibri-pxa3xx: add touchscreen support
In reply to pietergQuoted 1 line · pieterg
Signed-off-by pieter <[email protected]>
Quoted 100 lines
--- arch/arm/mach-pxa/colibri-pxa300.c | 2 + arch/arm/mach-pxa/colibri-pxa320.c | 1 + arch/arm/mach-pxa/colibri-pxa3xx.c | 31 ++++++++++++++++++++++++++++++ arch/arm/mach-pxa/include/mach/colibri.h | 6 +++++ 4 files changed, 40 insertions(+), 0 deletions(-)arch/arm/mach-pxa/colibri-pxa300.c +2
-0@@ -229,6 +229,8 @@ void __init colibri_pxa300_init(void) mfp_to_gpio(MFP_PIN_GPIO13));colibri_pxa300_init_uart ();colibri_pxa300_init_i2c (); +if (cpu_is_pxa310 ()) +colibri_pxa3xx_init_touchscreen (); }MACHINE_START (COLIBRI300 ,"Toradex Colibri PXA300" )arch/arm/mach-pxa/colibri-pxa320.c +1
-0@@ -229,6 +229,7 @@ void __init colibri_pxa320_init(void) mfp_to_gpio(MFP_PIN_GPIO28));colibri_pxa320_init_uart ();colibri_pxa320_init_i2c (); +colibri_pxa3xx_init_touchscreen (); }MACHINE_START (COLIBRI320 ,"Toradex Colibri PXA320" )arch/arm/mach-pxa/colibri-pxa3xx.c +31
-0@@ -198,3 +198,34 @@ void __init colibri_pxa3xx_init_nand(void) }#endif +#if defined(CONFIG_INPUT_TOUCHSCREEN ) + +#if defined(CONFIG_TOUCHSCREEN_WM97XX ) || \ + defined(CONFIG_TOUCHSCREEN_WM97XX_MODULE ) +static struct platform_device colibri_ts_wm97xx_device = { + .name ="wm97xx-ts" , + .id =-1 , +}; +#endif + +#if defined(CONFIG_TOUCHSCREEN_UCB1400 ) || \ + defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE ) +static struct platform_device colibri_ts_ucb1400_device = { + .name ="ucb1400_core" , + .id =-1 , +}; +#endif + +void __init colibri_pxa3xx_init_touchscreen (void ) +{ +#if defined(CONFIG_TOUCHSCREEN_WM97XX ) || \ + defined(CONFIG_TOUCHSCREEN_WM97XX_MODULE ) +platform_device_register (&colibri_ts_wm97xx_device); +#endif +#if defined(CONFIG_TOUCHSCREEN_UCB1400 ) || \ + defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE ) +platform_device_register (&colibri_ts_ucb1400_device); +#endif +} + +#endif arch/arm/mach-pxa/include/mach/colibri.h +6
-0@@ -30,6 +30,12 @@ extern void colibri_pxa3xx_init_nand(void);static inline void colibri_pxa3xx_init_nand (void ) {}#endif +#if defined(CONFIG_INPUT_TOUCHSCREEN ) +extern void colibri_pxa3xx_init_touchscreen (void ); +#else +static inline void colibri_pxa3xx_init_touchscreen (void ) {} +#endif +/* physical memory regions */ #define COLIBRI_SDRAM_BASE 0xa0000000/* SDRAM region */ Signature · 6 lines
1.6.5.rc1.44.ga1675 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel