Richard Purdie | 50a5de4 | 2005-09-13 01:25:30 -0700 | [diff] [blame] | 1 | /* |
| 2 | * SharpSL SSP Driver |
| 3 | */ |
| 4 | |
| 5 | struct corgissp_machinfo { |
| 6 | int port; |
| 7 | int cs_lcdcon; |
| 8 | int cs_ads7846; |
| 9 | int cs_max1111; |
| 10 | int clk_lcdcon; |
| 11 | int clk_ads7846; |
| 12 | int clk_max1111; |
| 13 | }; |
| 14 | |
| 15 | void corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo); |
Richard Purdie | 9fc7896 | 2005-09-13 01:25:32 -0700 | [diff] [blame] | 16 | |
| 17 | /* |
Richard Purdie | 1351e6e | 2005-09-13 01:25:33 -0700 | [diff] [blame] | 18 | * SharpSL Backlight |
| 19 | */ |
| 20 | |
| 21 | void corgi_bl_set_intensity(int intensity); |
| 22 | void spitz_bl_set_intensity(int intensity); |
| 23 | void akita_bl_set_intensity(int intensity); |
| 24 | |
| 25 | /* |
Richard Purdie | 9fc7896 | 2005-09-13 01:25:32 -0700 | [diff] [blame] | 26 | * SharpSL Touchscreen Driver |
| 27 | */ |
| 28 | |
| 29 | unsigned long corgi_get_hsync_len(void); |
| 30 | unsigned long spitz_get_hsync_len(void); |
| 31 | void corgi_put_hsync(void); |
| 32 | void spitz_put_hsync(void); |
| 33 | void corgi_wait_hsync(void); |
| 34 | void spitz_wait_hsync(void); |
Richard Purdie | 078abcf | 2005-11-10 17:42:29 +0000 | [diff] [blame] | 35 | |
| 36 | /* |
| 37 | * SharpSL Battery/PM Driver |
| 38 | */ |
| 39 | |
| 40 | struct 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 | |
| 65 | struct battery_thresh { |
| 66 | int voltage; |
| 67 | int percentage; |
| 68 | }; |
| 69 | |
| 70 | struct 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 | |
| 77 | struct 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 | |
| 101 | extern struct sharpsl_pm_status sharpsl_pm; |
| 102 | extern struct battery_thresh spitz_battery_levels_acin[]; |
| 103 | extern 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) |
Richard Purdie | c5e1ae9 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 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) |