Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: platform_profile: Add documentation

Add kerneldoc and sysfs class documentation.

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-19-kuurtb@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Kurt Borja and committed by
Ilpo Järvinen
ee7f3e2b c4f7d255

+91
+48
Documentation/ABI/testing/sysfs-class-platform-profile
··· 1 + What: /sys/class/platform-profile/platform-profile-X/name 2 + Date: March 2025 3 + KernelVersion: 6.14 4 + Description: Name of the class device given by the driver. 5 + 6 + RO 7 + 8 + What: /sys/class/platform-profile/platform-profile-X/choices 9 + Date: March 2025 10 + KernelVersion: 6.14 11 + Description: This file contains a space-separated list of profiles supported 12 + for this device. 13 + 14 + Drivers must use the following standard profile-names: 15 + 16 + ==================== ======================================== 17 + low-power Low power consumption 18 + cool Cooler operation 19 + quiet Quieter operation 20 + balanced Balance between low power consumption 21 + and performance 22 + balanced-performance Balance between performance and low 23 + power consumption with a slight bias 24 + towards performance 25 + performance High performance operation 26 + custom Driver defined custom profile 27 + ==================== ======================================== 28 + 29 + RO 30 + 31 + What: /sys/class/platform-profile/platform-profile-X/profile 32 + Date: March 2025 33 + KernelVersion: 6.14 34 + Description: Reading this file gives the current selected profile for this 35 + device. Writing this file with one of the strings from 36 + platform_profile_choices changes the profile to the new value. 37 + 38 + This file can be monitored for changes by polling for POLLPRI, 39 + POLLPRI will be signaled on any changes, independent of those 40 + changes coming from a userspace write; or coming from another 41 + source such as e.g. a hotkey triggered profile change handled 42 + either directly by the embedded-controller or fully handled 43 + inside the kernel. 44 + 45 + This file may also emit the string 'custom' to indicate 46 + that the driver is using a driver defined custom profile. 47 + 48 + RW
+33
drivers/acpi/platform_profile.c
··· 425 425 .is_visible = profile_class_is_visible, 426 426 }; 427 427 428 + /** 429 + * platform_profile_notify - Notify class device and legacy sysfs interface 430 + * @dev: The class device 431 + */ 428 432 void platform_profile_notify(struct device *dev) 429 433 { 430 434 scoped_cond_guard(mutex_intr, return, &profile_lock) { ··· 438 434 } 439 435 EXPORT_SYMBOL_GPL(platform_profile_notify); 440 436 437 + /** 438 + * platform_profile_cycle - Cycles profiles available on all registered class devices 439 + * 440 + * Return: 0 on success, -errno on failure 441 + */ 441 442 int platform_profile_cycle(void) 442 443 { 443 444 enum platform_profile_option next = PLATFORM_PROFILE_LAST; ··· 486 477 } 487 478 EXPORT_SYMBOL_GPL(platform_profile_cycle); 488 479 480 + /** 481 + * platform_profile_register - Creates and registers a platform profile class device 482 + * @dev: Parent device 483 + * @name: Name of the class device 484 + * @drvdata: Driver data that will be attached to the class device 485 + * @ops: Platform profile's mandatory operations 486 + * 487 + * Return: pointer to the new class device on success, ERR_PTR on failure 488 + */ 489 489 struct device *platform_profile_register(struct device *dev, const char *name, 490 490 void *drvdata, 491 491 const struct platform_profile_ops *ops) ··· 564 546 } 565 547 EXPORT_SYMBOL_GPL(platform_profile_register); 566 548 549 + /** 550 + * platform_profile_remove - Unregisters a platform profile class device 551 + * @dev: Class device 552 + * 553 + * Return: 0 554 + */ 567 555 int platform_profile_remove(struct device *dev) 568 556 { 569 557 struct platform_profile_handler *pprof = to_pprof_handler(dev); ··· 595 571 platform_profile_remove(*ppdev); 596 572 } 597 573 574 + /** 575 + * devm_platform_profile_register - Device managed version of platform_profile_register 576 + * @dev: Parent device 577 + * @name: Name of the class device 578 + * @drvdata: Driver data that will be attached to the class device 579 + * @ops: Platform profile's mandatory operations 580 + * 581 + * Return: pointer to the new class device on success, ERR_PTR on failure 582 + */ 598 583 struct device *devm_platform_profile_register(struct device *dev, const char *name, 599 584 void *drvdata, 600 585 const struct platform_profile_ops *ops)
+10
include/linux/platform_profile.h
··· 28 28 PLATFORM_PROFILE_LAST, /*must always be last */ 29 29 }; 30 30 31 + /** 32 + * struct platform_profile_ops - platform profile operations 33 + * @probe: Callback to setup choices available to the new class device. These 34 + * choices will only be enforced when setting a new profile, not when 35 + * getting the current one. 36 + * @profile_get: Callback that will be called when showing the current platform 37 + * profile in sysfs. 38 + * @profile_set: Callback that will be called when storing a new platform 39 + * profile in sysfs. 40 + */ 31 41 struct platform_profile_ops { 32 42 int (*probe)(void *drvdata, unsigned long *choices); 33 43 int (*profile_get)(struct device *dev, enum platform_profile_option *profile);