2 * SharpSL Battery/PM Driver
4 * Copyright (c) 2004-2005 Richard Purdie
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.
12 #include <linux/interrupt.h>
14 struct sharpsl_charger_machinfo
{
22 void (*discharge
)(int);
23 void (*discharge1
)(int);
25 void (*measure_temp
)(int);
26 void (*presuspend
)(void);
27 void (*postsuspend
)(void);
28 void (*earlyresume
)(void);
29 unsigned long (*read_devdata
)(int);
30 #define SHARPSL_BATT_VOLT 1
31 #define SHARPSL_BATT_TEMP 2
32 #define SHARPSL_ACIN_VOLT 3
33 #define SHARPSL_STATUS_ACIN 4
34 #define SHARPSL_STATUS_LOCK 5
35 #define SHARPSL_STATUS_CHRGFULL 6
36 #define SHARPSL_STATUS_FATAL 7
37 unsigned long (*charger_wakeup
)(void);
38 int (*should_wakeup
)(unsigned int resume_on_alarm
);
39 void (*backlight_limit
)(int);
40 int (*backlight_get_status
) (void);
46 int fatal_noacin_volt
;
48 struct battery_thresh
*bat_levels_noac
;
49 struct battery_thresh
*bat_levels_acin
;
50 struct battery_thresh
*bat_levels_noac_bl
;
51 struct battery_thresh
*bat_levels_acin_bl
;
58 struct battery_thresh
{
64 int ac_status
; /* APM AC Present/Not Present */
65 int mainbat_status
; /* APM Main Battery Status */
66 int mainbat_percent
; /* Main Battery Percentage Charge */
67 int mainbat_voltage
; /* Main Battery Voltage */
70 struct sharpsl_pm_status
{
72 struct timer_list ac_timer
;
73 struct timer_list chrg_full_timer
;
76 #define CHRG_ERROR (-1)
82 #define SHARPSL_SUSPENDED (1 << 0) /* Device is Suspended */
83 #define SHARPSL_ALARM_ACTIVE (1 << 1) /* Alarm is for charging event (not user) */
84 #define SHARPSL_BL_LIMIT (1 << 2) /* Backlight Intensity Limited */
85 #define SHARPSL_APM_QUEUED (1 << 3) /* APM Event Queued */
86 #define SHARPSL_DO_OFFLINE_CHRG (1 << 4) /* Trigger the offline charger */
89 unsigned long charge_start_time
;
90 struct sharpsl_charger_machinfo
*machinfo
;
91 struct battery_stat battstat
;
94 extern struct sharpsl_pm_status sharpsl_pm
;
97 #define SHARPSL_LED_ERROR 2
98 #define SHARPSL_LED_ON 1
99 #define SHARPSL_LED_OFF 0
101 void sharpsl_battery_kick(void);
102 void sharpsl_pm_led(int val
);
103 irqreturn_t
sharpsl_ac_isr(int irq
, void *dev_id
);
104 irqreturn_t
sharpsl_chrg_full_isr(int irq
, void *dev_id
);
105 irqreturn_t
sharpsl_fatal_isr(int irq
, void *dev_id
);