Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3006691imu; Fri, 23 Nov 2018 19:12:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/XrTkqp5/a+BpRK4FRqv5950PF5oOv2UzoFddEMA3DmvsC+7thyS83JDGB/QVlzidr9VBCi X-Received: by 2002:a63:bc02:: with SMTP id q2mr16654360pge.116.1543029162885; Fri, 23 Nov 2018 19:12:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543029162; cv=none; d=google.com; s=arc-20160816; b=rf+vJ4MznXPwCbfbx9ABbPEI2xtiu/iRPDWZh+p7JsamDDiElnAdfTL0QYrVuxgtS/ pPXqq7DV8FuD1kyJfEL58BfzaX/GjR2CFoY85O0Zh03VLbMnuLGamPtU3uuyRQB2Pizc gFnR/4vh96TXGoGe+p6Fix/7fMaz+pBDy0xuQwe8YmQ2uiom/oVVjB8vJZeSakYYxg6t T/D33WAig4oBga4n/Lo4be8G89dZJyGXMeWMnRTpE9qwIQalHUQ56CadfdcvILNtg+af DYq88k5u06ZxeZKK23iYesF24Y4zeevtTwMGfxajfvMgvMh9zV/iAFuRnh/JNei021Ow CmRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=FsQdcPGa5bDuj9Y0OU/EM9CLRTJgs5rdB18Teyz9nK0=; b=Je20docNCee9pKI+3Qs666HxFV1ouSsQspO4JFEvWvT8X2z0WwozTkNEU6FS0Fr3yj gWe5FLP1MnRa8bh5CzXpIPU1PyFOefFghvdK/vm8BQy19bFL5Q/yv8IQWS/f6XLL6h1m i4G3oyCFWmXw5+HagW1YnZc+vnuomMzliRtNm/jT+CcgXwc27RRuxLyDUnY6c6nxdVR4 8QI6nuoUCkizW98K2RgH7rxImHeVAbW7L0+x85Srw9bYHHClpRGaVqG97q5JBwfbWWrm mJYeRmucVWE9O9quIv2b4Og2yDBPODUnJGakTQ9WvTTyslS8TPFXGVNbWKKeXNPkQI+G wzxQ== 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 15si10886340pgv.351.2018.11.23.19.12.24; Fri, 23 Nov 2018 19:12:42 -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 S2395564AbeKWC6A (ORCPT + 99 others); Thu, 22 Nov 2018 21:58:00 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:41725 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730352AbeKWC6A (ORCPT ); Thu, 22 Nov 2018 21:58:00 -0500 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gPrfr-0003ud-76; Thu, 22 Nov 2018 17:17:51 +0100 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1gPrfo-0001gF-RW; Thu, 22 Nov 2018 17:17:48 +0100 Date: Thu, 22 Nov 2018 17:17:48 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Thierry Reding Cc: =?utf-8?B?Vm9rw6HEjQ==?= Michal , Mark Rutland , "devicetree@vger.kernel.org" , "linux-pwm@vger.kernel.org" , Lukasz Majewski , "linux-kernel@vger.kernel.org" , Rob Herring , "kernel@pengutronix.de" , Fabio Estevam , Lothar =?iso-8859-1?Q?Wa=DFmann?= , Linus Walleij Subject: Re: =?iso-8859-1?B?W1JDRqBQQVRDSCx2Miwy?= =?iso-8859-1?B?LzJd?= pwm: imx: Configure output to GPIO in disabled state Message-ID: <20181122161748.2ud7f26xkww5g24m@pengutronix.de> References: <20181109165555.vqbiwh4hlcnozdna@pengutronix.de> <20181114113449.GB2620@ulmo> <20181114215120.vddykljqyavm64wj@pengutronix.de> <20181115152545.GA8611@ulmo> <20181115203733.qvonika6yhn2bsnb@pengutronix.de> <20181116095124.GA28631@ulmo> <20181116103929.cxfvuc2te7cadhp2@pengutronix.de> <20181116122445.GA25386@ulmo> <20181118200815.a6hkokt3otfm4yl4@pengutronix.de> <20181122150338.GA24661@ulmo> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181122150338.GA24661@ulmo> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Thierry, On Thu, Nov 22, 2018 at 04:03:38PM +0100, Thierry Reding wrote: > On Sun, Nov 18, 2018 at 09:08:15PM +0100, Uwe Kleine-K?nig wrote: > > Thinking a bit about this it doesn't really matter for the consumer if > > the pin stays in the idle level because there is a pull into the right > > direction and the PWM is high-Z or if the PWM pulls actively in the > > right direction. Also for pwm_config(pwm, 0, 100) the PWM could disable > > its output in the presence of a pull, so the property says true that the > > effects of pwm_config(pwm, 0, 100) and pwm_disable(pwm) should be the > > same. And so my claim that pwm_disable is a part of the API that > > doesn't give any value stays true. > > I still think there's a slight difference there. Granted the effect on > the consumer is the same whether you disable or set the duty-cycle to > zero because the power output is the same. pwm_disable() is still more > explicit, though, so it may involve more than just setting the duty- > cycle. If pwm_disable() vs. duty-cycle=0 doesn't make a difference to the consumer, who do we do a favour by providing pwm_disable()? > > > But again, why should PWMs be special? You turn off all other resources > > > when you no longer need them, right? If you power your panel with a > > > regulator, then when the panel is disabled you want to disable the > > > regulator, right? Similarily if you don't use your I2C controller you > > > want to turn off the clock that drives it, right? This is the same for > > > any resource in your system: if you no longer need it, disable it. The > > > fact that "disabling" the PWM is not straightforward on i.MX doesn't > > > mean that we should simply ignore it. > > > > I don't say we should ignore it. I say we shouldn't disable the hardware > > if the consumer calls pwm_disable() if disabling the hardware results in > > a state that shouldn't happen on pwm_disable(). > > That's backwards. If disabling the hardware results in a state that > shouldn't happen when you disable the hardware, that just means that > you're doing something wrong. When you do something wrong you fix it. For you pwm_disable must imply disabling the PWM hardware. As you cannot have both (disable the hardware and keep the pin on the idle level without involving pinmux and GPIO) on i.MX in my eyes it is sensible to drop one requirement from the framework's expectations to make it possible for i.MX to fulfill them. As there is no advantage for anyone to force .disable() to actually disable the hardware (apart from a little power saving that probably isn't even measurable) that's IMHO the one to drop. > If the pin goes to the wrong level when you disable the hardware, the > natural fix for the problem is to make sure the pin stays at the right > level. Ack. And you can do this either in an easy variant or in a more complicated one. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |