diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2006-06-19 14:58:52 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-06-19 14:58:52 -0400 |
commit | f8703dc8cb10eca7f6fe6ef364d8e106fe07f034 (patch) | |
tree | 371f01b78f7fa205128b9ba9127b30904dfdd7b7 /arch/arm/common | |
parent | 88660351cb6daa85baf9700f12dff3af564dc14a (diff) |
[ARM] 3564/1: sharpsl_pm: Abstract some machine specific parameters
Patch from Richard Purdie
Abstract some machine specific parameters from the sharpsl_pm core
into the machine specific drivers. This allows the core to support
tosa/poodle.
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/common')
-rw-r--r-- | arch/arm/common/sharpsl_pm.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c index 3cd8c9ee4510..045e37e07330 100644 --- a/arch/arm/common/sharpsl_pm.c +++ b/arch/arm/common/sharpsl_pm.c | |||
@@ -49,13 +49,6 @@ | |||
49 | #define SHARPSL_CHARGE_CO_CHECK_TIME 5 /* 5 msec */ | 49 | #define SHARPSL_CHARGE_CO_CHECK_TIME 5 /* 5 msec */ |
50 | #define SHARPSL_CHARGE_RETRY_CNT 1 /* eqv. 10 min */ | 50 | #define SHARPSL_CHARGE_RETRY_CNT 1 /* eqv. 10 min */ |
51 | 51 | ||
52 | #define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */ | ||
53 | #define SHARPSL_CHARGE_ON_TEMP 0xe0 /* 2.9V */ | ||
54 | #define SHARPSL_CHARGE_ON_ACIN_HIGH 0x9b /* 6V */ | ||
55 | #define SHARPSL_CHARGE_ON_ACIN_LOW 0x34 /* 2V */ | ||
56 | #define SHARPSL_FATAL_ACIN_VOLT 182 /* 3.45V */ | ||
57 | #define SHARPSL_FATAL_NOACIN_VOLT 170 /* 3.40V */ | ||
58 | |||
59 | /* | 52 | /* |
60 | * Prototypes | 53 | * Prototypes |
61 | */ | 54 | */ |
@@ -82,12 +75,13 @@ DEFINE_LED_TRIGGER(sharpsl_charge_led_trigger); | |||
82 | static int get_percentage(int voltage) | 75 | static int get_percentage(int voltage) |
83 | { | 76 | { |
84 | int i = sharpsl_pm.machinfo->bat_levels - 1; | 77 | int i = sharpsl_pm.machinfo->bat_levels - 1; |
78 | int bl_status = sharpsl_pm.machinfo->backlight_get_status ? sharpsl_pm.machinfo->backlight_get_status() : 0; | ||
85 | struct battery_thresh *thresh; | 79 | struct battery_thresh *thresh; |
86 | 80 | ||
87 | if (sharpsl_pm.charge_mode == CHRG_ON) | 81 | if (sharpsl_pm.charge_mode == CHRG_ON) |
88 | thresh=sharpsl_pm.machinfo->bat_levels_acin; | 82 | thresh = bl_status ? sharpsl_pm.machinfo->bat_levels_acin_bl : sharpsl_pm.machinfo->bat_levels_acin; |
89 | else | 83 | else |
90 | thresh=sharpsl_pm.machinfo->bat_levels_noac; | 84 | thresh = bl_status ? sharpsl_pm.machinfo->bat_levels_noac_bl : sharpsl_pm.machinfo->bat_levels_noac; |
91 | 85 | ||
92 | while (i > 0 && (voltage > thresh[i].voltage)) | 86 | while (i > 0 && (voltage > thresh[i].voltage)) |
93 | i--; | 87 | i--; |
@@ -131,7 +125,7 @@ static void sharpsl_battery_thread(void *private_) | |||
131 | sharpsl_pm.battstat.ac_status = (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN) ? APM_AC_ONLINE : APM_AC_OFFLINE); | 125 | sharpsl_pm.battstat.ac_status = (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN) ? APM_AC_ONLINE : APM_AC_OFFLINE); |
132 | 126 | ||
133 | /* Corgi cannot confirm when battery fully charged so periodically kick! */ | 127 | /* Corgi cannot confirm when battery fully charged so periodically kick! */ |
134 | if (machine_is_corgi() && (sharpsl_pm.charge_mode == CHRG_ON) | 128 | if (!sharpsl_pm.machinfo->batfull_irq && (sharpsl_pm.charge_mode == CHRG_ON) |
135 | && time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_ON_TIME_INTERVAL)) | 129 | && time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_ON_TIME_INTERVAL)) |
136 | schedule_work(&toggle_charger); | 130 | schedule_work(&toggle_charger); |
137 | 131 | ||
@@ -166,11 +160,11 @@ static void sharpsl_battery_thread(void *private_) | |||
166 | && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) || | 160 | && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) || |
167 | (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL))) { | 161 | (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL))) { |
168 | if (!(sharpsl_pm.flags & SHARPSL_BL_LIMIT)) { | 162 | if (!(sharpsl_pm.flags & SHARPSL_BL_LIMIT)) { |
169 | corgibl_limit_intensity(1); | 163 | sharpsl_pm.machinfo->backlight_limit(1); |
170 | sharpsl_pm.flags |= SHARPSL_BL_LIMIT; | 164 | sharpsl_pm.flags |= SHARPSL_BL_LIMIT; |
171 | } | 165 | } |
172 | } else if (sharpsl_pm.flags & SHARPSL_BL_LIMIT) { | 166 | } else if (sharpsl_pm.flags & SHARPSL_BL_LIMIT) { |
173 | corgibl_limit_intensity(0); | 167 | sharpsl_pm.machinfo->backlight_limit(0); |
174 | sharpsl_pm.flags &= ~SHARPSL_BL_LIMIT; | 168 | sharpsl_pm.flags &= ~SHARPSL_BL_LIMIT; |
175 | } | 169 | } |
176 | 170 | ||
@@ -418,7 +412,7 @@ static int sharpsl_check_battery_temp(void) | |||
418 | val = get_select_val(buff); | 412 | val = get_select_val(buff); |
419 | 413 | ||
420 | dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val); | 414 | dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val); |
421 | if (val > SHARPSL_CHARGE_ON_TEMP) | 415 | if (val > sharpsl_pm.machinfo->charge_on_temp) |
422 | return -1; | 416 | return -1; |
423 | 417 | ||
424 | return 0; | 418 | return 0; |
@@ -450,7 +444,7 @@ static int sharpsl_check_battery_voltage(void) | |||
450 | val = get_select_val(buff); | 444 | val = get_select_val(buff); |
451 | dev_dbg(sharpsl_pm.dev, "Battery Voltage: %d\n", val); | 445 | dev_dbg(sharpsl_pm.dev, "Battery Voltage: %d\n", val); |
452 | 446 | ||
453 | if (val < SHARPSL_CHARGE_ON_VOLT) | 447 | if (val < sharpsl_pm.machinfo->charge_on_volt) |
454 | return -1; | 448 | return -1; |
455 | 449 | ||
456 | return 0; | 450 | return 0; |
@@ -468,7 +462,7 @@ static int sharpsl_ac_check(void) | |||
468 | temp = get_select_val(buff); | 462 | temp = get_select_val(buff); |
469 | dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n",temp); | 463 | dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n",temp); |
470 | 464 | ||
471 | if ((temp > SHARPSL_CHARGE_ON_ACIN_HIGH) || (temp < SHARPSL_CHARGE_ON_ACIN_LOW)) { | 465 | if ((temp > sharpsl_pm.machinfo->charge_acin_high) || (temp < sharpsl_pm.machinfo->charge_acin_low)) { |
472 | dev_err(sharpsl_pm.dev, "Error: AC check failed.\n"); | 466 | dev_err(sharpsl_pm.dev, "Error: AC check failed.\n"); |
473 | return -1; | 467 | return -1; |
474 | } | 468 | } |
@@ -627,8 +621,8 @@ static int sharpsl_fatal_check(void) | |||
627 | temp = get_select_val(buff); | 621 | temp = get_select_val(buff); |
628 | dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %d\n", acin, temp, sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT)); | 622 | dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %d\n", acin, temp, sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT)); |
629 | 623 | ||
630 | if ((acin && (temp < SHARPSL_FATAL_ACIN_VOLT)) || | 624 | if ((acin && (temp < sharpsl_pm.machinfo->fatal_acin_volt)) || |
631 | (!acin && (temp < SHARPSL_FATAL_NOACIN_VOLT))) | 625 | (!acin && (temp < sharpsl_pm.machinfo->fatal_noacin_volt))) |
632 | return -1; | 626 | return -1; |
633 | return 0; | 627 | return 0; |
634 | } | 628 | } |