Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'platform-drivers-x86-v4.17-1' of git://git.infradead.org/linux-platform-drivers-x86

Pull x86 platform driver updates from Andy Shevchenko:

- Dell SMBIOS driver fixed against memory leaks.

- The fujitsu-laptop driver is cleaned up and now supports hotkeys for
Lifebook U7x7 models. Besides that the typo introduced by one of
previous clean up series has been fixed.

- Specific to x86-based laptops HID device now supports
KEY_ROTATE_LOCK_TOGGLE event which is emitted, for example, by Wacom
MobileStudio Pro 13.

- Turbo MAX 3 technology is enabled for the rest of platforms that
support Hardware-P-States feature which have core priority described
by ACPI CPPC table.

- Mellanox on x86 gets better support of I2C bus in use including
support of hotpluggable ones.

- Silead touchscreen is enabled on two tablet models, i.e Yours Y8W81
and I.T.Works TW701.

- From now on the second fan on Thinkpad P50 is supported.

- The topstar-laptop driver is reworked to support new models, in
particular Topstar U931.

* tag 'platform-drivers-x86-v4.17-1' of git://git.infradead.org/linux-platform-drivers-x86: (41 commits)
platform/x86: thinkpad_acpi: Add 2nd Fan Support for Thinkpad P50
platform/x86: dell-smbios: Fix memory leaks in build_tokens_sysfs()
intel-hid: support KEY_ROTATE_LOCK_TOGGLE
intel-hid: clean up and sort header files
platform/x86: silead_dmi: Add entry for the Yours Y8W81 tablet
platform/x86: fujitsu-laptop: Support Lifebook U7x7 hotkeys
platform/x86: mlx-platform: Add physical bus number auto detection
platform/mellanox: mlxreg-hotplug: Change input for device create routine
platform/x86: mlx-platform: Add deffered bus functionality
platform/x86: mlx-platform: Use define for the channel numbers
platform/x86: fujitsu-laptop: Revert UNSUPPORTED_CMD back to an int
platform/x86: Fix dell driver init order
platform/x86: dell-smbios: Resolve dependency error on ACPI_WMI
platform/x86: dell-smbios: Resolve dependency error on DCDBAS
platform/x86: Allow for SMBIOS backend defaults
platform/x86: dell-smbios: Link all dell-smbios-* modules together
platform/x86: dell-smbios: Rename dell-smbios source to dell-smbios-base
platform/x86: dell-smbios: Correct some style warnings
platform/x86: wmi: Fix misuse of vsprintf extension %pULL
platform/x86: intel-hid: Reset wakeup capable flag on removal
...

+530 -213
+21 -10
drivers/platform/mellanox/mlxreg-hotplug.c
··· 93 93 bool after_probe; 94 94 }; 95 95 96 - static int mlxreg_hotplug_device_create(struct device *dev, 96 + static int mlxreg_hotplug_device_create(struct mlxreg_hotplug_priv_data *priv, 97 97 struct mlxreg_core_data *data) 98 98 { 99 + struct mlxreg_core_hotplug_platform_data *pdata; 100 + 99 101 /* 100 102 * Return if adapter number is negative. It could be in case hotplug 101 103 * event is not associated with hotplug device. ··· 105 103 if (data->hpdev.nr < 0) 106 104 return 0; 107 105 108 - data->hpdev.adapter = i2c_get_adapter(data->hpdev.nr); 106 + pdata = dev_get_platdata(&priv->pdev->dev); 107 + data->hpdev.adapter = i2c_get_adapter(data->hpdev.nr + 108 + pdata->shift_nr); 109 109 if (!data->hpdev.adapter) { 110 - dev_err(dev, "Failed to get adapter for bus %d\n", 111 - data->hpdev.nr); 110 + dev_err(priv->dev, "Failed to get adapter for bus %d\n", 111 + data->hpdev.nr + pdata->shift_nr); 112 112 return -EFAULT; 113 113 } 114 114 115 115 data->hpdev.client = i2c_new_device(data->hpdev.adapter, 116 116 data->hpdev.brdinfo); 117 117 if (!data->hpdev.client) { 118 - dev_err(dev, "Failed to create client %s at bus %d at addr 0x%02x\n", 119 - data->hpdev.brdinfo->type, data->hpdev.nr, 120 - data->hpdev.brdinfo->addr); 118 + dev_err(priv->dev, "Failed to create client %s at bus %d at addr 0x%02x\n", 119 + data->hpdev.brdinfo->type, data->hpdev.nr + 120 + pdata->shift_nr, data->hpdev.brdinfo->addr); 121 121 122 122 i2c_put_adapter(data->hpdev.adapter); 123 123 data->hpdev.adapter = NULL; ··· 274 270 if (item->inversed) 275 271 mlxreg_hotplug_device_destroy(data); 276 272 else 277 - mlxreg_hotplug_device_create(priv->dev, data); 273 + mlxreg_hotplug_device_create(priv, data); 278 274 } else { 279 275 if (item->inversed) 280 - mlxreg_hotplug_device_create(priv->dev, data); 276 + mlxreg_hotplug_device_create(priv, data); 281 277 else 282 278 mlxreg_hotplug_device_destroy(data); 283 279 } ··· 323 319 if (regval == MLXREG_HOTPLUG_HEALTH_MASK) { 324 320 if ((data->health_cntr++ == MLXREG_HOTPLUG_RST_CNTR) || 325 321 !priv->after_probe) { 326 - mlxreg_hotplug_device_create(priv->dev, data); 322 + mlxreg_hotplug_device_create(priv, data); 327 323 data->attached = true; 328 324 } 329 325 } else { ··· 554 550 { 555 551 struct mlxreg_core_hotplug_platform_data *pdata; 556 552 struct mlxreg_hotplug_priv_data *priv; 553 + struct i2c_adapter *deferred_adap; 557 554 int err; 558 555 559 556 pdata = dev_get_platdata(&pdev->dev); ··· 562 557 dev_err(&pdev->dev, "Failed to get platform data.\n"); 563 558 return -EINVAL; 564 559 } 560 + 561 + /* Defer probing if the necessary adapter is not configured yet. */ 562 + deferred_adap = i2c_get_adapter(pdata->deferred_nr); 563 + if (!deferred_adap) 564 + return -EPROBE_DEFER; 565 + i2c_put_adapter(deferred_adap); 565 566 566 567 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 567 568 if (!priv)
+3
drivers/platform/x86/Kconfig
··· 757 757 depends on ACPI 758 758 depends on INPUT 759 759 select INPUT_SPARSEKMAP 760 + select LEDS_CLASS 761 + select NEW_LEDS 760 762 ---help--- 761 763 This driver adds support for hotkeys found on Topstar laptops. 762 764 ··· 1176 1174 1177 1175 config MLX_PLATFORM 1178 1176 tristate "Mellanox Technologies platform support" 1177 + depends on I2C && REGMAP 1179 1178 ---help--- 1180 1179 This option enables system support for the Mellanox Technologies 1181 1180 platform. The Mellanox systems provide data center networking
+2 -2
drivers/platform/x86/dell-smbios-base.c
··· 514 514 continue; 515 515 516 516 loop_fail_create_value: 517 - kfree(value_name); 517 + kfree(location_name); 518 518 goto out_unwind_strings; 519 519 } 520 520 smbios_attribute_group.attrs = token_attrs; ··· 525 525 return 0; 526 526 527 527 out_unwind_strings: 528 - for (i = i-1; i > 0; i--) { 528 + while (i--) { 529 529 kfree(token_location_attrs[i].attr.name); 530 530 kfree(token_value_attrs[i].attr.name); 531 531 }
+104 -91
drivers/platform/x86/fujitsu-laptop.c
··· 53 53 #include <linux/kernel.h> 54 54 #include <linux/init.h> 55 55 #include <linux/acpi.h> 56 + #include <linux/bitops.h> 56 57 #include <linux/dmi.h> 57 58 #include <linux/backlight.h> 58 59 #include <linux/fb.h> ··· 62 61 #include <linux/kfifo.h> 63 62 #include <linux/leds.h> 64 63 #include <linux/platform_device.h> 65 - #include <linux/slab.h> 66 64 #include <acpi/video.h> 67 65 68 - #define FUJITSU_DRIVER_VERSION "0.6.0" 66 + #define FUJITSU_DRIVER_VERSION "0.6.0" 69 67 70 - #define FUJITSU_LCD_N_LEVELS 8 68 + #define FUJITSU_LCD_N_LEVELS 8 71 69 72 70 #define ACPI_FUJITSU_CLASS "fujitsu" 73 71 #define ACPI_FUJITSU_BL_HID "FUJ02B1" ··· 76 76 #define ACPI_FUJITSU_LAPTOP_DRIVER_NAME "Fujitsu laptop FUJ02E3 ACPI hotkeys driver" 77 77 #define ACPI_FUJITSU_LAPTOP_DEVICE_NAME "Fujitsu FUJ02E3" 78 78 79 - #define ACPI_FUJITSU_NOTIFY_CODE1 0x80 79 + #define ACPI_FUJITSU_NOTIFY_CODE 0x80 80 80 81 81 /* FUNC interface - command values */ 82 - #define FUNC_FLAGS 0x1000 83 - #define FUNC_LEDS 0x1001 84 - #define FUNC_BUTTONS 0x1002 85 - #define FUNC_BACKLIGHT 0x1004 82 + #define FUNC_FLAGS BIT(12) 83 + #define FUNC_LEDS (BIT(12) | BIT(0)) 84 + #define FUNC_BUTTONS (BIT(12) | BIT(1)) 85 + #define FUNC_BACKLIGHT (BIT(12) | BIT(2)) 86 86 87 87 /* FUNC interface - responses */ 88 - #define UNSUPPORTED_CMD 0x80000000 88 + #define UNSUPPORTED_CMD 0x80000000 89 89 90 90 /* FUNC interface - status flags */ 91 - #define FLAG_RFKILL 0x020 92 - #define FLAG_LID 0x100 93 - #define FLAG_DOCK 0x200 91 + #define FLAG_RFKILL BIT(5) 92 + #define FLAG_LID BIT(8) 93 + #define FLAG_DOCK BIT(9) 94 94 95 95 /* FUNC interface - LED control */ 96 - #define FUNC_LED_OFF 0x1 97 - #define FUNC_LED_ON 0x30001 98 - #define KEYBOARD_LAMPS 0x100 99 - #define LOGOLAMP_POWERON 0x2000 100 - #define LOGOLAMP_ALWAYS 0x4000 101 - #define RADIO_LED_ON 0x20 102 - #define ECO_LED 0x10000 103 - #define ECO_LED_ON 0x80000 96 + #define FUNC_LED_OFF BIT(0) 97 + #define FUNC_LED_ON (BIT(0) | BIT(16) | BIT(17)) 98 + #define LOGOLAMP_POWERON BIT(13) 99 + #define LOGOLAMP_ALWAYS BIT(14) 100 + #define KEYBOARD_LAMPS BIT(8) 101 + #define RADIO_LED_ON BIT(5) 102 + #define ECO_LED BIT(16) 103 + #define ECO_LED_ON BIT(19) 104 104 105 - /* Hotkey details */ 106 - #define KEY1_CODE 0x410 /* codes for the keys in the GIRB register */ 107 - #define KEY2_CODE 0x411 108 - #define KEY3_CODE 0x412 109 - #define KEY4_CODE 0x413 110 - #define KEY5_CODE 0x420 105 + /* FUNC interface - backlight power control */ 106 + #define BACKLIGHT_PARAM_POWER BIT(2) 107 + #define BACKLIGHT_OFF (BIT(0) | BIT(1)) 108 + #define BACKLIGHT_ON 0 111 109 112 - #define MAX_HOTKEY_RINGBUFFER_SIZE 100 113 - #define RINGBUFFERSIZE 40 110 + /* Scancodes read from the GIRB register */ 111 + #define KEY1_CODE 0x410 112 + #define KEY2_CODE 0x411 113 + #define KEY3_CODE 0x412 114 + #define KEY4_CODE 0x413 115 + #define KEY5_CODE 0x420 116 + 117 + /* Hotkey ringbuffer limits */ 118 + #define MAX_HOTKEY_RINGBUFFER_SIZE 100 119 + #define RINGBUFFERSIZE 40 120 + 121 + /* Module parameters */ 122 + static int use_alt_lcd_levels = -1; 123 + static bool disable_brightness_adjust; 114 124 115 125 /* Device controlling the backlight and associated keys */ 116 126 struct fujitsu_bl { ··· 132 122 }; 133 123 134 124 static struct fujitsu_bl *fujitsu_bl; 135 - static int use_alt_lcd_levels = -1; 136 - static bool disable_brightness_adjust; 137 125 138 126 /* Device used to access hotkeys and other features on the laptop */ 139 127 struct fujitsu_laptop { ··· 264 256 265 257 if (fext) { 266 258 if (b->props.power == FB_BLANK_POWERDOWN) 267 - call_fext_func(fext, FUNC_BACKLIGHT, 0x1, 0x4, 0x3); 259 + call_fext_func(fext, FUNC_BACKLIGHT, 0x1, 260 + BACKLIGHT_PARAM_POWER, BACKLIGHT_OFF); 268 261 else 269 - call_fext_func(fext, FUNC_BACKLIGHT, 0x1, 0x4, 0x0); 262 + call_fext_func(fext, FUNC_BACKLIGHT, 0x1, 263 + BACKLIGHT_PARAM_POWER, BACKLIGHT_ON); 270 264 } 271 265 272 266 return set_lcd_level(device, b->props.brightness); ··· 395 385 static int acpi_fujitsu_bl_add(struct acpi_device *device) 396 386 { 397 387 struct fujitsu_bl *priv; 398 - int error; 388 + int ret; 399 389 400 390 if (acpi_video_get_backlight_type() != acpi_backlight_vendor) 401 391 return -ENODEV; ··· 409 399 strcpy(acpi_device_class(device), ACPI_FUJITSU_CLASS); 410 400 device->driver_data = priv; 411 401 412 - error = acpi_fujitsu_bl_input_setup(device); 413 - if (error) 414 - return error; 415 - 416 402 pr_info("ACPI: %s [%s]\n", 417 403 acpi_device_name(device), acpi_device_bid(device)); 418 404 ··· 416 410 priv->max_brightness = FUJITSU_LCD_N_LEVELS; 417 411 get_lcd_level(device); 418 412 419 - error = fujitsu_backlight_register(device); 420 - if (error) 421 - return error; 413 + ret = acpi_fujitsu_bl_input_setup(device); 414 + if (ret) 415 + return ret; 422 416 423 - return 0; 417 + return fujitsu_backlight_register(device); 424 418 } 425 419 426 420 /* Brightness notify */ ··· 430 424 struct fujitsu_bl *priv = acpi_driver_data(device); 431 425 int oldb, newb; 432 426 433 - if (event != ACPI_FUJITSU_NOTIFY_CODE1) { 427 + if (event != ACPI_FUJITSU_NOTIFY_CODE) { 434 428 acpi_handle_info(device->handle, "unsupported event [0x%x]\n", 435 429 event); 436 430 sparse_keymap_report_event(priv->input, -1, 1, true); ··· 461 455 { KE_KEY, KEY3_CODE, { KEY_PROG3 } }, 462 456 { KE_KEY, KEY4_CODE, { KEY_PROG4 } }, 463 457 { KE_KEY, KEY5_CODE, { KEY_RFKILL } }, 458 + { KE_KEY, BIT(5), { KEY_RFKILL } }, 464 459 { KE_KEY, BIT(26), { KEY_TOUCHPAD_TOGGLE } }, 460 + { KE_KEY, BIT(29), { KEY_MICMUTE } }, 465 461 { KE_END, 0 } 466 462 }; 467 463 ··· 701 693 { 702 694 struct fujitsu_laptop *priv = acpi_driver_data(device); 703 695 struct led_classdev *led; 704 - int result; 696 + int ret; 705 697 706 698 if (call_fext_func(device, 707 699 FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) { ··· 712 704 led->name = "fujitsu::logolamp"; 713 705 led->brightness_set_blocking = logolamp_set; 714 706 led->brightness_get = logolamp_get; 715 - result = devm_led_classdev_register(&device->dev, led); 716 - if (result) 717 - return result; 707 + ret = devm_led_classdev_register(&device->dev, led); 708 + if (ret) 709 + return ret; 718 710 } 719 711 720 712 if ((call_fext_func(device, ··· 727 719 led->name = "fujitsu::kblamps"; 728 720 led->brightness_set_blocking = kblamps_set; 729 721 led->brightness_get = kblamps_get; 730 - result = devm_led_classdev_register(&device->dev, led); 731 - if (result) 732 - return result; 722 + ret = devm_led_classdev_register(&device->dev, led); 723 + if (ret) 724 + return ret; 733 725 } 734 726 735 727 /* ··· 750 742 led->brightness_set_blocking = radio_led_set; 751 743 led->brightness_get = radio_led_get; 752 744 led->default_trigger = "rfkill-any"; 753 - result = devm_led_classdev_register(&device->dev, led); 754 - if (result) 755 - return result; 745 + ret = devm_led_classdev_register(&device->dev, led); 746 + if (ret) 747 + return ret; 756 748 } 757 749 758 750 /* Support for eco led is not always signaled in bit corresponding ··· 770 762 led->name = "fujitsu::eco_led"; 771 763 led->brightness_set_blocking = eco_led_set; 772 764 led->brightness_get = eco_led_get; 773 - result = devm_led_classdev_register(&device->dev, led); 774 - if (result) 775 - return result; 765 + ret = devm_led_classdev_register(&device->dev, led); 766 + if (ret) 767 + return ret; 776 768 } 777 769 778 770 return 0; ··· 781 773 static int acpi_fujitsu_laptop_add(struct acpi_device *device) 782 774 { 783 775 struct fujitsu_laptop *priv; 784 - int error; 785 - int i; 776 + int ret, i = 0; 786 777 787 778 priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL); 788 779 if (!priv) ··· 796 789 797 790 /* kfifo */ 798 791 spin_lock_init(&priv->fifo_lock); 799 - error = kfifo_alloc(&priv->fifo, RINGBUFFERSIZE * sizeof(int), 800 - GFP_KERNEL); 801 - if (error) { 802 - pr_err("kfifo_alloc failed\n"); 803 - goto err_stop; 804 - } 805 - 806 - error = acpi_fujitsu_laptop_input_setup(device); 807 - if (error) 808 - goto err_free_fifo; 792 + ret = kfifo_alloc(&priv->fifo, RINGBUFFERSIZE * sizeof(int), 793 + GFP_KERNEL); 794 + if (ret) 795 + return ret; 809 796 810 797 pr_info("ACPI: %s [%s]\n", 811 798 acpi_device_name(device), acpi_device_bid(device)); 812 799 813 - i = 0; 814 - while (call_fext_func(device, FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0 815 - && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) 800 + while (call_fext_func(device, FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0 && 801 + i++ < MAX_HOTKEY_RINGBUFFER_SIZE) 816 802 ; /* No action, result is discarded */ 817 803 acpi_handle_debug(device->handle, "Discarded %i ringbuffer entries\n", 818 804 i); ··· 829 829 /* Sync backlight power status */ 830 830 if (fujitsu_bl && fujitsu_bl->bl_device && 831 831 acpi_video_get_backlight_type() == acpi_backlight_vendor) { 832 - if (call_fext_func(fext, FUNC_BACKLIGHT, 0x2, 0x4, 0x0) == 3) 832 + if (call_fext_func(fext, FUNC_BACKLIGHT, 0x2, 833 + BACKLIGHT_PARAM_POWER, 0x0) == BACKLIGHT_OFF) 833 834 fujitsu_bl->bl_device->props.power = FB_BLANK_POWERDOWN; 834 835 else 835 836 fujitsu_bl->bl_device->props.power = FB_BLANK_UNBLANK; 836 837 } 837 838 838 - error = acpi_fujitsu_laptop_leds_register(device); 839 - if (error) 839 + ret = acpi_fujitsu_laptop_input_setup(device); 840 + if (ret) 840 841 goto err_free_fifo; 841 842 842 - error = fujitsu_laptop_platform_add(device); 843 - if (error) 843 + ret = acpi_fujitsu_laptop_leds_register(device); 844 + if (ret) 845 + goto err_free_fifo; 846 + 847 + ret = fujitsu_laptop_platform_add(device); 848 + if (ret) 844 849 goto err_free_fifo; 845 850 846 851 return 0; 847 852 848 853 err_free_fifo: 849 854 kfifo_free(&priv->fifo); 850 - err_stop: 851 - return error; 855 + 856 + return ret; 852 857 } 853 858 854 859 static int acpi_fujitsu_laptop_remove(struct acpi_device *device) ··· 870 865 static void acpi_fujitsu_laptop_press(struct acpi_device *device, int scancode) 871 866 { 872 867 struct fujitsu_laptop *priv = acpi_driver_data(device); 873 - int status; 868 + int ret; 874 869 875 - status = kfifo_in_locked(&priv->fifo, (unsigned char *)&scancode, 876 - sizeof(scancode), &priv->fifo_lock); 877 - if (status != sizeof(scancode)) { 870 + ret = kfifo_in_locked(&priv->fifo, (unsigned char *)&scancode, 871 + sizeof(scancode), &priv->fifo_lock); 872 + if (ret != sizeof(scancode)) { 878 873 dev_info(&priv->input->dev, "Could not push scancode [0x%x]\n", 879 874 scancode); 880 875 return; ··· 887 882 static void acpi_fujitsu_laptop_release(struct acpi_device *device) 888 883 { 889 884 struct fujitsu_laptop *priv = acpi_driver_data(device); 890 - int scancode, status; 885 + int scancode, ret; 891 886 892 887 while (true) { 893 - status = kfifo_out_locked(&priv->fifo, 894 - (unsigned char *)&scancode, 895 - sizeof(scancode), &priv->fifo_lock); 896 - if (status != sizeof(scancode)) 888 + ret = kfifo_out_locked(&priv->fifo, (unsigned char *)&scancode, 889 + sizeof(scancode), &priv->fifo_lock); 890 + if (ret != sizeof(scancode)) 897 891 return; 898 892 sparse_keymap_report_event(priv->input, scancode, 0, false); 899 893 dev_dbg(&priv->input->dev, ··· 903 899 static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 event) 904 900 { 905 901 struct fujitsu_laptop *priv = acpi_driver_data(device); 906 - int scancode, i = 0; 902 + int scancode, i = 0, ret; 907 903 unsigned int irb; 908 904 909 - if (event != ACPI_FUJITSU_NOTIFY_CODE1) { 905 + if (event != ACPI_FUJITSU_NOTIFY_CODE) { 910 906 acpi_handle_info(device->handle, "Unsupported event [0x%x]\n", 911 907 event); 912 908 sparse_keymap_report_event(priv->input, -1, 1, true); ··· 934 930 * E736/E746/E756), the touchpad toggle hotkey (Fn+F4) is 935 931 * handled in software; its state is queried using FUNC_FLAGS 936 932 */ 937 - if ((priv->flags_supported & BIT(26)) && 938 - (call_fext_func(device, FUNC_FLAGS, 0x1, 0x0, 0x0) & BIT(26))) 939 - sparse_keymap_report_event(priv->input, BIT(26), 1, true); 933 + if (priv->flags_supported & (BIT(5) | BIT(26) | BIT(29))) { 934 + ret = call_fext_func(device, FUNC_FLAGS, 0x1, 0x0, 0x0); 935 + if (ret & BIT(5)) 936 + sparse_keymap_report_event(priv->input, 937 + BIT(5), 1, true); 938 + if (ret & BIT(26)) 939 + sparse_keymap_report_event(priv->input, 940 + BIT(26), 1, true); 941 + if (ret & BIT(29)) 942 + sparse_keymap_report_event(priv->input, 943 + BIT(29), 1, true); 944 + } 940 945 } 941 946 942 947 /* Initialization */
+2 -2
drivers/platform/x86/gpd-pocket-fan.c
··· 19 19 static int temp_limits[3] = { 55000, 60000, 65000 }; 20 20 module_param_array(temp_limits, int, NULL, 0444); 21 21 MODULE_PARM_DESC(temp_limits, 22 - "Milli-celcius values above which the fan speed increases"); 22 + "Millicelsius values above which the fan speed increases"); 23 23 24 24 static int hysteresis = 3000; 25 25 module_param(hysteresis, int, 0444); 26 26 MODULE_PARM_DESC(hysteresis, 27 - "Hysteresis in milli-celcius before lowering the fan speed"); 27 + "Hysteresis in millicelsius before lowering the fan speed"); 28 28 29 29 static int speed_on_ac = 2; 30 30 module_param(speed_on_ac, int, 0444);
+6 -8
drivers/platform/x86/intel-hid.c
··· 16 16 * 17 17 */ 18 18 19 + #include <linux/acpi.h> 20 + #include <linux/dmi.h> 21 + #include <linux/input.h> 22 + #include <linux/input/sparse-keymap.h> 19 23 #include <linux/kernel.h> 20 24 #include <linux/module.h> 21 - #include <linux/init.h> 22 - #include <linux/input.h> 23 25 #include <linux/platform_device.h> 24 - #include <linux/input/sparse-keymap.h> 25 - #include <linux/acpi.h> 26 26 #include <linux/suspend.h> 27 - #include <acpi/acpi_bus.h> 28 - #include <linux/dmi.h> 29 27 30 28 MODULE_LICENSE("GPL"); 31 29 MODULE_AUTHOR("Alex Hung"); ··· 65 67 { KE_IGNORE, 0xC5, { KEY_VOLUMEUP } }, /* Release */ 66 68 { KE_KEY, 0xC6, { KEY_VOLUMEDOWN } }, /* Press */ 67 69 { KE_IGNORE, 0xC7, { KEY_VOLUMEDOWN } }, /* Release */ 68 - { KE_SW, 0xC8, { .sw = { SW_ROTATE_LOCK, 1 } } }, /* Press */ 69 - { KE_SW, 0xC9, { .sw = { SW_ROTATE_LOCK, 0 } } }, /* Release */ 70 + { KE_KEY, 0xC8, { KEY_ROTATE_LOCK_TOGGLE } }, /* Press */ 71 + { KE_IGNORE, 0xC9, { KEY_ROTATE_LOCK_TOGGLE } }, /* Release */ 70 72 { KE_KEY, 0xCE, { KEY_POWER } }, /* Press */ 71 73 { KE_IGNORE, 0xCF, { KEY_POWER } }, /* Release */ 72 74 { KE_END },
-3
drivers/platform/x86/intel_turbo_max_3.c
··· 138 138 if (!id) 139 139 return -ENODEV; 140 140 141 - if (boot_cpu_has(X86_FEATURE_HWP)) 142 - return -ENODEV; 143 - 144 141 ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, 145 142 "platform/x86/turbo_max_3:online", 146 143 itmt_legacy_cpu_online, NULL);
+65 -3
drivers/platform/x86/mlx-platform.c
··· 85 85 #define MLXPLAT_CPLD_FAN_MASK GENMASK(3, 0) 86 86 #define MLXPLAT_CPLD_FAN_NG_MASK GENMASK(5, 0) 87 87 88 + /* Default I2C parent bus number */ 89 + #define MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR 1 90 + 91 + /* Maximum number of possible physical buses equipped on system */ 92 + #define MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM 16 93 + 94 + /* Number of channels in group */ 95 + #define MLXPLAT_CPLD_GRP_CHNL_NUM 8 96 + 88 97 /* Start channel numbers */ 89 98 #define MLXPLAT_CPLD_CH1 2 90 99 #define MLXPLAT_CPLD_CH2 10 ··· 133 124 }; 134 125 135 126 /* Platform default channels */ 136 - static const int mlxplat_default_channels[][8] = { 127 + static const int mlxplat_default_channels[][MLXPLAT_CPLD_GRP_CHNL_NUM] = { 137 128 { 138 129 MLXPLAT_CPLD_CH1, MLXPLAT_CPLD_CH1 + 1, MLXPLAT_CPLD_CH1 + 2, 139 130 MLXPLAT_CPLD_CH1 + 3, MLXPLAT_CPLD_CH1 + 4, MLXPLAT_CPLD_CH1 + ··· 703 694 ARRAY_SIZE(mlxplat_default_channels[i]); 704 695 } 705 696 mlxplat_hotplug = &mlxplat_mlxcpld_default_data; 697 + mlxplat_hotplug->deferred_nr = 698 + mlxplat_default_channels[i - 1][MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; 706 699 707 700 return 1; 708 701 }; ··· 719 708 ARRAY_SIZE(mlxplat_msn21xx_channels); 720 709 } 721 710 mlxplat_hotplug = &mlxplat_mlxcpld_msn21xx_data; 711 + mlxplat_hotplug->deferred_nr = 712 + mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; 722 713 723 714 return 1; 724 715 }; ··· 735 722 ARRAY_SIZE(mlxplat_msn21xx_channels); 736 723 } 737 724 mlxplat_hotplug = &mlxplat_mlxcpld_msn274x_data; 725 + mlxplat_hotplug->deferred_nr = 726 + mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; 738 727 739 728 return 1; 740 729 }; ··· 751 736 ARRAY_SIZE(mlxplat_msn21xx_channels); 752 737 } 753 738 mlxplat_hotplug = &mlxplat_mlxcpld_msn201x_data; 739 + mlxplat_hotplug->deferred_nr = 740 + mlxplat_default_channels[i - 1][MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; 754 741 755 742 return 1; 756 743 }; ··· 767 750 ARRAY_SIZE(mlxplat_msn21xx_channels); 768 751 } 769 752 mlxplat_hotplug = &mlxplat_mlxcpld_default_ng_data; 753 + mlxplat_hotplug->deferred_nr = 754 + mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; 770 755 771 756 return 1; 772 757 }; ··· 849 830 850 831 MODULE_DEVICE_TABLE(dmi, mlxplat_dmi_table); 851 832 833 + static int mlxplat_mlxcpld_verify_bus_topology(int *nr) 834 + { 835 + struct i2c_adapter *search_adap; 836 + int shift, i; 837 + 838 + /* Scan adapters from expected id to verify it is free. */ 839 + *nr = MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR; 840 + for (i = MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR; i < 841 + MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM; i++) { 842 + search_adap = i2c_get_adapter(i); 843 + if (search_adap) { 844 + i2c_put_adapter(search_adap); 845 + continue; 846 + } 847 + 848 + /* Return if expected parent adapter is free. */ 849 + if (i == MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR) 850 + return 0; 851 + break; 852 + } 853 + 854 + /* Return with error if free id for adapter is not found. */ 855 + if (i == MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM) 856 + return -ENODEV; 857 + 858 + /* Shift adapter ids, since expected parent adapter is not free. */ 859 + *nr = i; 860 + for (i = 0; i < ARRAY_SIZE(mlxplat_mux_data); i++) { 861 + shift = *nr - mlxplat_mux_data[i].parent; 862 + mlxplat_mux_data[i].parent = *nr; 863 + mlxplat_mux_data[i].base_nr += shift; 864 + if (shift > 0) 865 + mlxplat_hotplug->shift_nr = shift; 866 + } 867 + 868 + return 0; 869 + } 870 + 852 871 static int __init mlxplat_init(void) 853 872 { 854 873 struct mlxplat_priv *priv; 855 - int i, err; 874 + int i, nr, err; 856 875 857 876 if (!dmi_check_system(mlxplat_dmi_table)) 858 877 return -ENODEV; ··· 910 853 } 911 854 platform_set_drvdata(mlxplat_dev, priv); 912 855 913 - priv->pdev_i2c = platform_device_register_simple("i2c_mlxcpld", -1, 856 + err = mlxplat_mlxcpld_verify_bus_topology(&nr); 857 + if (nr < 0) 858 + goto fail_alloc; 859 + 860 + nr = (nr == MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM) ? -1 : nr; 861 + priv->pdev_i2c = platform_device_register_simple("i2c_mlxcpld", nr, 914 862 NULL, 0); 915 863 if (IS_ERR(priv->pdev_i2c)) { 916 864 err = PTR_ERR(priv->pdev_i2c);
+17
drivers/platform/x86/silead_dmi.c
··· 446 446 DMI_MATCH(DMI_BOARD_NAME, "X3 Plus"), 447 447 }, 448 448 }, 449 + { 450 + /* I.T.Works TW701 */ 451 + .driver_data = (void *)&surftab_wintron70_st70416_6_data, 452 + .matches = { 453 + DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), 454 + DMI_MATCH(DMI_PRODUCT_NAME, "i71c"), 455 + DMI_MATCH(DMI_BIOS_VERSION, "itWORKS.G.WI71C.JGBMRB"), 456 + }, 457 + }, 458 + { 459 + /* Yours Y8W81, same case and touchscreen as Chuwi Vi8 */ 460 + .driver_data = (void *)&chuwi_vi8_data, 461 + .matches = { 462 + DMI_MATCH(DMI_SYS_VENDOR, "YOURS"), 463 + DMI_MATCH(DMI_PRODUCT_NAME, "Y8W81"), 464 + }, 465 + }, 449 466 { }, 450 467 }; 451 468
+8
drivers/platform/x86/thinkpad_acpi.c
··· 8703 8703 .ec = TPID(__id1, __id2), \ 8704 8704 .quirks = __quirks } 8705 8705 8706 + #define TPACPI_FAN_QB(__id1, __id2, __quirks) \ 8707 + { .vendor = PCI_VENDOR_ID_LENOVO, \ 8708 + .bios = TPID(__id1, __id2), \ 8709 + .ec = TPACPI_MATCH_ANY, \ 8710 + .quirks = __quirks } 8711 + 8706 8712 static const struct tpacpi_quirk fan_quirk_table[] __initconst = { 8707 8713 TPACPI_FAN_QI('1', 'Y', TPACPI_FAN_Q1), 8708 8714 TPACPI_FAN_QI('7', '8', TPACPI_FAN_Q1), 8709 8715 TPACPI_FAN_QI('7', '6', TPACPI_FAN_Q1), 8710 8716 TPACPI_FAN_QI('7', '0', TPACPI_FAN_Q1), 8711 8717 TPACPI_FAN_QL('7', 'M', TPACPI_FAN_2FAN), 8718 + TPACPI_FAN_QB('N', '1', TPACPI_FAN_2FAN), 8712 8719 }; 8713 8720 8714 8721 #undef TPACPI_FAN_QL 8715 8722 #undef TPACPI_FAN_QI 8723 + #undef TPACPI_FAN_QB 8716 8724 8717 8725 static int __init fan_init(struct ibm_init_struct *iibm) 8718 8726 {
+292 -77
drivers/platform/x86/topstar-laptop.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 - * ACPI driver for Topstar notebooks (hotkeys support only) 3 + * Topstar Laptop ACPI Extras driver 3 4 * 4 5 * Copyright (c) 2009 Herton Ronaldo Krzesinski <herton@mandriva.com.br> 6 + * Copyright (c) 2018 Guillaume Douézan-Grard 5 7 * 6 8 * Implementation inspired by existing x86 platform drivers, in special 7 - * asus/eepc/fujitsu-laptop, thanks to their authors 8 - * 9 - * This program is free software; you can redistribute it and/or modify 10 - * it under the terms of the GNU General Public License version 2 as 11 - * published by the Free Software Foundation. 9 + * asus/eepc/fujitsu-laptop, thanks to their authors. 12 10 */ 13 11 14 12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ··· 16 18 #include <linux/init.h> 17 19 #include <linux/slab.h> 18 20 #include <linux/acpi.h> 21 + #include <linux/dmi.h> 19 22 #include <linux/input.h> 20 23 #include <linux/input/sparse-keymap.h> 24 + #include <linux/leds.h> 25 + #include <linux/platform_device.h> 21 26 22 - #define ACPI_TOPSTAR_CLASS "topstar" 27 + #define TOPSTAR_LAPTOP_CLASS "topstar" 23 28 24 - struct topstar_hkey { 25 - struct input_dev *inputdev; 29 + struct topstar_laptop { 30 + struct acpi_device *device; 31 + struct platform_device *platform; 32 + struct input_dev *input; 33 + struct led_classdev led; 26 34 }; 35 + 36 + /* 37 + * LED 38 + */ 39 + 40 + static enum led_brightness topstar_led_get(struct led_classdev *led) 41 + { 42 + return led->brightness; 43 + } 44 + 45 + static int topstar_led_set(struct led_classdev *led, 46 + enum led_brightness state) 47 + { 48 + struct topstar_laptop *topstar = container_of(led, 49 + struct topstar_laptop, led); 50 + 51 + struct acpi_object_list params; 52 + union acpi_object in_obj; 53 + unsigned long long int ret; 54 + acpi_status status; 55 + 56 + params.count = 1; 57 + params.pointer = &in_obj; 58 + in_obj.type = ACPI_TYPE_INTEGER; 59 + in_obj.integer.value = 0x83; 60 + 61 + /* 62 + * Topstar ACPI returns 0x30001 when the LED is ON and 0x30000 when it 63 + * is OFF. 64 + */ 65 + status = acpi_evaluate_integer(topstar->device->handle, 66 + "GETX", &params, &ret); 67 + if (ACPI_FAILURE(status)) 68 + return -1; 69 + 70 + /* 71 + * FNCX(0x83) toggles the LED (more precisely, it is supposed to 72 + * act as an hardware switch and disconnect the WLAN adapter but 73 + * it seems to be faulty on some models like the Topstar U931 74 + * Notebook). 75 + */ 76 + if ((ret == 0x30001 && state == LED_OFF) 77 + || (ret == 0x30000 && state != LED_OFF)) { 78 + status = acpi_execute_simple_method(topstar->device->handle, 79 + "FNCX", 0x83); 80 + if (ACPI_FAILURE(status)) 81 + return -1; 82 + } 83 + 84 + return 0; 85 + } 86 + 87 + static int topstar_led_init(struct topstar_laptop *topstar) 88 + { 89 + topstar->led = (struct led_classdev) { 90 + .default_trigger = "rfkill0", 91 + .brightness_get = topstar_led_get, 92 + .brightness_set_blocking = topstar_led_set, 93 + .name = TOPSTAR_LAPTOP_CLASS "::wlan", 94 + }; 95 + 96 + return led_classdev_register(&topstar->platform->dev, &topstar->led); 97 + } 98 + 99 + static void topstar_led_exit(struct topstar_laptop *topstar) 100 + { 101 + led_classdev_unregister(&topstar->led); 102 + } 103 + 104 + /* 105 + * Input 106 + */ 27 107 28 108 static const struct key_entry topstar_keymap[] = { 29 109 { KE_KEY, 0x80, { KEY_BRIGHTNESSUP } }, ··· 133 57 { KE_END, 0 } 134 58 }; 135 59 136 - static void acpi_topstar_notify(struct acpi_device *device, u32 event) 60 + static void topstar_input_notify(struct topstar_laptop *topstar, int event) 137 61 { 62 + if (!sparse_keymap_report_event(topstar->input, event, 1, true)) 63 + pr_info("unknown event = 0x%02x\n", event); 64 + } 65 + 66 + static int topstar_input_init(struct topstar_laptop *topstar) 67 + { 68 + struct input_dev *input; 69 + int err; 70 + 71 + input = input_allocate_device(); 72 + if (!input) 73 + return -ENOMEM; 74 + 75 + input->name = "Topstar Laptop extra buttons"; 76 + input->phys = TOPSTAR_LAPTOP_CLASS "/input0"; 77 + input->id.bustype = BUS_HOST; 78 + input->dev.parent = &topstar->platform->dev; 79 + 80 + err = sparse_keymap_setup(input, topstar_keymap, NULL); 81 + if (err) { 82 + pr_err("Unable to setup input device keymap\n"); 83 + goto err_free_dev; 84 + } 85 + 86 + err = input_register_device(input); 87 + if (err) { 88 + pr_err("Unable to register input device\n"); 89 + goto err_free_dev; 90 + } 91 + 92 + topstar->input = input; 93 + return 0; 94 + 95 + err_free_dev: 96 + input_free_device(input); 97 + return err; 98 + } 99 + 100 + static void topstar_input_exit(struct topstar_laptop *topstar) 101 + { 102 + input_unregister_device(topstar->input); 103 + } 104 + 105 + /* 106 + * Platform 107 + */ 108 + 109 + static struct platform_driver topstar_platform_driver = { 110 + .driver = { 111 + .name = TOPSTAR_LAPTOP_CLASS, 112 + }, 113 + }; 114 + 115 + static int topstar_platform_init(struct topstar_laptop *topstar) 116 + { 117 + int err; 118 + 119 + topstar->platform = platform_device_alloc(TOPSTAR_LAPTOP_CLASS, -1); 120 + if (!topstar->platform) 121 + return -ENOMEM; 122 + 123 + platform_set_drvdata(topstar->platform, topstar); 124 + 125 + err = platform_device_add(topstar->platform); 126 + if (err) 127 + goto err_device_put; 128 + 129 + return 0; 130 + 131 + err_device_put: 132 + platform_device_put(topstar->platform); 133 + return err; 134 + } 135 + 136 + static void topstar_platform_exit(struct topstar_laptop *topstar) 137 + { 138 + platform_device_unregister(topstar->platform); 139 + } 140 + 141 + /* 142 + * ACPI 143 + */ 144 + 145 + static int topstar_acpi_fncx_switch(struct acpi_device *device, bool state) 146 + { 147 + acpi_status status; 148 + u64 arg = state ? 0x86 : 0x87; 149 + 150 + status = acpi_execute_simple_method(device->handle, "FNCX", arg); 151 + if (ACPI_FAILURE(status)) { 152 + pr_err("Unable to switch FNCX notifications\n"); 153 + return -ENODEV; 154 + } 155 + 156 + return 0; 157 + } 158 + 159 + static void topstar_acpi_notify(struct acpi_device *device, u32 event) 160 + { 161 + struct topstar_laptop *topstar = acpi_driver_data(device); 138 162 static bool dup_evnt[2]; 139 163 bool *dup; 140 - struct topstar_hkey *hkey = acpi_driver_data(device); 141 164 142 165 /* 0x83 and 0x84 key events comes duplicated... */ 143 166 if (event == 0x83 || event == 0x84) { ··· 248 73 *dup = true; 249 74 } 250 75 251 - if (!sparse_keymap_report_event(hkey->inputdev, event, 1, true)) 252 - pr_info("unknown event = 0x%02x\n", event); 76 + topstar_input_notify(topstar, event); 253 77 } 254 78 255 - static int acpi_topstar_fncx_switch(struct acpi_device *device, bool state) 79 + static int topstar_acpi_init(struct topstar_laptop *topstar) 256 80 { 257 - acpi_status status; 81 + return topstar_acpi_fncx_switch(topstar->device, true); 82 + } 258 83 259 - status = acpi_execute_simple_method(device->handle, "FNCX", 260 - state ? 0x86 : 0x87); 261 - if (ACPI_FAILURE(status)) { 262 - pr_err("Unable to switch FNCX notifications\n"); 263 - return -ENODEV; 264 - } 84 + static void topstar_acpi_exit(struct topstar_laptop *topstar) 85 + { 86 + topstar_acpi_fncx_switch(topstar->device, false); 87 + } 265 88 89 + /* 90 + * Enable software-based WLAN LED control on systems with defective 91 + * hardware switch. 92 + */ 93 + static bool led_workaround; 94 + 95 + static int dmi_led_workaround(const struct dmi_system_id *id) 96 + { 97 + led_workaround = true; 266 98 return 0; 267 99 } 268 100 269 - static int acpi_topstar_init_hkey(struct topstar_hkey *hkey) 101 + static const struct dmi_system_id topstar_dmi_ids[] = { 102 + { 103 + .callback = dmi_led_workaround, 104 + .ident = "Topstar U931/RVP7", 105 + .matches = { 106 + DMI_MATCH(DMI_BOARD_NAME, "U931"), 107 + DMI_MATCH(DMI_BOARD_VERSION, "RVP7"), 108 + }, 109 + }, 110 + {} 111 + }; 112 + 113 + static int topstar_acpi_add(struct acpi_device *device) 270 114 { 271 - struct input_dev *input; 272 - int error; 115 + struct topstar_laptop *topstar; 116 + int err; 273 117 274 - input = input_allocate_device(); 275 - if (!input) 276 - return -ENOMEM; 118 + dmi_check_system(topstar_dmi_ids); 277 119 278 - input->name = "Topstar Laptop extra buttons"; 279 - input->phys = "topstar/input0"; 280 - input->id.bustype = BUS_HOST; 281 - 282 - error = sparse_keymap_setup(input, topstar_keymap, NULL); 283 - if (error) { 284 - pr_err("Unable to setup input device keymap\n"); 285 - goto err_free_dev; 286 - } 287 - 288 - error = input_register_device(input); 289 - if (error) { 290 - pr_err("Unable to register input device\n"); 291 - goto err_free_dev; 292 - } 293 - 294 - hkey->inputdev = input; 295 - return 0; 296 - 297 - err_free_dev: 298 - input_free_device(input); 299 - return error; 300 - } 301 - 302 - static int acpi_topstar_add(struct acpi_device *device) 303 - { 304 - struct topstar_hkey *tps_hkey; 305 - 306 - tps_hkey = kzalloc(sizeof(struct topstar_hkey), GFP_KERNEL); 307 - if (!tps_hkey) 120 + topstar = kzalloc(sizeof(struct topstar_laptop), GFP_KERNEL); 121 + if (!topstar) 308 122 return -ENOMEM; 309 123 310 124 strcpy(acpi_device_name(device), "Topstar TPSACPI"); 311 - strcpy(acpi_device_class(device), ACPI_TOPSTAR_CLASS); 125 + strcpy(acpi_device_class(device), TOPSTAR_LAPTOP_CLASS); 126 + device->driver_data = topstar; 127 + topstar->device = device; 312 128 313 - if (acpi_topstar_fncx_switch(device, true)) 314 - goto add_err; 129 + err = topstar_acpi_init(topstar); 130 + if (err) 131 + goto err_free; 315 132 316 - if (acpi_topstar_init_hkey(tps_hkey)) 317 - goto add_err; 133 + err = topstar_platform_init(topstar); 134 + if (err) 135 + goto err_acpi_exit; 318 136 319 - device->driver_data = tps_hkey; 137 + err = topstar_input_init(topstar); 138 + if (err) 139 + goto err_platform_exit; 140 + 141 + if (led_workaround) { 142 + err = topstar_led_init(topstar); 143 + if (err) 144 + goto err_input_exit; 145 + } 146 + 320 147 return 0; 321 148 322 - add_err: 323 - kfree(tps_hkey); 324 - return -ENODEV; 149 + err_input_exit: 150 + topstar_input_exit(topstar); 151 + err_platform_exit: 152 + topstar_platform_exit(topstar); 153 + err_acpi_exit: 154 + topstar_acpi_exit(topstar); 155 + err_free: 156 + kfree(topstar); 157 + return err; 325 158 } 326 159 327 - static int acpi_topstar_remove(struct acpi_device *device) 160 + static int topstar_acpi_remove(struct acpi_device *device) 328 161 { 329 - struct topstar_hkey *tps_hkey = acpi_driver_data(device); 162 + struct topstar_laptop *topstar = acpi_driver_data(device); 330 163 331 - acpi_topstar_fncx_switch(device, false); 164 + if (led_workaround) 165 + topstar_led_exit(topstar); 332 166 333 - input_unregister_device(tps_hkey->inputdev); 334 - kfree(tps_hkey); 167 + topstar_input_exit(topstar); 168 + topstar_platform_exit(topstar); 169 + topstar_acpi_exit(topstar); 335 170 171 + kfree(topstar); 336 172 return 0; 337 173 } 338 174 ··· 354 168 }; 355 169 MODULE_DEVICE_TABLE(acpi, topstar_device_ids); 356 170 357 - static struct acpi_driver acpi_topstar_driver = { 171 + static struct acpi_driver topstar_acpi_driver = { 358 172 .name = "Topstar laptop ACPI driver", 359 - .class = ACPI_TOPSTAR_CLASS, 173 + .class = TOPSTAR_LAPTOP_CLASS, 360 174 .ids = topstar_device_ids, 361 175 .ops = { 362 - .add = acpi_topstar_add, 363 - .remove = acpi_topstar_remove, 364 - .notify = acpi_topstar_notify, 176 + .add = topstar_acpi_add, 177 + .remove = topstar_acpi_remove, 178 + .notify = topstar_acpi_notify, 365 179 }, 366 180 }; 367 - module_acpi_driver(acpi_topstar_driver); 181 + 182 + static int __init topstar_laptop_init(void) 183 + { 184 + int ret; 185 + 186 + ret = platform_driver_register(&topstar_platform_driver); 187 + if (ret < 0) 188 + return ret; 189 + 190 + ret = acpi_bus_register_driver(&topstar_acpi_driver); 191 + if (ret < 0) 192 + goto err_driver_unreg; 193 + 194 + pr_info("ACPI extras driver loaded\n"); 195 + return 0; 196 + 197 + err_driver_unreg: 198 + platform_driver_unregister(&topstar_platform_driver); 199 + return ret; 200 + } 201 + 202 + static void __exit topstar_laptop_exit(void) 203 + { 204 + acpi_bus_unregister_driver(&topstar_acpi_driver); 205 + platform_driver_unregister(&topstar_platform_driver); 206 + } 207 + 208 + module_init(topstar_laptop_init); 209 + module_exit(topstar_laptop_exit); 368 210 369 211 MODULE_AUTHOR("Herton Ronaldo Krzesinski"); 212 + MODULE_AUTHOR("Guillaume Douézan-Grard"); 370 213 MODULE_DESCRIPTION("Topstar Laptop ACPI Extras driver"); 371 214 MODULE_LICENSE("GPL");
+6 -17
drivers/platform/x86/wmi.c
··· 130 130 uuid_le guid_input; 131 131 struct wmi_block *wblock; 132 132 struct guid_block *block; 133 - struct list_head *p; 134 133 135 134 if (uuid_le_to_bin(guid_string, &guid_input)) 136 135 return false; 137 136 138 - list_for_each(p, &wmi_block_list) { 139 - wblock = list_entry(p, struct wmi_block, list); 137 + list_for_each_entry(wblock, &wmi_block_list, list) { 140 138 block = &wblock->gblock; 141 139 142 140 if (memcmp(block->guid, &guid_input, 16) == 0) { ··· 517 519 struct wmi_block *block; 518 520 acpi_status status = AE_NOT_EXIST; 519 521 uuid_le guid_input; 520 - struct list_head *p; 521 522 522 523 if (!guid || !handler) 523 524 return AE_BAD_PARAMETER; ··· 524 527 if (uuid_le_to_bin(guid, &guid_input)) 525 528 return AE_BAD_PARAMETER; 526 529 527 - list_for_each(p, &wmi_block_list) { 530 + list_for_each_entry(block, &wmi_block_list, list) { 528 531 acpi_status wmi_status; 529 - block = list_entry(p, struct wmi_block, list); 530 532 531 533 if (memcmp(block->gblock.guid, &guid_input, 16) == 0) { 532 534 if (block->handler && ··· 556 560 struct wmi_block *block; 557 561 acpi_status status = AE_NOT_EXIST; 558 562 uuid_le guid_input; 559 - struct list_head *p; 560 563 561 564 if (!guid) 562 565 return AE_BAD_PARAMETER; ··· 563 568 if (uuid_le_to_bin(guid, &guid_input)) 564 569 return AE_BAD_PARAMETER; 565 570 566 - list_for_each(p, &wmi_block_list) { 571 + list_for_each_entry(block, &wmi_block_list, list) { 567 572 acpi_status wmi_status; 568 - block = list_entry(p, struct wmi_block, list); 569 573 570 574 if (memcmp(block->gblock.guid, &guid_input, 16) == 0) { 571 575 if (!block->handler || ··· 604 610 union acpi_object params[1]; 605 611 struct guid_block *gblock; 606 612 struct wmi_block *wblock; 607 - struct list_head *p; 608 613 609 614 input.count = 1; 610 615 input.pointer = params; 611 616 params[0].type = ACPI_TYPE_INTEGER; 612 617 params[0].integer.value = event; 613 618 614 - list_for_each(p, &wmi_block_list) { 615 - wblock = list_entry(p, struct wmi_block, list); 619 + list_for_each_entry(wblock, &wmi_block_list, list) { 616 620 gblock = &wblock->gblock; 617 621 618 622 if ((gblock->flags & ACPI_WMI_EVENT) && ··· 925 933 goto probe_failure; 926 934 } 927 935 928 - buf = kmalloc(strlen(wdriver->driver.name) + 5, GFP_KERNEL); 936 + buf = kasprintf(GFP_KERNEL, "wmi/%s", wdriver->driver.name); 929 937 if (!buf) { 930 938 ret = -ENOMEM; 931 939 goto probe_string_failure; 932 940 } 933 - sprintf(buf, "wmi/%s", wdriver->driver.name); 934 941 wblock->char_dev.minor = MISC_DYNAMIC_MINOR; 935 942 wblock->char_dev.name = buf; 936 943 wblock->char_dev.fops = &wmi_fops; ··· 1252 1261 { 1253 1262 struct guid_block *block; 1254 1263 struct wmi_block *wblock; 1255 - struct list_head *p; 1256 1264 bool found_it = false; 1257 1265 1258 - list_for_each(p, &wmi_block_list) { 1259 - wblock = list_entry(p, struct wmi_block, list); 1266 + list_for_each_entry(wblock, &wmi_block_list, list) { 1260 1267 block = &wblock->gblock; 1261 1268 1262 1269 if (wblock->acpi_device->handle == handle &&
+4
include/linux/platform_data/mlxreg.h
··· 129 129 * @mask: top aggregation interrupt common mask; 130 130 * @cell_low: location of low aggregation interrupt register; 131 131 * @mask_low: low aggregation interrupt common mask; 132 + * @deferred_nr: I2C adapter number must be exist prior probing execution; 133 + * @shift_nr: I2C adapter numbers must be incremented by this value; 132 134 */ 133 135 struct mlxreg_core_hotplug_platform_data { 134 136 struct mlxreg_core_item *items; ··· 141 139 u32 mask; 142 140 u32 cell_low; 143 141 u32 mask_low; 142 + int deferred_nr; 143 + int shift_nr; 144 144 }; 145 145 146 146 #endif /* __LINUX_PLATFORM_DATA_MLXREG_H */