All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Kurt Borja <kuurtb@gmail.com>
Cc: platform-driver-x86@vger.kernel.org,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>,
	 linux-acpi@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	 Mario Limonciello <mario.limonciello@amd.com>,
	Armin Wolf <W_Armin@gmx.de>,
	 Joshua Grisham <josh@joshuagrisham.com>,
	 "Derek J. Clark" <derekjohn.clark@gmail.com>,
	 Hans de Goede <hdegoede@redhat.com>,
	 Maximilian Luz <luzmaximilian@gmail.com>,
	"Lee, Chun-Yi" <jlee@suse.com>,
	 Shyam Sundar S K <Shyam-sundar.S-k@amd.com>,
	 Corentin Chary <corentin.chary@gmail.com>,
	 "Luke D. Jones" <luke@ljones.dev>,
	Lyndon Sanche <lsanche@lyndeno.ca>,
	 Ike Panhc <ike.pan@canonical.com>,
	 Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
	 Mark Pearson <mpearson-lenovo@squebb.ca>,
	 Alexis Belmonte <alexbelm48@gmail.com>,
	Ai Chao <aichao@kylinos.cn>,  Gergo Koteles <soyer@irl.hu>,
	Dell.Client.Kernel@dell.com,
	 ibm-acpi-devel@lists.sourceforge.net
Subject: Re: [PATCH v2 18/18] ACPI: platform_profile: Add documentation
Date: Tue, 14 Jan 2025 18:57:11 +0200 (EET)	[thread overview]
Message-ID: <0e10985e-2400-daee-00a9-3a6156214b3e@linux.intel.com> (raw)
In-Reply-To: <20250114153726.11802-19-kuurtb@gmail.com>

On Tue, 14 Jan 2025, Kurt Borja wrote:

> Add kerneldoc and sysfs class documentation.
> 
> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
> ---
>  .../ABI/testing/sysfs-class-platform-profile  | 44 +++++++++++++++++++
>  drivers/acpi/platform_profile.c               | 33 ++++++++++++++
>  include/linux/platform_profile.h              | 24 ++++++++++
>  3 files changed, 101 insertions(+)
>  create mode 100644 Documentation/ABI/testing/sysfs-class-platform-profile
> 
> diff --git a/Documentation/ABI/testing/sysfs-class-platform-profile b/Documentation/ABI/testing/sysfs-class-platform-profile
> new file mode 100644
> index 000000000000..b5a3600080bc
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-class-platform-profile
> @@ -0,0 +1,44 @@
> +What:		/sys/class/platform-profile/platform-profile-X/name
> +Date:		January 2025
> +Description:	Name of the class device given by the driver.
> +
> +		RO
> +
> +What:		/sys/class/platform-profile/platform-profile-X/choices
> +Date:		January 2025
> +Description:	This file contains a space-separated list of profiles supported for this device.
> +
> +		Drivers must use the following standard profile-names:
> +
> +		====================	========================================
> +		low-power		Low power consumption
> +		cool			Cooler operation
> +		quiet			Quieter operation
> +		balanced		Balance between low power consumption
> +					and performance
> +		balanced-performance	Balance between performance and low
> +					power consumption with a slight bias
> +					towards performance
> +		performance		High performance operation
> +		custom			Driver defined custom profile
> +		====================	========================================
> +
> +		RO
> +
> +What:		/sys/class/platform-profile/platform-profile-X/profile
> +Date:		January 2025
> +Description:	Reading this file gives the current selected profile for this
> +		device. Writing this file with one of the strings from
> +		platform_profile_choices changes the profile to the new value.
> +
> +		This file can be monitored for changes by polling for POLLPRI,
> +		POLLPRI will be signaled on any changes, independent of those
> +		changes coming from a userspace write; or coming from another
> +		source such as e.g. a hotkey triggered profile change handled
> +		either directly by the embedded-controller or fully handled
> +		inside the kernel.
> +
> +		This file may also emit the string 'custom' to indicate
> +		that the driver is using a driver defined custom profile.
> +
> +		RW
> diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
> index c44989801f8e..9caddac695b8 100644
> --- a/drivers/acpi/platform_profile.c
> +++ b/drivers/acpi/platform_profile.c
> @@ -426,6 +426,10 @@ static const struct attribute_group platform_profile_group = {
>  	.is_visible = profile_class_is_visible,
>  };
>  
> +/**
> + * platform_profile_notify - Notify class device and legacy sysfs interface
> + * @dev: The class device
> + */
>  void platform_profile_notify(struct device *dev)
>  {
>  	scoped_cond_guard(mutex_intr, return, &profile_lock) {
> @@ -435,6 +439,11 @@ void platform_profile_notify(struct device *dev)
>  }
>  EXPORT_SYMBOL_GPL(platform_profile_notify);
>  
> +/**
> + * platform_profile_cycle - Cycles profiles available on all registered class devices
> + *
> + * Return: 0 on success, -errno on failure
> + */
>  int platform_profile_cycle(void)
>  {
>  	enum platform_profile_option next = PLATFORM_PROFILE_LAST;
> @@ -478,6 +487,15 @@ int platform_profile_cycle(void)
>  }
>  EXPORT_SYMBOL_GPL(platform_profile_cycle);
>  
> +/**
> + * platform_profile_register - Creates and registers a platform profile class device
> + * @dev: Parent device
> + * @name: Name of the class device
> + * @drvdata: Driver data that will be attached to the class device
> + * @ops: Platform profile's mandatory operations
> + *
> + * Return: pointer to the new class device on success, ERR_PTR on failure
> + */
>  struct device *platform_profile_register(struct device *dev, const char *name,
>  					 void *drvdata,
>  					 const struct platform_profile_ops *ops)
> @@ -544,6 +562,12 @@ struct device *platform_profile_register(struct device *dev, const char *name,
>  }
>  EXPORT_SYMBOL_GPL(platform_profile_register);
>  
> +/**
> + * platform_profile_remove - Unregisters a platform profile class device
> + * @dev: Class device
> + *
> + * Return: 0
> + */
>  int platform_profile_remove(struct device *dev)
>  {
>  	struct platform_profile_handler *pprof = to_pprof_handler(dev);
> @@ -569,6 +593,15 @@ static void devm_platform_profile_release(struct device *dev, void *res)
>  	platform_profile_remove(*ppdev);
>  }
>  
> +/**
> + * devm_platform_profile_register - Device managed version of platform_profile_register
> + * @dev: Parent device
> + * @name: Name of the class device
> + * @drvdata: Driver data that will be attached to the class device
> + * @ops: Platform profile's mandatory operations
> + *
> + * Return: pointer to the new class device on success, ERR_PTR on failure
> + */
>  struct device *devm_platform_profile_register(struct device *dev, const char *name,
>  					      void *drvdata,
>  					      const struct platform_profile_ops *ops)
> diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h
> index eea1daf85616..eb4dc85dc18c 100644
> --- a/include/linux/platform_profile.h
> +++ b/include/linux/platform_profile.h
> @@ -28,6 +28,30 @@ enum platform_profile_option {
>  	PLATFORM_PROFILE_LAST, /*must always be last */
>  };
>  
> +/**
> + * struct platform_profile_ops - platform profile operations
> + * @probe:	Callback to setup choices available to the new class device.
> + *		Parameters are:
> + *		@drvdata: drvdata pointer passed to platform_profile_register.
> + *		@choices: Empty choices bitmap which the driver has to manually
> + *			  setup, by using set_bit() in bits corresponding to
> + *			  platform_profile_option values. These values will only
> + *			  be enforced when a new profile is selected from
> + *			  user-space.
> + * @profile_get: Callback that will be called when showing the current platform
> + *		 profile.
> + *		 Parameters are:
> + *		 @dev: Class device.
> + *		 @profile: Pointer to the profile which will be read from
> + *			   user-space. Selected choices are not enforced when
> + *			   modifying this value.
> + * @profile_set: Callback that will be called when storing the new platform
> + *		 profile.
> + *		 Parameters are:
> + *		 @dev: Class device.
> + *		 @profile: New platform profile to be set. Guaranteed to be a
> + *			   value selected in the @probe callback.

Does kerneldoc render this sensibly?

> + */
>  struct platform_profile_ops {
>  	int (*probe)(void *drvdata, unsigned long *choices);
>  	int (*profile_get)(struct device *dev, enum platform_profile_option *profile);
> 

-- 
 i.


  parent reply	other threads:[~2025-01-14 16:57 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-14 15:37 [PATCH v2 00/18] Hide platform_profile_handler from consumers Kurt Borja
2025-01-14 15:37 ` [PATCH v2 01/18] ACPI: platform_profile: Replace *class_dev member with class_dev Kurt Borja
2025-01-14 15:37 ` [PATCH v2 02/18] ACPI: platform_profile: Let drivers set drvdata to the class device Kurt Borja
2025-01-14 15:37 ` [PATCH v2 03/18] ACPI: platform_profile: Remove platform_profile_handler from callbacks Kurt Borja
2025-01-14 15:59   ` Mario Limonciello
2025-01-14 15:37 ` [PATCH v2 04/18] ACPI: platform_profile: Add `ops` member to handlers Kurt Borja
2025-01-14 15:37 ` [PATCH v2 05/18] ACPI: platform_profile: Add `probe` to platform_profile_ops Kurt Borja
2025-01-14 16:20   ` Mario Limonciello
2025-01-14 16:31     ` Kurt Borja
2025-01-14 16:36       ` Mario Limonciello
2025-01-14 15:37 ` [PATCH v2 06/18] platform/surface: surface_platform_profile: Use devm_platform_profile_register() Kurt Borja
2025-01-14 15:37 ` [PATCH v2 07/18] platform/x86: acer-wmi: " Kurt Borja
2025-01-14 15:37 ` [PATCH v2 08/18] platform/x86: amd: pmf: sps: " Kurt Borja
2025-01-14 15:37 ` [PATCH v2 09/18] platform/x86: asus-wmi: " Kurt Borja
2025-01-14 15:37 ` [PATCH v2 10/18] platform/x86: dell-pc: " Kurt Borja
2025-01-14 15:37 ` [PATCH v2 11/18] platform/x86: ideapad-laptop: " Kurt Borja
2025-01-14 15:37 ` [PATCH v2 12/18] platform/x86: hp-wmi: " Kurt Borja
2025-01-14 15:37 ` [PATCH v2 13/18] platform/x86: inspur_platform_profile: " Kurt Borja
2025-01-14 15:37 ` [PATCH v2 14/18] platform/x86: thinkpad_acpi: " Kurt Borja
2025-01-14 15:37 ` [PATCH v2 15/18] ACPI: platform_profile: Remove platform_profile_handler from exported symbols Kurt Borja
2025-01-14 16:22   ` Mario Limonciello
2025-01-14 16:55   ` Ilpo Järvinen
2025-01-14 17:13     ` Rafael J. Wysocki
2025-01-14 17:26     ` Kurt Borja
2025-01-14 17:55       ` Ilpo Järvinen
2025-01-15  2:45         ` Kurt Borja
2025-01-14 15:37 ` [PATCH v2 16/18] ACPI: platform_profile: Move platform_profile_handler Kurt Borja
2025-01-14 15:37 ` [PATCH v2 17/18] ACPI: platform_profile: Clean platform_profile_handler Kurt Borja
2025-01-14 15:37 ` [PATCH v2 18/18] ACPI: platform_profile: Add documentation Kurt Borja
2025-01-14 16:24   ` Mario Limonciello
2025-01-14 16:57   ` Ilpo Järvinen [this message]
2025-01-14 17:27     ` Kurt Borja
2025-01-14 17:15 ` [PATCH v2 00/18] Hide platform_profile_handler from consumers Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0e10985e-2400-daee-00a9-3a6156214b3e@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=Dell.Client.Kernel@dell.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=W_Armin@gmx.de \
    --cc=aichao@kylinos.cn \
    --cc=alexbelm48@gmail.com \
    --cc=corentin.chary@gmail.com \
    --cc=derekjohn.clark@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=hmh@hmh.eng.br \
    --cc=ibm-acpi-devel@lists.sourceforge.net \
    --cc=ike.pan@canonical.com \
    --cc=jlee@suse.com \
    --cc=josh@joshuagrisham.com \
    --cc=kuurtb@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lsanche@lyndeno.ca \
    --cc=luke@ljones.dev \
    --cc=luzmaximilian@gmail.com \
    --cc=mario.limonciello@amd.com \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=soyer@irl.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.