Commit graph

311 commits

Author SHA1 Message Date
Linus Torvalds
83158b21ae platform-drivers-x86 for v6.14-5
Fixes and new HW support:
 
  - amd/pmf:
 
     - Fix error handling in amd_pmf_init_smart_pc()
 
     - Fix missing hidden options for Smart PC
 
  - surface: aggregator_registry: Add Support for Surface Pro 11
 
 The following is an automated shortlog grouped by driver:
 
 amd/pmf:
  -  fix cleanup in amd_pmf_init_smart_pc()
 
 amd: pmf:
  -  Fix missing hidden options for Smart PC
 
 MAINTAINERS:
  -  Update Ike Panhc's email address
 
 surface: aggregator_registry:
  -  Add Support for Surface Pro 11
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQSCSUwRdwTNL2MhaBlZrE9hU+XOMQUCZ9Q9DAAKCRBZrE9hU+XO
 MZE3AP9GnIgzXK1dFbuorGfNCHMol4TbR6oANflMBPvORWE54QD/XWwongTvUpFU
 cgwVSasJb2fLso/nyBlVmYeKE7h8qAk=
 =6Une
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v6.14-5' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform driver fixes from Ilpo Järvinen:
 "Fixes and new HW support.

  The diff is a bit larger than I'd prefer at this point due to
  unwinding the amd/pmf driver's error handling properly instead of
  calling a deinit function that was a can full of worms.

  Summary:

   - amd/pmf:
       - Fix error handling in amd_pmf_init_smart_pc()
       - Fix missing hidden options for Smart PC

   - surface: aggregator_registry: Add Support for Surface Pro 11"

* tag 'platform-drivers-x86-v6.14-5' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
  MAINTAINERS: Update Ike Panhc's email address
  platform/x86/amd: pmf: Fix missing hidden options for Smart PC
  platform/surface: aggregator_registry: Add Support for Surface Pro 11
  platform/x86/amd/pmf: fix cleanup in amd_pmf_init_smart_pc()
2025-03-14 10:57:28 -10:00
Dan Carpenter
01db3d1ff4
platform/x86/amd/pmc: fix leak in probe()
Call pci_dev_put(rdev) before returning.

Fixes: 6ad1b2dc0f ("platform/x86/amd/pmc: Use managed APIs for mutex")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/65e2fffb-a1cb-4297-b725-661d6b790a05@stanley.mountain
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-03-13 15:00:33 +02:00
Mario Limonciello
4490fe9736
platform/x86/amd: pmf: Fix missing hidden options for Smart PC
amd_pmf_get_slider_info() checks the current profile to report correct
value to the TA inputs.  If hidden options are in use then the wrong
values will be reported to TA.

Add the two compat options PLATFORM_PROFILE_BALANCED_PERFORMANCE and
PLATFORM_PROFILE_QUIET for this use.

Reported-by: Yijun Shen <Yijun.Shen@dell.com>
Fixes: 9a43102daf ("platform/x86/amd: pmf: Add balanced-performance to hidden choices")
Fixes: 44e94fece5 ("platform/x86/amd: pmf: Add 'quiet' to hidden choices")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20250306034402.50478-1-superm1@kernel.org
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-03-13 14:53:33 +02:00
Dan Carpenter
5b1122fc49
platform/x86/amd/pmf: fix cleanup in amd_pmf_init_smart_pc()
There are a few problems in this code:

First, if amd_pmf_tee_init() fails then the function returns directly
instead of cleaning up.  We cannot simply do a "goto error;" because
the amd_pmf_tee_init() cleanup calls tee_shm_free(dev->fw_shm_pool);
and amd_pmf_tee_deinit() calls it as well leading to a double free.
I have re-written this code to use an unwind ladder to free the
allocations.

Second, if amd_pmf_start_policy_engine() fails on every iteration though
the loop then the code calls amd_pmf_tee_deinit() twice which is also a
double free.  Call amd_pmf_tee_deinit() inside the loop for each failed
iteration.  Also on that path the error codes are not necessarily
negative kernel error codes.  Set the error code to -EINVAL.

There is a very subtle third bug which is that if the call to
input_register_device() in amd_pmf_register_input_device() fails then
we call input_unregister_device() on an input device that wasn't
registered.  This will lead to a reference counting underflow
because of the device_del(&dev->dev) in __input_unregister_device().
It's unlikely that anyone would ever hit this bug in real life.

Fixes: 376a8c2a14 ("platform/x86/amd/pmf: Update PMF Driver for Compatibility with new PMF-TA")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/232231fc-6a71-495e-971b-be2a76f6db4c@stanley.mountain
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-03-11 17:23:57 +02:00
Linus Torvalds
d4fd25b6f8 ACPI fix for 6.14-rc6
Restore the previous behavior of the ACPI platform_profile sysfs
 interface that has been changed recently in a way incompatible
 with the existing user space (Mario Limonciello).
 -----BEGIN PGP SIGNATURE-----
 
 iQFGBAABCAAwFiEEcM8Aw/RY0dgsiRUR7l+9nS/U47UFAmfLW54SHHJqd0Byand5
 c29ja2kubmV0AAoJEO5fvZ0v1OO1VOUIAJwwmxAcJGHxbOPvK5r7jO/Rq4XFbMuT
 ftNEX+awNFcBFtm7dgxhTjqZUFDDntvB/+BDuBMz1xsP2QRsW38R84hiVlJgisT1
 XlMdqXalYQgN/MEQvS22AudyLBuWw1+/i9d8rZOf73wA9thOt5KrJa5IIieT1oJe
 kd5Kf3onrmwSv5h38NqKkUzO2QdY5rluUG47HIaiNpe+HODDwf2NU335CUV4V69q
 t6LKEoiSJ7Ziv7a5morXXu2Y26eTjK9kG8insGCgp/oK+nyxx5K8a7i/d8Hlp92b
 X21G4P278lYTBDR4QoJrhKPyLqvNUx9qQ7KHXrNPZGY/c+g31yfvWC8=
 =c0sa
 -----END PGP SIGNATURE-----

Merge tag 'acpi-6.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI fix from Rafael Wysocki:
 "Restore the previous behavior of the ACPI platform_profile sysfs
  interface that has been changed recently in a way incompatible with
  the existing user space (Mario Limonciello)"

* tag 'acpi-6.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  platform/x86/amd: pmf: Add balanced-performance to hidden choices
  platform/x86/amd: pmf: Add 'quiet' to hidden choices
  ACPI: platform_profile: Add support for hidden choices
2025-03-07 12:17:42 -10:00
Shyam Sundar S K
6ad1b2dc0f
platform/x86/amd/pmc: Use managed APIs for mutex
Adopt managed devm_* APIs for handling mutex creation and deletion,
facilitating automatic resource cleanup.

Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20250305142615.410178-4-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-03-07 12:17:51 +02:00
Shyam Sundar S K
c183cf6c53
platform/x86/amd/pmc: Remove unnecessary line breaks
Enhance code readability by fixing line break and blank line
inconsistencies.

Also make the return variable "rc" as function level local.

Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20250305142615.410178-3-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-03-07 12:17:49 +02:00
Shyam Sundar S K
e3f1fe9898
platform/x86/amd/pmc: Move macros and structures to the PMC header file
To improve the code organization and readability, move the macros and
structures from the AMD PMC driver to the PMC header file.

Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20250305142615.410178-2-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-03-07 12:17:48 +02:00
Shyam Sundar S K
351f3d9a05
platform/x86/amd/pmc: Notify user when platform does not support s0ix transition
Some of the AMD platforms do not support modern standby, so when such
CPU ID is detected, a warning message will be displayed to the user.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20250305142615.410178-1-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-03-07 12:17:46 +02:00
Shyam Sundar S K
376a8c2a14
platform/x86/amd/pmf: Update PMF Driver for Compatibility with new PMF-TA
The PMF driver allocates a shared memory buffer using
tee_shm_alloc_kernel_buf() for communication with the PMF-TA.

The latest PMF-TA version introduces new structures with OEM debug
information and additional policy input conditions for evaluating the
policy binary. Consequently, the shared memory size must be increased to
ensure compatibility between the PMF driver and the updated PMF-TA.

To do so, introduce the new PMF-TA UUID and update the PMF shared memory
configuration to ensure compatibility with the latest PMF-TA version.
Additionally, export the TA UUID.

These updates will result in modifications to the prototypes of
amd_pmf_tee_init() and amd_pmf_ta_open_session().

Link: https://lore.kernel.org/all/55ac865f-b1c7-fa81-51c4-d211c7963e7e@linux.intel.com/
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20250305045842.4117767-2-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-03-05 13:33:42 +02:00
Shyam Sundar S K
9ba93cb821
platform/x86/amd/pmf: Propagate PMF-TA return codes
In the amd_pmf_invoke_cmd_init() function within the PMF driver ensure
that the actual result from the PMF-TA is returned rather than a generic
EIO. This change allows for proper handling of errors originating from the
PMF-TA.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20250305045842.4117767-1-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-03-05 13:33:38 +02:00
Mario Limonciello
9a43102daf platform/x86/amd: pmf: Add balanced-performance to hidden choices
Acer's WMI driver uses balanced-performance but AMD-PMF doesn't.
In case a machine binds with both drivers let amd-pmf use
balanced-performance as well.

Fixes: 688834743d ("ACPI: platform_profile: Allow multiple handlers")
Suggested-by: Antheas Kapenekakis <lkml@antheas.dev>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Tested-by: Antheas Kapenekakis <lkml@antheas.dev>
Tested-by: Derek J. Clark <derekjohn.clark@gmail.com>
Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://patch.msgid.link/20250228170155.2623386-4-superm1@kernel.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-03-04 20:45:34 +01:00
Mario Limonciello
44e94fece5 platform/x86/amd: pmf: Add 'quiet' to hidden choices
When amd-pmf and asus-wmi are both bound no low power option shows
up in sysfs.  Add a hidden choice for amd-pmf to support 'quiet' mode
to let both bind.

Fixes: 688834743d ("ACPI: platform_profile: Allow multiple handlers")
Suggested-by: Antheas Kapenekakis <lkml@antheas.dev>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Tested-by: Antheas Kapenekakis <lkml@antheas.dev>
Tested-by: Derek J. Clark <derekjohn.clark@gmail.com>
Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://patch.msgid.link/20250228170155.2623386-3-superm1@kernel.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-03-04 20:45:34 +01:00
Mario Limonciello
1be4e29e94
platform/x86/amd/pmf: Initialize and clean up cb_mutex
`cb_mutex` was introduced in commit 9e0894d070 ("platform/x86/amd/pmf:
Enable Custom BIOS Inputs for PMF-TA") to prevent conccurrent access for
BIOS inputs. It however isn't initialized and so on use it may lead to
a NULL pointer dereference.

Add code to initialize on probe and clean up on destroy.

Reported-by: Yijun Shen <Yijun.Shen@dell.com>
Cc: Richard Gong <richgong@amd.com>
Fixes: 9e0894d070 ("platform/x86/amd/pmf: Enable Custom BIOS Inputs for PMF-TA")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Tested-By: Yijun Shen <Yijun_Shen@Dell.com>
Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20250227170308.435862-1-superm1@kernel.org
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-03-03 12:48:22 +02:00
Kurt Borja
cfba129ad2
platform/x86: amd: Use *-y instead of *-objs in Makefiles
The `objs` suffix is reserved for user-space tools. Use the `y` suffix
instead, which is usually used for kernel drivers.

While at it, fix alignment in AMD PMC and PMF Makefiles.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250218194113.26589-3-kuurtb@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-02-24 17:15:02 +02:00
Linus Torvalds
c9c0543b52 platform-drivers-x86 for v6.14-1
Highlights:
 
  - acer-wmi:
 
 	- Add support for PH14-51, PH16-72, and Nitro AN515-58
 
 	- Add proper hwmon support
 
 	- Improve error handling when reading "gaming system info"
 
 	- Replace direct EC reads for the current platform profile
 	  with WMI calls to handle EC address variations
 
 	- Replace custom platform_profile cycling with the generic one
 
  - ACPI: platform_profile: Major refactoring and improvements
 
 	- Support registering multiple platform_profile handlers
 	  concurrently to avoid the need to quirk which handler takes
 	  precedence
 
 	- Support reporting "custom" profile for cases where the current
 	  profile is ambiguous or when settings tweaks are done outside
 	  the pre-defined profile
 
 	- Abstract and layer platform_profile API better using the
 	  class_dev and drvdata
 
 	- Various minor improvements
 
 	- Add Documentation and kerneldoc
 
  - amd/hsmp: Add support for HSMP protocol v7
 
  - amd/pmc:
 
 	- Support AMD 1Ah family 70h
 
 	- Support STB with Ryzen desktop SoCs
 
  - amd/pmf:
 
 	- Support Custom BIOS inputs for PMF TA
 
 	- Support passing SRA sensor data from AMD SFH (HID) to PMF TA
 
  - dell-smo8800:
 
 	- Move SMO88xx quirk away from the generic i2c-i801 driver
 
 	- Add accelerometer support for Dell Latitude E6330/E6430 and
 	  XPS 9550
 
 	- Support probing accelerometer for models yet to be listed in
 	  the DMI mapping table because ACPI lacks i2c-address for the
 	  accelerometer (behind a module parameter because probing might
 	  be dangerous)
 
  - HID: amd_sfh: Add support for exporting SRA sensor data
 
  - hp-wmi: Add fan and thermal support for Victus 16-s1000
 
  - input: Add key for phone linking
 
  - input: i8042: Add context for the i8042 filter to enable cleaning up
    the filter related global variables from pdx86 drivers
 
  - lenovo-wmi-camera: Use SW_CAMERA_LENS_COVER instead of
    KEY_CAMERA_ACCESS
 
  - mellanox: mlxbf-pmc:
 
 	- Add support for monitoring cycle count
 
 	- Add Documentation
 
  - thinkpad_acpi: Add support for phone link key
 
  - tools/power/x86/intel-speed-select: Fix Turbo Ratio Limit restore
 
  - x86-android-tables: Add support for Vexia EDU ATLA 10 Bluetooth and
    EC battery driver
 
  - Miscellaneous cleanups / refactoring / improvements
 
 The following is an automated shortlog grouped by driver:
 
 acer-wmi:
  -  add support for Acer Nitro AN515-58
  -  Add support for Acer PH14-51
  -  Add support for Acer Predator PH16-72
  -  Fix initialization of last_non_turbo_profile
  -  Ignore AC events
  -  Implement proper hwmon support
  -  Improve error handling when reading gaming system information
  -  Rename ACER_CAP_FAN_SPEED_READ
  -  simplify platform profile cycling
  -  use an ACPI bitmap to set the platform profile choices
  -  Use devm_platform_profile_register()
  -  use new helper function for setting overclocks
  -  use WMI calls for platform profile handling
 
 ACPI: platform-profile:
  -  Add a name member to handlers
 
 ACPI: platform_profile:
  -  Add a prefix to log messages
  -  Add choices attribute for class interface
  -  Add concept of a "custom" profile
  -  Add device pointer into platform profile handler
  -  Add devm_platform_profile_register()
  -  Add documentation
  -  Add name attribute to class interface
  -  Add `ops` member to handlers
  -  Add platform handler argument to platform_profile_remove()
  -  Add `probe` to platform_profile_ops
  -  Add profile attribute for class interface
  -  Allow multiple handlers
  -  Check all profile handler to calculate next
  -  Clean platform_profile_handler
  -  Create class for ACPI platform profile
  -  Let drivers set drvdata to the class device
  -  Make sure all profile handlers agree on profile
  -  Move matching string for new profile out of mutex
  -  Move platform_profile_handler
  -  Move sanity check out of the mutex
  -  Notify change events on register and unregister
  -  Notify class device from platform_profile_notify()
  -  Only show profiles common for all handlers
  -  Pass the profile handler into platform_profile_notify()
  -  Remove platform_profile_handler from callbacks
  -  Remove platform_profile_handler from exported symbols
  -  Replace *class_dev member with class_dev
  -  Use guard(mutex) for register/unregister
  -  Use `scoped_cond_guard`
 
 alienware_wmi:
  -  General cleanup of WMAX methods
 
 alienware-wmi:
  -  Improve hdmi_mux, amplifier and deepslp group creation
  -  Improve rgb-zones group creation
  -  Modify parse_rgb() signature
  -  Move Lighting Control State
  -  Remove unnecessary check at module exit
  -  Use devm_platform_profile_register()
 
 amd/hsmp:
  -  Add support for HSMP protocol version 7 messages
  -  Constify 'struct bin_attribute'
 
 amd/pmc:
  -  Add STB support for AMD Desktop variants
  -  Define enum for S2D/PMC msg_port and add helper function
  -  Isolate STB code changes to a new file
  -  Move STB block into amd_pmc_s2d_init()
  -  Move STB functionality to a new file for better code organization
  -  Update function names to align with new STB file
  -  Update IP information structure for newer SoCs
  -  Update S2D message id for 1Ah Family 70h model
  -  Use ARRAY_SIZE() to fill num_ips information
 
 amd: pmc:
  -  Use guard(mutex)
 
 amd: pmf:
  -  Drop all quirks
 
 amd/pmf:
  -  Enable Custom BIOS Inputs for PMF-TA
  -  Get SRA sensor data from AMD SFH driver
 
 amd: pmf: sps:
  -  Use devm_platform_profile_register()
 
 amd: pmf:
  -  Switch to guard(mutex)
 
 asus-wmi:
  -  Use devm_platform_profile_register()
 
 dell: dcdbas:
  -  Constify 'struct bin_attribute'
 
 dell: dell-pc:
  -  Create platform device
 
 dell-pc:
  -  Use devm_platform_profile_register()
 
 dell_rbu:
  -  Constify 'struct bin_attribute'
 
 dell-smo8800:
  -  Add a couple more models to lis3lv02d_devices[]
  -  Add support for probing for the accelerometer i2c address
  -  Move instantiation of lis3lv02d i2c_client from i2c-i801 to dell-lis3lv02d
  -  Move SMO88xx acpi_device_ids to dell-smo8800-ids.h
 
 dell-sysman:
  -  Directly use firmware_attributes_class
 
 dell-uart-backlight:
  -  Use blacklight power constant
 
 docs: platform/x86: wmi:
  -  mention tool for invoking WMI methods
 
 Documentation/ABI:
  -  Add document for Mellanox PMC driver
  -  Add new sysfs field to sysfs-platform-mellanox-pmc
 
 Documentation:
  -  Add documentation about class interface for platform profiles
 
 firmware_attributes_class:
  -  Drop lifecycle functions
  -  Move include linux/device/class.h
  -  Simplify API
 
 fujitsu-laptop:
  -  replace strcpy -> strscpy
 
 HID: amd_sfh:
  -  Add support to export device operating states
 
 hp-bioscfg:
  -  Directly use firmware_attributes_class
 
 hp-wmi:
  -  Add fan and thermal profile support for Victus 16-s1000
  -  Use devm_platform_profile_register()
 
 ideapad-laptop:
  -  Use devm_platform_profile_register()
 
 Input:
  -  allocate keycode for phone linking
  -  i8042 - Add support for platform filter contexts
 
 inspur_platform_profile:
  -  Use devm_platform_profile_register()
 
 int3472:
  -  Check for adev == NULL
  -  Debug log the sensor name
  -  Fix skl_int3472_handle_gpio_resources() return value
  -  Make "pin number mismatch" message a debug message
 
 intel: bytcrc_pwrsrc:
  -  fix power_supply dependency
  -  Optionally register a power_supply dev
 
 intel: int0002_vgpio:
  -  Make the irqchip immutable
 
 intel/pmt:
  -  Constify 'struct bin_attribute'
 
 intel: punit_ipc:
  -  Remove unused function
 
 intel/sdsi:
  -  Constify 'struct bin_attribute'
 
 intel/tpmi/plr:
  -  Make char[] longer to silence warning
 
 lenovo-wmi-camera:
  -  Use SW_CAMERA_LENS_COVER instead of KEY_CAMERA_ACESS
 
 MAINTAINERS:
  -  Change AMD PMC driver status to "Supported"
 
 mlxbf-bootctl:
  -  Constify 'struct bin_attribute'
  -  use sysfs_emit() instead of sprintf()
 
 mlxbf-pmc:
  -  Add support for clock_measure performance block
  -  Add support for monitoring cycle count
  -  incorrect type in assignment
 
 mlxreg-hotplug:
  -  use sysfs_emit() instead of sprintf()
 
 mlxreg-io:
  -  use sysfs_emit() instead of sprintf()
 
 quickstart:
  -  don't include 'pm_wakeup.h' directly
 
 serdev_helpers:
  -  Add get_serdev_controller_from_parent() helper
  -  Check for serial_ctrl_uid == NULL
 
 surface: surface_platform_profile:
  -  Use devm_platform_profile_register()
 
 think-lmi:
  -  Directly use firmware_attributes_class
 
 thinkpad_acpi:
  -  Add support for new phone link hotkey
 
 thinkpad-acpi:
  -  replace strcpy with strscpy
 
 thinkpad_acpi:
  -  Use devm_platform_profile_register()
 
 tools/power/x86/intel-speed-select:
  -  Fix TRL restore after SST-TF disable
  -  v1.21 release
 
 wmi-bmof:
  -  Make use of .bin_size() callback
 
 x86-android-tablets:
  -  Add Bluetooth support for Vexia EDU ATLA 10
  -  Add missing __init to get_i2c_adap_by_*()
  -  Add support for getting serdev-controller by PCI parent
  -  Add Vexia EDU ATLA 10 EC battery driver
  -  Change x86_instantiate_serdev() prototype
  -  make platform data be static
  -  Make variables only used locally static
  -  Store serdev-controller ACPI HID + UID in a union
 
 Merges:
  -  Merge branch 'fixes' into 'for-next'
  -  Merge branch 'intel-sst' of https://github.com/spandruvada/linux-kernel into review-ilpo-next
  -  Merge branch 'platform-drivers-x86-platform-profile' into for-next
  -  Merge branch 'platform-drivers-x86-platform-profile' into for-next
  -  Merge import NS conversion from 'https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git' into for-next
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQSCSUwRdwTNL2MhaBlZrE9hU+XOMQUCZ5JDNAAKCRBZrE9hU+XO
 MT3AAP9YSYaWZUEgV9T/De2C/ksx0XfmHULmtQHccMgqIsIxmAEAmsBOHsDozPuZ
 9F2IbT4uBuQo2iwbGq0DhVd+N36kEQw=
 =Vz0C
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v6.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform driver updates from Ilpo Järvinen:
 "acer-wmi:
   - Add support for PH14-51, PH16-72, and Nitro AN515-58
   - Add proper hwmon support
   - Improve error handling when reading "gaming system info"
   - Replace direct EC reads for the current platform profile with WMI
     calls to handle EC address variations
   - Replace custom platform_profile cycling with the generic one

  ACPI:
   - platform_profile: Major refactoring and improvements
   - Support registering multiple platform_profile handlers concurrently
     to avoid the need to quirk which handler takes precedence
   - Support reporting "custom" profile for cases where the current
     profile is ambiguous or when settings tweaks are done outside the
     pre-defined profile
   - Abstract and layer platform_profile API better using the class_dev
     and drvdata
   - Various minor improvements
   - Add Documentation and kerneldoc

  amd/hsmp:
   - Add support for HSMP protocol v7

  amd/pmc:
   - Support AMD 1Ah family 70h
   - Support STB with Ryzen desktop SoCs

  amd/pmf:
   - Support Custom BIOS inputs for PMF TA
   - Support passing SRA sensor data from AMD SFH (HID) to PMF TA

  dell-smo8800:
   - Move SMO88xx quirk away from the generic i2c-i801 driver
   - Add accelerometer support for Dell Latitude E6330/E6430 and XPS
     9550
   - Support probing accelerometer for models yet to be listed in the
     DMI mapping table because ACPI lacks i2c-address for the
     accelerometer (behind a module parameter because probing might be
     dangerous)

  HID:
   - amd_sfh: Add support for exporting SRA sensor data

  hp-wmi:
   - Add fan and thermal support for Victus 16-s1000

  input:
   - Add key for phone linking
   - i8042: Add context for the i8042 filter to enable cleaning up the
     filter related global variables from pdx86 drivers

  lenovo-wmi-camera:
   - Use SW_CAMERA_LENS_COVER instead of KEY_CAMERA_ACCESS

  mellanox mlxbf-pmc:
   - Add support for monitoring cycle count
   - Add Documentation

  thinkpad_acpi:
   - Add support for phone link key

  tools/power/x86/intel-speed-select:
   - Fix Turbo Ratio Limit restore

  x86-android-tables:
   - Add support for Vexia EDU ATLA 10 Bluetooth and EC battery driver

  And miscellaneous cleanups / refactoring / improvements"

* tag 'platform-drivers-x86-v6.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (133 commits)
  platform/x86: acer-wmi: Fix initialization of last_non_turbo_profile
  platform/x86: acer-wmi: Ignore AC events
  platform/mellanox: mlxreg-io: use sysfs_emit() instead of sprintf()
  platform/mellanox: mlxreg-hotplug: use sysfs_emit() instead of sprintf()
  platform/mellanox: mlxbf-bootctl: use sysfs_emit() instead of sprintf()
  platform/x86: hp-wmi: Add fan and thermal profile support for Victus 16-s1000
  ACPI: platform_profile: Add a prefix to log messages
  ACPI: platform_profile: Add documentation
  ACPI: platform_profile: Clean platform_profile_handler
  ACPI: platform_profile: Move platform_profile_handler
  ACPI: platform_profile: Remove platform_profile_handler from exported symbols
  platform/x86: thinkpad_acpi: Use devm_platform_profile_register()
  platform/x86: inspur_platform_profile: Use devm_platform_profile_register()
  platform/x86: hp-wmi: Use devm_platform_profile_register()
  platform/x86: ideapad-laptop: Use devm_platform_profile_register()
  platform/x86: dell-pc: Use devm_platform_profile_register()
  platform/x86: asus-wmi: Use devm_platform_profile_register()
  platform/x86: amd: pmf: sps: Use devm_platform_profile_register()
  platform/x86: acer-wmi: Use devm_platform_profile_register()
  platform/surface: surface_platform_profile: Use devm_platform_profile_register()
  ...
2025-01-24 07:18:39 -08:00
Linus Torvalds
b9d8a295ed - The first part of a restructuring of AMD's representation of a northbridge
which is legacy now, and the creation of the new AMD node concept which
   represents the Zen architecture of having a collection of I/O devices within
   an SoC. Those nodes comprise the so-called data fabric on Zen. This has
   at least one practical advantage of not having to add a PCI ID each time
   a new data fabric PCI device releases. Eventually, the lot more uniform
   provider of data fabric functionality amd_node.c will be used by all the
   drivers which need it
 
 - Smaller cleanups
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmePuPIACgkQEsHwGGHe
 VUpU6Q//S9j9+YC9EpredFoJ5W0BfERR5XOum7YjlLxq2mVTStrf9Q1ecrwmS4Q6
 4mAydIDfhqNlouUjMBgNNFJcvm8lat+/pjY78oT8ZdjumslMbMxo81VmQ3fX+6fE
 izMrL81DG4j8zeleUyz5ecJEK/KPw1s3SkY736511PeJSalOU4hLYmU819imfAk/
 5c9os2GNhszIROE1YUYZQ3zXne1t2PNXKvctzVrJYjyKpIDgFNzTj6gXhePzXBNO
 iFdApqSgKdnnsD6VsfxYVnOKP+cSIl27Tbge6dm7DHQbSs00aVL64JPcX8/hWtp6
 ExrwBYiFk6yafwsNUu7/PmqbZNKYxDgvXFq8jSOFfioh6Km/QZYs8y1/qXN3qmSU
 78Ah5jyO+U+++FsSa2o9eRpU2l84UIQqvp84PeSLylzh7iLFyFCWsMfreNeIsF9v
 Jsost58JQOCufRK3qfMiDO88QUZRKyCfFymDAVcvPoBwp5nK9R1ohlbxgXrCPsE7
 Bd7J6jrlpcoRyYc8vhshkrnK2Sk6pP77OZOh5AZ9AybnALH0afUNLzk6sBtaObkZ
 xIJcSIBkKz3P4zWFKsXmqGYHWp1IsKsYRsNjCt5FExWOF+uKKKBjynHmlKeS0l/b
 J6bwDUPVW/gfkBqDV8bILultj9Gm8L5Z8SwvD1ww69OYN+c7oVk=
 =ZAjD
 -----END PGP SIGNATURE-----

Merge tag 'x86_misc_for_v6.14_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull misc x86 updates from Borislav Petkov:

 - The first part of a restructuring of AMD's representation of a
   northbridge which is legacy now, and the creation of the new AMD node
   concept which represents the Zen architecture of having a collection
   of I/O devices within an SoC. Those nodes comprise the so-called data
   fabric on Zen.

   This has at least one practical advantage of not having to add a PCI
   ID each time a new data fabric PCI device releases. Eventually, the
   lot more uniform provider of data fabric functionality amd_node.c
   will be used by all the drivers which need it

 - Smaller cleanups

* tag 'x86_misc_for_v6.14_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/amd_node: Use defines for SMN register offsets
  x86/amd_node: Remove dependency on AMD_NB
  x86/amd_node: Update __amd_smn_rw() error paths
  x86/amd_nb: Move SMN access code to a new amd_node driver
  x86/amd_nb, hwmon: (k10temp): Simplify amd_pci_dev_to_node_id()
  x86/amd_nb: Simplify function 3 search
  x86/amd_nb: Use topology info to get AMD node count
  x86/amd_nb: Simplify root device search
  x86/amd_nb: Simplify function 4 search
  x86: Start moving AMD node functionality out of AMD_NB
  x86/amd_nb: Clean up early_is_amd_nb()
  x86/amd_nb: Restrict init function to AMD-based systems
  x86/mtrr: Rename mtrr_overwrite_state() to guest_force_mtrr_state()
2025-01-21 09:38:52 -08:00
Ilpo Järvinen
0da9a3f9ac
Merge branch 'fixes' into 'for-next'
Merged the 'fixes' branch into the 'for-next' branch to resolve
a conflict in alienware-wmi zone teardown code.
2025-01-21 14:00:38 +02:00
Kurt Borja
07f531b395 ACPI: platform_profile: Remove platform_profile_handler from exported symbols
In order to protect the platform_profile_handler from API consumers,
allocate it in platform_profile_register() and modify it's signature
accordingly.

Remove the platform_profile_handler from all consumer drivers and
replace them with a pointer to the class device, which is
now returned from platform_profile_register().

Replace *pprof with a pointer to the class device in the rest of
exported symbols.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Link: https://lore.kernel.org/r/20250116002721.75592-16-kuurtb@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-01-17 19:15:59 +02:00
Kurt Borja
3e6d0bf3b9 platform/x86: amd: pmf: sps: Use devm_platform_profile_register()
Replace platform_profile_register() with it's device managed version.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Link: https://lore.kernel.org/r/20250116002721.75592-9-kuurtb@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-01-16 17:26:35 +02:00
Kurt Borja
58d5629dc8 ACPI: platform_profile: Add probe to platform_profile_ops
Add a `probe` callback to platform_profile_ops, which lets drivers
initialize the choices member manually. This is a step towards
unexposing the struct platform_profile_handler from the consumer
drivers.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Link: https://lore.kernel.org/r/20250116002721.75592-6-kuurtb@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-01-16 17:26:30 +02:00
Kurt Borja
b5ca1a4488 ACPI: platform_profile: Add ops member to handlers
Replace *profile_get and *profile_set members with a general *ops
member.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Link: https://lore.kernel.org/r/20250116002721.75592-5-kuurtb@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-01-16 17:26:28 +02:00
Kurt Borja
cf3ea098dd ACPI: platform_profile: Remove platform_profile_handler from callbacks
Devices can now set drvdata to the class device, thus passing the
platform_profile_handler to callbacks is unnecessary. Instead pass the
class device.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Link: https://lore.kernel.org/r/20250116002721.75592-4-kuurtb@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-01-16 17:26:26 +02:00
Kurt Borja
249c576f0f ACPI: platform_profile: Let drivers set drvdata to the class device
Add *drvdata to platform_profile_register() signature and assign it to
the class device.

While at it, pass specific driver state as drvdata to replace uses of
container_of() with dev_get_drvdata().

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Link: https://lore.kernel.org/r/20250116002721.75592-3-kuurtb@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-01-16 17:26:25 +02:00
Linus Torvalds
8c8d54116f platform-drivers-x86 for v6.13-5
Fixes and new HW support:
 
  - amd/pmc: Match IRQ1 wakeup disable with the enable on i8042 side
 
  - intel: power-domains: Clearwater Forest support
 
  - intel/pmc: Skip SSRAM setup when no additional devices are present
 
  - ISST: Clearwater Forest support
 
 The following is an automated shortlog grouped by driver:
 
 amd/pmc:
  -  Only disable IRQ1 wakeup where i8042 actually enabled it
 
 intel/pmc:
  -  Fix ioremap() of bad address
 
 intel: power-domains:
  -  Add Clearwater Forest support
 
 ISST:
  -  Add Clearwater Forest to support list
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQSCSUwRdwTNL2MhaBlZrE9hU+XOMQUCZ4EthAAKCRBZrE9hU+XO
 MY3zAPsEwcPckYuK5vuh3Q3S52VpZnJnErzvEPCgoL6gh0mMrgEArnzvAjfoFxYf
 xk1Bp9HpoiZNesNO9vWUO7AEm3gTiww=
 =txVF
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v6.13-5' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform driver fixes from Ilpo Järvinen:
 "Fixes and new HW support:

   - amd/pmc: Match IRQ1 wakeup disable with the enable on i8042 side

   - intel: power-domains: Clearwater Forest support

   - intel/pmc: Skip SSRAM setup when no additional devices are present

   - ISST: Clearwater Forest support"

* tag 'platform-drivers-x86-v6.13-5' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
  platform/x86: intel/pmc: Fix ioremap() of bad address
  platform/x86: ISST: Add Clearwater Forest to support list
  platform/x86/intel: power-domains: Add Clearwater Forest support
  platform/x86/amd/pmc: Only disable IRQ1 wakeup where i8042 actually enabled it
2025-01-10 08:14:22 -08:00
Shyam Sundar S K
cce179c655
platform/x86/amd/pmf: Get SRA sensor data from AMD SFH driver
The AMD SFH driver includes APIs to export SRA sensor data. This data is
utilized by the AMD PMF driver to transmit SRA data to the PMF TA,
enabling the AMD PMF driver to implement the output actions specified by
the PMF TA.

Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Jiri Kosina <jkosina@suse.com>
Link: https://lore.kernel.org/r/20241217151627.757477-3-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-01-09 13:38:21 +02:00
Mario Limonciello
d6caeafaa3 x86/amd_nb: Move SMN access code to a new amd_node driver
SMN access was bolted into amd_nb mostly as convenience.  This has
limitations though that require incurring tech debt to keep it working.

Move SMN access to the newly introduced AMD Node driver.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> # pdx86
Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> # PMF, PMC
Link: https://lore.kernel.org/r/20241206161210.163701-11-yazen.ghannam@amd.com
2025-01-08 10:59:44 +01:00
Maciej S. Szmigiero
dd410d7844
platform/x86/amd/pmc: Only disable IRQ1 wakeup where i8042 actually enabled it
Wakeup for IRQ1 should be disabled only in cases where i8042 had
actually enabled it, otherwise "wake_depth" for this IRQ will try to
drop below zero and there will be an unpleasant WARN() logged:

kernel: atkbd serio0: Disabling IRQ1 wakeup source to avoid platform firmware bug
kernel: ------------[ cut here ]------------
kernel: Unbalanced IRQ 1 wake disable
kernel: WARNING: CPU: 10 PID: 6431 at kernel/irq/manage.c:920 irq_set_irq_wake+0x147/0x1a0

The PMC driver uses DEFINE_SIMPLE_DEV_PM_OPS() to define its dev_pm_ops
which sets amd_pmc_suspend_handler() to the .suspend, .freeze, and
.poweroff handlers. i8042_pm_suspend(), however, is only set as
the .suspend handler.

Fix the issue by call PMC suspend handler only from the same set of
dev_pm_ops handlers as i8042_pm_suspend(), which currently means just
the .suspend handler.

To reproduce this issue try hibernating (S4) the machine after a fresh boot
without putting it into s2idle first.

Fixes: 8e60615e89 ("platform/x86/amd: pmc: Disable IRQ1 wakeup for RN/CZN")
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Link: https://lore.kernel.org/r/c8f28c002ca3c66fbeeb850904a1f43118e17200.1736184606.git.mail@maciej.szmigiero.name
[ij: edited the commit message.]
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-01-07 17:25:18 +02:00
Mario Limonciello
03f8e0e055
platform/x86/amd: pmf: Switch to guard(mutex)
Instead of using the `goto label; mutex_unlock()` pattern use
`guard(mutex)` which will release the mutex when it goes out of scope.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20241217194027.1189038-3-superm1@kernel.org
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-19 16:15:36 +02:00
Mario Limonciello
f947ea8dd6
platform/x86/amd: pmc: Use guard(mutex)
Instead of using the `goto label; mutex_unlock()` pattern use
`guard(mutex)` which will release the mutex when it goes out of scope.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20241217194027.1189038-2-superm1@kernel.org
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-19 16:15:32 +02:00
Shyam Sundar S K
9e0894d070
platform/x86/amd/pmf: Enable Custom BIOS Inputs for PMF-TA
Introduce support for passing custom BIOS inputs to the PMF-TA to assess
BIOS input policy conditions. The PMF driver will adjust system settings
based on these BIOS input conditions and their corresponding output
actions.

Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20241205101937.2547351-1-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-17 13:13:16 +02:00
Thomas Weißschuh
8fa1a2e105
platform/x86/amd/hsmp: Constify 'struct bin_attribute'
The sysfs core now allows instances of 'struct bin_attribute' to be
moved into read-only memory. Make use of that to protect them against
accidental or malicious modifications.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241202-sysfs-const-bin_attr-pdx86-v1-5-9ab204c2a814@weissschuh.net
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-17 13:12:59 +02:00
Ilpo Järvinen
18131e9f16
Merge branch 'platform-drivers-x86-platform-profile' into for-next 2024-12-12 16:07:26 +02:00
Mario Limonciello
dd7ba84afa
platform/x86/amd: pmf: Drop all quirks
As multiple platform profile handlers can now be registered, the quirks
to avoid registering amd-pmf as a handler are no longer necessary.
Drop them.

Reviewed-by: Armin Wolf <W_Armin@gmx.de>
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Matthew Schwartz <matthew.schwartz@linux.dev>
Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20241206031918.1537-22-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-10 19:18:20 +02:00
Mario Limonciello
9b3bb37b44
ACPI: platform_profile: Add platform handler argument to platform_profile_remove()
To allow registering and unregistering multiple platform handlers calls
to platform_profile_remove() will need to know which handler is to be
removed.  Add an argument for this.

Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Matthew Schwartz <matthew.schwartz@linux.dev>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20241206031918.1537-5-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-10 19:17:51 +02:00
Mario Limonciello
6f5e63ddc3
ACPI: platform_profile: Add device pointer into platform profile handler
In order to let platform profile handlers manage platform profile
for their driver the core code will need a pointer to the device.

Add this to the structure and use it in the trivial driver cases.

Reviewed-by: Armin Wolf <W_Armin@gmx.de>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20241206031918.1537-4-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-10 19:17:49 +02:00
Mario Limonciello
549de562d7
ACPI: platform-profile: Add a name member to handlers
In order to prepare for allowing multiple handlers, introduce
a name field that can be used to distinguish between different
handlers.

Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Matthew Schwartz <matthew.schwartz@linux.dev>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20241206031918.1537-2-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-10 19:17:45 +02:00
Ilpo Järvinen
dd77ba8801
Merge import NS conversion from 'https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git' into for-next 2024-12-04 14:02:54 +02:00
Peter Zijlstra
cdd30ebb1b module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498f ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.

Scripted using

  git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
  do
    awk -i inplace '
      /^#define EXPORT_SYMBOL_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /^#define MODULE_IMPORT_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /MODULE_IMPORT_NS/ {
        $0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
      }
      /EXPORT_SYMBOL_NS/ {
        if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
  	if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
  	    $0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
  	    $0 !~ /^my/) {
  	  getline line;
  	  gsub(/[[:space:]]*\\$/, "");
  	  gsub(/[[:space:]]/, "", line);
  	  $0 = $0 " " line;
  	}

  	$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
  		    "\\1(\\2, \"\\3\")", "g");
        }
      }
      { print }' $file;
  done

Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 11:34:44 -08:00
Shyam Sundar S K
382fe403dc
platform/x86/amd/pmc: Add STB support for AMD Desktop variants
Previously, AMD's Ryzen Desktop SoCs did not include support for STB.
However, to accommodate this recent change, PMFW has implemented a new
message port pair mechanism for handling messages, arguments, and
responses, specifically designed for distinguishing from Mobile SoCs.
Therefore, it is necessary to update the driver to properly handle this
incoming change.

Add a new function amd_stb_update_args() to simply the arguments that
needs to be passed between S2D supported Mobile SoCs vs Desktop SoCs.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20241108070822.3912689-10-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-02 19:47:21 +02:00
Shyam Sundar S K
4aeca31780
platform/x86/amd/pmc: Update S2D message id for 1Ah Family 70h model
AMD's 1Ah family 70h model uses a different S2D (Spill to DRAM) message
ID. Update the driver with this information.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20241108070822.3912689-9-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-02 19:47:15 +02:00
Shyam Sundar S K
e22fbf27a6
platform/x86/amd/pmc: Update IP information structure for newer SoCs
The latest AMD processors include additional IP blocks that must be turned
off before transitioning to low power. PMFW provides an interface to
retrieve debug information from each IP block, which is useful for
diagnosing issues if the system fails to enter or exit low power states,
or for profiling which IP block takes more time. Add support for using
this information within the driver.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20241108070822.3912689-8-Shyam-sundar.S-k@amd.com
[ij: grouped active_ips, ips_ptr, and num_ips next to each other.]
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-02 19:46:07 +02:00
Shyam Sundar S K
0b4c20ff2b
platform/x86/amd/pmc: Use ARRAY_SIZE() to fill num_ips information
Instead of manually specifying num_ips, use ARRAY_SIZE() to set this value
based on the actual number of elements in the array.

Reviewed-by: Ilpo Jarvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20241108070822.3912689-7-Shyam-sundar.S-k@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-02 19:31:46 +02:00
Shyam Sundar S K
3279f7a6b7
platform/x86/amd/pmc: Isolate STB code changes to a new file
Since S2D (Spill to DRAM) uses different message port offsets compared to
PMC message offsets for communication with PMFW, relocate the S2D macros
from pmc.c to a new file, mp1_stb.c, for better code organization.

Following this change, it is logical to introduce a new structure,
"struct stb_arg," to pass the message, argument, and response offset
details to PMFW via the amd_pmc_send_cmd() call. Additionally, move the
s2d_msg_id member from amd_pmc_dev into the new structure.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20241108070822.3912689-6-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-02 19:31:44 +02:00
Shyam Sundar S K
2851f4f8ed
platform/x86/amd/pmc: Define enum for S2D/PMC msg_port and add helper function
To distinguish between the PMC message port and the S2D (Spill to DRAM)
message port, replace the use of 0 and 1 with an enum.

To avoid printing the S2D or PMC port multiple times in debug print,
add new routine to retrieve the message port information, which can be
used to print the right msg_port getting used.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20241108070822.3912689-5-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-02 19:31:42 +02:00
Shyam Sundar S K
00a8d00243
platform/x86/amd/pmc: Update function names to align with new STB file
With STB now in a separate file, update the function names to match the
correct naming schema by removing the _pmc_ prefix where needed.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20241108070822.3912689-4-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-02 19:31:41 +02:00
Shyam Sundar S K
0e914063dd
platform/x86/amd/pmc: Move STB functionality to a new file for better code organization
As the SoC evolves with each generation, the dynamics between the PMC and
STB layers within the PMC driver are becoming increasingly complex, making
it challenging to manage both in a single file and maintain code
readability.

Additionally, during silicon bringup, the PMC functionality is often
enabled first, with STB functionality added later. This can lead to missed
updates in the driver, potentially causing issues.

To address these challenges, it's beneficial to move all STB-related
changes to a separate file. This approach will better accommodate newer
SoCs, provide improved flexibility for desktop variants, and facilitate
the collection of additional debug information through STB mechanisms.

Also the additional checks for entering s2d_init have been moved from
the PMC probe to amd_pmc_s2d_init(). This adjustment makes more sense
following the transfer of code to the separate mp1_stb.c file.

Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20241108070822.3912689-3-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-02 19:31:39 +02:00
Shyam Sundar S K
83ad6974dd
platform/x86/amd/pmc: Move STB block into amd_pmc_s2d_init()
Transfer the support for STB-related file operations to the
amd_pmc_s2d_init() function, thereby consolidating the STB and S2D
(Spill to DRAM) functionality in one location. Also, relocate the
call to amd_pmc_s2d_init() to occur after the creation of the
"amd_pmc" debugfs directory. This ensures that the driver's root debugfs
directory is established beforehand.

For older platforms that supported S2D, exit immediately after creating
debugfs. These platforms may not support the PMFW messages available on
newer platforms. This adjustment is necessary due to the relocation of
debugfs creation into amd_pmc_s2d_init().

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20241108070822.3912689-2-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-02 19:31:35 +02:00
Suma Hegde
836d0d7107
platform/x86/amd/hsmp: Add support for HSMP protocol version 7 messages
Following new HSMP messages are available on family 0x1A, model 0x00-0x1F
platforms with protocol version 7. Add support for them in the driver.
- SetXgmiPstateRange(26h)
- CpuRailIsoFreqPolicy(27h)
- DfcEnable(28h)
- GetRaplUnit(30h)
- GetRaplCoreCounter(31h)
- GetRaplPackageCounter(32h)

Also update HSMP message PwrEfficiencyModeSelection-21h. This message is
updated to include GET option in recent firmware.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Link: https://lore.kernel.org/r/20241118102752.11703-1-suma.hegde@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-02 19:20:14 +02:00
Linus Torvalds
55cb93fd24 Driver core changes for 6.13-rc1
Here is a small set of driver core changes for 6.13-rc1.
 
 Nothing major for this merge cycle, except for the 2 simple merge
 conflicts are here just to make life interesting.
 
 Included in here are:
   - sysfs core changes and preparations for more sysfs api cleanups that
     can come through all driver trees after -rc1 is out
   - fw_devlink fixes based on many reports and debugging sessions
   - list_for_each_reverse() removal, no one was using it!
   - last-minute seq_printf() format string bug found and fixed in many
     drivers all at once.
   - minor bugfixes and changes full details in the shortlog
 
 As mentioned above, there is 2 merge conflicts with your tree, one is
 where the file is removed (easy enough to resolve), the second is a
 build time error, that has been found in linux-next and the fix can be
 seen here:
 	https://lore.kernel.org/r/20241107212645.41252436@canb.auug.org.au
 
 Other than that, the changes here have been in linux-next with no other
 reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZ0lEog8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ym+0ACgw6wN+LkLVIHWhxTq5DYHQ0QCxY8AoJrRIcKe
 78h0+OU3OXhOy8JGz62W
 =oI5S
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core updates from Greg KH:
 "Here is a small set of driver core changes for 6.13-rc1.

  Nothing major for this merge cycle, except for the two simple merge
  conflicts are here just to make life interesting.

  Included in here are:

   - sysfs core changes and preparations for more sysfs api cleanups
     that can come through all driver trees after -rc1 is out

   - fw_devlink fixes based on many reports and debugging sessions

   - list_for_each_reverse() removal, no one was using it!

   - last-minute seq_printf() format string bug found and fixed in many
     drivers all at once.

   - minor bugfixes and changes full details in the shortlog"

* tag 'driver-core-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (35 commits)
  Fix a potential abuse of seq_printf() format string in drivers
  cpu: Remove spurious NULL in attribute_group definition
  s390/con3215: Remove spurious NULL in attribute_group definition
  perf: arm-ni: Remove spurious NULL in attribute_group definition
  driver core: Constify bin_attribute definitions
  sysfs: attribute_group: allow registration of const bin_attribute
  firmware_loader: Fix possible resource leak in fw_log_firmware_info()
  drivers: core: fw_devlink: Fix excess parameter description in docstring
  driver core: class: Correct WARN() message in APIs class_(for_each|find)_device()
  cacheinfo: Use of_property_present() for non-boolean properties
  cdx: Fix cdx_mmap_resource() after constifying attr in ->mmap()
  drivers: core: fw_devlink: Make the error message a bit more useful
  phy: tegra: xusb: Set fwnode for xusb port devices
  drm: display: Set fwnode for aux bus devices
  driver core: fw_devlink: Stop trying to optimize cycle detection logic
  driver core: Constify attribute arguments of binary attributes
  sysfs: bin_attribute: add const read/write callback variants
  sysfs: implement all BIN_ATTR_* macros in terms of __BIN_ATTR()
  sysfs: treewide: constify attribute callback of bin_attribute::llseek()
  sysfs: treewide: constify attribute callback of bin_attribute::mmap()
  ...
2024-11-29 11:43:29 -08:00