From patchwork Thu Aug 15 08:21:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emil Kronborg X-Patchwork-Id: 1972783 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=protonmail.com header.i=@protonmail.com header.a=rsa-sha256 header.s=protonmail3 header.b=KnnuRnM1; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wl5b410fTz1yXZ for ; Thu, 15 Aug 2024 23:30:08 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D74D4887F5; Thu, 15 Aug 2024 15:29:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; secure) header.d=protonmail.com header.i=@protonmail.com header.b="KnnuRnM1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 20F2D88A16; Thu, 15 Aug 2024 10:21:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch [185.70.40.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 03DCB889C9 for ; Thu, 15 Aug 2024 10:21:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=emil.kronborg@protonmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1723710088; x=1723969288; bh=fnQI5/5muuCcB11L+xlTbx2XW94Vvbah2UibiVPqsK8=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=KnnuRnM1MjVEHLz3M2xGdBN/ZYZRuYl8gMFqOEnf7pGEklz8eYBQv0dEJZ64fg+UN 6m63EizCxhXTNj6HXnW+mm0f0tSCyw7dqHyedXfQaXsU8ze4RysH81P72IH/RMMGiS eKsT1FNpmkwSWDz+ozjtIff1s1J9FzijE+CVeFKzxR5ZxlMXxnlTXEoJ753FxB9cJM aIZktcXp9rBR9iXFWAd3STPW4pIyzeDGL1hmn9YALr5XTyFP/xND2XIAanC9pVtLcU O9lYUqmlxpwd0g6JodPfLlpVt1M6v8X58UZHOVIugxTByEGtzwexn3/ZFohTgL7Nr3 VPl2ebFdY5Yrw== Date: Thu, 15 Aug 2024 08:21:22 +0000 To: trini@konsulko.com From: Emil Kronborg Cc: heinrich.schuchardt@canonical.com, quentin.schulz@cherry.de, u-boot@lists.denx.de Subject: [PATCH v4] doc: document the pwm command Message-ID: <20240815082101.15612-1-emil.kronborg@protonmail.com> Feedback-ID: 20949900:user:proton X-Pm-Message-ID: 1b36d28f3ab5a6c463c59e90fd83b06d1cb2f43f MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 15 Aug 2024 15:29:55 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Signed-off-by: Emil Kronborg Reviewed-by: Simon Glass --- Changes in v4: - Changed license from GPL-2.0+ to GPL-2.0-or-later. Also, removed trailing colon. - Simplified the descriptions in the Synopsis section by removing the text following the '-'. - Reformulated the description of the invert subcommand to be more precise and correct. - %s/duty cycle/duty period to be consistent with pwm.h and to ensure correctness, as duty cycle is dimensionless and is given in nanoseconds. - Moved the common parameters, pwm_dev_num and channel, to the bottom of the Description section, and added the remaining parameters. - Added a comma in the Examples section and used 'µs' instead of 'us'. - Rebased on top of master. doc/usage/cmd/pwm.rst | 91 +++++++++++++++++++++++++++++++++++++++++++ doc/usage/index.rst | 1 + 2 files changed, 92 insertions(+) create mode 100644 doc/usage/cmd/pwm.rst base-commit: 90270e0f71c53cca9c0347ce3baedf26b8ec4cdb diff --git a/doc/usage/cmd/pwm.rst b/doc/usage/cmd/pwm.rst new file mode 100644 index 000000000000..522acb5afa33 --- /dev/null +++ b/doc/usage/cmd/pwm.rst @@ -0,0 +1,91 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +.. index:: + single: pwm (command) + +pwm command +=========== + +Synopsis +-------- + +:: + + pwm invert + pwm config + pwm enable + pwm disable + + +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. + +Return value +------------ + +If the command succeeds, the return value ``$?`` is set to 0. If an error occurs, the +return value ``$?`` is set to 1. diff --git a/doc/usage/index.rst b/doc/usage/index.rst index 1f6518b77c4b..6a218c46b4e4 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -93,6 +93,7 @@ Shell commands cmd/pinmux cmd/printenv cmd/pstore + cmd/pwm cmd/qfw cmd/read cmd/reset