Skip to content

Commit 0a8db05

Browse files
committed
Merge tag 'platform-drivers-x86-v6.5-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform driver fixes from Hans de Goede: "Misc small fixes and hw-id additions" * tag 'platform-drivers-x86-v6.5-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: platform/x86: huawei-wmi: Silence ambient light sensor platform/x86: msi-laptop: Fix rfkill out-of-sync on MSI Wind U100 platform/x86: asus-wmi: Fix setting RGB mode on some TUF laptops platform/x86: think-lmi: Use kfree_sensitive instead of kfree platform/x86/intel/hid: Add HP Dragonfly G2 to VGBS DMI quirks platform/x86: intel: hid: Always call BTNL ACPI method platform/x86/amd/pmf: Notify OS power slider update platform/x86/amd/pmf: reduce verbosity of apmf_get_system_params platform/x86: serial-multi-instantiate: Auto detect IRQ resource for CSC3551 platform/x86/amd: pmc: Use release_mem_region() to undo request_mem_region_muxed() platform/x86: touchscreen_dmi.c: small changes for Archos 101 Cesium Educ tablet
2 parents f40125c + c217337 commit 0a8db05

File tree

12 files changed

+173
-40
lines changed

12 files changed

+173
-40
lines changed

drivers/platform/x86/amd/pmc-quirks.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <linux/dmi.h>
1212
#include <linux/io.h>
1313
#include <linux/ioport.h>
14-
#include <linux/slab.h>
1514

1615
#include "pmc.h"
1716

@@ -135,12 +134,10 @@ static const struct dmi_system_id fwbug_list[] = {
135134
*/
136135
static void amd_pmc_skip_nvme_smi_handler(u32 s2idle_bug_mmio)
137136
{
138-
struct resource *res;
139137
void __iomem *addr;
140138
u8 val;
141139

142-
res = request_mem_region_muxed(s2idle_bug_mmio, 1, "amd_pmc_pm80");
143-
if (!res)
140+
if (!request_mem_region_muxed(s2idle_bug_mmio, 1, "amd_pmc_pm80"))
144141
return;
145142

146143
addr = ioremap(s2idle_bug_mmio, 1);
@@ -152,8 +149,7 @@ static void amd_pmc_skip_nvme_smi_handler(u32 s2idle_bug_mmio)
152149

153150
iounmap(addr);
154151
cleanup_resource:
155-
release_resource(res);
156-
kfree(res);
152+
release_mem_region(s2idle_bug_mmio, 1);
157153
}
158154

159155
void amd_pmc_process_restore_quirks(struct amd_pmc_dev *dev)

drivers/platform/x86/amd/pmf/acpi.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,27 @@ int apmf_get_static_slider_granular(struct amd_pmf_dev *pdev,
106106
data, sizeof(*data));
107107
}
108108

109+
int apmf_os_power_slider_update(struct amd_pmf_dev *pdev, u8 event)
110+
{
111+
struct os_power_slider args;
112+
struct acpi_buffer params;
113+
union acpi_object *info;
114+
int err = 0;
115+
116+
args.size = sizeof(args);
117+
args.slider_event = event;
118+
119+
params.length = sizeof(args);
120+
params.pointer = (void *)&args;
121+
122+
info = apmf_if_call(pdev, APMF_FUNC_OS_POWER_SLIDER_UPDATE, &params);
123+
if (!info)
124+
err = -EIO;
125+
126+
kfree(info);
127+
return err;
128+
}
129+
109130
static void apmf_sbios_heartbeat_notify(struct work_struct *work)
110131
{
111132
struct amd_pmf_dev *dev = container_of(work, struct amd_pmf_dev, heart_beat.work);
@@ -289,7 +310,7 @@ int apmf_acpi_init(struct amd_pmf_dev *pmf_dev)
289310

290311
ret = apmf_get_system_params(pmf_dev);
291312
if (ret) {
292-
dev_err(pmf_dev->dev, "APMF apmf_get_system_params failed :%d\n", ret);
313+
dev_dbg(pmf_dev->dev, "APMF apmf_get_system_params failed :%d\n", ret);
293314
goto out;
294315
}
295316

drivers/platform/x86/amd/pmf/core.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ static int amd_pmf_pwr_src_notify_call(struct notifier_block *nb, unsigned long
7272
return NOTIFY_DONE;
7373
}
7474

75-
amd_pmf_set_sps_power_limits(pmf);
75+
if (is_apmf_func_supported(pmf, APMF_FUNC_STATIC_SLIDER_GRANULAR))
76+
amd_pmf_set_sps_power_limits(pmf);
77+
78+
if (is_apmf_func_supported(pmf, APMF_FUNC_OS_POWER_SLIDER_UPDATE))
79+
amd_pmf_power_slider_update_event(pmf);
7680

7781
return NOTIFY_OK;
7882
}
@@ -297,7 +301,8 @@ static void amd_pmf_init_features(struct amd_pmf_dev *dev)
297301
int ret;
298302

299303
/* Enable Static Slider */
300-
if (is_apmf_func_supported(dev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) {
304+
if (is_apmf_func_supported(dev, APMF_FUNC_STATIC_SLIDER_GRANULAR) ||
305+
is_apmf_func_supported(dev, APMF_FUNC_OS_POWER_SLIDER_UPDATE)) {
301306
amd_pmf_init_sps(dev);
302307
dev->pwr_src_notifier.notifier_call = amd_pmf_pwr_src_notify_call;
303308
power_supply_reg_notifier(&dev->pwr_src_notifier);

drivers/platform/x86/amd/pmf/pmf.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define APMF_FUNC_SBIOS_HEARTBEAT 4
2222
#define APMF_FUNC_AUTO_MODE 5
2323
#define APMF_FUNC_SET_FAN_IDX 7
24+
#define APMF_FUNC_OS_POWER_SLIDER_UPDATE 8
2425
#define APMF_FUNC_STATIC_SLIDER_GRANULAR 9
2526
#define APMF_FUNC_DYN_SLIDER_AC 11
2627
#define APMF_FUNC_DYN_SLIDER_DC 12
@@ -44,6 +45,14 @@
4445
#define GET_STT_LIMIT_APU 0x20
4546
#define GET_STT_LIMIT_HS2 0x21
4647

48+
/* OS slider update notification */
49+
#define DC_BEST_PERF 0
50+
#define DC_BETTER_PERF 1
51+
#define DC_BATTERY_SAVER 3
52+
#define AC_BEST_PERF 4
53+
#define AC_BETTER_PERF 5
54+
#define AC_BETTER_BATTERY 6
55+
4756
/* Fan Index for Auto Mode */
4857
#define FAN_INDEX_AUTO 0xFFFFFFFF
4958

@@ -193,6 +202,11 @@ struct amd_pmf_static_slider_granular {
193202
struct apmf_sps_prop_granular prop[POWER_SOURCE_MAX][POWER_MODE_MAX];
194203
};
195204

205+
struct os_power_slider {
206+
u16 size;
207+
u8 slider_event;
208+
} __packed;
209+
196210
struct fan_table_control {
197211
bool manual;
198212
unsigned long fan_id;
@@ -383,6 +397,7 @@ int amd_pmf_send_cmd(struct amd_pmf_dev *dev, u8 message, bool get, u32 arg, u32
383397
int amd_pmf_init_metrics_table(struct amd_pmf_dev *dev);
384398
int amd_pmf_get_power_source(void);
385399
int apmf_install_handler(struct amd_pmf_dev *pmf_dev);
400+
int apmf_os_power_slider_update(struct amd_pmf_dev *dev, u8 flag);
386401

387402
/* SPS Layer */
388403
int amd_pmf_get_pprof_modes(struct amd_pmf_dev *pmf);
@@ -393,6 +408,7 @@ void amd_pmf_deinit_sps(struct amd_pmf_dev *dev);
393408
int apmf_get_static_slider_granular(struct amd_pmf_dev *pdev,
394409
struct apmf_static_slider_granular_output *output);
395410
bool is_pprof_balanced(struct amd_pmf_dev *pmf);
411+
int amd_pmf_power_slider_update_event(struct amd_pmf_dev *dev);
396412

397413

398414
int apmf_update_fan_idx(struct amd_pmf_dev *pdev, bool manual, u32 idx);

drivers/platform/x86/amd/pmf/sps.c

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,25 +174,91 @@ int amd_pmf_get_pprof_modes(struct amd_pmf_dev *pmf)
174174
return mode;
175175
}
176176

177+
int amd_pmf_power_slider_update_event(struct amd_pmf_dev *dev)
178+
{
179+
u8 mode, flag = 0;
180+
int src;
181+
182+
mode = amd_pmf_get_pprof_modes(dev);
183+
if (mode < 0)
184+
return mode;
185+
186+
src = amd_pmf_get_power_source();
187+
188+
if (src == POWER_SOURCE_AC) {
189+
switch (mode) {
190+
case POWER_MODE_PERFORMANCE:
191+
flag |= BIT(AC_BEST_PERF);
192+
break;
193+
case POWER_MODE_BALANCED_POWER:
194+
flag |= BIT(AC_BETTER_PERF);
195+
break;
196+
case POWER_MODE_POWER_SAVER:
197+
flag |= BIT(AC_BETTER_BATTERY);
198+
break;
199+
default:
200+
dev_err(dev->dev, "unsupported platform profile\n");
201+
return -EOPNOTSUPP;
202+
}
203+
204+
} else if (src == POWER_SOURCE_DC) {
205+
switch (mode) {
206+
case POWER_MODE_PERFORMANCE:
207+
flag |= BIT(DC_BEST_PERF);
208+
break;
209+
case POWER_MODE_BALANCED_POWER:
210+
flag |= BIT(DC_BETTER_PERF);
211+
break;
212+
case POWER_MODE_POWER_SAVER:
213+
flag |= BIT(DC_BATTERY_SAVER);
214+
break;
215+
default:
216+
dev_err(dev->dev, "unsupported platform profile\n");
217+
return -EOPNOTSUPP;
218+
}
219+
}
220+
221+
apmf_os_power_slider_update(dev, flag);
222+
223+
return 0;
224+
}
225+
177226
static int amd_pmf_profile_set(struct platform_profile_handler *pprof,
178227
enum platform_profile_option profile)
179228
{
180229
struct amd_pmf_dev *pmf = container_of(pprof, struct amd_pmf_dev, pprof);
230+
int ret = 0;
181231

182232
pmf->current_profile = profile;
183233

184-
return amd_pmf_set_sps_power_limits(pmf);
234+
/* Notify EC about the slider position change */
235+
if (is_apmf_func_supported(pmf, APMF_FUNC_OS_POWER_SLIDER_UPDATE)) {
236+
ret = amd_pmf_power_slider_update_event(pmf);
237+
if (ret)
238+
return ret;
239+
}
240+
241+
if (is_apmf_func_supported(pmf, APMF_FUNC_STATIC_SLIDER_GRANULAR)) {
242+
ret = amd_pmf_set_sps_power_limits(pmf);
243+
if (ret)
244+
return ret;
245+
}
246+
247+
return 0;
185248
}
186249

187250
int amd_pmf_init_sps(struct amd_pmf_dev *dev)
188251
{
189252
int err;
190253

191254
dev->current_profile = PLATFORM_PROFILE_BALANCED;
192-
amd_pmf_load_defaults_sps(dev);
193255

194-
/* update SPS balanced power mode thermals */
195-
amd_pmf_set_sps_power_limits(dev);
256+
if (is_apmf_func_supported(dev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) {
257+
amd_pmf_load_defaults_sps(dev);
258+
259+
/* update SPS balanced power mode thermals */
260+
amd_pmf_set_sps_power_limits(dev);
261+
}
196262

197263
dev->pprof.profile_get = amd_pmf_profile_get;
198264
dev->pprof.profile_set = amd_pmf_profile_set;

drivers/platform/x86/asus-wmi.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,13 +738,23 @@ static ssize_t kbd_rgb_mode_store(struct device *dev,
738738
struct device_attribute *attr,
739739
const char *buf, size_t count)
740740
{
741-
u32 cmd, mode, r, g, b, speed;
741+
u32 cmd, mode, r, g, b, speed;
742742
int err;
743743

744744
if (sscanf(buf, "%d %d %d %d %d %d", &cmd, &mode, &r, &g, &b, &speed) != 6)
745745
return -EINVAL;
746746

747-
cmd = !!cmd;
747+
/* B3 is set and B4 is save to BIOS */
748+
switch (cmd) {
749+
case 0:
750+
cmd = 0xb3;
751+
break;
752+
case 1:
753+
cmd = 0xb4;
754+
break;
755+
default:
756+
return -EINVAL;
757+
}
748758

749759
/* These are the known usable modes across all TUF/ROG */
750760
if (mode >= 12 || mode == 9)

drivers/platform/x86/huawei-wmi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ static const struct key_entry huawei_wmi_keymap[] = {
8585
{ KE_IGNORE, 0x293, { KEY_KBDILLUMTOGGLE } },
8686
{ KE_IGNORE, 0x294, { KEY_KBDILLUMUP } },
8787
{ KE_IGNORE, 0x295, { KEY_KBDILLUMUP } },
88+
// Ignore Ambient Light Sensoring
89+
{ KE_KEY, 0x2c1, { KEY_RESERVED } },
8890
{ KE_END, 0 }
8991
};
9092

drivers/platform/x86/intel/hid.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ static const struct dmi_system_id dmi_vgbs_allow_list[] = {
150150
DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go"),
151151
},
152152
},
153+
{
154+
.matches = {
155+
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
156+
DMI_MATCH(DMI_PRODUCT_NAME, "HP Elite Dragonfly G2 Notebook PC"),
157+
},
158+
},
153159
{ }
154160
};
155161

@@ -620,7 +626,7 @@ static bool button_array_present(struct platform_device *device)
620626
static int intel_hid_probe(struct platform_device *device)
621627
{
622628
acpi_handle handle = ACPI_HANDLE(&device->dev);
623-
unsigned long long mode;
629+
unsigned long long mode, dummy;
624630
struct intel_hid_priv *priv;
625631
acpi_status status;
626632
int err;
@@ -692,18 +698,15 @@ static int intel_hid_probe(struct platform_device *device)
692698
if (err)
693699
goto err_remove_notify;
694700

695-
if (priv->array) {
696-
unsigned long long dummy;
701+
intel_button_array_enable(&device->dev, true);
697702

698-
intel_button_array_enable(&device->dev, true);
699-
700-
/* Call button load method to enable HID power button */
701-
if (!intel_hid_evaluate_method(handle, INTEL_HID_DSM_BTNL_FN,
702-
&dummy)) {
703-
dev_warn(&device->dev,
704-
"failed to enable HID power button\n");
705-
}
706-
}
703+
/*
704+
* Call button load method to enable HID power button
705+
* Always do this since it activates events on some devices without
706+
* a button array too.
707+
*/
708+
if (!intel_hid_evaluate_method(handle, INTEL_HID_DSM_BTNL_FN, &dummy))
709+
dev_warn(&device->dev, "failed to enable HID power button\n");
707710

708711
device_init_wakeup(&device->dev, true);
709712
/*

drivers/platform/x86/msi-laptop.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static ssize_t set_device_state(const char *buf, size_t count, u8 mask)
208208
return -EINVAL;
209209

210210
if (quirks->ec_read_only)
211-
return -EOPNOTSUPP;
211+
return 0;
212212

213213
/* read current device state */
214214
result = ec_read(MSI_STANDARD_EC_COMMAND_ADDRESS, &rdata);
@@ -838,15 +838,15 @@ static bool msi_laptop_i8042_filter(unsigned char data, unsigned char str,
838838
static void msi_init_rfkill(struct work_struct *ignored)
839839
{
840840
if (rfk_wlan) {
841-
rfkill_set_sw_state(rfk_wlan, !wlan_s);
841+
msi_rfkill_set_state(rfk_wlan, !wlan_s);
842842
rfkill_wlan_set(NULL, !wlan_s);
843843
}
844844
if (rfk_bluetooth) {
845-
rfkill_set_sw_state(rfk_bluetooth, !bluetooth_s);
845+
msi_rfkill_set_state(rfk_bluetooth, !bluetooth_s);
846846
rfkill_bluetooth_set(NULL, !bluetooth_s);
847847
}
848848
if (rfk_threeg) {
849-
rfkill_set_sw_state(rfk_threeg, !threeg_s);
849+
msi_rfkill_set_state(rfk_threeg, !threeg_s);
850850
rfkill_threeg_set(NULL, !threeg_s);
851851
}
852852
}

drivers/platform/x86/serial-multi-instantiate.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define IRQ_RESOURCE_NONE 0
2222
#define IRQ_RESOURCE_GPIO 1
2323
#define IRQ_RESOURCE_APIC 2
24+
#define IRQ_RESOURCE_AUTO 3
2425

2526
enum smi_bus_type {
2627
SMI_I2C,
@@ -52,6 +53,18 @@ static int smi_get_irq(struct platform_device *pdev, struct acpi_device *adev,
5253
int ret;
5354

5455
switch (inst->flags & IRQ_RESOURCE_TYPE) {
56+
case IRQ_RESOURCE_AUTO:
57+
ret = acpi_dev_gpio_irq_get(adev, inst->irq_idx);
58+
if (ret > 0) {
59+
dev_dbg(&pdev->dev, "Using gpio irq\n");
60+
break;
61+
}
62+
ret = platform_get_irq(pdev, inst->irq_idx);
63+
if (ret > 0) {
64+
dev_dbg(&pdev->dev, "Using platform irq\n");
65+
break;
66+
}
67+
break;
5568
case IRQ_RESOURCE_GPIO:
5669
ret = acpi_dev_gpio_irq_get(adev, inst->irq_idx);
5770
break;
@@ -307,10 +320,10 @@ static const struct smi_node int3515_data = {
307320

308321
static const struct smi_node cs35l41_hda = {
309322
.instances = {
310-
{ "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 },
311-
{ "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 },
312-
{ "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 },
313-
{ "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 },
323+
{ "cs35l41-hda", IRQ_RESOURCE_AUTO, 0 },
324+
{ "cs35l41-hda", IRQ_RESOURCE_AUTO, 0 },
325+
{ "cs35l41-hda", IRQ_RESOURCE_AUTO, 0 },
326+
{ "cs35l41-hda", IRQ_RESOURCE_AUTO, 0 },
314327
{}
315328
},
316329
.bus_type = SMI_AUTO_DETECT,

0 commit comments

Comments
 (0)