Thomas Weißschuh
d0eee1be37
platform/x86: firmware_attributes_class: Move include linux/device/class.h
...
The header firmware_attributes_class.h uses 'struct class'. It should
also include the necessary dependency header.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com >
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca >
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
Link: https://lore.kernel.org/r/20250104-firmware-attributes-simplify-v1-1-949f9709e405@weissschuh.net
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:40:17 +02:00
Nitin Joshi
053c409951
platform/x86: thinkpad-acpi: replace strcpy with strscpy
...
strcpy() performs no bounds checking on the destination buffer. This
could result in linear overflows beyond the end of the buffer, leading
to all kinds of misbehaviors.[1]
[1]: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy
Signed-off-by: Nitin Joshi <nitjoshi@gmail.com >
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca >
Link: https://lore.kernel.org/r/20250107021507.4786-1-nitjoshi@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-09 13:40:15 +02:00
Ilpo Järvinen
595c4b6724
Merge branch 'intel-sst' of https://github.com/spandruvada/linux-kernel into review-ilpo-next
2025-01-09 13:39:19 +02:00
Hridesh MG
98e45f0d7b
docs: platform/x86: wmi: mention tool for invoking WMI methods
...
Add a reference to WMIExplorer, a tool useful for inspecting and
invoking WMI methods on Windows. This can assist developers in testing
and understanding WMI device functionality when porting drivers to
Linux.
Signed-off-by: Hridesh MG <hridesh699@gmail.com >
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
Link: https://lore.kernel.org/r/20250101092730.87160-1-hridesh699@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-09 13:38:39 +02: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
Basavaraj Natikar
d1c444b471
HID: amd_sfh: Add support to export device operating states
...
Add support to export device operating states, such as laptop placement,
platform types and propagate this data to AMD PMF driver for use in
actions.
To retrieve the device operating states data, SRA sensor support need to
be enabled in AMD SFH driver. So add support to enable the SRA sensor.
Also, remove explicit assignments to sensor_index enum.
Co-developed-by: Akshata MukundShetty <akshata.mukundshetty@amd.com >
Signed-off-by: Akshata MukundShetty <akshata.mukundshetty@amd.com >
Signed-off-by: Basavaraj Natikar <basavaraj.natikar@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-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-01-09 13:38:04 +02:00
Srinivas Pandruvada
600c8f2431
tools/power/x86/intel-speed-select: v1.21 release
...
This version has one fix:
- Fix restoring TRL after SST-TF disable
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com >
2025-01-03 06:29:03 -08:00
Srinivas Pandruvada
991c8aacfb
tools/power/x86/intel-speed-select: Fix TRL restore after SST-TF disable
...
When SST-TF is disabled, the TRL (Turbo Ratio Limit) of config level 0
is getting restored. But the TRL of current level should be restored
which may not be config level 0.
This is caused by a bug in treating config level as TRL level. So
arguments needs to be swapped.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com >
2025-01-03 06:29:02 -08:00
Kurt Borja
6b228cfc52
alienware-wmi: Use devm_platform_profile_register()
...
Replace platform_profile_register() with it's device managed version.
Drop remove_thermal_profile() because it's no longer needed.
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
Signed-off-by: Kurt Borja <kuurtb@gmail.com >
Link: https://lore.kernel.org/r/20241224140131.30362-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 >
2024-12-30 20:22:55 +02:00
Ilpo Järvinen
c416a3fed7
Merge branch 'platform-drivers-x86-platform-profile' into for-next
2024-12-30 20:21:09 +02:00
Kurt Borja
b651ea8a44
ACPI: platform_profile: Add devm_platform_profile_register()
...
Platform profile's lifetime is usually tied to a device's lifetime,
therefore add a device managed version of platform_profile_register().
Signed-off-by: Kurt Borja <kuurtb@gmail.com >
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
Link: https://lore.kernel.org/r/20241224140131.30362-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 >
2024-12-29 18:27:22 +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
8ba0e61861
mlxbf-bootctl: 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/20241215-sysfs-const-bin_attr-mellanox-v1-1-b6fe4f68e2ca@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:13:14 +02:00
Thomas Zimmermann
a2ec08e43f
platform/x86: dell-uart-backlight: Use blacklight power constant
...
The backlight subsystem has gotten its own power constants. Replace
FB_BLANK_UNBLANK with BACKLIGHT_POWER_ON.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
Link: https://lore.kernel.org/r/20241213100647.200598-1-tzimmermann@suse.de
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:13 +02:00
Armin Wolf
0c91d916af
platform/x86: wmi-bmof: Make use of .bin_size() callback
...
Until now the wmi-bmof driver had to allocate the binary sysfs
attribute dynamically since its size depends on the bmof buffer
returned by the firmware.
Use the new .bin_size() callback to avoid having to do this memory
allocation.
Tested on a Asus Prime B650-Plus.
Signed-off-by: Armin Wolf <W_Armin@gmx.de >
Link: https://lore.kernel.org/r/20241206215650.2977-1-W_Armin@gmx.de
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:10 +02:00
Arnd Bergmann
204d45fe68
platform/x86/intel: bytcrc_pwrsrc: fix power_supply dependency
...
The driver now fails to link when the power supply core is missing
or in a loadable module:
_64-linux/bin/x86_64-linux-ld: drivers/platform/x86/intel/bytcrc_pwrsrc.o: in function `crc_pwrsrc_irq_handler':
bytcrc_pwrsrc.c:(.text+0x2aa): undefined reference to `power_supply_changed'
x86_64-linux-ld: drivers/platform/x86/intel/bytcrc_pwrsrc.o: in function `crc_pwrsrc_psy_get_property':
bytcrc_pwrsrc.c:(.text+0x2f6): undefined reference to `power_supply_get_drvdata'
x86_64-linux-ld: drivers/platform/x86/intel/bytcrc_pwrsrc.o: in function `crc_pwrsrc_probe':
bytcrc_pwrsrc.c:(.text+0x644): undefined reference to `devm_power_supply_register'
Add the appropriate dependency for it.
Fixes: 0130ec83c5 ("platform/x86/intel: bytcrc_pwrsrc: Optionally register a power_supply dev")
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20241216083409.1885677-1-arnd@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-17 13:13:09 +02:00
Hans de Goede
e21bff27f2
platform/x86: dell-smo8800: Add a couple more models to lis3lv02d_devices[]
...
Add the accelerometer address for the following laptop models
to lis3lv02d_devices[]:
Dell Latitude E6330
Dell Latitude E6430
Dell XPS 15 9550
Tested-by: Hans de Goede <hdegoede@redhat.com >
Reviewed-by: Pali Rohár <pali@kernel.org >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20241209183557.7560-4-hdegoede@redhat.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:07 +02:00
Hans de Goede
cc0809b752
platform/x86: dell-smo8800: Move instantiation of lis3lv02d i2c_client from i2c-i801 to dell-lis3lv02d
...
Various Dell laptops have an lis3lv02d freefall/accelerometer sensor.
The lis3lv02d chip has an interrupt line as well as an I2C connection to
the system's main SMBus.
The lis3lv02d is described in the ACPI tables by an SMO88xx ACPI device,
but the SMO88xx ACPI fwnodes are incomplete and only list an IRQ resource.
So far this has been worked around with some SMO88xx specific quirk code
in the generic i2c-i801 driver, but it is not necessary to handle the Dell
specific instantiation of i2c_client-s for SMO88xx ACPI devices there.
The kernel already instantiates platform_device-s for these with an
acpi:SMO88xx modalias. The drivers/platform/x86/dell/dell-smo8800.c
driver binds to this platform device but this only deals with
the interrupt resource. Add a drivers/platform/x86/dell/dell-lis3lv02d.c
which will matches on the same acpi:SMO88xx modaliases and move
the i2c_client instantiation from the generic i2c-i801 driver there.
Moving the i2c_client instantiation has the following advantages:
1. This moves the SMO88xx ACPI device quirk handling away from the generic
i2c-i801 module which is loaded on all Intel x86 machines to a module
which will only be loaded when there is an ACPI SMO88xx device.
2. This removes the duplication of the SMO88xx ACPI Hardware ID (HID) table
between the i2c-i801 and dell-smo8800 drivers.
3. This allows extending the quirk handling by adding new code and related
module parameters to the dell-lis3lv02d driver, without needing to modify
the i2c-i801 code.
Reviewed-by: Pali Rohár <pali@kernel.org >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
Acked-by: Wolfram Sang <wsa@kernel.org >
Link: https://lore.kernel.org/r/20241209183557.7560-3-hdegoede@redhat.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:05 +02:00
Hans de Goede
bdf0ea9d52
platform/x86: dell-smo8800: Move SMO88xx acpi_device_ids to dell-smo8800-ids.h
...
Move the SMO88xx acpi_device_ids to a new dell-smo8800-ids.h header,
so that these can be shared with the new dell-lis3lv02d code.
Reviewed-by: Pali Rohár <pali@kernel.org >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20241209183557.7560-2-hdegoede@redhat.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:03 +02:00
Ilpo Järvinen
3bc018395f
platform/x86/intel/tpmi/plr: Make char[] longer to silence warning
...
W=1 build triggers this warning:
drivers/platform/x86/intel/plr_tpmi.c:315:55: error: ‘snprintf’ output
may be truncated before the last format character
[-Werror=format-truncation=]
315 | snprintf(name, sizeof(name), "domain%d", i);
| ^
drivers/platform/x86/intel/plr_tpmi.c:315:17: note: ‘snprintf’ output
between 8 and 17 bytes into a destination of size 16
315 | snprintf(name, sizeof(name), "domain%d", i);
Inspecting the code tells that maximum i in intel_plr_probe() will fit
into u8 because it comes from:
struct intel_tpmi_pfs_entry {
...
u64 num_entries:8;
...but compiler does not know that. Saving one byte in name[] at the
expense of a warning with W=1 seems a bad trade so simply make it
name[17].
Link: https://lore.kernel.org/r/20241210140115.1375-1-ilpo.jarvinen@linux.intel.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-17 13:13:01 +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
Thomas Weißschuh
7ff2fecc8b
platform/x86/intel/pmt: 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-4-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:57 +02:00
Thomas Weißschuh
b0034f206f
platform/x86/intel/sdsi: 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-3-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:52 +02:00
Thomas Weißschuh
fbabd3dbb5
platform/x86: dell_rbu: 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-2-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:49 +02:00
Thomas Weißschuh
c0cc60b392
platform/x86: dell: dcdbas: 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.
While at it switch from the custom DCDBAS_BIN_ATTR_RW() to the identical
BIN_ATTR_RW() macro.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
Link: https://lore.kernel.org/r/20241202-sysfs-const-bin_attr-pdx86-v1-1-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:11:42 +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
0056b0852c
Documentation: Add documentation about class interface for platform profiles
...
The class interface allows changing multiple platform profiles on a system
to different values. The semantics of it are similar to the legacy
interface.
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
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-23-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:18:22 +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
688834743d
ACPI: platform_profile: Allow multiple handlers
...
Multiple drivers may attempt to register platform profile handlers,
but only one may be registered and the behavior is non-deterministic
for which one wins. It's mostly controlled by probing order.
This can be problematic if one driver changes CPU settings and another
driver notifies the EC for changing fan curves.
Modify the ACPI platform profile handler to let multiple drivers
register platform profile handlers and abstract this detail from userspace.
To avoid undefined behaviors only offer profiles that are commonly
advertised across multiple handlers.
If any problems occur when changing profiles for any driver, then the
drivers that were already changed remain changed and the legacy sysfs
handler will report 'custom'.
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
Tested-by: Matthew Schwartz <matthew.schwartz@linux.dev >
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca >
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
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-21-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:18:18 +02:00
Mario Limonciello
37a6853d83
ACPI: platform_profile: Notify class device from platform_profile_notify()
...
When a driver has called platform_profile_notify() both the legacy sysfs
interface and the class device should be notified as userspace may listen
to either.
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
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-20-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:18:16 +02:00
Mario Limonciello
70246f89c5
ACPI: platform_profile: Check all profile handler to calculate next
...
As multiple platform profile handlers might not all support the same
profile, cycling to the next profile could have a different result
depending on what handler are registered.
Check what is active and supported by all handlers to decide what
to do.
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
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-19-mario.limonciello@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-10 19:18:14 +02:00
Mario Limonciello
e836b7dfba
ACPI: platform_profile: Make sure all profile handlers agree on profile
...
If for any reason multiple profile handlers don't agree on the profile
return the custom profile.
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
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-18-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:18:13 +02:00
Mario Limonciello
494637cf5b
ACPI: platform_profile: Add concept of a "custom" profile
...
When two profile handlers don't agree on the current profile it's ambiguous
what to show to the legacy sysfs interface.
Add a "custom" profile string that userspace will be able to use the legacy
sysfs interface to distinguish this situation..
Additionally drivers can choose to use this to indicate that a user has
modified driver settings in a way that the platform profile advertised by
a driver is not accurate.
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
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-17-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:18:11 +02:00
Mario Limonciello
06ec24388f
ACPI: platform_profile: Only show profiles common for all handlers
...
If multiple platform profile handlers have been registered, don't allow
switching to profiles unique to only one handler.
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
Tested-by: Matthew Schwartz <matthew.schwartz@linux.dev >
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-16-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:18:10 +02:00
Mario Limonciello
e5fe5ddc38
ACPI: platform_profile: Notify change events on register and unregister
...
As multiple platform profile handlers may come and go, send a notification
to userspace each time that a platform profile handler is registered or
unregistered.
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
Tested-by: Matthew Schwartz <matthew.schwartz@linux.dev >
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-15-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:18:08 +02:00
Mario Limonciello
d2785e3942
ACPI: platform_profile: Add profile attribute for class interface
...
Reading and writing the `profile` sysfs file will use the callbacks for
the platform profile handler to read or set the given profile.
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca >
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
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-14-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:18:06 +02:00
Mario Limonciello
52a67be8ee
ACPI: platform_profile: Add choices attribute for class interface
...
The `choices` file will show all possible choices that a given platform
profile handler can support.
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
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-13-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:18:04 +02:00
Mario Limonciello
97cab71d71
ACPI: platform_profile: Add name attribute to class interface
...
The name attribute shows the name of the associated platform profile
handler.
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
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-12-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:18:03 +02:00
Mario Limonciello
77be5cacb2
ACPI: platform_profile: Create class for ACPI platform profile
...
When registering a platform profile handler create a class device
that will allow changing a single platform profile handler.
The class and sysfs group are no longer needed when the platform profile
core is a module and unloaded, so remove them at that time as well.
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
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-11-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:18:01 +02:00
Mario Limonciello
1f3ac55c2e
ACPI: platform_profile: Use scoped_cond_guard
...
Migrate away from using an interruptible mutex to scoped_cond_guard
in all functions. While changing, move the sysfs notification
used in platform_profile_store() outside of mutex scope.
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
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-10-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:17:59 +02:00
Mario Limonciello
55b1e68134
ACPI: platform_profile: Use guard(mutex) for register/unregister
...
guard(mutex) can be used to automatically release mutexes when going
out of scope.
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: 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-9-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:17:57 +02:00
Mario Limonciello
ab431a2075
ACPI: platform_profile: Move matching string for new profile out of mutex
...
Holding the mutex is not necessary while scanning the string passed into
platform_profile_store().
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
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-8-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:17:56 +02:00
Mario Limonciello
585484003d
ACPI: platform_profile: Move sanity check out of the mutex
...
The sanity check that the platform handler had choices set doesn't
need the mutex taken. Move it to earlier in the registration.
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
Tested-by: Matthew Schwartz <matthew.schwartz@linux.dev >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca >
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-7-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:17:54 +02:00
Mario Limonciello
4d5c027bf5
ACPI: platform_profile: Pass the profile handler into platform_profile_notify()
...
The profile handler will be used to notify the appropriate class
devices.
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
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-6-mario.limonciello@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-10 19:17:53 +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
7c63fe4dcd
platform/x86/dell: dell-pc: Create platform device
...
In order to have a device for the platform profile core to reference
create a platform device for dell-pc.
While doing this change the memory allocation for the thermal handler
to be device managed to follow the lifecycle of that device.
Reviewed-by: Armin Wolf <W_Armin@gmx.de >
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.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-3-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-12-10 19:17:48 +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