Merge tag 'platform-drivers-x86-v6.4-5' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform driver fix from Hans de Goede: "One small fix for an AMD PMF driver issue which is causing issues for users of just released AMD laptop models" * tag 'platform-drivers-x86-v6.4-5' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: platform/x86/amd/pmf: Register notify handler only if SPS is enabled
This commit is contained in:
@@ -297,6 +297,8 @@ static void amd_pmf_init_features(struct amd_pmf_dev *dev)
|
||||
/* Enable Static Slider */
|
||||
if (is_apmf_func_supported(dev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) {
|
||||
amd_pmf_init_sps(dev);
|
||||
dev->pwr_src_notifier.notifier_call = amd_pmf_pwr_src_notify_call;
|
||||
power_supply_reg_notifier(&dev->pwr_src_notifier);
|
||||
dev_dbg(dev->dev, "SPS enabled and Platform Profiles registered\n");
|
||||
}
|
||||
|
||||
@@ -315,8 +317,10 @@ static void amd_pmf_init_features(struct amd_pmf_dev *dev)
|
||||
|
||||
static void amd_pmf_deinit_features(struct amd_pmf_dev *dev)
|
||||
{
|
||||
if (is_apmf_func_supported(dev, APMF_FUNC_STATIC_SLIDER_GRANULAR))
|
||||
if (is_apmf_func_supported(dev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) {
|
||||
power_supply_unreg_notifier(&dev->pwr_src_notifier);
|
||||
amd_pmf_deinit_sps(dev);
|
||||
}
|
||||
|
||||
if (is_apmf_func_supported(dev, APMF_FUNC_AUTO_MODE)) {
|
||||
amd_pmf_deinit_auto_mode(dev);
|
||||
@@ -399,9 +403,6 @@ static int amd_pmf_probe(struct platform_device *pdev)
|
||||
apmf_install_handler(dev);
|
||||
amd_pmf_dbgfs_register(dev);
|
||||
|
||||
dev->pwr_src_notifier.notifier_call = amd_pmf_pwr_src_notify_call;
|
||||
power_supply_reg_notifier(&dev->pwr_src_notifier);
|
||||
|
||||
dev_info(dev->dev, "registered PMF device successfully\n");
|
||||
|
||||
return 0;
|
||||
@@ -411,7 +412,6 @@ static void amd_pmf_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct amd_pmf_dev *dev = platform_get_drvdata(pdev);
|
||||
|
||||
power_supply_unreg_notifier(&dev->pwr_src_notifier);
|
||||
amd_pmf_deinit_features(dev);
|
||||
apmf_acpi_deinit(dev);
|
||||
amd_pmf_dbgfs_unregister(dev);
|
||||
|
||||
Reference in New Issue
Block a user