]> Pileus Git - ~andy/linux/commitdiff
video: atmel_lcdfb: fix platform data struct
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Thu, 28 Mar 2013 14:53:42 +0000 (22:53 +0800)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 27 Sep 2013 06:26:19 +0000 (09:26 +0300)
Today we mix pdata and drivers data in the struct atmel_lcdfb_info
Fix it and introduce a new struct atmel_lcdfb_pdata for platform data only

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
21 files changed:
arch/arm/mach-at91/at91sam9261_devices.c
arch/arm/mach-at91/at91sam9263_devices.c
arch/arm/mach-at91/at91sam9g45_devices.c
arch/arm/mach-at91/at91sam9rl_devices.c
arch/arm/mach-at91/board-sam9261ek.c
arch/arm/mach-at91/board-sam9263ek.c
arch/arm/mach-at91/board-sam9m10g45ek.c
arch/arm/mach-at91/board-sam9rlek.c
arch/arm/mach-at91/board.h
arch/avr32/boards/atngw100/evklcd10x.c
arch/avr32/boards/atngw100/mrmt.c
arch/avr32/boards/atstk1000/atstk1000.h
arch/avr32/boards/atstk1000/setup.c
arch/avr32/boards/favr-32/setup.c
arch/avr32/boards/hammerhead/setup.c
arch/avr32/boards/merisc/display.c
arch/avr32/boards/mimc200/setup.c
arch/avr32/mach-at32ap/at32ap700x.c
arch/avr32/mach-at32ap/include/mach/board.h
drivers/video/atmel_lcdfb.c
include/video/atmel_lcdc.h

index 629ea5fc95cf74e2cf72a145d3ea80c4d98aa4b3..b2a34740146aaab4d3af99b741979c670be6402e 100644 (file)
@@ -465,7 +465,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
 
 #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
 static u64 lcdc_dmamask = DMA_BIT_MASK(32);
-static struct atmel_lcdfb_info lcdc_data;
+static struct atmel_lcdfb_pdata lcdc_data;
 
 static struct resource lcdc_resources[] = {
        [0] = {
@@ -498,7 +498,7 @@ static struct platform_device at91_lcdc_device = {
        .num_resources  = ARRAY_SIZE(lcdc_resources),
 };
 
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
 {
        if (!data) {
                return;
@@ -559,7 +559,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
        platform_device_register(&at91_lcdc_device);
 }
 #else
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
 #endif
 
 
index 858c8aac2daf06328ed99de3b56987647f81b33d..4aeadddbc18108918b883150bef49b3a770eeb42 100644 (file)
@@ -832,7 +832,7 @@ void __init at91_add_device_can(struct at91_can_data *data) {}
 
 #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
 static u64 lcdc_dmamask = DMA_BIT_MASK(32);
-static struct atmel_lcdfb_info lcdc_data;
+static struct atmel_lcdfb_pdata lcdc_data;
 
 static struct resource lcdc_resources[] = {
        [0] = {
@@ -859,7 +859,7 @@ static struct platform_device at91_lcdc_device = {
        .num_resources  = ARRAY_SIZE(lcdc_resources),
 };
 
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
 {
        if (!data)
                return;
@@ -891,7 +891,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
        platform_device_register(&at91_lcdc_device);
 }
 #else
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
 #endif
 
 
index acb703e13331e2a9931bb321d7c1f9f71d550f11..cb36fa872d305d6f22b9133d48d3bdaaa678789d 100644 (file)
@@ -965,7 +965,7 @@ void __init at91_add_device_isi(struct isi_platform_data *data,
 
 #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
 static u64 lcdc_dmamask = DMA_BIT_MASK(32);
-static struct atmel_lcdfb_info lcdc_data;
+static struct atmel_lcdfb_pdata lcdc_data;
 
 static struct resource lcdc_resources[] = {
        [0] = {
@@ -991,7 +991,7 @@ static struct platform_device at91_lcdc_device = {
        .num_resources  = ARRAY_SIZE(lcdc_resources),
 };
 
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
 {
        if (!data)
                return;
@@ -1037,7 +1037,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
        platform_device_register(&at91_lcdc_device);
 }
 #else
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
 #endif
 
 
index 352468f265a9616bb411fecc503a13a933e926b2..a698bdab2cce682fee2983e0942d5bc2126139e4 100644 (file)
@@ -498,7 +498,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) {}
 
 #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
 static u64 lcdc_dmamask = DMA_BIT_MASK(32);
-static struct atmel_lcdfb_info lcdc_data;
+static struct atmel_lcdfb_pdata lcdc_data;
 
 static struct resource lcdc_resources[] = {
        [0] = {
@@ -525,7 +525,7 @@ static struct platform_device at91_lcdc_device = {
        .num_resources  = ARRAY_SIZE(lcdc_resources),
 };
 
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
 {
        if (!data) {
                return;
@@ -557,7 +557,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
        platform_device_register(&at91_lcdc_device);
 }
 #else
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
 #endif
 
 
index d3437624ca4e213092132bd6a16195e8668a9d7e..4ab1ba7557e429ed368611794e7ffda01412ab4f 100644 (file)
@@ -401,7 +401,7 @@ static void at91_lcdc_stn_power_control(int on)
        }
 }
 
-static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
        .default_bpp                    = 1,
        .default_dmacon                 = ATMEL_LCDC_DMAEN,
        .default_lcdcon2                = AT91SAM9261_DEFAULT_STN_LCDCON2,
@@ -453,7 +453,7 @@ static void at91_lcdc_tft_power_control(int on)
                at91_set_gpio_value(AT91_PIN_PA12, 1);  /* power down */
 }
 
-static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
        .lcdcon_is_backlight            = true,
        .default_bpp                    = 16,
        .default_dmacon                 = ATMEL_LCDC_DMAEN,
@@ -465,7 +465,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
 #endif
 
 #else
-static struct atmel_lcdfb_info __initdata ek_lcdc_data;
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
 #endif
 
 
index 3284df05df14be82b8bf7acce98ef090ccf09b56..0fdae3f1541da10fb6511c77081e8f323ba3fa81 100644 (file)
@@ -281,7 +281,7 @@ static void at91_lcdc_power_control(int on)
 }
 
 /* Driver datas */
-static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
        .lcdcon_is_backlight            = true,
        .default_bpp                    = 16,
        .default_dmacon                 = ATMEL_LCDC_DMAEN,
@@ -292,7 +292,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
 };
 
 #else
-static struct atmel_lcdfb_info __initdata ek_lcdc_data;
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
 #endif
 
 
index 2a94896a1375029b8eb34e030981480ad35acd10..ef39078c8ce214973352a22055421d7404cb4952 100644 (file)
@@ -284,7 +284,7 @@ static struct fb_monspecs at91fb_default_monspecs = {
                                        | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
 
 /* Driver datas */
-static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
        .lcdcon_is_backlight            = true,
        .default_bpp                    = 32,
        .default_dmacon                 = ATMEL_LCDC_DMAEN,
@@ -295,7 +295,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
 };
 
 #else
-static struct atmel_lcdfb_info __initdata ek_lcdc_data;
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
 #endif
 
 
index aa265dcf212875651da778e9213177b7e41803de..b77d7a9febd8a4f07c66a7250acaf52df798ddad 100644 (file)
@@ -179,7 +179,7 @@ static void at91_lcdc_power_control(int on)
 }
 
 /* Driver datas */
-static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
        .lcdcon_is_backlight            = true,
        .default_bpp                    = 16,
        .default_dmacon                 = ATMEL_LCDC_DMAEN,
@@ -191,7 +191,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
 };
 
 #else
-static struct atmel_lcdfb_info __initdata ek_lcdc_data;
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
 #endif
 
 
index 4a234fb2ab3b80d73dbdfa6bafc1cf7a08253287..6c08b341167d308df456eb1a0e79b4f10b5a9e00 100644 (file)
@@ -107,8 +107,8 @@ extern void __init at91_add_device_pwm(u32 mask);
 extern void __init at91_add_device_ssc(unsigned id, unsigned pins);
 
  /* LCD Controller */
-struct atmel_lcdfb_info;
-extern void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data);
+struct atmel_lcdfb_pdata;
+extern void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data);
 
  /* AC97 */
 extern void __init at91_add_device_ac97(struct ac97c_platform_data *data);
index 20388750d56447ee92324ee50cadfc0dacb5c89b..dc4280413e9dc10441b50fb7e43fa047910a801c 100644 (file)
@@ -58,7 +58,7 @@ static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
        .dclkmax                = 28330000,
 };
 
-static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
        .default_bpp            = 16,
        .default_dmacon         = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
        .default_lcdcon2        = (ATMEL_LCDC_DISTYPE_TFT
@@ -96,7 +96,7 @@ static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
        .dclkmax                = 7000000,
 };
 
-static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
        .default_bpp            = 16,
        .default_dmacon         = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
        .default_lcdcon2        = (ATMEL_LCDC_DISTYPE_TFT
@@ -134,7 +134,7 @@ static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
        .dclkmax                = 6400000,
 };
 
-static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
        .default_bpp            = 16,
        .default_dmacon         = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
        .default_lcdcon2        = (ATMEL_LCDC_DISTYPE_TFT
index 7de083d19b7ee0b5cf9f63a14f953b7311a1564e..1ba09e4c02b14d08c1bc0211866e43c1aec5735f 100644 (file)
@@ -83,7 +83,7 @@ static struct fb_monspecs __initdata lcd_fb_default_monspecs = {
        .dclkmax                = 9260000,
 };
 
-static struct atmel_lcdfb_info __initdata rmt_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata rmt_lcdc_data = {
        .default_bpp            = 24,
        .default_dmacon         = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
        .default_lcdcon2        = (ATMEL_LCDC_DISTYPE_TFT
@@ -126,7 +126,7 @@ static struct fb_monspecs __initdata lcd_fb_default_monspecs = {
        .dclkmax                = 9260000,
 };
 
-static struct atmel_lcdfb_info __initdata rmt_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata rmt_lcdc_data = {
        .default_bpp            = 24,
        .default_dmacon         = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
        .default_lcdcon2        = (ATMEL_LCDC_DISTYPE_TFT
index 9392d3252865a6886025167fe151e7356acf8f64..653cc09e536c7555272b2d2988f6db67ffa61ce9 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H
 #define __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H
 
-extern struct atmel_lcdfb_info atstk1000_lcdc_data;
+extern struct atmel_lcdfb_pdata atstk1000_lcdc_data;
 
 void atstk1000_setup_j2_leds(void);
 
index 2d6b560115d9fa19c250f52a0a6e7c27bea27e81..b6b88f5e0b43a6d1e8c330e512021ec27935e7d5 100644 (file)
@@ -55,7 +55,7 @@ static struct fb_monspecs __initdata atstk1000_default_monspecs = {
        .dclkmax                = 30000000,
 };
 
-struct atmel_lcdfb_info __initdata atstk1000_lcdc_data = {
+struct atmel_lcdfb_pdata __initdata atstk1000_lcdc_data = {
        .default_bpp            = 24,
        .default_dmacon         = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
        .default_lcdcon2        = (ATMEL_LCDC_DISTYPE_TFT
index 27bd6fbe21cb5f76253ad88f50f4a12c13f9778e..7b1f2cd854008c16117cf5c39c06f4bd2115a9fa 100644 (file)
@@ -125,7 +125,7 @@ static struct fb_monspecs __initdata favr32_default_monspecs = {
        .dclkmax                = 28000000,
 };
 
-struct atmel_lcdfb_info __initdata favr32_lcdc_data = {
+struct atmel_lcdfb_pdata __initdata favr32_lcdc_data = {
        .default_bpp            = 16,
        .default_dmacon         = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
        .default_lcdcon2        = (ATMEL_LCDC_DISTYPE_TFT
index 9d1efd1cd42534076307d59c1444a663c3b8764d..dc0e317f2ecdddc62c23939dd0863749c4491de8 100644 (file)
@@ -77,7 +77,7 @@ static struct fb_monspecs __initdata hammerhead_hda350t_monspecs = {
        .dclkmax                = 10000000,
 };
 
-struct atmel_lcdfb_info __initdata hammerhead_lcdc_data = {
+struct atmel_lcdfb_pdata __initdata hammerhead_lcdc_data = {
        .default_bpp            = 24,
        .default_dmacon         = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
        .default_lcdcon2        = (ATMEL_LCDC_DISTYPE_TFT
index 85a543cd4abcf26c3e517975029b8b694f197999..e7683ee7ed408d8ebe46930bf9ee4cb6a0885e91 100644 (file)
@@ -45,7 +45,7 @@ static struct fb_monspecs merisc_fb_monspecs = {
        .dclkmax        = 30000000,
 };
 
-struct atmel_lcdfb_info merisc_lcdc_data = {
+struct atmel_lcdfb_pdata merisc_lcdc_data = {
        .default_bpp            = 24,
        .default_dmacon         = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
        .default_lcdcon2        = (ATMEL_LCDC_DISTYPE_TFT
index 05358aa5ef7d210ed42d2bb6f68be48b3fa4c690..1cb8e9cc5cfaedb6d00ed8e589393531c37bf4ed 100644 (file)
@@ -8,7 +8,7 @@
  * published by the Free Software Foundation.
  */
 
-extern struct atmel_lcdfb_info mimc200_lcdc_data;
+extern struct atmel_lcdfb_pdata mimc200_lcdc_data;
 
 #include <linux/clk.h>
 #include <linux/etherdevice.h>
@@ -71,7 +71,7 @@ static struct fb_monspecs __initdata mimc200_default_monspecs = {
        .dclkmax                = 25200000,
 };
 
-struct atmel_lcdfb_info __initdata mimc200_lcdc_data = {
+struct atmel_lcdfb_pdata __initdata mimc200_lcdc_data = {
        .default_bpp            = 16,
        .default_dmacon         = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
        .default_lcdcon2        = (ATMEL_LCDC_DISTYPE_TFT
index a68f3cf7c3c1bda0f3d02dc8d45672a4f3db0793..a1f4d1e91b522e03f486b41759a1b25a2d44e36f 100644 (file)
@@ -1439,7 +1439,7 @@ fail:
  *  LCDC
  * -------------------------------------------------------------------- */
 #if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002)
-static struct atmel_lcdfb_info atmel_lcdfb0_data;
+static struct atmel_lcdfb_pdata atmel_lcdfb0_data;
 static struct resource atmel_lcdfb0_resource[] = {
        {
                .start          = 0xff000000,
@@ -1467,12 +1467,12 @@ static struct clk atmel_lcdfb0_pixclk = {
 };
 
 struct platform_device *__init
-at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
+at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_pdata *data,
                     unsigned long fbmem_start, unsigned long fbmem_len,
                     u64 pin_mask)
 {
        struct platform_device *pdev;
-       struct atmel_lcdfb_info *info;
+       struct atmel_lcdfb_pdata *info;
        struct fb_monspecs *monspecs;
        struct fb_videomode *modedb;
        unsigned int modedb_size;
@@ -1529,7 +1529,7 @@ at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
        }
 
        info = pdev->dev.platform_data;
-       memcpy(info, data, sizeof(struct atmel_lcdfb_info));
+       memcpy(info, data, sizeof(struct atmel_lcdfb_pdata));
        info->default_monspecs = monspecs;
 
        pdev->name = "at32ap-lcdfb";
index d485b0391357cab467faefab4e07ba20e0aad2ac..f1a316d52c738b0bac6653c876c3c7c817f28a66 100644 (file)
@@ -44,9 +44,9 @@ struct platform_device *
 at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n);
 void at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b, unsigned int n);
 
-struct atmel_lcdfb_info;
+struct atmel_lcdfb_pdata;
 struct platform_device *
-at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
+at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_pdata *data,
                     unsigned long fbmem_start, unsigned long fbmem_len,
                     u64 pin_mask);
 
index 3f7d6dc3408db19b3cb2b14661d4ad0310c74704..0d7214df1237690998db6734df0cacbd56bd219c 100644 (file)
 #include <linux/gfp.h>
 #include <linux/module.h>
 #include <linux/platform_data/atmel.h>
+#include <video/of_display_timing.h>
 
 #include <mach/cpu.h>
 #include <asm/gpio.h>
 
 #include <video/atmel_lcdc.h>
 
+struct atmel_lcdfb_config {
+       bool have_alt_pixclock;
+       bool have_hozval;
+       bool have_intensity_bit;
+};
+
+ /* LCD Controller info data structure, stored in device platform_data */
+struct atmel_lcdfb_info {
+       spinlock_t              lock;
+       struct fb_info          *info;
+       void __iomem            *mmio;
+       int                     irq_base;
+       struct work_struct      task;
+
+       unsigned int            smem_len;
+       struct platform_device  *pdev;
+       struct clk              *bus_clk;
+       struct clk              *lcdc_clk;
+
+       struct backlight_device *backlight;
+       u8                      bl_power;
+       u8                      saved_lcdcon;
+
+       u32                     pseudo_palette[16];
+       bool                    have_intensity_bit;
+
+       struct atmel_lcdfb_pdata pdata;
+
+       struct atmel_lcdfb_config *config;
+};
+
 #define lcdc_readl(sinfo, reg)         __raw_readl((sinfo)->mmio+(reg))
 #define lcdc_writel(sinfo, reg, val)   __raw_writel((val), (sinfo)->mmio+(reg))
 
 #define ATMEL_LCDC_DMA_BURST_LEN       8       /* words */
 #define ATMEL_LCDC_FIFO_SIZE           512     /* words */
 
-struct atmel_lcdfb_config {
-       bool have_alt_pixclock;
-       bool have_hozval;
-       bool have_intensity_bit;
-};
-
 static struct atmel_lcdfb_config at91sam9261_config = {
        .have_hozval            = true,
        .have_intensity_bit     = true,
@@ -248,15 +274,17 @@ static void exit_backlight(struct atmel_lcdfb_info *sinfo)
 
 static void init_contrast(struct atmel_lcdfb_info *sinfo)
 {
+       struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
+
        /* contrast pwm can be 'inverted' */
-       if (sinfo->lcdcon_pol_negative)
+       if (pdata->lcdcon_pol_negative)
                        contrast_ctr &= ~(ATMEL_LCDC_POL_POSITIVE);
 
        /* have some default contrast/backlight settings */
        lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr);
        lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, ATMEL_LCDC_CVAL_DEFAULT);
 
-       if (sinfo->lcdcon_is_backlight)
+       if (pdata->lcdcon_is_backlight)
                init_backlight(sinfo);
 }
 
@@ -299,9 +327,11 @@ static unsigned long compute_hozval(struct atmel_lcdfb_info *sinfo,
 
 static void atmel_lcdfb_stop_nowait(struct atmel_lcdfb_info *sinfo)
 {
+       struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
+
        /* Turn off the LCD controller and the DMA controller */
        lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
-                       sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET);
+                       pdata->guard_time << ATMEL_LCDC_GUARDT_OFFSET);
 
        /* Wait for the LCDC core to become idle */
        while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY)
@@ -321,9 +351,11 @@ static void atmel_lcdfb_stop(struct atmel_lcdfb_info *sinfo)
 
 static void atmel_lcdfb_start(struct atmel_lcdfb_info *sinfo)
 {
-       lcdc_writel(sinfo, ATMEL_LCDC_DMACON, sinfo->default_dmacon);
+       struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
+
+       lcdc_writel(sinfo, ATMEL_LCDC_DMACON, pdata->default_dmacon);
        lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
-               (sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET)
+               (pdata->guard_time << ATMEL_LCDC_GUARDT_OFFSET)
                | ATMEL_LCDC_PWR);
 }
 
@@ -424,6 +456,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
 {
        struct device *dev = info->device;
        struct atmel_lcdfb_info *sinfo = info->par;
+       struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
        unsigned long clk_value_khz;
 
        clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000;
@@ -510,7 +543,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
                else
                        var->green.length = 6;
 
-               if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
+               if (pdata->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
                        /* RGB:5X5 mode */
                        var->red.offset = var->green.length + 5;
                        var->blue.offset = 0;
@@ -527,7 +560,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
                var->transp.length = 8;
                /* fall through */
        case 24:
-               if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
+               if (pdata->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
                        /* RGB:888 mode */
                        var->red.offset = 16;
                        var->blue.offset = 0;
@@ -576,6 +609,7 @@ static void atmel_lcdfb_reset(struct atmel_lcdfb_info *sinfo)
 static int atmel_lcdfb_set_par(struct fb_info *info)
 {
        struct atmel_lcdfb_info *sinfo = info->par;
+       struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
        unsigned long hozval_linesz;
        unsigned long value;
        unsigned long clk_value_khz;
@@ -637,7 +671,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
 
 
        /* Initialize control register 2 */
-       value = sinfo->default_lcdcon2;
+       value = pdata->default_lcdcon2;
 
        if (!(info->var.sync & FB_SYNC_HOR_HIGH_ACT))
                value |= ATMEL_LCDC_INVLINE_INVERTED;
@@ -741,6 +775,7 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red,
                             unsigned int transp, struct fb_info *info)
 {
        struct atmel_lcdfb_info *sinfo = info->par;
+       struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
        unsigned int val;
        u32 *pal;
        int ret = 1;
@@ -777,8 +812,7 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red,
                                 */
                        } else {
                                /* new style BGR:565 / RGB:565 */
-                               if (sinfo->lcd_wiring_mode ==
-                                   ATMEL_LCDC_WIRING_RGB) {
+                               if (pdata->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
                                        val  = ((blue >> 11) & 0x001f);
                                        val |= ((red  >>  0) & 0xf800);
                                } else {
@@ -918,7 +952,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct fb_info *info;
        struct atmel_lcdfb_info *sinfo;
-       struct atmel_lcdfb_info *pdata_sinfo;
+       struct atmel_lcdfb_pdata *pdata;
        struct fb_videomode fbmode;
        struct resource *regs = NULL;
        struct resource *map = NULL;
@@ -936,17 +970,8 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
        sinfo = info->par;
 
        if (dev_get_platdata(dev)) {
-               pdata_sinfo = dev_get_platdata(dev);
-               sinfo->default_bpp = pdata_sinfo->default_bpp;
-               sinfo->default_dmacon = pdata_sinfo->default_dmacon;
-               sinfo->default_lcdcon2 = pdata_sinfo->default_lcdcon2;
-               sinfo->default_monspecs = pdata_sinfo->default_monspecs;
-               sinfo->atmel_lcdfb_power_control = pdata_sinfo->atmel_lcdfb_power_control;
-               sinfo->guard_time = pdata_sinfo->guard_time;
-               sinfo->smem_len = pdata_sinfo->smem_len;
-               sinfo->lcdcon_is_backlight = pdata_sinfo->lcdcon_is_backlight;
-               sinfo->lcdcon_pol_negative = pdata_sinfo->lcdcon_pol_negative;
-               sinfo->lcd_wiring_mode = pdata_sinfo->lcd_wiring_mode;
+               pdata = dev_get_platdata(dev);
+               sinfo->pdata = *pdata;
        } else {
                dev_err(dev, "cannot get default configuration\n");
                goto free_info;
@@ -962,7 +987,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
        info->pseudo_palette = sinfo->pseudo_palette;
        info->fbops = &atmel_lcdfb_ops;
 
-       memcpy(&info->monspecs, sinfo->default_monspecs, sizeof(info->monspecs));
+       memcpy(&info->monspecs, pdata->default_monspecs, sizeof(info->monspecs));
        info->fix = atmel_lcdfb_fix;
 
        /* Enable LCDC Clocks */
@@ -980,7 +1005,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
 
        ret = fb_find_mode(&info->var, info, NULL, info->monspecs.modedb,
                        info->monspecs.modedb_len, info->monspecs.modedb,
-                       sinfo->default_bpp);
+                       pdata->default_bpp);
        if (!ret) {
                dev_err(dev, "no suitable video mode found\n");
                goto stop_clk;
@@ -1097,8 +1122,8 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
        fb_add_videomode(&fbmode, &info->modelist);
 
        /* Power up the LCDC screen */
-       if (sinfo->atmel_lcdfb_power_control)
-               sinfo->atmel_lcdfb_power_control(1);
+       if (pdata->atmel_lcdfb_power_control)
+               pdata->atmel_lcdfb_power_control(1);
 
        dev_info(dev, "fb%d: Atmel LCDC at 0x%08lx (mapped at %p), irq %d\n",
                       info->node, info->fix.mmio_start, sinfo->mmio, sinfo->irq_base);
@@ -1141,15 +1166,17 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct fb_info *info = dev_get_drvdata(dev);
        struct atmel_lcdfb_info *sinfo;
+       struct atmel_lcdfb_pdata *pdata;
 
        if (!info || !info->par)
                return 0;
        sinfo = info->par;
+       pdata = &sinfo->pdata;
 
        cancel_work_sync(&sinfo->task);
        exit_backlight(sinfo);
-       if (sinfo->atmel_lcdfb_power_control)
-               sinfo->atmel_lcdfb_power_control(0);
+       if (pdata->atmel_lcdfb_power_control)
+               pdata->atmel_lcdfb_power_control(0);
        unregister_framebuffer(info);
        atmel_lcdfb_stop_clock(sinfo);
        clk_put(sinfo->lcdc_clk);
@@ -1176,6 +1203,7 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
 {
        struct fb_info *info = platform_get_drvdata(pdev);
        struct atmel_lcdfb_info *sinfo = info->par;
+       struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
 
        /*
         * We don't want to handle interrupts while the clock is
@@ -1185,8 +1213,8 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
 
        sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR);
        lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0);
-       if (sinfo->atmel_lcdfb_power_control)
-               sinfo->atmel_lcdfb_power_control(0);
+       if (pdata->atmel_lcdfb_power_control)
+               pdata->atmel_lcdfb_power_control(0);
 
        atmel_lcdfb_stop(sinfo);
        atmel_lcdfb_stop_clock(sinfo);
@@ -1198,11 +1226,12 @@ static int atmel_lcdfb_resume(struct platform_device *pdev)
 {
        struct fb_info *info = platform_get_drvdata(pdev);
        struct atmel_lcdfb_info *sinfo = info->par;
+       struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
 
        atmel_lcdfb_start_clock(sinfo);
        atmel_lcdfb_start(sinfo);
-       if (sinfo->atmel_lcdfb_power_control)
-               sinfo->atmel_lcdfb_power_control(1);
+       if (pdata->atmel_lcdfb_power_control)
+               pdata->atmel_lcdfb_power_control(1);
        lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon);
 
        /* Enable FIFO & DMA errors */
index 0f5a2fc69af9971606a1b07185e6f366bf21fbec..f197c54712b09ceef3307bc2c56df721ede2f9ba 100644 (file)
 #define ATMEL_LCDC_WIRING_BGR  0
 #define ATMEL_LCDC_WIRING_RGB  1
 
-struct atmel_lcdfb_config;
 
  /* LCD Controller info data structure, stored in device platform_data */
-struct atmel_lcdfb_info {
-       spinlock_t              lock;
-       struct fb_info          *info;
-       void __iomem            *mmio;
-       int                     irq_base;
-       struct work_struct      task;
-
+struct atmel_lcdfb_pdata {
        unsigned int            guard_time;
-       unsigned int            smem_len;
-       struct platform_device  *pdev;
-       struct clk              *bus_clk;
-       struct clk              *lcdc_clk;
-
-#ifdef CONFIG_BACKLIGHT_ATMEL_LCDC
-       struct backlight_device *backlight;
-       u8                      bl_power;
-#endif
        bool                    lcdcon_is_backlight;
        bool                    lcdcon_pol_negative;
-       u8                      saved_lcdcon;
-
        u8                      default_bpp;
        u8                      lcd_wiring_mode;
        unsigned int            default_lcdcon2;
        unsigned int            default_dmacon;
        void (*atmel_lcdfb_power_control)(int on);
        struct fb_monspecs      *default_monspecs;
-       u32                     pseudo_palette[16];
-
-       struct atmel_lcdfb_config *config;
 };
 
 #define ATMEL_LCDC_DMABADDR1   0x00