From: 许盛飞 Date: Wed, 7 Nov 2012 03:46:01 +0000 (+0800) Subject: adc-battery: add battery-power decision method when reboot the system X-Git-Tag: firefly_0821_release~8266 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3398342781e5c67f5311453cea029f8585526087;p=firefly-linux-kernel-4.4.55.git adc-battery: add battery-power decision method when reboot the system --- diff --git a/arch/arm/mach-rk2928/include/mach/board.h b/arch/arm/mach-rk2928/include/mach/board.h index 34a8035f78ba..6ab45c5ddb0e 100755 --- a/arch/arm/mach-rk2928/include/mach/board.h +++ b/arch/arm/mach-rk2928/include/mach/board.h @@ -40,60 +40,6 @@ struct ts_hw_data { int touch_en_gpio; }; - -//#if defined CONFIG_BATTERY_RK30_ADC_FAC -/* adc battery */ -struct rk30_adc_battery_platform_data { - int (*io_init)(void); - int (*io_deinit)(void); - int (*is_dc_charging)(void); - int (*charging_ok)(void); - - int (*is_usb_charging)(void); - int spport_usb_charging ; - int (*control_usb_charging)(int); - - int dc_det_pin; - int batt_low_pin; - int charge_ok_pin; - int charge_set_pin; - - int dc_det_level; - int batt_low_level; - int charge_ok_level; - int charge_set_level; - - int adc_channel; - - int dc_det_pin_pull; //pull up/down enable/disbale - int batt_low_pin_pull; - int charge_ok_pin_pull; - int charge_set_pin_pull; - - int low_voltage_protection; // low voltage protection - - int charging_sleep; // don't have lock,if chargeing_sleep = 0;else have lock - - - int save_capacity; //save capacity to /data/bat_last_capacity.dat, suggested use - - int reference_voltage; // the rK2928 is 3300;RK3066 and rk29 are 2500;rk3066B is 1800; - int pull_up_res; //divider resistance , pull-up resistor - int pull_down_res; //divider resistance , pull-down resistor - - int time_down_discharge; //the time of capactiy drop 1% --discharge - int time_up_charge; //the time of capacity up 1% ---charging - - int use_board_table; - int table_size; - int *discharge_table; - int *charge_table; - int *property_tabel; - int *board_batt_table; - -}; -//#endif - #ifndef _LINUX_WLAN_PLAT_H_ struct wifi_platform_data { int (*set_power)(int val); diff --git a/arch/arm/mach-rk30/include/mach/board.h b/arch/arm/mach-rk30/include/mach/board.h index 9b070b853f6a..4e96f5ed77c5 100644 --- a/arch/arm/mach-rk30/include/mach/board.h +++ b/arch/arm/mach-rk30/include/mach/board.h @@ -11,56 +11,6 @@ #include #include #include -/* adc battery */ -struct rk30_adc_battery_platform_data { - int (*io_init)(void); - int (*io_deinit)(void); - int (*is_dc_charging)(void); - int (*charging_ok)(void); - - int (*is_usb_charging)(void); - int spport_usb_charging ; - int (*control_usb_charging)(int); - - int dc_det_pin; - int batt_low_pin; - int charge_ok_pin; - int charge_set_pin; - - int dc_det_level; - int batt_low_level; - int charge_ok_level; - int charge_set_level; - - int adc_channel; - - int dc_det_pin_pull; //pull up/down enable/disbale - int batt_low_pin_pull; - int charge_ok_pin_pull; - int charge_set_pin_pull; - - int low_voltage_protection; // low voltage protection - - int charging_sleep; // don't have lock,if chargeing_sleep = 0;else have lock - - - int save_capacity; //save capacity to /data/bat_last_capacity.dat, suggested use - - int reference_voltage; // the rK2928 is 3300;RK3066 and rk29 are 2500;rk3066B is 1800; - int pull_up_res; //divider resistance , pull-up resistor - int pull_down_res; //divider resistance , pull-down resistor - - int time_down_discharge; //the time of capactiy drop 1% --discharge - int time_up_charge; //the time of capacity up 1% ---charging - - int use_board_table; - int table_size; - int *discharge_table; - int *charge_table; - int *property_tabel; - int *board_batt_table; - -}; #ifndef _LINUX_WLAN_PLAT_H_ struct wifi_platform_data { diff --git a/arch/arm/plat-rk/include/plat/board.h b/arch/arm/plat-rk/include/plat/board.h index 63053b939655..d687ad00809a 100755 --- a/arch/arm/plat-rk/include/plat/board.h +++ b/arch/arm/plat-rk/include/plat/board.h @@ -264,6 +264,61 @@ struct rk29_vmac_platform_data { int (*rmii_power_control)(int enable); int(*rmii_speed_switch)(int speed); }; +//#if defined CONFIG_BATTERY_RK30_ADC_FAC +/* adc battery */ +struct rk30_adc_battery_platform_data { + int (*io_init)(void); + int (*io_deinit)(void); + int (*is_dc_charging)(void); + int (*charging_ok)(void); + + int (*is_usb_charging)(void); + int spport_usb_charging ; + int (*control_usb_charging)(int); + + int is_reboot_charging; + + int dc_det_pin; + int batt_low_pin; + int charge_ok_pin; + int charge_set_pin; + + int dc_det_level; + int batt_low_level; + int charge_ok_level; + int charge_set_level; + + int adc_channel; + + int dc_det_pin_pull; //pull up/down enable/disbale + int batt_low_pin_pull; + int charge_ok_pin_pull; + int charge_set_pin_pull; + + int low_voltage_protection; // low voltage protection + + int charging_sleep; // don't have lock,if chargeing_sleep = 0;else have lock + + + int save_capacity; //save capacity to /data/bat_last_capacity.dat, suggested use + + int reference_voltage; // the rK2928 is 3300;RK3066 and rk29 are 2500;rk3066B is 1800; + int pull_up_res; //divider resistance , pull-up resistor + int pull_down_res; //divider resistance , pull-down resistor + + int time_down_discharge; //the time of capactiy drop 1% --discharge + int time_up_charge; //the time of capacity up 1% ---charging + + int use_board_table; + int table_size; + int *discharge_table; + int *charge_table; + int *property_tabel; + int *board_batt_table; + +}; +//#endif + #define BOOT_MODE_NORMAL 0 #define BOOT_MODE_FACTORY2 1 diff --git a/drivers/power/rk30_factory_adc_battery.c b/drivers/power/rk30_factory_adc_battery.c index 6b02d55392ba..840e5acd0561 100644 --- a/drivers/power/rk30_factory_adc_battery.c +++ b/drivers/power/rk30_factory_adc_battery.c @@ -1070,7 +1070,12 @@ static void rk30_adc_battery_poweron_capacity_check(void) // //2£©Èç¹û²»ÕâÑù×ö£¬¶Ìʱ¼ä¹Ø»úÔÙ¿ª»ú£¬Ç°ºóÈÝÁ¿²»Ò»ÖÂÓÖ¸ÃÔõô°ì£¿ // //3£©Ò»ÏÂÄÇÖÖ·½Ê½ºÏÊÊ£¿ //gBatteryData->bat_capacity = new_capacity; - gBatteryData->bat_capacity = (new_capacity > old_capacity) ? new_capacity : old_capacity; + // gBatteryData->bat_capacity = (new_capacity > old_capacity) ? new_capacity : old_capacity; + if( gBatteryData ->pdata->is_reboot_charging == 1) + gBatteryData->bat_capacity = old_capacity; + else + gBatteryData->bat_capacity = (new_capacity > old_capacity) ? new_capacity : old_capacity; + }else{ if(new_capacity > old_capacity + 50 )