From patchwork Fri Jan 24 07:41:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 3534581 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7E47E9F1C3 for ; Fri, 24 Jan 2014 13:22:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3CC2A20161 for ; Fri, 24 Jan 2014 13:22:28 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1EB9720179 for ; Fri, 24 Jan 2014 13:22:23 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6giA-0007Os-6q; Fri, 24 Jan 2014 13:22:18 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6bOw-0008Kr-Fk; Fri, 24 Jan 2014 07:42:06 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6bOs-0008K9-VG for linux-arm-kernel@lists.infradead.org; Fri, 24 Jan 2014 07:42:04 +0000 Received: from ptx.hi.pengutronix.de ([2001:6f8:1178:2:5054:ff:fec0:8e10] ident=Debian-exim) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1W6bO1-0004oG-Ax; Fri, 24 Jan 2014 08:41:09 +0100 Received: from sha by ptx.hi.pengutronix.de with local (Exim 4.80) (envelope-from ) id 1W6bNv-0001aa-MD; Fri, 24 Jan 2014 08:41:03 +0100 Date: Fri, 24 Jan 2014 08:41:03 +0100 From: Sascha Hauer To: Lothar =?iso-8859-15?Q?Wa=DFmann?= Subject: Re: [PATCH 1/2] PWM: let of_xlate handlers check args count Message-ID: <20140124074103.GJ16215@pengutronix.de> References: <20140123083714.3c6e86ae@ipc1.ka-ro> <1390467898-9216-1-git-send-email-s.hauer@pengutronix.de> <1390467898-9216-2-git-send-email-s.hauer@pengutronix.de> <20140123115632.6d3f1a58@ipc1.ka-ro> <20140123110444.GI16215@pengutronix.de> <20140123165349.GY15937@n2100.arm.linux.org.uk> <20140123173642.GZ15937@n2100.arm.linux.org.uk> <20140124064254.0369084d@ipc1.ka-ro> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140124064254.0369084d@ipc1.ka-ro> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 08:29:31 up 152 days, 17:00, 41 users, load average: 0.05, 0.05, 0.05 User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: 2001:6f8:1178:2:5054:ff:fec0:8e10 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140124_024203_392079_DC2CD764 X-CRM114-Status: GOOD ( 27.72 ) X-Spam-Score: -2.5 (--) Cc: Mark Rutland , linux-pwm@vger.kernel.org, Russell King - ARM Linux , Pawel Moll , Ian Campbell , linux-kernel@vger.kernel.org, Rob Herring , Thierry Reding , Rob Landley , Kumar Gala , Shawn Guo , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jan 24, 2014 at 06:42:54AM +0100, Lothar Waßmann wrote: > Hi, > > > Okay, this works, but there's a problem with pwm-leds. > > > > When the duty cycle is set to zero (when you set the brightness to zero) > > pwm-leds decides to disable the PWM after configuring it. This causes > > the PWM output to be driven low, causing the LED to go to maximum > > brightness. > > > > So, using the inversion at PWM level doesn't work. > > > The problem is that the driver calls pwm_disable() when the duty cycle is 0. > This sets the PWM output low independent from the output polarity setting. > > > To make this work correctly, we really need pwm-leds to do the inversion > > rather than setting the inversion bit in hardware. > > > The same holds for the pwm-backlight driver. > > The easiest fix would be not to call pwm_disable() even for a zero duty > cycle. IMO that's the right thing to do anyway due to the different PWM hardware controllers we have. I'm thinking about the following patch for some time. Sascha --------------------8<-------------------------- From 9ebbc3d72c71bd97d7fc4458f60ae3ecd5876984 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 24 Jan 2014 08:34:16 +0100 Subject: [PATCH] PWM: Document disabled PWM output as undefined When disabled PWM hardware reacts differently. Some controllers just stop with their current value, others produce a constant high or low output, sometimes depending on the output inversion bit. Update the documentation to reflect that and request from the PWM consumer drivers to set a constant high/low value with duty cycles of 0/100% instead of disabling the PWM. Signed-off-by: Sascha Hauer --- Documentation/pwm.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/pwm.txt b/Documentation/pwm.txt index 93cb979..b7e8a31 100644 --- a/Documentation/pwm.txt +++ b/Documentation/pwm.txt @@ -44,6 +44,8 @@ After being requested, a PWM has to be configured using: int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns); To start/stop toggling the PWM output use pwm_enable()/pwm_disable(). +The output of a disabled PWM is undefined. Set the duty cycle to 100% +for a constant high output and to 0 for constant low output. Using PWMs with the sysfs interface -----------------------------------