From 596def0b693e6ac944fefa190c86a2c08cab1660 Mon Sep 17 00:00:00 2001 From: linjh Date: Wed, 24 Oct 2012 18:48:50 +0800 Subject: [PATCH] rk2928-phonepad: update power charger support [reference files] arch/arm/configs/rk2928_phonepad_defconfig arch/arm/mach-rk2928/board-rk2928-phonepad.c --- arch/arm/configs/rk2928_phonepad_defconfig | 1 + arch/arm/mach-rk2928/board-rk2928-phonepad.c | 40 +++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/arch/arm/configs/rk2928_phonepad_defconfig b/arch/arm/configs/rk2928_phonepad_defconfig index 516bc85ed0d3..8bcc680122fa 100644 --- a/arch/arm/configs/rk2928_phonepad_defconfig +++ b/arch/arm/configs/rk2928_phonepad_defconfig @@ -274,6 +274,7 @@ CONFIG_POWER_SUPPLY=y CONFIG_BATTERY_RK30_ADC_FAC=y CONFIG_BATTERY_RK30_AC_CHARGE=y CONFIG_BATTERY_RK30_VOL3V8=y +CONFIG_POWER_ON_CHARGER_DISPLAY=y # CONFIG_HWMON is not set CONFIG_MFD_TPS65910=y CONFIG_MFD_TPS65090=y diff --git a/arch/arm/mach-rk2928/board-rk2928-phonepad.c b/arch/arm/mach-rk2928/board-rk2928-phonepad.c index d58e9bb6aea0..bb1dfd5a444d 100755 --- a/arch/arm/mach-rk2928/board-rk2928-phonepad.c +++ b/arch/arm/mach-rk2928/board-rk2928-phonepad.c @@ -448,13 +448,51 @@ static struct sensor_platform_data ps_ap321xx_info = { #endif #if defined(CONFIG_BATTERY_RK30_ADC)||defined(CONFIG_BATTERY_RK30_ADC_FAC) +#define CHARGE_OK_PIN RK2928_PIN1_PA0 +#define DC_DET_PIN RK2928_PIN1_PA5 +int rk30_battery_adc_io_init(void){ + int ret = 0; + + //dc charge detect pin + ret = gpio_request(DC_DET_PIN, NULL); + if (ret) { + printk("failed to request dc_det gpio\n"); + return ret ; + } + + gpio_pull_updown(DC_DET_PIN, 0);//important + ret = gpio_direction_input(DC_DET_PIN); + if (ret) { + printk("failed to set gpio dc_det input\n"); + return ret ; + } + + //charge ok pin + ret = gpio_request(CHARGE_OK_PIN, NULL); + if (ret) { + printk("failed to request charge_ok gpio\n"); + return ret ; + } + + gpio_pull_updown(CHARGE_OK_PIN, 1);//important + ret = gpio_direction_input(CHARGE_OK_PIN); + if (ret) { + printk("failed to set gpio charge_ok input\n"); + return ret ; + } + + return 0; + +} static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = { .dc_det_pin = RK2928_PIN1_PA5, .batt_low_pin = INVALID_GPIO, .charge_set_pin = INVALID_GPIO, .charge_ok_pin = RK2928_PIN1_PA0, - .dc_det_level = GPIO_HIGH, // + .dc_det_level = GPIO_LOW, // .charge_ok_level = GPIO_HIGH, + + .io_init = rk30_battery_adc_io_init, }; static struct platform_device rk30_device_adc_battery = { -- 2.34.1