From patchwork Thu Aug 1 10:07:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Kronborg X-Patchwork-Id: 1967677 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=b5MbI9UZ; 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)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WZW462ngCz1ybX for ; Fri, 2 Aug 2024 00:07:02 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 523E788B29; Thu, 1 Aug 2024 16:06:24 +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="b5MbI9UZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 86C1388AE4; Thu, 1 Aug 2024 12:08:02 +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_H4, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) (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 934788874D for ; Thu, 1 Aug 2024 12:08:00 +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=1722506879; x=1722766079; bh=AiG2zbHmg1QDlD/Z7vcncYJWQrx02I0U4bO2kRtKXuk=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=b5MbI9UZbHrWDD1C6/FnpY80f7v2/X99rJhV0TxzyaKE90DO/yvnMcA7emIE7OfCk 1Ujm74x1m6t2UwmLtNAa7R8kBg4KlJQtwYmmdcBJlxj8jy6m2D6dL5OxnY7l3o+UXD 3CUH0ZWG6Cqz1ZR4fjHMScBCX0XvSyYQA8rs8t/VjXkyHXmd2x2U8+UF7cuQRhRcX7 c1c0mcVOTJWk/gthwjNxoGSCbHbIJJr7cGZY3mFHQ5RbBlrIhwxwfBax3d+yKvnwjE oi2DPI+Y1xlBJXk0edon6ObWBZ7ZifKQIOBN1ibf7tNRRrWSa09DJ35hInmDSZf+nT Jnrs0DX18FrgQ== Date: Thu, 01 Aug 2024 10:07:57 +0000 To: trini@konsulko.com From: Emil Kronborg Cc: quentin.schulz@cherry.de, u-boot@lists.denx.de Subject: [PATCH v3] doc: document the pwm command Message-ID: <20240801100754.44732-1-emil.kronborg@protonmail.com> Feedback-ID: 20949900:user:proton X-Pm-Message-ID: f1496347ff59bdf78ff2de085e42ae311e47c226 MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 01 Aug 2024 16:06:21 +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 --- Changes in v3: - The help text for 'pwm config' in the examples section is more explicit about 20 us and 14 us for the period and duty cycle, respectively. - Fixed 'pwm enable' and 'pwm disable' in the examples section to only expect 2 arguments. - Rebased on top of master. doc/usage/cmd/pwm.rst | 80 +++++++++++++++++++++++++++++++++++++++++++ doc/usage/index.rst | 1 + 2 files changed, 81 insertions(+) create mode 100644 doc/usage/cmd/pwm.rst base-commit: 7010f22eba35b2a6b66ba37ce565e566ca08c68f diff --git a/doc/usage/cmd/pwm.rst b/doc/usage/cmd/pwm.rst new file mode 100644 index 000000000000..bd1255d82186 --- /dev/null +++ b/doc/usage/cmd/pwm.rst @@ -0,0 +1,80 @@ +.. SPDX-License-Identifier: GPL-2.0+: + +.. index:: + single: pwm (command) + +pwm command +=========== + +Synopsis +-------- + +:: + + pwm invert - invert polarity + pwm config - config PWM + pwm enable - enable PWM output + pwm disable - disable PWM output + + +Description +----------- + +The ``pwm`` command is used to access and configure PWM (Pulse Width Modulation) +signals. For all subcommands, the following arguments are common: + +pwm_dev_num + device number + +channel + channel on chosen device + +pwm invert +---------- + +The signal's active and inactive states are swapped. + +pwm config +---------- + +Configure the period and duty cycle in nanoseconds. + +pwm enable +---------- + +Enable output on the configured device and channel. + +pwm disable +----------- + +Disable output on the configured device and channel. + +Examples +-------- + +Configure device 0 channel 0 to 20 us period and 14 us (that is, 70%) duty cycle:: + + => 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 49b354e6ffd2..1adab5283950 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -92,6 +92,7 @@ Shell commands cmd/pinmux cmd/printenv cmd/pstore + cmd/pwm cmd/qfw cmd/read cmd/reset