Merge branch 'platform-drivers-x86-amd-pmf' into review-hans
authorHans de Goede <hdegoede@redhat.com>
Tue, 27 Sep 2022 12:57:38 +0000 (14:57 +0200)
committerHans de Goede <hdegoede@redhat.com>
Tue, 27 Sep 2022 12:57:38 +0000 (14:57 +0200)
1  2 
drivers/platform/x86/amd/pmf/acpi.c
drivers/platform/x86/amd/pmf/core.c
drivers/platform/x86/amd/pmf/pmf.h

@@@ -233,16 -233,28 +233,38 @@@ static int apmf_get_system_params(struc
        return 0;
  }
  
 +int apmf_get_dyn_slider_def_ac(struct amd_pmf_dev *pdev, struct apmf_dyn_slider_output *data)
 +{
 +      return apmf_if_call_store_buffer(pdev, APMF_FUNC_DYN_SLIDER_AC, data, sizeof(*data));
 +}
 +
 +int apmf_get_dyn_slider_def_dc(struct amd_pmf_dev *pdev, struct apmf_dyn_slider_output *data)
 +{
 +      return apmf_if_call_store_buffer(pdev, APMF_FUNC_DYN_SLIDER_DC, data, sizeof(*data));
 +}
 +
+ int apmf_install_handler(struct amd_pmf_dev *pmf_dev)
+ {
+       acpi_handle ahandle = ACPI_HANDLE(pmf_dev->dev);
+       acpi_status status;
+       /* Install the APMF Notify handler */
+       if (is_apmf_func_supported(pmf_dev, APMF_FUNC_AUTO_MODE) &&
+           is_apmf_func_supported(pmf_dev, APMF_FUNC_SBIOS_REQUESTS)) {
+               status = acpi_install_notify_handler(ahandle, ACPI_ALL_NOTIFY,
+                                                    apmf_event_handler, pmf_dev);
+               if (ACPI_FAILURE(status)) {
+                       dev_err(pmf_dev->dev, "failed to install notify handler\n");
+                       return -ENODEV;
+               }
+               /* Call the handler once manually to catch up with possibly missed notifies. */
+               apmf_event_handler(ahandle, 0, pmf_dev);
+       }
+       return 0;
+ }
  void apmf_acpi_deinit(struct amd_pmf_dev *pmf_dev)
  {
        acpi_handle ahandle = ACPI_HANDLE(pmf_dev->dev);
Simple merge
Simple merge