David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 1 | /* |
| 2 | * ideapad_acpi.c - Lenovo IdeaPad ACPI Extras |
| 3 | * |
| 4 | * Copyright © 2010 Intel Corporation |
| 5 | * Copyright © 2010 David Woodhouse <dwmw2@infradead.org> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 20 | * 02110-1301, USA. |
| 21 | */ |
| 22 | |
| 23 | #include <linux/kernel.h> |
| 24 | #include <linux/module.h> |
| 25 | #include <linux/init.h> |
| 26 | #include <linux/types.h> |
| 27 | #include <acpi/acpi_bus.h> |
| 28 | #include <acpi/acpi_drivers.h> |
| 29 | #include <linux/rfkill.h> |
| 30 | |
| 31 | #define IDEAPAD_DEV_CAMERA 0 |
| 32 | #define IDEAPAD_DEV_WLAN 1 |
| 33 | #define IDEAPAD_DEV_BLUETOOTH 2 |
| 34 | #define IDEAPAD_DEV_3G 3 |
| 35 | #define IDEAPAD_DEV_KILLSW 4 |
| 36 | |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 37 | struct ideapad_private { |
Ike Panhc | 26c81d5 | 2010-10-01 15:39:40 +0800 | [diff] [blame] | 38 | acpi_handle handle; |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 39 | struct rfkill *rfk[5]; |
Ike Panhc | fa08359 | 2010-10-01 15:39:59 +0800 | [diff] [blame^] | 40 | } *ideapad_priv; |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 41 | |
| 42 | static struct { |
| 43 | char *name; |
Ike Panhc | dfa7f6f | 2010-10-01 15:39:29 +0800 | [diff] [blame] | 44 | int cfgbit; |
Ike Panhc | fa08359 | 2010-10-01 15:39:59 +0800 | [diff] [blame^] | 45 | int opcode; |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 46 | int type; |
| 47 | } ideapad_rfk_data[] = { |
Ike Panhc | fa08359 | 2010-10-01 15:39:59 +0800 | [diff] [blame^] | 48 | { "ideapad_camera", 19, 0x1E, NUM_RFKILL_TYPES }, |
| 49 | { "ideapad_wlan", 18, 0x15, RFKILL_TYPE_WLAN }, |
| 50 | { "ideapad_bluetooth", 16, 0x17, RFKILL_TYPE_BLUETOOTH }, |
| 51 | { "ideapad_3g", 17, 0x20, RFKILL_TYPE_WWAN }, |
| 52 | { "ideapad_killsw", 0, 0, RFKILL_TYPE_WLAN } |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 53 | }; |
| 54 | |
Ike Panhc | 6a09f21 | 2010-10-01 15:38:46 +0800 | [diff] [blame] | 55 | /* |
| 56 | * ACPI Helpers |
| 57 | */ |
| 58 | #define IDEAPAD_EC_TIMEOUT (100) /* in ms */ |
| 59 | |
| 60 | static int read_method_int(acpi_handle handle, const char *method, int *val) |
| 61 | { |
| 62 | acpi_status status; |
| 63 | unsigned long long result; |
| 64 | |
| 65 | status = acpi_evaluate_integer(handle, (char *)method, NULL, &result); |
| 66 | if (ACPI_FAILURE(status)) { |
| 67 | *val = -1; |
| 68 | return -1; |
| 69 | } else { |
| 70 | *val = result; |
| 71 | return 0; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | static int method_vpcr(acpi_handle handle, int cmd, int *ret) |
| 76 | { |
| 77 | acpi_status status; |
| 78 | unsigned long long result; |
| 79 | struct acpi_object_list params; |
| 80 | union acpi_object in_obj; |
| 81 | |
| 82 | params.count = 1; |
| 83 | params.pointer = &in_obj; |
| 84 | in_obj.type = ACPI_TYPE_INTEGER; |
| 85 | in_obj.integer.value = cmd; |
| 86 | |
| 87 | status = acpi_evaluate_integer(handle, "VPCR", ¶ms, &result); |
| 88 | |
| 89 | if (ACPI_FAILURE(status)) { |
| 90 | *ret = -1; |
| 91 | return -1; |
| 92 | } else { |
| 93 | *ret = result; |
| 94 | return 0; |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | static int method_vpcw(acpi_handle handle, int cmd, int data) |
| 99 | { |
| 100 | struct acpi_object_list params; |
| 101 | union acpi_object in_obj[2]; |
| 102 | acpi_status status; |
| 103 | |
| 104 | params.count = 2; |
| 105 | params.pointer = in_obj; |
| 106 | in_obj[0].type = ACPI_TYPE_INTEGER; |
| 107 | in_obj[0].integer.value = cmd; |
| 108 | in_obj[1].type = ACPI_TYPE_INTEGER; |
| 109 | in_obj[1].integer.value = data; |
| 110 | |
| 111 | status = acpi_evaluate_object(handle, "VPCW", ¶ms, NULL); |
| 112 | if (status != AE_OK) |
| 113 | return -1; |
| 114 | return 0; |
| 115 | } |
| 116 | |
| 117 | static int read_ec_data(acpi_handle handle, int cmd, unsigned long *data) |
| 118 | { |
| 119 | int val; |
| 120 | unsigned long int end_jiffies; |
| 121 | |
| 122 | if (method_vpcw(handle, 1, cmd)) |
| 123 | return -1; |
| 124 | |
| 125 | for (end_jiffies = jiffies+(HZ)*IDEAPAD_EC_TIMEOUT/1000+1; |
| 126 | time_before(jiffies, end_jiffies);) { |
| 127 | schedule(); |
| 128 | if (method_vpcr(handle, 1, &val)) |
| 129 | return -1; |
| 130 | if (val == 0) { |
| 131 | if (method_vpcr(handle, 0, &val)) |
| 132 | return -1; |
| 133 | *data = val; |
| 134 | return 0; |
| 135 | } |
| 136 | } |
| 137 | pr_err("timeout in read_ec_cmd\n"); |
| 138 | return -1; |
| 139 | } |
| 140 | |
| 141 | static int write_ec_cmd(acpi_handle handle, int cmd, unsigned long data) |
| 142 | { |
| 143 | int val; |
| 144 | unsigned long int end_jiffies; |
| 145 | |
| 146 | if (method_vpcw(handle, 0, data)) |
| 147 | return -1; |
| 148 | if (method_vpcw(handle, 1, cmd)) |
| 149 | return -1; |
| 150 | |
| 151 | for (end_jiffies = jiffies+(HZ)*IDEAPAD_EC_TIMEOUT/1000+1; |
| 152 | time_before(jiffies, end_jiffies);) { |
| 153 | schedule(); |
| 154 | if (method_vpcr(handle, 1, &val)) |
| 155 | return -1; |
| 156 | if (val == 0) |
| 157 | return 0; |
| 158 | } |
| 159 | pr_err("timeout in write_ec_cmd\n"); |
| 160 | return -1; |
| 161 | } |
| 162 | /* the above is ACPI helpers */ |
| 163 | |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 164 | static ssize_t show_ideapad_cam(struct device *dev, |
| 165 | struct device_attribute *attr, |
| 166 | char *buf) |
| 167 | { |
Ike Panhc | 26c81d5 | 2010-10-01 15:39:40 +0800 | [diff] [blame] | 168 | struct ideapad_private *priv = dev_get_drvdata(dev); |
| 169 | acpi_handle handle = priv->handle; |
| 170 | unsigned long result; |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 171 | |
Ike Panhc | 26c81d5 | 2010-10-01 15:39:40 +0800 | [diff] [blame] | 172 | if (read_ec_data(handle, 0x1D, &result)) |
| 173 | return sprintf(buf, "-1\n"); |
| 174 | return sprintf(buf, "%lu\n", result); |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | static ssize_t store_ideapad_cam(struct device *dev, |
| 178 | struct device_attribute *attr, |
| 179 | const char *buf, size_t count) |
| 180 | { |
Ike Panhc | 26c81d5 | 2010-10-01 15:39:40 +0800 | [diff] [blame] | 181 | struct ideapad_private *priv = dev_get_drvdata(dev); |
| 182 | acpi_handle handle = priv->handle; |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 183 | int ret, state; |
| 184 | |
| 185 | if (!count) |
| 186 | return 0; |
| 187 | if (sscanf(buf, "%i", &state) != 1) |
| 188 | return -EINVAL; |
Ike Panhc | 26c81d5 | 2010-10-01 15:39:40 +0800 | [diff] [blame] | 189 | ret = write_ec_cmd(handle, 0x1E, state); |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 190 | if (ret < 0) |
| 191 | return ret; |
| 192 | return count; |
| 193 | } |
| 194 | |
| 195 | static DEVICE_ATTR(camera_power, 0644, show_ideapad_cam, store_ideapad_cam); |
| 196 | |
| 197 | static int ideapad_rfk_set(void *data, bool blocked) |
| 198 | { |
| 199 | int device = (unsigned long)data; |
| 200 | |
| 201 | if (device == IDEAPAD_DEV_KILLSW) |
| 202 | return -EINVAL; |
Ike Panhc | fa08359 | 2010-10-01 15:39:59 +0800 | [diff] [blame^] | 203 | |
| 204 | return write_ec_cmd(ideapad_priv->handle, |
| 205 | ideapad_rfk_data[device].opcode, |
| 206 | !blocked); |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | static struct rfkill_ops ideapad_rfk_ops = { |
| 210 | .set_block = ideapad_rfk_set, |
| 211 | }; |
| 212 | |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 213 | static void ideapad_sync_rfk_state(struct acpi_device *adevice) |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 214 | { |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 215 | struct ideapad_private *priv = dev_get_drvdata(&adevice->dev); |
Ike Panhc | 2b7266b | 2010-10-01 15:39:49 +0800 | [diff] [blame] | 216 | acpi_handle handle = priv->handle; |
| 217 | unsigned long hw_blocked; |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 218 | int i; |
| 219 | |
Ike Panhc | 2b7266b | 2010-10-01 15:39:49 +0800 | [diff] [blame] | 220 | if (read_ec_data(handle, 0x23, &hw_blocked)) |
| 221 | return; |
| 222 | hw_blocked = !hw_blocked; |
| 223 | |
| 224 | for (i = IDEAPAD_DEV_WLAN; i <= IDEAPAD_DEV_KILLSW; i++) |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 225 | if (priv->rfk[i]) |
| 226 | rfkill_set_hw_state(priv->rfk[i], hw_blocked); |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 227 | } |
| 228 | |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 229 | static int ideapad_register_rfkill(struct acpi_device *adevice, int dev) |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 230 | { |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 231 | struct ideapad_private *priv = dev_get_drvdata(&adevice->dev); |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 232 | int ret; |
Ike Panhc | 2b7266b | 2010-10-01 15:39:49 +0800 | [diff] [blame] | 233 | unsigned long sw_blocked; |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 234 | |
Ike Panhc | 2b7266b | 2010-10-01 15:39:49 +0800 | [diff] [blame] | 235 | priv->rfk[dev] = rfkill_alloc(ideapad_rfk_data[dev].name, &adevice->dev, |
| 236 | ideapad_rfk_data[dev].type, &ideapad_rfk_ops, |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 237 | (void *)(long)dev); |
| 238 | if (!priv->rfk[dev]) |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 239 | return -ENOMEM; |
| 240 | |
Ike Panhc | 2b7266b | 2010-10-01 15:39:49 +0800 | [diff] [blame] | 241 | if (read_ec_data(ideapad_priv->handle, ideapad_rfk_data[dev].opcode-1, |
| 242 | &sw_blocked)) { |
| 243 | rfkill_init_sw_state(priv->rfk[dev], 0); |
| 244 | } else { |
| 245 | sw_blocked = !sw_blocked; |
| 246 | rfkill_init_sw_state(priv->rfk[dev], sw_blocked); |
| 247 | } |
| 248 | |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 249 | ret = rfkill_register(priv->rfk[dev]); |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 250 | if (ret) { |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 251 | rfkill_destroy(priv->rfk[dev]); |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 252 | return ret; |
| 253 | } |
| 254 | return 0; |
| 255 | } |
| 256 | |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 257 | static void ideapad_unregister_rfkill(struct acpi_device *adevice, int dev) |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 258 | { |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 259 | struct ideapad_private *priv = dev_get_drvdata(&adevice->dev); |
| 260 | |
| 261 | if (!priv->rfk[dev]) |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 262 | return; |
| 263 | |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 264 | rfkill_unregister(priv->rfk[dev]); |
| 265 | rfkill_destroy(priv->rfk[dev]); |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 266 | } |
| 267 | |
| 268 | static const struct acpi_device_id ideapad_device_ids[] = { |
| 269 | { "VPC2004", 0}, |
| 270 | { "", 0}, |
| 271 | }; |
| 272 | MODULE_DEVICE_TABLE(acpi, ideapad_device_ids); |
| 273 | |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 274 | static int ideapad_acpi_add(struct acpi_device *adevice) |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 275 | { |
Ike Panhc | 6f8371c | 2010-10-01 15:39:14 +0800 | [diff] [blame] | 276 | int i, cfg; |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 277 | int devs_present[5]; |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 278 | struct ideapad_private *priv; |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 279 | |
Ike Panhc | 6f8371c | 2010-10-01 15:39:14 +0800 | [diff] [blame] | 280 | if (read_method_int(adevice->handle, "_CFG", &cfg)) |
| 281 | return -ENODEV; |
| 282 | |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 283 | for (i = IDEAPAD_DEV_CAMERA; i < IDEAPAD_DEV_KILLSW; i++) { |
Ike Panhc | dfa7f6f | 2010-10-01 15:39:29 +0800 | [diff] [blame] | 284 | if (test_bit(ideapad_rfk_data[i].cfgbit, (unsigned long *)&cfg)) |
| 285 | devs_present[i] = 1; |
| 286 | else |
| 287 | devs_present[i] = 0; |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | /* The hardware switch is always present */ |
| 291 | devs_present[IDEAPAD_DEV_KILLSW] = 1; |
| 292 | |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 293 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
| 294 | if (!priv) |
| 295 | return -ENOMEM; |
| 296 | |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 297 | if (devs_present[IDEAPAD_DEV_CAMERA]) { |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 298 | int ret = device_create_file(&adevice->dev, &dev_attr_camera_power); |
| 299 | if (ret) { |
| 300 | kfree(priv); |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 301 | return ret; |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 302 | } |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 303 | } |
| 304 | |
Ike Panhc | 26c81d5 | 2010-10-01 15:39:40 +0800 | [diff] [blame] | 305 | priv->handle = adevice->handle; |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 306 | dev_set_drvdata(&adevice->dev, priv); |
Ike Panhc | fa08359 | 2010-10-01 15:39:59 +0800 | [diff] [blame^] | 307 | ideapad_priv = priv; |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 308 | for (i = IDEAPAD_DEV_WLAN; i <= IDEAPAD_DEV_KILLSW; i++) { |
| 309 | if (!devs_present[i]) |
| 310 | continue; |
| 311 | |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 312 | ideapad_register_rfkill(adevice, i); |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 313 | } |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 314 | ideapad_sync_rfk_state(adevice); |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 315 | return 0; |
| 316 | } |
| 317 | |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 318 | static int ideapad_acpi_remove(struct acpi_device *adevice, int type) |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 319 | { |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 320 | struct ideapad_private *priv = dev_get_drvdata(&adevice->dev); |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 321 | int i; |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 322 | |
| 323 | device_remove_file(&adevice->dev, &dev_attr_camera_power); |
| 324 | |
| 325 | for (i = IDEAPAD_DEV_WLAN; i <= IDEAPAD_DEV_KILLSW; i++) |
| 326 | ideapad_unregister_rfkill(adevice, i); |
| 327 | |
| 328 | dev_set_drvdata(&adevice->dev, NULL); |
| 329 | kfree(priv); |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 330 | return 0; |
| 331 | } |
| 332 | |
David Woodhouse | ce32632 | 2010-08-11 17:59:35 +0100 | [diff] [blame] | 333 | static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event) |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 334 | { |
Ike Panhc | 8e7d354 | 2010-10-01 15:39:05 +0800 | [diff] [blame] | 335 | acpi_handle handle = adevice->handle; |
| 336 | unsigned long vpc1, vpc2, vpc_bit; |
| 337 | |
| 338 | if (read_ec_data(handle, 0x10, &vpc1)) |
| 339 | return; |
| 340 | if (read_ec_data(handle, 0x1A, &vpc2)) |
| 341 | return; |
| 342 | |
| 343 | vpc1 = (vpc2 << 8) | vpc1; |
| 344 | for (vpc_bit = 0; vpc_bit < 16; vpc_bit++) { |
| 345 | if (test_bit(vpc_bit, &vpc1)) { |
| 346 | if (vpc_bit == 9) |
| 347 | ideapad_sync_rfk_state(adevice); |
| 348 | } |
| 349 | } |
David Woodhouse | 58ac7aa | 2010-08-10 23:44:05 +0100 | [diff] [blame] | 350 | } |
| 351 | |
| 352 | static struct acpi_driver ideapad_acpi_driver = { |
| 353 | .name = "ideapad_acpi", |
| 354 | .class = "IdeaPad", |
| 355 | .ids = ideapad_device_ids, |
| 356 | .ops.add = ideapad_acpi_add, |
| 357 | .ops.remove = ideapad_acpi_remove, |
| 358 | .ops.notify = ideapad_acpi_notify, |
| 359 | .owner = THIS_MODULE, |
| 360 | }; |
| 361 | |
| 362 | |
| 363 | static int __init ideapad_acpi_module_init(void) |
| 364 | { |
| 365 | acpi_bus_register_driver(&ideapad_acpi_driver); |
| 366 | |
| 367 | return 0; |
| 368 | } |
| 369 | |
| 370 | |
| 371 | static void __exit ideapad_acpi_module_exit(void) |
| 372 | { |
| 373 | acpi_bus_unregister_driver(&ideapad_acpi_driver); |
| 374 | |
| 375 | } |
| 376 | |
| 377 | MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>"); |
| 378 | MODULE_DESCRIPTION("IdeaPad ACPI Extras"); |
| 379 | MODULE_LICENSE("GPL"); |
| 380 | |
| 381 | module_init(ideapad_acpi_module_init); |
| 382 | module_exit(ideapad_acpi_module_exit); |