Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2916532imu; Wed, 7 Nov 2018 01:36:04 -0800 (PST) X-Google-Smtp-Source: AJdET5f7BfrJ0L9nYwXdO7Qh9kV8VmALAFX0539QbfY2taDUc+P/3dBBG0jIWuALZeSzFjpHDBas X-Received: by 2002:a17:902:aa84:: with SMTP id d4-v6mr1203700plr.25.1541583364614; Wed, 07 Nov 2018 01:36:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541583364; cv=none; d=google.com; s=arc-20160816; b=GveoCBEEBFDxx4AktQCpudzPi83u0SD5gh8sbAwZp/4Ya265Y3SJaYJ+DcDHU5z819 DZa7jyrTODUCkjXUXmTlaBA2VQHdiiBFVFB1Y+yRqwqE0eiVuMcMCjLKKzdGfELyQ/BK 92f3uh8KVphu6euZmz+FBKZOGF0VY+C7lJB/7rqbY6R63ce4Hv+JB+8QOiPlQE4dJyh4 otzZvn5getk1sJJOzR5b5HDuWx8q21AnE4bRbcPtDdZhhiKhcKy/oFI2sn38tRu6eqU4 od8ULplGXHWd/Oyu0kBI+1PwTv8/iIr/KpbyCdNyZRUaTBkD4M3PzBDJq2uTLeabd2JT w5LQ== 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=kCfcODDNvrZUGGa/xcPfd82pca/2SSPtTWF6/cflVEE=; b=h22yJOTsn9Arn/5O31nWAKjG0ZCZH+TYorV1hOvVbqYKT9FcN10/IkYIKkQ9j3Bif8 zhaQlia9doM2qC1em4lQeEOMjY6kehIUIUHIrIhzxjePK9GNwrvmOLIolKcnMcZGNkLN PA/QbxmY9fsA7retNfqcaeHPadU43gLmtLcqwu3qBWQcMz+aPdweJkN4l24yCWgjmRms oDSQ9fZMZU9S4EU2uzXJTVrR+L5ivwQDiKWZ+rdYInZ/F49+7yPtK6MbGMjwQAjiowe0 OA/DUIqdMCdy29GcbeG0ihUrPPK9MEJucwCiqSOogpGW0KPD5vk6o2AM421EuztKjF81 YnKw== 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 y15si61573pgf.321.2018.11.07.01.35.47; Wed, 07 Nov 2018 01:36:04 -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 S1726411AbeKGTDh (ORCPT + 99 others); Wed, 7 Nov 2018 14:03:37 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:34477 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726242AbeKGTDh (ORCPT ); Wed, 7 Nov 2018 14:03:37 -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 1gKKDo-0007yx-7E; Wed, 07 Nov 2018 10:34:00 +0100 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1gKKDj-0004rS-UC; Wed, 07 Nov 2018 10:33:55 +0100 Date: Wed, 7 Nov 2018 10:33:55 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: =?utf-8?B?Vm9rw6HEjQ==?= Michal Cc: Thierry Reding , Rob Herring , Mark Rutland , "devicetree@vger.kernel.org" , "linux-pwm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Lukasz Majewski , Fabio Estevam , Lothar =?iso-8859-1?Q?Wa=DFmann?= , kernel@pengutronix.de Subject: Re: =?iso-8859-1?B?W1JDRqBQQVRDSCx2Miwy?= =?iso-8859-1?B?LzJd?= pwm: imx: Configure output to GPIO in disabled state Message-ID: <20181107093355.e4n3irrnkybqsjvc@pengutronix.de> References: <1539163920-9442-3-git-send-email-michal.vokac@ysoft.com> <20181012085720.GA9451@taurus.defre.kleine-koenig.org> <20181012160854.hmgpokxgsrqdzobx@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Michal, just to state it more explicitly, I think the following patch (not even compile tested) is much preferable over your approach: diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c index 1d5242c9cde0..af88644b5efb 100644 --- a/drivers/pwm/pwm-imx.c +++ b/drivers/pwm/pwm-imx.c @@ -216,7 +216,14 @@ static int imx_pwm_apply_v2(struct pwm_chip *chip, struct pwm_device *pwm, cr |= MX3_PWMCR_POUTC; writel(cr, imx->mmio_base + MX3_PWMCR); - } else if (cstate.enabled) { + } else if (cstate.enabled && state->polarity == PWM_POLARITY_NORMAL) { + /* + * When disabled in hardware the output pin goes to 0 + * independant of the polarity setting. The expectation of some + * people however is that after disabling the pin goes to the + * inactive level which isn't given for an inversed pwm, so + * only disable for normal polarity. + */ writel(0, imx->mmio_base + MX3_PWMCR); clk_disable_unprepare(imx->clk_per); I think it solves most if not all problems you want to address with the pinctrl stuff. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |