[ARM] 4737/1: Refactor corgi_lcd to improve readability + bugfix
authorRichard Purdie <rpurdie@rpsys.net>
Wed, 2 Jan 2008 00:09:54 +0000 (01:09 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 28 Jan 2008 13:13:25 +0000 (13:13 +0000)
This patch refactors the code in corgi_lcd.c moving it to the board
specific corgi and spitz files where appropriate instead of the
existing ifdef mess which hinders readability.

Fix spitz_get_hsync_len() to call get_hsync_invperiod so pxafb can be
compiled as a module.

The confusing variables which represent the inverse horizintal sync
period are renamed to "invperiod" consistently.

An incorrect comment in corgi_ts.c is also corrected.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-pxa/corgi.c
arch/arm/mach-pxa/corgi_lcd.c
arch/arm/mach-pxa/sharpsl.h
arch/arm/mach-pxa/spitz.c
drivers/input/touchscreen/corgi_ts.c
include/asm-arm/arch-pxa/corgi.h
include/asm-arm/arch-pxa/sharpsl.h
include/asm-arm/arch-pxa/spitz.h

index 2363cc64fe076b2a19268407f52e1f3bd11f6688..7304fdbfbb0fe86beb602159b8ad86ea9f7dd32a 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/mmc/host.h>
 #include <linux/pm.h>
 #include <linux/backlight.h>
+#include <video/w100fb.h>
 
 #include <asm/setup.h>
 #include <asm/memory.h>
@@ -140,6 +141,136 @@ struct corgissp_machinfo corgi_ssp_machinfo = {
 };
 
 
+/*
+ * LCD/Framebuffer
+ */
+static void w100_lcdtg_suspend(struct w100fb_par *par)
+{
+       corgi_lcdtg_suspend();
+}
+
+static void w100_lcdtg_init(struct w100fb_par *par)
+{
+       corgi_lcdtg_hw_init(par->xres);
+}
+
+
+static struct w100_tg_info corgi_lcdtg_info = {
+       .change  = w100_lcdtg_init,
+       .suspend = w100_lcdtg_suspend,
+       .resume  = w100_lcdtg_init,
+};
+
+static struct w100_mem_info corgi_fb_mem = {
+       .ext_cntl          = 0x00040003,
+       .sdram_mode_reg    = 0x00650021,
+       .ext_timing_cntl   = 0x10002a4a,
+       .io_cntl           = 0x7ff87012,
+       .size              = 0x1fffff,
+};
+
+static struct w100_gen_regs corgi_fb_regs = {
+       .lcd_format    = 0x00000003,
+       .lcdd_cntl1    = 0x01CC0000,
+       .lcdd_cntl2    = 0x0003FFFF,
+       .genlcd_cntl1  = 0x00FFFF0D,
+       .genlcd_cntl2  = 0x003F3003,
+       .genlcd_cntl3  = 0x000102aa,
+};
+
+static struct w100_gpio_regs corgi_fb_gpio = {
+       .init_data1   = 0x000000bf,
+       .init_data2   = 0x00000000,
+       .gpio_dir1    = 0x00000000,
+       .gpio_oe1     = 0x03c0feff,
+       .gpio_dir2    = 0x00000000,
+       .gpio_oe2     = 0x00000000,
+};
+
+static struct w100_mode corgi_fb_modes[] = {
+{
+       .xres            = 480,
+       .yres            = 640,
+       .left_margin     = 0x56,
+       .right_margin    = 0x55,
+       .upper_margin    = 0x03,
+       .lower_margin    = 0x00,
+       .crtc_ss         = 0x82360056,
+       .crtc_ls         = 0xA0280000,
+       .crtc_gs         = 0x80280028,
+       .crtc_vpos_gs    = 0x02830002,
+       .crtc_rev        = 0x00400008,
+       .crtc_dclk       = 0xA0000000,
+       .crtc_gclk       = 0x8015010F,
+       .crtc_goe        = 0x80100110,
+       .crtc_ps1_active = 0x41060010,
+       .pll_freq        = 75,
+       .fast_pll_freq   = 100,
+       .sysclk_src      = CLK_SRC_PLL,
+       .sysclk_divider  = 0,
+       .pixclk_src      = CLK_SRC_PLL,
+       .pixclk_divider  = 2,
+       .pixclk_divider_rotated = 6,
+},{
+       .xres            = 240,
+       .yres            = 320,
+       .left_margin     = 0x27,
+       .right_margin    = 0x2e,
+       .upper_margin    = 0x01,
+       .lower_margin    = 0x00,
+       .crtc_ss         = 0x81170027,
+       .crtc_ls         = 0xA0140000,
+       .crtc_gs         = 0xC0140014,
+       .crtc_vpos_gs    = 0x00010141,
+       .crtc_rev        = 0x00400008,
+       .crtc_dclk       = 0xA0000000,
+       .crtc_gclk       = 0x8015010F,
+       .crtc_goe        = 0x80100110,
+       .crtc_ps1_active = 0x41060010,
+       .pll_freq        = 0,
+       .fast_pll_freq   = 0,
+       .sysclk_src      = CLK_SRC_XTAL,
+       .sysclk_divider  = 0,
+       .pixclk_src      = CLK_SRC_XTAL,
+       .pixclk_divider  = 1,
+       .pixclk_divider_rotated = 1,
+},
+
+};
+
+static struct w100fb_mach_info corgi_fb_info = {
+       .tg         = &corgi_lcdtg_info,
+       .init_mode  = INIT_MODE_ROTATED,
+       .mem        = &corgi_fb_mem,
+       .regs       = &corgi_fb_regs,
+       .modelist   = &corgi_fb_modes[0],
+       .num_modes  = 2,
+       .gpio       = &corgi_fb_gpio,
+       .xtal_freq  = 12500000,
+       .xtal_dbl   = 0,
+};
+
+static struct resource corgi_fb_resources[] = {
+       [0] = {
+               .start   = 0x08000000,
+               .end     = 0x08ffffff,
+               .flags   = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device corgifb_device = {
+       .name           = "w100fb",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(corgi_fb_resources),
+       .resource       = corgi_fb_resources,
+       .dev            = {
+               .platform_data = &corgi_fb_info,
+               .parent = &corgissp_device.dev,
+       },
+
+};
+
+
 /*
  * Corgi Backlight Device
  */
@@ -154,6 +285,21 @@ static void corgi_bl_kick_battery(void)
        }
 }
 
+static void corgi_bl_set_intensity(int intensity)
+{
+       if (intensity > 0x10)
+               intensity += 0x10;
+
+       /* Bits 0-4 are accessed via the SSP interface */
+       corgi_ssp_blduty_set(intensity & 0x1f);
+
+       /* Bit 5 is via SCOOP */
+       if (intensity & 0x0020)
+               set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT);
+       else
+               reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT);
+}
+
 static struct generic_bl_info corgi_bl_machinfo = {
        .name = "corgi-bl",
        .max_intensity = 0x2f,
@@ -190,9 +336,40 @@ static struct platform_device corgiled_device = {
        .id             = -1,
 };
 
+
 /*
  * Corgi Touch Screen Device
  */
+static unsigned long (*get_hsync_invperiod)(struct device *dev);
+
+static void inline sharpsl_wait_sync(int gpio)
+{
+       while((GPLR(gpio) & GPIO_bit(gpio)) == 0);
+       while((GPLR(gpio) & GPIO_bit(gpio)) != 0);
+}
+
+static unsigned long corgi_get_hsync_invperiod(void)
+{
+       if (!get_hsync_invperiod)
+               get_hsync_invperiod = symbol_get(w100fb_get_hsynclen);
+       if (!get_hsync_invperiod)
+               return 0;
+
+       return get_hsync_invperiod(&corgifb_device.dev);
+}
+
+static void corgi_put_hsync(void)
+{
+       if (get_hsync_invperiod)
+               symbol_put(w100fb_get_hsynclen);
+       get_hsync_invperiod = NULL;
+}
+
+static void corgi_wait_hsync(void)
+{
+       sharpsl_wait_sync(CORGI_GPIO_HSYNC);
+}
+
 static struct resource corgits_resources[] = {
        [0] = {
                .start          = CORGI_IRQ_GPIO_TP_INT,
@@ -202,9 +379,9 @@ static struct resource corgits_resources[] = {
 };
 
 static struct corgits_machinfo  corgi_ts_machinfo = {
-       .get_hsync_len   = corgi_get_hsync_len,
-       .put_hsync       = corgi_put_hsync,
-       .wait_hsync      = corgi_wait_hsync,
+       .get_hsync_invperiod = corgi_get_hsync_invperiod,
+       .put_hsync           = corgi_put_hsync,
+       .wait_hsync          = corgi_wait_hsync,
 };
 
 static struct platform_device corgits_device = {
index 365b9435f748bbe57cf6c9650bd6e25909047211..9328df37afd1551f8c91f93ce38a1416053a74ff 100644 (file)
@@ -173,7 +173,7 @@ static void lcdtg_set_phadadj(int mode)
 
 static int lcd_inited;
 
-static void lcdtg_hw_init(int mode)
+void corgi_lcdtg_hw_init(int mode)
 {
        if (!lcd_inited) {
                int comadj;
@@ -254,7 +254,7 @@ static void lcdtg_hw_init(int mode)
        }
 }
 
-static void lcdtg_suspend(void)
+void corgi_lcdtg_suspend(void)
 {
        /* 60Hz x 2 frame = 16.7msec x 2 = 33.4 msec */
        mdelay(34);
@@ -288,298 +288,3 @@ static void lcdtg_suspend(void)
        lcd_inited = 0;
 }
 
-
-/*
- * Corgi w100 Frame Buffer Device
- */
-#ifdef CONFIG_PXA_SHARP_C7xx
-
-#include <video/w100fb.h>
-
-static void w100_lcdtg_suspend(struct w100fb_par *par)
-{
-       lcdtg_suspend();
-}
-
-static void w100_lcdtg_init(struct w100fb_par *par)
-{
-       lcdtg_hw_init(par->xres);
-}
-
-
-static struct w100_tg_info corgi_lcdtg_info = {
-       .change  = w100_lcdtg_init,
-       .suspend = w100_lcdtg_suspend,
-       .resume  = w100_lcdtg_init,
-};
-
-static struct w100_mem_info corgi_fb_mem = {
-       .ext_cntl          = 0x00040003,
-       .sdram_mode_reg    = 0x00650021,
-       .ext_timing_cntl   = 0x10002a4a,
-       .io_cntl           = 0x7ff87012,
-       .size              = 0x1fffff,
-};
-
-static struct w100_gen_regs corgi_fb_regs = {
-       .lcd_format    = 0x00000003,
-       .lcdd_cntl1    = 0x01CC0000,
-       .lcdd_cntl2    = 0x0003FFFF,
-       .genlcd_cntl1  = 0x00FFFF0D,
-       .genlcd_cntl2  = 0x003F3003,
-       .genlcd_cntl3  = 0x000102aa,
-};
-
-static struct w100_gpio_regs corgi_fb_gpio = {
-       .init_data1   = 0x000000bf,
-       .init_data2   = 0x00000000,
-       .gpio_dir1    = 0x00000000,
-       .gpio_oe1     = 0x03c0feff,
-       .gpio_dir2    = 0x00000000,
-       .gpio_oe2     = 0x00000000,
-};
-
-static struct w100_mode corgi_fb_modes[] = {
-{
-       .xres            = 480,
-       .yres            = 640,
-       .left_margin     = 0x56,
-       .right_margin    = 0x55,
-       .upper_margin    = 0x03,
-       .lower_margin    = 0x00,
-       .crtc_ss         = 0x82360056,
-       .crtc_ls         = 0xA0280000,
-       .crtc_gs         = 0x80280028,
-       .crtc_vpos_gs    = 0x02830002,
-       .crtc_rev        = 0x00400008,
-       .crtc_dclk       = 0xA0000000,
-       .crtc_gclk       = 0x8015010F,
-       .crtc_goe        = 0x80100110,
-       .crtc_ps1_active = 0x41060010,
-       .pll_freq        = 75,
-       .fast_pll_freq   = 100,
-       .sysclk_src      = CLK_SRC_PLL,
-       .sysclk_divider  = 0,
-       .pixclk_src      = CLK_SRC_PLL,
-       .pixclk_divider  = 2,
-       .pixclk_divider_rotated = 6,
-},{
-       .xres            = 240,
-       .yres            = 320,
-       .left_margin     = 0x27,
-       .right_margin    = 0x2e,
-       .upper_margin    = 0x01,
-       .lower_margin    = 0x00,
-       .crtc_ss         = 0x81170027,
-       .crtc_ls         = 0xA0140000,
-       .crtc_gs         = 0xC0140014,
-       .crtc_vpos_gs    = 0x00010141,
-       .crtc_rev        = 0x00400008,
-       .crtc_dclk       = 0xA0000000,
-       .crtc_gclk       = 0x8015010F,
-       .crtc_goe        = 0x80100110,
-       .crtc_ps1_active = 0x41060010,
-       .pll_freq        = 0,
-       .fast_pll_freq   = 0,
-       .sysclk_src      = CLK_SRC_XTAL,
-       .sysclk_divider  = 0,
-       .pixclk_src      = CLK_SRC_XTAL,
-       .pixclk_divider  = 1,
-       .pixclk_divider_rotated = 1,
-},
-
-};
-
-static struct w100fb_mach_info corgi_fb_info = {
-       .tg         = &corgi_lcdtg_info,
-       .init_mode  = INIT_MODE_ROTATED,
-       .mem        = &corgi_fb_mem,
-       .regs       = &corgi_fb_regs,
-       .modelist   = &corgi_fb_modes[0],
-       .num_modes  = 2,
-       .gpio       = &corgi_fb_gpio,
-       .xtal_freq  = 12500000,
-       .xtal_dbl   = 0,
-};
-
-static struct resource corgi_fb_resources[] = {
-       [0] = {
-               .start   = 0x08000000,
-               .end     = 0x08ffffff,
-               .flags   = IORESOURCE_MEM,
-       },
-};
-
-struct platform_device corgifb_device = {
-       .name           = "w100fb",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(corgi_fb_resources),
-       .resource       = corgi_fb_resources,
-       .dev            = {
-               .platform_data = &corgi_fb_info,
-               .parent = &corgissp_device.dev,
-       },
-
-};
-#endif
-
-
-/*
- * Spitz PXA Frame Buffer Device
- */
-#ifdef CONFIG_PXA_SHARP_Cxx00
-
-#include <asm/arch/pxafb.h>
-
-void spitz_lcd_power(int on, struct fb_var_screeninfo *var)
-{
-       if (on)
-               lcdtg_hw_init(var->xres);
-       else
-               lcdtg_suspend();
-}
-
-#endif
-
-
-/*
- * Corgi/Spitz Touchscreen to LCD interface
- */
-static unsigned long (*get_hsync_time)(struct device *dev);
-
-static void inline sharpsl_wait_sync(int gpio)
-{
-       while((GPLR(gpio) & GPIO_bit(gpio)) == 0);
-       while((GPLR(gpio) & GPIO_bit(gpio)) != 0);
-}
-
-#ifdef CONFIG_PXA_SHARP_C7xx
-unsigned long corgi_get_hsync_len(void)
-{
-       if (!get_hsync_time)
-               get_hsync_time = symbol_get(w100fb_get_hsynclen);
-       if (!get_hsync_time)
-               return 0;
-
-       return get_hsync_time(&corgifb_device.dev);
-}
-
-void corgi_put_hsync(void)
-{
-       if (get_hsync_time)
-               symbol_put(w100fb_get_hsynclen);
-       get_hsync_time = NULL;
-}
-
-void corgi_wait_hsync(void)
-{
-       sharpsl_wait_sync(CORGI_GPIO_HSYNC);
-}
-#endif
-
-#ifdef CONFIG_PXA_SHARP_Cxx00
-static struct device *spitz_pxafb_dev;
-
-static int is_pxafb_device(struct device * dev, void * data)
-{
-       struct platform_device *pdev = container_of(dev, struct platform_device, dev);
-
-       return (strncmp(pdev->name, "pxa2xx-fb", 9) == 0);
-}
-
-unsigned long spitz_get_hsync_len(void)
-{
-#ifdef CONFIG_FB_PXA
-       if (!spitz_pxafb_dev) {
-               spitz_pxafb_dev = bus_find_device(&platform_bus_type, NULL, NULL, is_pxafb_device);
-               if (!spitz_pxafb_dev)
-                       return 0;
-       }
-       if (!get_hsync_time)
-               get_hsync_time = symbol_get(pxafb_get_hsync_time);
-       if (!get_hsync_time)
-#endif
-               return 0;
-
-       return pxafb_get_hsync_time(spitz_pxafb_dev);
-}
-
-void spitz_put_hsync(void)
-{
-       put_device(spitz_pxafb_dev);
-       if (get_hsync_time)
-               symbol_put(pxafb_get_hsync_time);
-       spitz_pxafb_dev = NULL;
-       get_hsync_time = NULL;
-}
-
-void spitz_wait_hsync(void)
-{
-       sharpsl_wait_sync(SPITZ_GPIO_HSYNC);
-}
-#endif
-
-/*
- * Corgi/Spitz Backlight Power
- */
-#ifdef CONFIG_PXA_SHARP_C7xx
-void corgi_bl_set_intensity(int intensity)
-{
-       if (intensity > 0x10)
-               intensity += 0x10;
-
-       /* Bits 0-4 are accessed via the SSP interface */
-       corgi_ssp_blduty_set(intensity & 0x1f);
-
-       /* Bit 5 is via SCOOP */
-       if (intensity & 0x0020)
-               set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT);
-       else
-               reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT);
-}
-#endif
-
-
-#if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI)
-void spitz_bl_set_intensity(int intensity)
-{
-       if (intensity > 0x10)
-               intensity += 0x10;
-
-       /* Bits 0-4 are accessed via the SSP interface */
-       corgi_ssp_blduty_set(intensity & 0x1f);
-
-       /* Bit 5 is via SCOOP */
-       if (intensity & 0x0020)
-               reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT);
-       else
-               set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT);
-
-       if (intensity)
-               set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON);
-       else
-               reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON);
-}
-#endif
-
-#ifdef CONFIG_MACH_AKITA
-void akita_bl_set_intensity(int intensity)
-{
-       if (intensity > 0x10)
-               intensity += 0x10;
-
-       /* Bits 0-4 are accessed via the SSP interface */
-       corgi_ssp_blduty_set(intensity & 0x1f);
-
-       /* Bit 5 is via IO-Expander */
-       if (intensity & 0x0020)
-               akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT);
-       else
-               akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT);
-
-       if (intensity)
-               akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON);
-       else
-               akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON);
-}
-#endif
index da4769caaf72b74a9cabe231e98081b6a1d82d37..047909a76651fb377aca1a5e0677e4ca5a21f771 100644 (file)
@@ -26,28 +26,15 @@ void corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo);
 
 
 /*
- * SharpSL Backlight
+ * SharpSL/Corgi LCD Driver
  */
-void corgi_bl_set_intensity(int intensity);
-void spitz_bl_set_intensity(int intensity);
-void akita_bl_set_intensity(int intensity);
-
-
-/*
- * SharpSL Touchscreen Driver
- */
-unsigned long corgi_get_hsync_len(void);
-unsigned long spitz_get_hsync_len(void);
-void corgi_put_hsync(void);
-void spitz_put_hsync(void);
-void corgi_wait_hsync(void);
-void spitz_wait_hsync(void);
+void corgi_lcdtg_suspend(void);
+void corgi_lcdtg_hw_init(int mode);
 
 
 /*
  * SharpSL Battery/PM Driver
  */
-
 #define READ_GPIO_BIT(x)    (GPLR(x) & GPIO_bit(x))
 
 /* MAX1111 Channel Definitions */
index 2d78199d24af962c6cacebe691f65492bb31fc41..bb4b65d352c9351c5eab910ebee90c98fbe62f79 100644 (file)
@@ -271,6 +271,55 @@ static struct platform_device spitzled_device = {
 /*
  * Spitz Touch Screen Device
  */
+
+static unsigned long (*get_hsync_invperiod)(struct device *dev);
+
+static void inline sharpsl_wait_sync(int gpio)
+{
+       while((GPLR(gpio) & GPIO_bit(gpio)) == 0);
+       while((GPLR(gpio) & GPIO_bit(gpio)) != 0);
+}
+
+static struct device *spitz_pxafb_dev;
+
+static int is_pxafb_device(struct device * dev, void * data)
+{
+       struct platform_device *pdev = container_of(dev, struct platform_device, dev);
+
+       return (strncmp(pdev->name, "pxa2xx-fb", 9) == 0);
+}
+
+static unsigned long spitz_get_hsync_invperiod(void)
+{
+#ifdef CONFIG_FB_PXA
+       if (!spitz_pxafb_dev) {
+               spitz_pxafb_dev = bus_find_device(&platform_bus_type, NULL, NULL, is_pxafb_device);
+               if (!spitz_pxafb_dev)
+                       return 0;
+       }
+       if (!get_hsync_invperiod)
+               get_hsync_invperiod = symbol_get(pxafb_get_hsync_time);
+       if (!get_hsync_invperiod)
+#endif
+               return 0;
+
+       return get_hsync_invperiod(spitz_pxafb_dev);
+}
+
+static void spitz_put_hsync(void)
+{
+       put_device(spitz_pxafb_dev);
+       if (get_hsync_invperiod)
+               symbol_put(pxafb_get_hsync_time);
+       spitz_pxafb_dev = NULL;
+       get_hsync_invperiod = NULL;
+}
+
+static void spitz_wait_hsync(void)
+{
+       sharpsl_wait_sync(SPITZ_GPIO_HSYNC);
+}
+
 static struct resource spitzts_resources[] = {
        [0] = {
                .start          = SPITZ_IRQ_GPIO_TP_INT,
@@ -280,9 +329,9 @@ static struct resource spitzts_resources[] = {
 };
 
 static struct corgits_machinfo  spitz_ts_machinfo = {
-       .get_hsync_len   = spitz_get_hsync_len,
-       .put_hsync       = spitz_put_hsync,
-       .wait_hsync      = spitz_wait_hsync,
+       .get_hsync_invperiod = spitz_get_hsync_invperiod,
+       .put_hsync           = spitz_put_hsync,
+       .wait_hsync          = spitz_wait_hsync,
 };
 
 static struct platform_device spitzts_device = {
@@ -423,6 +472,14 @@ static struct pxaficp_platform_data spitz_ficp_platform_data = {
  * Spitz PXA Framebuffer
  */
 
+static void spitz_lcd_power(int on, struct fb_var_screeninfo *var)
+{
+       if (on)
+               corgi_lcdtg_hw_init(var->xres);
+       else
+               corgi_lcdtg_suspend();
+}
+
 static struct pxafb_mode_info spitz_pxafb_modes[] = {
 {
        .pixclock       = 19231,
@@ -520,6 +577,27 @@ static void __init common_init(void)
        set_pxa_fb_info(&spitz_pxafb_info);
 }
 
+#if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI)
+static void spitz_bl_set_intensity(int intensity)
+{
+       if (intensity > 0x10)
+               intensity += 0x10;
+
+       /* Bits 0-4 are accessed via the SSP interface */
+       corgi_ssp_blduty_set(intensity & 0x1f);
+
+       /* Bit 5 is via SCOOP */
+       if (intensity & 0x0020)
+               reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT);
+       else
+               set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT);
+
+       if (intensity)
+               set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON);
+       else
+               reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON);
+}
+
 static void __init spitz_init(void)
 {
        platform_scoop_config = &spitz_pcmcia_config;
@@ -530,6 +608,7 @@ static void __init spitz_init(void)
 
        platform_device_register(&spitzscoop2_device);
 }
+#endif
 
 #ifdef CONFIG_MACH_AKITA
 /*
@@ -542,6 +621,26 @@ struct platform_device akitaioexp_device = {
 
 EXPORT_SYMBOL_GPL(akitaioexp_device);
 
+static void akita_bl_set_intensity(int intensity)
+{
+       if (intensity > 0x10)
+               intensity += 0x10;
+
+       /* Bits 0-4 are accessed via the SSP interface */
+       corgi_ssp_blduty_set(intensity & 0x1f);
+
+       /* Bit 5 is via IO-Expander */
+       if (intensity & 0x0020)
+               akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT);
+       else
+               akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT);
+
+       if (intensity)
+               akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON);
+       else
+               akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON);
+}
+
 static void __init akita_init(void)
 {
        spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode;
@@ -558,7 +657,6 @@ static void __init akita_init(void)
 }
 #endif
 
-
 static void __init fixup_spitz(struct machine_desc *desc,
                struct tag *tags, char **cmdline, struct meminfo *mi)
 {
index b1b2e07bf080b3cb348726e3c7a3aff935ad7725..99d92f5c93d68f1b778c8a419963274f9b299e5b 100644 (file)
@@ -74,10 +74,10 @@ extern unsigned int get_clk_frequency_khz(int info);
 
 static unsigned long calc_waittime(struct corgi_ts *corgi_ts)
 {
-       unsigned long hsync_len = corgi_ts->machinfo->get_hsync_len();
+       unsigned long hsync_invperiod = corgi_ts->machinfo->get_hsync_invperiod();
 
-       if (hsync_len)
-               return get_clk_frequency_khz(0)*1000/hsync_len;
+       if (hsync_invperiod)
+               return get_clk_frequency_khz(0)*1000/hsync_invperiod;
        else
                return 0;
 }
@@ -114,7 +114,7 @@ static int sync_receive_data_send_cmd(struct corgi_ts *corgi_ts, int doRecive, i
                        if (timer2-timer1 > wait_time) {
                                /* too slow - timeout, try again */
                                corgi_ts->machinfo->wait_hsync();
-                               /* get OSCR */
+                               /* get CCNT */
                                CCNT(timer1);
                                /* Wait after HSync */
                                CCNT(timer2);
index e554caa0d18b02030fb87bae0048c7fc0e257f11..bf856503baf69666d4956a417db24ace9cc1e5a1 100644 (file)
  */
 extern struct platform_device corgiscoop_device;
 extern struct platform_device corgissp_device;
-extern struct platform_device corgifb_device;
 
 #endif /* __ASM_ARCH_CORGI_H  */
 
index 2b0fe773213adac40885c88b60db66825f6fcd23..3b1d4a72d4d1f08f43058e2a428939ba4b484cdd 100644 (file)
@@ -16,7 +16,7 @@ int corgi_ssp_max1111_get(unsigned long data);
  */
 
 struct corgits_machinfo {
-       unsigned long (*get_hsync_len)(void);
+       unsigned long (*get_hsync_invperiod)(void);
        void (*put_hsync)(void);
        void (*wait_hsync)(void);
 };
index 4953dd324d4d1e51630c48bce3d15eaf05a3a426..bd14365f7ed58cba919b9f24b7f0ad54e08493ae 100644 (file)
@@ -156,5 +156,3 @@ extern struct platform_device spitzscoop_device;
 extern struct platform_device spitzscoop2_device;
 extern struct platform_device spitzssp_device;
 extern struct sharpsl_charger_machinfo spitz_pm_machinfo;
-
-extern void spitz_lcd_power(int on, struct fb_var_screeninfo *var);