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 ...
Unified · Split
| @@ -93,9 +93,11 @@ struct mlxreg_hotplug_priv_data { · 92 unmodified lines | ||
| 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. |
| @@ -103,19 +105,21 @@ static int mlxreg_hotplug_device_create(struct device *dev, · 1 unmodified line | ||
| 103 | 105 | if (data->hpdev.nr < 0) |
| 104 | 106 | return 0; |
| 105 | 107 | |
| 106 | − data->hpdev.adapter = i2c_get_adapter(data->hpdev.nr); | |
| 108 | + pdata = dev_get_platdata(&priv->pdev->dev); | |
| 109 | + data->hpdev.adapter = i2c_get_adapter(data->hpdev.nr + | |
| 110 | + pdata->shift_nr); | |
| 107 | 111 | if (!data->hpdev.adapter) { |
| 108 | − dev_err(dev, "Failed to get adapter for bus %d\n", | |
| 109 | − data->hpdev.nr); | |
| 112 | + dev_err(priv->dev, "Failed to get adapter for bus %d\n", | |
| 113 | + data->hpdev.nr + pdata->shift_nr); | |
| 110 | 114 | return -EFAULT; |
| 111 | 115 | } |
| 112 | 116 | |
| 113 | 117 | data->hpdev.client = i2c_new_device(data->hpdev.adapter, |
| 114 | 118 | data->hpdev.brdinfo); |
| 115 | 119 | if (!data->hpdev.client) { |
| 116 | − dev_err(dev, "Failed to create client %s at bus %d at addr 0x%02x\n", | |
| 117 | − data->hpdev.brdinfo->type, data->hpdev.nr, | |
| 118 | − data->hpdev.brdinfo->addr); | |
| 120 | + dev_err(priv->dev, "Failed to create client %s at bus %d at addr 0x%02x\n", | |
| 121 | + data->hpdev.brdinfo->type, data->hpdev.nr + | |
| 122 | + pdata->shift_nr, data->hpdev.brdinfo->addr); | |
| 119 | 123 | |
| 120 | 124 | i2c_put_adapter(data->hpdev.adapter); |
| 121 | 125 | data->hpdev.adapter = NULL; |
| @@ -270,10 +274,10 @@ mlxreg_hotplug_work_helper(struct mlxreg_hotplug_priv_data *priv, · 148 unmodified lines | ||
| 270 | 274 | if (item->inversed) |
| 271 | 275 | mlxreg_hotplug_device_destroy(data); |
| 272 | 276 | else |
| 273 | − mlxreg_hotplug_device_create(priv->dev, data); | |
| 277 | + mlxreg_hotplug_device_create(priv, data); | |
| 274 | 278 | } else { |
| 275 | 279 | if (item->inversed) |
| 276 | − mlxreg_hotplug_device_create(priv->dev, data); | |
| 280 | + mlxreg_hotplug_device_create(priv, data); | |
| 277 | 281 | else |
| 278 | 282 | mlxreg_hotplug_device_destroy(data); |
| 279 | 283 | } |
| @@ -319,7 +323,7 @@ mlxreg_hotplug_health_work_helper(struct mlxreg_hotplug_priv_data *priv, · 39 unmodified lines | ||
| 319 | 323 | if (regval == MLXREG_HOTPLUG_HEALTH_MASK) { |
| 320 | 324 | if ((data->health_cntr++ == MLXREG_HOTPLUG_RST_CNTR) || |
| 321 | 325 | !priv->after_probe) { |
| 322 | − mlxreg_hotplug_device_create(priv->dev, data); | |
| 326 | + mlxreg_hotplug_device_create(priv, data); | |
| 323 | 327 | data->attached = true; |
| 324 | 328 | } |
| 325 | 329 | } else { |
| @@ -550,6 +554,7 @@ static int mlxreg_hotplug_probe(struct platform_device *pdev) · 224 unmodified lines | ||
| 550 | 554 | { |
| 551 | 555 | struct mlxreg_core_hotplug_platform_data *pdata; |
| 552 | 556 | struct mlxreg_hotplug_priv_data *priv; |
| 557 | + struct i2c_adapter *deferred_adap; | |
| 553 | 558 | int err; |
| 554 | 559 | |
| 555 | 560 | pdata = dev_get_platdata(&pdev->dev); |
| @@ -558,6 +563,12 @@ static int mlxreg_hotplug_probe(struct platform_device *pdev) · 2 unmodified lines | ||
| 558 | 563 | return -EINVAL; |
| 559 | 564 | } |
| 560 | 565 | |
| 566 | + /* Defer probing if the necessary adapter is not configured yet. */ | |
| 567 | + deferred_adap = i2c_get_adapter(pdata->deferred_nr); | |
| 568 | + if (!deferred_adap) | |
| 569 | + return -EPROBE_DEFER; | |
| 570 | + i2c_put_adapter(deferred_adap); | |
| 571 | + | |
| 561 | 572 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |
| 562 | 573 | if (!priv) |
| 563 | 574 | return -ENOMEM; |
| @@ -757,6 +757,8 @@ config TOPSTAR_LAPTOP · 756 unmodified lines | ||
| 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 | |
| @@ -1174,6 +1176,7 @@ config INTEL_TELEMETRY · 411 unmodified lines | ||
| 1174 | 1176 | |
| 1175 | 1177 | config MLX_PLATFORM |
| 1176 | 1178 | tristate "Mellanox Technologies platform support" |
| 1179 | + depends on I2C && REGMAP | |
| 1177 | 1180 | ---help--- |
| 1178 | 1181 | This option enables system support for the Mellanox Technologies |
| 1179 | 1182 | platform. The Mellanox systems provide data center networking |
| @@ -514,7 +514,7 @@ static int build_tokens_sysfs(struct platform_device *dev) · 513 unmodified lines | ||
| 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,7 +525,7 @@ loop_fail_create_value: · 4 unmodified lines | ||
| 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 | } |
| @@ -53,6 +53,7 @@ · 52 unmodified lines | ||
| 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> |
| @@ -61,12 +62,11 @@ · 2 unmodified lines | ||
| 61 | 62 | #include <linux/kfifo.h> |
| 62 | 63 | #include <linux/leds.h> |
| 63 | 64 | #include <linux/platform_device.h> |
| 64 | −#include <linux/slab.h> | |
| 65 | 65 | #include <acpi/video.h> |
| 66 | 66 | |
| 67 | −#define FUJITSU_DRIVER_VERSION "0.6.0" | |
| 67 | +#define FUJITSU_DRIVER_VERSION "0.6.0" | |
| 68 | 68 | |
| 69 | −#define FUJITSU_LCD_N_LEVELS 8 | |
| 69 | +#define FUJITSU_LCD_N_LEVELS 8 | |
| 70 | 70 | |
| 71 | 71 | #define ACPI_FUJITSU_CLASS "fujitsu" |
| 72 | 72 | #define ACPI_FUJITSU_BL_HID "FUJ02B1" |
| @@ -76,41 +76,51 @@ · 3 unmodified lines | ||
| 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 | |
| 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 | |
| 111 | − | |
| 112 | −#define MAX_HOTKEY_RINGBUFFER_SIZE 100 | |
| 113 | −#define RINGBUFFERSIZE 40 | |
| 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 | + | |
| 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 | |
| 109 | + | |
| 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 { |
| @@ -122,8 +132,6 @@ struct fujitsu_bl { · 5 unmodified lines | ||
| 122 | 132 | }; |
| 123 | 133 | |
| 124 | 134 | static struct fujitsu_bl *fujitsu_bl; |
| 125 | −static int use_alt_lcd_levels = -1; | |
| 126 | −static bool disable_brightness_adjust; | |
| 127 | 135 | |
| 128 | 136 | /* Device used to access hotkeys and other features on the laptop */ |
| 129 | 137 | struct fujitsu_laptop { |
| @@ -256,9 +264,11 @@ static int bl_update_status(struct backlight_device *b) · 126 unmodified lines | ||
| 256 | 264 | |
| 257 | 265 | if (fext) { |
| 258 | 266 | if (b->props.power == FB_BLANK_POWERDOWN) |
| 259 | − call_fext_func(fext, FUNC_BACKLIGHT, 0x1, 0x4, 0x3); | |
| 267 | + call_fext_func(fext, FUNC_BACKLIGHT, 0x1, | |
| 268 | + BACKLIGHT_PARAM_POWER, BACKLIGHT_OFF); | |
| 260 | 269 | else |
| 261 | − call_fext_func(fext, FUNC_BACKLIGHT, 0x1, 0x4, 0x0); | |
| 270 | + call_fext_func(fext, FUNC_BACKLIGHT, 0x1, | |
| 271 | + BACKLIGHT_PARAM_POWER, BACKLIGHT_ON); | |
| 262 | 272 | } |
| 263 | 273 | |
| 264 | 274 | return set_lcd_level(device, b->props.brightness); |
| @@ -385,7 +395,7 @@ static int fujitsu_backlight_register(struct acpi_device *device) · 120 unmodified lines | ||
| 385 | 395 | static int acpi_fujitsu_bl_add(struct acpi_device *device) |
| 386 | 396 | { |
| 387 | 397 | struct fujitsu_bl *priv; |
| 388 | − int error; | |
| 398 | + int ret; | |
| 389 | 399 | |
| 390 | 400 | if (acpi_video_get_backlight_type() != acpi_backlight_vendor) |
| 391 | 401 | return -ENODEV; |
| @@ -399,10 +409,6 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device) · 7 unmodified lines | ||
| 399 | 409 | strcpy(acpi_device_class(device), ACPI_FUJITSU_CLASS); |
| 400 | 410 | device->driver_data = priv; |
| 401 | 411 | |
| 402 | − error = acpi_fujitsu_bl_input_setup(device); | |
| 403 | − if (error) | |
| 404 | − return error; | |
| 405 | − | |
| 406 | 412 | pr_info("ACPI: %s [%s]\n", |
| 407 | 413 | acpi_device_name(device), acpi_device_bid(device)); |
| 408 | 414 | |
| @@ -410,11 +416,11 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device) · 1 unmodified line | ||
| 410 | 416 | priv->max_brightness = FUJITSU_LCD_N_LEVELS; |
| 411 | 417 | get_lcd_level(device); |
| 412 | 418 | |
| 413 | − error = fujitsu_backlight_register(device); | |
| 414 | − if (error) | |
| 415 | − return error; | |
| 419 | + ret = acpi_fujitsu_bl_input_setup(device); | |
| 420 | + if (ret) | |
| 421 | + return ret; | |
| 416 | 422 | |
| 417 | − return 0; | |
| 423 | + return fujitsu_backlight_register(device); | |
| 418 | 424 | } |
| 419 | 425 | |
| 420 | 426 | /* Brightness notify */ |
| @@ -424,7 +430,7 @@ static void acpi_fujitsu_bl_notify(struct acpi_device *device, u32 event) · 3 unmodified lines | ||
| 424 | 430 | struct fujitsu_bl *priv = acpi_driver_data(device); |
| 425 | 431 | int oldb, newb; |
| 426 | 432 | |
| 427 | − if (event != ACPI_FUJITSU_NOTIFY_CODE1) { | |
| 433 | + if (event != ACPI_FUJITSU_NOTIFY_CODE) { | |
| 428 | 434 | acpi_handle_info(device->handle, "unsupported event [0x%x]\n", |
| 429 | 435 | event); |
| 430 | 436 | sparse_keymap_report_event(priv->input, -1, 1, true); |
| @@ -455,7 +461,9 @@ static const struct key_entry keymap_default[] = { · 24 unmodified lines | ||
| 455 | 461 | { KE_KEY, KEY3_CODE, { KEY_PROG3 } }, |
| 456 | 462 | { KE_KEY, KEY4_CODE, { KEY_PROG4 } }, |
| 457 | 463 | { KE_KEY, KEY5_CODE, { KEY_RFKILL } }, |
| 464 | + { KE_KEY, BIT(5), { KEY_RFKILL } }, | |
| 458 | 465 | { KE_KEY, BIT(26), { KEY_TOUCHPAD_TOGGLE } }, |
| 466 | + { KE_KEY, BIT(29), { KEY_MICMUTE } }, | |
| 459 | 467 | { KE_END, 0 } |
| 460 | 468 | }; |
| 461 | 469 | |
| @@ -693,7 +701,7 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) · 231 unmodified lines | ||
| 693 | 701 | { |
| 694 | 702 | struct fujitsu_laptop *priv = acpi_driver_data(device); |
| 695 | 703 | struct led_classdev *led; |
| 696 | − int result; | |
| 704 | + int ret; | |
| 697 | 705 | |
| 698 | 706 | if (call_fext_func(device, |
| 699 | 707 | FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) { |
| @@ -704,9 +712,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) · 4 unmodified lines | ||
| 704 | 712 | led->name = "fujitsu::logolamp"; |
| 705 | 713 | led->brightness_set_blocking = logolamp_set; |
| 706 | 714 | led->brightness_get = logolamp_get; |
| 707 | − result = devm_led_classdev_register(&device->dev, led); | |
| 708 | − if (result) | |
| 709 | − return result; | |
| 715 | + ret = devm_led_classdev_register(&device->dev, led); | |
| 716 | + if (ret) | |
| 717 | + return ret; | |
| 710 | 718 | } |
| 711 | 719 | |
| 712 | 720 | if ((call_fext_func(device, |
| @@ -719,9 +727,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) · 6 unmodified lines | ||
| 719 | 727 | led->name = "fujitsu::kblamps"; |
| 720 | 728 | led->brightness_set_blocking = kblamps_set; |
| 721 | 729 | led->brightness_get = kblamps_get; |
| 722 | − result = devm_led_classdev_register(&device->dev, led); | |
| 723 | − if (result) | |
| 724 | − return result; | |
| 730 | + ret = devm_led_classdev_register(&device->dev, led); | |
| 731 | + if (ret) | |
| 732 | + return ret; | |
| 725 | 733 | } |
| 726 | 734 | |
| 727 | 735 | /* |
| @@ -742,9 +750,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) · 14 unmodified lines | ||
| 742 | 750 | led->brightness_set_blocking = radio_led_set; |
| 743 | 751 | led->brightness_get = radio_led_get; |
| 744 | 752 | led->default_trigger = "rfkill-any"; |
| 745 | − result = devm_led_classdev_register(&device->dev, led); | |
| 746 | − if (result) | |
| 747 | − return result; | |
| 753 | + ret = devm_led_classdev_register(&device->dev, led); | |
| 754 | + if (ret) | |
| 755 | + return ret; | |
| 748 | 756 | } |
| 749 | 757 | |
| 750 | 758 | /* Support for eco led is not always signaled in bit corresponding |
| @@ -762,9 +770,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) · 11 unmodified lines | ||
| 762 | 770 | led->name = "fujitsu::eco_led"; |
| 763 | 771 | led->brightness_set_blocking = eco_led_set; |
| 764 | 772 | led->brightness_get = eco_led_get; |
| 765 | − result = devm_led_classdev_register(&device->dev, led); | |
| 766 | − if (result) | |
| 767 | − return result; | |
| 773 | + ret = devm_led_classdev_register(&device->dev, led); | |
| 774 | + if (ret) | |
| 775 | + return ret; | |
| 768 | 776 | } |
| 769 | 777 | |
| 770 | 778 | return 0; |
| @@ -773,8 +781,7 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) · 2 unmodified lines | ||
| 773 | 781 | static int acpi_fujitsu_laptop_add(struct acpi_device *device) |
| 774 | 782 | { |
| 775 | 783 | struct fujitsu_laptop *priv; |
| 776 | − int error; | |
| 777 | − int i; | |
| 784 | + int ret, i = 0; | |
| 778 | 785 | |
| 779 | 786 | priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL); |
| 780 | 787 | if (!priv) |
| @@ -789,23 +796,16 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) · 8 unmodified lines | ||
| 789 | 796 | |
| 790 | 797 | /* kfifo */ |
| 791 | 798 | spin_lock_init(&priv->fifo_lock); |
| 792 | − error = kfifo_alloc(&priv->fifo, RINGBUFFERSIZE * sizeof(int), | |
| 793 | − GFP_KERNEL); | |
| 794 | − if (error) { | |
| 795 | − pr_err("kfifo_alloc failed\n"); | |
| 796 | − goto err_stop; | |
| 797 | − } | |
| 798 | − | |
| 799 | − error = acpi_fujitsu_laptop_input_setup(device); | |
| 800 | − if (error) | |
| 801 | − goto err_free_fifo; | |
| 799 | + ret = kfifo_alloc(&priv->fifo, RINGBUFFERSIZE * sizeof(int), | |
| 800 | + GFP_KERNEL); | |
| 801 | + if (ret) | |
| 802 | + return ret; | |
| 802 | 803 | |
| 803 | 804 | pr_info("ACPI: %s [%s]\n", |
| 804 | 805 | acpi_device_name(device), acpi_device_bid(device)); |
| 805 | 806 | |
| 806 | − i = 0; | |
| 807 | − while (call_fext_func(device, FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0 | |
| 808 | − && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) | |
| 807 | + while (call_fext_func(device, FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0 && | |
| 808 | + i++ < MAX_HOTKEY_RINGBUFFER_SIZE) | |
| 809 | 809 | ; /* No action, result is discarded */ |
| 810 | 810 | acpi_handle_debug(device->handle, "Discarded %i ringbuffer entries\n", |
| 811 | 811 | i); |
| @@ -829,26 +829,31 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) · 17 unmodified lines | ||
| 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) | |
| 841 | + goto err_free_fifo; | |
| 842 | + | |
| 843 | + ret = acpi_fujitsu_laptop_leds_register(device); | |
| 844 | + if (ret) | |
| 840 | 845 | goto err_free_fifo; |
| 841 | 846 | |
| 842 | − error = fujitsu_laptop_platform_add(device); | |
| 843 | − if (error) | |
| 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) |
| @@ -865,11 +870,11 @@ static int acpi_fujitsu_laptop_remove(struct acpi_device *device) · 10 unmodified lines | ||
| 865 | 870 | static void acpi_fujitsu_laptop_press(struct acpi_device *device, int scancode) |
| 866 | 871 | { |
| 867 | 872 | struct fujitsu_laptop *priv = acpi_driver_data(device); |
| 868 | − int status; | |
| 873 | + int ret; | |
| 869 | 874 | |
| 870 | − status = kfifo_in_locked(&priv->fifo, (unsigned char *)&scancode, | |
| 871 | − sizeof(scancode), &priv->fifo_lock); | |
| 872 | − if (status != sizeof(scancode)) { | |
| 875 | + ret = kfifo_in_locked(&priv->fifo, (unsigned char *)&scancode, | |
| 876 | + sizeof(scancode), &priv->fifo_lock); | |
| 877 | + if (ret != sizeof(scancode)) { | |
| 873 | 878 | dev_info(&priv->input->dev, "Could not push scancode [0x%x]\n", |
| 874 | 879 | scancode); |
| 875 | 880 | return; |
| @@ -882,13 +887,12 @@ static void acpi_fujitsu_laptop_press(struct acpi_device *device, int scancode) · 6 unmodified lines | ||
| 882 | 887 | static void acpi_fujitsu_laptop_release(struct acpi_device *device) |
| 883 | 888 | { |
| 884 | 889 | struct fujitsu_laptop *priv = acpi_driver_data(device); |
| 885 | − int scancode, status; | |
| 890 | + int scancode, ret; | |
| 886 | 891 | |
| 887 | 892 | while (true) { |
| 888 | − status = kfifo_out_locked(&priv->fifo, | |
| 889 | − (unsigned char *)&scancode, | |
| 890 | − sizeof(scancode), &priv->fifo_lock); | |
| 891 | − if (status != sizeof(scancode)) | |
| 893 | + ret = kfifo_out_locked(&priv->fifo, (unsigned char *)&scancode, | |
| 894 | + sizeof(scancode), &priv->fifo_lock); | |
| 895 | + if (ret != sizeof(scancode)) | |
| 892 | 896 | return; |
| 893 | 897 | sparse_keymap_report_event(priv->input, scancode, 0, false); |
| 894 | 898 | dev_dbg(&priv->input->dev, |
| @@ -899,10 +903,10 @@ static void acpi_fujitsu_laptop_release(struct acpi_device *device) · 4 unmodified lines | ||
| 899 | 903 | static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 event) |
| 900 | 904 | { |
| 901 | 905 | struct fujitsu_laptop *priv = acpi_driver_data(device); |
| 902 | − int scancode, i = 0; | |
| 906 | + int scancode, i = 0, ret; | |
| 903 | 907 | unsigned int irb; |
| 904 | 908 | |
| 905 | − if (event != ACPI_FUJITSU_NOTIFY_CODE1) { | |
| 909 | + if (event != ACPI_FUJITSU_NOTIFY_CODE) { | |
| 906 | 910 | acpi_handle_info(device->handle, "Unsupported event [0x%x]\n", |
| 907 | 911 | event); |
| 908 | 912 | sparse_keymap_report_event(priv->input, -1, 1, true); |
| @@ -930,9 +934,18 @@ static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 event) · 21 unmodified lines | ||
| 930 | 934 | * E736/E746/E756), the touchpad toggle hotkey (Fn+F4) is |
| 931 | 935 | * handled in software; its state is queried using FUNC_FLAGS |
| 932 | 936 | */ |
| 933 | − if ((priv->flags_supported & BIT(26)) && | |
| 934 | − (call_fext_func(device, FUNC_FLAGS, 0x1, 0x0, 0x0) & BIT(26))) | |
| 935 | − sparse_keymap_report_event(priv->input, BIT(26), 1, true); | |
| 937 | + if (priv->flags_supported & (BIT(5) | BIT(26) | BIT(29))) { | |
| 938 | + ret = call_fext_func(device, FUNC_FLAGS, 0x1, 0x0, 0x0); | |
| 939 | + if (ret & BIT(5)) | |
| 940 | + sparse_keymap_report_event(priv->input, | |
| 941 | + BIT(5), 1, true); | |
| 942 | + if (ret & BIT(26)) | |
| 943 | + sparse_keymap_report_event(priv->input, | |
| 944 | + BIT(26), 1, true); | |
| 945 | + if (ret & BIT(29)) | |
| 946 | + sparse_keymap_report_event(priv->input, | |
| 947 | + BIT(29), 1, true); | |
| 948 | + } | |
| 936 | 949 | } |
| 937 | 950 | |
| 938 | 951 | /* Initialization */ |
| @@ -19,12 +19,12 @@ · 18 unmodified lines | ||
| 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); |
| @@ -16,16 +16,14 @@ · 15 unmodified lines | ||
| 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"); |
| @@ -67,8 +65,8 @@ static const struct key_entry intel_array_keymap[] = { · 35 unmodified lines | ||
| 67 | 65 | { KE_IGNORE, 0xC5, { KEY_VOLUMEUP } }, /* Release */ |
| 68 | 66 | { KE_KEY, 0xC6, { KEY_VOLUMEDOWN } }, /* Press */ |
| 69 | 67 | { KE_IGNORE, 0xC7, { KEY_VOLUMEDOWN } }, /* Release */ |
| 70 | − { KE_SW, 0xC8, { .sw = { SW_ROTATE_LOCK, 1 } } }, /* Press */ | |
| 71 | − { KE_SW, 0xC9, { .sw = { SW_ROTATE_LOCK, 0 } } }, /* Release */ | |
| 68 | + { KE_KEY, 0xC8, { KEY_ROTATE_LOCK_TOGGLE } }, /* Press */ | |
| 69 | + { KE_IGNORE, 0xC9, { KEY_ROTATE_LOCK_TOGGLE } }, /* Release */ | |
| 72 | 70 | { KE_KEY, 0xCE, { KEY_POWER } }, /* Press */ |
| 73 | 71 | { KE_IGNORE, 0xCF, { KEY_POWER } }, /* Release */ |
| 74 | 72 | { KE_END }, |
| @@ -138,9 +138,6 @@ static int __init itmt_legacy_init(void) · 137 unmodified lines | ||
| 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); |
| @@ -85,6 +85,15 @@ · 84 unmodified lines | ||
| 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 |
| @@ -124,7 +133,7 @@ static const struct resource mlxplat_lpc_resources[] = { · 33 unmodified lines | ||
| 124 | 133 | }; |
| 125 | 134 | |
| 126 | 135 | /* Platform default channels */ |
| 127 | −static const int mlxplat_default_channels[][8] = { | |
| 136 | +static const int mlxplat_default_channels[][MLXPLAT_CPLD_GRP_CHNL_NUM] = { | |
| 128 | 137 | { |
| 129 | 138 | MLXPLAT_CPLD_CH1, MLXPLAT_CPLD_CH1 + 1, MLXPLAT_CPLD_CH1 + 2, |
| 130 | 139 | MLXPLAT_CPLD_CH1 + 3, MLXPLAT_CPLD_CH1 + 4, MLXPLAT_CPLD_CH1 + |
| @@ -694,6 +703,8 @@ static int __init mlxplat_dmi_default_matched(const struct dmi_system_id *dmi) · 563 unmodified lines | ||
| 694 | 703 | ARRAY_SIZE(mlxplat_default_channels[i]); |
| 695 | 704 | } |
| 696 | 705 | mlxplat_hotplug = &mlxplat_mlxcpld_default_data; |
| 706 | + mlxplat_hotplug->deferred_nr = | |
| 707 | + mlxplat_default_channels[i - 1][MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; | |
| 697 | 708 | |
| 698 | 709 | return 1; |
| 699 | 710 | }; |
| @@ -708,6 +719,8 @@ static int __init mlxplat_dmi_msn21xx_matched(const struct dmi_system_id *dmi) · 8 unmodified lines | ||
| 708 | 719 | ARRAY_SIZE(mlxplat_msn21xx_channels); |
| 709 | 720 | } |
| 710 | 721 | mlxplat_hotplug = &mlxplat_mlxcpld_msn21xx_data; |
| 722 | + mlxplat_hotplug->deferred_nr = | |
| 723 | + mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; | |
| 711 | 724 | |
| 712 | 725 | return 1; |
| 713 | 726 | }; |
| @@ -722,6 +735,8 @@ static int __init mlxplat_dmi_msn274x_matched(const struct dmi_system_id *dmi) · 8 unmodified lines | ||
| 722 | 735 | ARRAY_SIZE(mlxplat_msn21xx_channels); |
| 723 | 736 | } |
| 724 | 737 | mlxplat_hotplug = &mlxplat_mlxcpld_msn274x_data; |
| 738 | + mlxplat_hotplug->deferred_nr = | |
| 739 | + mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; | |
| 725 | 740 | |
| 726 | 741 | return 1; |
| 727 | 742 | }; |
| @@ -736,6 +751,8 @@ static int __init mlxplat_dmi_msn201x_matched(const struct dmi_system_id *dmi) · 8 unmodified lines | ||
| 736 | 751 | ARRAY_SIZE(mlxplat_msn21xx_channels); |
| 737 | 752 | } |
| 738 | 753 | mlxplat_hotplug = &mlxplat_mlxcpld_msn201x_data; |
| 754 | + mlxplat_hotplug->deferred_nr = | |
| 755 | + mlxplat_default_channels[i - 1][MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; | |
| 739 | 756 | |
| 740 | 757 | return 1; |
| 741 | 758 | }; |
| @@ -750,6 +767,8 @@ static int __init mlxplat_dmi_qmb7xx_matched(const struct dmi_system_id *dmi) · 8 unmodified lines | ||
| 750 | 767 | ARRAY_SIZE(mlxplat_msn21xx_channels); |
| 751 | 768 | } |
| 752 | 769 | mlxplat_hotplug = &mlxplat_mlxcpld_default_ng_data; |
| 770 | + mlxplat_hotplug->deferred_nr = | |
| 771 | + mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; | |
| 753 | 772 | |
| 754 | 773 | return 1; |
| 755 | 774 | }; |
| @@ -830,10 +849,48 @@ static const struct dmi_system_id mlxplat_dmi_table[] __initconst = { · 74 unmodified lines | ||
| 830 | 849 | |
| 831 | 850 | MODULE_DEVICE_TABLE(dmi, mlxplat_dmi_table); |
| 832 | 851 | |
| 852 | +static int mlxplat_mlxcpld_verify_bus_topology(int *nr) | |
| 853 | +{ | |
| 854 | + struct i2c_adapter *search_adap; | |
| 855 | + int shift, i; | |
| 856 | + | |
| 857 | + /* Scan adapters from expected id to verify it is free. */ | |
| 858 | + *nr = MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR; | |
| 859 | + for (i = MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR; i < | |
| 860 | + MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM; i++) { | |
| 861 | + search_adap = i2c_get_adapter(i); | |
| 862 | + if (search_adap) { | |
| 863 | + i2c_put_adapter(search_adap); | |
| 864 | + continue; | |
| 865 | + } | |
| 866 | + | |
| 867 | + /* Return if expected parent adapter is free. */ | |
| 868 | + if (i == MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR) | |
| 869 | + return 0; | |
| 870 | + break; | |
| 871 | + } | |
| 872 | + | |
| 873 | + /* Return with error if free id for adapter is not found. */ | |
| 874 | + if (i == MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM) | |
| 875 | + return -ENODEV; | |
| 876 | + | |
| 877 | + /* Shift adapter ids, since expected parent adapter is not free. */ | |
| 878 | + *nr = i; | |
| 879 | + for (i = 0; i < ARRAY_SIZE(mlxplat_mux_data); i++) { | |
| 880 | + shift = *nr - mlxplat_mux_data[i].parent; | |
| 881 | + mlxplat_mux_data[i].parent = *nr; | |
| 882 | + mlxplat_mux_data[i].base_nr += shift; | |
| 883 | + if (shift > 0) | |
| 884 | + mlxplat_hotplug->shift_nr = shift; | |
| 885 | + } | |
| 886 | + | |
| 887 | + return 0; | |
| 888 | +} | |
| 889 | + | |
| 833 | 890 | static int __init mlxplat_init(void) |
| 834 | 891 | { |
| 835 | 892 | struct mlxplat_priv *priv; |
| 836 | − int i, err; | |
| 893 | + int i, nr, err; | |
| 837 | 894 | |
| 838 | 895 | if (!dmi_check_system(mlxplat_dmi_table)) |
| 839 | 896 | return -ENODEV; |
| @@ -853,7 +910,12 @@ static int __init mlxplat_init(void) · 13 unmodified lines | ||
| 853 | 910 | } |
| 854 | 911 | platform_set_drvdata(mlxplat_dev, priv); |
| 855 | 912 | |
| 856 | − priv->pdev_i2c = platform_device_register_simple("i2c_mlxcpld", -1, | |
| 913 | + err = mlxplat_mlxcpld_verify_bus_topology(&nr); | |
| 914 | + if (nr < 0) | |
| 915 | + goto fail_alloc; | |
| 916 | + | |
| 917 | + nr = (nr == MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM) ? -1 : nr; | |
| 918 | + priv->pdev_i2c = platform_device_register_simple("i2c_mlxcpld", nr, | |
| 857 | 919 | NULL, 0); |
| 858 | 920 | if (IS_ERR(priv->pdev_i2c)) { |
| 859 | 921 | err = PTR_ERR(priv->pdev_i2c); |
| @@ -446,6 +446,23 @@ static const struct dmi_system_id silead_ts_dmi_table[] = { · 445 unmodified lines | ||
| 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 | |
| @@ -8703,16 +8703,24 @@ static const struct attribute_group fan_attr_group = { · 8702 unmodified lines | ||
| 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 | { |
| @@ -1,14 +1,12 @@ | ||
| 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 |
| @@ -18,15 +16,93 @@ · 3 unmodified lines | ||
| 18 | 16 | #include <linux/init.h> |
| 19 | 17 | #include <linux/slab.h> |
| 20 | 18 | #include <linux/acpi.h> |
| 19 | +#include <linux/dmi.h> | |
| 21 | 20 | #include <linux/input.h> |
| 22 | 21 | #include <linux/input/sparse-keymap.h> |
| 22 | +#include <linux/leds.h> | |
| 23 | +#include <linux/platform_device.h> | |
| 23 | 24 | |
| 24 | −#define ACPI_TOPSTAR_CLASS "topstar" | |
| 25 | +#define TOPSTAR_LAPTOP_CLASS "topstar" | |
| 25 | 26 | |
| 26 | −struct topstar_hkey { | |
| 27 | − struct input_dev *inputdev; | |
| 27 | +struct topstar_laptop { | |
| 28 | + struct acpi_device *device; | |
| 29 | + struct platform_device *platform; | |
| 30 | + struct input_dev *input; | |
| 31 | + struct led_classdev led; | |
| 28 | 32 | }; |
| 29 | 33 | |
| 34 | +/* | |
| 35 | + * LED | |
| 36 | + */ | |
| 37 | + | |
| 38 | +static enum led_brightness topstar_led_get(struct led_classdev *led) | |
| 39 | +{ | |
| 40 | + return led->brightness; | |
| 41 | +} | |
| 42 | + | |
| 43 | +static int topstar_led_set(struct led_classdev *led, | |
| 44 | + enum led_brightness state) | |
| 45 | +{ | |
| 46 | + struct topstar_laptop *topstar = container_of(led, | |
| 47 | + struct topstar_laptop, led); | |
| 48 | + | |
| 49 | + struct acpi_object_list params; | |
| 50 | + union acpi_object in_obj; | |
| 51 | + unsigned long long int ret; | |
| 52 | + acpi_status status; | |
| 53 | + | |
| 54 | + params.count = 1; | |
| 55 | + params.pointer = &in_obj; | |
| 56 | + in_obj.type = ACPI_TYPE_INTEGER; | |
| 57 | + in_obj.integer.value = 0x83; | |
| 58 | + | |
| 59 | + /* | |
| 60 | + * Topstar ACPI returns 0x30001 when the LED is ON and 0x30000 when it | |
| 61 | + * is OFF. | |
| 62 | + */ | |
| 63 | + status = acpi_evaluate_integer(topstar->device->handle, | |
| 64 | + "GETX", ¶ms, &ret); | |
| 65 | + if (ACPI_FAILURE(status)) | |
| 66 | + return -1; | |
| 67 | + | |
| 68 | + /* | |
| 69 | + * FNCX(0x83) toggles the LED (more precisely, it is supposed to | |
| 70 | + * act as an hardware switch and disconnect the WLAN adapter but | |
| 71 | + * it seems to be faulty on some models like the Topstar U931 | |
| 72 | + * Notebook). | |
| 73 | + */ | |
| 74 | + if ((ret == 0x30001 && state == LED_OFF) | |
| 75 | + || (ret == 0x30000 && state != LED_OFF)) { | |
| 76 | + status = acpi_execute_simple_method(topstar->device->handle, | |
| 77 | + "FNCX", 0x83); | |
| 78 | + if (ACPI_FAILURE(status)) | |
| 79 | + return -1; | |
| 80 | + } | |
| 81 | + | |
| 82 | + return 0; | |
| 83 | +} | |
| 84 | + | |
| 85 | +static int topstar_led_init(struct topstar_laptop *topstar) | |
| 86 | +{ | |
| 87 | + topstar->led = (struct led_classdev) { | |
| 88 | + .default_trigger = "rfkill0", | |
| 89 | + .brightness_get = topstar_led_get, | |
| 90 | + .brightness_set_blocking = topstar_led_set, | |
| 91 | + .name = TOPSTAR_LAPTOP_CLASS "::wlan", | |
| 92 | + }; | |
| 93 | + | |
| 94 | + return led_classdev_register(&topstar->platform->dev, &topstar->led); | |
| 95 | +} | |
| 96 | + | |
| 97 | +static void topstar_led_exit(struct topstar_laptop *topstar) | |
| 98 | +{ | |
| 99 | + led_classdev_unregister(&topstar->led); | |
| 100 | +} | |
| 101 | + | |
| 102 | +/* | |
| 103 | + * Input | |
| 104 | + */ | |
| 105 | + | |
| 30 | 106 | static const struct key_entry topstar_keymap[] = { |
| 31 | 107 | { KE_KEY, 0x80, { KEY_BRIGHTNESSUP } }, |
| 32 | 108 | { KE_KEY, 0x81, { KEY_BRIGHTNESSDOWN } }, |
| @@ -57,107 +133,217 @@ static const struct key_entry topstar_keymap[] = { · 24 unmodified lines | ||
| 57 | 133 | { KE_END, 0 } |
| 58 | 134 | }; |
| 59 | 135 | |
| 60 | −static void acpi_topstar_notify(struct acpi_device *device, u32 event) | |
| 136 | +static void topstar_input_notify(struct topstar_laptop *topstar, int event) | |
| 61 | 137 | { |
| 62 | − static bool dup_evnt[2]; | |
| 63 | − bool *dup; | |
| 64 | − struct topstar_hkey *hkey = acpi_driver_data(device); | |
| 65 | − | |
| 66 | − /* 0x83 and 0x84 key events comes duplicated... */ | |
| 67 | − if (event == 0x83 || event == 0x84) { | |
| 68 | − dup = &dup_evnt[event - 0x83]; | |
| 69 | − if (*dup) { | |
| 70 | − *dup = false; | |
| 71 | − return; | |
| 72 | − } | |
| 73 | − *dup = true; | |
| 74 | − } | |
| 75 | − | |
| 76 | − if (!sparse_keymap_report_event(hkey->inputdev, event, 1, true)) | |
| 138 | + if (!sparse_keymap_report_event(topstar->input, event, 1, true)) | |
| 77 | 139 | pr_info("unknown event = 0x%02x\n", event); |
| 78 | 140 | } |
| 79 | 141 | |
| 80 | −static int acpi_topstar_fncx_switch(struct acpi_device *device, bool state) | |
| 81 | −{ | |
| 82 | − acpi_status status; | |
| 83 | − | |
| 84 | − status = acpi_execute_simple_method(device->handle, "FNCX", | |
| 85 | − state ? 0x86 : 0x87); | |
| 86 | − if (ACPI_FAILURE(status)) { | |
| 87 | − pr_err("Unable to switch FNCX notifications\n"); | |
| 88 | − return -ENODEV; | |
| 89 | − } | |
| 90 | − | |
| 91 | − return 0; | |
| 92 | −} | |
| 93 | − | |
| 94 | −static int acpi_topstar_init_hkey(struct topstar_hkey *hkey) | |
| 142 | +static int topstar_input_init(struct topstar_laptop *topstar) | |
| 95 | 143 | { |
| 96 | 144 | struct input_dev *input; |
| 97 | − int error; | |
| 145 | + int err; | |
| 98 | 146 | |
| 99 | 147 | input = input_allocate_device(); |
| 100 | 148 | if (!input) |
| 101 | 149 | return -ENOMEM; |
| 102 | 150 | |
| 103 | 151 | input->name = "Topstar Laptop extra buttons"; |
| 104 | − input->phys = "topstar/input0"; | |
| 152 | + input->phys = TOPSTAR_LAPTOP_CLASS "/input0"; | |
| 105 | 153 | input->id.bustype = BUS_HOST; |
| 154 | + input->dev.parent = &topstar->platform->dev; | |
| 106 | 155 | |
| 107 | − error = sparse_keymap_setup(input, topstar_keymap, NULL); | |
| 108 | − if (error) { | |
| 156 | + err = sparse_keymap_setup(input, topstar_keymap, NULL); | |
| 157 | + if (err) { | |
| 109 | 158 | pr_err("Unable to setup input device keymap\n"); |
| 110 | 159 | goto err_free_dev; |
| 111 | 160 | } |
| 112 | 161 | |
| 113 | − error = input_register_device(input); | |
| 114 | − if (error) { | |
| 162 | + err = input_register_device(input); | |
| 163 | + if (err) { | |
| 115 | 164 | pr_err("Unable to register input device\n"); |
| 116 | 165 | goto err_free_dev; |
| 117 | 166 | } |
| 118 | 167 | |
| 119 | − hkey->inputdev = input; | |
| 168 | + topstar->input = input; | |
| 120 | 169 | return 0; |
| 121 | 170 | |
| 122 | − err_free_dev: | |
| 171 | +err_free_dev: | |
| 123 | 172 | input_free_device(input); |
| 124 | − return error; | |
| 173 | + return err; | |
| 125 | 174 | } |
| 126 | 175 | |
| 127 | −static int acpi_topstar_add(struct acpi_device *device) | |
| 176 | +static void topstar_input_exit(struct topstar_laptop *topstar) | |
| 128 | 177 | { |
| 129 | − struct topstar_hkey *tps_hkey; | |
| 178 | + input_unregister_device(topstar->input); | |
| 179 | +} | |
| 130 | 180 | |
| 131 | − tps_hkey = kzalloc(sizeof(struct topstar_hkey), GFP_KERNEL); | |
| 132 | − if (!tps_hkey) | |
| 181 | +/* | |
| 182 | + * Platform | |
| 183 | + */ | |
| 184 | + | |
| 185 | +static struct platform_driver topstar_platform_driver = { | |
| 186 | + .driver = { | |
| 187 | + .name = TOPSTAR_LAPTOP_CLASS, | |
| 188 | + }, | |
| 189 | +}; | |
| 190 | + | |
| 191 | +static int topstar_platform_init(struct topstar_laptop *topstar) | |
| 192 | +{ | |
| 193 | + int err; | |
| 194 | + | |
| 195 | + topstar->platform = platform_device_alloc(TOPSTAR_LAPTOP_CLASS, -1); | |
| 196 | + if (!topstar->platform) | |
| 133 | 197 | return -ENOMEM; |
| 134 | 198 | |
| 135 | − strcpy(acpi_device_name(device), "Topstar TPSACPI"); | |
| 136 | − strcpy(acpi_device_class(device), ACPI_TOPSTAR_CLASS); | |
| 199 | + platform_set_drvdata(topstar->platform, topstar); | |
| 200 | + | |
| 201 | + err = platform_device_add(topstar->platform); | |
| 202 | + if (err) | |
| 203 | + goto err_device_put; | |
| 204 | + | |
| 205 | + return 0; | |
| 137 | 206 | |
| 138 | − if (acpi_topstar_fncx_switch(device, true)) | |
| 139 | − goto add_err; | |
| 207 | +err_device_put: | |
| 208 | + platform_device_put(topstar->platform); | |
| 209 | + return err; | |
| 210 | +} | |
| 211 | + | |
| 212 | +static void topstar_platform_exit(struct topstar_laptop *topstar) | |
| 213 | +{ | |
| 214 | + platform_device_unregister(topstar->platform); | |
| 215 | +} | |
| 216 | + | |
| 217 | +/* | |
| 218 | + * ACPI | |
| 219 | + */ | |
| 220 | + | |
| 221 | +static int topstar_acpi_fncx_switch(struct acpi_device *device, bool state) | |
| 222 | +{ | |
| 223 | + acpi_status status; | |
| 224 | + u64 arg = state ? 0x86 : 0x87; | |
| 140 | 225 | |
| 141 | − if (acpi_topstar_init_hkey(tps_hkey)) | |
| 142 | − goto add_err; | |
| 226 | + status = acpi_execute_simple_method(device->handle, "FNCX", arg); | |
| 227 | + if (ACPI_FAILURE(status)) { | |
| 228 | + pr_err("Unable to switch FNCX notifications\n"); | |
| 229 | + return -ENODEV; | |
| 230 | + } | |
| 143 | 231 | |
| 144 | − device->driver_data = tps_hkey; | |
| 145 | 232 | return 0; |
| 233 | +} | |
| 146 | 234 | |
| 147 | −add_err: | |
| 148 | − kfree(tps_hkey); | |
| 149 | − return -ENODEV; | |
| 235 | +static void topstar_acpi_notify(struct acpi_device *device, u32 event) | |
| 236 | +{ | |
| 237 | + struct topstar_laptop *topstar = acpi_driver_data(device); | |
| 238 | + static bool dup_evnt[2]; | |
| 239 | + bool *dup; | |
| 240 | + | |
| 241 | + /* 0x83 and 0x84 key events comes duplicated... */ | |
| 242 | + if (event == 0x83 || event == 0x84) { | |
| 243 | + dup = &dup_evnt[event - 0x83]; | |
| 244 | + if (*dup) { | |
| 245 | + *dup = false; | |
| 246 | + return; | |
| 247 | + } | |
| 248 | + *dup = true; | |
| 249 | + } | |
| 250 | + | |
| 251 | + topstar_input_notify(topstar, event); | |
| 150 | 252 | } |
| 151 | 253 | |
| 152 | −static int acpi_topstar_remove(struct acpi_device *device) | |
| 254 | +static int topstar_acpi_init(struct topstar_laptop *topstar) | |
| 153 | 255 | { |
| 154 | − struct topstar_hkey *tps_hkey = acpi_driver_data(device); | |
| 256 | + return topstar_acpi_fncx_switch(topstar->device, true); | |
| 257 | +} | |
| 155 | 258 | |
| 156 | − acpi_topstar_fncx_switch(device, false); | |
| 259 | +static void topstar_acpi_exit(struct topstar_laptop *topstar) | |
| 260 | +{ | |
| 261 | + topstar_acpi_fncx_switch(topstar->device, false); | |
| 262 | +} | |
| 157 | 263 | |
| 158 | − input_unregister_device(tps_hkey->inputdev); | |
| 159 | − kfree(tps_hkey); | |
| 264 | +/* | |
| 265 | + * Enable software-based WLAN LED control on systems with defective | |
| 266 | + * hardware switch. | |
| 267 | + */ | |
| 268 | +static bool led_workaround; | |
| 160 | 269 | |
| 270 | +static int dmi_led_workaround(const struct dmi_system_id *id) | |
| 271 | +{ | |
| 272 | + led_workaround = true; | |
| 273 | + return 0; | |
| 274 | +} | |
| 275 | + | |
| 276 | +static const struct dmi_system_id topstar_dmi_ids[] = { | |
| 277 | + { | |
| 278 | + .callback = dmi_led_workaround, | |
| 279 | + .ident = "Topstar U931/RVP7", | |
| 280 | + .matches = { | |
| 281 | + DMI_MATCH(DMI_BOARD_NAME, "U931"), | |
| 282 | + DMI_MATCH(DMI_BOARD_VERSION, "RVP7"), | |
| 283 | + }, | |
| 284 | + }, | |
| 285 | + {} | |
| 286 | +}; | |
| 287 | + | |
| 288 | +static int topstar_acpi_add(struct acpi_device *device) | |
| 289 | +{ | |
| 290 | + struct topstar_laptop *topstar; | |
| 291 | + int err; | |
| 292 | + | |
| 293 | + dmi_check_system(topstar_dmi_ids); | |
| 294 | + | |
| 295 | + topstar = kzalloc(sizeof(struct topstar_laptop), GFP_KERNEL); | |
| 296 | + if (!topstar) | |
| 297 | + return -ENOMEM; | |
| 298 | + | |
| 299 | + strcpy(acpi_device_name(device), "Topstar TPSACPI"); | |
| 300 | + strcpy(acpi_device_class(device), TOPSTAR_LAPTOP_CLASS); | |
| 301 | + device->driver_data = topstar; | |
| 302 | + topstar->device = device; | |
| 303 | + | |
| 304 | + err = topstar_acpi_init(topstar); | |
| 305 | + if (err) | |
| 306 | + goto err_free; | |
| 307 | + | |
| 308 | + err = topstar_platform_init(topstar); | |
| 309 | + if (err) | |
| 310 | + goto err_acpi_exit; | |
| 311 | + | |
| 312 | + err = topstar_input_init(topstar); | |
| 313 | + if (err) | |
| 314 | + goto err_platform_exit; | |
| 315 | + | |
| 316 | + if (led_workaround) { | |
| 317 | + err = topstar_led_init(topstar); | |
| 318 | + if (err) | |
| 319 | + goto err_input_exit; | |
| 320 | + } | |
| 321 | + | |
| 322 | + return 0; | |
| 323 | + | |
| 324 | +err_input_exit: | |
| 325 | + topstar_input_exit(topstar); | |
| 326 | +err_platform_exit: | |
| 327 | + topstar_platform_exit(topstar); | |
| 328 | +err_acpi_exit: | |
| 329 | + topstar_acpi_exit(topstar); | |
| 330 | +err_free: | |
| 331 | + kfree(topstar); | |
| 332 | + return err; | |
| 333 | +} | |
| 334 | + | |
| 335 | +static int topstar_acpi_remove(struct acpi_device *device) | |
| 336 | +{ | |
| 337 | + struct topstar_laptop *topstar = acpi_driver_data(device); | |
| 338 | + | |
| 339 | + if (led_workaround) | |
| 340 | + topstar_led_exit(topstar); | |
| 341 | + | |
| 342 | + topstar_input_exit(topstar); | |
| 343 | + topstar_platform_exit(topstar); | |
| 344 | + topstar_acpi_exit(topstar); | |
| 345 | + | |
| 346 | + kfree(topstar); | |
| 161 | 347 | return 0; |
| 162 | 348 | } |
| 163 | 349 | |
| @@ -168,18 +354,47 @@ static const struct acpi_device_id topstar_device_ids[] = { · 4 unmodified lines | ||
| 168 | 354 | }; |
| 169 | 355 | MODULE_DEVICE_TABLE(acpi, topstar_device_ids); |
| 170 | 356 | |
| 171 | −static struct acpi_driver acpi_topstar_driver = { | |
| 357 | +static struct acpi_driver topstar_acpi_driver = { | |
| 172 | 358 | .name = "Topstar laptop ACPI driver", |
| 173 | − .class = ACPI_TOPSTAR_CLASS, | |
| 359 | + .class = TOPSTAR_LAPTOP_CLASS, | |
| 174 | 360 | .ids = topstar_device_ids, |
| 175 | 361 | .ops = { |
| 176 | − .add = acpi_topstar_add, | |
| 177 | − .remove = acpi_topstar_remove, | |
| 178 | − .notify = acpi_topstar_notify, | |
| 362 | + .add = topstar_acpi_add, | |
| 363 | + .remove = topstar_acpi_remove, | |
| 364 | + .notify = topstar_acpi_notify, | |
| 179 | 365 | }, |
| 180 | 366 | }; |
| 181 | −module_acpi_driver(acpi_topstar_driver); | |
| 367 | + | |
| 368 | +static int __init topstar_laptop_init(void) | |
| 369 | +{ | |
| 370 | + int ret; | |
| 371 | + | |
| 372 | + ret = platform_driver_register(&topstar_platform_driver); | |
| 373 | + if (ret < 0) | |
| 374 | + return ret; | |
| 375 | + | |
| 376 | + ret = acpi_bus_register_driver(&topstar_acpi_driver); | |
| 377 | + if (ret < 0) | |
| 378 | + goto err_driver_unreg; | |
| 379 | + | |
| 380 | + pr_info("ACPI extras driver loaded\n"); | |
| 381 | + return 0; | |
| 382 | + | |
| 383 | +err_driver_unreg: | |
| 384 | + platform_driver_unregister(&topstar_platform_driver); | |
| 385 | + return ret; | |
| 386 | +} | |
| 387 | + | |
| 388 | +static void __exit topstar_laptop_exit(void) | |
| 389 | +{ | |
| 390 | + acpi_bus_unregister_driver(&topstar_acpi_driver); | |
| 391 | + platform_driver_unregister(&topstar_platform_driver); | |
| 392 | +} | |
| 393 | + | |
| 394 | +module_init(topstar_laptop_init); | |
| 395 | +module_exit(topstar_laptop_exit); | |
| 182 | 396 | |
| 183 | 397 | MODULE_AUTHOR("Herton Ronaldo Krzesinski"); |
| 398 | +MODULE_AUTHOR("Guillaume Douézan-Grard"); | |
| 184 | 399 | MODULE_DESCRIPTION("Topstar Laptop ACPI Extras driver"); |
| 185 | 400 | MODULE_LICENSE("GPL"); |
| @@ -130,13 +130,11 @@ static bool find_guid(const char *guid_string, struct wmi_block **out) · 129 unmodified lines | ||
| 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) { |
| @@ -519,7 +517,6 @@ wmi_notify_handler handler, void *data) · 376 unmodified lines | ||
| 519 | 517 | struct wmi_block *block; |
| 520 | 518 | acpi_status status = AE_NOT_EXIST; |
| 521 | 519 | uuid_le guid_input; |
| 522 | − struct list_head *p; | |
| 523 | 520 | |
| 524 | 521 | if (!guid || !handler) |
| 525 | 522 | return AE_BAD_PARAMETER; |
| @@ -527,9 +524,8 @@ wmi_notify_handler handler, void *data) · 1 unmodified line | ||
| 527 | 524 | if (uuid_le_to_bin(guid, &guid_input)) |
| 528 | 525 | return AE_BAD_PARAMETER; |
| 529 | 526 | |
| 530 | − list_for_each(p, &wmi_block_list) { | |
| 527 | + list_for_each_entry(block, &wmi_block_list, list) { | |
| 531 | 528 | acpi_status wmi_status; |
| 532 | − block = list_entry(p, struct wmi_block, list); | |
| 533 | 529 | |
| 534 | 530 | if (memcmp(block->gblock.guid, &guid_input, 16) == 0) { |
| 535 | 531 | if (block->handler && |
| @@ -560,7 +556,6 @@ acpi_status wmi_remove_notify_handler(const char *guid) · 24 unmodified lines | ||
| 560 | 556 | struct wmi_block *block; |
| 561 | 557 | acpi_status status = AE_NOT_EXIST; |
| 562 | 558 | uuid_le guid_input; |
| 563 | − struct list_head *p; | |
| 564 | 559 | |
| 565 | 560 | if (!guid) |
| 566 | 561 | return AE_BAD_PARAMETER; |
| @@ -568,9 +563,8 @@ acpi_status wmi_remove_notify_handler(const char *guid) · 1 unmodified line | ||
| 568 | 563 | if (uuid_le_to_bin(guid, &guid_input)) |
| 569 | 564 | return AE_BAD_PARAMETER; |
| 570 | 565 | |
| 571 | − list_for_each(p, &wmi_block_list) { | |
| 566 | + list_for_each_entry(block, &wmi_block_list, list) { | |
| 572 | 567 | acpi_status wmi_status; |
| 573 | − block = list_entry(p, struct wmi_block, list); | |
| 574 | 568 | |
| 575 | 569 | if (memcmp(block->gblock.guid, &guid_input, 16) == 0) { |
| 576 | 570 | if (!block->handler || |
| @@ -610,15 +604,13 @@ acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out) · 33 unmodified lines | ||
| 610 | 604 | union acpi_object params[1]; |
| 611 | 605 | struct guid_block *gblock; |
| 612 | 606 | struct wmi_block *wblock; |
| 613 | − struct list_head *p; | |
| 614 | 607 | |
| 615 | 608 | input.count = 1; |
| 616 | 609 | input.pointer = params; |
| 617 | 610 | params[0].type = ACPI_TYPE_INTEGER; |
| 618 | 611 | params[0].integer.value = event; |
| 619 | 612 | |
| 620 | − list_for_each(p, &wmi_block_list) { | |
| 621 | − wblock = list_entry(p, struct wmi_block, list); | |
| 613 | + list_for_each_entry(wblock, &wmi_block_list, list) { | |
| 622 | 614 | gblock = &wblock->gblock; |
| 623 | 615 | |
| 624 | 616 | if ((gblock->flags & ACPI_WMI_EVENT) && |
| @@ -933,12 +925,11 @@ static int wmi_dev_probe(struct device *dev) · 308 unmodified lines | ||
| 933 | 925 | goto probe_failure; |
| 934 | 926 | } |
| 935 | 927 | |
| 936 | − buf = kmalloc(strlen(wdriver->driver.name) + 5, GFP_KERNEL); | |
| 928 | + buf = kasprintf(GFP_KERNEL, "wmi/%s", wdriver->driver.name); | |
| 937 | 929 | if (!buf) { |
| 938 | 930 | ret = -ENOMEM; |
| 939 | 931 | goto probe_string_failure; |
| 940 | 932 | } |
| 941 | − sprintf(buf, "wmi/%s", wdriver->driver.name); | |
| 942 | 933 | wblock->char_dev.minor = MISC_DYNAMIC_MINOR; |
| 943 | 934 | wblock->char_dev.name = buf; |
| 944 | 935 | wblock->char_dev.fops = &wmi_fops; |
| @@ -1261,11 +1252,9 @@ static void acpi_wmi_notify_handler(acpi_handle handle, u32 event, · 316 unmodified lines | ||
| 1261 | 1252 | { |
| 1262 | 1253 | struct guid_block *block; |
| 1263 | 1254 | struct wmi_block *wblock; |
| 1264 | − struct list_head *p; | |
| 1265 | 1255 | bool found_it = false; |
| 1266 | 1256 | |
| 1267 | − list_for_each(p, &wmi_block_list) { | |
| 1268 | − wblock = list_entry(p, struct wmi_block, list); | |
| 1257 | + list_for_each_entry(wblock, &wmi_block_list, list) { | |
| 1269 | 1258 | block = &wblock->gblock; |
| 1270 | 1259 | |
| 1271 | 1260 | if (wblock->acpi_device->handle == handle && |
| @@ -129,6 +129,8 @@ struct mlxreg_core_platform_data { · 128 unmodified lines | ||
| 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; |
| @@ -139,6 +141,8 @@ struct mlxreg_core_hotplug_platform_data { · 4 unmodified lines | ||
| 139 | 141 | u32 mask; |
| 140 | 142 | u32 cell_low; |
| 141 | 143 | u32 mask_low; |
| 144 | + int deferred_nr; | |
| 145 | + int shift_nr; | |
| 142 | 146 | }; |
| 143 | 147 | |
| 144 | 148 | #endif /* __LINUX_PLATFORM_DATA_MLXREG_H */ |