From patchwork Wed Feb 28 01:37:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 878888 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@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=linux-pwm-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zrdW659vBz9s3G for ; Wed, 28 Feb 2018 12:38:26 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751793AbeB1BiZ (ORCPT ); Tue, 27 Feb 2018 20:38:25 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:43112 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751656AbeB1BiZ (ORCPT ); Tue, 27 Feb 2018 20:38:25 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C5C0B1435; Tue, 27 Feb 2018 17:38:24 -0800 (PST) Received: from slackpad.lan (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E090D3F318; Tue, 27 Feb 2018 17:38:22 -0800 (PST) From: Andre Przywara To: Thierry Reding , Rob Herring , Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, hao5781286@gmail.com, Maxime Ripard , linux-sunxi@googlegroups.com, linux-pwm@vger.kernel.org Subject: [PATCH] dt-bindings: pwm: Add generic "pwm-channels" property Date: Wed, 28 Feb 2018 01:37:32 +0000 Message-Id: <20180228013732.8506-1-andre.przywara@arm.com> X-Mailer: git-send-email 2.14.1 Sender: linux-pwm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pwm@vger.kernel.org Many PWM drivers seem to hardcode the number of PWM channels (brcm,iproc-pwm, brcm,kona-pwm.txt). If this is only one device supported by the binding, that's probably OK, but for instance for sun4i-pwm I see one or two channels, depending on the particular SoC. amlogic,meson-gxbb-pwm seems to deduce the number of channels from the number of input clocks, and pwm-st has a vendor-specific property for that (st,pwm-num-chan). To cover all those cases more elegantly in (future) bindings, add a new generic property to specify the number of PWM channels a particular controller implements. For instance the sun4i-pwm driver could be extended to support this for future SoCs as well. Signed-off-by: Andre Przywara Reviewed-by: Rob Herring --- Hi, while looking at the bindings for PWM drivers, I was wondering if we should have a generic property to note the number of implemented channels? We have something for instance for DMA controllers (dma-channels), so adding this to PWM controller bindings sounds natural. In particular the new sun8i-pwm IP seems to be scalable to a number of channels, judging from the register and bit layout and from the bit assignment in the manual. I have the gut feeling we will meet this fella again in another Allwinner SoC with a different number of channels. Thanks! Andre. Documentation/devicetree/bindings/pwm/pwm.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/pwm/pwm.txt b/Documentation/devicetree/bindings/pwm/pwm.txt index 8556263b8502..770f3aee17af 100644 --- a/Documentation/devicetree/bindings/pwm/pwm.txt +++ b/Documentation/devicetree/bindings/pwm/pwm.txt @@ -60,10 +60,16 @@ Example with optional PWM specifier for inverse polarity PWM controller nodes must specify the number of cells used for the specifier using the '#pwm-cells' property. +A specific controller binding might specify the implemented number of +PWM channels using this generic property: + pwm-channels = <8>; +This property holds a single 32 bit integer. + An example PWM controller might look like this: pwm: pwm@7000a000 { compatible = "nvidia,tegra20-pwm"; reg = <0x7000a000 0x100>; #pwm-cells = <2>; + pwm-channels = <4>; };