aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/sharpsl.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/sharpsl.h')
-rw-r--r--arch/arm/mach-pxa/sharpsl.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/sharpsl.h b/arch/arm/mach-pxa/sharpsl.h
index 3977a77aacdd..4879c0f7da72 100644
--- a/arch/arm/mach-pxa/sharpsl.h
+++ b/arch/arm/mach-pxa/sharpsl.h
@@ -32,3 +32,90 @@ void corgi_put_hsync(void);
32void spitz_put_hsync(void); 32void spitz_put_hsync(void);
33void corgi_wait_hsync(void); 33void corgi_wait_hsync(void);
34void spitz_wait_hsync(void); 34void spitz_wait_hsync(void);
35
36/*
37 * SharpSL Battery/PM Driver
38 */
39
40struct sharpsl_charger_machinfo {
41 void (*init)(void);
42 int gpio_acin;
43 int gpio_batfull;
44 int gpio_batlock;
45 int gpio_fatal;
46 int (*status_acin)(void);
47 void (*discharge)(int);
48 void (*discharge1)(int);
49 void (*charge)(int);
50 void (*chargeled)(int);
51 void (*measure_temp)(int);
52 void (*presuspend)(void);
53 void (*postsuspend)(void);
54 unsigned long (*charger_wakeup)(void);
55 int (*should_wakeup)(unsigned int resume_on_alarm);
56 int bat_levels;
57 struct battery_thresh *bat_levels_noac;
58 struct battery_thresh *bat_levels_acin;
59 int status_high_acin;
60 int status_low_acin;
61 int status_high_noac;
62 int status_low_noac;
63};
64
65struct battery_thresh {
66 int voltage;
67 int percentage;
68};
69
70struct battery_stat {
71 int ac_status; /* APM AC Present/Not Present */
72 int mainbat_status; /* APM Main Battery Status */
73 int mainbat_percent; /* Main Battery Percentage Charge */
74 int mainbat_voltage; /* Main Battery Voltage */
75};
76
77struct sharpsl_pm_status {
78 struct device *dev;
79 struct timer_list ac_timer;
80 struct timer_list chrg_full_timer;
81
82 int charge_mode;
83#define CHRG_ERROR (-1)
84#define CHRG_OFF (0)
85#define CHRG_ON (1)
86#define CHRG_DONE (2)
87
88 unsigned int flags;
89#define SHARPSL_SUSPENDED (1 << 0) /* Device is Suspended */
90#define SHARPSL_ALARM_ACTIVE (1 << 1) /* Alarm is for charging event (not user) */
91#define SHARPSL_BL_LIMIT (1 << 2) /* Backlight Intensity Limited */
92#define SHARPSL_APM_QUEUED (1 << 3) /* APM Event Queued */
93#define SHARPSL_DO_OFFLINE_CHRG (1 << 4) /* Trigger the offline charger */
94
95 int full_count;
96 unsigned long charge_start_time;
97 struct sharpsl_charger_machinfo *machinfo;
98 struct battery_stat battstat;
99};
100
101extern struct sharpsl_pm_status sharpsl_pm;
102extern struct battery_thresh spitz_battery_levels_acin[];
103extern struct battery_thresh spitz_battery_levels_noac[];
104
105#define READ_GPIO_BIT(x) (GPLR(x) & GPIO_bit(x))
106
107#define SHARPSL_LED_ERROR 2
108#define SHARPSL_LED_ON 1
109#define SHARPSL_LED_OFF 0
110
111#define CHARGE_ON() sharpsl_pm.machinfo->charge(1)
112#define CHARGE_OFF() sharpsl_pm.machinfo->charge(0)
113#define CHARGE_LED_ON() sharpsl_pm.machinfo->chargeled(SHARPSL_LED_ON)
114#define CHARGE_LED_OFF() sharpsl_pm.machinfo->chargeled(SHARPSL_LED_OFF)
115#define CHARGE_LED_ERR() sharpsl_pm.machinfo->chargeled(SHARPSL_LED_ERROR)
116#define DISCHARGE_ON() sharpsl_pm.machinfo->discharge(1)
117#define DISCHARGE_OFF() sharpsl_pm.machinfo->discharge(0)
118#define STATUS_AC_IN sharpsl_pm.machinfo->status_acin()
119#define STATUS_BATT_LOCKED READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batlock)
120#define STATUS_CHRG_FULL READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batfull)
121#define STATUS_FATAL READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_fatal)