blob: c5248e214b5deaceb3f07355c8ffd92e6559601c
1 | /* |
2 | * include/amlogic/aml_lcd.h |
3 | * |
4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by |
6 | * the Free Software Foundation; either version 2 of the named License, |
7 | * or any later version. |
8 | * |
9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. |
13 | * |
14 | */ |
15 | |
16 | #ifndef INC_AML_LCD_H |
17 | #define INC_AML_LCD_H |
18 | |
19 | #include <common.h> |
20 | #include <linux/list.h> |
21 | #include <amlogic/aml_lcd_vout.h> |
22 | #ifdef CONFIG_AML_LCD_EXTERN |
23 | #include <amlogic/aml_lcd_extern.h> |
24 | #endif |
25 | #ifdef CONFIG_AML_BL_EXTERN |
26 | #include <amlogic/aml_bl_extern.h> |
27 | #endif |
28 | |
29 | #ifdef CONFIG_SYS_I2C_AML |
30 | #define LCD_EXT_I2C_BUS_0 1 //A |
31 | #define LCD_EXT_I2C_BUS_1 2 //B |
32 | #define LCD_EXT_I2C_BUS_2 3 //C |
33 | #define LCD_EXT_I2C_BUS_3 4 //D |
34 | #define LCD_EXT_I2C_BUS_4 0 //AO |
35 | #define LCD_EXT_I2C_BUS_MAX 0xff |
36 | |
37 | #else |
38 | #define LCD_EXT_I2C_BUS_0 0 //A |
39 | #define LCD_EXT_I2C_BUS_1 1 //B |
40 | #define LCD_EXT_I2C_BUS_2 2 //C |
41 | #define LCD_EXT_I2C_BUS_3 3 //D |
42 | #define LCD_EXT_I2C_BUS_4 4 //AO |
43 | #define LCD_EXT_I2C_BUS_MAX 0xff |
44 | |
45 | #endif |
46 | |
47 | #define LCD_EXT_I2C_BUS_INVALID 0xff |
48 | #define LCD_EXT_I2C_ADDR_INVALID 0xff |
49 | #define LCD_EXT_GPIO_INVALID 0xff |
50 | |
51 | #define LCD_EXT_SPI_CLK_FREQ_DFT 10 /* unit: KHz */ |
52 | |
53 | |
54 | #define LCD_EXT_CMD_TYPE_CMD_DELAY 0x00 |
55 | #define LCD_EXT_CMD_TYPE_CMD2_DELAY 0x01 /* for i2c device 2nd addr */ |
56 | #define LCD_EXT_CMD_TYPE_NONE 0x10 |
57 | #define LCD_EXT_CMD_TYPE_CMD 0xc0 |
58 | #define LCD_EXT_CMD_TYPE_CMD2 0xc1 /* for i2c device 2nd addr */ |
59 | #define LCD_EXT_CMD_TYPE_GPIO 0xf0 |
60 | #define LCD_EXT_CMD_TYPE_CHECK 0xfc |
61 | #define LCD_EXT_CMD_TYPE_DELAY 0xfd |
62 | #define LCD_EXT_CMD_TYPE_END 0xff |
63 | |
64 | #define LCD_EXT_CMD_SIZE_DYNAMIC 0xff |
65 | #define LCD_EXT_DYNAMIC_SIZE_INDEX 1 |
66 | |
67 | |
68 | #define Rsv_val 0xffffffff |
69 | struct ext_lcd_config_s { |
70 | const char panel_type[15]; |
71 | int lcd_type; // LCD_TTL /LCD_LVDS/LCD_VBYONE |
72 | unsigned char lcd_bits; |
73 | |
74 | unsigned short h_active; |
75 | unsigned short v_active; |
76 | unsigned short h_period; |
77 | unsigned short v_period; |
78 | unsigned short hsync_width; |
79 | unsigned short hsync_bp; |
80 | unsigned short hsync_pol; |
81 | unsigned short vsync_width; |
82 | unsigned short vsync_bp; |
83 | unsigned short vsync_pol; |
84 | |
85 | unsigned int customer_val_0; //fr_adjust_type |
86 | unsigned int customer_val_1; //ss_level |
87 | unsigned int customer_val_2; //clk_auto_generate |
88 | unsigned int customer_val_3; //pixel clock(unit in Hz) |
89 | unsigned int customer_val_4; |
90 | unsigned int customer_val_5; |
91 | unsigned int customer_val_6; |
92 | unsigned int customer_val_7; |
93 | unsigned int customer_val_8; |
94 | unsigned int customer_val_9; |
95 | |
96 | int lcd_spc_val0; |
97 | int lcd_spc_val1; |
98 | int lcd_spc_val2; |
99 | int lcd_spc_val3; |
100 | int lcd_spc_val4; |
101 | int lcd_spc_val5; |
102 | int lcd_spc_val6; |
103 | int lcd_spc_val7; |
104 | int lcd_spc_val8; |
105 | int lcd_spc_val9; |
106 | |
107 | struct lcd_power_step_s *power_on_step; |
108 | struct lcd_power_step_s *power_off_step; |
109 | |
110 | /* backlight */ |
111 | unsigned int level_default; |
112 | unsigned int level_max; |
113 | unsigned int level_min; |
114 | unsigned int level_mid; |
115 | unsigned int level_mid_mapping; |
116 | |
117 | unsigned int bl_method; |
118 | unsigned int bl_en_gpio; |
119 | unsigned short bl_en_gpio_on; |
120 | unsigned short bl_en_gpio_off; |
121 | unsigned short bl_power_on_delay; |
122 | unsigned short bl_power_off_delay; |
123 | |
124 | unsigned int pwm_method; |
125 | unsigned int pwm_port; |
126 | unsigned int pwm_freq; |
127 | unsigned int pwm_duty_max; |
128 | unsigned int pwm_duty_min; |
129 | unsigned int pwm_gpio; |
130 | unsigned int pwm_gpio_off; |
131 | |
132 | unsigned int pwm2_method; |
133 | unsigned int pwm2_port; |
134 | unsigned int pwm2_freq; |
135 | unsigned int pwm2_duty_max; |
136 | unsigned int pwm2_duty_min; |
137 | unsigned int pwm2_gpio; |
138 | unsigned int pwm2_gpio_off; |
139 | |
140 | unsigned int pwm_level_max; |
141 | unsigned int pwm_level_min; |
142 | unsigned int pwm2_level_max; |
143 | unsigned int pwm2_level_min; |
144 | |
145 | unsigned int pwm_on_delay; |
146 | unsigned int pwm_off_delay; |
147 | |
148 | /* backlight extern */ |
149 | unsigned int bl_ext_index; |
150 | }; |
151 | |
152 | #define LCD_NUM_MAX 10 |
153 | |
154 | extern struct ext_lcd_config_s ext_lcd_config[LCD_NUM_MAX]; |
155 | |
156 | #endif /* INC_AML_LCD_H */ |
157 |