aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/configs/gta02_moredrivers_defconfig2
-rw-r--r--arch/arm/configs/gta02_packaging_defconfig2
-rw-r--r--arch/arm/mach-s3c2442/mach-gta02.c30
3 files changed, 32 insertions, 2 deletions
diff --git a/arch/arm/configs/gta02_moredrivers_defconfig b/arch/arm/configs/gta02_moredrivers_defconfig
index 8d06cd6c70b..bd66869f74a 100644
--- a/arch/arm/configs/gta02_moredrivers_defconfig
+++ b/arch/arm/configs/gta02_moredrivers_defconfig
@@ -1177,7 +1177,7 @@ CONFIG_APM_POWER=y
CONFIG_CHARGER_PCF50633=y
CONFIG_BATTERY_BQ27000_HDQ=y
CONFIG_HDQ_GPIO_BITBANG=y
-# CONFIG_BATTERY_GTA01 is not set
+CONFIG_BATTERY_GTA01=m
CONFIG_HWMON=y
# CONFIG_HWMON_VID is not set
# CONFIG_SENSORS_AD7414 is not set
diff --git a/arch/arm/configs/gta02_packaging_defconfig b/arch/arm/configs/gta02_packaging_defconfig
index 755e416b100..15defd28841 100644
--- a/arch/arm/configs/gta02_packaging_defconfig
+++ b/arch/arm/configs/gta02_packaging_defconfig
@@ -1180,7 +1180,7 @@ CONFIG_APM_POWER=y
CONFIG_CHARGER_PCF50633=y
CONFIG_BATTERY_BQ27000_HDQ=y
CONFIG_HDQ_GPIO_BITBANG=y
-# CONFIG_BATTERY_GTA01 is not set
+CONFIG_BATTERY_GTA01=m
CONFIG_HWMON=y
# CONFIG_HWMON_VID is not set
# CONFIG_SENSORS_AD7414 is not set
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 <linux/hdq.h>
#include <linux/bq27000_battery.h>
+#include <linux/gta01_battery.h>
#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 = &gta01_bat_pdata,
+ }
+};
+
#ifdef CONFIG_HDQ_GPIO_BITBANG
/* BQ27000 Battery */
@@ -1550,6 +1579,7 @@ static struct platform_device *gta02_devices_pmu_children[] = {
&gta02_spi_gpio_dev, /* input 2 and 3 */
&gta02_button_dev, /* input 4 */
&gta02_resume_reason_device,
+ &gta01_bat,
};
static void gta02_pmu_regulator_registered(struct pcf50633 *pcf, int id)