Lines Matching +full:battery +full:- +full:driven
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * thinkpad_acpi.c - ThinkPad ACPI Extras
5 * Copyright (C) 2004-2005 Borislav Deianov <borislav@users.sf.net>
6 * Copyright (C) 2006-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br>
16 * 2007-10-20 changelog trimmed down
18 * 2007-03-27 0.14 renamed to thinkpad_acpi and moved to
21 * 2006-11-22 0.13 new maintainer
23 * not be updated further in-file.
25 * 2005-03-17 0.11 support for 600e, 770x
28 * 2005-01-16 0.9 use MODULE_VERSION
33 * 2004-11-08 0.8 fix init error case, don't return from a macro
45 #include <linux/hwmon-sysfs.h>
74 #include <acpi/battery.h>
120 /* Misc NVRAM-related */
159 /* Hotkey-related */
175 TP_HKEY_EV_WKUP_S3_BATLOW = 0x2313, /* battery empty, S3 */
176 TP_HKEY_EV_WKUP_S4_BATLOW = 0x2413, /* battery empty, S4 */
178 /* Auto-sleep after eject request */
195 /* User-interface events */
207 /* Key-related user-interface events */
213 TP_HKEY_EV_ALARM_BAT_HOT = 0x6011, /* battery too hot */
214 TP_HKEY_EV_ALARM_BAT_XHOT = 0x6012, /* battery critically hot */
224 /* AC-related events */
227 /* Further user-interface events */
242 #define TPACPI_URL "http://ibm-acpi.sf.net/"
243 #define TPACPI_MAIL "ibm-acpi-devel@lists.sourceforge.net"
270 * Driver-wide structs and misc. variables
367 char *ec_version_str; /* Something like 1ZHT51WW-1.04a */
375 char *nummodel_str; /* 9384A9C for a 9384-A9C model */
456 * two or three characters from the set [0-9A-Z], i.e. base 36.
508 * tpacpi_check_quirks() - search BIOS/EC version on a list
525 if ((qlist->vendor == thinkpad_id.vendor || in tpacpi_check_quirks()
526 qlist->vendor == TPACPI_MATCH_ANY) && in tpacpi_check_quirks()
527 (qlist->bios == thinkpad_id.bios_model || in tpacpi_check_quirks()
528 qlist->bios == TPACPI_MATCH_ANY) && in tpacpi_check_quirks()
529 (qlist->ec == thinkpad_id.ec_model || in tpacpi_check_quirks()
530 qlist->ec == TPACPI_MATCH_ANY)) in tpacpi_check_quirks()
531 return qlist->quirks; in tpacpi_check_quirks()
533 qlist_size--; in tpacpi_check_quirks()
575 "\\CMOS", /* A3x, G4x, R32, T23, T30, X22-24, X30 */
701 return -ENXIO; in issue_thinkpad_cmos_command()
704 return -EIO; in issue_thinkpad_cmos_command()
793 if (!ibm || !ibm->acpi || !ibm->acpi->notify) in dispatch_acpi_notify()
796 ibm->acpi->notify(ibm, event); in dispatch_acpi_notify()
803 BUG_ON(!ibm->acpi); in setup_acpi_notify()
805 if (!*ibm->acpi->handle) in setup_acpi_notify()
809 "setting up ACPI notify for %s\n", ibm->name); in setup_acpi_notify()
811 ibm->acpi->device = acpi_fetch_acpi_dev(*ibm->acpi->handle); in setup_acpi_notify()
812 if (!ibm->acpi->device) { in setup_acpi_notify()
813 pr_err("acpi_fetch_acpi_dev(%s) failed\n", ibm->name); in setup_acpi_notify()
814 return -ENODEV; in setup_acpi_notify()
817 ibm->acpi->device->driver_data = ibm; in setup_acpi_notify()
818 sprintf(acpi_device_class(ibm->acpi->device), "%s/%s", in setup_acpi_notify()
820 ibm->name); in setup_acpi_notify()
822 status = acpi_install_notify_handler(*ibm->acpi->handle, in setup_acpi_notify()
823 ibm->acpi->type, dispatch_acpi_notify, ibm); in setup_acpi_notify()
827 ibm->name); in setup_acpi_notify()
830 ibm->name, acpi_format_exception(status)); in setup_acpi_notify()
832 return -ENODEV; in setup_acpi_notify()
834 ibm->flags.acpi_notify_installed = 1; in setup_acpi_notify()
848 "registering %s as an ACPI driver\n", ibm->name); in register_tpacpi_subdriver()
850 BUG_ON(!ibm->acpi); in register_tpacpi_subdriver()
852 ibm->acpi->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL); in register_tpacpi_subdriver()
853 if (!ibm->acpi->driver) { in register_tpacpi_subdriver()
854 pr_err("failed to allocate memory for ibm->acpi->driver\n"); in register_tpacpi_subdriver()
855 return -ENOMEM; in register_tpacpi_subdriver()
858 sprintf(ibm->acpi->driver->name, "%s_%s", TPACPI_NAME, ibm->name); in register_tpacpi_subdriver()
859 ibm->acpi->driver->ids = ibm->acpi->hid; in register_tpacpi_subdriver()
861 ibm->acpi->driver->ops.add = &tpacpi_device_add; in register_tpacpi_subdriver()
863 rc = acpi_bus_register_driver(ibm->acpi->driver); in register_tpacpi_subdriver()
866 ibm->name, rc); in register_tpacpi_subdriver()
867 kfree(ibm->acpi->driver); in register_tpacpi_subdriver()
868 ibm->acpi->driver = NULL; in register_tpacpi_subdriver()
870 ibm->flags.acpi_driver_registered = 1; in register_tpacpi_subdriver()
886 struct ibm_struct *ibm = m->private; in dispatch_proc_show()
888 if (!ibm || !ibm->read) in dispatch_proc_show()
889 return -EINVAL; in dispatch_proc_show()
890 return ibm->read(m); in dispatch_proc_show()
906 if (!ibm || !ibm->write) in dispatch_proc_write()
907 return -EINVAL; in dispatch_proc_write()
908 if (count > PAGE_SIZE - 1) in dispatch_proc_write()
909 return -EINVAL; in dispatch_proc_write()
914 ret = ibm->write(kernbuf); in dispatch_proc_write()
954 if (ibm->suspend) in tpacpi_suspend_handler()
955 (ibm->suspend)(); in tpacpi_suspend_handler()
968 if (ibm->resume) in tpacpi_resume_handler()
969 (ibm->resume)(); in tpacpi_resume_handler()
986 if (ibm->shutdown) in tpacpi_shutdown_handler()
987 (ibm->shutdown)(); in tpacpi_shutdown_handler()
1003 return -EINVAL; in parse_strtoul()
1027 * ThinkPad-ACPI firmware handling model:
1029 * WLSW (master wireless switch) is event-driven, and is common to all
1030 * firmware-controlled radios. It cannot be controlled, just monitored,
1033 * The kernel, a masked-off hotkey, and WLSW can change the radio state
1037 * masked-off hotkeys are used.
1066 /* ThinkPad-ACPI rfkill subdriver */
1087 return -ENODEV; in tpacpi_rfk_update_swstate()
1089 status = (tp_rfk->ops->get_status)(); in tpacpi_rfk_update_swstate()
1093 rfkill_set_sw_state(tp_rfk->rfkill, in tpacpi_rfk_update_swstate()
1100 * Sync the HW-blocking state of all rfkill switches,
1111 if (rfkill_set_hw_state(tp_rfk->rfkill, in tpacpi_rfk_update_hwblock_state()
1113 /* ignore -- we track sw block */ in tpacpi_rfk_update_hwblock_state()
1148 res = (tp_rfk->ops->set_status)(blocked ? in tpacpi_rfk_hook_set_block()
1177 atp_rfk->rfkill = rfkill_alloc(name, in tpacpi_new_rfkill()
1178 &tpacpi_pdev->dev, in tpacpi_new_rfkill()
1182 if (!atp_rfk || !atp_rfk->rfkill) { in tpacpi_new_rfkill()
1185 return -ENOMEM; in tpacpi_new_rfkill()
1188 atp_rfk->id = id; in tpacpi_new_rfkill()
1189 atp_rfk->ops = tp_rfkops; in tpacpi_new_rfkill()
1191 sw_status = (tp_rfkops->get_status)(); in tpacpi_new_rfkill()
1200 rfkill_init_sw_state(atp_rfk->rfkill, sw_state); in tpacpi_new_rfkill()
1204 rfkill_set_hw_state(atp_rfk->rfkill, hw_state); in tpacpi_new_rfkill()
1206 res = rfkill_register(atp_rfk->rfkill); in tpacpi_new_rfkill()
1209 rfkill_destroy(atp_rfk->rfkill); in tpacpi_new_rfkill()
1229 rfkill_unregister(tp_rfk->rfkill); in tpacpi_destroy_rfkill()
1230 rfkill_destroy(tp_rfk->rfkill); in tpacpi_destroy_rfkill()
1242 /* sysfs <radio> enable ------------------------------------------------ */
1249 printk_deprecated_rfkill_attribute(attr->attr.name); in tpacpi_rfk_sysfs_enable_show()
1271 printk_deprecated_rfkill_attribute(attr->attr.name); in tpacpi_rfk_sysfs_enable_store()
1274 return -EINVAL; in tpacpi_rfk_sysfs_enable_store()
1276 tpacpi_disclose_usertask(attr->attr.name, "set to %ld\n", t); in tpacpi_rfk_sysfs_enable_store()
1280 return -EPERM; in tpacpi_rfk_sysfs_enable_store()
1282 res = tpacpi_rfkill_switches[id]->ops->set_status((!!t) ? in tpacpi_rfk_sysfs_enable_store()
1289 /* procfs -------------------------------------------------------------- */
1317 int status = -1; in tpacpi_rfk_procfs_write()
1321 return -ENODEV; in tpacpi_rfk_procfs_write()
1329 return -EINVAL; in tpacpi_rfk_procfs_write()
1332 if (status != -1) { in tpacpi_rfk_procfs_write()
1336 res = (tpacpi_rfkill_switches[id]->ops->set_status)(status); in tpacpi_rfk_procfs_write()
1344 * thinkpad-acpi driver attributes
1347 /* interface_version --------------------------------------------------- */
1354 /* debug_level --------------------------------------------------------- */
1366 return -EINVAL; in debug_level_store()
1374 /* version ------------------------------------------------------------- */
1382 /* --------------------------------------------------------------------- */
1386 /* wlsw_emulstate ------------------------------------------------------ */
1398 return -EINVAL; in wlsw_emulstate_store()
1409 /* bluetooth_emulstate ------------------------------------------------- */
1421 return -EINVAL; in bluetooth_emulstate_store()
1429 /* wwan_emulstate ------------------------------------------------- */
1441 return -EINVAL; in wwan_emulstate_store()
1449 /* uwb_emulstate ------------------------------------------------- */
1461 return -EINVAL; in uwb_emulstate_store()
1547 /* Numeric models ------------------ */
1559 /* A-series ------------------------- */
1573 /* G-series ------------------------- */
1578 /* R-series, T-series --------------- */
1608 /* X-series ------------------------- */
1621 /* (0) - older versions lack DMI EC fw string and functionality */
1622 /* (1) - older versions known to lack functionality */
1678 * thinkpad-acpi metadata subdriver
1713 * Unlike other classes, hotkey-class events have mask/unmask control on
1714 * non-ancient firmware. However, how it behaves changes a lot with the
1938 return -ENODEV; in hotkey_get_wlsw()
1947 return -EIO; in hotkey_get_wlsw()
2041 return -EIO; in hotkey_get_tablet_mode()
2047 return -EIO; in hotkey_get_tablet_mode()
2072 return -EIO; in hotkey_mask_get()
2080 /* sync userspace-visible mask */ in hotkey_mask_get()
2118 rc = -EIO; in hotkey_mask_set()
2159 …pr_notice("please consider using the driver defaults, and refer to up-to-date thinkpad-acpi docume… in hotkey_user_mask_set()
2208 return -EIO; in hotkey_status_get()
2216 return -EIO; in hotkey_status_set()
2280 n->thinkpad_toggle = !!(d & TP_NVRAM_MASK_HKT_THINKPAD); in hotkey_read_nvram()
2281 n->zoom_toggle = !!(d & TP_NVRAM_MASK_HKT_ZOOM); in hotkey_read_nvram()
2282 n->display_toggle = !!(d & TP_NVRAM_MASK_HKT_DISPLAY); in hotkey_read_nvram()
2283 n->hibernate_toggle = !!(d & TP_NVRAM_MASK_HKT_HIBERNATE); in hotkey_read_nvram()
2287 n->thinklight_toggle = !!(d & TP_NVRAM_MASK_THINKLIGHT); in hotkey_read_nvram()
2291 n->displayexp_toggle = in hotkey_read_nvram()
2296 n->brightness_level = (d & TP_NVRAM_MASK_LEVEL_BRIGHTNESS) in hotkey_read_nvram()
2298 n->brightness_toggle = in hotkey_read_nvram()
2303 n->volume_level = (d & TP_NVRAM_MASK_LEVEL_VOLUME) in hotkey_read_nvram()
2305 n->mute = !!(d & TP_NVRAM_MASK_MUTE); in hotkey_read_nvram()
2306 n->volume_toggle = !!(d & TP_NVRAM_MASK_HKT_VOLUME); in hotkey_read_nvram()
2313 oldn->__member != newn->__member) \
2331 i--; in issue_volchange()
2347 i--; in issue_brightnesschange()
2373 * - Pressing MUTE issues mute hotkey message, even when already mute in hotkey_compare_and_issue_event()
2374 * - Pressing Volume up/down issues volume up/down hotkey messages, in hotkey_compare_and_issue_event()
2376 * - The act of unmuting issues volume up/down notification, in hotkey_compare_and_issue_event()
2386 if (newn->mute) { in hotkey_compare_and_issue_event()
2388 if (!oldn->mute || in hotkey_compare_and_issue_event()
2389 oldn->volume_toggle != newn->volume_toggle || in hotkey_compare_and_issue_event()
2390 oldn->volume_level != newn->volume_level) { in hotkey_compare_and_issue_event()
2393 issue_volchange(oldn->volume_level, newn->volume_level, in hotkey_compare_and_issue_event()
2399 if (oldn->mute) { in hotkey_compare_and_issue_event()
2403 if (oldn->volume_level != newn->volume_level) { in hotkey_compare_and_issue_event()
2404 issue_volchange(oldn->volume_level, newn->volume_level, in hotkey_compare_and_issue_event()
2406 } else if (oldn->volume_toggle != newn->volume_toggle) { in hotkey_compare_and_issue_event()
2408 if (newn->volume_level == 0) in hotkey_compare_and_issue_event()
2410 else if (newn->volume_level >= TP_NVRAM_LEVEL_VOLUME_MAX) in hotkey_compare_and_issue_event()
2416 if (oldn->brightness_level != newn->brightness_level) { in hotkey_compare_and_issue_event()
2417 issue_brightnesschange(oldn->brightness_level, in hotkey_compare_and_issue_event()
2418 newn->brightness_level, event_mask); in hotkey_compare_and_issue_event()
2419 } else if (oldn->brightness_toggle != newn->brightness_toggle) { in hotkey_compare_and_issue_event()
2421 if (newn->brightness_level == 0) in hotkey_compare_and_issue_event()
2423 else if (newn->brightness_level >= bright_maxlvl in hotkey_compare_and_issue_event()
2436 * most of them are edge-based. We only issue those requested by
2530 (poll_user_mask && tpacpi_inputdev->users > 0))) { in hotkey_poll_setup()
2586 return -EBUSY; in hotkey_inputdev_open()
2591 return -EBUSY; in hotkey_inputdev_open()
2602 /* sysfs hotkey enable ------------------------------------------------- */
2629 return -EINVAL; in hotkey_enable_store()
2632 return -EPERM; in hotkey_enable_store()
2639 /* sysfs hotkey mask --------------------------------------------------- */
2655 return -EINVAL; in hotkey_mask_store()
2658 return -ERESTARTSYS; in hotkey_mask_store()
2675 /* sysfs hotkey bios_enabled ------------------------------------------- */
2685 /* sysfs hotkey bios_mask ---------------------------------------------- */
2697 /* sysfs hotkey all_mask ----------------------------------------------- */
2708 /* sysfs hotkey all_mask ----------------------------------------------- */
2719 /* sysfs hotkey recommended_mask --------------------------------------- */
2733 /* sysfs hotkey hotkey_source_mask ------------------------------------- */
2751 return -EINVAL; in hotkey_source_mask_store()
2754 return -ERESTARTSYS; in hotkey_source_mask_store()
2784 /* sysfs hotkey hotkey_poll_freq --------------------------------------- */
2799 return -EINVAL; in hotkey_poll_freq_store()
2802 return -ERESTARTSYS; in hotkey_poll_freq_store()
2818 /* sysfs hotkey radio_sw (pollable) ------------------------------------ */
2840 sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, in hotkey_radio_sw_notify_change()
2844 /* sysfs hotkey tablet mode (pollable) --------------------------------- */
2862 sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, in hotkey_tablet_mode_notify_change()
2866 /* sysfs wakeup reason (pollable) -------------------------------------- */
2878 sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, in hotkey_wakeup_reason_notify_change()
2882 /* sysfs wakeup hotunplug_complete (pollable) -------------------------- */
2895 sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, in hotkey_wakeup_hotunplug_complete_notify_change()
2899 /* sysfs adaptive kbd mode --------------------------------------------- */
2933 return -EINVAL; in adaptive_kbd_mode_store()
2949 return tp_features.has_adaptive_kbd ? attr->mode : 0; in hadaptive_kbd_attr_is_visible()
2957 /* --------------------------------------------------------------------- */
2989 return attr->mode; in hotkey_attr_is_visible()
3017 /* Sync hw blocking state first if it is hw-blocked */ in tpacpi_send_radiosw_update()
3021 /* Sync hw blocking state last if it is hw-unblocked */ in tpacpi_send_radiosw_update()
3065 tpacpi_inputdev->keybit); in hotkey_unmap()
3149 * firmware at driver load time, which means the firm- in hotkey_init()
3153 * 2. You must be subscribed to the linux-thinkpad and in hotkey_init()
3154 * ibm-acpi-devel mailing lists, and you should read the in hotkey_init()
3157 * know the past history of problems with the thinkpad- in hotkey_init()
3161 * 3. Do not send thinkpad-acpi specific patches directly to in hotkey_init()
3162 * for merging, *ever*. Send them to the linux-acpi in hotkey_init()
3164 * through acpi-test and the ACPI maintainer. in hotkey_init()
3167 * Ask the thinkpad-acpi maintainer to do it, instead. in hotkey_init()
3199 * the built-in *extra* mixer. Never map it to control in hotkey_init()
3240 /* These should be enabled --only-- when ACPI video in hotkey_init()
3252 * react to it and reprograms the built-in *extra* mixer. in hotkey_init()
3256 * these over the regular keyboard, so these are no-ops, in hotkey_init()
3371 BUG_ON(tpacpi_inputdev->open != NULL || in hotkey_init()
3372 tpacpi_inputdev->close != NULL); in hotkey_init()
3389 return -ENODEV; in hotkey_init()
3397 A30, R30, R31, T20-22, X20-21, X22-24. Detected by checking in hotkey_init()
3416 /* Fallback: pre-init for FN+F3,F4,F12 */ in hotkey_init()
3433 /* Fallback: pre-init for FN+F3,F4,F12 */ in hotkey_init()
3513 return -ENOMEM; in hotkey_init()
3517 tpacpi_inputdev->keycodesize = TPACPI_HOTKEY_MAP_TYPESIZE; in hotkey_init()
3518 tpacpi_inputdev->keycodemax = TPACPI_HOTKEY_MAP_LEN; in hotkey_init()
3519 tpacpi_inputdev->keycode = hotkey_keycode_map; in hotkey_init()
3546 pr_notice("Disabling thinkpad-acpi brightness events by default...\n"); in hotkey_init()
3580 if (res < 0 && res != -ENXIO) { in hotkey_init()
3590 tpacpi_inputdev->open = &hotkey_inputdev_open; in hotkey_init()
3591 tpacpi_inputdev->close = &hotkey_inputdev_close; in hotkey_init()
3599 * mode, Web conference mode, Function mode and Lay-flat mode.
3628 return -EIO; in adaptive_keyboard_get_mode()
3638 return -EINVAL; in adaptive_keyboard_set_mode()
3642 return -EIO; in adaptive_keyboard_set_mode()
3651 size_t max_mode = ARRAY_SIZE(adaptive_keyboard_modes) - 1; in adaptive_keyboard_get_next_mode()
3705 TP_ACPI_HOTKEYSCAN_EXTENDED_START - in adaptive_keyboard_hotkey_notify_hotkey()
3711 keycode = hotkey_keycode_map[scancode - FIRST_ADAPTIVE_KEY + in adaptive_keyboard_hotkey_notify_hotkey()
3743 scancode = (hkey & 0xfff) - (0x300 - TP_ACPI_HOTKEYSCAN_EXTENDED_START); in hotkey_notify_extended_hotkey()
3757 /* 0x1000-0x1FFF: key presses */ in hotkey_notify_hotkey()
3772 scancode--; in hotkey_notify_hotkey()
3797 /* 0x2000-0x2FFF: Wakeup reason */ in hotkey_notify_wakeup()
3814 case TP_HKEY_EV_WKUP_S3_BATLOW: /* Battery on critical low level/S3 */ in hotkey_notify_wakeup()
3815 case TP_HKEY_EV_WKUP_S4_BATLOW: /* Battery on critical low level/S4 */ in hotkey_notify_wakeup()
3816 pr_alert("EMERGENCY WAKEUP: battery almost empty\n"); in hotkey_notify_wakeup()
3817 /* how to auto-heal: */ in hotkey_notify_wakeup()
3827 pr_info("woke up due to a hot-unplug request...\n"); in hotkey_notify_wakeup()
3837 /* 0x4000-0x4FFF: dock-related events */ in hotkey_notify_dockevent()
3858 * duplicates from intel-vbtn, which already emits SW_TABLET_MODE events in hotkey_notify_dockevent()
3865 * https://lore.kernel.org/platform-driver-x86/38cb8265-1e30-d547-9e12-b4ae290be737@a-kobel.de/ in hotkey_notify_dockevent()
3882 /* 0x5000-0x5FFF: human interface helpers */ in hotkey_notify_usrevent()
3891 case TP_HKEY_EV_TABLET_TABLET: /* X41t-X61t: tablet mode */ in hotkey_notify_usrevent()
3892 case TP_HKEY_EV_TABLET_NOTEBOOK: /* X41t-X61t: normal mode */ in hotkey_notify_usrevent()
3917 /* 0x6000-0x6FFF: thermal alarms/notices and keyboard events */ in hotkey_notify_6xxx()
3929 /* Thermal event - pass on to event handler */ in hotkey_notify_6xxx()
3938 pr_crit("THERMAL ALARM: battery is too hot!\n"); in hotkey_notify_6xxx()
3942 pr_alert("THERMAL EMERGENCY: battery is extremely hot!\n"); in hotkey_notify_6xxx()
3984 /* palm detected - pass on to event handler */ in hotkey_notify_6xxx()
4008 ibm->acpi->device->pnp.device_class, in hotkey_notify()
4009 dev_name(&ibm->acpi->device->dev), in hotkey_notify()
4030 /* 0x1000-0x1FFF: key presses */ in hotkey_notify()
4035 /* 0x2000-0x2FFF: Wakeup reason */ in hotkey_notify()
4040 /* 0x3000-0x3FFF: bay-related wakeups */ in hotkey_notify()
4057 /* 0x4000-0x4FFF: dock-related events */ in hotkey_notify()
4062 /* 0x5000-0x5FFF: human interface helpers */ in hotkey_notify()
4067 /* 0x6000-0x6FFF: thermal alarms/notices and in hotkey_notify()
4073 /* 0x7000-0x7FFF: misc */ in hotkey_notify()
4094 ibm->acpi->device->pnp.device_class, in hotkey_notify()
4095 dev_name(&ibm->acpi->device->dev), in hotkey_notify()
4142 /* procfs -------------------------------------------------------------- */
4153 return -ERESTARTSYS; in hotkey_read()
4188 return -ENODEV; in hotkey_write()
4191 return -ERESTARTSYS; in hotkey_write()
4201 res = -EPERM; in hotkey_write()
4210 res = -EINVAL; in hotkey_write()
4265 TP_ACPI_BLTH_GET_PWR_ON_RESUME = 0x01, /* Get power-on-resume state */
4284 return -EIO; in bluetooth_get_status()
4311 return -EIO; in bluetooth_set_status()
4316 /* sysfs bluetooth enable ---------------------------------------------- */
4335 /* --------------------------------------------------------------------- */
4345 return tp_features.bluetooth ? attr->mode : 0; in bluetooth_attr_is_visible()
4393 .ident = "ThinkPad A285 - 20MW",
4401 .ident = "ThinkPad A285 - 20MX",
4409 .ident = "ThinkPad A485 - 20MU",
4417 .ident = "ThinkPad A485 - 20MV",
4441 if (tp_features.quirks && tp_features.quirks->btusb_bug && in have_bt_fwbug()
4461 G4x, R30, R31, R40e, R50e, T20-22, X20-21 */ in bluetooth_init()
4485 return -ENODEV; in bluetooth_init()
4495 /* procfs -------------------------------------------------------------- */
4539 return -EIO; in wan_get_status()
4566 return -EIO; in wan_set_status()
4571 /* sysfs wan enable ---------------------------------------------------- */
4591 /* --------------------------------------------------------------------- */
4601 return tp_features.wan ? attr->mode : 0; in wan_attr_is_visible()
4664 return -ENODEV; in wan_init()
4674 /* procfs -------------------------------------------------------------- */
4716 return -EIO; in uwb_get_status()
4742 return -EIO; in uwb_set_status()
4747 /* --------------------------------------------------------------------- */
4792 return -ENODEV; in uwb_init()
4885 return (video_supported != TPACPI_VIDEO_NONE) ? 0 : -ENODEV; in video_init()
4905 return -EIO; in video_outputsw_get()
4910 return -EIO; in video_outputsw_get()
4914 return -EIO; in video_outputsw_get()
4921 return -EIO; in video_outputsw_get()
4927 return -EIO; in video_outputsw_get()
4931 return -EIO; in video_outputsw_get()
4936 return -ENOSYS; in video_outputsw_get()
4965 pr_err("video auto-switch left enabled due to error\n"); in video_outputsw_set()
4966 return -EIO; in video_outputsw_set()
4974 return -ENOSYS; in video_outputsw_set()
4977 return (res) ? 0 : -EIO; in video_outputsw_set()
4987 return -EIO; in video_autosw_get()
4992 return -EIO; in video_autosw_get()
4995 return -ENOSYS; in video_autosw_get()
5004 return -EIO; in video_autosw_set()
5031 return -ENOSYS; in video_outputsw_cycle()
5034 pr_err("video auto-switch left enabled due to error\n"); in video_outputsw_cycle()
5035 return -EIO; in video_outputsw_cycle()
5038 return (res) ? 0 : -EIO; in video_outputsw_cycle()
5046 0 : -EIO; in video_expand_toggle()
5049 0 : -EIO; in video_expand_toggle()
5052 0 : -EIO; in video_expand_toggle()
5054 return -ENOSYS; in video_expand_toggle()
5070 return -EPERM; in video_read()
5103 return -ENODEV; in video_write()
5107 return -EPERM; in video_write()
5144 return -EINVAL; in video_write()
5180 return -ENXIO; in kbdlight_set_level()
5185 ret = -EIO; in kbdlight_set_level()
5199 return -ENXIO; in kbdlight_get_level()
5202 return -EIO; in kbdlight_get_level()
5237 * b010100000010000000XX - ThinkPad X1 Carbon 3rd in kbdlight_is_supported()
5238 * b110100010010000000XX - ThinkPad x230 in kbdlight_is_supported()
5239 * b010100000010000000XX - ThinkPad x240 in kbdlight_is_supported()
5240 * b010100000010000000XX - ThinkPad W541 in kbdlight_is_supported()
5244 * b10100001000000000000 - ThinkPad x230 in kbdlight_is_supported()
5245 * b10110001000000000000 - ThinkPad E430 in kbdlight_is_supported()
5246 * b00000000000000000000 - ThinkPad E450 in kbdlight_is_supported()
5293 return -ENODEV; in kbdlight_init()
5299 rc = led_classdev_register(&tpacpi_pdev->dev, in kbdlight_init()
5324 if (ret == 0 && !(led_cdev->flags & LED_SUSPENDED)) in kbdlight_set_level_and_update()
5325 led_cdev->brightness = level; in kbdlight_set_level_and_update()
5351 int res, level = -EINVAL; in kbdlight_write()
5354 return -ENODEV; in kbdlight_write()
5363 return -EINVAL; in kbdlight_write()
5401 TPACPI_HANDLE(lght, root, "\\LGHT"); /* A21e, A2xm/p, T20-22, X20-21 */
5410 return -EIO; in light_get_status()
5414 return -ENXIO; in light_get_status()
5431 return (rc) ? 0 : -EIO; in light_set_status()
5434 return -ENXIO; in light_set_status()
5484 return -ENODEV; in light_init()
5486 rc = led_classdev_register(&tpacpi_pdev->dev, in light_init()
5530 return -ENODEV; in light_write()
5538 return -EINVAL; in light_write()
5555 /* sysfs cmos_command -------------------------------------------------- */
5564 return -EINVAL; in cmos_command_store()
5580 return cmos_handle ? attr->mode : 0; in cmos_attr_is_visible()
5588 /* --------------------------------------------------------------------- */
5600 return cmos_handle ? 0 : -ENODEV; in cmos_init()
5606 R30, R31, T20-22, X20-21 */ in cmos_read()
5611 seq_printf(m, "commands:\t<cmd> (<cmd> is 0-21)\n"); in cmos_read()
5627 return -EINVAL; in cmos_write()
5650 TPACPI_LED_OLD, /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */
5703 return -EIO; in led_get_status()
5712 return -ENXIO; in led_get_status()
5731 return -EINVAL; in led_set_status()
5733 return -EPERM; in led_set_status()
5736 return -EIO; in led_set_status()
5739 /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20 */ in led_set_status()
5741 return -EINVAL; in led_set_status()
5743 return -EPERM; in led_set_status()
5755 return -EINVAL; in led_set_status()
5757 return -EPERM; in led_set_status()
5760 return -EIO; in led_set_status()
5763 return -ENXIO; in led_set_status()
5781 else if (tpacpi_led_state_cache[data->led] != TPACPI_LED_BLINK) in led_sysfs_set()
5786 return led_set_status(data->led, new_state); in led_sysfs_set()
5801 return -EINVAL; in led_sysfs_blink_set()
5803 return led_set_status(data->led, TPACPI_LED_BLINK); in led_sysfs_blink_set()
5813 rc = led_get_status(data->led); in led_sysfs_get()
5848 return led_classdev_register(&tpacpi_pdev->dev, &tpacpi_leds[led].led_classdev); in tpacpi_init_led()
5876 /* (1) - may have excess leds enabled on MSB */
5906 /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */ in led_init_detect_mode()
5946 return -ENODEV; in led_init()
5952 return -ENOMEM; in led_init()
5956 tpacpi_leds[i].led = -1; in led_init()
5989 return -EIO; in led_read()
5994 seq_printf(m, "commands:\t<led> on, <led> off, <led> blink (<led> is 0-15)\n"); in led_read()
6006 return -ENODEV; in led_write()
6010 return -EINVAL; in led_write()
6012 if (led < 0 || led > (TPACPI_LED_NUMLEDS - 1)) in led_write()
6013 return -ENODEV; in led_write()
6016 return -ENODEV; in led_write()
6025 return -EINVAL; in led_write()
6053 TPACPI_Q_IBM('I', 'U', TPACPI_BEEP_Q1), /* 570E - unverified */
6072 return (beep_handle) ? 0 : -ENODEV; in beep_init()
6081 seq_printf(m, "commands:\t<cmd> (<cmd> is 0-17)\n"); in beep_read()
6093 return -ENODEV; in beep_write()
6100 return -EINVAL; in beep_write()
6104 return -EIO; in beep_write()
6108 return -EIO; in beep_write()
6127 TPACPI_THERMAL_ACPI_TMP07, /* Use ACPI TMP0-7 */
6128 TPACPI_THERMAL_ACPI_UPDT, /* Use ACPI TMP0-7 with UPDT */
6137 TP_EC_THERMAL_TMP_NA = -128, /* ACPI EC sensor not available */
6139 TPACPI_THERMAL_SENSOR_NA = -128000, /* Sensor not available */
6151 /* idx is zero-based */
6165 idx -= 8; in thermal_get_sensor()
6172 return -EIO; in thermal_get_sensor()
6182 return -EIO; in thermal_get_sensor()
6184 return -EIO; in thermal_get_sensor()
6185 *value = (t - 2732) * 100; in thermal_get_sensor()
6194 return -EIO; in thermal_get_sensor()
6195 if (t > 127 || t < -127) in thermal_get_sensor()
6204 return -ENOSYS; in thermal_get_sensor()
6207 return -EINVAL; in thermal_get_sensor()
6219 return -EINVAL; in thermal_get_sensors()
6225 res = thermal_get_sensor(i, &s->temp[i]); in thermal_get_sensors()
6254 /* sysfs temp##_input -------------------------------------------------- */
6262 int idx = sensor_attr->index; in thermal_temp_input_show()
6270 return -ENXIO; in thermal_temp_input_show()
6335 return attr->mode; in thermal_attr_is_visible()
6367 return thermal_use_labels ? attr->mode : 0; in temp_label_attr_is_visible()
6375 /* --------------------------------------------------------------------- */
6390 * 0x78-0x7F, 0xC0-0xC7. Registers return 0x00 for in thermal_init()
6391 * non-implemented, thermal sensors return 0x80 when in thermal_init()
6396 * version 3 the Lenovo firmware team confirmed that registers 0xC0-0xC7 in thermal_init()
6456 return thermal_read_mode != TPACPI_THERMAL_NONE ? 0 : -ENODEV; in thermal_init()
6471 for (i = 0; i < (n - 1); i++) in thermal_read()
6493 * CMOS NVRAM byte 0x5E, bits 0-3.
6500 * Bit 3-0: backlight brightness level
6521 TPACPI_BRGHT_MODE_UCMS_STEP, /* UCMS step-based control */
6602 return -EIO; in tpacpi_brightness_get_raw()
6606 return -ENXIO; in tpacpi_brightness_get_raw()
6618 return -EIO; in tpacpi_brightness_set_ec()
6623 return -EIO; in tpacpi_brightness_set_ec()
6643 inc = (value > current_value) ? 1 : -1; in tpacpi_brightness_set_ucmsstep()
6647 return -EIO; in tpacpi_brightness_set_ucmsstep()
6658 return -EINVAL; in brightness_set()
6676 res = -ENXIO; in brightness_set()
6683 /* sysfs backlight class ----------------------------------------------- */
6727 /* --------------------------------------------------------------------- */
6736 status = acpi_evaluate_object(adev->handle, "_BCL", NULL, &buffer); in tpacpi_evaluate_bcl()
6741 if (!obj || obj->type != ACPI_TYPE_PACKAGE) { in tpacpi_evaluate_bcl()
6742 acpi_handle_info(adev->handle, in tpacpi_evaluate_bcl()
6747 rc = obj->package.count; in tpacpi_evaluate_bcl()
6785 return (bcl_levels > 2) ? (bcl_levels - 2) : 0; in tpacpi_check_std_acpi_brightness_support()
6802 TPACPI_Q_IBM('1', 'R', TPACPI_BRGHT_Q_EC), /* R50,51 T40-42 */
6848 bright_maxlvl = b - 1; in tpacpi_detect_brightness_capabilities()
6870 return -ENODEV; in brightness_init()
6875 return -ENODEV; in brightness_init()
6881 return -ENODEV; in brightness_init()
6884 return -ENODEV; in brightness_init()
6888 return -ENODEV; in brightness_init()
6899 return -EINVAL; in brightness_init()
6910 "driver auto-selected brightness_mode=%d\n", in brightness_init()
6918 return -EINVAL; in brightness_init()
6921 return -ENODEV; in brightness_init()
6992 seq_printf(m, "commands:\tlevel <level> (<level> is 0-%d)\n", in brightness_read()
7015 level--; in brightness_write()
7020 return -EINVAL; in brightness_write()
7034 return (rc == -EINTR) ? -ERESTARTSYS : rc; in brightness_write()
7059 * Bit 3-0: Volume
7063 * bits 3-0 (volume). Other bits in NVRAM may have other functions,
7075 * To avoid confusing userspace, we simply disable all EC-based mute
7086 #define DEFAULT_ALSA_IDX ~((1 << (SNDRV_CARDS - 3)) - 1)
7088 #define DEFAULT_ALSA_IDX ~((1 << (32 - 3)) - 1)
7119 TPACPI_VOL_MODE_UCMS_STEP, /* UCMS step-based control: N/A */
7149 * TP_NVRAM_ADDR_MIXER, as we need to do read-modify-write
7205 return -EIO; in volume_get_status_ec()
7222 return -EIO; in volume_set_status_ec()
7247 return -EINTR; in __volume_set_mute_ec()
7292 return -EINVAL; in __volume_set_volume_ec()
7295 return -EINTR; in __volume_set_volume_ec()
7319 return -ENODEV; in volume_set_software_mute()
7324 return -EIO; in volume_set_software_mute()
7333 return -EIO; in volume_set_software_mute()
7342 * startup. Just on case there are SAUM-capable ThinkPads in volume_set_software_mute()
7376 if (alsa_card && alsa_card->private_data) { in volume_alsa_notify_change()
7377 d = alsa_card->private_data; in volume_alsa_notify_change()
7378 if (d->ctl_mute_id) in volume_alsa_notify_change()
7381 d->ctl_mute_id); in volume_alsa_notify_change()
7382 if (d->ctl_vol_id) in volume_alsa_notify_change()
7385 d->ctl_vol_id); in volume_alsa_notify_change()
7392 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in volume_alsa_vol_info()
7393 uinfo->count = 1; in volume_alsa_vol_info()
7394 uinfo->value.integer.min = 0; in volume_alsa_vol_info()
7395 uinfo->value.integer.max = TP_EC_VOLUME_MAX; in volume_alsa_vol_info()
7409 ucontrol->value.integer.value[0] = s & TP_EC_AUDIO_LVL_MSK; in volume_alsa_vol_get()
7417 ucontrol->value.integer.value[0]); in volume_alsa_vol_put()
7418 return volume_alsa_set_volume(ucontrol->value.integer.value[0]); in volume_alsa_vol_put()
7433 ucontrol->value.integer.value[0] = in volume_alsa_mute_get()
7442 ucontrol->value.integer.value[0] ? in volume_alsa_mute_put()
7444 return volume_alsa_set_mute(!ucontrol->value.integer.value[0]); in volume_alsa_mute_put()
7506 rc = snd_card_new(&tpacpi_pdev->dev, in volume_create_alsa_mixer()
7511 return -ENODEV; in volume_create_alsa_mixer()
7514 BUG_ON(!card->private_data); in volume_create_alsa_mixer()
7515 data = card->private_data; in volume_create_alsa_mixer()
7516 data->card = card; in volume_create_alsa_mixer()
7518 strscpy(card->driver, TPACPI_ALSA_DRVNAME, in volume_create_alsa_mixer()
7519 sizeof(card->driver)); in volume_create_alsa_mixer()
7520 strscpy(card->shortname, TPACPI_ALSA_SHRTNAME, in volume_create_alsa_mixer()
7521 sizeof(card->shortname)); in volume_create_alsa_mixer()
7522 snprintf(card->mixername, sizeof(card->mixername), "ThinkPad EC %s", in volume_create_alsa_mixer()
7525 snprintf(card->longname, sizeof(card->longname), in volume_create_alsa_mixer()
7526 "%s at EC reg 0x%02x, fw %s", card->shortname, TP_EC_AUDIO, in volume_create_alsa_mixer()
7548 data->ctl_vol_id = &ctl_vol->id; in volume_create_alsa_mixer()
7557 data->ctl_mute_id = &ctl_mute->id; in volume_create_alsa_mixer()
7570 return -ENODEV; in volume_create_alsa_mixer()
7573 #define TPACPI_VOL_Q_MUTEONLY 0x0001 /* Mute-only control available */
7592 /* Whitelist mute-only on all Lenovo by default */
7614 return -EINVAL; in volume_init()
7619 return -ENODEV; in volume_init()
7623 return -EINVAL; in volume_init()
7632 return -ENODEV; in volume_init()
7645 return -ENODEV; /* no mixer */ in volume_init()
7654 return -ENODEV; in volume_init()
7659 "using user-supplied volume_capabilities=%d\n", in volume_init()
7667 "driver auto-selected volume_mode=%d\n", in volume_init()
7671 "using user-supplied volume_mode=%d\n", in volume_init()
7723 seq_printf(m, "commands:\tlevel <level> (<level> is 0-%d)\n", in volume_read()
7750 return -EPERM; in volume_write()
7772 new_level--; in volume_write()
7785 return -EINVAL; in volume_write()
7800 return (rc == -EINTR) ? -ERESTARTSYS : rc; in volume_write()
7825 return -ENODEV; in volume_init()
7873 * Speeds up fan to 100% duty-cycle, which is far above
7876 * 5-3 unused in some models. Extra bits for fan level
7879 * 2-0 fan level (0..7 usually)
7892 * ----
7897 * This register is present on all ThinkPads with a new-style EC, and
7903 * Unfortunately a lot of ThinkPads with new-style ECs but whose firmware
7917 * ----
7929 * So far, only the firmware for the X60/X61 non-tablet versions
7930 * seem to support this (firmware TP-7M).
7955 * that are using non-standard EC locations for reporting fan speeds.
7960 #define FAN_RPM_CAL_CONST 491520 /* FAN RPM calculation offset for some non-standard ECFW */
7973 fan_status_offset_ns = 0x93, /* Special status/control offset for non-standard EC Fan1 */
7974 fan2_status_offset_ns = 0x96, /* Special status/control offset for non-standard EC Fan2 */
7975 fan_rpm_status_ns = 0x95, /* Special offset for Fan1 RPM status for non-standard EC */
7976 fan2_rpm_status_ns = 0x98, /* Special offset for Fan2 RPM status for non-standard EC */
7981 TPACPI_FAN_LAST_LEVEL = 0x100, /* Use cached last-seen fan level */
7987 TPACPI_FAN_RD_TPEC, /* Use ACPI EC regs 0x2f, 0x84-0x85 */
7988 TPACPI_FAN_RD_TPEC_NS, /* Use non-standard ACPI EC regs (eg: L13 Yoga gen2 etc.) */
8030 "JFNS", /* 770x-JL */
8045 * Enable for TP-1Y (T43), TP-78 (R51e), TP-76 (R52),
8046 * TP-70 (T43, R52), which are known to be buggy.
8131 return -EIO; in fan_get_status()
8141 return -EIO; in fan_get_status()
8152 return -EIO; in fan_get_status()
8160 return -ENXIO; in fan_get_status()
8172 return -ERESTARTSYS; in fan_get_status_safe()
8195 return -EIO; in fan_get_speed()
8198 return -EIO; in fan_get_speed()
8208 return -EIO; in fan_get_speed()
8215 return -ENXIO; in fan_get_speed()
8230 return -EIO; in fan2_get_speed()
8235 return -EIO; in fan2_get_speed()
8247 return -EIO; in fan2_get_speed()
8250 return -EIO; in fan2_get_speed()
8254 return -EIO; in fan2_get_speed()
8260 return -ENXIO; in fan2_get_speed()
8269 return -EPERM; in fan_set_level()
8274 return -EINVAL; in fan_set_level()
8285 return -EIO; in fan_set_level()
8293 return -EINVAL; in fan_set_level()
8312 return -EIO; in fan_set_level()
8318 return -ENXIO; in fan_set_level()
8331 return -EPERM; in fan_set_level_safe()
8334 return -ERESTARTSYS; in fan_set_level_safe()
8353 return -EPERM; in fan_set_enable()
8356 return -ERESTARTSYS; in fan_set_enable()
8372 rc = -EIO; in fan_set_enable()
8390 rc = -EIO; in fan_set_enable()
8396 rc = -ENXIO; in fan_set_enable()
8413 return -EPERM; in fan_set_disable()
8416 return -ERESTARTSYS; in fan_set_disable()
8423 rc = -EIO; in fan_set_disable()
8432 rc = -EIO; in fan_set_disable()
8438 rc = -ENXIO; in fan_set_disable()
8454 return -EPERM; in fan_set_speed()
8457 return -ERESTARTSYS; in fan_set_speed()
8465 rc = -EIO; in fan_set_speed()
8467 rc = -EINVAL; in fan_set_speed()
8471 rc = -ENXIO; in fan_set_speed()
8529 /* sysfs fan pwm1_enable ----------------------------------------------- */
8559 return -EINVAL; in fan_pwm1_enable_store()
8575 /* reserved for software-controlled auto mode */ in fan_pwm1_enable_store()
8576 return -ENOSYS; in fan_pwm1_enable_store()
8578 return -EINVAL; in fan_pwm1_enable_store()
8582 if (res == -ENXIO) in fan_pwm1_enable_store()
8583 return -EINVAL; in fan_pwm1_enable_store()
8595 /* sysfs fan pwm1 ------------------------------------------------------ */
8626 return -EINVAL; in fan_pwm1_store()
8631 /* scale down from 0-255 to 0-7 */ in fan_pwm1_store()
8635 return -ERESTARTSYS; in fan_pwm1_store()
8641 if (rc == -ENXIO) in fan_pwm1_store()
8642 rc = -EINVAL; in fan_pwm1_store()
8655 /* sysfs fan fan1_input ------------------------------------------------ */
8676 /* sysfs fan fan2_input ------------------------------------------------ */
8697 /* sysfs fan fan_watchdog (hwmon driver) ------------------------------- */
8709 return -EINVAL; in fan_watchdog_store()
8712 return -EPERM; in fan_watchdog_store()
8723 /* --------------------------------------------------------------------- */
8745 return attr->mode; in fan_attr_is_visible()
8767 #define TPACPI_FAN_NS 0x0010 /* For EC with non-Standard register addresses */
8823 return -ENODEV; in fan_init()
8827 pr_info("ECFW with non-standard fan reg control found\n"); in fan_init()
8844 /* all other ThinkPads: note that even old-style in fan_init()
8862 /* It responded - so let's assume it's there */ in fan_init()
8868 /* Fan not auto-detected */ in fan_init()
8882 return -ENODEV; in fan_init()
8887 /* 570, 770x-JL */ in fan_init()
8933 return -ENODEV; in fan_init()
9087 seq_printf(m, " (<level> is 0-7)\n"); in fan_read()
9091 seq_printf(m, " (<level> is 0-7, auto, disengaged, full-speed)\n"); in fan_read()
9098 "commands:\twatchdog <timeout> (<timeout> is 0 (off), 1-120 (seconds))\n"); in fan_read()
9101 seq_printf(m, "commands:\tspeed <speed> (<speed> is 0-65535)\n"); in fan_read()
9112 else if (strstarts(cmd, "level disengaged") || strstarts(cmd, "level full-speed")) in fan_write_cmd_level()
9118 if (*rc == -ENXIO) in fan_write_cmd_level()
9134 if (*rc == -ENXIO) in fan_write_cmd_enable()
9149 if (*rc == -ENXIO) in fan_write_cmd_disable()
9169 if (*rc == -ENXIO) in fan_write_cmd_speed()
9187 *rc = -EINVAL; in fan_write_cmd_watchdog()
9213 rc = -EINVAL; in fan_write()
9261 if (ACPI_FAILURE(acpi_get_handle(hkey_handle, t->name, &temp))) { in mute_led_on_off()
9262 pr_warn("Thinkpad ACPI has no %s interface.\n", t->name); in mute_led_on_off()
9263 return -EIO; in mute_led_on_off()
9266 if (!acpi_evalf(hkey_handle, &output, t->name, "dd", in mute_led_on_off()
9267 state ? t->on_value : t->off_value)) in mute_led_on_off()
9268 return -EIO; in mute_led_on_off()
9270 t->state = state; in mute_led_on_off()
9279 if (t->state < 0 || t->state == on) in tpacpi_led_set()
9280 return t->state; in tpacpi_led_set()
9301 .default_trigger = "audio-mute",
9307 .default_trigger = "audio-micmute",
9318 if (ACPI_FAILURE(acpi_get_handle(hkey_handle, t->name, &temp))) { in mute_led_init()
9319 t->state = -ENODEV; in mute_led_init()
9324 err = led_classdev_register(&tpacpi_pdev->dev, &mute_led_cdev[i]); in mute_led_init()
9326 while (i--) in mute_led_init()
9350 if (t->state >= 0) in mute_led_resume()
9351 mute_led_on_off(t, t->state); in mute_led_resume()
9362 * Battery Wear Control Driver
9414 * This evaluates a ACPI method call specific to the battery
9435 static int tpacpi_battery_get(int what, int battery, int *ret) in tpacpi_battery_get() argument
9439 if ACPI_FAILURE(tpacpi_battery_acpi_eval(GET_START, ret, battery)) in tpacpi_battery_get()
9440 return -ENODEV; in tpacpi_battery_get()
9446 if ACPI_FAILURE(tpacpi_battery_acpi_eval(GET_STOP, ret, battery)) in tpacpi_battery_get()
9447 return -ENODEV; in tpacpi_battery_get()
9460 if ACPI_FAILURE(tpacpi_battery_acpi_eval(GET_DISCHARGE, ret, battery)) in tpacpi_battery_get()
9461 return -ENODEV; in tpacpi_battery_get()
9466 if ACPI_FAILURE(tpacpi_battery_acpi_eval(GET_INHIBIT, ret, battery)) in tpacpi_battery_get()
9467 return -ENODEV; in tpacpi_battery_get()
9473 return -EINVAL; in tpacpi_battery_get()
9477 static int tpacpi_battery_set(int what, int battery, int value) in tpacpi_battery_set() argument
9482 /* The battery ID is in bits 8-9, 2 bits */ in tpacpi_battery_set()
9483 param |= battery << 8; in tpacpi_battery_set()
9488 pr_err("failed to set charge threshold on battery %d", in tpacpi_battery_set()
9489 battery); in tpacpi_battery_set()
9490 return -ENODEV; in tpacpi_battery_set()
9495 pr_err("failed to set stop threshold: %d", battery); in tpacpi_battery_set()
9496 return -ENODEV; in tpacpi_battery_set()
9502 * battery ID is in bits 8-9, 2 bits. in tpacpi_battery_set()
9505 pr_err("failed to set force discharge on %d", battery); in tpacpi_battery_set()
9506 return -ENODEV; in tpacpi_battery_set()
9513 * The battery ID is in bits 4-5, 2 bits, in tpacpi_battery_set()
9514 * the effective time is in bits 8-23, 2 bytes. in tpacpi_battery_set()
9518 param |= battery << 4; in tpacpi_battery_set()
9521 pr_err("failed to set inhibit charge on %d", battery); in tpacpi_battery_set()
9522 return -ENODEV; in tpacpi_battery_set()
9527 return -EINVAL; in tpacpi_battery_set()
9531 static int tpacpi_battery_set_validate(int what, int battery, int value) in tpacpi_battery_set_validate() argument
9535 ret = tpacpi_battery_set(what, battery, value); in tpacpi_battery_set_validate()
9539 ret = tpacpi_battery_get(what, battery, &v); in tpacpi_battery_set_validate()
9548 ret = tpacpi_battery_get(what, battery, &v); in tpacpi_battery_set_validate()
9555 return -EIO; in tpacpi_battery_set_validate()
9558 static int tpacpi_battery_probe(int battery) in tpacpi_battery_probe() argument
9562 memset(&battery_info.batteries[battery], 0, in tpacpi_battery_probe()
9563 sizeof(battery_info.batteries[battery])); in tpacpi_battery_probe()
9576 if ACPI_FAILURE(tpacpi_battery_acpi_eval(GET_START, &ret, battery)) { in tpacpi_battery_probe()
9577 pr_err("Error probing battery %d\n", battery); in tpacpi_battery_probe()
9578 return -ENODEV; in tpacpi_battery_probe()
9585 battery_info.batteries[battery].start_support = 1; in tpacpi_battery_probe()
9587 return -ENODEV; in tpacpi_battery_probe()
9588 if (tpacpi_battery_get(THRESHOLD_START, battery, in tpacpi_battery_probe()
9589 &battery_info.batteries[battery].charge_start)) { in tpacpi_battery_probe()
9590 pr_err("Error probing battery %d\n", battery); in tpacpi_battery_probe()
9591 return -ENODEV; in tpacpi_battery_probe()
9595 if ACPI_FAILURE(tpacpi_battery_acpi_eval(GET_STOP, &ret, battery)) { in tpacpi_battery_probe()
9596 pr_err("Error probing battery stop; %d\n", battery); in tpacpi_battery_probe()
9597 return -ENODEV; in tpacpi_battery_probe()
9601 battery_info.batteries[battery].stop_support = 1; in tpacpi_battery_probe()
9603 return -ENODEV; in tpacpi_battery_probe()
9604 if (tpacpi_battery_get(THRESHOLD_STOP, battery, in tpacpi_battery_probe()
9605 &battery_info.batteries[battery].charge_stop)) { in tpacpi_battery_probe()
9606 pr_err("Error probing battery stop: %d\n", battery); in tpacpi_battery_probe()
9607 return -ENODEV; in tpacpi_battery_probe()
9611 if (ACPI_FAILURE(tpacpi_battery_acpi_eval(GET_DISCHARGE, &ret, battery))) { in tpacpi_battery_probe()
9612 pr_err("Error probing battery discharge; %d\n", battery); in tpacpi_battery_probe()
9613 return -ENODEV; in tpacpi_battery_probe()
9617 battery_info.batteries[battery].charge_behaviours |= in tpacpi_battery_probe()
9621 if (ACPI_FAILURE(tpacpi_battery_acpi_eval(GET_INHIBIT, &ret, battery))) { in tpacpi_battery_probe()
9622 pr_err("Error probing battery inhibit charge; %d\n", battery); in tpacpi_battery_probe()
9623 return -ENODEV; in tpacpi_battery_probe()
9627 battery_info.batteries[battery].charge_behaviours |= in tpacpi_battery_probe()
9631 battery_info.batteries[battery].charge_behaviours |= in tpacpi_battery_probe()
9634 pr_info("battery %d registered (start %d, stop %d, behaviours: 0x%x)\n", in tpacpi_battery_probe()
9635 battery, in tpacpi_battery_probe()
9636 battery_info.batteries[battery].charge_start, in tpacpi_battery_probe()
9637 battery_info.batteries[battery].charge_stop, in tpacpi_battery_probe()
9638 battery_info.batteries[battery].charge_behaviours); in tpacpi_battery_probe()
9654 * If for some reason the battery is not BAT0 nor is it in tpacpi_battery_get_id()
9655 * BAT1, we will assume it's the default, first battery, in tpacpi_battery_get_id()
9658 pr_warn("unknown battery %s, assuming primary", battery_name); in tpacpi_battery_get_id()
9670 int battery, rval; in tpacpi_battery_store() local
9673 * one battery. If that is the case, in tpacpi_battery_store()
9680 * with "Any Battery" as the parameter. in tpacpi_battery_store()
9684 battery = tpacpi_battery_get_id(supply->desc->name); in tpacpi_battery_store()
9686 battery = BAT_PRIMARY; in tpacpi_battery_store()
9694 if (!battery_info.batteries[battery].start_support) in tpacpi_battery_store()
9695 return -ENODEV; in tpacpi_battery_store()
9698 return -EINVAL; in tpacpi_battery_store()
9699 if (value > battery_info.batteries[battery].charge_stop) in tpacpi_battery_store()
9700 return -EINVAL; in tpacpi_battery_store()
9701 if (tpacpi_battery_set(THRESHOLD_START, battery, value)) in tpacpi_battery_store()
9702 return -ENODEV; in tpacpi_battery_store()
9703 battery_info.batteries[battery].charge_start = value; in tpacpi_battery_store()
9707 if (!battery_info.batteries[battery].stop_support) in tpacpi_battery_store()
9708 return -ENODEV; in tpacpi_battery_store()
9711 return -EINVAL; in tpacpi_battery_store()
9712 if (value < battery_info.batteries[battery].charge_start) in tpacpi_battery_store()
9713 return -EINVAL; in tpacpi_battery_store()
9714 battery_info.batteries[battery].charge_stop = value; in tpacpi_battery_store()
9722 if (tpacpi_battery_set(THRESHOLD_STOP, battery, value)) in tpacpi_battery_store()
9723 return -EINVAL; in tpacpi_battery_store()
9727 return -EINVAL; in tpacpi_battery_store()
9737 int ret, battery; in tpacpi_battery_show() local
9740 * one battery. If that is the case, in tpacpi_battery_show()
9747 * with "Any Battery" as the parameter. in tpacpi_battery_show()
9751 battery = tpacpi_battery_get_id(supply->desc->name); in tpacpi_battery_show()
9753 battery = BAT_PRIMARY; in tpacpi_battery_show()
9754 if (tpacpi_battery_get(what, battery, &ret)) in tpacpi_battery_show()
9755 return -ENODEV; in tpacpi_battery_show()
9780 int ret, battery; in charge_behaviour_show() local
9782 battery = tpacpi_battery_get_id(supply->desc->name); in charge_behaviour_show()
9783 available = battery_info.batteries[battery].charge_behaviours; in charge_behaviour_show()
9786 if (tpacpi_battery_get(FORCE_DISCHARGE, battery, &ret)) in charge_behaviour_show()
9787 return -ENODEV; in charge_behaviour_show()
9795 if (tpacpi_battery_get(INHIBIT_CHARGE, battery, &ret)) in charge_behaviour_show()
9796 return -ENODEV; in charge_behaviour_show()
9826 int selected, battery, ret = 0; in charge_behaviour_store() local
9829 battery = tpacpi_battery_get_id(supply->desc->name); in charge_behaviour_store()
9830 available = battery_info.batteries[battery].charge_behaviours; in charge_behaviour_store()
9839 ret = tpacpi_battery_set_validate(FORCE_DISCHARGE, battery, 0); in charge_behaviour_store()
9841 ret = min(ret, tpacpi_battery_set_validate(INHIBIT_CHARGE, battery, 0)); in charge_behaviour_store()
9847 ret = tpacpi_battery_set_validate(INHIBIT_CHARGE, battery, 0); in charge_behaviour_store()
9848 ret = min(ret, tpacpi_battery_set_validate(FORCE_DISCHARGE, battery, 1)); in charge_behaviour_store()
9854 ret = tpacpi_battery_set_validate(FORCE_DISCHARGE, battery, 0); in charge_behaviour_store()
9855 ret = min(ret, tpacpi_battery_set_validate(INHIBIT_CHARGE, battery, 1)); in charge_behaviour_store()
9861 return -EINVAL; in charge_behaviour_store()
9894 /* ACPI battery hooking */
9896 static int tpacpi_battery_add(struct power_supply *battery, struct acpi_battery_hook *hook) in tpacpi_battery_add() argument
9898 int batteryid = tpacpi_battery_get_id(battery->desc->name); in tpacpi_battery_add()
9901 return -ENODEV; in tpacpi_battery_add()
9902 if (device_add_groups(&battery->dev, tpacpi_battery_groups)) in tpacpi_battery_add()
9903 return -ENODEV; in tpacpi_battery_add()
9907 static int tpacpi_battery_remove(struct power_supply *battery, struct acpi_battery_hook *hook) in tpacpi_battery_remove() argument
9909 device_remove_groups(&battery->dev, tpacpi_battery_groups); in tpacpi_battery_remove()
9916 .name = "ThinkPad Battery Extension",
9924 * primary battery as BAT1.
9954 .name = "battery",
9971 if (WARN_ON(!mutex_is_locked(&priv->lock))) in lcdshadow_set_sw_state()
9972 return -EIO; in lcdshadow_set_sw_state()
9975 return -EIO; in lcdshadow_set_sw_state()
9977 priv->hw_state = priv->sw_state = state; in lcdshadow_set_sw_state()
9988 priv->hw_state = priv->sw_state = output & 0x1; in lcdshadow_get_hw_state()
10007 return -EIO; in tpacpi_lcdshadow_init()
10012 lcdshadow_dev = drm_privacy_screen_register(&tpacpi_pdev->dev, in tpacpi_lcdshadow_init()
10030 mutex_lock(&lcdshadow_dev->lock); in lcdshadow_resume()
10031 lcdshadow_set_sw_state(lcdshadow_dev, lcdshadow_dev->sw_state); in lcdshadow_resume()
10032 mutex_unlock(&lcdshadow_dev->lock); in lcdshadow_resume()
10040 seq_printf(m, "status:\t\t%d\n", lcdshadow_dev->hw_state); in lcdshadow_read()
10050 int res, state = -EINVAL; in lcdshadow_write()
10053 return -ENODEV; in lcdshadow_write()
10062 return -EINVAL; in lcdshadow_write()
10064 mutex_lock(&lcdshadow_dev->lock); in lcdshadow_write()
10066 mutex_unlock(&lcdshadow_dev->lock); in lcdshadow_write()
10085 #define DYTC_CMD_QUERY 0 /* To get DYTC status - enable/revision */
10086 #define DYTC_QUERY_ENABLE_BIT 8 /* Bit 8 - 0 = disabled, 1 = enabled */
10087 #define DYTC_QUERY_SUBREV_BIT 16 /* Bits 16 - 27 - sub revision */
10088 #define DYTC_QUERY_REV_BIT 28 /* Bits 28 - 31 - revision */
10108 return -ENODEV; in dytc_command()
10111 return -EIO; in dytc_command()
10136 return -ENODEV; in palmsensor_get()
10138 return -EIO; in palmsensor_get()
10156 sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, "dytc_lapmode"); in lapsensor_refresh()
10172 sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, "palmsensor"); in palmsensor_refresh()
10218 return attr->mode; in proxsensor_attr_is_visible()
10232 /* If support isn't available for both devices return -ENODEV */ in tpacpi_proxsensor_init()
10233 if ((palm_err == -ENODEV) && (lap_err == -ENODEV)) in tpacpi_proxsensor_init()
10234 return -ENODEV; in tpacpi_proxsensor_init()
10236 if (palm_err && (palm_err != -ENODEV)) in tpacpi_proxsensor_init()
10238 if (lap_err && (lap_err != -ENODEV)) in tpacpi_proxsensor_init()
10245 .name = "proximity-sensor",
10261 #define DYTC_GET_FUNCTION_BIT 8 /* Bits 8-11 - function setting */
10262 #define DYTC_GET_MODE_BIT 12 /* Bits 12-15 - mode setting */
10264 #define DYTC_SET_FUNCTION_BIT 12 /* Bits 12-15 - function setting */
10265 #define DYTC_SET_MODE_BIT 16 /* Bits 16-19 - mode setting */
10266 #define DYTC_SET_VALID_BIT 20 /* Bit 20 - 1 = on, 0 = off */
10290 #define DYTC_ERR_MASK 0xF /* Bits 0-3 in cmd result are the error result */
10331 return -EINVAL; in convert_dytc_to_profile()
10342 return -EINVAL; in convert_dytc_to_profile()
10352 return -EOPNOTSUPP; in convert_dytc_to_profile()
10379 return -EOPNOTSUPP; in convert_profile_to_dytc()
10403 return -ENODEV; in dytc_control_amt()
10420 * Helper function - check if we are in CQL mode and if we are
10421 * - disable CQL,
10422 * - run the command
10423 * - enable CQL
10482 * Note we still need to disable CQL mode before hand and re-enable in dytc_profile_set()
10505 /* Success - update current profile */ in dytc_profile_set()
10530 err = -ENODEV; in dytc_profile_refresh()
10568 return -ENODEV; in tpacpi_dytc_profile_init()
10578 case -1: in tpacpi_dytc_profile_init()
10611 return -ENODEV; in tpacpi_dytc_profile_init()
10624 return -ENODEV; in tpacpi_dytc_profile_init()
10642 .name = "dytc-profile",
10664 {"fr-ch", 0x100c},
10684 return -ENODEV; in set_keyboard_lang_command()
10688 return -EIO; in set_keyboard_lang_command()
10700 return -ENODEV; in get_keyboard_lang()
10704 return -EIO; in get_keyboard_lang()
10708 * '(' and ')') keys which use layout dependent key-press emulation. in get_keyboard_lang()
10711 return -ENODEV; in get_keyboard_lang()
10768 dev_err(&tpacpi_pdev->dev, "Unknown Keyboard language. Ignoring\n"); in keyboard_lang_store()
10769 return -EINVAL; in keyboard_lang_store()
10772 tpacpi_disclose_usertask(attr->attr.name, in keyboard_lang_store()
10775 sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, "keyboard_lang"); in keyboard_lang_store()
10789 return tp_features.kbd_lang ? attr->mode : 0; in kbdlang_attr_is_visible()
10826 return -ENODEV; in dprc_command()
10830 return -EIO; in dprc_command()
10838 return -ENODEV; in dprc_command()
10857 return -ENODEV; in get_wwan_antenna()
10873 return -ENODATA; in wwan_antenna_type_show()
10886 return has_antennatype ? attr->mode : 0; in dprc_attr_is_visible()
10910 /* --------------------------------------------------------------------- */
10943 return attr->mode; in tpacpi_attr_is_visible()
11059 if (!atomic_add_unless(&dytc_ignore_event, -1, 0)) in tpacpi_driver_event()
11067 mutex_lock(&lcdshadow_dev->lock); in tpacpi_driver_event()
11068 old_hw_state = lcdshadow_dev->hw_state; in tpacpi_driver_event()
11070 changed = lcdshadow_dev->hw_state != old_hw_state; in tpacpi_driver_event()
11071 mutex_unlock(&lcdshadow_dev->lock); in tpacpi_driver_event()
11092 /* --------------------------------------------------------------------- */
11114 dbg_printk(TPACPI_DBG_EXIT, "removing %s\n", ibm->name); in ibm_exit()
11116 list_del_init(&ibm->all_drivers); in ibm_exit()
11118 if (ibm->flags.acpi_notify_installed) { in ibm_exit()
11120 "%s: acpi_remove_notify_handler\n", ibm->name); in ibm_exit()
11121 BUG_ON(!ibm->acpi); in ibm_exit()
11122 acpi_remove_notify_handler(*ibm->acpi->handle, in ibm_exit()
11123 ibm->acpi->type, in ibm_exit()
11125 ibm->flags.acpi_notify_installed = 0; in ibm_exit()
11128 if (ibm->flags.proc_created) { in ibm_exit()
11130 "%s: remove_proc_entry\n", ibm->name); in ibm_exit()
11131 remove_proc_entry(ibm->name, proc_dir); in ibm_exit()
11132 ibm->flags.proc_created = 0; in ibm_exit()
11135 if (ibm->flags.acpi_driver_registered) { in ibm_exit()
11137 "%s: acpi_bus_unregister_driver\n", ibm->name); in ibm_exit()
11138 BUG_ON(!ibm->acpi); in ibm_exit()
11139 acpi_bus_unregister_driver(ibm->acpi->driver); in ibm_exit()
11140 kfree(ibm->acpi->driver); in ibm_exit()
11141 ibm->acpi->driver = NULL; in ibm_exit()
11142 ibm->flags.acpi_driver_registered = 0; in ibm_exit()
11145 if (ibm->flags.init_called && ibm->exit) { in ibm_exit()
11146 ibm->exit(); in ibm_exit()
11147 ibm->flags.init_called = 0; in ibm_exit()
11150 dbg_printk(TPACPI_DBG_INIT, "finished removing %s\n", ibm->name); in ibm_exit()
11156 struct ibm_struct *ibm = iibm->data; in ibm_init()
11161 INIT_LIST_HEAD(&ibm->all_drivers); in ibm_init()
11163 if (ibm->flags.experimental && !experimental) in ibm_init()
11167 "probing for %s\n", ibm->name); in ibm_init()
11169 if (iibm->init) { in ibm_init()
11170 ret = iibm->init(iibm); in ibm_init()
11171 if (ret > 0 || ret == -ENODEV) in ibm_init()
11176 ibm->flags.init_called = 1; in ibm_init()
11179 if (ibm->acpi) { in ibm_init()
11180 if (ibm->acpi->hid) { in ibm_init()
11186 if (ibm->acpi->notify) { in ibm_init()
11188 if (ret == -ENODEV) { in ibm_init()
11190 ibm->name); in ibm_init()
11200 "%s installed\n", ibm->name); in ibm_init()
11202 if (ibm->read) { in ibm_init()
11203 umode_t mode = iibm->base_procfs_mode; in ibm_init()
11207 if (ibm->write) in ibm_init()
11209 entry = proc_create_data(ibm->name, mode, proc_dir, in ibm_init()
11212 pr_err("unable to create proc entry %s\n", ibm->name); in ibm_init()
11213 ret = -ENODEV; in ibm_init()
11216 ibm->flags.proc_created = 1; in ibm_init()
11219 list_add_tail(&ibm->all_drivers, &tpacpi_all_drivers); in ibm_init()
11226 ibm->name, ret); in ibm_init()
11249 * Ancient 570/600 and -SL lacks (#.##c) in tpacpi_parse_fw_id()
11275 * ---------------------------------------------------- in find_new_ec_fwstr()
11288 if (dm->type != 140 || dm->length < 0x0F || in find_new_ec_fwstr()
11298 /* returns 0 - probe ok, or < 0 - probe error.
11300 * On error, kfree() cleanup on tp->* is not performed, caller must do it */
11310 return -EINVAL; in get_thinkpad_model_data()
11315 tp->vendor = PCI_VENDOR_ID_IBM; in get_thinkpad_model_data()
11317 tp->vendor = PCI_VENDOR_ID_LENOVO; in get_thinkpad_model_data()
11322 tp->bios_version_str = kstrdup(s, GFP_KERNEL); in get_thinkpad_model_data()
11323 if (s && !tp->bios_version_str) in get_thinkpad_model_data()
11324 return -ENOMEM; in get_thinkpad_model_data()
11327 t = tpacpi_parse_fw_id(tp->bios_version_str, in get_thinkpad_model_data()
11328 &tp->bios_model, &tp->bios_release); in get_thinkpad_model_data()
11335 * up-to-date BIOS or they will not be detected. in get_thinkpad_model_data()
11340 if (sscanf(dev->name, in get_thinkpad_model_data()
11341 "IBM ThinkPad Embedded Controller -[%17c", in get_thinkpad_model_data()
11343 ec_fw_string[sizeof(ec_fw_string) - 1] = 0; in get_thinkpad_model_data()
11354 tp->ec_version_str = kstrdup(ec_fw_string, GFP_KERNEL); in get_thinkpad_model_data()
11355 if (!tp->ec_version_str) in get_thinkpad_model_data()
11356 return -ENOMEM; in get_thinkpad_model_data()
11359 &tp->ec_model, &tp->ec_release); in get_thinkpad_model_data()
11369 tp->model_str = kstrdup(s, GFP_KERNEL); in get_thinkpad_model_data()
11370 if (!tp->model_str) in get_thinkpad_model_data()
11371 return -ENOMEM; in get_thinkpad_model_data()
11375 tp->model_str = kstrdup(s, GFP_KERNEL); in get_thinkpad_model_data()
11376 if (!tp->model_str) in get_thinkpad_model_data()
11377 return -ENOMEM; in get_thinkpad_model_data()
11382 tp->nummodel_str = kstrdup(s, GFP_KERNEL); in get_thinkpad_model_data()
11383 if (s && !tp->nummodel_str) in get_thinkpad_model_data()
11384 return -ENOMEM; in get_thinkpad_model_data()
11394 return -ENODEV; in probe_for_thinkpad()
11398 return -ENODEV; in probe_for_thinkpad()
11401 * Non-ancient models have better DMI tagging, but very old models in probe_for_thinkpad()
11413 return -ENODEV; in probe_for_thinkpad()
11417 return -ENODEV; in probe_for_thinkpad()
11546 if (!kp || !kp->name || !val) in set_ibm_param()
11547 return -EINVAL; in set_ibm_param()
11551 if (!ibm || !ibm->name) in set_ibm_param()
11554 if (strcmp(ibm->name, kp->name) == 0 && ibm->write) { in set_ibm_param()
11555 if (strlen(val) > sizeof(ibms_init[i].param) - 1) in set_ibm_param()
11556 return -ENOSPC; in set_ibm_param()
11562 return -EINVAL; in set_ibm_param()
11567 "Enables experimental features when non-zero");
11570 MODULE_PARM_DESC(debug, "Sets debug level bit-mask");
11574 "Attempts to load the driver even on a mis-identified ThinkPad when true");
11617 …MODULE_PARM_DESC(feature, "Simulates thinkpad-acpi procfs command at module load, see documentatio…
11657 MODULE_PARM_DESC(profile_force, "Force profile mode. -1=off, 1=MMC, 2=PSC");
11712 /* Driver-level probe */ in thinkpad_acpi_module_init()
11752 return -ENOMEM; in thinkpad_acpi_module_init()
11759 return -ENODEV; in thinkpad_acpi_module_init()
11764 tp_features.quirks = dmi_id->driver_data; in thinkpad_acpi_module_init()
11791 return -ENOMEM; in thinkpad_acpi_module_init()
11794 tpacpi_inputdev->name = "ThinkPad Extra Buttons"; in thinkpad_acpi_module_init()
11795 tpacpi_inputdev->phys = TPACPI_DRVR_NAME "/input0"; in thinkpad_acpi_module_init()
11796 tpacpi_inputdev->id.bustype = BUS_HOST; in thinkpad_acpi_module_init()
11797 tpacpi_inputdev->id.vendor = thinkpad_id.vendor; in thinkpad_acpi_module_init()
11798 tpacpi_inputdev->id.product = TPACPI_HKEY_INPUT_PRODUCT; in thinkpad_acpi_module_init()
11799 tpacpi_inputdev->id.version = TPACPI_HKEY_INPUT_VERSION; in thinkpad_acpi_module_init()
11800 tpacpi_inputdev->dev.parent = &tpacpi_pdev->dev; in thinkpad_acpi_module_init()
11810 ret = ibms_init[i].data->write(ibms_init[i].param); in thinkpad_acpi_module_init()
11836 &tpacpi_sensors_pdev->dev, TPACPI_NAME, NULL, tpacpi_hwmon_groups); in thinkpad_acpi_module_init()