@@ -5015,30 +5015,46 @@ static int asus_hotk_restore(struct device *device)
5015
5015
return 0 ;
5016
5016
}
5017
5017
5018
- static void asus_ally_s2idle_restore ( void )
5018
+ static int asus_hotk_prepare ( struct device * device )
5019
5019
{
5020
5020
if (use_ally_mcu_hack == ASUS_WMI_ALLY_MCU_HACK_ENABLED ) {
5021
5021
acpi_execute_simple_method (NULL , ASUS_USB0_PWR_EC0_CSEE ,
5022
- ASUS_USB0_PWR_EC0_CSEE_ON );
5022
+ ASUS_USB0_PWR_EC0_CSEE_OFF );
5023
5023
msleep (ASUS_USB0_PWR_EC0_CSEE_WAIT );
5024
5024
}
5025
+ return 0 ;
5025
5026
}
5026
5027
5027
- static int asus_hotk_prepare (struct device * device )
5028
+ #if defined(CONFIG_SUSPEND )
5029
+ static void asus_ally_s2idle_restore (void )
5028
5030
{
5029
5031
if (use_ally_mcu_hack == ASUS_WMI_ALLY_MCU_HACK_ENABLED ) {
5030
5032
acpi_execute_simple_method (NULL , ASUS_USB0_PWR_EC0_CSEE ,
5031
- ASUS_USB0_PWR_EC0_CSEE_OFF );
5033
+ ASUS_USB0_PWR_EC0_CSEE_ON );
5032
5034
msleep (ASUS_USB0_PWR_EC0_CSEE_WAIT );
5033
5035
}
5034
- return 0 ;
5035
5036
}
5036
5037
5037
5038
/* Use only for Ally devices due to the wake_on_ac */
5038
5039
static struct acpi_s2idle_dev_ops asus_ally_s2idle_dev_ops = {
5039
5040
.restore = asus_ally_s2idle_restore ,
5040
5041
};
5041
5042
5043
+ static void asus_s2idle_check_register (void )
5044
+ {
5045
+ if (acpi_register_lps0_dev (& asus_ally_s2idle_dev_ops ))
5046
+ pr_warn ("failed to register LPS0 sleep handler in asus-wmi\n" );
5047
+ }
5048
+
5049
+ static void asus_s2idle_check_unregister (void )
5050
+ {
5051
+ acpi_unregister_lps0_dev (& asus_ally_s2idle_dev_ops );
5052
+ }
5053
+ #else
5054
+ static void asus_s2idle_check_register (void ) {}
5055
+ static void asus_s2idle_check_unregister (void ) {}
5056
+ #endif /* CONFIG_SUSPEND */
5057
+
5042
5058
static const struct dev_pm_ops asus_pm_ops = {
5043
5059
.thaw = asus_hotk_thaw ,
5044
5060
.restore = asus_hotk_restore ,
@@ -5070,9 +5086,7 @@ static int asus_wmi_probe(struct platform_device *pdev)
5070
5086
return ret ;
5071
5087
}
5072
5088
5073
- ret = acpi_register_lps0_dev (& asus_ally_s2idle_dev_ops );
5074
- if (ret )
5075
- pr_warn ("failed to register LPS0 sleep handler in asus-wmi\n" );
5089
+ asus_s2idle_check_register ();
5076
5090
5077
5091
return asus_wmi_add (pdev );
5078
5092
}
@@ -5106,7 +5120,8 @@ EXPORT_SYMBOL_GPL(asus_wmi_register_driver);
5106
5120
5107
5121
void asus_wmi_unregister_driver (struct asus_wmi_driver * driver )
5108
5122
{
5109
- acpi_unregister_lps0_dev (& asus_ally_s2idle_dev_ops );
5123
+ asus_s2idle_check_unregister ();
5124
+
5110
5125
platform_device_unregister (driver -> platform_device );
5111
5126
platform_driver_unregister (& driver -> platform_driver );
5112
5127
used = false;
0 commit comments