From patchwork Fri Jan 12 14:22:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10161167 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A48A460327 for ; Fri, 12 Jan 2018 14:39:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E229287ED for ; Fri, 12 Jan 2018 14:39:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52034288F7; Fri, 12 Jan 2018 14:39:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BF2F2287ED for ; Fri, 12 Jan 2018 14:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BBei0eVFfKyn4wGIQQwkvSGiUmj+Zosh3YJKoeOIfkc=; b=b1oIYnOFtj3vEJ sMosOHWiaKAkXlXqHtVSbg+81omhZVnioarkG14vJwxK/SOUhboigoUK1rczycePXj0SnOeoCcrpv YA73mvLODqKUkrmsiwU2M4F6xQTOG65QdaFuAAv9JKt75NnnAMQntbRp4b5G6/QHujKD79Qf1hB0f 39AanEDApEBDjpvC9qxW9uLLDHS+paZlQuPX4MnPCHbzJq/12S1/1JK8nonj7HiCOqbNKe8Y1EsAI J9gg9v65iMd7yB3WWE14FI/lHFwIFkY26tZEiEjGjIKz0vdtHVlCeK6w/a3XeuGEbh7fv2shQc0Za Zn0UselgIExAR7ee3Uyg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ea0UR-0003oO-8d; Fri, 12 Jan 2018 14:39:27 +0000 Received: from esa2.microchip.iphmx.com ([68.232.149.84]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ea0Fu-00083A-Lr; Fri, 12 Jan 2018 14:24:42 +0000 X-IronPort-AV: E=Sophos;i="5.46,349,1511852400"; d="scan'208";a="10394898" Received: from exsmtp03.microchip.com (HELO email.microchip.com) ([198.175.253.49]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Jan 2018 07:24:14 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.76.4) by chn-sv-exch03.mchp-main.com (10.10.76.49) with Microsoft SMTP Server id 14.3.352.0; Fri, 12 Jan 2018 07:24:14 -0700 From: Claudiu Beznea To: , , , , , , , , , Subject: [PATCH v2 11/16] pwm: add documentation for PWM modes Date: Fri, 12 Jan 2018 16:22:58 +0200 Message-ID: <1515766983-15151-12-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515766983-15151-1-git-send-email-claudiu.beznea@microchip.com> References: <1515766983-15151-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180112_062427_077425_64AD7248 X-CRM114-Status: GOOD ( 12.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, Claudiu Beznea , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add documentation for PWM normal and complementary modes. Signed-off-by: Claudiu Beznea --- Documentation/devicetree/bindings/pwm/pwm.txt | 17 ++++++++++++++-- Documentation/pwm.txt | 29 +++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/pwm/pwm.txt b/Documentation/devicetree/bindings/pwm/pwm.txt index 8556263b8502..fdff25bad1db 100644 --- a/Documentation/devicetree/bindings/pwm/pwm.txt +++ b/Documentation/devicetree/bindings/pwm/pwm.txt @@ -43,8 +43,8 @@ because the name "backlight" would be used as fallback anyway. pwm-specifier typically encodes the chip-relative PWM number and the PWM period in nanoseconds. -Optionally, the pwm-specifier can encode a number of flags (defined in -) in a third cell: +Optionally, the pwm-specifier can encode: +1. a number of flags (defined in ) in a third cell: - PWM_POLARITY_INVERTED: invert the PWM signal polarity Example with optional PWM specifier for inverse polarity @@ -54,6 +54,19 @@ Example with optional PWM specifier for inverse polarity pwm-names = "backlight"; }; +2. PWM working modes (defined in ) in the 4th cell: +- PWM_MODE_NORMAL: for all PWM controllers +- PWM_MODE_COMPLEMENTARY: for PWM controllers with more than one output per +PWM channel + +Example with PWM modes: + + bl: blacklight { + pwms = <&pwm 0 5000000 PWM_POLARITY_INVERTED + PWM_DTMODE_NORMAL | PWM_DTMODE_COMPLEMENTARY>; + pwm-names = "backlight"; + }; + 2) PWM controller nodes ----------------------- diff --git a/Documentation/pwm.txt b/Documentation/pwm.txt index 8fbf0aa3ba2d..58c9bd55f021 100644 --- a/Documentation/pwm.txt +++ b/Documentation/pwm.txt @@ -61,8 +61,8 @@ In addition to the PWM state, the PWM API also exposes PWM arguments, which are the reference PWM config one should use on this PWM. PWM arguments are usually platform-specific and allows the PWM user to only care about dutycycle relatively to the full period (like, duty = 50% of the -period). struct pwm_args contains 2 fields (period and polarity) and should -be used to set the initial PWM config (usually done in the probe function +period). struct pwm_args contains 3 fields (period, polarity and mode) and +should be used to set the initial PWM config (usually done in the probe function of the PWM user). PWM arguments are retrieved with pwm_get_args(). Using PWMs with the sysfs interface @@ -83,6 +83,9 @@ will find: unexport Unexports a PWM channel from sysfs (write-only). + mode + PWM chip supported modes. + The PWM channels are numbered using a per-chip index from 0 to npwm-1. When a PWM channel is exported a pwmX directory will be created in the @@ -110,6 +113,28 @@ channel that was exported. The following properties will then be available: - 0 - disabled - 1 - enabled + mode + Set PWM channel working mode (normal and complementary). PWM chip with + complementary mode could also work in normal mode by using only one physical + output. + + Normal mode - for PWM chips with one output per PWM channel; output + waveforms looks like this: + __ __ __ __ + PWM __| |__| |__| |__| |__ + <--T--> + + Complementary mode - for PWM chips with more than one output per PWM + channel; output waveforms for a PWM controller with 2 outputs per PWM + channel looks line this: + __ __ __ __ + PWMH1 __| |__| |__| |__| |__ + __ __ __ __ __ + PWML1 |__| |__| |__| |__| + <--T--> + + Where T is the signal period. + Implementing a PWM driver -------------------------