From 5c51e06ab8f83f41c52a37a80eb76b5b1fad8421 Mon Sep 17 00:00:00 2001 From: Lekensteyn Date: Wed, 14 Dec 2011 18:21:43 +0100 Subject: [PATCH] bbswitch: Add more debugging messages --- bbswitch.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/bbswitch.c b/bbswitch.c index ec8e84f..99b09ab 100644 --- a/bbswitch.c +++ b/bbswitch.c @@ -142,7 +142,8 @@ static int bbswitch_optimus_dsm(void) { if (!acpi_call_dsm(dis_handle, acpi_optimus_dsm_muid, 0x100, 0x1A, args, &result)) { - printk(KERN_INFO "bbswitch: Result of _DSM call: %08X\n", result); + printk(KERN_INFO "bbswitch: Result of Optimus _DSM call: %08X\n", + result); return 0; } // failure @@ -159,7 +160,8 @@ static int bbswitch_acpi_off(void) { // failure return 1; } - printk(KERN_INFO "bbswitch: Result of _DSM call for OFF: %08X\n", result); + printk(KERN_INFO "bbswitch: Result of _DSM call for OFF: %08X\n", + result); } return 0; } @@ -174,7 +176,8 @@ static int bbswitch_acpi_on(void) { // failure return 1; } - printk(KERN_INFO "bbswitch: Result of _DSM call for ON: %08X\n", result); + printk(KERN_INFO "bbswitch: Result of _DSM call for ON: %08X\n", + result); } return 0; } @@ -215,7 +218,9 @@ static void bbswitch_off(void) { pci_disable_device(dis_dev); pci_set_power_state(dis_dev, PCI_D3hot); - bbswitch_acpi_off(); + if (!bbswitch_acpi_off()) + printk(KERN_WARNING "bbswitch: The discrete card could not be disabled" + " by a _DSM call\n"); } static void bbswitch_on(void) { @@ -224,7 +229,9 @@ static void bbswitch_on(void) { printk(KERN_INFO "bbswitch: enabling discrete graphics\n"); - bbswitch_acpi_on(); + if (!bbswitch_acpi_on()) + printk(KERN_WARNING "bbswitch: The discrete card could not be enabled" + " by a _DSM call\n"); pci_set_power_state(dis_dev, PCI_D0); pci_restore_state(dis_dev); @@ -320,8 +327,10 @@ static int __init bbswitch_init(void) { if (has_dsm_func(acpi_optimus_dsm_muid, 0x100, 0x1A)) { dsm_type = DSM_TYPE_OPTIMUS; + printk(KERN_INFO "bbswitch: detected an Optimus _DSM function\n"); } else if (has_dsm_func(acpi_nvidia_dsm_muid, 0x102, 0x3)) { dsm_type = DSM_TYPE_NVIDIA; + printk(KERN_INFO "bbswitch: detected a nVidia _DSM function\n"); } else { printk(KERN_ERR "bbswitch: No suitable _DSM call found.\n"); return -ENODEV;