1 /* 2 * Allwinner SoCs display driver. 3 * 4 * Copyright (C) 2016 Allwinner. 5 * 6 * This file is licensed under the terms of the GNU General Public 7 * License version 2. This program is licensed "as is" without any 8 * warranty of any kind, whether express or implied. 9 */ 10 11 12 #ifndef __DISP_LCD_H__ 13 #define __DISP_LCD_H__ 14 15 #include "disp_private.h" 16 17 #define LCD_GPIO_NUM 8 18 #define LCD_POWER_NUM 4 19 #define LCD_POWER_STR_LEN 32 20 #define LCD_GPIO_REGU_NUM 3 21 #define LCD_GPIO_SCL (LCD_GPIO_NUM-2) 22 #define LCD_GPIO_SDA (LCD_GPIO_NUM-1) 23 24 struct disp_lcd_cfg { 25 bool lcd_used; 26 27 bool lcd_bl_en_used; 28 struct disp_gpio_info lcd_bl_en; 29 int lcd_bl_gpio_hdl; 30 char lcd_bl_en_power[LCD_POWER_STR_LEN]; 31 struct regulator *bl_regulator; 32 33 u32 lcd_power_used[LCD_POWER_NUM]; 34 char lcd_power[LCD_POWER_NUM][LCD_POWER_STR_LEN]; 35 struct regulator *regulator[LCD_POWER_NUM]; 36 37 #ifdef CONFIG_AW_DRM 38 u32 lcd_fix_power_used[LCD_POWER_NUM]; 39 char lcd_fix_power[LCD_POWER_NUM][LCD_POWER_STR_LEN]; 40 #endif 41 42 bool lcd_gpio_used[LCD_GPIO_NUM]; 43 struct disp_gpio_info lcd_gpio[LCD_GPIO_NUM]; 44 int gpio_hdl[LCD_GPIO_NUM]; 45 char lcd_gpio_power[LCD_GPIO_REGU_NUM][LCD_POWER_STR_LEN]; 46 struct regulator *gpio_regulator[LCD_GPIO_REGU_NUM]; 47 48 char lcd_pin_power[LCD_GPIO_REGU_NUM][LCD_POWER_STR_LEN]; 49 struct regulator *pin_regulator[LCD_GPIO_REGU_NUM]; 50 51 u32 backlight_bright; 52 /* 53 * IEP-drc backlight dimming rate: 54 * 0 -256 (256: no dimming; 0: the most dimming) 55 */ 56 u32 backlight_dimming; 57 u32 backlight_curve_adjust[101]; 58 59 u32 lcd_bright; 60 u32 lcd_contrast; 61 u32 lcd_saturation; 62 u32 lcd_hue; 63 }; 64 65 s32 disp_init_lcd(struct disp_bsp_init_para *para); 66 s32 disp_lcd_set_bright(struct disp_device *lcd, u32 bright); 67 s32 disp_lcd_get_bright(struct disp_device *lcd); 68 s32 disp_lcd_gpio_init(struct disp_device *lcd); 69 s32 disp_lcd_gpio_exit(struct disp_device *lcd); 70 s32 disp_lcd_gpio_set_direction(struct disp_device *lcd, u32 io_index, 71 u32 direction); 72 s32 disp_lcd_gpio_get_value(struct disp_device *lcd, u32 io_index); 73 s32 disp_lcd_gpio_set_value(struct disp_device *lcd, u32 io_index, u32 data); 74 s32 disp_lcd_is_enabled(struct disp_device *lcd); 75 void reload_lcd(void); 76 #if defined(SUPPORT_EINK) && defined(CONFIG_EINK_PANEL_USED) 77 extern int display_finish_flag; 78 #endif 79 80 #endif 81