1225c9a8dSPaul Mundt #ifndef __ASM_SH_MOBILE_LCDC_H__ 2225c9a8dSPaul Mundt #define __ASM_SH_MOBILE_LCDC_H__ 3225c9a8dSPaul Mundt 4225c9a8dSPaul Mundt #include <linux/fb.h> 5225c9a8dSPaul Mundt 61430e006SGuennadi Liakhovetski enum { 71430e006SGuennadi Liakhovetski RGB8, /* 24bpp, 8:8:8 */ 8225c9a8dSPaul Mundt RGB9, /* 18bpp, 9:9 */ 9225c9a8dSPaul Mundt RGB12A, /* 24bpp, 12:12 */ 10225c9a8dSPaul Mundt RGB12B, /* 12bpp */ 11225c9a8dSPaul Mundt RGB16, /* 16bpp */ 12225c9a8dSPaul Mundt RGB18, /* 18bpp */ 13225c9a8dSPaul Mundt RGB24, /* 24bpp */ 141430e006SGuennadi Liakhovetski YUV422, /* 16bpp */ 15225c9a8dSPaul Mundt SYS8A, /* 24bpp, 8:8:8 */ 16225c9a8dSPaul Mundt SYS8B, /* 18bpp, 8:8:2 */ 17225c9a8dSPaul Mundt SYS8C, /* 18bpp, 2:8:8 */ 18225c9a8dSPaul Mundt SYS8D, /* 16bpp, 8:8 */ 19225c9a8dSPaul Mundt SYS9, /* 18bpp, 9:9 */ 20225c9a8dSPaul Mundt SYS12, /* 24bpp, 12:12 */ 21225c9a8dSPaul Mundt SYS16A, /* 16bpp */ 22225c9a8dSPaul Mundt SYS16B, /* 18bpp, 16:2 */ 23225c9a8dSPaul Mundt SYS16C, /* 18bpp, 2:16 */ 24225c9a8dSPaul Mundt SYS18, /* 18bpp */ 251430e006SGuennadi Liakhovetski SYS24, /* 24bpp */ 261430e006SGuennadi Liakhovetski }; 27225c9a8dSPaul Mundt 28225c9a8dSPaul Mundt enum { LCDC_CHAN_DISABLED = 0, 29225c9a8dSPaul Mundt LCDC_CHAN_MAINLCD, 30225c9a8dSPaul Mundt LCDC_CHAN_SUBLCD }; 31225c9a8dSPaul Mundt 32225c9a8dSPaul Mundt enum { LCDC_CLK_BUS, LCDC_CLK_PERIPHERAL, LCDC_CLK_EXTERNAL }; 33225c9a8dSPaul Mundt 34f400f510SMagnus Damm #define LCDC_FLAGS_DWPOL (1 << 0) /* Rising edge dot clock data latch */ 35f400f510SMagnus Damm #define LCDC_FLAGS_DIPOL (1 << 1) /* Active low display enable polarity */ 36f400f510SMagnus Damm #define LCDC_FLAGS_DAPOL (1 << 2) /* Active low display data polarity */ 37f400f510SMagnus Damm #define LCDC_FLAGS_HSCNT (1 << 3) /* Disable HSYNC during VBLANK */ 38f400f510SMagnus Damm #define LCDC_FLAGS_DWCNT (1 << 4) /* Disable dotclock during blanking */ 39f400f510SMagnus Damm 40225c9a8dSPaul Mundt struct sh_mobile_lcdc_sys_bus_cfg { 41225c9a8dSPaul Mundt unsigned long ldmt2r; 42225c9a8dSPaul Mundt unsigned long ldmt3r; 438564557aSMagnus Damm unsigned long deferred_io_msec; 44225c9a8dSPaul Mundt }; 45225c9a8dSPaul Mundt 46225c9a8dSPaul Mundt struct sh_mobile_lcdc_sys_bus_ops { 47225c9a8dSPaul Mundt void (*write_index)(void *handle, unsigned long data); 48225c9a8dSPaul Mundt void (*write_data)(void *handle, unsigned long data); 49225c9a8dSPaul Mundt unsigned long (*read_data)(void *handle); 50225c9a8dSPaul Mundt }; 51225c9a8dSPaul Mundt 526de9edd5SGuennadi Liakhovetski struct module; 53225c9a8dSPaul Mundt struct sh_mobile_lcdc_board_cfg { 546de9edd5SGuennadi Liakhovetski struct module *owner; 55225c9a8dSPaul Mundt void *board_data; 56225c9a8dSPaul Mundt int (*setup_sys)(void *board_data, void *sys_ops_handle, 57225c9a8dSPaul Mundt struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 58ef61aae4SMagnus Damm void (*start_transfer)(void *board_data, void *sys_ops_handle, 59ef61aae4SMagnus Damm struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 60c2439398SGuennadi Liakhovetski void (*display_on)(void *board_data, struct fb_info *info); 61225c9a8dSPaul Mundt void (*display_off)(void *board_data); 62*3b0fd9d7SAlexandre Courbot int (*set_brightness)(void *board_data, int brightness); 63*3b0fd9d7SAlexandre Courbot int (*get_brightness)(void *board_data); 64225c9a8dSPaul Mundt }; 65225c9a8dSPaul Mundt 66225c9a8dSPaul Mundt struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */ 67225c9a8dSPaul Mundt unsigned long width; 68225c9a8dSPaul Mundt unsigned long height; 69225c9a8dSPaul Mundt }; 70225c9a8dSPaul Mundt 71*3b0fd9d7SAlexandre Courbot /* backlight info */ 72*3b0fd9d7SAlexandre Courbot struct sh_mobile_lcdc_bl_info { 73*3b0fd9d7SAlexandre Courbot const char *name; 74*3b0fd9d7SAlexandre Courbot int max_brightness; 75*3b0fd9d7SAlexandre Courbot }; 76*3b0fd9d7SAlexandre Courbot 77225c9a8dSPaul Mundt struct sh_mobile_lcdc_chan_cfg { 78225c9a8dSPaul Mundt int chan; 79225c9a8dSPaul Mundt int bpp; 80225c9a8dSPaul Mundt int interface_type; /* selects RGBn or SYSn I/F, see above */ 81225c9a8dSPaul Mundt int clock_divider; 82f400f510SMagnus Damm unsigned long flags; /* LCDC_FLAGS_... */ 8344432407SGuennadi Liakhovetski const struct fb_videomode *lcd_cfg; 8444432407SGuennadi Liakhovetski int num_cfg; 85225c9a8dSPaul Mundt struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg; 86225c9a8dSPaul Mundt struct sh_mobile_lcdc_board_cfg board_cfg; 87*3b0fd9d7SAlexandre Courbot struct sh_mobile_lcdc_bl_info bl_info; 88225c9a8dSPaul Mundt struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */ 89225c9a8dSPaul Mundt }; 90225c9a8dSPaul Mundt 91225c9a8dSPaul Mundt struct sh_mobile_lcdc_info { 92225c9a8dSPaul Mundt int clock_source; 93225c9a8dSPaul Mundt struct sh_mobile_lcdc_chan_cfg ch[2]; 94225c9a8dSPaul Mundt }; 95225c9a8dSPaul Mundt 96225c9a8dSPaul Mundt #endif /* __ASM_SH_MOBILE_LCDC_H__ */ 97