@@ -216,14 +216,14 @@ static int __pwm_write_waveform(struct pwm_chip *chip, struct pwm_device *pwm, c
216
216
*
217
217
* Typically a given waveform cannot be implemented exactly by hardware, e.g.
218
218
* because hardware only supports coarse period resolution or no duty_offset.
219
- * This function returns the actually implemented waveform if you pass wf to
220
- * pwm_set_waveform_might_sleep now.
219
+ * This function returns the actually implemented waveform if you pass @ wf to
220
+ * pwm_set_waveform_might_sleep() now.
221
221
*
222
222
* Note however that the world doesn't stop turning when you call it, so when
223
- * doing
223
+ * doing::
224
224
*
225
- * pwm_round_waveform_might_sleep(mypwm, &wf);
226
- * pwm_set_waveform_might_sleep(mypwm, &wf, true);
225
+ * pwm_round_waveform_might_sleep(mypwm, &wf);
226
+ * pwm_set_waveform_might_sleep(mypwm, &wf, true);
227
227
*
228
228
* the latter might fail, e.g. because an input clock changed its rate between
229
229
* these two calls and the waveform determined by
@@ -233,8 +233,9 @@ static int __pwm_write_waveform(struct pwm_chip *chip, struct pwm_device *pwm, c
233
233
* value (in the order period_length_ns, duty_length_ns and then
234
234
* duty_offset_ns). Only if this isn't possible, a value might grow.
235
235
*
236
- * Returns 0 on success, 1 if at least one value had to be rounded up or a
236
+ * Returns: 0 on success, 1 if at least one value had to be rounded up or a
237
237
* negative errno.
238
+ * Context: May sleep.
238
239
*/
239
240
int pwm_round_waveform_might_sleep (struct pwm_device * pwm , struct pwm_waveform * wf )
240
241
{
@@ -291,6 +292,9 @@ EXPORT_SYMBOL_GPL(pwm_round_waveform_might_sleep);
291
292
*
292
293
* Stores the current configuration of the PWM in @wf. Note this is the
293
294
* equivalent of pwm_get_state_hw() (and not pwm_get_state()) for pwm_waveform.
295
+ *
296
+ * Returns: 0 on success or a negative errno
297
+ * Context: May sleep.
294
298
*/
295
299
int pwm_get_waveform_might_sleep (struct pwm_device * pwm , struct pwm_waveform * wf )
296
300
{
@@ -399,13 +403,17 @@ static int __pwm_set_waveform(struct pwm_device *pwm,
399
403
*
400
404
* Typically a requested waveform cannot be implemented exactly, e.g. because
401
405
* you requested .period_length_ns = 100 ns, but the hardware can only set
402
- * periods that are a multiple of 8.5 ns. With that hardware passing exact =
406
+ * periods that are a multiple of 8.5 ns. With that hardware passing @ exact =
403
407
* true results in pwm_set_waveform_might_sleep() failing and returning 1. If
404
- * exact = false you get a period of 93.5 ns (i.e. the biggest period not bigger
408
+ * @ exact = false you get a period of 93.5 ns (i.e. the biggest period not bigger
405
409
* than the requested value).
406
- * Note that even with exact = true, some rounding by less than 1 is
410
+ * Note that even with @ exact = true, some rounding by less than 1 ns is
407
411
* possible/needed. In the above example requesting .period_length_ns = 94 and
408
- * exact = true, you get the hardware configured with period = 93.5 ns.
412
+ * @exact = true, you get the hardware configured with period = 93.5 ns.
413
+ *
414
+ * Returns: 0 on success, 1 if was rounded up (if !@exact) or no perfect match was
415
+ * possible (if @exact), or a negative errno
416
+ * Context: May sleep.
409
417
*/
410
418
int pwm_set_waveform_might_sleep (struct pwm_device * pwm ,
411
419
const struct pwm_waveform * wf , bool exact )
@@ -565,11 +573,6 @@ static bool pwm_state_valid(const struct pwm_state *state)
565
573
return true;
566
574
}
567
575
568
- /**
569
- * __pwm_apply() - atomically apply a new state to a PWM device
570
- * @pwm: PWM device
571
- * @state: new state to apply
572
- */
573
576
static int __pwm_apply (struct pwm_device * pwm , const struct pwm_state * state )
574
577
{
575
578
struct pwm_chip * chip ;
@@ -678,6 +681,9 @@ static int __pwm_apply(struct pwm_device *pwm, const struct pwm_state *state)
678
681
* Cannot be used in atomic context.
679
682
* @pwm: PWM device
680
683
* @state: new state to apply
684
+ *
685
+ * Returns: 0 on success, or a negative errno
686
+ * Context: May sleep.
681
687
*/
682
688
int pwm_apply_might_sleep (struct pwm_device * pwm , const struct pwm_state * state )
683
689
{
@@ -719,6 +725,9 @@ EXPORT_SYMBOL_GPL(pwm_apply_might_sleep);
719
725
* Not all PWM devices support this function, check with pwm_might_sleep().
720
726
* @pwm: PWM device
721
727
* @state: new state to apply
728
+ *
729
+ * Returns: 0 on success, or a negative errno
730
+ * Context: Any
722
731
*/
723
732
int pwm_apply_atomic (struct pwm_device * pwm , const struct pwm_state * state )
724
733
{
@@ -792,6 +801,9 @@ EXPORT_SYMBOL_GPL(pwm_get_state_hw);
792
801
* This function will adjust the PWM config to the PWM arguments provided
793
802
* by the DT or PWM lookup table. This is particularly useful to adapt
794
803
* the bootloader config to the Linux one.
804
+ *
805
+ * Returns: 0 on success or a negative error code on failure.
806
+ * Context: May sleep.
795
807
*/
796
808
int pwm_adjust_config (struct pwm_device * pwm )
797
809
{
0 commit comments