From fdb523185743e026b5b69f896ab5afc47909d8b0 Mon Sep 17 00:00:00 2001 From: xhh Date: Sat, 13 Sep 2014 11:22:51 +0800 Subject: [PATCH] =?utf8?q?86v:=E7=94=B5=E6=B1=A0=E6=A3=80=E6=B5=8B?= =?utf8?q?=EF=BC=8C=E6=91=84=E5=83=8F=E5=A4=B4=E7=9A=84=E6=95=B4=E7=90=86?= =?utf8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- arch/arm/boot/dts/rk3126-86v.dts | 12 +-- arch/arm/boot/dts/rk3126-cif-sensor.dtsi | 6 +- arch/arm/configs/rk3126_86v_defconfig | 16 ++++ drivers/power/rk30_factory_adc_battery.c | 42 +++++++++- .../linux/power/rk30_factory_adc_battery.h | 82 ------------------- 5 files changed, 66 insertions(+), 92 deletions(-) mode change 100644 => 100755 drivers/power/rk30_factory_adc_battery.c delete mode 100755 include/linux/power/rk30_factory_adc_battery.h diff --git a/arch/arm/boot/dts/rk3126-86v.dts b/arch/arm/boot/dts/rk3126-86v.dts index 70794e07c672..2d570af31005 100755 --- a/arch/arm/boot/dts/rk3126-86v.dts +++ b/arch/arm/boot/dts/rk3126-86v.dts @@ -25,7 +25,7 @@ wireless-wlan { compatible = "wlan-platdata"; - wifi_chip_type = "rtl8188eu"; + wifi_chip_type = "rtkwifi"; sdio_vref = <1800>; //1800mv or 3300mv //power_ctrl_by_pmu; @@ -70,7 +70,7 @@ 200000 1100000 300000 1100000 400000 1100000 - 533000 1100000 + 533000 1250000 >; freq-table = < @@ -101,8 +101,8 @@ /* KHz uV */ //200000 1250000 300000 1100000 - 400000 1100000 - 480000 1200000 + 400000 1150000 + 480000 1250000 //300000 1250000 >; @@ -251,8 +251,8 @@ //bat_low_gpio = <&gpio0 GPIO_A7 GPIO_ACTIVE_LOW>; //chg_ok_gpio = <&gpio0 GPIO_B1 GPIO_ACTIVE_HIGH>; bat_table = <0 0 0 0 100 100 - 3500 3729 3860 3910 3959 4000 4044 4086 4150 4208 4250 - 3750 3900 4020 4080 4125 4185 4215 4240 4275 4295 4300 + 3500 3619 3678 3734 3742 3783 3813 3884 3968 4110 4220 + 3750 3710 3770 3830 3850 3880 3910 3980 4060 4240 4300 >; is_dc_charge = <1>; is_usb_charge = <0>; diff --git a/arch/arm/boot/dts/rk3126-cif-sensor.dtsi b/arch/arm/boot/dts/rk3126-cif-sensor.dtsi index c056d7e9eb98..f9d26410f421 100755 --- a/arch/arm/boot/dts/rk3126-cif-sensor.dtsi +++ b/arch/arm/boot/dts/rk3126-cif-sensor.dtsi @@ -59,10 +59,11 @@ is_front = <1>; rockchip,power = <&gpio2 GPIO_B2 GPIO_ACTIVE_HIGH>; rockchip,powerdown = <&gpio1 GPIO_B2 GPIO_ACTIVE_HIGH>; + pwdn_active = ; + pwr_active = ; mir = <0>; flash_attach = <0>; resolution = ; - pwdn_info = ; powerup_sequence = ; orientation = <0>; i2c_add = ; @@ -77,10 +78,11 @@ is_front = <0>; rockchip,power = <&gpio2 GPIO_B2 GPIO_ACTIVE_HIGH>; rockchip,powerdown = <&gpio1 GPIO_B1 GPIO_ACTIVE_HIGH>; + pwdn_active = ; + pwr_active = ; mir = <0>; flash_attach = <0>; resolution = ; - pwdn_info = ; powerup_sequence = ; orientation = <0>; i2c_add = ; diff --git a/arch/arm/configs/rk3126_86v_defconfig b/arch/arm/configs/rk3126_86v_defconfig index 74f3989490a3..c42a54bee390 100755 --- a/arch/arm/configs/rk3126_86v_defconfig +++ b/arch/arm/configs/rk3126_86v_defconfig @@ -210,6 +210,7 @@ CONFIG_RFKILL=y CONFIG_RFKILL_RK=y CONFIG_DEVTMPFS=y CONFIG_DMA_CMA=y +CONFIG_CMA_SIZE_MBYTES=4 CONFIG_BLK_DEV_LOOP=y CONFIG_UID_STAT=y CONFIG_SRAM=y @@ -332,6 +333,10 @@ CONFIG_SPI_ROCKCHIP_DMA=y CONFIG_SPI_ROCKCHIP_TEST=y CONFIG_DEBUG_GPIO=y CONFIG_GPIO_SYSFS=y +CONFIG_CHARGER_RT5025=y +CONFIG_BATTERY_RT5025=y +CONFIG_CHARGER_RT5036=y +CONFIG_RT_POWER=y CONFIG_BATTERY_RICOH619=y CONFIG_BATTERY_BQ24296=y CONFIG_BATTERY_BQ27320=y @@ -339,6 +344,13 @@ CONFIG_BATTERY_RK30_ADC_FAC=y CONFIG_CW2015_BATTERY=y CONFIG_SENSORS_ROCKCHIP_TSADC=y CONFIG_THERMAL=y +CONFIG_MFD_RT5025=y +CONFIG_MISC_RT5025=y +CONFIG_IRQ_RT5025=y +CONFIG_DEBUG_RT5025=y +CONFIG_MFD_RT5036=y +CONFIG_MISC_RT5036=y +CONFIG_IRQ_RT5036=y CONFIG_MFD_RK808=y CONFIG_MFD_RK818=y CONFIG_MFD_RICOH619=y @@ -346,6 +358,8 @@ CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_ACT8846=y CONFIG_ACT8846_SUPPORT_RESET=y +CONFIG_REGULATOR_RT5025=y +CONFIG_REGULATOR_RT5036=y CONFIG_ROCKCHIP_PWM_REGULATOR=y CONFIG_REGULATOR_SYR82X=y CONFIG_REGULATOR_RICOH619=y @@ -358,6 +372,7 @@ CONFIG_V4L_PLATFORM_DRIVERS=y CONFIG_GC0308=y # CONFIG_GC0329 is not set CONFIG_GC2035=y +# CONFIG_OV2659 is not set CONFIG_MALI_MIDGARD=m CONFIG_MALI_MIDGARD_DVFS=y CONFIG_MALI_MIDGARD_RT_PM=y @@ -517,6 +532,7 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y CONFIG_SWITCH=y CONFIG_RTC_CLASS=y CONFIG_RTC_HYM8563=y +CONFIG_RTC_RT5036=y CONFIG_RTC_DRV_RC5T619=y CONFIG_STAGING=y CONFIG_ZSMALLOC=y diff --git a/drivers/power/rk30_factory_adc_battery.c b/drivers/power/rk30_factory_adc_battery.c old mode 100644 new mode 100755 index 157e21e122ef..b07d98f37393 --- a/drivers/power/rk30_factory_adc_battery.c +++ b/drivers/power/rk30_factory_adc_battery.c @@ -44,6 +44,7 @@ #include #include +#include #ifdef CONFIG_EARLYSUSPEND /* kernel/power/earlysuspend.c */ extern suspend_state_t get_suspend_state(void); @@ -60,8 +61,8 @@ do {\ #define TIMER_MS_COUNTS 1000 #define SLOPE_SECOND_COUNTS 15 -#define DISCHARGE_MIN_SECOND 60 -#define CHARGE_MIN_SECOND 45 +#define DISCHARGE_MIN_SECOND 30 +#define CHARGE_MIN_SECOND 30 #define CHARGE_MID_SECOND 90 #define CHARGE_MAX_SECOND 250 #define CHARGE_FULL_DELAY_TIMES 10 @@ -104,6 +105,7 @@ int gDoubleVoltageCnt = 6800; unsigned long gSecondsCnt = 0; char gDischargeFlag[4] = {"on "}; +int pwr_hold; #if 1 #define BATT_MAX_VOL_VALUE 4250/*Full charge volatge*/ @@ -245,6 +247,35 @@ static bool batt_gpio_is_valid(int number) return number > 0 && number < 256; } +static void v86_pm_power_off(void) +{ + + bool isCharging = false; + if (batt_gpio_is_valid(gBatteryData->pdata->dc_det_pin)){ + if (gpio_get_value (gBatteryData->pdata->dc_det_pin) == gBatteryData->pdata->dc_det_level){ + isCharging = 1; + }else{ + isCharging = 0; + } + } + //gpio_direction_output(pwr_hold, GPIO_LOW); + printk("xhh ========= v86_pm_power_off \n"); + gpio_request(pwr_hold, NULL); + //mdelay(500); + if(isCharging) + { + printk("xhh ========= isCharging \n"); + arm_pm_restart('h', "charge"); + } + else + { + printk("xhh ========= power off \n"); + gpio_direction_output(pwr_hold, RK30_GPIO_LOW); + gpio_set_value(pwr_hold,RK30_GPIO_LOW); + } + while(1); + +} #ifdef BATTERY_APK //#define BAT_ADC_TABLE_LEN 11 @@ -2179,6 +2210,10 @@ rk30_adc_battery_platform_data *data) if (batt_gpio_is_valid(data->charge_ok_pin)) data->charge_ok_level = (flags & OF_GPIO_ACTIVE_LOW) ? RK30_GPIO_LOW : RK30_GPIO_HIGH; + pwr_hold = of_get_named_gpio_flags(node, "pwr_hold", 0, + &flags); + if (pwr_hold == -EPROBE_DEFER) + printk("%s pwr_hold error\n",__func__); ret = of_property_read_u32(node, "is_dc_charge", &value); if (ret < 0) { @@ -2291,6 +2326,9 @@ static int rk30_adc_battery_probe(struct platform_device *pdev) //register adc for battery sample + if (!pm_power_off) { + pm_power_off = v86_pm_power_off; + } data->wq = create_singlethread_workqueue("adc_battd"); //variable init diff --git a/include/linux/power/rk30_factory_adc_battery.h b/include/linux/power/rk30_factory_adc_battery.h deleted file mode 100755 index c794a10be86c..000000000000 --- a/include/linux/power/rk30_factory_adc_battery.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * RockChip ADC Battery Driver - * Copyright (C) 2012, RockChip - * - * Authors: xuhuicong - * - * Based on rk30_adc_battery.c - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#ifndef RK30_FACTORY_ADC_BATTERY_H -#define RK30_FACTORY_ADC_BATTERY_H - - -/* 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 usb_det_pin; - int dc_det_pin; - int batt_low_pin; - int charge_ok_pin; - int charge_set_pin; - int back_light_pin; - - int ctrl_charge_led_pin; - int ctrl_charge_enable; - void (*ctrl_charge_led)(int); - - int dc_det_level; - int batt_low_level; - int charge_ok_level; - int charge_set_level; - int usb_det_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 is_reboot_charging; - 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; - int *dts_batt_table; - -int is_dc_charge; -int is_usb_charge; - struct iio_channel *chan; - -}; - -#endif -- 2.34.1