Skip to content

Commit e463b05

Browse files
ukleinekUwe Kleine-König
authored andcommitted
pwm: Better document return value of pwm_round_waveform_might_sleep()
Better explain how pwm_round_waveform_might_sleep() (and so the respective lowlevel driver callback) is supposed to round and the meaning of the return value. Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/db84abf1e82e4498fc0e7c318d2673771d0039fe.1744120697.git.ukleinek@kernel.org [ukleinek: Fix a rst formatting issue reported by Stephen Rothwell] Signed-off-by: Uwe Kleine-König <[email protected]>
1 parent bd89714 commit e463b05

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/pwm/core.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,12 @@ static int __pwm_write_waveform(struct pwm_chip *chip, struct pwm_device *pwm, c
229229
* these two calls and the waveform determined by
230230
* pwm_round_waveform_might_sleep() cannot be implemented any more.
231231
*
232-
* Returns 0 on success, 1 if there is no valid hardware configuration matching
233-
* the input waveform under the PWM rounding rules or a negative errno.
232+
* Usually all values passed in @wf are rounded down to the nearest possible
233+
* value (in the order period_length_ns, duty_length_ns and then
234+
* duty_offset_ns). Only if this isn't possible, a value might grow.
235+
*
236+
* Returns 0 on success, 1 if at least one value had to be rounded up or a
237+
* negative errno.
234238
*/
235239
int pwm_round_waveform_might_sleep(struct pwm_device *pwm, struct pwm_waveform *wf)
236240
{

0 commit comments

Comments
 (0)