Commit 1a2f6a37 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'platform-drivers-x86-v6.0-2' of...

Merge tag 'platform-drivers-x86-v6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform driver fixes from Hans de Goede:
 "Various small fixes and hardware-id additions"

* tag 'platform-drivers-x86-v6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
  platform/x86: p2sb: Fix UAF when caller uses resource name
  platform/x86: asus-wmi: Increase FAN_CURVE_BUF_LEN to 32
  platform/mellanox: Remove redundant 'NULL' check
  platform/mellanox: Remove unnecessary code
  platform/mellanox: mlxreg-lc: Fix locking issue
  platform/mellanox: mlxreg-lc: Fix coverity warning
  platform/x86: acer-wmi: Acer Aspire One AOD270/Packard Bell Dot keymap fixes
  platform/x86: thinkpad_acpi: Explicitly set to balanced mode on startup
  platform/x86: asus-wmi: Fix the name of the mic-mute LED classdev
  platform/surface: aggregator_registry: Add HID devices for sensors and UCSI client to SP8
  platform/surface: aggregator_registry: Rename HID device nodes based on new findings
  platform/surface: aggregator_registry: Rename HID device nodes based on their function
  platform/surface: aggregator_registry: Add support for Surface Laptop Go 2
  platform/x86: x86-android-tablets: Fix broken touchscreen on Chuwi Hi8 with Windows BIOS
  platform/x86: pmc_atom: Fix SLP_TYPx bitfield mask
parents cf3488fa 647e82db
...@@ -460,8 +460,6 @@ static int mlxreg_lc_power_on_off(struct mlxreg_lc *mlxreg_lc, u8 action) ...@@ -460,8 +460,6 @@ static int mlxreg_lc_power_on_off(struct mlxreg_lc *mlxreg_lc, u8 action)
u32 regval; u32 regval;
int err; int err;
mutex_lock(&mlxreg_lc->lock);
err = regmap_read(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_pwr, &regval); err = regmap_read(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_pwr, &regval);
if (err) if (err)
goto regmap_read_fail; goto regmap_read_fail;
...@@ -474,7 +472,6 @@ static int mlxreg_lc_power_on_off(struct mlxreg_lc *mlxreg_lc, u8 action) ...@@ -474,7 +472,6 @@ static int mlxreg_lc_power_on_off(struct mlxreg_lc *mlxreg_lc, u8 action)
err = regmap_write(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_pwr, regval); err = regmap_write(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_pwr, regval);
regmap_read_fail: regmap_read_fail:
mutex_unlock(&mlxreg_lc->lock);
return err; return err;
} }
...@@ -491,8 +488,6 @@ static int mlxreg_lc_enable_disable(struct mlxreg_lc *mlxreg_lc, bool action) ...@@ -491,8 +488,6 @@ static int mlxreg_lc_enable_disable(struct mlxreg_lc *mlxreg_lc, bool action)
* line card which is already has been enabled. Disabling does not affect the disabled line * line card which is already has been enabled. Disabling does not affect the disabled line
* card. * card.
*/ */
mutex_lock(&mlxreg_lc->lock);
err = regmap_read(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_ena, &regval); err = regmap_read(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_ena, &regval);
if (err) if (err)
goto regmap_read_fail; goto regmap_read_fail;
...@@ -505,7 +500,6 @@ static int mlxreg_lc_enable_disable(struct mlxreg_lc *mlxreg_lc, bool action) ...@@ -505,7 +500,6 @@ static int mlxreg_lc_enable_disable(struct mlxreg_lc *mlxreg_lc, bool action)
err = regmap_write(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_ena, regval); err = regmap_write(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_ena, regval);
regmap_read_fail: regmap_read_fail:
mutex_unlock(&mlxreg_lc->lock);
return err; return err;
} }
...@@ -537,6 +531,15 @@ mlxreg_lc_sn4800_c16_config_init(struct mlxreg_lc *mlxreg_lc, void *regmap, ...@@ -537,6 +531,15 @@ mlxreg_lc_sn4800_c16_config_init(struct mlxreg_lc *mlxreg_lc, void *regmap,
static void static void
mlxreg_lc_state_update(struct mlxreg_lc *mlxreg_lc, enum mlxreg_lc_state state, u8 action) mlxreg_lc_state_update(struct mlxreg_lc *mlxreg_lc, enum mlxreg_lc_state state, u8 action)
{
if (action)
mlxreg_lc->state |= state;
else
mlxreg_lc->state &= ~state;
}
static void
mlxreg_lc_state_update_locked(struct mlxreg_lc *mlxreg_lc, enum mlxreg_lc_state state, u8 action)
{ {
mutex_lock(&mlxreg_lc->lock); mutex_lock(&mlxreg_lc->lock);
...@@ -560,8 +563,11 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, ...@@ -560,8 +563,11 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind,
dev_info(mlxreg_lc->dev, "linecard#%d state %d event kind %d action %d\n", dev_info(mlxreg_lc->dev, "linecard#%d state %d event kind %d action %d\n",
mlxreg_lc->data->slot, mlxreg_lc->state, kind, action); mlxreg_lc->data->slot, mlxreg_lc->state, kind, action);
if (!(mlxreg_lc->state & MLXREG_LC_INITIALIZED)) mutex_lock(&mlxreg_lc->lock);
if (!(mlxreg_lc->state & MLXREG_LC_INITIALIZED)) {
mutex_unlock(&mlxreg_lc->lock);
return 0; return 0;
}
switch (kind) { switch (kind) {
case MLXREG_HOTPLUG_LC_SYNCED: case MLXREG_HOTPLUG_LC_SYNCED:
...@@ -574,7 +580,7 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, ...@@ -574,7 +580,7 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind,
if (!(mlxreg_lc->state & MLXREG_LC_POWERED) && action) { if (!(mlxreg_lc->state & MLXREG_LC_POWERED) && action) {
err = mlxreg_lc_power_on_off(mlxreg_lc, 1); err = mlxreg_lc_power_on_off(mlxreg_lc, 1);
if (err) if (err)
return err; goto mlxreg_lc_power_on_off_fail;
} }
/* In case line card is configured - enable it. */ /* In case line card is configured - enable it. */
if (mlxreg_lc->state & MLXREG_LC_CONFIGURED && action) if (mlxreg_lc->state & MLXREG_LC_CONFIGURED && action)
...@@ -588,12 +594,13 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, ...@@ -588,12 +594,13 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind,
/* In case line card is configured - enable it. */ /* In case line card is configured - enable it. */
if (mlxreg_lc->state & MLXREG_LC_CONFIGURED) if (mlxreg_lc->state & MLXREG_LC_CONFIGURED)
err = mlxreg_lc_enable_disable(mlxreg_lc, 1); err = mlxreg_lc_enable_disable(mlxreg_lc, 1);
mutex_unlock(&mlxreg_lc->lock);
return err; return err;
} }
err = mlxreg_lc_create_static_devices(mlxreg_lc, mlxreg_lc->main_devs, err = mlxreg_lc_create_static_devices(mlxreg_lc, mlxreg_lc->main_devs,
mlxreg_lc->main_devs_num); mlxreg_lc->main_devs_num);
if (err) if (err)
return err; goto mlxreg_lc_create_static_devices_fail;
/* In case line card is already in ready state - enable it. */ /* In case line card is already in ready state - enable it. */
if (mlxreg_lc->state & MLXREG_LC_CONFIGURED) if (mlxreg_lc->state & MLXREG_LC_CONFIGURED)
...@@ -620,6 +627,10 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, ...@@ -620,6 +627,10 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind,
break; break;
} }
mlxreg_lc_power_on_off_fail:
mlxreg_lc_create_static_devices_fail:
mutex_unlock(&mlxreg_lc->lock);
return err; return err;
} }
...@@ -665,7 +676,7 @@ static int mlxreg_lc_completion_notify(void *handle, struct i2c_adapter *parent, ...@@ -665,7 +676,7 @@ static int mlxreg_lc_completion_notify(void *handle, struct i2c_adapter *parent,
if (err) if (err)
goto mlxreg_lc_create_static_devices_failed; goto mlxreg_lc_create_static_devices_failed;
mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_POWERED, 1); mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_POWERED, 1);
} }
/* Verify if line card is synchronized. */ /* Verify if line card is synchronized. */
...@@ -676,7 +687,7 @@ static int mlxreg_lc_completion_notify(void *handle, struct i2c_adapter *parent, ...@@ -676,7 +687,7 @@ static int mlxreg_lc_completion_notify(void *handle, struct i2c_adapter *parent,
/* Power on line card if necessary. */ /* Power on line card if necessary. */
if (regval & mlxreg_lc->data->mask) { if (regval & mlxreg_lc->data->mask) {
mlxreg_lc->state |= MLXREG_LC_SYNCED; mlxreg_lc->state |= MLXREG_LC_SYNCED;
mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_SYNCED, 1); mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_SYNCED, 1);
if (mlxreg_lc->state & ~MLXREG_LC_POWERED) { if (mlxreg_lc->state & ~MLXREG_LC_POWERED) {
err = mlxreg_lc_power_on_off(mlxreg_lc, 1); err = mlxreg_lc_power_on_off(mlxreg_lc, 1);
if (err) if (err)
...@@ -684,7 +695,7 @@ static int mlxreg_lc_completion_notify(void *handle, struct i2c_adapter *parent, ...@@ -684,7 +695,7 @@ static int mlxreg_lc_completion_notify(void *handle, struct i2c_adapter *parent,
} }
} }
mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_INITIALIZED, 1); mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_INITIALIZED, 1);
return 0; return 0;
...@@ -814,10 +825,9 @@ static int mlxreg_lc_probe(struct platform_device *pdev) ...@@ -814,10 +825,9 @@ static int mlxreg_lc_probe(struct platform_device *pdev)
mutex_init(&mlxreg_lc->lock); mutex_init(&mlxreg_lc->lock);
/* Set event notification callback. */ /* Set event notification callback. */
if (data->notifier) { data->notifier->user_handler = mlxreg_lc_event_handler;
data->notifier->user_handler = mlxreg_lc_event_handler; data->notifier->handle = mlxreg_lc;
data->notifier->handle = mlxreg_lc;
}
data->hpdev.adapter = i2c_get_adapter(data->hpdev.nr); data->hpdev.adapter = i2c_get_adapter(data->hpdev.nr);
if (!data->hpdev.adapter) { if (!data->hpdev.adapter) {
dev_err(&pdev->dev, "Failed to get adapter for bus %d\n", dev_err(&pdev->dev, "Failed to get adapter for bus %d\n",
...@@ -863,7 +873,6 @@ static int mlxreg_lc_probe(struct platform_device *pdev) ...@@ -863,7 +873,6 @@ static int mlxreg_lc_probe(struct platform_device *pdev)
if (err) { if (err) {
dev_err(&pdev->dev, "Failed to sync regmap for client %s at bus %d at addr 0x%02x\n", dev_err(&pdev->dev, "Failed to sync regmap for client %s at bus %d at addr 0x%02x\n",
data->hpdev.brdinfo->type, data->hpdev.nr, data->hpdev.brdinfo->addr); data->hpdev.brdinfo->type, data->hpdev.nr, data->hpdev.brdinfo->addr);
err = PTR_ERR(regmap);
goto regcache_sync_fail; goto regcache_sync_fail;
} }
...@@ -878,16 +887,14 @@ static int mlxreg_lc_probe(struct platform_device *pdev) ...@@ -878,16 +887,14 @@ static int mlxreg_lc_probe(struct platform_device *pdev)
if (err) if (err)
goto mlxreg_lc_config_init_fail; goto mlxreg_lc_config_init_fail;
return err; return 0;
mlxreg_lc_config_init_fail: mlxreg_lc_config_init_fail:
regcache_sync_fail: regcache_sync_fail:
regmap_write_fail: regmap_write_fail:
devm_regmap_init_i2c_fail: devm_regmap_init_i2c_fail:
if (data->hpdev.client) { i2c_unregister_device(data->hpdev.client);
i2c_unregister_device(data->hpdev.client); data->hpdev.client = NULL;
data->hpdev.client = NULL;
}
i2c_new_device_fail: i2c_new_device_fail:
i2c_put_adapter(data->hpdev.adapter); i2c_put_adapter(data->hpdev.adapter);
data->hpdev.adapter = NULL; data->hpdev.adapter = NULL;
...@@ -905,6 +912,8 @@ static int mlxreg_lc_remove(struct platform_device *pdev) ...@@ -905,6 +912,8 @@ static int mlxreg_lc_remove(struct platform_device *pdev)
struct mlxreg_core_data *data = dev_get_platdata(&pdev->dev); struct mlxreg_core_data *data = dev_get_platdata(&pdev->dev);
struct mlxreg_lc *mlxreg_lc = platform_get_drvdata(pdev); struct mlxreg_lc *mlxreg_lc = platform_get_drvdata(pdev);
mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_INITIALIZED, 0);
/* /*
* Probing and removing are invoked by hotplug events raised upon line card insertion and * Probing and removing are invoked by hotplug events raised upon line card insertion and
* removing. If probing procedure fails all data is cleared. However, hotplug event still * removing. If probing procedure fails all data is cleared. However, hotplug event still
......
...@@ -86,38 +86,38 @@ static const struct software_node ssam_node_bas_dtx = { ...@@ -86,38 +86,38 @@ static const struct software_node ssam_node_bas_dtx = {
.parent = &ssam_node_root, .parent = &ssam_node_root,
}; };
/* HID keyboard (TID1). */ /* HID keyboard (SAM, TID=1). */
static const struct software_node ssam_node_hid_tid1_keyboard = { static const struct software_node ssam_node_hid_sam_keyboard = {
.name = "ssam:01:15:01:01:00", .name = "ssam:01:15:01:01:00",
.parent = &ssam_node_root, .parent = &ssam_node_root,
}; };
/* HID pen stash (TID1; pen taken / stashed away evens). */ /* HID pen stash (SAM, TID=1; pen taken / stashed away evens). */
static const struct software_node ssam_node_hid_tid1_penstash = { static const struct software_node ssam_node_hid_sam_penstash = {
.name = "ssam:01:15:01:02:00", .name = "ssam:01:15:01:02:00",
.parent = &ssam_node_root, .parent = &ssam_node_root,
}; };
/* HID touchpad (TID1). */ /* HID touchpad (SAM, TID=1). */
static const struct software_node ssam_node_hid_tid1_touchpad = { static const struct software_node ssam_node_hid_sam_touchpad = {
.name = "ssam:01:15:01:03:00", .name = "ssam:01:15:01:03:00",
.parent = &ssam_node_root, .parent = &ssam_node_root,
}; };
/* HID device instance 6 (TID1, unknown HID device). */ /* HID device instance 6 (SAM, TID=1, HID sensor collection). */
static const struct software_node ssam_node_hid_tid1_iid6 = { static const struct software_node ssam_node_hid_sam_sensors = {
.name = "ssam:01:15:01:06:00", .name = "ssam:01:15:01:06:00",
.parent = &ssam_node_root, .parent = &ssam_node_root,
}; };
/* HID device instance 7 (TID1, unknown HID device). */ /* HID device instance 7 (SAM, TID=1, UCM UCSI HID client). */
static const struct software_node ssam_node_hid_tid1_iid7 = { static const struct software_node ssam_node_hid_sam_ucm_ucsi = {
.name = "ssam:01:15:01:07:00", .name = "ssam:01:15:01:07:00",
.parent = &ssam_node_root, .parent = &ssam_node_root,
}; };
/* HID system controls (TID1). */ /* HID system controls (SAM, TID=1). */
static const struct software_node ssam_node_hid_tid1_sysctrl = { static const struct software_node ssam_node_hid_sam_sysctrl = {
.name = "ssam:01:15:01:08:00", .name = "ssam:01:15:01:08:00",
.parent = &ssam_node_root, .parent = &ssam_node_root,
}; };
...@@ -182,8 +182,8 @@ static const struct software_node ssam_node_hid_kip_touchpad = { ...@@ -182,8 +182,8 @@ static const struct software_node ssam_node_hid_kip_touchpad = {
.parent = &ssam_node_hub_kip, .parent = &ssam_node_hub_kip,
}; };
/* HID device instance 5 (KIP hub, unknown HID device). */ /* HID device instance 5 (KIP hub, type-cover firmware update). */
static const struct software_node ssam_node_hid_kip_iid5 = { static const struct software_node ssam_node_hid_kip_fwupd = {
.name = "ssam:01:15:02:05:00", .name = "ssam:01:15:02:05:00",
.parent = &ssam_node_hub_kip, .parent = &ssam_node_hub_kip,
}; };
...@@ -241,12 +241,12 @@ static const struct software_node *ssam_node_group_sls[] = { ...@@ -241,12 +241,12 @@ static const struct software_node *ssam_node_group_sls[] = {
&ssam_node_bat_main, &ssam_node_bat_main,
&ssam_node_tmp_pprof, &ssam_node_tmp_pprof,
&ssam_node_pos_tablet_switch, &ssam_node_pos_tablet_switch,
&ssam_node_hid_tid1_keyboard, &ssam_node_hid_sam_keyboard,
&ssam_node_hid_tid1_penstash, &ssam_node_hid_sam_penstash,
&ssam_node_hid_tid1_touchpad, &ssam_node_hid_sam_touchpad,
&ssam_node_hid_tid1_iid6, &ssam_node_hid_sam_sensors,
&ssam_node_hid_tid1_iid7, &ssam_node_hid_sam_ucm_ucsi,
&ssam_node_hid_tid1_sysctrl, &ssam_node_hid_sam_sysctrl,
NULL, NULL,
}; };
...@@ -278,7 +278,9 @@ static const struct software_node *ssam_node_group_sp8[] = { ...@@ -278,7 +278,9 @@ static const struct software_node *ssam_node_group_sp8[] = {
&ssam_node_hid_kip_keyboard, &ssam_node_hid_kip_keyboard,
&ssam_node_hid_kip_penstash, &ssam_node_hid_kip_penstash,
&ssam_node_hid_kip_touchpad, &ssam_node_hid_kip_touchpad,
&ssam_node_hid_kip_iid5, &ssam_node_hid_kip_fwupd,
&ssam_node_hid_sam_sensors,
&ssam_node_hid_sam_ucm_ucsi,
NULL, NULL,
}; };
...@@ -325,6 +327,9 @@ static const struct acpi_device_id ssam_platform_hub_match[] = { ...@@ -325,6 +327,9 @@ static const struct acpi_device_id ssam_platform_hub_match[] = {
/* Surface Laptop Go 1 */ /* Surface Laptop Go 1 */
{ "MSHW0118", (unsigned long)ssam_node_group_slg1 }, { "MSHW0118", (unsigned long)ssam_node_group_slg1 },
/* Surface Laptop Go 2 */
{ "MSHW0290", (unsigned long)ssam_node_group_slg1 },
/* Surface Laptop Studio */ /* Surface Laptop Studio */
{ "MSHW0123", (unsigned long)ssam_node_group_sls }, { "MSHW0123", (unsigned long)ssam_node_group_sls },
......
...@@ -99,6 +99,7 @@ static const struct key_entry acer_wmi_keymap[] __initconst = { ...@@ -99,6 +99,7 @@ static const struct key_entry acer_wmi_keymap[] __initconst = {
{KE_KEY, 0x22, {KEY_PROG2} }, /* Arcade */ {KE_KEY, 0x22, {KEY_PROG2} }, /* Arcade */
{KE_KEY, 0x23, {KEY_PROG3} }, /* P_Key */ {KE_KEY, 0x23, {KEY_PROG3} }, /* P_Key */
{KE_KEY, 0x24, {KEY_PROG4} }, /* Social networking_Key */ {KE_KEY, 0x24, {KEY_PROG4} }, /* Social networking_Key */
{KE_KEY, 0x27, {KEY_HELP} },
{KE_KEY, 0x29, {KEY_PROG3} }, /* P_Key for TM8372 */ {KE_KEY, 0x29, {KEY_PROG3} }, /* P_Key for TM8372 */
{KE_IGNORE, 0x41, {KEY_MUTE} }, {KE_IGNORE, 0x41, {KEY_MUTE} },
{KE_IGNORE, 0x42, {KEY_PREVIOUSSONG} }, {KE_IGNORE, 0x42, {KEY_PREVIOUSSONG} },
...@@ -112,7 +113,13 @@ static const struct key_entry acer_wmi_keymap[] __initconst = { ...@@ -112,7 +113,13 @@ static const struct key_entry acer_wmi_keymap[] __initconst = {
{KE_IGNORE, 0x48, {KEY_VOLUMEUP} }, {KE_IGNORE, 0x48, {KEY_VOLUMEUP} },
{KE_IGNORE, 0x49, {KEY_VOLUMEDOWN} }, {KE_IGNORE, 0x49, {KEY_VOLUMEDOWN} },
{KE_IGNORE, 0x4a, {KEY_VOLUMEDOWN} }, {KE_IGNORE, 0x4a, {KEY_VOLUMEDOWN} },
{KE_IGNORE, 0x61, {KEY_SWITCHVIDEOMODE} }, /*
* 0x61 is KEY_SWITCHVIDEOMODE. Usually this is a duplicate input event
* with the "Video Bus" input device events. But sometimes it is not
* a dup. Map it to KEY_UNKNOWN instead of using KE_IGNORE so that
* udev/hwdb can override it on systems where it is not a dup.
*/
{KE_KEY, 0x61, {KEY_UNKNOWN} },
{KE_IGNORE, 0x62, {KEY_BRIGHTNESSUP} }, {KE_IGNORE, 0x62, {KEY_BRIGHTNESSUP} },
{KE_IGNORE, 0x63, {KEY_BRIGHTNESSDOWN} }, {KE_IGNORE, 0x63, {KEY_BRIGHTNESSDOWN} },
{KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */ {KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */
......
...@@ -107,7 +107,7 @@ module_param(fnlock_default, bool, 0444); ...@@ -107,7 +107,7 @@ module_param(fnlock_default, bool, 0444);
#define WMI_EVENT_MASK 0xFFFF #define WMI_EVENT_MASK 0xFFFF
#define FAN_CURVE_POINTS 8 #define FAN_CURVE_POINTS 8
#define FAN_CURVE_BUF_LEN (FAN_CURVE_POINTS * 2) #define FAN_CURVE_BUF_LEN 32
#define FAN_CURVE_DEV_CPU 0x00 #define FAN_CURVE_DEV_CPU 0x00
#define FAN_CURVE_DEV_GPU 0x01 #define FAN_CURVE_DEV_GPU 0x01
/* Mask to determine if setting temperature or percentage */ /* Mask to determine if setting temperature or percentage */
...@@ -1118,7 +1118,7 @@ static int asus_wmi_led_init(struct asus_wmi *asus) ...@@ -1118,7 +1118,7 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
} }
if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MICMUTE_LED)) { if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MICMUTE_LED)) {
asus->micmute_led.name = "asus::micmute"; asus->micmute_led.name = "platform::micmute";
asus->micmute_led.max_brightness = 1; asus->micmute_led.max_brightness = 1;
asus->micmute_led.brightness = ledtrig_audio_get(LED_AUDIO_MICMUTE); asus->micmute_led.brightness = ledtrig_audio_get(LED_AUDIO_MICMUTE);
asus->micmute_led.brightness_set_blocking = micmute_led_set; asus->micmute_led.brightness_set_blocking = micmute_led_set;
...@@ -2233,8 +2233,10 @@ static int fan_curve_get_factory_default(struct asus_wmi *asus, u32 fan_dev) ...@@ -2233,8 +2233,10 @@ static int fan_curve_get_factory_default(struct asus_wmi *asus, u32 fan_dev)
curves = &asus->custom_fan_curves[fan_idx]; curves = &asus->custom_fan_curves[fan_idx];
err = asus_wmi_evaluate_method_buf(asus->dsts_id, fan_dev, mode, buf, err = asus_wmi_evaluate_method_buf(asus->dsts_id, fan_dev, mode, buf,
FAN_CURVE_BUF_LEN); FAN_CURVE_BUF_LEN);
if (err) if (err) {
pr_warn("%s (0x%08x) failed: %d\n", __func__, fan_dev, err);
return err; return err;
}
fan_curve_copy_from_buf(curves, buf); fan_curve_copy_from_buf(curves, buf);
curves->device_id = fan_dev; curves->device_id = fan_dev;
...@@ -2252,9 +2254,6 @@ static int fan_curve_check_present(struct asus_wmi *asus, bool *available, ...@@ -2252,9 +2254,6 @@ static int fan_curve_check_present(struct asus_wmi *asus, bool *available,
err = fan_curve_get_factory_default(asus, fan_dev); err = fan_curve_get_factory_default(asus, fan_dev);
if (err) { if (err) {
pr_debug("fan_curve_get_factory_default(0x%08x) failed: %d\n",
fan_dev, err);
/* Don't cause probe to fail on devices without fan-curves */
return 0; return 0;
} }
......
...@@ -42,10 +42,24 @@ static int p2sb_get_devfn(unsigned int *devfn) ...@@ -42,10 +42,24 @@ static int p2sb_get_devfn(unsigned int *devfn)
return 0; return 0;
} }
/* Copy resource from the first BAR of the device in question */
static int p2sb_read_bar0(struct pci_dev *pdev, struct resource *mem) static int p2sb_read_bar0(struct pci_dev *pdev, struct resource *mem)
{ {
/* Copy resource from the first BAR of the device in question */ struct resource *bar0 = &pdev->resource[0];
*mem = pdev->resource[0];
/* Make sure we have no dangling pointers in the output */
memset(mem, 0, sizeof(*mem));
/*
* We copy only selected fields from the original resource.
* Because a PCI device will be removed soon, we may not use
* any allocated data, hence we may not copy any pointers.
*/
mem->start = bar0->start;
mem->end = bar0->end;
mem->flags = bar0->flags;
mem->desc = bar0->desc;
return 0; return 0;
} }
......
...@@ -232,7 +232,7 @@ static void pmc_power_off(void) ...@@ -232,7 +232,7 @@ static void pmc_power_off(void)
pm1_cnt_port = acpi_base_addr + PM1_CNT; pm1_cnt_port = acpi_base_addr + PM1_CNT;
pm1_cnt_value = inl(pm1_cnt_port); pm1_cnt_value = inl(pm1_cnt_port);
pm1_cnt_value &= SLEEP_TYPE_MASK; pm1_cnt_value &= ~SLEEP_TYPE_MASK;
pm1_cnt_value |= SLEEP_TYPE_S5; pm1_cnt_value |= SLEEP_TYPE_S5;
pm1_cnt_value |= SLEEP_ENABLE; pm1_cnt_value |= SLEEP_ENABLE;
......
...@@ -10592,10 +10592,9 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) ...@@ -10592,10 +10592,9 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm)
/* Ensure initial values are correct */ /* Ensure initial values are correct */
dytc_profile_refresh(); dytc_profile_refresh();
/* Set AMT correctly now we know current profile */ /* Workaround for https://bugzilla.kernel.org/show_bug.cgi?id=216347 */
if ((dytc_capabilities & BIT(DYTC_FC_PSC)) && if (dytc_capabilities & BIT(DYTC_FC_PSC))
(dytc_capabilities & BIT(DYTC_FC_AMT))) dytc_profile_set(NULL, PLATFORM_PROFILE_BALANCED);
dytc_control_amt(dytc_current_profile == PLATFORM_PROFILE_BALANCED);
return 0; return 0;
} }
......
...@@ -663,9 +663,23 @@ static const struct x86_i2c_client_info chuwi_hi8_i2c_clients[] __initconst = { ...@@ -663,9 +663,23 @@ static const struct x86_i2c_client_info chuwi_hi8_i2c_clients[] __initconst = {
}, },
}; };
static int __init chuwi_hi8_init(void)
{
/*
* Avoid the acpi_unregister_gsi() call in x86_acpi_irq_helper_get()
* breaking the touchscreen + logging various errors when the Windows
* BIOS is used.
*/
if (acpi_dev_present("MSSL0001", NULL, 1))
return -ENODEV;
return 0;
}
static const struct x86_dev_info chuwi_hi8_info __initconst = { static const struct x86_dev_info chuwi_hi8_info __initconst = {
.i2c_client_info = chuwi_hi8_i2c_clients, .i2c_client_info = chuwi_hi8_i2c_clients,
.i2c_client_count = ARRAY_SIZE(chuwi_hi8_i2c_clients), .i2c_client_count = ARRAY_SIZE(chuwi_hi8_i2c_clients),
.init = chuwi_hi8_init,
}; };
#define CZC_EC_EXTRA_PORT 0x68 #define CZC_EC_EXTRA_PORT 0x68
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#ifndef PMC_ATOM_H #ifndef PMC_ATOM_H
#define PMC_ATOM_H #define PMC_ATOM_H
#include <linux/bits.h>
/* ValleyView Power Control Unit PCI Device ID */ /* ValleyView Power Control Unit PCI Device ID */
#define PCI_DEVICE_ID_VLV_PMC 0x0F1C #define PCI_DEVICE_ID_VLV_PMC 0x0F1C
/* CherryTrail Power Control Unit PCI Device ID */ /* CherryTrail Power Control Unit PCI Device ID */
...@@ -139,9 +141,9 @@ ...@@ -139,9 +141,9 @@
#define ACPI_MMIO_REG_LEN 0x100 #define ACPI_MMIO_REG_LEN 0x100
#define PM1_CNT 0x4 #define PM1_CNT 0x4
#define SLEEP_TYPE_MASK 0xFFFFECFF #define SLEEP_TYPE_MASK GENMASK(12, 10)
#define SLEEP_TYPE_S5 0x1C00 #define SLEEP_TYPE_S5 0x1C00
#define SLEEP_ENABLE 0x2000 #define SLEEP_ENABLE BIT(13)
extern int pmc_atom_read(int offset, u32 *value); extern int pmc_atom_read(int offset, u32 *value);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment