u-boot/doc/usage/cmd/pwm.rst
Tom Rini 11da3403e9 doc: usage: Add general rule for $?
For nearly all commands in U-Boot the '?' variable is handled the same
way with 0 meaning success, 1 meaning any failure.  Explain this in the
general rules section of the cmdline documentation (with a link to a
counter example) and then remove the redundant wording from most
commands. We retain a section about the return value in a number of
places where we are doing something such as always returning a specific
value or we have useful additional information to go along with the
normal return codes.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-10-26 09:03:35 -06:00

86 lines
1.5 KiB
ReStructuredText

.. SPDX-License-Identifier: GPL-2.0-or-later
.. index::
single: pwm (command)
pwm command
===========
Synopsis
--------
::
pwm invert <pwm_dev_num> <channel> <polarity>
pwm config <pwm_dev_num> <channel> <period_ns> <duty_ns>
pwm enable <pwm_dev_num> <channel>
pwm disable <pwm_dev_num> <channel>
Description
-----------
The ``pwm`` command is used to access and configure PWM (Pulse Width Modulation)
signals.
pwm invert
----------
* If the value of ``polarity`` is 0, the default polarity is used.
* If the value of ``polarity`` is 1, the polarity is inverted.
pwm config
----------
Configure the period and duty period in nanoseconds.
pwm enable
----------
Enable output on the configured device and channel.
pwm disable
-----------
Disable output on the configured device and channel.
pwm_dev_num
Device number of the pulse width modulation device
channel
Output channel of the PWM device
polarity
* 0 - Use normal polarity
* 1 - Use inverted polarity
duty_ns
Duty period in ns
period_ns
Period time in ns
Examples
--------
Configure device 0, channel 0 to 20 µs period and 14 µs (that is, 70%) duty period::
=> pwm config 0 0 20000 14000
Enable output on the configured device and channel::
=> pwm enable 0 0
Disable output on the configured device and channel::
=> pwm disable 0 0
Invert the signal on the configured device and channel::
=> pwm invert 0 0 1
Configuration
-------------
The ``pwm`` command is only available if CONFIG_CMD_PWM=y.