2 #define CONFIG_ERR(v, name) do { printk("%s: Invalid parameter: %s(%d)\n", __func__, (name), (v)); } while(0)
4 #define CONFIG_ERR(v, name)
6 #include <plat/config.h>
10 uint key_adc = DEF_KEY_ADC;
11 module_param(key_adc, uint, 0644);
12 uint key_val_size = 6;
13 uint key_val[] = {DEF_PLAY_KEY, DEF_VOLDN_KEY, DEF_VOLUP_KEY, DEF_MENU_KEY, DEF_ESC_KEY, DEF_HOME_KEY};
14 module_param_array(key_val, uint, &key_val_size, 0644);
15 static inline int check_key_param(void)
21 static int bl_en = DEF_BL_EN;
22 module_param(bl_en, int, 0644);
23 static uint bl_pwmid = DEF_BL_PWMID;
24 module_param(bl_pwmid, uint, 0644);
26 static uint bl_pwm_mode =DEF_BL_PWM_MOD;
28 static uint bl_mode = DEF_BL_MOD;
29 module_param(bl_mode, uint, 0644);
30 static uint bl_div = DEF_BL_DIV;
31 module_param(bl_div, uint, 0644);
32 static uint bl_ref = DEF_BL_REF;
33 module_param(bl_ref, uint, 0644);
34 static uint bl_min = DEF_BL_MIN;
35 module_param(bl_min, uint, 0644);
36 static uint bl_max = DEF_BL_MAX;
37 module_param(bl_max, uint, 0644);
39 static inline int check_bl_param(void){
40 if(bl_pwmid < 0 || bl_pwmid > 3){
41 CONFIG_ERR(bl_pwmid, "bl_pwm");
44 if(bl_ref != 0 && bl_ref != 1){
45 CONFIG_ERR(bl_ref, "bl_ref");
48 if(bl_min < 0||bl_min > 255){
49 CONFIG_ERR(bl_min, "bl_min");
52 if(bl_max < 0||bl_max > 255){
53 CONFIG_ERR(bl_max, "bl_max");
61 static int lcd_cs = DEF_LCD_CS;
62 module_param(lcd_cs, int, 0644);
63 static int lcd_en = DEF_LCD_EN;
64 module_param(lcd_en, int, 0644);
65 static int lcd_std = DEF_LCD_STD;
66 module_param(lcd_std, int, 0644);
68 static inline int check_lcd_param(void)
72 uint lcd_param[LCD_PARAM_MAX] = DEF_LCD_PARAM;
73 module_param_array(lcd_param, uint, NULL, 0644);
77 int codec_type = DEF_CODEC_TYPE;
78 module_param(codec_type, int, 0644);
79 int codec_power = DEF_CODEC_POWER;
80 module_param(codec_power, int, 0644);
81 int codec_rst = DEF_CODEC_RST;
82 module_param(codec_rst, int, 0644);
83 int codec_hdmi_irq = DEF_CODEC_HDMI_IRQ;
84 module_param(codec_hdmi_irq, int, 0644);
85 static int spk_ctl = DEF_SPK_CTL;
86 module_param(spk_ctl, int, 0644);
87 static int hp_det = DEF_HP_DET;
88 module_param(hp_det, int, 0644);
89 static int codec_i2c = DEF_CODEC_I2C; // i2c channel
90 module_param(codec_i2c, int, 0644);
91 static int codec_addr = DEF_CODEC_ADDR; // i2c addr
92 module_param(codec_addr, int, 0644);
93 static inline int check_codec_param(void)
99 static int tp_type = DEF_TP_TYPE;
100 module_param(tp_type, int, 0644);
101 static int tp_irq = DEF_TP_IRQ;
102 module_param(tp_irq, int, 0644);
103 static int tp_rst =DEF_TP_RST;
104 module_param(tp_rst, int, 0644);
105 static int tp_i2c = DEF_TP_I2C; // i2c channel
106 module_param(tp_i2c, int, 0644);
107 static int tp_addr = DEF_TP_ADDR; // i2c addr
108 module_param(tp_addr, int, 0644);
109 static int tp_xmax = DEF_X_MAX;
110 module_param(tp_xmax, int, 0644);
111 static int tp_ymax = DEF_Y_MAX;
112 module_param(tp_ymax, int, 0644);
113 static int tp_firmVer= DEF_FIRMVER;
114 module_param(tp_firmVer, int, 0644);
115 static inline int check_tp_param(void)
117 if(tp_type == TP_TYPE_NONE)
119 if(tp_type < TP_TYPE_NONE || tp_type > TP_TYPE_MAX){
120 CONFIG_ERR(tp_type, "tp_type");
123 if(tp_i2c < 0 || tp_i2c > 3){
124 CONFIG_ERR(tp_i2c, "tp_i2c");
127 if(tp_addr < 0 || tp_addr > 0x7f){
128 CONFIG_ERR(tp_addr, "tp_addr");
132 if(tp_xmax < 0 || tp_xmax >1920){
133 CONFIG_ERR(tp_xmax, "tp_xmax");
137 if(tp_ymax < 0 || tp_ymax >1920){
138 CONFIG_ERR(tp_ymax, "tp_ymax");
146 static int gs_type = DEF_GS_TYPE;
147 module_param(gs_type, int, 0644);
148 static int gs_irq = DEF_GS_IRQ;
149 module_param(gs_irq, int, 0644);
150 static int gs_i2c = DEF_GS_I2C;
151 module_param(gs_i2c, int, 0644);
152 static int gs_addr = DEF_GS_ADDR;
153 module_param(gs_addr, int, 0644);
154 static int gs_orig[9] = DEF_GS_ORIG;
155 module_param_array(gs_orig, int, NULL, 0644);
156 static inline int check_gs_param(void)
159 if(gs_type == GS_TYPE_NONE)
161 if(gs_type < GS_TYPE_NONE || gs_type > GS_TYPE_MAX){
162 CONFIG_ERR(gs_type, "gs_type");
165 if(gs_i2c < 0 || gs_i2c > 3){
166 CONFIG_ERR(gs_i2c, "gs_i2c");
169 if(gs_addr < 0 || gs_addr > 0x7f){
170 CONFIG_ERR(gs_i2c, "gs_addr");
173 for(i = 0; i < 9; i++){
174 if(gs_orig[i] != 1 && gs_orig[i] != 0 && gs_orig[i] != -1)
176 CONFIG_ERR(gs_orig[i], "gs_orig[x]");
184 static int dc_det = DEF_DC_DET;
185 module_param(dc_det, int, 0644);
186 static int bat_low = DEF_BAT_LOW;
187 module_param(bat_low, int, 0644);
188 static int chg_ok = DEF_CHG_OK;
189 module_param(chg_ok, int, 0644);
190 static int chg_set = DEF_CHG_SET;
191 module_param(chg_set, int, 0644);
192 static int usb_det = DEF_USB_DET;
193 module_param(usb_det, int, 0644);
194 static int ref_vol = DEF_REF_VOL;
195 module_param(ref_vol, int, 0644);
196 static int up_res = DEF_UP_RES;
197 module_param(up_res, int, 0644);
198 static int down_res = DEF_DOWN_RES;
199 module_param(down_res, int, 0644);
200 static int root_chg = DEF_ROOT_CHG;
201 module_param(root_chg, int, 0644);
202 static int save_cap = DEF_SAVE_CAP;
203 module_param(save_cap, int, 0644);
204 static int low_vol = DEF_LOW_VOL;
205 module_param(low_vol, int, 0644);
206 int bat_charge[11] = DEF_BAT_CHARGE;
207 module_param_array(bat_charge, int, NULL, 0644);
208 int bat_discharge[11] = DEF_BAT_DISCHARGE;
209 module_param_array(bat_discharge, int, NULL, 0644);
210 static inline int check_chg_param(void)
216 int wifi_type = DEF_WIFI_TYPE;
217 module_param(wifi_type, int, 0644);
218 int wifi_pwr = DEF_WIFI_POWER;
219 module_param(wifi_pwr, int, 0644);
220 static inline int check_wifi_param(void)
226 static int pwr_on = DEF_PWR_ON;
227 module_param(pwr_on, int, 0644);
228 static inline int rk_power_on(void)
231 ret=port_output_init(pwr_on, 1, "pwr_on");
233 CONFIG_ERR(pwr_on, "pwr_on");
235 port_output_on(pwr_on);