From 6e7fee4b8ed7a8669d5e4eaa492e8c6cb6105de6 Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Fri, 5 Jun 2009 11:11:04 +0400 Subject: GTA02: gps power management bugfix After suspending with GPS powered on power_on sysfs node reports 0 and GPS is actually unpowered but "echo 1 > power_on" has no effect. This patch fixes it. Reported and analised by Timo Juhani Lindfors , ticket #2293. Signed-off-by: Paul Fertser --- arch/arm/plat-s3c24xx/neo1973_pm_gps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/arm') diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gps.c b/arch/arm/plat-s3c24xx/neo1973_pm_gps.c index 93b491137e7..b59d4959257 100644 --- a/arch/arm/plat-s3c24xx/neo1973_pm_gps.c +++ b/arch/arm/plat-s3c24xx/neo1973_pm_gps.c @@ -305,7 +305,8 @@ static void gps_pwron_set(int on) /* remove pulldown now it won't be floating any more */ s3c2410_gpio_pullup(S3C2410_GPH5, 0); - if (!neo1973_gps.power_was_on) + if (!regulator_is_enabled(neo1973_gps.regulator[ + GTA02_GPS_REG_RF_3V])) regulator_enable(neo1973_gps.regulator[ GTA02_GPS_REG_RF_3V]); return; -- cgit v1.2.3 From e03b339e05fbf46836c83d5595d4db77112b429d Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Wed, 24 Jun 2009 12:29:37 +0400 Subject: GTA0[12]: add nls 866, 1251 to defconfigs These codepages are still widely used by inferior operating systems to represent cyrillic letters in filenames, both in fat filesystem and by some samba-servers. Signed-off-by: Paul Fertser --- arch/arm/configs/gta01_moredrivers_defconfig | 4 ++-- arch/arm/configs/gta02_packaging_defconfig | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'arch/arm') diff --git a/arch/arm/configs/gta01_moredrivers_defconfig b/arch/arm/configs/gta01_moredrivers_defconfig index 1f5883729dc..36d2b170b52 100644 --- a/arch/arm/configs/gta01_moredrivers_defconfig +++ b/arch/arm/configs/gta01_moredrivers_defconfig @@ -1839,7 +1839,7 @@ CONFIG_NLS_CODEPAGE_850=m # CONFIG_NLS_CODEPAGE_863 is not set # CONFIG_NLS_CODEPAGE_864 is not set # CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set +CONFIG_NLS_CODEPAGE_866=m # CONFIG_NLS_CODEPAGE_869 is not set CONFIG_NLS_CODEPAGE_936=m CONFIG_NLS_CODEPAGE_950=m @@ -1848,7 +1848,7 @@ CONFIG_NLS_CODEPAGE_950=m # CONFIG_NLS_CODEPAGE_874 is not set # CONFIG_NLS_ISO8859_8 is not set # CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_CODEPAGE_1251=m # CONFIG_NLS_ASCII is not set CONFIG_NLS_ISO8859_1=y # CONFIG_NLS_ISO8859_2 is not set diff --git a/arch/arm/configs/gta02_packaging_defconfig b/arch/arm/configs/gta02_packaging_defconfig index dfdfb19a2f1..755e416b100 100644 --- a/arch/arm/configs/gta02_packaging_defconfig +++ b/arch/arm/configs/gta02_packaging_defconfig @@ -1953,7 +1953,7 @@ CONFIG_NLS_CODEPAGE_850=m # CONFIG_NLS_CODEPAGE_863 is not set # CONFIG_NLS_CODEPAGE_864 is not set # CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set +CONFIG_NLS_CODEPAGE_866=m # CONFIG_NLS_CODEPAGE_869 is not set CONFIG_NLS_CODEPAGE_936=m CONFIG_NLS_CODEPAGE_950=m @@ -1962,7 +1962,7 @@ CONFIG_NLS_CODEPAGE_950=m # CONFIG_NLS_CODEPAGE_874 is not set # CONFIG_NLS_ISO8859_8 is not set # CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_CODEPAGE_1251=m # CONFIG_NLS_ASCII is not set CONFIG_NLS_ISO8859_1=y # CONFIG_NLS_ISO8859_2 is not set -- cgit v1.2.3 From 991a4b782728554b7274339e763a01b0905c1fe4 Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Sun, 5 Jul 2009 22:53:25 +0400 Subject: GTA01: fix current and voltage reporting units According to power_supply class specification all voltages and currents must be reported in uV and uA correspondingly. Signed-off-by: Paul Fertser --- arch/arm/mach-s3c2410/mach-gta01.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/arm') diff --git a/arch/arm/mach-s3c2410/mach-gta01.c b/arch/arm/mach-s3c2410/mach-gta01.c index 1fe3eef2257..1021ff5f2d5 100644 --- a/arch/arm/mach-s3c2410/mach-gta01.c +++ b/arch/arm/mach-s3c2410/mach-gta01.c @@ -237,7 +237,7 @@ static int gta01_bat_get_voltage(void) adc = pcf50606_adc_sync_read(pcf, PCF50606_ADCMUX_BATVOLT_RES); mv = (adc * 6000) / 1024; - return mv; + return mv * 1000; } static int gta01_bat_get_current(void) @@ -251,7 +251,7 @@ static int gta01_bat_get_current(void) res = (adc_adcin1 - adc_battvolt) * 2400; /*rsense is 220 milli */ - return (res * 1000) / (220 * 1024); + return (res * 1000) / (220 * 1024) * 1000; } static struct gta01_bat_platform_data gta01_bat_pdata = { -- cgit v1.2.3 From dcd90798cdab0ab1e7c1fb56af8841bb225b5fdc Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 26 Jul 2009 20:51:48 +0200 Subject: gta02: fix compile without CHARGER_PCF50633 gta02_pmu_force_shutdown is only defined when CONFIG_CHARGER_PCF50633 is set, but it's used unconditionally. Signed-off-by: Lars-Peter Clausen --- arch/arm/mach-s3c2442/mach-gta02.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/arm') diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c index cb821cedcd0..82b7de85ac9 100644 --- a/arch/arm/mach-s3c2442/mach-gta02.c +++ b/arch/arm/mach-s3c2442/mach-gta02.c @@ -490,6 +490,7 @@ static int gta02_udc_vbus_status(void) #define gta02_get_charger_online_status NULL #define gta02_get_charger_active_status NULL #define gta02_pmu_event_callback NULL +#define gta02_pmu_force_shutdown NULL #define gta02_udc_vbus_draw NULL #define gta02_udc_vbus_status NULL #endif -- cgit v1.2.3 From bcdf6f7109ea494ca84a3baea3a3c563dca9f68b Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Wed, 29 Jul 2009 18:32:52 +0400 Subject: gta02: charging_restart_interval should no longer be used, count on MBC auto-restart Signed-off-by: Paul Fertser --- arch/arm/mach-s3c2442/mach-gta02.c | 1 - 1 file changed, 1 deletion(-) (limited to 'arch/arm') diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c index 82b7de85ac9..d70c3e62500 100644 --- a/arch/arm/mach-s3c2442/mach-gta02.c +++ b/arch/arm/mach-s3c2442/mach-gta02.c @@ -570,7 +570,6 @@ struct pcf50633_platform_data gta02_pcf_pdata = { .batteries = gta02_batteries, .num_batteries = ARRAY_SIZE(gta02_batteries), - .charging_restart_interval = (900 * HZ), .chg_ref_current_ma = 1000, .reg_init_data = { -- cgit v1.2.3 From 9190ad6503355a829b20154286dcb8a3ad482d8d Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Wed, 29 Jul 2009 23:56:48 +0400 Subject: gta02: use a dedicated function to query usb online status We need to use a dedicated function because we can't get charger status from an irq context and that is required by usb gadgets. Signed-off-by: Paul Fertser --- arch/arm/mach-s3c2442/mach-gta02.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/arm') diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c index d70c3e62500..cb272fd49ac 100644 --- a/arch/arm/mach-s3c2442/mach-gta02.c +++ b/arch/arm/mach-s3c2442/mach-gta02.c @@ -391,7 +391,7 @@ static int gta02_get_charger_online_status(void) { struct pcf50633 *pcf = gta02_pcf; - return pcf50633_mbc_get_status(pcf) & PCF50633_MBC_USB_ONLINE; + return pcf50633_mbc_get_usb_online_status(pcf); } static int gta02_get_charger_active_status(void) @@ -484,7 +484,7 @@ static int gta02_udc_vbus_status(void) if (!gta02_pcf) return -ENODEV; - return !!(pcf50633_mbc_get_status(pcf) & PCF50633_MBC_USB_ONLINE); + return pcf50633_mbc_get_usb_online_status(pcf); } #else /* !CONFIG_CHARGER_PCF50633 */ #define gta02_get_charger_online_status NULL -- cgit v1.2.3 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/configs/gta02_moredrivers_defconfig | 2 +- arch/arm/configs/gta02_packaging_defconfig | 2 +- arch/arm/mach-s3c2442/mach-gta02.c | 30 ++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) (limited to 'arch/arm') 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 #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 From 197d20a357d6a8840b26577c6ed2764493f96b8b Mon Sep 17 00:00:00 2001 From: Sven Rebhan Date: Sun, 23 Aug 2009 17:17:23 +0200 Subject: Fix max voltage of LDO1 This patch fixes a typo in the voltage setting of LDO1. In the function mangle_pmu_pdata_by_system_rev() the value of min_uV is set twice, while the value of max_uV stays at the initialized value. This leaves us with .constraints.min_uV = 3300000 and .constraints.max_uV = 1300000, which is probably not what we want. This patch is only required on andy-tracking. Signed-off-by: Sven Rebhan --- arch/arm/mach-s3c2442/mach-gta02.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/arm') diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c index 5de85c01893..e4f052595bd 100644 --- a/arch/arm/mach-s3c2442/mach-gta02.c +++ b/arch/arm/mach-s3c2442/mach-gta02.c @@ -727,7 +727,7 @@ static void mangle_pmu_pdata_by_system_rev(void) reg_init_data[PCF50633_REGULATOR_LDO1] .constraints.min_uV = 3300000; reg_init_data[PCF50633_REGULATOR_LDO1] - .constraints.min_uV = 3300000; + .constraints.max_uV = 3300000; reg_init_data[PCF50633_REGULATOR_LDO1] .constraints.state_mem.enabled = 0; -- cgit v1.2.3 From a3587e4ed77974adfb057af261aaeea4022018e8 Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Thu, 27 Aug 2009 12:19:12 +0400 Subject: gta01: when charging the current reported should be negative Reported-by: Arnaud Patard Signed-off-by: Paul Fertser --- arch/arm/mach-s3c2410/mach-gta01.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/arm') diff --git a/arch/arm/mach-s3c2410/mach-gta01.c b/arch/arm/mach-s3c2410/mach-gta01.c index 1021ff5f2d5..8a13a4adcfd 100644 --- a/arch/arm/mach-s3c2410/mach-gta01.c +++ b/arch/arm/mach-s3c2410/mach-gta01.c @@ -248,7 +248,7 @@ static int gta01_bat_get_current(void) adc_battvolt = pcf50606_adc_sync_read(pcf, PCF50606_ADCMUX_BATVOLT_SUBTR); adc_adcin1 = pcf50606_adc_sync_read(pcf, PCF50606_ADCMUX_ADCIN1_SUBTR); - res = (adc_adcin1 - adc_battvolt) * 2400; + res = (adc_battvolt - adc_adcin1) * 2400; /*rsense is 220 milli */ return (res * 1000) / (220 * 1024) * 1000; -- cgit v1.2.3