Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sharpsl_pm.h
Go to the documentation of this file.
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 #ifndef _MACH_SHARPSL_PM
12 #define _MACH_SHARPSL_PM
13 
15  void (*init)(void);
16  void (*exit)(void);
17  int gpio_acin;
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);
56 };
57 
59  int voltage;
61 };
62 
63 struct battery_stat {
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 */
68 };
69 
71  struct device *dev;
74 
76 #define CHRG_ERROR (-1)
77 #define CHRG_OFF (0)
78 #define CHRG_ON (1)
79 #define CHRG_DONE (2)
80 
81  unsigned int flags;
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 */
87 
89  unsigned long charge_start_time;
92 };
93 
94 extern struct sharpsl_pm_status sharpsl_pm;
95 
98 
99 #define SHARPSL_LED_ERROR 2
100 #define SHARPSL_LED_ON 1
101 #define SHARPSL_LED_OFF 0
102 
103 void sharpsl_battery_kick(void);
104 void sharpsl_pm_led(int val);
105 
106 /* MAX1111 Channel Definitions */
107 #define MAX1111_BATT_VOLT 4u
108 #define MAX1111_BATT_TEMP 2u
109 #define MAX1111_ACIN_VOLT 6u
111 
113 #endif