summaryrefslogtreecommitdiffstats
path: root/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0004-bq27x00_battery-add-charged-gpio.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0004-bq27x00_battery-add-charged-gpio.patch')
-rw-r--r--extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0004-bq27x00_battery-add-charged-gpio.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0004-bq27x00_battery-add-charged-gpio.patch b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0004-bq27x00_battery-add-charged-gpio.patch
new file mode 100644
index 00000000..759525f2
--- /dev/null
+++ b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0004-bq27x00_battery-add-charged-gpio.patch
@@ -0,0 +1,65 @@
1From 829d500667448b7ea9465615261a988adc3aa645 Mon Sep 17 00:00:00 2001
2From: Gregoire Gentil <gregoire@gentil.com>
3Date: Fri, 12 Mar 2010 11:42:45 +0100
4Subject: [PATCH 04/17] bq27x00_battery: add charged gpio
5
6---
7 drivers/power/bq27x00_battery.c | 21 +++++++++++++++++++++
8 1 files changed, 21 insertions(+), 0 deletions(-)
9
10diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
11index 6935bb6..4b80f59 100644
12--- a/drivers/power/bq27x00_battery.c
13+++ b/drivers/power/bq27x00_battery.c
14@@ -28,6 +28,7 @@
15
16 #define DRIVER_VERSION "1.0.0"
17
18+#define BQ27x00_REG_MODE 0x00
19 #define BQ27x00_REG_TEMP 0x06
20 #define BQ27x00_REG_VOLT 0x08
21 #define BQ27x00_REG_RSOC 0x0B /* Relative State-of-Charge */
22@@ -65,6 +66,7 @@ static enum power_supply_property bq27x00_battery_props[] = {
23 POWER_SUPPLY_PROP_CURRENT_NOW,
24 POWER_SUPPLY_PROP_CAPACITY,
25 POWER_SUPPLY_PROP_TEMP,
26+ POWER_SUPPLY_PROP_ONLINE,
27 };
28
29 /*
30@@ -83,6 +85,22 @@ static int bq27x00_read(u8 reg, int *rt_value, int b_single,
31 }
32
33 /*
34+ * Return the GPIO status (0 or 1)
35+ * Or < 0 if something fails.
36+ */
37+static int bq27x00_gpio(struct bq27x00_device_info *di)
38+{
39+ int ret;
40+ int gpio = 0;
41+
42+ ret = bq27x00_read(BQ27x00_REG_MODE, &gpio, 0, di);
43+ if (ret)
44+ return ret;
45+
46+ return (gpio & 0x40) >> 6;
47+}
48+
49+/*
50 * Return the battery temperature in Celsius degrees
51 * Or < 0 if something fails.
52 */
53@@ -184,6 +202,9 @@ static int bq27x00_battery_get_property(struct power_supply *psy,
54 case POWER_SUPPLY_PROP_TEMP:
55 val->intval = bq27x00_battery_temperature(di);
56 break;
57+ case POWER_SUPPLY_PROP_ONLINE:
58+ val->intval = bq27x00_gpio(di);
59+ break;
60 default:
61 return -EINVAL;
62 }
63--
641.6.6.1
65