aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/sharpsl.h
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2006-01-05 15:44:55 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-01-05 15:44:55 -0500
commitb7557de41a04346cb545d4dda7088760cb96e713 (patch)
treedf9acef34fdf1460858ed39b35d447f6bfdc95d1 /arch/arm/mach-pxa/sharpsl.h
parent3125c68d70e3433c21234431a9df9e7336efa29f (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 'arch/arm/mach-pxa/sharpsl.h')
-rw-r--r--arch/arm/mach-pxa/sharpsl.h100
1 files changed, 21 insertions, 79 deletions
diff --git a/arch/arm/mach-pxa/sharpsl.h b/arch/arm/mach-pxa/sharpsl.h
index b0c40a1d6671..92b793050509 100644
--- a/arch/arm/mach-pxa/sharpsl.h
+++ b/arch/arm/mach-pxa/sharpsl.h
@@ -1,7 +1,16 @@
1/* 1/*
2 * SharpSL SSP Driver 2 * Copyright (c) 2004-2005 Richard Purdie
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
3 */ 8 */
4 9
10
11/*
12 * SharpSL SSP Driver
13 */
5struct corgissp_machinfo { 14struct corgissp_machinfo {
6 int port; 15 int port;
7 int cs_lcdcon; 16 int cs_lcdcon;
@@ -14,18 +23,18 @@ struct corgissp_machinfo {
14 23
15void corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo); 24void corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo);
16 25
26
17/* 27/*
18 * SharpSL Backlight 28 * SharpSL Backlight
19 */ 29 */
20
21void corgi_bl_set_intensity(int intensity); 30void corgi_bl_set_intensity(int intensity);
22void spitz_bl_set_intensity(int intensity); 31void spitz_bl_set_intensity(int intensity);
23void akita_bl_set_intensity(int intensity); 32void akita_bl_set_intensity(int intensity);
24 33
34
25/* 35/*
26 * SharpSL Touchscreen Driver 36 * SharpSL Touchscreen Driver
27 */ 37 */
28
29unsigned long corgi_get_hsync_len(void); 38unsigned long corgi_get_hsync_len(void);
30unsigned long spitz_get_hsync_len(void); 39unsigned long spitz_get_hsync_len(void);
31void corgi_put_hsync(void); 40void corgi_put_hsync(void);
@@ -33,89 +42,22 @@ void spitz_put_hsync(void);
33void corgi_wait_hsync(void); 42void corgi_wait_hsync(void);
34void spitz_wait_hsync(void); 43void spitz_wait_hsync(void);
35 44
45
36/* 46/*
37 * SharpSL Battery/PM Driver 47 * SharpSL Battery/PM Driver
38 */ 48 */
39 49
40struct sharpsl_charger_machinfo { 50#define READ_GPIO_BIT(x) (GPLR(x) & GPIO_bit(x))
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 51
95 int full_count; 52/* MAX1111 Channel Definitions */
96 unsigned long charge_start_time; 53#define MAX1111_BATT_VOLT 4u
97 struct sharpsl_charger_machinfo *machinfo; 54#define MAX1111_BATT_TEMP 2u
98 struct battery_stat battstat; 55#define MAX1111_ACIN_VOLT 6u
99};
100 56
101extern struct sharpsl_pm_status sharpsl_pm;
102extern struct battery_thresh spitz_battery_levels_acin[]; 57extern struct battery_thresh spitz_battery_levels_acin[];
103extern struct battery_thresh spitz_battery_levels_noac[]; 58extern struct battery_thresh spitz_battery_levels_noac[];
59void sharpsl_pm_pxa_init(void);
60void sharpsl_pm_pxa_remove(void);
61int sharpsl_pm_pxa_read_max1111(int channel);
104 62
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 63
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)