Skip to contentSkip to conversation

SharpSL: Add cxx00 support to the Corgi LCD driver

PATCH In review Richard Purdie 3 participants 5 messages Sep 6, 2005 – Sep 8, 2005

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/5 SharpSL: Add cxx00 support to the Corgi LCD driver

The same LCD is present on both the Sharp Zaurus c7x0 series and the cxx00 but with different framebuffer drivers (w100fb vs. pxafb). This patch adds support for the cxx00 series to the LCD driver. It also adds some LCD to touchscreen interface logic needed by the touchscreen driver to prevent interference problems, the idea being to keep all the ugly code in one place leaving the drivers themselves clean. sharpsl.h is used to provide the abstraction.

include/asm-arm/arch-pxa/sharpsl.h +8 -0
Index: linux-2.6.12/include/asm-arm/arch-pxa/sharpsl.h
===================================================================
@@ -10,3 +10,11 @@
 void corgi_ssp_lcdtg_send (unsigned char adrs, unsigned char data);
 void corgi_ssp_blduty_set(int duty);
 int corgi_ssp_max1111_get(unsigned long data);
+
+/*
+ * SharpSL LCD Driver 
+ */
+
+unsigned long corgi_get_hsync_len(void);
+void corgi_wait_hsync(void);
+
arch/arm/mach-pxa/corgi_lcd.c +89 -14

167 lines not on this page · raw message

#1 lore raw
Quoted 6 lines · Richard Purdie
arch/arm/mach-pxa/corgi_lcd.c +6 -0
+/*
+ * Corgi/Spitz Touchscreen to LCD interface
+ */
+unsigned long inline corgi_get_hsync_len(void)
+{
+       if (machine_is_corgi() || machine_is_shepherd() || machine_is_husky()) {

arch/arm/mach-pxa/corgi_lcd.c line 457

Quoted 10 lines
arch/arm/mach-pxa/corgi_lcd.c +10 -0
+#ifdef CONFIG_PXA_SHARP_C7xx
+               return w100fb_get_hsynclen(&corgifb_device.dev);
+#endif
+       } else if (machine_is_spitz() || machine_is_akita() || machine_is_borzoi()) {
+#ifdef CONFIG_PXA_SHARP_Cxx00
+               return pxafb_get_hsync_time(&pxafb_device.dev);
+#endif
+       }
+       return 0;
+}

Please consider making two version of corgi_get_hsync_len() instead for both config options. The above is hard to read.

Pekka

#2 lore raw
Quoted 16 lines · Richard Purdie
Quoted 16 lines
arch/arm/mach-pxa/corgi_lcd.c +16 -0
+/*
+ * Corgi/Spitz Touchscreen to LCD interface
+ */
+unsigned long inline corgi_get_hsync_len(void)
+{
+       if (machine_is_corgi() || machine_is_shepherd() || machine_is_husky()) {
+#ifdef CONFIG_PXA_SHARP_C7xx
+               return w100fb_get_hsynclen(&corgifb_device.dev);
+#endif
+       } else if (machine_is_spitz() || machine_is_akita() || machine_is_borzoi()) {
+#ifdef CONFIG_PXA_SHARP_Cxx00
+               return pxafb_get_hsync_time(&pxafb_device.dev);
+#endif
+       }
+       return 0;
+}
Quoted 2 lines · Pekka Enberg

Please consider making two version of corgi_get_hsync_len() instead for both config options. The above is hard to read.

Uhm, forget it. I didn't realize both config options can be enabled at the same time. Sorry for the noise.

Pekka

#3 lore raw
In reply to Richard Purdie

arch/arm/mach-pxa/corgi_lcd.c line 454

Quoted 13 lines · Richard Purdie
arch/arm/mach-pxa/corgi_lcd.c +13 -0
+/*
+ * Corgi/Spitz Touchscreen to LCD interface
+ */
+unsigned long inline corgi_get_hsync_len(void) 
+{
+	if (machine_is_corgi() || machine_is_shepherd() || machine_is_husky()) {
+#ifdef CONFIG_PXA_SHARP_C7xx
+		return w100fb_get_hsynclen(&corgifb_device.dev);
+#endif
+	} else if (machine_is_spitz() || machine_is_akita() || machine_is_borzoi()) {
+#ifdef CONFIG_PXA_SHARP_Cxx00
+		return pxafb_get_hsync_time(&pxafb_device.dev);
+#endif

This means you have to force these drivers to be built (since this file will always be built for sharp stuff.) This doesn't seem like a good solution.

Quoted 1 line

+#define SyncHS(x) while((GPLR(x) & GPIO_bit(x)) == 0); while((GPLR(x) & GPIO_bit(x)) != 0);

That's particularly gruesome - firstly, two statements inside a macro. Secondly, no barrier() or cpu_relax() in there (as the kernel janitors like to see.) It won't make any difference to the generated code, but makes other folk happier.

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 10 lines · Russell King
Quoted 9 lines · Richard Purdie
arch/arm/mach-pxa/corgi_lcd.c +9 -0
+/*
+ * Corgi/Spitz Touchscreen to LCD interface
+ */
+unsigned long inline corgi_get_hsync_len(void) 
+{
+	if (machine_is_corgi() || machine_is_shepherd() || machine_is_husky()) {
+#ifdef CONFIG_PXA_SHARP_C7xx
+		return w100fb_get_hsynclen(&corgifb_device.dev);
+#endif
Quoted 8 lines

arch/arm/mach-pxa/corgi_lcd.c line 454

Quoted 4 lines
arch/arm/mach-pxa/corgi_lcd.c +4 -0
+	} else if (machine_is_spitz() || machine_is_akita() || machine_is_borzoi()) {
+#ifdef CONFIG_PXA_SHARP_Cxx00
+		return pxafb_get_hsync_time(&pxafb_device.dev);
+#endif

This means you have to force these drivers to be built (since this file will always be built for sharp stuff.) This doesn't seem like a good solution.

It was made inline so in theory only the touchscreen drivers had the dependency. I then moved it to another file which kind of breaks things.

Would using symbol_put and symbol_get be a better solution? I was warned off those functions in the past but this would appear to be an ideal use as if the framebuffer drivers aren't loaded, we don't care about this.

Quoted 6 lines
Quoted 1 line

+#define SyncHS(x) while((GPLR(x) & GPIO_bit(x)) == 0); while((GPLR(x) & GPIO_bit(x)) != 0);

That's particularly gruesome - firstly, two statements inside a macro. Secondly, no barrier() or cpu_relax() in there (as the kernel janitors like to see.) It won't make any difference to the generated code, but makes other folk happier.

This needs to be a fast piece of code as its in an interrupt handler and we go to great lengths to time things to avoid interference from the lcd. I need to check what timing overhead those functions have...

Richard