aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/ec.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r--drivers/acpi/ec.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 17a98aa734b8..e05bb148754c 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -56,14 +56,15 @@ ACPI_MODULE_NAME("acpi_ec")
56#define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ 56#define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */
57 57
58/* EC commands */ 58/* EC commands */
59#define ACPI_EC_COMMAND_READ 0x80 59enum ec_command {
60#define ACPI_EC_COMMAND_WRITE 0x81 60 ACPI_EC_COMMAND_READ = 0x80,
61#define ACPI_EC_BURST_ENABLE 0x82 61 ACPI_EC_COMMAND_WRITE = 0x81,
62#define ACPI_EC_BURST_DISABLE 0x83 62 ACPI_EC_BURST_ENABLE = 0x82,
63#define ACPI_EC_COMMAND_QUERY 0x84 63 ACPI_EC_BURST_DISABLE = 0x83,
64 64 ACPI_EC_COMMAND_QUERY = 0x84,
65};
65/* EC events */ 66/* EC events */
66enum { 67enum ec_event {
67 ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */ 68 ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */
68 ACPI_EC_EVENT_IBF_0, /* Input buffer empty */ 69 ACPI_EC_EVENT_IBF_0, /* Input buffer empty */
69}; 70};
@@ -71,10 +72,10 @@ enum {
71#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ 72#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */
72#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ 73#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
73 74
74enum { 75static enum ec_mode {
75 EC_INTR = 1, /* Output buffer full */ 76 EC_INTR = 1, /* Output buffer full */
76 EC_POLL, /* Input buffer empty */ 77 EC_POLL, /* Input buffer empty */
77}; 78} acpi_ec_mode = EC_INTR;
78 79
79static int acpi_ec_remove(struct acpi_device *device, int type); 80static int acpi_ec_remove(struct acpi_device *device, int type);
80static int acpi_ec_start(struct acpi_device *device); 81static int acpi_ec_start(struct acpi_device *device);
@@ -109,7 +110,6 @@ struct acpi_ec {
109 110
110/* External interfaces use first EC only, so remember */ 111/* External interfaces use first EC only, so remember */
111static struct acpi_device *first_ec; 112static struct acpi_device *first_ec;
112static int acpi_ec_mode = EC_INTR;
113 113
114/* -------------------------------------------------------------------------- 114/* --------------------------------------------------------------------------
115 Transaction Management 115 Transaction Management
@@ -135,7 +135,7 @@ static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)
135 outb(data, ec->data_addr); 135 outb(data, ec->data_addr);
136} 136}
137 137
138static inline int acpi_ec_check_status(struct acpi_ec *ec, u8 event) 138static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event)
139{ 139{
140 u8 status = acpi_ec_read_status(ec); 140 u8 status = acpi_ec_read_status(ec);
141 141
@@ -150,7 +150,7 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, u8 event)
150 return 0; 150 return 0;
151} 151}
152 152
153static int acpi_ec_wait(struct acpi_ec *ec, u8 event) 153static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event)
154{ 154{
155 if (acpi_ec_mode == EC_POLL) { 155 if (acpi_ec_mode == EC_POLL) {
156 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); 156 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);