diff options
author | Suresh Mangipudi <smangipudi@nvidia.com> | 2010-07-23 17:10:42 -0700 |
---|---|---|
committer | Gary King <gking@nvidia.com> | 2010-07-26 15:23:34 -0700 |
commit | 86ec9122a2a50dd4652c05f1090c0f01a4110a6c (patch) | |
tree | dd03ed75c10cf06a2b4d91ddaec4880733b568c3 /drivers | |
parent | 51b2a84496a6426cec1f8aa56a60ea3a05e7d1f5 (diff) |
[ventana]Battery charging.
The GPIO port R pin 6 needs to be set low for charging of battery on ventana rev C
Change-Id: I2ac17494f65f550d5bf676ae8ec09819983b72ac
Reviewed-on: http://git-master/r/4171
Tested-by: Suresh Mangipudi <smangipudi@nvidia.com>
Reviewed-by: Gary King <gking@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/power/tegra_odm_battery.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/power/tegra_odm_battery.c b/drivers/power/tegra_odm_battery.c index 9f77f1ff0702..d0c61978ae9b 100644 --- a/drivers/power/tegra_odm_battery.c +++ b/drivers/power/tegra_odm_battery.c @@ -35,6 +35,7 @@ #include "nvcommon.h" #include "nvos.h" #include "nvrm_pmu.h" +#include "nvodm_battery.h" #include "mach/nvrm_linux.h" // for s_hRmGlobal #define NVBATTERY_POLLING_INTERVAL 30000 /* 30 Seconds */ @@ -121,6 +122,7 @@ typedef struct tegra_battery_dev { NvU32 ACLineStatus; NvU32 batt_status_poll_period; NvBool present; + NvOdmBatteryDeviceHandle hOdmBattDev; } tegra_battery_dev; static tegra_battery_dev *batt_dev; @@ -381,7 +383,7 @@ static void tegra_battery_poll_timer_func(unsigned long unused) static int tegra_battery_probe(struct platform_device *pdev) { int i, rc; - + NvBool result; batt_dev = kzalloc(sizeof(*batt_dev), GFP_KERNEL); if (!batt_dev) { @@ -405,9 +407,12 @@ static int tegra_battery_probe(struct platform_device *pdev) return rc; } } - printk(KERN_INFO "%s: battery driver registered\n", pdev->name); - + result = NvOdmBatteryDeviceOpen(&(batt_dev->hOdmBattDev), NULL); + if (!result) { + pr_err("NvOdmBatteryDeviceOpen FAILED\n"); + goto err; + } batt_dev->batt_status_poll_period = NVBATTERY_POLLING_INTERVAL; setup_timer(&(batt_dev->battery_poll_timer), tegra_battery_poll_timer_func, 0); mod_timer(&(batt_dev->battery_poll_timer), @@ -426,6 +431,12 @@ static int tegra_battery_probe(struct platform_device *pdev) } return 0; +err: + if (batt_dev) { + kfree(batt_dev); + batt_dev = NULL; + } + return -1; } static int tegra_battery_remove(struct platform_device *pdev) @@ -440,10 +451,13 @@ static int tegra_battery_remove(struct platform_device *pdev) device_remove_file(&pdev->dev, &tegra_battery_attr); del_timer_sync(&(batt_dev->battery_poll_timer)); + if (batt_dev->hOdmBattDev) { + NvOdmBatteryDeviceClose(batt_dev->hOdmBattDev); + batt_dev->hOdmBattDev = NULL; + } kfree(batt_dev); batt_dev = NULL; } - return 0; } |