diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2006-01-05 15:44:55 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-01-05 15:44:55 -0500 |
commit | b7557de41a04346cb545d4dda7088760cb96e713 (patch) | |
tree | df9acef34fdf1460858ed39b35d447f6bfdc95d1 /include/asm-arm | |
parent | 3125c68d70e3433c21234431a9df9e7336efa29f (diff) |
[ARM] 3228/1: SharpSL: Move PM code to arch/arm/common
Patch from Richard Purdie
This patch moves a large chunk of the sharpsl_pm driver to
arch/arm/common so that it can be reused on other devices such as the
SL-5500 (collie). It also abstracts some functions from the core into
the machine and platform specific parts of the driver to aid reuse.
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'include/asm-arm')
-rw-r--r-- | include/asm-arm/hardware/sharpsl_pm.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/include/asm-arm/hardware/sharpsl_pm.h b/include/asm-arm/hardware/sharpsl_pm.h new file mode 100644 index 000000000000..36983e5f3665 --- /dev/null +++ b/include/asm-arm/hardware/sharpsl_pm.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | * SharpSL Battery/PM Driver | ||
3 | * | ||
4 | * Copyright (c) 2004-2005 Richard Purdie | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #include <linux/interrupt.h> | ||
13 | |||
14 | struct sharpsl_charger_machinfo { | ||
15 | void (*init)(void); | ||
16 | void (*exit)(void); | ||
17 | int gpio_acin; | ||
18 | int gpio_batfull; | ||
19 | int gpio_batlock; | ||
20 | int gpio_fatal; | ||
21 | void (*discharge)(int); | ||
22 | void (*discharge1)(int); | ||
23 | void (*charge)(int); | ||
24 | void (*measure_temp)(int); | ||
25 | void (*presuspend)(void); | ||
26 | void (*postsuspend)(void); | ||
27 | unsigned long (*read_devdata)(int); | ||
28 | #define SHARPSL_BATT_VOLT 1 | ||
29 | #define SHARPSL_BATT_TEMP 2 | ||
30 | #define SHARPSL_ACIN_VOLT 3 | ||
31 | #define SHARPSL_STATUS_ACIN 4 | ||
32 | #define SHARPSL_STATUS_LOCK 5 | ||
33 | #define SHARPSL_STATUS_CHRGFULL 6 | ||
34 | #define SHARPSL_STATUS_FATAL 7 | ||
35 | unsigned long (*charger_wakeup)(void); | ||
36 | int (*should_wakeup)(unsigned int resume_on_alarm); | ||
37 | int bat_levels; | ||
38 | struct battery_thresh *bat_levels_noac; | ||
39 | struct battery_thresh *bat_levels_acin; | ||
40 | int status_high_acin; | ||
41 | int status_low_acin; | ||
42 | int status_high_noac; | ||
43 | int status_low_noac; | ||
44 | }; | ||
45 | |||
46 | struct battery_thresh { | ||
47 | int voltage; | ||
48 | int percentage; | ||
49 | }; | ||
50 | |||
51 | struct battery_stat { | ||
52 | int ac_status; /* APM AC Present/Not Present */ | ||
53 | int mainbat_status; /* APM Main Battery Status */ | ||
54 | int mainbat_percent; /* Main Battery Percentage Charge */ | ||
55 | int mainbat_voltage; /* Main Battery Voltage */ | ||
56 | }; | ||
57 | |||
58 | struct sharpsl_pm_status { | ||
59 | struct device *dev; | ||
60 | struct timer_list ac_timer; | ||
61 | struct timer_list chrg_full_timer; | ||
62 | |||
63 | int charge_mode; | ||
64 | #define CHRG_ERROR (-1) | ||
65 | #define CHRG_OFF (0) | ||
66 | #define CHRG_ON (1) | ||
67 | #define CHRG_DONE (2) | ||
68 | |||
69 | unsigned int flags; | ||
70 | #define SHARPSL_SUSPENDED (1 << 0) /* Device is Suspended */ | ||
71 | #define SHARPSL_ALARM_ACTIVE (1 << 1) /* Alarm is for charging event (not user) */ | ||
72 | #define SHARPSL_BL_LIMIT (1 << 2) /* Backlight Intensity Limited */ | ||
73 | #define SHARPSL_APM_QUEUED (1 << 3) /* APM Event Queued */ | ||
74 | #define SHARPSL_DO_OFFLINE_CHRG (1 << 4) /* Trigger the offline charger */ | ||
75 | |||
76 | int full_count; | ||
77 | unsigned long charge_start_time; | ||
78 | struct sharpsl_charger_machinfo *machinfo; | ||
79 | struct battery_stat battstat; | ||
80 | }; | ||
81 | |||
82 | extern struct sharpsl_pm_status sharpsl_pm; | ||
83 | |||
84 | |||
85 | #define SHARPSL_LED_ERROR 2 | ||
86 | #define SHARPSL_LED_ON 1 | ||
87 | #define SHARPSL_LED_OFF 0 | ||
88 | |||
89 | void sharpsl_battery_kick(void); | ||
90 | void sharpsl_pm_led(int val); | ||
91 | irqreturn_t sharpsl_ac_isr(int irq, void *dev_id, struct pt_regs *fp); | ||
92 | irqreturn_t sharpsl_chrg_full_isr(int irq, void *dev_id, struct pt_regs *fp); | ||
93 | irqreturn_t sharpsl_fatal_isr(int irq, void *dev_id, struct pt_regs *fp); | ||
94 | |||