diff options
Diffstat (limited to 'recipes/linux/linux-omap-psp-2.6.32/omap3-touchbook/0004-bq27x00_battery-add-charged-gpio.patch')
-rw-r--r-- | recipes/linux/linux-omap-psp-2.6.32/omap3-touchbook/0004-bq27x00_battery-add-charged-gpio.patch | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/recipes/linux/linux-omap-psp-2.6.32/omap3-touchbook/0004-bq27x00_battery-add-charged-gpio.patch b/recipes/linux/linux-omap-psp-2.6.32/omap3-touchbook/0004-bq27x00_battery-add-charged-gpio.patch new file mode 100644 index 0000000000..670103287c --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/omap3-touchbook/0004-bq27x00_battery-add-charged-gpio.patch @@ -0,0 +1,65 @@ +From c72622f546557a12ba1c1a0d6d678cb8fb886039 Mon Sep 17 00:00:00 2001 +From: Gregoire Gentil <gregoire@gentil.com> +Date: Fri, 12 Mar 2010 11:42:45 +0100 +Subject: [PATCH 04/14] bq27x00_battery: add charged gpio + +--- + drivers/power/bq27x00_battery.c | 21 +++++++++++++++++++++ + 1 files changed, 21 insertions(+), 0 deletions(-) + +diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c +index 6935bb6..4b80f59 100644 +--- a/drivers/power/bq27x00_battery.c ++++ b/drivers/power/bq27x00_battery.c +@@ -28,6 +28,7 @@ + + #define DRIVER_VERSION "1.0.0" + ++#define BQ27x00_REG_MODE 0x00 + #define BQ27x00_REG_TEMP 0x06 + #define BQ27x00_REG_VOLT 0x08 + #define BQ27x00_REG_RSOC 0x0B /* Relative State-of-Charge */ +@@ -65,6 +66,7 @@ static enum power_supply_property bq27x00_battery_props[] = { + POWER_SUPPLY_PROP_CURRENT_NOW, + POWER_SUPPLY_PROP_CAPACITY, + POWER_SUPPLY_PROP_TEMP, ++ POWER_SUPPLY_PROP_ONLINE, + }; + + /* +@@ -83,6 +85,22 @@ static int bq27x00_read(u8 reg, int *rt_value, int b_single, + } + + /* ++ * Return the GPIO status (0 or 1) ++ * Or < 0 if something fails. ++ */ ++static int bq27x00_gpio(struct bq27x00_device_info *di) ++{ ++ int ret; ++ int gpio = 0; ++ ++ ret = bq27x00_read(BQ27x00_REG_MODE, &gpio, 0, di); ++ if (ret) ++ return ret; ++ ++ return (gpio & 0x40) >> 6; ++} ++ ++/* + * Return the battery temperature in Celsius degrees + * Or < 0 if something fails. + */ +@@ -184,6 +202,9 @@ static int bq27x00_battery_get_property(struct power_supply *psy, + case POWER_SUPPLY_PROP_TEMP: + val->intval = bq27x00_battery_temperature(di); + break; ++ case POWER_SUPPLY_PROP_ONLINE: ++ val->intval = bq27x00_gpio(di); ++ break; + default: + return -EINVAL; + } +-- +1.6.6.1 + |