diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-10 15:18:50 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-10 15:18:50 -0400 |
| commit | a7726f6b61e8917e73101bb8071facdff7ec5d72 (patch) | |
| tree | 8c0e0635a0a279fa3bad3e7ea393c38b3b73b5ce | |
| parent | 1b02dcb9fa530614151d5713684a626a3c93e054 (diff) | |
| parent | a986c75a7df027d2c649a8f087be9417372cbfb3 (diff) | |
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
...
| -rw-r--r-- | drivers/platform/mellanox/mlxreg-hotplug.c | 31 | ||||
| -rw-r--r-- | drivers/platform/x86/Kconfig | 3 | ||||
| -rw-r--r-- | drivers/platform/x86/dell-smbios-base.c | 4 | ||||
| -rw-r--r-- | drivers/platform/x86/fujitsu-laptop.c | 199 | ||||
| -rw-r--r-- | drivers/platform/x86/gpd-pocket-fan.c | 4 | ||||
| -rw-r--r-- | drivers/platform/x86/intel-hid.c | 14 | ||||
| -rw-r--r-- | drivers/platform/x86/intel_turbo_max_3.c | 3 | ||||
| -rw-r--r-- | drivers/platform/x86/mlx-platform.c | 68 | ||||
| -rw-r--r-- | drivers/platform/x86/silead_dmi.c | 17 | ||||
| -rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 8 | ||||
| -rw-r--r-- | drivers/platform/x86/topstar-laptop.c | 363 | ||||
| -rw-r--r-- | drivers/platform/x86/wmi.c | 23 | ||||
| -rw-r--r-- | include/linux/platform_data/mlxreg.h | 4 |
13 files changed, 529 insertions, 212 deletions
diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c b/drivers/platform/mellanox/mlxreg-hotplug.c index 313cf8ad77bf..ea9e7f4479ca 100644 --- a/drivers/platform/mellanox/mlxreg-hotplug.c +++ b/drivers/platform/mellanox/mlxreg-hotplug.c | |||
| @@ -93,9 +93,11 @@ struct mlxreg_hotplug_priv_data { | |||
| 93 | bool after_probe; | 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 | struct mlxreg_core_data *data) | 97 | struct mlxreg_core_data *data) |
| 98 | { | 98 | { |
| 99 | struct mlxreg_core_hotplug_platform_data *pdata; | ||
| 100 | |||
| 99 | /* | 101 | /* |
| 100 | * Return if adapter number is negative. It could be in case hotplug | 102 | * Return if adapter number is negative. It could be in case hotplug |
| 101 | * event is not associated with hotplug device. | 103 | * event is not associated with hotplug device. |
| @@ -103,19 +105,21 @@ static int mlxreg_hotplug_device_create(struct device *dev, | |||
| 103 | if (data->hpdev.nr < 0) | 105 | if (data->hpdev.nr < 0) |
| 104 | return 0; | 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 | if (!data->hpdev.adapter) { | 111 | if (!data->hpdev.adapter) { |
| 108 | dev_err(dev, "Failed to get adapter for bus %d\n", | 112 | dev_err(priv->dev, "Failed to get adapter for bus %d\n", |
| 109 | data->hpdev.nr); | 113 | data->hpdev.nr + pdata->shift_nr); |
| 110 | return -EFAULT; | 114 | return -EFAULT; |
| 111 | } | 115 | } |
| 112 | 116 | ||
| 113 | data->hpdev.client = i2c_new_device(data->hpdev.adapter, | 117 | data->hpdev.client = i2c_new_device(data->hpdev.adapter, |
| 114 | data->hpdev.brdinfo); | 118 | data->hpdev.brdinfo); |
| 115 | if (!data->hpdev.client) { | 119 | if (!data->hpdev.client) { |
| 116 | dev_err(dev, "Failed to create client %s at bus %d at addr 0x%02x\n", | 120 | dev_err(priv->dev, "Failed to create client %s at bus %d at addr 0x%02x\n", |
| 117 | data->hpdev.brdinfo->type, data->hpdev.nr, | 121 | data->hpdev.brdinfo->type, data->hpdev.nr + |
| 118 | data->hpdev.brdinfo->addr); | 122 | pdata->shift_nr, data->hpdev.brdinfo->addr); |
| 119 | 123 | ||
| 120 | i2c_put_adapter(data->hpdev.adapter); | 124 | i2c_put_adapter(data->hpdev.adapter); |
| 121 | data->hpdev.adapter = NULL; | 125 | data->hpdev.adapter = NULL; |
| @@ -270,10 +274,10 @@ mlxreg_hotplug_work_helper(struct mlxreg_hotplug_priv_data *priv, | |||
| 270 | if (item->inversed) | 274 | if (item->inversed) |
| 271 | mlxreg_hotplug_device_destroy(data); | 275 | mlxreg_hotplug_device_destroy(data); |
| 272 | else | 276 | else |
| 273 | mlxreg_hotplug_device_create(priv->dev, data); | 277 | mlxreg_hotplug_device_create(priv, data); |
| 274 | } else { | 278 | } else { |
| 275 | if (item->inversed) | 279 | if (item->inversed) |
| 276 | mlxreg_hotplug_device_create(priv->dev, data); | 280 | mlxreg_hotplug_device_create(priv, data); |
| 277 | else | 281 | else |
| 278 | mlxreg_hotplug_device_destroy(data); | 282 | mlxreg_hotplug_device_destroy(data); |
| 279 | } | 283 | } |
| @@ -319,7 +323,7 @@ mlxreg_hotplug_health_work_helper(struct mlxreg_hotplug_priv_data *priv, | |||
| 319 | if (regval == MLXREG_HOTPLUG_HEALTH_MASK) { | 323 | if (regval == MLXREG_HOTPLUG_HEALTH_MASK) { |
| 320 | if ((data->health_cntr++ == MLXREG_HOTPLUG_RST_CNTR) || | 324 | if ((data->health_cntr++ == MLXREG_HOTPLUG_RST_CNTR) || |
| 321 | !priv->after_probe) { | 325 | !priv->after_probe) { |
| 322 | mlxreg_hotplug_device_create(priv->dev, data); | 326 | mlxreg_hotplug_device_create(priv, data); |
| 323 | data->attached = true; | 327 | data->attached = true; |
| 324 | } | 328 | } |
| 325 | } else { | 329 | } else { |
| @@ -550,6 +554,7 @@ static int mlxreg_hotplug_probe(struct platform_device *pdev) | |||
| 550 | { | 554 | { |
| 551 | struct mlxreg_core_hotplug_platform_data *pdata; | 555 | struct mlxreg_core_hotplug_platform_data *pdata; |
| 552 | struct mlxreg_hotplug_priv_data *priv; | 556 | struct mlxreg_hotplug_priv_data *priv; |
| 557 | struct i2c_adapter *deferred_adap; | ||
| 553 | int err; | 558 | int err; |
| 554 | 559 | ||
| 555 | pdata = dev_get_platdata(&pdev->dev); | 560 | pdata = dev_get_platdata(&pdev->dev); |
| @@ -558,6 +563,12 @@ static int mlxreg_hotplug_probe(struct platform_device *pdev) | |||
| 558 | return -EINVAL; | 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 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); | 572 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |
| 562 | if (!priv) | 573 | if (!priv) |
| 563 | return -ENOMEM; | 574 | return -ENOMEM; |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index ef016e46544a..39d06dd1f63a 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
| @@ -757,6 +757,8 @@ config TOPSTAR_LAPTOP | |||
| 757 | depends on ACPI | 757 | depends on ACPI |
| 758 | depends on INPUT | 758 | depends on INPUT |
| 759 | select INPUT_SPARSEKMAP | 759 | select INPUT_SPARSEKMAP |
| 760 | select LEDS_CLASS | ||
| 761 | select NEW_LEDS | ||
| 760 | ---help--- | 762 | ---help--- |
| 761 | This driver adds support for hotkeys found on Topstar laptops. | 763 | This driver adds support for hotkeys found on Topstar laptops. |
| 762 | 764 | ||
| @@ -1174,6 +1176,7 @@ config INTEL_TELEMETRY | |||
| 1174 | 1176 | ||
| 1175 | config MLX_PLATFORM | 1177 | config MLX_PLATFORM |
| 1176 | tristate "Mellanox Technologies platform support" | 1178 | tristate "Mellanox Technologies platform support" |
| 1179 | depends on I2C && REGMAP | ||
| 1177 | ---help--- | 1180 | ---help--- |
| 1178 | This option enables system support for the Mellanox Technologies | 1181 | This option enables system support for the Mellanox Technologies |
| 1179 | platform. The Mellanox systems provide data center networking | 1182 | platform. The Mellanox systems provide data center networking |
diff --git a/drivers/platform/x86/dell-smbios-base.c b/drivers/platform/x86/dell-smbios-base.c index 2485c80a9fdd..33fb2a20458a 100644 --- a/drivers/platform/x86/dell-smbios-base.c +++ b/drivers/platform/x86/dell-smbios-base.c | |||
| @@ -514,7 +514,7 @@ static int build_tokens_sysfs(struct platform_device *dev) | |||
| 514 | continue; | 514 | continue; |
| 515 | 515 | ||
| 516 | loop_fail_create_value: | 516 | loop_fail_create_value: |
| 517 | kfree(value_name); | 517 | kfree(location_name); |
| 518 | goto out_unwind_strings; | 518 | goto out_unwind_strings; |
| 519 | } | 519 | } |
| 520 | smbios_attribute_group.attrs = token_attrs; | 520 | smbios_attribute_group.attrs = token_attrs; |
| @@ -525,7 +525,7 @@ loop_fail_create_value: | |||
| 525 | return 0; | 525 | return 0; |
| 526 | 526 | ||
| 527 | out_unwind_strings: | 527 | out_unwind_strings: |
| 528 | for (i = i-1; i > 0; i--) { | 528 | while (i--) { |
| 529 | kfree(token_location_attrs[i].attr.name); | 529 | kfree(token_location_attrs[i].attr.name); |
| 530 | kfree(token_value_attrs[i].attr.name); | 530 | kfree(token_value_attrs[i].attr.name); |
| 531 | } | 531 | } |
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 2cfbd3fa5136..cd95b6f3a064 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c | |||
| @@ -53,6 +53,7 @@ | |||
| 53 | #include <linux/kernel.h> | 53 | #include <linux/kernel.h> |
| 54 | #include <linux/init.h> | 54 | #include <linux/init.h> |
| 55 | #include <linux/acpi.h> | 55 | #include <linux/acpi.h> |
| 56 | #include <linux/bitops.h> | ||
| 56 | #include <linux/dmi.h> | 57 | #include <linux/dmi.h> |
| 57 | #include <linux/backlight.h> | 58 | #include <linux/backlight.h> |
| 58 | #include <linux/fb.h> | 59 | #include <linux/fb.h> |
| @@ -61,12 +62,11 @@ | |||
| 61 | #include <linux/kfifo.h> | 62 | #include <linux/kfifo.h> |
| 62 | #include <linux/leds.h> | 63 | #include <linux/leds.h> |
| 63 | #include <linux/platform_device.h> | 64 | #include <linux/platform_device.h> |
| 64 | #include <linux/slab.h> | ||
| 65 | #include <acpi/video.h> | 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 | #define ACPI_FUJITSU_CLASS "fujitsu" | 71 | #define ACPI_FUJITSU_CLASS "fujitsu" |
| 72 | #define ACPI_FUJITSU_BL_HID "FUJ02B1" | 72 | #define ACPI_FUJITSU_BL_HID "FUJ02B1" |
| @@ -76,41 +76,51 @@ | |||
| 76 | #define ACPI_FUJITSU_LAPTOP_DRIVER_NAME "Fujitsu laptop FUJ02E3 ACPI hotkeys driver" | 76 | #define ACPI_FUJITSU_LAPTOP_DRIVER_NAME "Fujitsu laptop FUJ02E3 ACPI hotkeys driver" |
| 77 | #define ACPI_FUJITSU_LAPTOP_DEVICE_NAME "Fujitsu FUJ02E3" | 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 | /* FUNC interface - command values */ | 81 | /* FUNC interface - command values */ |
| 82 | #define FUNC_FLAGS 0x1000 | 82 | #define FUNC_FLAGS BIT(12) |
| 83 | #define FUNC_LEDS 0x1001 | 83 | #define FUNC_LEDS (BIT(12) | BIT(0)) |
| 84 | #define FUNC_BUTTONS 0x1002 | 84 | #define FUNC_BUTTONS (BIT(12) | BIT(1)) |
| 85 | #define FUNC_BACKLIGHT 0x1004 | 85 | #define FUNC_BACKLIGHT (BIT(12) | BIT(2)) |
| 86 | 86 | ||
| 87 | /* FUNC interface - responses */ | 87 | /* FUNC interface - responses */ |
| 88 | #define UNSUPPORTED_CMD 0x80000000 | 88 | #define UNSUPPORTED_CMD 0x80000000 |
| 89 | 89 | ||
| 90 | /* FUNC interface - status flags */ | 90 | /* FUNC interface - status flags */ |
| 91 | #define FLAG_RFKILL 0x020 | 91 | #define FLAG_RFKILL BIT(5) |
| 92 | #define FLAG_LID 0x100 | 92 | #define FLAG_LID BIT(8) |
| 93 | #define FLAG_DOCK 0x200 | 93 | #define FLAG_DOCK BIT(9) |
| 94 | 94 | ||
| 95 | /* FUNC interface - LED control */ | 95 | /* FUNC interface - LED control */ |
| 96 | #define FUNC_LED_OFF 0x1 | 96 | #define FUNC_LED_OFF BIT(0) |
| 97 | #define FUNC_LED_ON 0x30001 | 97 | #define FUNC_LED_ON (BIT(0) | BIT(16) | BIT(17)) |
| 98 | #define KEYBOARD_LAMPS 0x100 | 98 | #define LOGOLAMP_POWERON BIT(13) |
| 99 | #define LOGOLAMP_POWERON 0x2000 | 99 | #define LOGOLAMP_ALWAYS BIT(14) |
| 100 | #define LOGOLAMP_ALWAYS 0x4000 | 100 | #define KEYBOARD_LAMPS BIT(8) |
| 101 | #define RADIO_LED_ON 0x20 | 101 | #define RADIO_LED_ON BIT(5) |
| 102 | #define ECO_LED 0x10000 | 102 | #define ECO_LED BIT(16) |
| 103 | #define ECO_LED_ON 0x80000 | 103 | #define ECO_LED_ON BIT(19) |
| 104 | 104 | ||
| 105 | /* Hotkey details */ | 105 | /* FUNC interface - backlight power control */ |
| 106 | #define KEY1_CODE 0x410 /* codes for the keys in the GIRB register */ | 106 | #define BACKLIGHT_PARAM_POWER BIT(2) |
| 107 | #define KEY2_CODE 0x411 | 107 | #define BACKLIGHT_OFF (BIT(0) | BIT(1)) |
| 108 | #define KEY3_CODE 0x412 | 108 | #define BACKLIGHT_ON 0 |
| 109 | #define KEY4_CODE 0x413 | 109 | |
| 110 | #define KEY5_CODE 0x420 | 110 | /* Scancodes read from the GIRB register */ |
| 111 | 111 | #define KEY1_CODE 0x410 | |
| 112 | #define MAX_HOTKEY_RINGBUFFER_SIZE 100 | 112 | #define KEY2_CODE 0x411 |
| 113 | #define RINGBUFFERSIZE 40 | 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 | /* Device controlling the backlight and associated keys */ | 125 | /* Device controlling the backlight and associated keys */ |
| 116 | struct fujitsu_bl { | 126 | struct fujitsu_bl { |
| @@ -122,8 +132,6 @@ struct fujitsu_bl { | |||
| 122 | }; | 132 | }; |
| 123 | 133 | ||
| 124 | static struct fujitsu_bl *fujitsu_bl; | 134 | static struct fujitsu_bl *fujitsu_bl; |
| 125 | static int use_alt_lcd_levels = -1; | ||
| 126 | static bool disable_brightness_adjust; | ||
| 127 | 135 | ||
| 128 | /* Device used to access hotkeys and other features on the laptop */ | 136 | /* Device used to access hotkeys and other features on the laptop */ |
| 129 | struct fujitsu_laptop { | 137 | struct fujitsu_laptop { |
| @@ -256,9 +264,11 @@ static int bl_update_status(struct backlight_device *b) | |||
| 256 | 264 | ||
| 257 | if (fext) { | 265 | if (fext) { |
| 258 | if (b->props.power == FB_BLANK_POWERDOWN) | 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 | else | 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 | return set_lcd_level(device, b->props.brightness); | 274 | return set_lcd_level(device, b->props.brightness); |
| @@ -385,7 +395,7 @@ static int fujitsu_backlight_register(struct acpi_device *device) | |||
| 385 | static int acpi_fujitsu_bl_add(struct acpi_device *device) | 395 | static int acpi_fujitsu_bl_add(struct acpi_device *device) |
| 386 | { | 396 | { |
| 387 | struct fujitsu_bl *priv; | 397 | struct fujitsu_bl *priv; |
| 388 | int error; | 398 | int ret; |
| 389 | 399 | ||
| 390 | if (acpi_video_get_backlight_type() != acpi_backlight_vendor) | 400 | if (acpi_video_get_backlight_type() != acpi_backlight_vendor) |
| 391 | return -ENODEV; | 401 | return -ENODEV; |
| @@ -399,10 +409,6 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device) | |||
| 399 | strcpy(acpi_device_class(device), ACPI_FUJITSU_CLASS); | 409 | strcpy(acpi_device_class(device), ACPI_FUJITSU_CLASS); |
| 400 | device->driver_data = priv; | 410 | device->driver_data = priv; |
| 401 | 411 | ||
| 402 | error = acpi_fujitsu_bl_input_setup(device); | ||
| 403 | if (error) | ||
| 404 | return error; | ||
| 405 | |||
| 406 | pr_info("ACPI: %s [%s]\n", | 412 | pr_info("ACPI: %s [%s]\n", |
| 407 | acpi_device_name(device), acpi_device_bid(device)); | 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) | |||
| 410 | priv->max_brightness = FUJITSU_LCD_N_LEVELS; | 416 | priv->max_brightness = FUJITSU_LCD_N_LEVELS; |
| 411 | get_lcd_level(device); | 417 | get_lcd_level(device); |
| 412 | 418 | ||
| 413 | error = fujitsu_backlight_register(device); | 419 | ret = acpi_fujitsu_bl_input_setup(device); |
| 414 | if (error) | 420 | if (ret) |
| 415 | return error; | 421 | return ret; |
| 416 | 422 | ||
| 417 | return 0; | 423 | return fujitsu_backlight_register(device); |
| 418 | } | 424 | } |
| 419 | 425 | ||
| 420 | /* Brightness notify */ | 426 | /* Brightness notify */ |
| @@ -424,7 +430,7 @@ static void acpi_fujitsu_bl_notify(struct acpi_device *device, u32 event) | |||
| 424 | struct fujitsu_bl *priv = acpi_driver_data(device); | 430 | struct fujitsu_bl *priv = acpi_driver_data(device); |
| 425 | int oldb, newb; | 431 | int oldb, newb; |
| 426 | 432 | ||
| 427 | if (event != ACPI_FUJITSU_NOTIFY_CODE1) { | 433 | if (event != ACPI_FUJITSU_NOTIFY_CODE) { |
| 428 | acpi_handle_info(device->handle, "unsupported event [0x%x]\n", | 434 | acpi_handle_info(device->handle, "unsupported event [0x%x]\n", |
| 429 | event); | 435 | event); |
| 430 | sparse_keymap_report_event(priv->input, -1, 1, true); | 436 | sparse_keymap_report_event(priv->input, -1, 1, true); |
| @@ -455,7 +461,9 @@ static const struct key_entry keymap_default[] = { | |||
| 455 | { KE_KEY, KEY3_CODE, { KEY_PROG3 } }, | 461 | { KE_KEY, KEY3_CODE, { KEY_PROG3 } }, |
| 456 | { KE_KEY, KEY4_CODE, { KEY_PROG4 } }, | 462 | { KE_KEY, KEY4_CODE, { KEY_PROG4 } }, |
| 457 | { KE_KEY, KEY5_CODE, { KEY_RFKILL } }, | 463 | { KE_KEY, KEY5_CODE, { KEY_RFKILL } }, |
| 464 | { KE_KEY, BIT(5), { KEY_RFKILL } }, | ||
| 458 | { KE_KEY, BIT(26), { KEY_TOUCHPAD_TOGGLE } }, | 465 | { KE_KEY, BIT(26), { KEY_TOUCHPAD_TOGGLE } }, |
| 466 | { KE_KEY, BIT(29), { KEY_MICMUTE } }, | ||
| 459 | { KE_END, 0 } | 467 | { KE_END, 0 } |
| 460 | }; | 468 | }; |
| 461 | 469 | ||
| @@ -693,7 +701,7 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) | |||
| 693 | { | 701 | { |
| 694 | struct fujitsu_laptop *priv = acpi_driver_data(device); | 702 | struct fujitsu_laptop *priv = acpi_driver_data(device); |
| 695 | struct led_classdev *led; | 703 | struct led_classdev *led; |
| 696 | int result; | 704 | int ret; |
| 697 | 705 | ||
| 698 | if (call_fext_func(device, | 706 | if (call_fext_func(device, |
| 699 | FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) { | 707 | FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) { |
| @@ -704,9 +712,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) | |||
| 704 | led->name = "fujitsu::logolamp"; | 712 | led->name = "fujitsu::logolamp"; |
| 705 | led->brightness_set_blocking = logolamp_set; | 713 | led->brightness_set_blocking = logolamp_set; |
| 706 | led->brightness_get = logolamp_get; | 714 | led->brightness_get = logolamp_get; |
| 707 | result = devm_led_classdev_register(&device->dev, led); | 715 | ret = devm_led_classdev_register(&device->dev, led); |
| 708 | if (result) | 716 | if (ret) |
| 709 | return result; | 717 | return ret; |
| 710 | } | 718 | } |
| 711 | 719 | ||
| 712 | if ((call_fext_func(device, | 720 | if ((call_fext_func(device, |
| @@ -719,9 +727,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) | |||
| 719 | led->name = "fujitsu::kblamps"; | 727 | led->name = "fujitsu::kblamps"; |
| 720 | led->brightness_set_blocking = kblamps_set; | 728 | led->brightness_set_blocking = kblamps_set; |
| 721 | led->brightness_get = kblamps_get; | 729 | led->brightness_get = kblamps_get; |
| 722 | result = devm_led_classdev_register(&device->dev, led); | 730 | ret = devm_led_classdev_register(&device->dev, led); |
| 723 | if (result) | 731 | if (ret) |
| 724 | return result; | 732 | return ret; |
| 725 | } | 733 | } |
| 726 | 734 | ||
| 727 | /* | 735 | /* |
| @@ -742,9 +750,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) | |||
| 742 | led->brightness_set_blocking = radio_led_set; | 750 | led->brightness_set_blocking = radio_led_set; |
| 743 | led->brightness_get = radio_led_get; | 751 | led->brightness_get = radio_led_get; |
| 744 | led->default_trigger = "rfkill-any"; | 752 | led->default_trigger = "rfkill-any"; |
| 745 | result = devm_led_classdev_register(&device->dev, led); | 753 | ret = devm_led_classdev_register(&device->dev, led); |
| 746 | if (result) | 754 | if (ret) |
| 747 | return result; | 755 | return ret; |
| 748 | } | 756 | } |
| 749 | 757 | ||
| 750 | /* Support for eco led is not always signaled in bit corresponding | 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) | |||
| 762 | led->name = "fujitsu::eco_led"; | 770 | led->name = "fujitsu::eco_led"; |
| 763 | led->brightness_set_blocking = eco_led_set; | 771 | led->brightness_set_blocking = eco_led_set; |
| 764 | led->brightness_get = eco_led_get; | 772 | led->brightness_get = eco_led_get; |
| 765 | result = devm_led_classdev_register(&device->dev, led); | 773 | ret = devm_led_classdev_register(&device->dev, led); |
| 766 | if (result) | 774 | if (ret) |
| 767 | return result; | 775 | return ret; |
| 768 | } | 776 | } |
| 769 | 777 | ||
| 770 | return 0; | 778 | return 0; |
| @@ -773,8 +781,7 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) | |||
| 773 | static int acpi_fujitsu_laptop_add(struct acpi_device *device) | 781 | static int acpi_fujitsu_laptop_add(struct acpi_device *device) |
| 774 | { | 782 | { |
| 775 | struct fujitsu_laptop *priv; | 783 | struct fujitsu_laptop *priv; |
| 776 | int error; | 784 | int ret, i = 0; |
| 777 | int i; | ||
| 778 | 785 | ||
| 779 | priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL); | 786 | priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL); |
| 780 | if (!priv) | 787 | if (!priv) |
| @@ -789,23 +796,16 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) | |||
| 789 | 796 | ||
| 790 | /* kfifo */ | 797 | /* kfifo */ |
| 791 | spin_lock_init(&priv->fifo_lock); | 798 | spin_lock_init(&priv->fifo_lock); |
| 792 | error = kfifo_alloc(&priv->fifo, RINGBUFFERSIZE * sizeof(int), | 799 | ret = kfifo_alloc(&priv->fifo, RINGBUFFERSIZE * sizeof(int), |
| 793 | GFP_KERNEL); | 800 | GFP_KERNEL); |
| 794 | if (error) { | 801 | if (ret) |
| 795 | pr_err("kfifo_alloc failed\n"); | 802 | return ret; |
| 796 | goto err_stop; | ||
| 797 | } | ||
| 798 | |||
| 799 | error = acpi_fujitsu_laptop_input_setup(device); | ||
| 800 | if (error) | ||
| 801 | goto err_free_fifo; | ||
| 802 | 803 | ||
| 803 | pr_info("ACPI: %s [%s]\n", | 804 | pr_info("ACPI: %s [%s]\n", |
| 804 | acpi_device_name(device), acpi_device_bid(device)); | 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 && |
| 807 | while (call_fext_func(device, FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0 | 808 | i++ < MAX_HOTKEY_RINGBUFFER_SIZE) |
| 808 | && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) | ||
| 809 | ; /* No action, result is discarded */ | 809 | ; /* No action, result is discarded */ |
| 810 | acpi_handle_debug(device->handle, "Discarded %i ringbuffer entries\n", | 810 | acpi_handle_debug(device->handle, "Discarded %i ringbuffer entries\n", |
| 811 | i); | 811 | i); |
| @@ -829,26 +829,31 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) | |||
| 829 | /* Sync backlight power status */ | 829 | /* Sync backlight power status */ |
| 830 | if (fujitsu_bl && fujitsu_bl->bl_device && | 830 | if (fujitsu_bl && fujitsu_bl->bl_device && |
| 831 | acpi_video_get_backlight_type() == acpi_backlight_vendor) { | 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 | fujitsu_bl->bl_device->props.power = FB_BLANK_POWERDOWN; | 834 | fujitsu_bl->bl_device->props.power = FB_BLANK_POWERDOWN; |
| 834 | else | 835 | else |
| 835 | fujitsu_bl->bl_device->props.power = FB_BLANK_UNBLANK; | 836 | fujitsu_bl->bl_device->props.power = FB_BLANK_UNBLANK; |
| 836 | } | 837 | } |
| 837 | 838 | ||
| 838 | error = acpi_fujitsu_laptop_leds_register(device); | 839 | ret = acpi_fujitsu_laptop_input_setup(device); |
| 839 | if (error) | 840 | if (ret) |
| 841 | goto err_free_fifo; | ||
| 842 | |||
| 843 | ret = acpi_fujitsu_laptop_leds_register(device); | ||
| 844 | if (ret) | ||
| 840 | goto err_free_fifo; | 845 | goto err_free_fifo; |
| 841 | 846 | ||
| 842 | error = fujitsu_laptop_platform_add(device); | 847 | ret = fujitsu_laptop_platform_add(device); |
| 843 | if (error) | 848 | if (ret) |
| 844 | goto err_free_fifo; | 849 | goto err_free_fifo; |
| 845 | 850 | ||
| 846 | return 0; | 851 | return 0; |
| 847 | 852 | ||
| 848 | err_free_fifo: | 853 | err_free_fifo: |
| 849 | kfifo_free(&priv->fifo); | 854 | kfifo_free(&priv->fifo); |
| 850 | err_stop: | 855 | |
| 851 | return error; | 856 | return ret; |
| 852 | } | 857 | } |
| 853 | 858 | ||
| 854 | static int acpi_fujitsu_laptop_remove(struct acpi_device *device) | 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) | |||
| 865 | static void acpi_fujitsu_laptop_press(struct acpi_device *device, int scancode) | 870 | static void acpi_fujitsu_laptop_press(struct acpi_device *device, int scancode) |
| 866 | { | 871 | { |
| 867 | struct fujitsu_laptop *priv = acpi_driver_data(device); | 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, | 875 | ret = kfifo_in_locked(&priv->fifo, (unsigned char *)&scancode, |
| 871 | sizeof(scancode), &priv->fifo_lock); | 876 | sizeof(scancode), &priv->fifo_lock); |
| 872 | if (status != sizeof(scancode)) { | 877 | if (ret != sizeof(scancode)) { |
| 873 | dev_info(&priv->input->dev, "Could not push scancode [0x%x]\n", | 878 | dev_info(&priv->input->dev, "Could not push scancode [0x%x]\n", |
| 874 | scancode); | 879 | scancode); |
| 875 | return; | 880 | return; |
| @@ -882,13 +887,12 @@ static void acpi_fujitsu_laptop_press(struct acpi_device *device, int scancode) | |||
| 882 | static void acpi_fujitsu_laptop_release(struct acpi_device *device) | 887 | static void acpi_fujitsu_laptop_release(struct acpi_device *device) |
| 883 | { | 888 | { |
| 884 | struct fujitsu_laptop *priv = acpi_driver_data(device); | 889 | struct fujitsu_laptop *priv = acpi_driver_data(device); |
| 885 | int scancode, status; | 890 | int scancode, ret; |
| 886 | 891 | ||
| 887 | while (true) { | 892 | while (true) { |
| 888 | status = kfifo_out_locked(&priv->fifo, | 893 | ret = kfifo_out_locked(&priv->fifo, (unsigned char *)&scancode, |
| 889 | (unsigned char *)&scancode, | 894 | sizeof(scancode), &priv->fifo_lock); |
| 890 | sizeof(scancode), &priv->fifo_lock); | 895 | if (ret != sizeof(scancode)) |
| 891 | if (status != sizeof(scancode)) | ||
| 892 | return; | 896 | return; |
| 893 | sparse_keymap_report_event(priv->input, scancode, 0, false); | 897 | sparse_keymap_report_event(priv->input, scancode, 0, false); |
| 894 | dev_dbg(&priv->input->dev, | 898 | dev_dbg(&priv->input->dev, |
| @@ -899,10 +903,10 @@ static void acpi_fujitsu_laptop_release(struct acpi_device *device) | |||
| 899 | static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 event) | 903 | static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 event) |
| 900 | { | 904 | { |
| 901 | struct fujitsu_laptop *priv = acpi_driver_data(device); | 905 | struct fujitsu_laptop *priv = acpi_driver_data(device); |
| 902 | int scancode, i = 0; | 906 | int scancode, i = 0, ret; |
| 903 | unsigned int irb; | 907 | unsigned int irb; |
| 904 | 908 | ||
| 905 | if (event != ACPI_FUJITSU_NOTIFY_CODE1) { | 909 | if (event != ACPI_FUJITSU_NOTIFY_CODE) { |
| 906 | acpi_handle_info(device->handle, "Unsupported event [0x%x]\n", | 910 | acpi_handle_info(device->handle, "Unsupported event [0x%x]\n", |
| 907 | event); | 911 | event); |
| 908 | sparse_keymap_report_event(priv->input, -1, 1, true); | 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) | |||
| 930 | * E736/E746/E756), the touchpad toggle hotkey (Fn+F4) is | 934 | * E736/E746/E756), the touchpad toggle hotkey (Fn+F4) is |
| 931 | * handled in software; its state is queried using FUNC_FLAGS | 935 | * handled in software; its state is queried using FUNC_FLAGS |
| 932 | */ | 936 | */ |
| 933 | if ((priv->flags_supported & BIT(26)) && | 937 | if (priv->flags_supported & (BIT(5) | BIT(26) | BIT(29))) { |
| 934 | (call_fext_func(device, FUNC_FLAGS, 0x1, 0x0, 0x0) & BIT(26))) | 938 | ret = call_fext_func(device, FUNC_FLAGS, 0x1, 0x0, 0x0); |
| 935 | sparse_keymap_report_event(priv->input, BIT(26), 1, true); | 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 | /* Initialization */ | 951 | /* Initialization */ |
diff --git a/drivers/platform/x86/gpd-pocket-fan.c b/drivers/platform/x86/gpd-pocket-fan.c index 2d645c505f81..be85ed966bf3 100644 --- a/drivers/platform/x86/gpd-pocket-fan.c +++ b/drivers/platform/x86/gpd-pocket-fan.c | |||
| @@ -19,12 +19,12 @@ | |||
| 19 | static int temp_limits[3] = { 55000, 60000, 65000 }; | 19 | static int temp_limits[3] = { 55000, 60000, 65000 }; |
| 20 | module_param_array(temp_limits, int, NULL, 0444); | 20 | module_param_array(temp_limits, int, NULL, 0444); |
| 21 | MODULE_PARM_DESC(temp_limits, | 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 | static int hysteresis = 3000; | 24 | static int hysteresis = 3000; |
| 25 | module_param(hysteresis, int, 0444); | 25 | module_param(hysteresis, int, 0444); |
| 26 | MODULE_PARM_DESC(hysteresis, | 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 | static int speed_on_ac = 2; | 29 | static int speed_on_ac = 2; |
| 30 | module_param(speed_on_ac, int, 0444); | 30 | module_param(speed_on_ac, int, 0444); |
diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c index 5e3df194723e..b5adba227783 100644 --- a/drivers/platform/x86/intel-hid.c +++ b/drivers/platform/x86/intel-hid.c | |||
| @@ -16,16 +16,14 @@ | |||
| 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 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
| 20 | #include <linux/module.h> | 24 | #include <linux/module.h> |
| 21 | #include <linux/init.h> | ||
| 22 | #include <linux/input.h> | ||
| 23 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
| 24 | #include <linux/input/sparse-keymap.h> | ||
| 25 | #include <linux/acpi.h> | ||
| 26 | #include <linux/suspend.h> | 26 | #include <linux/suspend.h> |
| 27 | #include <acpi/acpi_bus.h> | ||
| 28 | #include <linux/dmi.h> | ||
| 29 | 27 | ||
| 30 | MODULE_LICENSE("GPL"); | 28 | MODULE_LICENSE("GPL"); |
| 31 | MODULE_AUTHOR("Alex Hung"); | 29 | MODULE_AUTHOR("Alex Hung"); |
| @@ -67,8 +65,8 @@ static const struct key_entry intel_array_keymap[] = { | |||
| 67 | { KE_IGNORE, 0xC5, { KEY_VOLUMEUP } }, /* Release */ | 65 | { KE_IGNORE, 0xC5, { KEY_VOLUMEUP } }, /* Release */ |
| 68 | { KE_KEY, 0xC6, { KEY_VOLUMEDOWN } }, /* Press */ | 66 | { KE_KEY, 0xC6, { KEY_VOLUMEDOWN } }, /* Press */ |
| 69 | { KE_IGNORE, 0xC7, { KEY_VOLUMEDOWN } }, /* Release */ | 67 | { KE_IGNORE, 0xC7, { KEY_VOLUMEDOWN } }, /* Release */ |
| 70 | { KE_SW, 0xC8, { .sw = { SW_ROTATE_LOCK, 1 } } }, /* Press */ | 68 | { KE_KEY, 0xC8, { KEY_ROTATE_LOCK_TOGGLE } }, /* Press */ |
| 71 | { KE_SW, 0xC9, { .sw = { SW_ROTATE_LOCK, 0 } } }, /* Release */ | 69 | { KE_IGNORE, 0xC9, { KEY_ROTATE_LOCK_TOGGLE } }, /* Release */ |
| 72 | { KE_KEY, 0xCE, { KEY_POWER } }, /* Press */ | 70 | { KE_KEY, 0xCE, { KEY_POWER } }, /* Press */ |
| 73 | { KE_IGNORE, 0xCF, { KEY_POWER } }, /* Release */ | 71 | { KE_IGNORE, 0xCF, { KEY_POWER } }, /* Release */ |
| 74 | { KE_END }, | 72 | { KE_END }, |
diff --git a/drivers/platform/x86/intel_turbo_max_3.c b/drivers/platform/x86/intel_turbo_max_3.c index d4ea01805879..a6d5aa0c3c47 100644 --- a/drivers/platform/x86/intel_turbo_max_3.c +++ b/drivers/platform/x86/intel_turbo_max_3.c | |||
| @@ -138,9 +138,6 @@ static int __init itmt_legacy_init(void) | |||
| 138 | if (!id) | 138 | if (!id) |
| 139 | return -ENODEV; | 139 | return -ENODEV; |
| 140 | 140 | ||
| 141 | if (boot_cpu_has(X86_FEATURE_HWP)) | ||
| 142 | return -ENODEV; | ||
| 143 | |||
| 144 | ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, | 141 | ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, |
| 145 | "platform/x86/turbo_max_3:online", | 142 | "platform/x86/turbo_max_3:online", |
| 146 | itmt_legacy_cpu_online, NULL); | 143 | itmt_legacy_cpu_online, NULL); |
diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c index 454e14f02285..7a0bd24c1ae2 100644 --- a/drivers/platform/x86/mlx-platform.c +++ b/drivers/platform/x86/mlx-platform.c | |||
| @@ -85,6 +85,15 @@ | |||
| 85 | #define MLXPLAT_CPLD_FAN_MASK GENMASK(3, 0) | 85 | #define MLXPLAT_CPLD_FAN_MASK GENMASK(3, 0) |
| 86 | #define MLXPLAT_CPLD_FAN_NG_MASK GENMASK(5, 0) | 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 | /* Start channel numbers */ | 97 | /* Start channel numbers */ |
| 89 | #define MLXPLAT_CPLD_CH1 2 | 98 | #define MLXPLAT_CPLD_CH1 2 |
| 90 | #define MLXPLAT_CPLD_CH2 10 | 99 | #define MLXPLAT_CPLD_CH2 10 |
| @@ -124,7 +133,7 @@ static const struct resource mlxplat_lpc_resources[] = { | |||
| 124 | }; | 133 | }; |
| 125 | 134 | ||
| 126 | /* Platform default channels */ | 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 | MLXPLAT_CPLD_CH1, MLXPLAT_CPLD_CH1 + 1, MLXPLAT_CPLD_CH1 + 2, | 138 | MLXPLAT_CPLD_CH1, MLXPLAT_CPLD_CH1 + 1, MLXPLAT_CPLD_CH1 + 2, |
| 130 | MLXPLAT_CPLD_CH1 + 3, MLXPLAT_CPLD_CH1 + 4, MLXPLAT_CPLD_CH1 + | 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) | |||
| 694 | ARRAY_SIZE(mlxplat_default_channels[i]); | 703 | ARRAY_SIZE(mlxplat_default_channels[i]); |
| 695 | } | 704 | } |
| 696 | mlxplat_hotplug = &mlxplat_mlxcpld_default_data; | 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 | return 1; | 709 | return 1; |
| 699 | }; | 710 | }; |
| @@ -708,6 +719,8 @@ static int __init mlxplat_dmi_msn21xx_matched(const struct dmi_system_id *dmi) | |||
| 708 | ARRAY_SIZE(mlxplat_msn21xx_channels); | 719 | ARRAY_SIZE(mlxplat_msn21xx_channels); |
| 709 | } | 720 | } |
| 710 | mlxplat_hotplug = &mlxplat_mlxcpld_msn21xx_data; | 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 | return 1; | 725 | return 1; |
| 713 | }; | 726 | }; |
| @@ -722,6 +735,8 @@ static int __init mlxplat_dmi_msn274x_matched(const struct dmi_system_id *dmi) | |||
| 722 | ARRAY_SIZE(mlxplat_msn21xx_channels); | 735 | ARRAY_SIZE(mlxplat_msn21xx_channels); |
| 723 | } | 736 | } |
| 724 | mlxplat_hotplug = &mlxplat_mlxcpld_msn274x_data; | 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 | return 1; | 741 | return 1; |
| 727 | }; | 742 | }; |
| @@ -736,6 +751,8 @@ static int __init mlxplat_dmi_msn201x_matched(const struct dmi_system_id *dmi) | |||
| 736 | ARRAY_SIZE(mlxplat_msn21xx_channels); | 751 | ARRAY_SIZE(mlxplat_msn21xx_channels); |
| 737 | } | 752 | } |
| 738 | mlxplat_hotplug = &mlxplat_mlxcpld_msn201x_data; | 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 | return 1; | 757 | return 1; |
| 741 | }; | 758 | }; |
| @@ -750,6 +767,8 @@ static int __init mlxplat_dmi_qmb7xx_matched(const struct dmi_system_id *dmi) | |||
| 750 | ARRAY_SIZE(mlxplat_msn21xx_channels); | 767 | ARRAY_SIZE(mlxplat_msn21xx_channels); |
| 751 | } | 768 | } |
| 752 | mlxplat_hotplug = &mlxplat_mlxcpld_default_ng_data; | 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 | return 1; | 773 | return 1; |
| 755 | }; | 774 | }; |
| @@ -830,10 +849,48 @@ static const struct dmi_system_id mlxplat_dmi_table[] __initconst = { | |||
| 830 | 849 | ||
| 831 | MODULE_DEVICE_TABLE(dmi, mlxplat_dmi_table); | 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 | static int __init mlxplat_init(void) | 890 | static int __init mlxplat_init(void) |
| 834 | { | 891 | { |
| 835 | struct mlxplat_priv *priv; | 892 | struct mlxplat_priv *priv; |
| 836 | int i, err; | 893 | int i, nr, err; |
| 837 | 894 | ||
| 838 | if (!dmi_check_system(mlxplat_dmi_table)) | 895 | if (!dmi_check_system(mlxplat_dmi_table)) |
| 839 | return -ENODEV; | 896 | return -ENODEV; |
| @@ -853,7 +910,12 @@ static int __init mlxplat_init(void) | |||
| 853 | } | 910 | } |
| 854 | platform_set_drvdata(mlxplat_dev, priv); | 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 | NULL, 0); | 919 | NULL, 0); |
| 858 | if (IS_ERR(priv->pdev_i2c)) { | 920 | if (IS_ERR(priv->pdev_i2c)) { |
| 859 | err = PTR_ERR(priv->pdev_i2c); | 921 | err = PTR_ERR(priv->pdev_i2c); |
diff --git a/drivers/platform/x86/silead_dmi.c b/drivers/platform/x86/silead_dmi.c index 3a624090191d..452aacabaa8e 100644 --- a/drivers/platform/x86/silead_dmi.c +++ b/drivers/platform/x86/silead_dmi.c | |||
| @@ -446,6 +446,23 @@ static const struct dmi_system_id silead_ts_dmi_table[] = { | |||
| 446 | DMI_MATCH(DMI_BOARD_NAME, "X3 Plus"), | 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 | ||
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 1c57ee2b6d19..da1ca4856ea1 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
| @@ -8703,16 +8703,24 @@ static const struct attribute_group fan_attr_group = { | |||
| 8703 | .ec = TPID(__id1, __id2), \ | 8703 | .ec = TPID(__id1, __id2), \ |
| 8704 | .quirks = __quirks } | 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 | static const struct tpacpi_quirk fan_quirk_table[] __initconst = { | 8712 | static const struct tpacpi_quirk fan_quirk_table[] __initconst = { |
| 8707 | TPACPI_FAN_QI('1', 'Y', TPACPI_FAN_Q1), | 8713 | TPACPI_FAN_QI('1', 'Y', TPACPI_FAN_Q1), |
| 8708 | TPACPI_FAN_QI('7', '8', TPACPI_FAN_Q1), | 8714 | TPACPI_FAN_QI('7', '8', TPACPI_FAN_Q1), |
| 8709 | TPACPI_FAN_QI('7', '6', TPACPI_FAN_Q1), | 8715 | TPACPI_FAN_QI('7', '6', TPACPI_FAN_Q1), |
| 8710 | TPACPI_FAN_QI('7', '0', TPACPI_FAN_Q1), | 8716 | TPACPI_FAN_QI('7', '0', TPACPI_FAN_Q1), |
| 8711 | TPACPI_FAN_QL('7', 'M', TPACPI_FAN_2FAN), | 8717 | TPACPI_FAN_QL('7', 'M', TPACPI_FAN_2FAN), |
| 8718 | TPACPI_FAN_QB('N', '1', TPACPI_FAN_2FAN), | ||
| 8712 | }; | 8719 | }; |
| 8713 | 8720 | ||
| 8714 | #undef TPACPI_FAN_QL | 8721 | #undef TPACPI_FAN_QL |
| 8715 | #undef TPACPI_FAN_QI | 8722 | #undef TPACPI_FAN_QI |
| 8723 | #undef TPACPI_FAN_QB | ||
| 8716 | 8724 | ||
| 8717 | static int __init fan_init(struct ibm_init_struct *iibm) | 8725 | static int __init fan_init(struct ibm_init_struct *iibm) |
| 8718 | { | 8726 | { |
diff --git a/drivers/platform/x86/topstar-laptop.c b/drivers/platform/x86/topstar-laptop.c index 1032c00b907b..f7761d98c0fd 100644 --- a/drivers/platform/x86/topstar-laptop.c +++ b/drivers/platform/x86/topstar-laptop.c | |||
| @@ -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 | * Copyright (c) 2009 Herton Ronaldo Krzesinski <herton@mandriva.com.br> | 5 | * Copyright (c) 2009 Herton Ronaldo Krzesinski <herton@mandriva.com.br> |
| 6 | * Copyright (c) 2018 Guillaume Douézan-Grard | ||
| 5 | * | 7 | * |
| 6 | * Implementation inspired by existing x86 platform drivers, in special | 8 | * Implementation inspired by existing x86 platform drivers, in special |
| 7 | * asus/eepc/fujitsu-laptop, thanks to their authors | 9 | * 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. | ||
| 12 | */ | 10 | */ |
| 13 | 11 | ||
| 14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| @@ -18,15 +16,93 @@ | |||
| 18 | #include <linux/init.h> | 16 | #include <linux/init.h> |
| 19 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
| 20 | #include <linux/acpi.h> | 18 | #include <linux/acpi.h> |
| 19 | #include <linux/dmi.h> | ||
| 21 | #include <linux/input.h> | 20 | #include <linux/input.h> |
| 22 | #include <linux/input/sparse-keymap.h> | 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 topstar_laptop { |
| 27 | struct input_dev *inputdev; | 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 | static const struct key_entry topstar_keymap[] = { | 106 | static const struct key_entry topstar_keymap[] = { |
| 31 | { KE_KEY, 0x80, { KEY_BRIGHTNESSUP } }, | 107 | { KE_KEY, 0x80, { KEY_BRIGHTNESSUP } }, |
| 32 | { KE_KEY, 0x81, { KEY_BRIGHTNESSDOWN } }, | 108 | { KE_KEY, 0x81, { KEY_BRIGHTNESSDOWN } }, |
| @@ -57,107 +133,217 @@ static const struct key_entry topstar_keymap[] = { | |||
| 57 | { KE_END, 0 } | 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]; | 138 | if (!sparse_keymap_report_event(topstar->input, event, 1, true)) |
| 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)) | ||
| 77 | pr_info("unknown event = 0x%02x\n", event); | 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) | 142 | static int topstar_input_init(struct topstar_laptop *topstar) |
| 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) | ||
| 95 | { | 143 | { |
| 96 | struct input_dev *input; | 144 | struct input_dev *input; |
| 97 | int error; | 145 | int err; |
| 98 | 146 | ||
| 99 | input = input_allocate_device(); | 147 | input = input_allocate_device(); |
| 100 | if (!input) | 148 | if (!input) |
| 101 | return -ENOMEM; | 149 | return -ENOMEM; |
| 102 | 150 | ||
| 103 | input->name = "Topstar Laptop extra buttons"; | 151 | input->name = "Topstar Laptop extra buttons"; |
| 104 | input->phys = "topstar/input0"; | 152 | input->phys = TOPSTAR_LAPTOP_CLASS "/input0"; |
| 105 | input->id.bustype = BUS_HOST; | 153 | input->id.bustype = BUS_HOST; |
| 154 | input->dev.parent = &topstar->platform->dev; | ||
| 106 | 155 | ||
| 107 | error = sparse_keymap_setup(input, topstar_keymap, NULL); | 156 | err = sparse_keymap_setup(input, topstar_keymap, NULL); |
| 108 | if (error) { | 157 | if (err) { |
| 109 | pr_err("Unable to setup input device keymap\n"); | 158 | pr_err("Unable to setup input device keymap\n"); |
| 110 | goto err_free_dev; | 159 | goto err_free_dev; |
| 111 | } | 160 | } |
| 112 | 161 | ||
| 113 | error = input_register_device(input); | 162 | err = input_register_device(input); |
| 114 | if (error) { | 163 | if (err) { |
| 115 | pr_err("Unable to register input device\n"); | 164 | pr_err("Unable to register input device\n"); |
| 116 | goto err_free_dev; | 165 | goto err_free_dev; |
| 117 | } | 166 | } |
| 118 | 167 | ||
| 119 | hkey->inputdev = input; | 168 | topstar->input = input; |
| 120 | return 0; | 169 | return 0; |
| 121 | 170 | ||
| 122 | err_free_dev: | 171 | err_free_dev: |
| 123 | input_free_device(input); | 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); | 181 | /* |
| 132 | if (!tps_hkey) | 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 | return -ENOMEM; | 197 | return -ENOMEM; |
| 134 | 198 | ||
| 135 | strcpy(acpi_device_name(device), "Topstar TPSACPI"); | 199 | platform_set_drvdata(topstar->platform, topstar); |
| 136 | strcpy(acpi_device_class(device), ACPI_TOPSTAR_CLASS); | 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)) | 207 | err_device_put: |
| 139 | goto add_err; | 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)) | 226 | status = acpi_execute_simple_method(device->handle, "FNCX", arg); |
| 142 | goto add_err; | 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 | return 0; | 232 | return 0; |
| 233 | } | ||
| 146 | 234 | ||
| 147 | add_err: | 235 | static void topstar_acpi_notify(struct acpi_device *device, u32 event) |
| 148 | kfree(tps_hkey); | 236 | { |
| 149 | return -ENODEV; | 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); | 264 | /* |
| 159 | kfree(tps_hkey); | 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 | return 0; | 347 | return 0; |
| 162 | } | 348 | } |
| 163 | 349 | ||
| @@ -168,18 +354,47 @@ static const struct acpi_device_id topstar_device_ids[] = { | |||
| 168 | }; | 354 | }; |
| 169 | MODULE_DEVICE_TABLE(acpi, topstar_device_ids); | 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 | .name = "Topstar laptop ACPI driver", | 358 | .name = "Topstar laptop ACPI driver", |
| 173 | .class = ACPI_TOPSTAR_CLASS, | 359 | .class = TOPSTAR_LAPTOP_CLASS, |
| 174 | .ids = topstar_device_ids, | 360 | .ids = topstar_device_ids, |
| 175 | .ops = { | 361 | .ops = { |
| 176 | .add = acpi_topstar_add, | 362 | .add = topstar_acpi_add, |
| 177 | .remove = acpi_topstar_remove, | 363 | .remove = topstar_acpi_remove, |
| 178 | .notify = acpi_topstar_notify, | 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 | MODULE_AUTHOR("Herton Ronaldo Krzesinski"); | 397 | MODULE_AUTHOR("Herton Ronaldo Krzesinski"); |
| 398 | MODULE_AUTHOR("Guillaume Douézan-Grard"); | ||
| 184 | MODULE_DESCRIPTION("Topstar Laptop ACPI Extras driver"); | 399 | MODULE_DESCRIPTION("Topstar Laptop ACPI Extras driver"); |
| 185 | MODULE_LICENSE("GPL"); | 400 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 8796211ef24a..8e3d0146ff8c 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c | |||
| @@ -130,13 +130,11 @@ static bool find_guid(const char *guid_string, struct wmi_block **out) | |||
| 130 | uuid_le guid_input; | 130 | uuid_le guid_input; |
| 131 | struct wmi_block *wblock; | 131 | struct wmi_block *wblock; |
| 132 | struct guid_block *block; | 132 | struct guid_block *block; |
| 133 | struct list_head *p; | ||
| 134 | 133 | ||
| 135 | if (uuid_le_to_bin(guid_string, &guid_input)) | 134 | if (uuid_le_to_bin(guid_string, &guid_input)) |
| 136 | return false; | 135 | return false; |
| 137 | 136 | ||
| 138 | list_for_each(p, &wmi_block_list) { | 137 | list_for_each_entry(wblock, &wmi_block_list, list) { |
| 139 | wblock = list_entry(p, struct wmi_block, list); | ||
| 140 | block = &wblock->gblock; | 138 | block = &wblock->gblock; |
| 141 | 139 | ||
| 142 | if (memcmp(block->guid, &guid_input, 16) == 0) { | 140 | if (memcmp(block->guid, &guid_input, 16) == 0) { |
| @@ -519,7 +517,6 @@ wmi_notify_handler handler, void *data) | |||
| 519 | struct wmi_block *block; | 517 | struct wmi_block *block; |
| 520 | acpi_status status = AE_NOT_EXIST; | 518 | acpi_status status = AE_NOT_EXIST; |
| 521 | uuid_le guid_input; | 519 | uuid_le guid_input; |
| 522 | struct list_head *p; | ||
| 523 | 520 | ||
| 524 | if (!guid || !handler) | 521 | if (!guid || !handler) |
| 525 | return AE_BAD_PARAMETER; | 522 | return AE_BAD_PARAMETER; |
| @@ -527,9 +524,8 @@ wmi_notify_handler handler, void *data) | |||
| 527 | if (uuid_le_to_bin(guid, &guid_input)) | 524 | if (uuid_le_to_bin(guid, &guid_input)) |
| 528 | return AE_BAD_PARAMETER; | 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 | acpi_status wmi_status; | 528 | acpi_status wmi_status; |
| 532 | block = list_entry(p, struct wmi_block, list); | ||
| 533 | 529 | ||
| 534 | if (memcmp(block->gblock.guid, &guid_input, 16) == 0) { | 530 | if (memcmp(block->gblock.guid, &guid_input, 16) == 0) { |
| 535 | if (block->handler && | 531 | if (block->handler && |
| @@ -560,7 +556,6 @@ acpi_status wmi_remove_notify_handler(const char *guid) | |||
| 560 | struct wmi_block *block; | 556 | struct wmi_block *block; |
| 561 | acpi_status status = AE_NOT_EXIST; | 557 | acpi_status status = AE_NOT_EXIST; |
| 562 | uuid_le guid_input; | 558 | uuid_le guid_input; |
| 563 | struct list_head *p; | ||
| 564 | 559 | ||
| 565 | if (!guid) | 560 | if (!guid) |
| 566 | return AE_BAD_PARAMETER; | 561 | return AE_BAD_PARAMETER; |
| @@ -568,9 +563,8 @@ acpi_status wmi_remove_notify_handler(const char *guid) | |||
| 568 | if (uuid_le_to_bin(guid, &guid_input)) | 563 | if (uuid_le_to_bin(guid, &guid_input)) |
| 569 | return AE_BAD_PARAMETER; | 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 | acpi_status wmi_status; | 567 | acpi_status wmi_status; |
| 573 | block = list_entry(p, struct wmi_block, list); | ||
| 574 | 568 | ||
| 575 | if (memcmp(block->gblock.guid, &guid_input, 16) == 0) { | 569 | if (memcmp(block->gblock.guid, &guid_input, 16) == 0) { |
| 576 | if (!block->handler || | 570 | if (!block->handler || |
| @@ -610,15 +604,13 @@ acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out) | |||
| 610 | union acpi_object params[1]; | 604 | union acpi_object params[1]; |
| 611 | struct guid_block *gblock; | 605 | struct guid_block *gblock; |
| 612 | struct wmi_block *wblock; | 606 | struct wmi_block *wblock; |
| 613 | struct list_head *p; | ||
| 614 | 607 | ||
| 615 | input.count = 1; | 608 | input.count = 1; |
| 616 | input.pointer = params; | 609 | input.pointer = params; |
| 617 | params[0].type = ACPI_TYPE_INTEGER; | 610 | params[0].type = ACPI_TYPE_INTEGER; |
| 618 | params[0].integer.value = event; | 611 | params[0].integer.value = event; |
| 619 | 612 | ||
| 620 | list_for_each(p, &wmi_block_list) { | 613 | list_for_each_entry(wblock, &wmi_block_list, list) { |
| 621 | wblock = list_entry(p, struct wmi_block, list); | ||
| 622 | gblock = &wblock->gblock; | 614 | gblock = &wblock->gblock; |
| 623 | 615 | ||
| 624 | if ((gblock->flags & ACPI_WMI_EVENT) && | 616 | if ((gblock->flags & ACPI_WMI_EVENT) && |
| @@ -933,12 +925,11 @@ static int wmi_dev_probe(struct device *dev) | |||
| 933 | goto probe_failure; | 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 | if (!buf) { | 929 | if (!buf) { |
| 938 | ret = -ENOMEM; | 930 | ret = -ENOMEM; |
| 939 | goto probe_string_failure; | 931 | goto probe_string_failure; |
| 940 | } | 932 | } |
| 941 | sprintf(buf, "wmi/%s", wdriver->driver.name); | ||
| 942 | wblock->char_dev.minor = MISC_DYNAMIC_MINOR; | 933 | wblock->char_dev.minor = MISC_DYNAMIC_MINOR; |
| 943 | wblock->char_dev.name = buf; | 934 | wblock->char_dev.name = buf; |
| 944 | wblock->char_dev.fops = &wmi_fops; | 935 | wblock->char_dev.fops = &wmi_fops; |
| @@ -1261,11 +1252,9 @@ static void acpi_wmi_notify_handler(acpi_handle handle, u32 event, | |||
| 1261 | { | 1252 | { |
| 1262 | struct guid_block *block; | 1253 | struct guid_block *block; |
| 1263 | struct wmi_block *wblock; | 1254 | struct wmi_block *wblock; |
| 1264 | struct list_head *p; | ||
| 1265 | bool found_it = false; | 1255 | bool found_it = false; |
| 1266 | 1256 | ||
| 1267 | list_for_each(p, &wmi_block_list) { | 1257 | list_for_each_entry(wblock, &wmi_block_list, list) { |
| 1268 | wblock = list_entry(p, struct wmi_block, list); | ||
| 1269 | block = &wblock->gblock; | 1258 | block = &wblock->gblock; |
| 1270 | 1259 | ||
| 1271 | if (wblock->acpi_device->handle == handle && | 1260 | if (wblock->acpi_device->handle == handle && |
diff --git a/include/linux/platform_data/mlxreg.h b/include/linux/platform_data/mlxreg.h index fcdc707eab99..2744cff1b297 100644 --- a/include/linux/platform_data/mlxreg.h +++ b/include/linux/platform_data/mlxreg.h | |||
| @@ -129,6 +129,8 @@ struct mlxreg_core_platform_data { | |||
| 129 | * @mask: top aggregation interrupt common mask; | 129 | * @mask: top aggregation interrupt common mask; |
| 130 | * @cell_low: location of low aggregation interrupt register; | 130 | * @cell_low: location of low aggregation interrupt register; |
| 131 | * @mask_low: low aggregation interrupt common mask; | 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 | struct mlxreg_core_hotplug_platform_data { | 135 | struct mlxreg_core_hotplug_platform_data { |
| 134 | struct mlxreg_core_item *items; | 136 | struct mlxreg_core_item *items; |
| @@ -139,6 +141,8 @@ struct mlxreg_core_hotplug_platform_data { | |||
| 139 | u32 mask; | 141 | u32 mask; |
| 140 | u32 cell_low; | 142 | u32 cell_low; |
| 141 | u32 mask_low; | 143 | u32 mask_low; |
| 144 | int deferred_nr; | ||
| 145 | int shift_nr; | ||
| 142 | }; | 146 | }; |
| 143 | 147 | ||
| 144 | #endif /* __LINUX_PLATFORM_DATA_MLXREG_H */ | 148 | #endif /* __LINUX_PLATFORM_DATA_MLXREG_H */ |
