From patchwork Thu Feb 22 12:01:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 876626 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3znCkP02fKz9s5R for ; Thu, 22 Feb 2018 23:06:21 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932327AbeBVMDi (ORCPT ); Thu, 22 Feb 2018 07:03:38 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:62205 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932121AbeBVMDf (ORCPT ); Thu, 22 Feb 2018 07:03:35 -0500 X-IronPort-AV: E=Sophos;i="5.47,377,1515481200"; d="scan'208";a="12245986" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Feb 2018 05:03:33 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Thu, 22 Feb 2018 05:03:32 -0700 From: Claudiu Beznea To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , , , , , , , , , , Claudiu Beznea Subject: [PATCH v3 06/10] pwm: add PWM modes Date: Thu, 22 Feb 2018 14:01:17 +0200 Message-ID: <1519300881-8136-7-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519300881-8136-1-git-send-email-claudiu.beznea@microchip.com> References: <1519300881-8136-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add PWM normal and complementary modes. Signed-off-by: Claudiu Beznea --- Documentation/devicetree/bindings/pwm/pwm.txt | 9 +++++++-- Documentation/pwm.txt | 26 +++++++++++++++++++++++--- include/dt-bindings/pwm/pwm.h | 1 + 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/pwm/pwm.txt b/Documentation/devicetree/bindings/pwm/pwm.txt index 8556263b8502..c2b4b9ba0e3f 100644 --- a/Documentation/devicetree/bindings/pwm/pwm.txt +++ b/Documentation/devicetree/bindings/pwm/pwm.txt @@ -46,11 +46,16 @@ period in nanoseconds. Optionally, the pwm-specifier can encode a number of flags (defined in ) in a third cell: - PWM_POLARITY_INVERTED: invert the PWM signal polarity +- PWM_DTMODE_COMPLEMENTARY: PWM complementary working mode (for PWM +channels two outputs); if not specified, the default for PWM channel will +be used -Example with optional PWM specifier for inverse polarity +Example with optional PWM specifier for inverse polarity and complementary +mode: bl: backlight { - pwms = <&pwm 0 5000000 PWM_POLARITY_INVERTED>; + pwms = <&pwm 0 5000000 + (PWM_DTMODE_COMPLEMENTARY | PWM_POLARITY_INVERTED)>; pwm-names = "backlight"; }; diff --git a/Documentation/pwm.txt b/Documentation/pwm.txt index 8fbf0aa3ba2d..59592f8cc381 100644 --- a/Documentation/pwm.txt +++ b/Documentation/pwm.txt @@ -61,9 +61,9 @@ 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 -of the PWM user). PWM arguments are retrieved with pwm_get_args(). +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 ----------------------------------- @@ -110,6 +110,26 @@ channel that was exported. The following properties will then be available: - 0 - disabled - 1 - enabled + mode + Get/set PWM channel working mode. + + Normal mode - for PWM channels with one output; this should be the + default working mode for every PWM channel; output waveforms looks + like this: + __ __ __ __ + PWM __| |__| |__| |__| |__ + <--T--> + + Complementary mode - for PWM channels two outputs; output waveforms + looks line this: + __ __ __ __ + PWMH1 __| |__| |__| |__| |__ + __ __ __ __ __ + PWML1 |__| |__| |__| |__| + <--T--> + + Where T is the signal period. + Implementing a PWM driver ------------------------- diff --git a/include/dt-bindings/pwm/pwm.h b/include/dt-bindings/pwm/pwm.h index ab9a077e3c7d..b4d61269aced 100644 --- a/include/dt-bindings/pwm/pwm.h +++ b/include/dt-bindings/pwm/pwm.h @@ -11,5 +11,6 @@ #define _DT_BINDINGS_PWM_PWM_H #define PWM_POLARITY_INVERTED (1 << 0) +#define PWM_DTMODE_COMPLEMENTARY (1 << 1) #endif From patchwork Thu Feb 22 12:01:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 876621 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3znCjK1t6Jz9s5R for ; Thu, 22 Feb 2018 23:05:25 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753800AbeBVMEG (ORCPT ); Thu, 22 Feb 2018 07:04:06 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:62262 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932103AbeBVMEE (ORCPT ); Thu, 22 Feb 2018 07:04:04 -0500 X-IronPort-AV: E=Sophos;i="5.47,377,1515481200"; d="scan'208";a="12246004" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Feb 2018 05:04:01 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Thu, 22 Feb 2018 05:04:00 -0700 From: Claudiu Beznea To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , , , , , , , , , , Claudiu Beznea Subject: [PATCH v3 09/10] pwm: add documentation for pwm push-pull mode Date: Thu, 22 Feb 2018 14:01:20 +0200 Message-ID: <1519300881-8136-10-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519300881-8136-1-git-send-email-claudiu.beznea@microchip.com> References: <1519300881-8136-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add documentation for PWM push-pull mode. Signed-off-by: Claudiu Beznea Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/pwm/pwm.txt | 2 ++ Documentation/pwm.txt | 16 ++++++++++++++++ include/dt-bindings/pwm/pwm.h | 1 + 3 files changed, 19 insertions(+) diff --git a/Documentation/devicetree/bindings/pwm/pwm.txt b/Documentation/devicetree/bindings/pwm/pwm.txt index c2b4b9ba0e3f..968dd786ad7c 100644 --- a/Documentation/devicetree/bindings/pwm/pwm.txt +++ b/Documentation/devicetree/bindings/pwm/pwm.txt @@ -49,6 +49,8 @@ Optionally, the pwm-specifier can encode a number of flags (defined in - PWM_DTMODE_COMPLEMENTARY: PWM complementary working mode (for PWM channels two outputs); if not specified, the default for PWM channel will be used +- PWM_DTMODE_PUSH_PULL: PWM push-pull working modes (for PWM channels with +two outputs); if not specified the default for PWM channel will be used Example with optional PWM specifier for inverse polarity and complementary mode: diff --git a/Documentation/pwm.txt b/Documentation/pwm.txt index 59592f8cc381..174c371583b6 100644 --- a/Documentation/pwm.txt +++ b/Documentation/pwm.txt @@ -128,6 +128,22 @@ channel that was exported. The following properties will then be available: PWML1 |__| |__| |__| |__| <--T--> + Push-pull mode - for PWM channels with two outputs; output waveforms + for a PWM channel with 2 outputs, in push-pull mode, with normal + polarity looks like this: + __ __ + PWMH __| |________| |________ + __ __ + PWML ________| |________| |__ + <--T--> + + If polarity is inversed: + __ ________ ________ + PWMH |__| |__| + ________ ________ __ + PWML |__| |__| + <--T--> + Where T is the signal period. Implementing a PWM driver diff --git a/include/dt-bindings/pwm/pwm.h b/include/dt-bindings/pwm/pwm.h index b4d61269aced..674dfdd59595 100644 --- a/include/dt-bindings/pwm/pwm.h +++ b/include/dt-bindings/pwm/pwm.h @@ -12,5 +12,6 @@ #define PWM_POLARITY_INVERTED (1 << 0) #define PWM_DTMODE_COMPLEMENTARY (1 << 1) +#define PWM_DTMODE_PUSH_PULL (1 << 2) #endif