Received: by 10.223.185.116 with SMTP id b49csp1837674wrg; Thu, 22 Feb 2018 04:05:03 -0800 (PST) X-Google-Smtp-Source: AH8x227/iHHxVpy8ut+YN0ZpSgDbyBUtqc3eisNCIAYYukvl+dQ6+Bqu9mPIKX5JsXkX9vhrfxcx X-Received: by 2002:a17:902:6ecf:: with SMTP id l15-v6mr6385784pln.443.1519301103762; Thu, 22 Feb 2018 04:05:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519301103; cv=none; d=google.com; s=arc-20160816; b=fGRthfTZNSFS0MpC+FCeGR/yhNEbSKLfi4VlQRPeW7kNwnqZQrVXDjJg/QOWFz81KN oAwZOC4au+TUA8nQWj5UgtpfT4lmYRrJ5MJrbJHCYibKyFweKOxhdkBSA9Oc4HVUrQNP CwEgW8ZXTQvjGEx1hsB4tao7EHYSDYBnu3sf6Q9gZ+m9vKh5DjmmQdykfUb3Pps6gjDb LG4HRbnJU4tfMxXwoejW3MBbzB8DqhgM+k4vlmJn/1OelzcxbD99kfAY/qimhM1HDs5l bo5TeZNZ/Iw2bRo7knfYH4+hPufmJt3P0wwJ6N4LltTvc1teVficIy0gNAY2UnE5T4D3 iiCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=0rMDxtyEP7Njiwr8GhMlLip8A5EWi9llflokhdaswm4=; b=M5o7Nb8tFus1Gan2T0kpJ7FO/0HY54wuK5Yg32bNUCIISqCB+unenp+hCNpCBj+Gph oFpRf7Ua+8PPPytPFxDKeGtLMA5G57Nw4BuDHxP/mA832hWTVD+j1RAffFSFI10nNYy3 RaVhY4SSSYjOt5JJM5jznsUxmrdzOK8136CZoPfLwtfyCIGg7+wWyxjn9e1XR3NA8D39 HuaO2Mi+nLoc3RB/Z4KrGLoXWRKBYZLsb2ZPNUXp1KwrYss8/o7haqvMa3rgCyIPzP+8 YeqoBk+WJJO6BxK6W1yxZL08TO6E6wjIADibq0ixj4ZKIC00icL82Zyepw0Z7K6rQaZ0 V8HQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a15si1284866pgd.420.2018.02.22.04.04.47; Thu, 22 Feb 2018 04:05:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932354AbeBVMDl (ORCPT + 99 others); Thu, 22 Feb 2018 07:03:41 -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 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 -- 2.7.4