mirror of
https://github.com/VIKINGYFY/immortalwrt.git
synced 2025-12-16 17:15:26 +00:00
158 lines
6.5 KiB
Diff
158 lines
6.5 KiB
Diff
From 7f8ce4d88b42fcbd3350370ec4d02e00979fc5a9 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@baylibre.com>
|
|
Date: Thu, 17 Apr 2025 20:16:11 +0200
|
|
Subject: [PATCH] pwm: Fix various formatting issues in kernel-doc
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Add Return and (where interesting) Context sections, fix some formatting
|
|
and drop documenting the internal function __pwm_apply().
|
|
|
|
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
|
|
Link: https://lore.kernel.org/r/20250417181611.2693599-2-u.kleine-koenig@baylibre.com
|
|
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
|
|
---
|
|
drivers/pwm/core.c | 42 +++++++++++++++++++++++++++---------------
|
|
include/linux/pwm.h | 8 +++++---
|
|
2 files changed, 32 insertions(+), 18 deletions(-)
|
|
|
|
--- a/drivers/pwm/core.c
|
|
+++ b/drivers/pwm/core.c
|
|
@@ -216,14 +216,14 @@ static int __pwm_write_waveform(struct p
|
|
*
|
|
* Typically a given waveform cannot be implemented exactly by hardware, e.g.
|
|
* because hardware only supports coarse period resolution or no duty_offset.
|
|
- * This function returns the actually implemented waveform if you pass wf to
|
|
- * pwm_set_waveform_might_sleep now.
|
|
+ * This function returns the actually implemented waveform if you pass @wf to
|
|
+ * pwm_set_waveform_might_sleep() now.
|
|
*
|
|
* Note however that the world doesn't stop turning when you call it, so when
|
|
- * doing
|
|
+ * doing::
|
|
*
|
|
- * pwm_round_waveform_might_sleep(mypwm, &wf);
|
|
- * pwm_set_waveform_might_sleep(mypwm, &wf, true);
|
|
+ * pwm_round_waveform_might_sleep(mypwm, &wf);
|
|
+ * pwm_set_waveform_might_sleep(mypwm, &wf, true);
|
|
*
|
|
* the latter might fail, e.g. because an input clock changed its rate between
|
|
* these two calls and the waveform determined by
|
|
@@ -233,8 +233,9 @@ static int __pwm_write_waveform(struct p
|
|
* value (in the order period_length_ns, duty_length_ns and then
|
|
* duty_offset_ns). Only if this isn't possible, a value might grow.
|
|
*
|
|
- * Returns 0 on success, 1 if at least one value had to be rounded up or a
|
|
+ * Returns: 0 on success, 1 if at least one value had to be rounded up or a
|
|
* negative errno.
|
|
+ * Context: May sleep.
|
|
*/
|
|
int pwm_round_waveform_might_sleep(struct pwm_device *pwm, struct pwm_waveform *wf)
|
|
{
|
|
@@ -291,6 +292,9 @@ EXPORT_SYMBOL_GPL(pwm_round_waveform_mig
|
|
*
|
|
* Stores the current configuration of the PWM in @wf. Note this is the
|
|
* equivalent of pwm_get_state_hw() (and not pwm_get_state()) for pwm_waveform.
|
|
+ *
|
|
+ * Returns: 0 on success or a negative errno
|
|
+ * Context: May sleep.
|
|
*/
|
|
int pwm_get_waveform_might_sleep(struct pwm_device *pwm, struct pwm_waveform *wf)
|
|
{
|
|
@@ -399,13 +403,17 @@ static int __pwm_set_waveform(struct pwm
|
|
*
|
|
* Typically a requested waveform cannot be implemented exactly, e.g. because
|
|
* you requested .period_length_ns = 100 ns, but the hardware can only set
|
|
- * periods that are a multiple of 8.5 ns. With that hardware passing exact =
|
|
+ * periods that are a multiple of 8.5 ns. With that hardware passing @exact =
|
|
* true results in pwm_set_waveform_might_sleep() failing and returning 1. If
|
|
- * exact = false you get a period of 93.5 ns (i.e. the biggest period not bigger
|
|
+ * @exact = false you get a period of 93.5 ns (i.e. the biggest period not bigger
|
|
* than the requested value).
|
|
- * Note that even with exact = true, some rounding by less than 1 is
|
|
+ * Note that even with @exact = true, some rounding by less than 1 ns is
|
|
* possible/needed. In the above example requesting .period_length_ns = 94 and
|
|
- * exact = true, you get the hardware configured with period = 93.5 ns.
|
|
+ * @exact = true, you get the hardware configured with period = 93.5 ns.
|
|
+ *
|
|
+ * Returns: 0 on success, 1 if was rounded up (if !@exact) or no perfect match was
|
|
+ * possible (if @exact), or a negative errno
|
|
+ * Context: May sleep.
|
|
*/
|
|
int pwm_set_waveform_might_sleep(struct pwm_device *pwm,
|
|
const struct pwm_waveform *wf, bool exact)
|
|
@@ -565,11 +573,6 @@ static bool pwm_state_valid(const struct
|
|
return true;
|
|
}
|
|
|
|
-/**
|
|
- * __pwm_apply() - atomically apply a new state to a PWM device
|
|
- * @pwm: PWM device
|
|
- * @state: new state to apply
|
|
- */
|
|
static int __pwm_apply(struct pwm_device *pwm, const struct pwm_state *state)
|
|
{
|
|
struct pwm_chip *chip;
|
|
@@ -678,6 +681,9 @@ static int __pwm_apply(struct pwm_device
|
|
* Cannot be used in atomic context.
|
|
* @pwm: PWM device
|
|
* @state: new state to apply
|
|
+ *
|
|
+ * Returns: 0 on success, or a negative errno
|
|
+ * Context: May sleep.
|
|
*/
|
|
int pwm_apply_might_sleep(struct pwm_device *pwm, const struct pwm_state *state)
|
|
{
|
|
@@ -719,6 +725,9 @@ EXPORT_SYMBOL_GPL(pwm_apply_might_sleep)
|
|
* Not all PWM devices support this function, check with pwm_might_sleep().
|
|
* @pwm: PWM device
|
|
* @state: new state to apply
|
|
+ *
|
|
+ * Returns: 0 on success, or a negative errno
|
|
+ * Context: Any
|
|
*/
|
|
int pwm_apply_atomic(struct pwm_device *pwm, const struct pwm_state *state)
|
|
{
|
|
@@ -778,6 +787,9 @@ static int pwm_get_state_hw(struct pwm_d
|
|
* This function will adjust the PWM config to the PWM arguments provided
|
|
* by the DT or PWM lookup table. This is particularly useful to adapt
|
|
* the bootloader config to the Linux one.
|
|
+ *
|
|
+ * Returns: 0 on success or a negative error code on failure.
|
|
+ * Context: May sleep.
|
|
*/
|
|
int pwm_adjust_config(struct pwm_device *pwm)
|
|
{
|
|
--- a/include/linux/pwm.h
|
|
+++ b/include/linux/pwm.h
|
|
@@ -218,6 +218,8 @@ static inline void pwm_init_state(const
|
|
*
|
|
* pwm_get_state(pwm, &state);
|
|
* duty = pwm_get_relative_duty_cycle(&state, 100);
|
|
+ *
|
|
+ * Returns: rounded relative duty cycle multiplied by @scale
|
|
*/
|
|
static inline unsigned int
|
|
pwm_get_relative_duty_cycle(const struct pwm_state *state, unsigned int scale)
|
|
@@ -244,8 +246,8 @@ pwm_get_relative_duty_cycle(const struct
|
|
* pwm_set_relative_duty_cycle(&state, 50, 100);
|
|
* pwm_apply_might_sleep(pwm, &state);
|
|
*
|
|
- * This functions returns -EINVAL if @duty_cycle and/or @scale are
|
|
- * inconsistent (@scale == 0 or @duty_cycle > @scale).
|
|
+ * Returns: 0 on success or ``-EINVAL`` if @duty_cycle and/or @scale are
|
|
+ * inconsistent (@scale == 0 or @duty_cycle > @scale)
|
|
*/
|
|
static inline int
|
|
pwm_set_relative_duty_cycle(struct pwm_state *state, unsigned int duty_cycle,
|
|
@@ -346,7 +348,7 @@ struct pwm_chip {
|
|
* pwmchip_supports_waveform() - checks if the given chip supports waveform callbacks
|
|
* @chip: The pwm_chip to test
|
|
*
|
|
- * Returns true iff the pwm chip support the waveform functions like
|
|
+ * Returns: true iff the pwm chip support the waveform functions like
|
|
* pwm_set_waveform_might_sleep() and pwm_round_waveform_might_sleep()
|
|
*/
|
|
static inline bool pwmchip_supports_waveform(struct pwm_chip *chip)
|