From e34a1783641c47c606978c0e74433bd57d6559fe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Sun, 1 May 2011 01:56:10 +0200 Subject: [PATCH] Update bq27x00_battery patch --- .../debian/patches/bq27x00_battery.patch | 34 ++++++++------------ 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/kernel-power-2.6.28/debian/patches/bq27x00_battery.patch b/kernel-power-2.6.28/debian/patches/bq27x00_battery.patch index a09f23b..bced80b 100644 --- a/kernel-power-2.6.28/debian/patches/bq27x00_battery.patch +++ b/kernel-power-2.6.28/debian/patches/bq27x00_battery.patch @@ -1,5 +1,5 @@ ---- kernel-power-2.6.28/drivers/power/bq27x00_battery.c 2011-02-18 19:36:55.000000000 +0100 -+++ kernel-power-2.6.28/drivers/power/bq27x00_battery.c 2011-02-18 19:39:01.000000000 +0100 +--- kernel-power-2.6.28/drivers/power/bq27x00_battery.c 2011-05-01 01:48:44.000000000 +0200 ++++ kernel-power-2.6.28/drivers/power/bq27x00_battery.c 2011-05-01 01:51:12.000000000 +0200 @@ -3,6 +3,8 @@ * * Copyright (C) 2008 Rodolfo Giometti @@ -23,7 +23,7 @@ #include #include #include -@@ -24,144 +33,416 @@ +@@ -24,144 +33,410 @@ #include #include #include @@ -31,8 +31,6 @@ #include -#define DRIVER_VERSION "1.0.0" -+//#include -+ +#define CONFIG_BATTERY_BQ27X00_I2C + +struct bq27000_platform_data { @@ -87,7 +85,7 @@ + int time_to_empty_avg; + int time_to_full; + int charge_full; -+ int charge_counter; ++ int cycle_count; + int capacity; + int flags; + @@ -132,8 +130,7 @@ + POWER_SUPPLY_PROP_CHARGE_FULL, + POWER_SUPPLY_PROP_CHARGE_NOW, + POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, -+ POWER_SUPPLY_PROP_CHARGE_COUNTER, -+// POWER_SUPPLY_PROP_ENERGY_NOW, ++ POWER_SUPPLY_PROP_CYCLE_COUNT, }; +static unsigned int poll_interval = 360; @@ -304,7 +301,6 @@ - dev_err(di->dev, "error reading flags\n"); + + if (tval == 65535) -+// return -ENODATA; return 0; + + return tval * 60; @@ -323,7 +319,7 @@ + cache.time_to_empty_avg = bq27x00_battery_read_time(di, BQ27x00_REG_TTECP); + cache.time_to_full = bq27x00_battery_read_time(di, BQ27x00_REG_TTF); + cache.charge_full = bq27x00_battery_read_lmd(di); -+ cache.charge_counter = bq27x00_battery_read_cyct(di); ++ cache.cycle_count = bq27x00_battery_read_cyct(di); + + if (!is_bq27500) + cache.current_now = bq27x00_read(di, BQ27x00_REG_AI, false); @@ -354,8 +350,6 @@ + bq27x00_update(di); + + if (poll_interval > 0) { -+ /* The timer does not have to be accurate. */ -+// set_timer_slack(&di->work.timer, poll_interval * HZ / 4); + schedule_delayed_work(&di->work, poll_interval * HZ); } - return curr; @@ -506,7 +500,7 @@ } #define to_bq27x00_device_info(x) container_of((x), \ -@@ -171,89 +452,164 @@ static int bq27x00_battery_get_property( +@@ -171,89 +446,164 @@ static int bq27x00_battery_get_property( enum power_supply_property psp, union power_supply_propval *val) { @@ -569,8 +563,8 @@ + case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: + ret = bq27x00_simple_value(di->charge_design_full, val); + break; -+ case POWER_SUPPLY_PROP_CHARGE_COUNTER: -+ ret = bq27x00_simple_value(di->cache.charge_counter, val); ++ case POWER_SUPPLY_PROP_CYCLE_COUNT: ++ ret = bq27x00_simple_value(di->cache.cycle_count, val); + break; + case POWER_SUPPLY_PROP_ENERGY_NOW: + ret = bq27x00_battery_energy(di, val); @@ -713,7 +707,7 @@ int num; int retval = 0; -@@ -267,7 +623,7 @@ static int bq27200_battery_probe(struct +@@ -267,7 +617,7 @@ static int bq27200_battery_probe(struct if (retval < 0) return retval; @@ -722,7 +716,7 @@ if (!name) { dev_err(&client->dev, "failed to allocate device name\n"); retval = -ENOMEM; -@@ -280,37 +636,20 @@ static int bq27200_battery_probe(struct +@@ -280,37 +630,20 @@ static int bq27200_battery_probe(struct retval = -ENOMEM; goto batt_failed_2; } @@ -766,7 +760,7 @@ batt_failed_3: kfree(di); batt_failed_2: -@@ -323,11 +662,11 @@ batt_failed_1: +@@ -323,11 +656,11 @@ batt_failed_1: return retval; } @@ -780,7 +774,7 @@ kfree(di->bat.name); -@@ -340,31 +679,180 @@ static int bq27200_battery_remove(struct +@@ -340,31 +673,180 @@ static int bq27200_battery_remove(struct return 0; } @@ -974,7 +968,7 @@ return ret; } -@@ -372,7 +860,8 @@ module_init(bq27x00_battery_init); +@@ -372,7 +854,8 @@ module_init(bq27x00_battery_init); static void __exit bq27x00_battery_exit(void) { -- 1.7.9.5