| #ifndef _LCD_DRV_H_ |
| #define _LCD_DRV_H_ |
| |
| enum { |
| LCD_FORMAT_RGB565, |
| LCD_FORMAT_RGB1555, |
| LCD_FORMAT_RGB888_PACKED, |
| LCD_FORMAT_RGB888_UNPACKED, |
| LCD_FORMAT_RGBA888, /*ARGB*/ |
| LCD_FORMAT_YUV422_PACKED, |
| LCD_FORMAT_YUV422_PLANAR, |
| LCD_FORMAT_YUV420_PLANAR, |
| LCD_FORMAT_RGB888A, /*RGBA*/ |
| LCD_FORMAT_YUV420_SEMI, |
| LCD_FORMAT_LIMIT |
| }; |
| |
| enum { |
| LCD_ALPHA_LAYER, |
| LCD_ALPHA_PIXEL, |
| LCD_ALPHA_LIMIT |
| }; |
| |
| enum { |
| LCD_LAYER_IMG = 0, /* panel video path, the bottom layer */ |
| LCD_LAYER_OSD1, /* panel graphic path, the middle layer */ |
| LCD_LAYER_OSD2, /* tv graphic path, the top layer */ |
| LCD_LAYER_LIMIT |
| }; |
| |
| enum { |
| LCD_ALPHA_MODE_NORMAL, |
| LCD_ALPHA_MODE_PRE, |
| LCD_ALPHA_MODE_SPECIAL, |
| LCD_ALPHA_MODE_LIMIT |
| }; |
| |
| enum { |
| LCD_CK_MODE_Y, |
| LCD_CK_MODE_U, |
| LCD_CK_MODE_V, |
| LCD_CK_MODE_YUV, |
| LCD_CK_MODE_RGB, |
| LCD_CK_MODE_B, |
| LCD_CK_MODE_LUMA, |
| LCD_CK_MODE_LIMIT |
| }; |
| |
| enum { |
| LCD_DITHER_4X4, |
| LCD_DITHER_4X8, |
| LCD_DITHER_LIMIT |
| }; |
| |
| enum { |
| LCD_CB_FRAME_DONE, |
| LCD_CB_WB_DONE, |
| LCD_CB_LIMIT |
| }; |
| |
| struct s_color_key { |
| unsigned char ck_threshold1; |
| unsigned char ck_threshold2; |
| unsigned char ck_dest_value; |
| unsigned char ck_dest_alpha; |
| }; |
| |
| struct s_color_key_setting { |
| struct s_color_key ck_y; |
| struct s_color_key ck_u; |
| struct s_color_key ck_v; |
| unsigned short reserved; |
| unsigned char ck_mode; |
| unsigned char ck_en; |
| }; |
| |
| struct s_cbsh_setting { |
| unsigned short brightness; |
| unsigned short contrast; |
| unsigned short saturation; |
| unsigned short multiplier; |
| unsigned short hue_sin; |
| unsigned short hue_cos; |
| unsigned short reserved1; |
| unsigned char reserved2; |
| unsigned char cbsh_en; |
| }; |
| |
| struct s_dither_setting { |
| unsigned char dither_en; |
| unsigned char dither_mode; |
| unsigned short reserved; |
| }; |
| |
| struct s_point { |
| unsigned short x; |
| unsigned short y; |
| }; |
| |
| struct s_plane_buffer { |
| unsigned int addr; |
| unsigned short width; |
| unsigned short height; |
| unsigned short stride; |
| unsigned short reserved; |
| }; |
| |
| struct s_layer_setting { |
| unsigned char layer_en; |
| unsigned char format; |
| unsigned char alpha_sel; |
| unsigned char mirror_en; |
| struct s_plane_buffer src_buffer[3]; |
| struct s_point dest_point; |
| struct s_color_key_setting ck_setting; |
| struct s_cbsh_setting cbsh_setting; |
| unsigned int layer_alpha; |
| }; |
| |
| struct s_wb_setting { |
| unsigned char wb_en; |
| unsigned char format; |
| unsigned short reserved; |
| struct s_plane_buffer dest_buffer; |
| }; |
| |
| struct s_output_setting { |
| unsigned char format; |
| unsigned char type; |
| unsigned char te_pol; |
| unsigned char te_en; |
| unsigned char dsi_mode; |
| unsigned char hbp; |
| unsigned char hfp; |
| unsigned char hsync; |
| unsigned char vbp; |
| unsigned char vfp; |
| unsigned char vsync; |
| unsigned char reserved; |
| unsigned short height; |
| unsigned short width; |
| unsigned short data_lane_num; /*1 or 2*/ |
| unsigned short reserved2; |
| }; |
| |
| struct s_lcd_ctx { |
| unsigned int base_addr; |
| unsigned char alpha_mode; |
| unsigned char gamma_en; |
| unsigned short reserved; |
| unsigned int bg_color; |
| struct s_layer_setting layer_setting[3]; |
| struct s_wb_setting wb_setting; |
| struct s_output_setting output_setting; |
| struct s_dither_setting dither_setting; |
| }; |
| |
| u32 lcd_read(u32 reg); |
| void lcd_write(u32 reg, u32 val); |
| void lcd_set_bits(u32 reg, u32 bits); |
| void lcd_clear_bits(u32 reg, u32 bits); |
| void lcd_write_bits(u32 reg, u32 value, u32 mask, u32 shifts); |
| void lcd_reset_panel(void); |
| |
| struct s_lcd_ctx *lcd_init(void); |
| int lcd_enable_layer(struct s_lcd_ctx *lcd_ctx, unsigned int layer_id); |
| int lcd_disable_layer(struct s_lcd_ctx *lcd_ctx, unsigned int layer_id); |
| int lcd_refresh(struct s_lcd_ctx *lcd_ctx, int sync); |
| int lcd_wait_done(void); |
| int lcd_after_refresh(struct s_lcd_ctx *lcd_ctx); |
| int lcd_output_setting(struct s_lcd_ctx *lcd_ctx, struct panel_spec *panel); |
| void lcd_uninit(struct s_lcd_ctx *lcd_ctx); |
| void lcd_start(int wb, int sync, int video_mode); |
| #endif /*_LCD_DRV_H_*/ |