platform/x86: msi-laptop: Add msi_scm_disable_hw_fn_handling() helper
Add a msi_scm_disable_hw_fn_handling() to remove the duplicate code for this in the resume and init paths. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20220826111453.178962-2-hdegoede@redhat.com
This commit is contained in:
parent
57209ddd5b
commit
c35c7b9805
|
@ -913,8 +913,7 @@ err_bluetooth:
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM_SLEEP
|
static int msi_scm_disable_hw_fn_handling(void)
|
||||||
static int msi_laptop_resume(struct device *device)
|
|
||||||
{
|
{
|
||||||
u8 data;
|
u8 data;
|
||||||
int result;
|
int result;
|
||||||
|
@ -934,6 +933,12 @@ static int msi_laptop_resume(struct device *device)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_PM_SLEEP
|
||||||
|
static int msi_laptop_resume(struct device *device)
|
||||||
|
{
|
||||||
|
return msi_scm_disable_hw_fn_handling();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int __init msi_laptop_input_setup(void)
|
static int __init msi_laptop_input_setup(void)
|
||||||
|
@ -966,7 +971,6 @@ err_free_dev:
|
||||||
|
|
||||||
static int __init load_scm_model_init(struct platform_device *sdev)
|
static int __init load_scm_model_init(struct platform_device *sdev)
|
||||||
{
|
{
|
||||||
u8 data;
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (!quirks->ec_read_only) {
|
if (!quirks->ec_read_only) {
|
||||||
|
@ -980,12 +984,7 @@ static int __init load_scm_model_init(struct platform_device *sdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* disable hardware control by fn key */
|
/* disable hardware control by fn key */
|
||||||
result = ec_read(MSI_STANDARD_EC_SCM_LOAD_ADDRESS, &data);
|
result = msi_scm_disable_hw_fn_handling();
|
||||||
if (result < 0)
|
|
||||||
return result;
|
|
||||||
|
|
||||||
result = ec_write(MSI_STANDARD_EC_SCM_LOAD_ADDRESS,
|
|
||||||
data | MSI_STANDARD_EC_SCM_LOAD_MASK);
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue