TFT液晶屏驱动移植

1、打开 arch/arm/mach-s3c2440/mach-smdk2440.c,先删除之前的 LCD 设备平台代码

/* LCD driver info */

static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {

      ……

}

static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {

      ……

}

--------------------------------------------------------------------------------

2、再把已经移植好的代码加入,如下:

/* LCD driver info */

//2440 3.5LCD的配置和参数设置

#if defined(CONFIG_FB_S3C2410_W320240)

#define LCD_WIDTH 320

#define LCD_HEIGHT 240

#define LCD_PIXCLOCK 100000

#define LCD_RIGHT_MARGIN 23

#define LCD_LEFT_MARGIN 18

#define LCD_HSYNC_LEN 43

#define LCD_UPPER_MARGIN 6

#define LCD_LOWER_MARGIN 4

#define LCD_VSYNC_LEN 14

 

//NEC 3.5LCD的配置和参数设置

#elif defined(CONFIG_FB_S3C2410_N240320)

#define LCD_WIDTH 240

#define LCD_HEIGHT 320

#define LCD_PIXCLOCK 100000

#define LCD_RIGHT_MARGIN 36

#define LCD_LEFT_MARGIN 19

#define LCD_HSYNC_LEN 5

#define LCD_UPPER_MARGIN 1

#define LCD_LOWER_MARGIN 5

#define LCD_VSYNC_LEN 1 

 

//夏普 8LCD的配置和参数设置

#elif defined(CONFIG_FB_S3C2410_TFT640480)

#define LCD_WIDTH 640

#define LCD_HEIGHT 480

#define LCD_PIXCLOCK 80000

#define LCD_RIGHT_MARGIN 67 

#define LCD_LEFT_MARGIN 40

#define LCD_HSYNC_LEN 31

#define LCD_UPPER_MARGIN 25

#define LCD_LOWER_MARGIN 5

#define LCD_VSYNC_LEN 1

 

//统宝 3.5LCD的配置和参数设置

#elif defined(CONFIG_FB_S3C2410_T240320)

#define LCD_WIDTH 240

#define LCD_HEIGHT 320

#define LCD_PIXCLOCK 146250//170000

#define LCD_RIGHT_MARGIN 25

#define LCD_LEFT_MARGIN 0

#define LCD_HSYNC_LEN 4

#define LCD_UPPER_MARGIN 1

#define LCD_LOWER_MARGIN 4

#define LCD_VSYNC_LEN 1

 

//群创 7LCD的配置和参数设置

#elif defined(CONFIG_FB_S3C2410_TFT800480)

#define LCD_WIDTH 800

#define LCD_HEIGHT 480

#define LCD_PIXCLOCK 11463 //40000

#define LCD_RIGHT_MARGIN 67

#define LCD_LEFT_MARGIN 40

#define LCD_HSYNC_LEN 31

#define LCD_UPPER_MARGIN 25

#define LCD_LOWER_MARGIN 5

#define LCD_VSYNC_LEN 1

 

//LCD2VGA(分辨率为 1024x768)模块的配置和参数设置

#elif defined(CONFIG_FB_S3C2410_VGA1024768)

#define LCD_WIDTH 1024

#define LCD_HEIGHT 768

#define LCD_PIXCLOCK 80000

#define LCD_RIGHT_MARGIN 15

#define LCD_LEFT_MARGIN 199

#define LCD_HSYNC_LEN 15

#define LCD_UPPER_MARGIN 1

#define LCD_LOWER_MARGIN 1

#define LCD_VSYNC_LEN 1

#define LCD_CON5 (S3C2410_LCDCON5_FRM565 | S3C2410_LCDCON5_HWSWP)

#endif

 

#if defined (LCD_WIDTH)

static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {

#if !defined (LCD_CON5)

        .lcdcon5        = S3C2410_LCDCON5_FRM565 |

                          S3C2410_LCDCON5_INVVLINE |

                          S3C2410_LCDCON5_INVVFRAME |

                          S3C2410_LCDCON5_PWREN |

                          S3C2410_LCDCON5_HWSWP,

#else

        .lcdcon5        = LCD_CON5,

#endif

        .type          = S3C2410_LCDCON1_TFT,

 

        .width          = LCD_WIDTH,

        .height        = LCD_HEIGHT,

 

        .pixclock      = LCD_PIXCLOCK,

        .xres          = LCD_WIDTH,

        .yres          = LCD_HEIGHT,

        .bpp            = 16,

        .left_margin    = LCD_LEFT_MARGIN + 1,

        .right_margin  = LCD_RIGHT_MARGIN + 1,

        .hsync_len      = LCD_HSYNC_LEN + 1,

        .upper_margin  = LCD_UPPER_MARGIN + 1,

        .lower_margin  = LCD_LOWER_MARGIN + 1,

        .vsync_len      = LCD_VSYNC_LEN + 1,

};

 

static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {

        .displays      = &smdk2440_lcd_cfg,

        .num_displays  = 1,

        .default_display = 0,

 

        .gpccon =      0xaa955699,

        .gpccon_mask =  0xffc003cc,

        .gpcup =        0x0000ffff,

        .gpcup_mask =  0xffffffff,

 

        .gpdcon =      0xaa95aaa1,

        .gpdcon_mask =  0xffc0fff0,

        .gpdup =        0x0000faff,

        .gpdup_mask =  0xffffffff,

 

        .lpcsel        = 0xf82,

};

#endif

注:我只试过第一个配置,其它配置本人未测试过。

--------------------------------------------------------------------------------

3  打开 drivers/video/Kconfig,加入以下配置信息:

 

 

config FB_S3C2410_DEBUG

       bool "S3C2410 lcd debug messages"

       depends on FB_S3C2410

       help

         Turn on debugging messages. Note that you can set/unset at run time

         through sysfs

 

choice

prompt "LCD select"

depends on FB_S3C2410

help

  3C24x0 LCD size select

config FB_S3C2410_W320240

boolean "3.5 inch 320X240 WANXIN LCD"

depends on FB_S3C2410

help

  3.5 inch 240X320 WANXIN LCD

 

config FB_S3C2410_T240320

boolean "3.5 inch 240X320 Toppoly LCD"

depends on FB_S3C2410

help

  3.5 inch 240X320 Toppoly LCD

 

config FB_S3C2410_N240320

boolean "3.5 inch 240X320 NEC LCD"

depends on FB_S3C2410

help

  3.5 inch 240x320 NEC LCD

 

config FB_S3C2410_TFT640480

boolean "8 inch 640X480 L80 LCD"

depends on FB_S3C2410

help

  8 inch 640X480 LCD

 

config FB_S3C2410_TFT800480

boolean "7 inch 800x480 TFT LCD"

depends on FB_S3C2410

help

  7 inch 800x480 TFT LCD

 

config FB_S3C2410_VGA1024768

boolean "VGA 1024x768"

depends on FB_S3C2410

help

  VGA 1024x768

endchoice 

config BACKLIGHT_SMDK2440

-----------------------------------------------------------------------

4、配置内核

Device Drivers  --->

Graphics support  --->

<*> Support for frame buffer devices  --->

  Enable firmware EDID

      Enable Video Mode Handling Helpers

    <*>  S3C2410 LCD framebuffer support

        LCD select (3.5 inch 320X240 WANXIN LCD)  --->

 

你可能感兴趣的:(TFT液晶屏驱动移植)