Skip to content

Commit f51de61

Browse files
committed
Merge tag 'platform-drivers-x86-v6.6-5' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform driver fixes from Hans de Goede: - Fix spurious brightness down presses on newer Asus laptop models - Fix backlight control not working on T2 Mac Pro all-in-ones - Add Armin Wolf as new maintainer for the WMI bus driver and change its status from orphaned to maintained - A few other small fixes * tag 'platform-drivers-x86-v6.6-5' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: platform/mellanox: mlxbf-tmfifo: Fix a warning message apple-gmux: Hard Code max brightness for MMIO gmux platform/surface: platform_profile: Propagate error if profile registration fails platform/x86: asus-wmi: Map 0x2a code, Ignore 0x2b and 0x2c events platform/x86: asus-wmi: Only map brightness codes when using asus-wmi backlight control platform/x86: asus-wmi: Change ASUS_WMI_BRN_DOWN code from 0x20 to 0x2e platform/x86: wmi: Update MAINTAINERS entry platform/x86: msi-ec: Fix the 3rd config platform/x86: intel-uncore-freq: Conditionally create attribute for read frequency platform: mellanox: Fix a resource leak in an error handling path in probing flow
2 parents bfd4704 + 99c09c9 commit f51de61

File tree

10 files changed

+45
-32
lines changed

10 files changed

+45
-32
lines changed

MAINTAINERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,9 @@ F: drivers/acpi/viot.c
378378
F: include/linux/acpi_viot.h
379379

380380
ACPI WMI DRIVER
381+
M: Armin Wolf <[email protected]>
381382
382-
S: Orphan
383+
S: Maintained
383384
F: Documentation/driver-api/wmi.rst
384385
F: Documentation/wmi/
385386
F: drivers/platform/x86/wmi.c

drivers/platform/mellanox/mlxbf-tmfifo.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -609,24 +609,25 @@ static void mlxbf_tmfifo_rxtx_word(struct mlxbf_tmfifo_vring *vring,
609609

610610
if (vring->cur_len + sizeof(u64) <= len) {
611611
/* The whole word. */
612-
if (!IS_VRING_DROP(vring)) {
613-
if (is_rx)
612+
if (is_rx) {
613+
if (!IS_VRING_DROP(vring))
614614
memcpy(addr + vring->cur_len, &data,
615615
sizeof(u64));
616-
else
617-
memcpy(&data, addr + vring->cur_len,
618-
sizeof(u64));
616+
} else {
617+
memcpy(&data, addr + vring->cur_len,
618+
sizeof(u64));
619619
}
620620
vring->cur_len += sizeof(u64);
621621
} else {
622622
/* Leftover bytes. */
623-
if (!IS_VRING_DROP(vring)) {
624-
if (is_rx)
623+
if (is_rx) {
624+
if (!IS_VRING_DROP(vring))
625625
memcpy(addr + vring->cur_len, &data,
626626
len - vring->cur_len);
627-
else
628-
memcpy(&data, addr + vring->cur_len,
629-
len - vring->cur_len);
627+
} else {
628+
data = 0;
629+
memcpy(&data, addr + vring->cur_len,
630+
len - vring->cur_len);
630631
}
631632
vring->cur_len = len;
632633
}

drivers/platform/surface/surface_platform_profile.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev)
159159
set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, tpd->handler.choices);
160160
set_bit(PLATFORM_PROFILE_PERFORMANCE, tpd->handler.choices);
161161

162-
platform_profile_register(&tpd->handler);
163-
return 0;
162+
return platform_profile_register(&tpd->handler);
164163
}
165164

166165
static void surface_platform_profile_remove(struct ssam_device *sdev)

drivers/platform/x86/apple-gmux.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ struct apple_gmux_config {
105105
#define GMUX_BRIGHTNESS_MASK 0x00ffffff
106106
#define GMUX_MAX_BRIGHTNESS GMUX_BRIGHTNESS_MASK
107107

108+
# define MMIO_GMUX_MAX_BRIGHTNESS 0xffff
109+
108110
static u8 gmux_pio_read8(struct apple_gmux_data *gmux_data, int port)
109111
{
110112
return inb(gmux_data->iostart + port);
@@ -857,7 +859,17 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
857859

858860
memset(&props, 0, sizeof(props));
859861
props.type = BACKLIGHT_PLATFORM;
860-
props.max_brightness = gmux_read32(gmux_data, GMUX_PORT_MAX_BRIGHTNESS);
862+
863+
/*
864+
* All MMIO gmux's have 0xffff as max brightness, but some iMacs incorrectly
865+
* report 0x03ff, despite the firmware being happy to set 0xffff as the brightness
866+
* at boot. Force 0xffff for all MMIO gmux's so they all have the correct brightness
867+
* range.
868+
*/
869+
if (type == APPLE_GMUX_TYPE_MMIO)
870+
props.max_brightness = MMIO_GMUX_MAX_BRIGHTNESS;
871+
else
872+
props.max_brightness = gmux_read32(gmux_data, GMUX_PORT_MAX_BRIGHTNESS);
861873

862874
#if IS_REACHABLE(CONFIG_ACPI_VIDEO)
863875
register_bdev = acpi_video_get_backlight_type() == acpi_backlight_apple_gmux;

drivers/platform/x86/asus-nb-wmi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,9 @@ static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
531531
static const struct key_entry asus_nb_wmi_keymap[] = {
532532
{ KE_KEY, ASUS_WMI_BRN_DOWN, { KEY_BRIGHTNESSDOWN } },
533533
{ KE_KEY, ASUS_WMI_BRN_UP, { KEY_BRIGHTNESSUP } },
534+
{ KE_KEY, 0x2a, { KEY_SELECTIVE_SCREENSHOT } },
535+
{ KE_IGNORE, 0x2b, }, /* PrintScreen (also send via PS/2) on newer models */
536+
{ KE_IGNORE, 0x2c, }, /* CapsLock (also send via PS/2) on newer models */
534537
{ KE_KEY, 0x30, { KEY_VOLUMEUP } },
535538
{ KE_KEY, 0x31, { KEY_VOLUMEDOWN } },
536539
{ KE_KEY, 0x32, { KEY_MUTE } },

drivers/platform/x86/asus-wmi.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3826,7 +3826,6 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
38263826
{
38273827
unsigned int key_value = 1;
38283828
bool autorelease = 1;
3829-
int orig_code = code;
38303829

38313830
if (asus->driver->key_filter) {
38323831
asus->driver->key_filter(asus->driver, &code, &key_value,
@@ -3835,16 +3834,10 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
38353834
return;
38363835
}
38373836

3838-
if (code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNUP_MAX)
3839-
code = ASUS_WMI_BRN_UP;
3840-
else if (code >= NOTIFY_BRNDOWN_MIN && code <= NOTIFY_BRNDOWN_MAX)
3841-
code = ASUS_WMI_BRN_DOWN;
3842-
3843-
if (code == ASUS_WMI_BRN_DOWN || code == ASUS_WMI_BRN_UP) {
3844-
if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
3845-
asus_wmi_backlight_notify(asus, orig_code);
3846-
return;
3847-
}
3837+
if (acpi_video_get_backlight_type() == acpi_backlight_vendor &&
3838+
code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNDOWN_MAX) {
3839+
asus_wmi_backlight_notify(asus, code);
3840+
return;
38483841
}
38493842

38503843
if (code == NOTIFY_KBD_BRTUP) {

drivers/platform/x86/asus-wmi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <linux/i8042.h>
1919

2020
#define ASUS_WMI_KEY_IGNORE (-1)
21-
#define ASUS_WMI_BRN_DOWN 0x20
21+
#define ASUS_WMI_BRN_DOWN 0x2e
2222
#define ASUS_WMI_BRN_UP 0x2f
2323

2424
struct module;

drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ show_uncore_data(initial_max_freq_khz);
176176

177177
static int create_attr_group(struct uncore_data *data, char *name)
178178
{
179-
int ret, index = 0;
179+
int ret, freq, index = 0;
180180

181181
init_attribute_rw(max_freq_khz);
182182
init_attribute_rw(min_freq_khz);
@@ -197,7 +197,11 @@ static int create_attr_group(struct uncore_data *data, char *name)
197197
data->uncore_attrs[index++] = &data->min_freq_khz_dev_attr.attr;
198198
data->uncore_attrs[index++] = &data->initial_min_freq_khz_dev_attr.attr;
199199
data->uncore_attrs[index++] = &data->initial_max_freq_khz_dev_attr.attr;
200-
data->uncore_attrs[index++] = &data->current_freq_khz_dev_attr.attr;
200+
201+
ret = uncore_read_freq(data, &freq);
202+
if (!ret)
203+
data->uncore_attrs[index++] = &data->current_freq_khz_dev_attr.attr;
204+
201205
data->uncore_attrs[index] = NULL;
202206

203207
data->uncore_attr_group.name = name;

drivers/platform/x86/mlx-platform.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6514,13 +6514,15 @@ static int mlxplat_i2c_main_init(struct mlxplat_priv *priv)
65146514
return 0;
65156515

65166516
fail_mlxplat_i2c_mux_topology_init:
6517+
platform_device_unregister(priv->pdev_i2c);
65176518
fail_platform_i2c_register:
65186519
fail_mlxplat_mlxcpld_verify_bus_topology:
65196520
return err;
65206521
}
65216522

65226523
static void mlxplat_i2c_main_exit(struct mlxplat_priv *priv)
65236524
{
6525+
mlxplat_pre_exit(priv);
65246526
mlxplat_i2c_mux_topology_exit(priv);
65256527
if (priv->pdev_i2c)
65266528
platform_device_unregister(priv->pdev_i2c);
@@ -6597,7 +6599,7 @@ static int mlxplat_probe(struct platform_device *pdev)
65976599

65986600
fail_register_reboot_notifier:
65996601
fail_regcache_sync:
6600-
mlxplat_pre_exit(priv);
6602+
mlxplat_i2c_main_exit(priv);
66016603
fail_mlxplat_i2c_main_init:
66026604
fail_regmap_write:
66036605
fail_alloc:
@@ -6614,7 +6616,6 @@ static int mlxplat_remove(struct platform_device *pdev)
66146616
pm_power_off = NULL;
66156617
if (mlxplat_reboot_nb)
66166618
unregister_reboot_notifier(mlxplat_reboot_nb);
6617-
mlxplat_pre_exit(priv);
66186619
mlxplat_i2c_main_exit(priv);
66196620
mlxplat_post_exit();
66206621
return 0;

drivers/platform/x86/msi-ec.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,13 @@ static struct msi_ec_conf CONF2 __initdata = {
276276

277277
static const char * const ALLOWED_FW_3[] __initconst = {
278278
"1592EMS1.111",
279-
"E1592IMS.10C",
280279
NULL
281280
};
282281

283282
static struct msi_ec_conf CONF3 __initdata = {
284283
.allowed_fw = ALLOWED_FW_3,
285284
.charge_control = {
286-
.address = 0xef,
285+
.address = 0xd7,
287286
.offset_start = 0x8a,
288287
.offset_end = 0x80,
289288
.range_min = 0x8a,

0 commit comments

Comments
 (0)