Skip to content

Commit 65d4898

Browse files
committed
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
2 parents c213de6 + 146b6f6 commit 65d4898

File tree

1 file changed

+5
-5
lines changed
  • drivers/platform/x86/amd/pmf

1 file changed

+5
-5
lines changed

drivers/platform/x86/amd/pmf/core.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ static void amd_pmf_init_features(struct amd_pmf_dev *dev)
297297
/* Enable Static Slider */
298298
if (is_apmf_func_supported(dev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) {
299299
amd_pmf_init_sps(dev);
300+
dev->pwr_src_notifier.notifier_call = amd_pmf_pwr_src_notify_call;
301+
power_supply_reg_notifier(&dev->pwr_src_notifier);
300302
dev_dbg(dev->dev, "SPS enabled and Platform Profiles registered\n");
301303
}
302304

@@ -315,8 +317,10 @@ static void amd_pmf_init_features(struct amd_pmf_dev *dev)
315317

316318
static void amd_pmf_deinit_features(struct amd_pmf_dev *dev)
317319
{
318-
if (is_apmf_func_supported(dev, APMF_FUNC_STATIC_SLIDER_GRANULAR))
320+
if (is_apmf_func_supported(dev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) {
321+
power_supply_unreg_notifier(&dev->pwr_src_notifier);
319322
amd_pmf_deinit_sps(dev);
323+
}
320324

321325
if (is_apmf_func_supported(dev, APMF_FUNC_AUTO_MODE)) {
322326
amd_pmf_deinit_auto_mode(dev);
@@ -399,9 +403,6 @@ static int amd_pmf_probe(struct platform_device *pdev)
399403
apmf_install_handler(dev);
400404
amd_pmf_dbgfs_register(dev);
401405

402-
dev->pwr_src_notifier.notifier_call = amd_pmf_pwr_src_notify_call;
403-
power_supply_reg_notifier(&dev->pwr_src_notifier);
404-
405406
dev_info(dev->dev, "registered PMF device successfully\n");
406407

407408
return 0;
@@ -411,7 +412,6 @@ static void amd_pmf_remove(struct platform_device *pdev)
411412
{
412413
struct amd_pmf_dev *dev = platform_get_drvdata(pdev);
413414

414-
power_supply_unreg_notifier(&dev->pwr_src_notifier);
415415
amd_pmf_deinit_features(dev);
416416
apmf_acpi_deinit(dev);
417417
amd_pmf_dbgfs_unregister(dev);

0 commit comments

Comments
 (0)