From 2d158aae9d8d36f575504f59884ed8e80802efe2 Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Sun, 26 Jul 2009 18:09:13 +0400 Subject: GTA02: add support for dumb battery driver This allows to use gta01 battery driver on gta02. echo bq27000-battery.0 > /sys/bus/platform/drivers/bq27000-battery/unbind modprobe gta01_battery Signed-off-by: Paul Fertser --- arch/arm/mach-s3c2442/mach-gta02.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'arch/arm/mach-s3c2442/mach-gta02.c') diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c index cb272fd49ac..5de85c01893 100644 --- a/arch/arm/mach-s3c2442/mach-gta02.c +++ b/arch/arm/mach-s3c2442/mach-gta02.c @@ -100,6 +100,7 @@ #include #include +#include #include "../plat-s3c24xx/neo1973_pm_gps.h" @@ -747,6 +748,34 @@ static void mangle_pmu_pdata_by_system_rev(void) } } +static int gta02_bat_get_voltage(void) +{ + struct pcf50633 *pcf = gta02_pcf; + u16 adc, mv = 0; + adc = pcf50633_adc_sync_read(pcf, + PCF50633_ADCC1_MUX_BATSNS_RES, + PCF50633_ADCC1_AVERAGE_16); + /* The formula from DS is for divide-by-two mode, current driver uses + divide-by-three */ + mv = (adc * 6000) / 1023; + return mv * 1000; +} + +static struct gta01_bat_platform_data gta01_bat_pdata = { +#ifdef CONFIG_CHARGER_PCF50633 + .get_charging_status = gta02_get_charger_active_status, +#endif + .get_voltage = gta02_bat_get_voltage, +}; + +struct platform_device gta01_bat = { + .name = "gta01_battery", + .id = -1, + .dev = { + .platform_data = >a01_bat_pdata, + } +}; + #ifdef CONFIG_HDQ_GPIO_BITBANG /* BQ27000 Battery */ @@ -1550,6 +1579,7 @@ static struct platform_device *gta02_devices_pmu_children[] = { >a02_spi_gpio_dev, /* input 2 and 3 */ >a02_button_dev, /* input 4 */ >a02_resume_reason_device, + >a01_bat, }; static void gta02_pmu_regulator_registered(struct pcf50633 *pcf, int id) -- cgit v1.2.3