aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2010-12-29 14:12:01 -0500
committerAnton Vorontsov <cbouatmailru@gmail.com>2011-01-12 12:28:24 -0500
commitc566d299f91bdb622046126dbcb040f9e52572ba (patch)
treeadeecaada08dec5c2dc643575dd360924ce88d91 /drivers/power
parentf3dcab70e192b0489ac05cc554e0b1cedae46d1a (diff)
olpc_battery: Ambient temperature is not available on XO-1.5
The XO-1.5 does not support the ambient temperature property. Create a separate list of properties for that configuration where ambient temperature is not included, and apply the correct property list at runtime. Signed-off-by: Daniel Drake <dsd@laptop.org> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/olpc_battery.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c
index 5bc1dcf7785e..0cd4f15e3013 100644
--- a/drivers/power/olpc_battery.c
+++ b/drivers/power/olpc_battery.c
@@ -331,7 +331,7 @@ static int olpc_bat_get_property(struct power_supply *psy,
331 return ret; 331 return ret;
332} 332}
333 333
334static enum power_supply_property olpc_bat_props[] = { 334static enum power_supply_property olpc_xo1_bat_props[] = {
335 POWER_SUPPLY_PROP_STATUS, 335 POWER_SUPPLY_PROP_STATUS,
336 POWER_SUPPLY_PROP_CHARGE_TYPE, 336 POWER_SUPPLY_PROP_CHARGE_TYPE,
337 POWER_SUPPLY_PROP_PRESENT, 337 POWER_SUPPLY_PROP_PRESENT,
@@ -348,6 +348,23 @@ static enum power_supply_property olpc_bat_props[] = {
348 POWER_SUPPLY_PROP_CHARGE_COUNTER, 348 POWER_SUPPLY_PROP_CHARGE_COUNTER,
349}; 349};
350 350
351/* XO-1.5 does not have ambient temperature property */
352static enum power_supply_property olpc_xo15_bat_props[] = {
353 POWER_SUPPLY_PROP_STATUS,
354 POWER_SUPPLY_PROP_CHARGE_TYPE,
355 POWER_SUPPLY_PROP_PRESENT,
356 POWER_SUPPLY_PROP_HEALTH,
357 POWER_SUPPLY_PROP_TECHNOLOGY,
358 POWER_SUPPLY_PROP_VOLTAGE_AVG,
359 POWER_SUPPLY_PROP_CURRENT_AVG,
360 POWER_SUPPLY_PROP_CAPACITY,
361 POWER_SUPPLY_PROP_CAPACITY_LEVEL,
362 POWER_SUPPLY_PROP_TEMP,
363 POWER_SUPPLY_PROP_MANUFACTURER,
364 POWER_SUPPLY_PROP_SERIAL_NUMBER,
365 POWER_SUPPLY_PROP_CHARGE_COUNTER,
366};
367
351/* EEPROM reading goes completely around the power_supply API, sadly */ 368/* EEPROM reading goes completely around the power_supply API, sadly */
352 369
353#define EEPROM_START 0x20 370#define EEPROM_START 0x20
@@ -419,8 +436,6 @@ static struct device_attribute olpc_bat_error = {
419static struct platform_device *bat_pdev; 436static struct platform_device *bat_pdev;
420 437
421static struct power_supply olpc_bat = { 438static struct power_supply olpc_bat = {
422 .properties = olpc_bat_props,
423 .num_properties = ARRAY_SIZE(olpc_bat_props),
424 .get_property = olpc_bat_get_property, 439 .get_property = olpc_bat_get_property,
425 .use_for_apm = 1, 440 .use_for_apm = 1,
426}; 441};
@@ -466,6 +481,13 @@ static int __init olpc_bat_init(void)
466 goto ac_failed; 481 goto ac_failed;
467 482
468 olpc_bat.name = bat_pdev->name; 483 olpc_bat.name = bat_pdev->name;
484 if (olpc_board_at_least(olpc_board_pre(0xd0))) { /* XO-1.5 */
485 olpc_bat.properties = olpc_xo15_bat_props;
486 olpc_bat.num_properties = ARRAY_SIZE(olpc_xo15_bat_props);
487 } else { /* XO-1 */
488 olpc_bat.properties = olpc_xo1_bat_props;
489 olpc_bat.num_properties = ARRAY_SIZE(olpc_xo1_bat_props);
490 }
469 491
470 ret = power_supply_register(&bat_pdev->dev, &olpc_bat); 492 ret = power_supply_register(&bat_pdev->dev, &olpc_bat);
471 if (ret) 493 if (ret)