Skip to content

Commit f965e5b

Browse files
flukejonesjwrdegoede
authored andcommitted
platform/x86: asus-wmi: add debug print in more key places
Add more verbose debug print in the WMI method calls. This helps a lot with debugging various issues working with regular users as the WMI methods can be traced now. Signed-off-by: Luke D. Jones <luke@ljones.dev> Link: https://lore.kernel.org/r/20240910050507.685069-1-luke@ljones.dev Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent 5f1cda5 commit f965e5b

1 file changed

Lines changed: 48 additions & 10 deletions

File tree

drivers/platform/x86/asus-wmi.c

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -354,20 +354,29 @@ static int asus_wmi_evaluate_method3(u32 method_id,
354354
status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID, 0, method_id,
355355
&input, &output);
356356

357-
if (ACPI_FAILURE(status))
357+
pr_debug("%s called (0x%08x) with args: 0x%08x, 0x%08x, 0x%08x\n",
358+
__func__, method_id, arg0, arg1, arg2);
359+
if (ACPI_FAILURE(status)) {
360+
pr_debug("%s, (0x%08x), arg 0x%08x failed: %d\n",
361+
__func__, method_id, arg0, -EIO);
358362
return -EIO;
363+
}
359364

360365
obj = (union acpi_object *)output.pointer;
361366
if (obj && obj->type == ACPI_TYPE_INTEGER)
362367
tmp = (u32) obj->integer.value;
363368

369+
pr_debug("Result: 0x%08x\n", tmp);
364370
if (retval)
365371
*retval = tmp;
366372

367373
kfree(obj);
368374

369-
if (tmp == ASUS_WMI_UNSUPPORTED_METHOD)
375+
if (tmp == ASUS_WMI_UNSUPPORTED_METHOD) {
376+
pr_debug("%s, (0x%08x), arg 0x%08x failed: %d\n",
377+
__func__, method_id, arg0, -ENODEV);
370378
return -ENODEV;
379+
}
371380

372381
return 0;
373382
}
@@ -397,20 +406,29 @@ static int asus_wmi_evaluate_method5(u32 method_id,
397406
status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID, 0, method_id,
398407
&input, &output);
399408

400-
if (ACPI_FAILURE(status))
409+
pr_debug("%s called (0x%08x) with args: 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x\n",
410+
__func__, method_id, arg0, arg1, arg2, arg3, arg4);
411+
if (ACPI_FAILURE(status)) {
412+
pr_debug("%s, (0x%08x), arg 0x%08x failed: %d\n",
413+
__func__, method_id, arg0, -EIO);
401414
return -EIO;
415+
}
402416

403417
obj = (union acpi_object *)output.pointer;
404418
if (obj && obj->type == ACPI_TYPE_INTEGER)
405419
tmp = (u32) obj->integer.value;
406420

421+
pr_debug("Result: %x\n", tmp);
407422
if (retval)
408423
*retval = tmp;
409424

410425
kfree(obj);
411426

412-
if (tmp == ASUS_WMI_UNSUPPORTED_METHOD)
427+
if (tmp == ASUS_WMI_UNSUPPORTED_METHOD) {
428+
pr_debug("%s, (0x%08x), arg 0x%08x failed: %d\n",
429+
__func__, method_id, arg0, -ENODEV);
413430
return -ENODEV;
431+
}
414432

415433
return 0;
416434
}
@@ -436,8 +454,13 @@ static int asus_wmi_evaluate_method_buf(u32 method_id,
436454
status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID, 0, method_id,
437455
&input, &output);
438456

439-
if (ACPI_FAILURE(status))
457+
pr_debug("%s called (0x%08x) with args: 0x%08x, 0x%08x\n",
458+
__func__, method_id, arg0, arg1);
459+
if (ACPI_FAILURE(status)) {
460+
pr_debug("%s, (0x%08x), arg 0x%08x failed: %d\n",
461+
__func__, method_id, arg0, -EIO);
440462
return -EIO;
463+
}
441464

442465
obj = (union acpi_object *)output.pointer;
443466

@@ -473,8 +496,11 @@ static int asus_wmi_evaluate_method_buf(u32 method_id,
473496

474497
kfree(obj);
475498

476-
if (err)
499+
if (err) {
500+
pr_debug("%s, (0x%08x), arg 0x%08x failed: %d\n",
501+
__func__, method_id, arg0, err);
477502
return err;
503+
}
478504

479505
return 0;
480506
}
@@ -562,6 +588,7 @@ static bool asus_wmi_dev_is_present(struct asus_wmi *asus, u32 dev_id)
562588
{
563589
u32 retval;
564590
int status = asus_wmi_get_devstate(asus, dev_id, &retval);
591+
pr_debug("%s called (0x%08x), retval: 0x%08x\n", __func__, dev_id, retval);
565592

566593
return status == 0 && (retval & ASUS_WMI_DSTS_PRESENCE_BIT);
567594
}
@@ -3617,18 +3644,27 @@ static int asus_wmi_custom_fan_curve_init(struct asus_wmi *asus)
36173644

36183645
err = fan_curve_check_present(asus, &asus->cpu_fan_curve_available,
36193646
ASUS_WMI_DEVID_CPU_FAN_CURVE);
3620-
if (err)
3647+
if (err) {
3648+
pr_debug("%s, checked 0x%08x, failed: %d\n",
3649+
__func__, ASUS_WMI_DEVID_CPU_FAN_CURVE, err);
36213650
return err;
3651+
}
36223652

36233653
err = fan_curve_check_present(asus, &asus->gpu_fan_curve_available,
36243654
ASUS_WMI_DEVID_GPU_FAN_CURVE);
3625-
if (err)
3655+
if (err) {
3656+
pr_debug("%s, checked 0x%08x, failed: %d\n",
3657+
__func__, ASUS_WMI_DEVID_GPU_FAN_CURVE, err);
36263658
return err;
3659+
}
36273660

36283661
err = fan_curve_check_present(asus, &asus->mid_fan_curve_available,
36293662
ASUS_WMI_DEVID_MID_FAN_CURVE);
3630-
if (err)
3663+
if (err) {
3664+
pr_debug("%s, checked 0x%08x, failed: %d\n",
3665+
__func__, ASUS_WMI_DEVID_MID_FAN_CURVE, err);
36313666
return err;
3667+
}
36323668

36333669
if (!asus->cpu_fan_curve_available
36343670
&& !asus->gpu_fan_curve_available
@@ -4459,8 +4495,10 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj,
44594495
else if (attr == &dev_attr_available_mini_led_mode.attr)
44604496
ok = asus->mini_led_dev_id != 0;
44614497

4462-
if (devid != -1)
4498+
if (devid != -1) {
44634499
ok = !(asus_wmi_get_devstate_simple(asus, devid) < 0);
4500+
pr_debug("%s called 0x%08x, ok: %x\n", __func__, devid, ok);
4501+
}
44644502

44654503
return ok ? attr->mode : 0;
44664504
}

0 commit comments

Comments
 (0)