2 * eepc-laptop.c - Asus Eee PC extras
4 * Based on asus_acpi.c as patched for the Eee PC by Asus:
5 * ftp://ftp.asus.com/pub/ASUS/EeePC/701/ASUS_ACPI_071126.rar
6 * Based on eee.c from eeepc-linux
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
19 #include <linux/kernel.h>
20 #include <linux/module.h>
21 #include <linux/init.h>
22 #include <linux/types.h>
23 #include <linux/platform_device.h>
24 #include <linux/backlight.h>
26 #include <linux/hwmon.h>
27 #include <linux/hwmon-sysfs.h>
28 #include <acpi/acpi_drivers.h>
29 #include <acpi/acpi_bus.h>
30 #include <linux/uaccess.h>
31 #include <linux/input.h>
32 #include <linux/rfkill.h>
34 #define EEEPC_LAPTOP_VERSION "0.1"
36 #define EEEPC_HOTK_NAME "Eee PC Hotkey Driver"
37 #define EEEPC_HOTK_FILE "eeepc"
38 #define EEEPC_HOTK_CLASS "hotkey"
39 #define EEEPC_HOTK_DEVICE_NAME "Hotkey"
40 #define EEEPC_HOTK_HID "ASUS010"
42 #define EEEPC_LOG EEEPC_HOTK_FILE ": "
43 #define EEEPC_ERR KERN_ERR EEEPC_LOG
44 #define EEEPC_WARNING KERN_WARNING EEEPC_LOG
45 #define EEEPC_NOTICE KERN_NOTICE EEEPC_LOG
46 #define EEEPC_INFO KERN_INFO EEEPC_LOG
49 * Definitions for Asus EeePC
51 #define NOTIFY_WLAN_ON 0x10
52 #define NOTIFY_BRN_MIN 0x20
53 #define NOTIFY_BRN_MAX 0x2f
56 DISABLE_ASL_WLAN = 0x0001,
57 DISABLE_ASL_BLUETOOTH = 0x0002,
58 DISABLE_ASL_IRDA = 0x0004,
59 DISABLE_ASL_CAMERA = 0x0008,
60 DISABLE_ASL_TV = 0x0010,
61 DISABLE_ASL_GPS = 0x0020,
62 DISABLE_ASL_DISPLAYSWITCH = 0x0040,
63 DISABLE_ASL_MODEM = 0x0080,
64 DISABLE_ASL_CARDREADER = 0x0100
81 CM_ASL_CPUTEMPERATURE,
92 static const char *cm_getv[] = {
93 "WLDG", "BTHG", NULL, NULL,
94 "CAMG", NULL, NULL, NULL,
95 NULL, "PBLG", NULL, NULL,
96 "CFVG", NULL, NULL, NULL,
97 "USBG", NULL, NULL, "MODG",
101 static const char *cm_setv[] = {
102 "WLDS", "BTHS", NULL, NULL,
103 "CAMS", NULL, NULL, NULL,
104 "SDSP", "PBLS", "HDPS", NULL,
105 "CFVS", NULL, NULL, NULL,
106 "USBG", NULL, NULL, "MODS",
110 #define EEEPC_EC "\\_SB.PCI0.SBRG.EC0."
112 #define EEEPC_EC_FAN_PWM EEEPC_EC "SC02" /* Fan PWM duty cycle (%) */
113 #define EEEPC_EC_SC02 0x63
114 #define EEEPC_EC_FAN_HRPM EEEPC_EC "SC05" /* High byte, fan speed (RPM) */
115 #define EEEPC_EC_FAN_LRPM EEEPC_EC "SC06" /* Low byte, fan speed (RPM) */
116 #define EEEPC_EC_FAN_CTRL EEEPC_EC "SFB3" /* Byte containing SF25 */
117 #define EEEPC_EC_SFB3 0xD3
120 * This is the main structure, we can use it to store useful information
121 * about the hotk device
124 struct acpi_device *device; /* the device we are in */
125 acpi_handle handle; /* the handle of the hotk device */
126 u32 cm_supported; /* the control methods supported
128 uint init_flag; /* Init flags */
129 u16 event_count[128]; /* count for each event */
130 struct input_dev *inputdev;
132 struct rfkill *eeepc_wlan_rfkill;
133 struct rfkill *eeepc_bluetooth_rfkill;
136 /* The actual device the driver binds to */
137 static struct eeepc_hotk *ehotk;
139 /* Platform device/driver */
140 static struct platform_driver platform_driver = {
142 .name = EEEPC_HOTK_FILE,
143 .owner = THIS_MODULE,
147 static struct platform_device *platform_device;
155 enum { KE_KEY, KE_END };
157 static struct key_entry eeepc_keymap[] = {
158 /* Sleep already handled via generic ACPI code */
159 {KE_KEY, 0x10, KEY_WLAN },
160 {KE_KEY, 0x12, KEY_PROG1 },
161 {KE_KEY, 0x13, KEY_MUTE },
162 {KE_KEY, 0x14, KEY_VOLUMEDOWN },
163 {KE_KEY, 0x15, KEY_VOLUMEUP },
164 {KE_KEY, 0x1a, KEY_COFFEE },
165 {KE_KEY, 0x1b, KEY_ZOOM },
166 {KE_KEY, 0x1c, KEY_PROG2 },
167 {KE_KEY, 0x1d, KEY_PROG3 },
168 {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE },
169 {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE },
170 {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE },
175 * The hotkey driver declaration
177 static int eeepc_hotk_add(struct acpi_device *device);
178 static int eeepc_hotk_remove(struct acpi_device *device, int type);
180 static const struct acpi_device_id eeepc_device_ids[] = {
184 MODULE_DEVICE_TABLE(acpi, eeepc_device_ids);
186 static struct acpi_driver eeepc_hotk_driver = {
187 .name = EEEPC_HOTK_NAME,
188 .class = EEEPC_HOTK_CLASS,
189 .ids = eeepc_device_ids,
191 .add = eeepc_hotk_add,
192 .remove = eeepc_hotk_remove,
196 /* The backlight device /sys/class/backlight */
197 static struct backlight_device *eeepc_backlight_device;
199 /* The hwmon device */
200 static struct device *eeepc_hwmon_device;
203 * The backlight class declaration
205 static int read_brightness(struct backlight_device *bd);
206 static int update_bl_status(struct backlight_device *bd);
207 static struct backlight_ops eeepcbl_ops = {
208 .get_brightness = read_brightness,
209 .update_status = update_bl_status,
212 MODULE_AUTHOR("Corentin Chary, Eric Cooper");
213 MODULE_DESCRIPTION(EEEPC_HOTK_NAME);
214 MODULE_LICENSE("GPL");
219 static int write_acpi_int(acpi_handle handle, const char *method, int val,
220 struct acpi_buffer *output)
222 struct acpi_object_list params;
223 union acpi_object in_obj;
227 params.pointer = &in_obj;
228 in_obj.type = ACPI_TYPE_INTEGER;
229 in_obj.integer.value = val;
231 status = acpi_evaluate_object(handle, (char *)method, ¶ms, output);
232 return (status == AE_OK ? 0 : -1);
235 static int read_acpi_int(acpi_handle handle, const char *method, int *val)
238 unsigned long long result;
240 status = acpi_evaluate_integer(handle, (char *)method, NULL, &result);
241 if (ACPI_FAILURE(status)) {
250 static int set_acpi(int cm, int value)
252 if (ehotk->cm_supported & (0x1 << cm)) {
253 const char *method = cm_setv[cm];
256 if (write_acpi_int(ehotk->handle, method, value, NULL))
257 printk(EEEPC_WARNING "Error writing %s\n", method);
262 static int get_acpi(int cm)
265 if ((ehotk->cm_supported & (0x1 << cm))) {
266 const char *method = cm_getv[cm];
269 if (read_acpi_int(ehotk->handle, method, &value))
270 printk(EEEPC_WARNING "Error reading %s\n", method);
278 static int read_brightness(struct backlight_device *bd)
280 return get_acpi(CM_ASL_PANELBRIGHT);
283 static int set_brightness(struct backlight_device *bd, int value)
285 value = max(0, min(15, value));
286 return set_acpi(CM_ASL_PANELBRIGHT, value);
289 static int update_bl_status(struct backlight_device *bd)
291 return set_brightness(bd, bd->props.brightness);
298 static int eeepc_wlan_rfkill_set(void *data, enum rfkill_state state)
300 if (state == RFKILL_STATE_SOFT_BLOCKED)
301 return set_acpi(CM_ASL_WLAN, 0);
303 return set_acpi(CM_ASL_WLAN, 1);
306 static int eeepc_wlan_rfkill_state(void *data, enum rfkill_state *state)
308 if (get_acpi(CM_ASL_WLAN) == 1)
309 *state = RFKILL_STATE_UNBLOCKED;
311 *state = RFKILL_STATE_SOFT_BLOCKED;
315 static int eeepc_bluetooth_rfkill_set(void *data, enum rfkill_state state)
317 if (state == RFKILL_STATE_SOFT_BLOCKED)
318 return set_acpi(CM_ASL_BLUETOOTH, 0);
320 return set_acpi(CM_ASL_BLUETOOTH, 1);
323 static int eeepc_bluetooth_rfkill_state(void *data, enum rfkill_state *state)
325 if (get_acpi(CM_ASL_BLUETOOTH) == 1)
326 *state = RFKILL_STATE_UNBLOCKED;
328 *state = RFKILL_STATE_SOFT_BLOCKED;
335 static int parse_arg(const char *buf, unsigned long count, int *val)
339 if (sscanf(buf, "%i", val) != 1)
344 static ssize_t store_sys_acpi(int cm, const char *buf, size_t count)
348 rv = parse_arg(buf, count, &value);
354 static ssize_t show_sys_acpi(int cm, char *buf)
356 return sprintf(buf, "%d\n", get_acpi(cm));
359 #define EEEPC_CREATE_DEVICE_ATTR(_name, _cm) \
360 static ssize_t show_##_name(struct device *dev, \
361 struct device_attribute *attr, \
364 return show_sys_acpi(_cm, buf); \
366 static ssize_t store_##_name(struct device *dev, \
367 struct device_attribute *attr, \
368 const char *buf, size_t count) \
370 return store_sys_acpi(_cm, buf, count); \
372 static struct device_attribute dev_attr_##_name = { \
374 .name = __stringify(_name), \
376 .show = show_##_name, \
377 .store = store_##_name, \
380 EEEPC_CREATE_DEVICE_ATTR(camera, CM_ASL_CAMERA);
381 EEEPC_CREATE_DEVICE_ATTR(cardr, CM_ASL_CARDREADER);
382 EEEPC_CREATE_DEVICE_ATTR(disp, CM_ASL_DISPLAYSWITCH);
384 static struct attribute *platform_attributes[] = {
385 &dev_attr_camera.attr,
386 &dev_attr_cardr.attr,
391 static struct attribute_group platform_attribute_group = {
392 .attrs = platform_attributes
398 static struct key_entry *eepc_get_entry_by_scancode(int code)
400 struct key_entry *key;
402 for (key = eeepc_keymap; key->type != KE_END; key++)
403 if (code == key->code)
409 static struct key_entry *eepc_get_entry_by_keycode(int code)
411 struct key_entry *key;
413 for (key = eeepc_keymap; key->type != KE_END; key++)
414 if (code == key->keycode && key->type == KE_KEY)
420 static int eeepc_getkeycode(struct input_dev *dev, int scancode, int *keycode)
422 struct key_entry *key = eepc_get_entry_by_scancode(scancode);
424 if (key && key->type == KE_KEY) {
425 *keycode = key->keycode;
432 static int eeepc_setkeycode(struct input_dev *dev, int scancode, int keycode)
434 struct key_entry *key;
437 if (keycode < 0 || keycode > KEY_MAX)
440 key = eepc_get_entry_by_scancode(scancode);
441 if (key && key->type == KE_KEY) {
442 old_keycode = key->keycode;
443 key->keycode = keycode;
444 set_bit(keycode, dev->keybit);
445 if (!eepc_get_entry_by_keycode(old_keycode))
446 clear_bit(old_keycode, dev->keybit);
453 static int eeepc_hotk_check(void)
455 const struct key_entry *key;
456 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
459 result = acpi_bus_get_status(ehotk->device);
462 if (ehotk->device->status.present) {
463 if (write_acpi_int(ehotk->handle, "INIT", ehotk->init_flag,
465 printk(EEEPC_ERR "Hotkey initialization failed\n");
468 printk(EEEPC_NOTICE "Hotkey init flags 0x%x\n",
471 /* get control methods supported */
472 if (read_acpi_int(ehotk->handle, "CMSG"
473 , &ehotk->cm_supported)) {
475 "Get control methods supported failed\n");
479 "Get control methods supported: 0x%x\n",
480 ehotk->cm_supported);
482 ehotk->inputdev = input_allocate_device();
483 if (!ehotk->inputdev) {
484 printk(EEEPC_INFO "Unable to allocate input device\n");
487 ehotk->inputdev->name = "Asus EeePC extra buttons";
488 ehotk->inputdev->phys = EEEPC_HOTK_FILE "/input0";
489 ehotk->inputdev->id.bustype = BUS_HOST;
490 ehotk->inputdev->getkeycode = eeepc_getkeycode;
491 ehotk->inputdev->setkeycode = eeepc_setkeycode;
493 for (key = eeepc_keymap; key->type != KE_END; key++) {
496 set_bit(EV_KEY, ehotk->inputdev->evbit);
497 set_bit(key->keycode, ehotk->inputdev->keybit);
501 result = input_register_device(ehotk->inputdev);
503 printk(EEEPC_INFO "Unable to register input device\n");
504 input_free_device(ehotk->inputdev);
508 printk(EEEPC_ERR "Hotkey device not present, aborting\n");
514 static void notify_brn(void)
516 struct backlight_device *bd = eeepc_backlight_device;
517 bd->props.brightness = read_brightness(bd);
520 static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
522 static struct key_entry *key;
525 if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX)
527 acpi_bus_generate_proc_event(ehotk->device, event,
528 ehotk->event_count[event % 128]++);
529 if (ehotk->inputdev) {
530 key = eepc_get_entry_by_scancode(event);
534 input_report_key(ehotk->inputdev, key->keycode,
536 input_sync(ehotk->inputdev);
537 input_report_key(ehotk->inputdev, key->keycode,
539 input_sync(ehotk->inputdev);
546 static int eeepc_hotk_add(struct acpi_device *device)
548 acpi_status status = AE_OK;
553 printk(EEEPC_NOTICE EEEPC_HOTK_NAME "\n");
554 ehotk = kzalloc(sizeof(struct eeepc_hotk), GFP_KERNEL);
557 ehotk->init_flag = DISABLE_ASL_WLAN | DISABLE_ASL_DISPLAYSWITCH;
558 ehotk->handle = device->handle;
559 strcpy(acpi_device_name(device), EEEPC_HOTK_DEVICE_NAME);
560 strcpy(acpi_device_class(device), EEEPC_HOTK_CLASS);
561 device->driver_data = ehotk;
562 ehotk->device = device;
563 result = eeepc_hotk_check();
566 status = acpi_install_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
567 eeepc_hotk_notify, ehotk);
568 if (ACPI_FAILURE(status))
569 printk(EEEPC_ERR "Error installing notify handler\n");
571 if (get_acpi(CM_ASL_WLAN) != -1) {
572 ehotk->eeepc_wlan_rfkill = rfkill_allocate(&device->dev,
575 if (!ehotk->eeepc_wlan_rfkill)
578 ehotk->eeepc_wlan_rfkill->name = "eeepc-wlan";
579 ehotk->eeepc_wlan_rfkill->toggle_radio = eeepc_wlan_rfkill_set;
580 ehotk->eeepc_wlan_rfkill->get_state = eeepc_wlan_rfkill_state;
581 if (get_acpi(CM_ASL_WLAN) == 1) {
582 ehotk->eeepc_wlan_rfkill->state =
583 RFKILL_STATE_UNBLOCKED;
584 rfkill_set_default(RFKILL_TYPE_WLAN,
585 RFKILL_STATE_UNBLOCKED);
587 ehotk->eeepc_wlan_rfkill->state =
588 RFKILL_STATE_SOFT_BLOCKED;
589 rfkill_set_default(RFKILL_TYPE_WLAN,
590 RFKILL_STATE_SOFT_BLOCKED);
592 result = rfkill_register(ehotk->eeepc_wlan_rfkill);
597 if (get_acpi(CM_ASL_BLUETOOTH) != -1) {
598 ehotk->eeepc_bluetooth_rfkill =
599 rfkill_allocate(&device->dev, RFKILL_TYPE_BLUETOOTH);
601 if (!ehotk->eeepc_bluetooth_rfkill)
604 ehotk->eeepc_bluetooth_rfkill->name = "eeepc-bluetooth";
605 ehotk->eeepc_bluetooth_rfkill->toggle_radio =
606 eeepc_bluetooth_rfkill_set;
607 ehotk->eeepc_bluetooth_rfkill->get_state =
608 eeepc_bluetooth_rfkill_state;
609 if (get_acpi(CM_ASL_BLUETOOTH) == 1) {
610 ehotk->eeepc_bluetooth_rfkill->state =
611 RFKILL_STATE_UNBLOCKED;
612 rfkill_set_default(RFKILL_TYPE_BLUETOOTH,
613 RFKILL_STATE_UNBLOCKED);
615 ehotk->eeepc_bluetooth_rfkill->state =
616 RFKILL_STATE_SOFT_BLOCKED;
617 rfkill_set_default(RFKILL_TYPE_BLUETOOTH,
618 RFKILL_STATE_SOFT_BLOCKED);
621 result = rfkill_register(ehotk->eeepc_bluetooth_rfkill);
628 if (ehotk->eeepc_bluetooth_rfkill)
629 rfkill_free(ehotk->eeepc_bluetooth_rfkill);
630 rfkill_unregister(ehotk->eeepc_wlan_rfkill);
631 ehotk->eeepc_wlan_rfkill = NULL;
633 if (ehotk->eeepc_wlan_rfkill)
634 rfkill_free(ehotk->eeepc_wlan_rfkill);
642 static int eeepc_hotk_remove(struct acpi_device *device, int type)
644 acpi_status status = 0;
646 if (!device || !acpi_driver_data(device))
648 status = acpi_remove_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
650 if (ACPI_FAILURE(status))
651 printk(EEEPC_ERR "Error removing notify handler\n");
659 static int eeepc_get_fan_pwm(void)
663 read_acpi_int(NULL, EEEPC_EC_FAN_PWM, &value);
664 value = value * 255 / 100;
668 static void eeepc_set_fan_pwm(int value)
670 value = SENSORS_LIMIT(value, 0, 255);
671 value = value * 100 / 255;
672 ec_write(EEEPC_EC_SC02, value);
675 static int eeepc_get_fan_rpm(void)
680 read_acpi_int(NULL, EEEPC_EC_FAN_HRPM, &high);
681 read_acpi_int(NULL, EEEPC_EC_FAN_LRPM, &low);
682 return (high << 8 | low);
685 static int eeepc_get_fan_ctrl(void)
689 read_acpi_int(NULL, EEEPC_EC_FAN_CTRL, &value);
690 return ((value & 0x02 ? 1 : 0));
693 static void eeepc_set_fan_ctrl(int manual)
697 read_acpi_int(NULL, EEEPC_EC_FAN_CTRL, &value);
702 ec_write(EEEPC_EC_SFB3, value);
705 static ssize_t store_sys_hwmon(void (*set)(int), const char *buf, size_t count)
709 rv = parse_arg(buf, count, &value);
715 static ssize_t show_sys_hwmon(int (*get)(void), char *buf)
717 return sprintf(buf, "%d\n", get());
720 #define EEEPC_CREATE_SENSOR_ATTR(_name, _mode, _set, _get) \
721 static ssize_t show_##_name(struct device *dev, \
722 struct device_attribute *attr, \
725 return show_sys_hwmon(_set, buf); \
727 static ssize_t store_##_name(struct device *dev, \
728 struct device_attribute *attr, \
729 const char *buf, size_t count) \
731 return store_sys_hwmon(_get, buf, count); \
733 static SENSOR_DEVICE_ATTR(_name, _mode, show_##_name, store_##_name, 0);
735 EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL);
736 EEEPC_CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR,
737 eeepc_get_fan_pwm, eeepc_set_fan_pwm);
738 EEEPC_CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR,
739 eeepc_get_fan_ctrl, eeepc_set_fan_ctrl);
742 show_name(struct device *dev, struct device_attribute *attr, char *buf)
744 return sprintf(buf, "eeepc\n");
746 static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
748 static struct attribute *hwmon_attributes[] = {
749 &sensor_dev_attr_pwm1.dev_attr.attr,
750 &sensor_dev_attr_fan1_input.dev_attr.attr,
751 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
752 &sensor_dev_attr_name.dev_attr.attr,
756 static struct attribute_group hwmon_attribute_group = {
757 .attrs = hwmon_attributes
763 static void eeepc_backlight_exit(void)
765 if (eeepc_backlight_device)
766 backlight_device_unregister(eeepc_backlight_device);
767 eeepc_backlight_device = NULL;
770 static void eeepc_rfkill_exit(void)
772 if (ehotk->eeepc_wlan_rfkill)
773 rfkill_unregister(ehotk->eeepc_wlan_rfkill);
774 if (ehotk->eeepc_bluetooth_rfkill)
775 rfkill_unregister(ehotk->eeepc_bluetooth_rfkill);
778 static void eeepc_input_exit(void)
781 input_unregister_device(ehotk->inputdev);
784 static void eeepc_hwmon_exit(void)
786 struct device *hwmon;
788 hwmon = eeepc_hwmon_device;
791 sysfs_remove_group(&hwmon->kobj,
792 &hwmon_attribute_group);
793 hwmon_device_unregister(hwmon);
794 eeepc_hwmon_device = NULL;
797 static void __exit eeepc_laptop_exit(void)
799 eeepc_backlight_exit();
803 acpi_bus_unregister_driver(&eeepc_hotk_driver);
804 sysfs_remove_group(&platform_device->dev.kobj,
805 &platform_attribute_group);
806 platform_device_unregister(platform_device);
807 platform_driver_unregister(&platform_driver);
810 static int eeepc_backlight_init(struct device *dev)
812 struct backlight_device *bd;
814 bd = backlight_device_register(EEEPC_HOTK_FILE, dev,
818 "Could not register eeepc backlight device\n");
819 eeepc_backlight_device = NULL;
822 eeepc_backlight_device = bd;
823 bd->props.max_brightness = 15;
824 bd->props.brightness = read_brightness(NULL);
825 bd->props.power = FB_BLANK_UNBLANK;
826 backlight_update_status(bd);
830 static int eeepc_hwmon_init(struct device *dev)
832 struct device *hwmon;
835 hwmon = hwmon_device_register(dev);
838 "Could not register eeepc hwmon device\n");
839 eeepc_hwmon_device = NULL;
840 return PTR_ERR(hwmon);
842 eeepc_hwmon_device = hwmon;
843 result = sysfs_create_group(&hwmon->kobj,
844 &hwmon_attribute_group);
850 static int __init eeepc_laptop_init(void)
857 result = acpi_bus_register_driver(&eeepc_hotk_driver);
861 acpi_bus_unregister_driver(&eeepc_hotk_driver);
864 dev = acpi_get_physical_device(ehotk->device->handle);
866 if (!acpi_video_backlight_support()) {
867 result = eeepc_backlight_init(dev);
871 printk(EEEPC_INFO "Backlight controlled by ACPI video "
874 result = eeepc_hwmon_init(dev);
877 /* Register platform stuff */
878 result = platform_driver_register(&platform_driver);
880 goto fail_platform_driver;
881 platform_device = platform_device_alloc(EEEPC_HOTK_FILE, -1);
882 if (!platform_device) {
884 goto fail_platform_device1;
886 result = platform_device_add(platform_device);
888 goto fail_platform_device2;
889 result = sysfs_create_group(&platform_device->dev.kobj,
890 &platform_attribute_group);
895 platform_device_del(platform_device);
896 fail_platform_device2:
897 platform_device_put(platform_device);
898 fail_platform_device1:
899 platform_driver_unregister(&platform_driver);
900 fail_platform_driver:
903 eeepc_backlight_exit();
910 module_init(eeepc_laptop_init);
911 module_exit(eeepc_laptop_exit);