From patchwork Fri Nov 16 06:52:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 998779 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TPDt14qZ"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42x87F6P45z9s8F for ; Fri, 16 Nov 2018 17:52:41 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=s23PvaPxiwwm4fyKukIUr7/WtVI7yQh6sMHoluwhQCg=; b=TPDt14qZqrULOu Fis05ay0lScmW86jmcbkhE8xk/qVnd2bWIhjmWMf4wiGQoZS/DaMqfhedpWne04eIZ8gb6xX3jEgB dcxhzahxpX+mZFbAD06G/Se/Fuau486sOKgVpkFmzCmU8KqZxYcGqVIGlvNjXM6gkgSI0wjVTPQCf 17gUo//0ehKX/DA0SzqZlHSr6LUiYcXt3N3ULdMq8aauQmDxhbJ7LMSZDOk219t0aTpUacwsSJxba kXJ5VLyWvYpAukJIjuPpunDsdjyrVaZmPNd3mCLNxBuTuk/1ovURi5GIasKG+4kIkcSvKj3Ph6OkI 2WqdzI6Gc1GCLVeJ5Rog==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNXzX-0008Dw-AS; Fri, 16 Nov 2018 06:52:35 +0000 Received: from antares.kleine-koenig.org ([2a01:4f8:c0c:3a97::2]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNXzT-0008DA-QZ for linux-arm-kernel@lists.infradead.org; Fri, 16 Nov 2018 06:52:33 +0000 Received: by antares.kleine-koenig.org (Postfix, from userid 1000) id E260B47D1C1; Fri, 16 Nov 2018 07:52:15 +0100 (CET) From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thierry Reding , Joachim Eastwood Subject: [PATCH] pwm: lpc18xx-sct: don't reconfigure PWM in .request and .free Date: Fri, 16 Nov 2018 07:52:08 +0100 Message-Id: <20181116065208.3920-1-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114115025.GC2620@ulmo> References: <20181114115025.GC2620@ulmo> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181115_225232_011046_E2D4CDEC X-CRM114-Status: GOOD ( 11.82 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Regarding the .request case: The consumer might be interested in taking over the configured state from the boot loader. So the initially configured state should be retained. For the free case the PWM consumer is responsible to disable the PWM before calling pwm_release and there are three subcases to consider: a) The pwm is already off. Then there is no gain in disabling the PWM once more. b) The pwm is still running and there is a good reason for that. (Not sure this is a valid case, I cannot imagine such a good reason.) Then it is contra productive to disable the pwm. c) The pwm is still running because the consumer failed to disable the PWM. Then the consumer needs fixing and there is little incentive to paper over the problem in the backend driver. This aligns the lpc18xx-sct driver to the other PWM drivers that also don't reconfigure the hardware in .request and .free. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-lpc18xx-sct.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c index d7f5f7de030d..475918d9f543 100644 --- a/drivers/pwm/pwm-lpc18xx-sct.c +++ b/drivers/pwm/pwm-lpc18xx-sct.c @@ -296,7 +296,6 @@ static int lpc18xx_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) set_bit(event, &lpc18xx_pwm->event_map); lpc18xx_data->duty_event = event; - lpc18xx_pwm_config_duty(chip, pwm, pwm_get_duty_cycle(pwm)); return 0; } @@ -306,8 +305,6 @@ static void lpc18xx_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) struct lpc18xx_pwm_chip *lpc18xx_pwm = to_lpc18xx_pwm_chip(chip); struct lpc18xx_pwm_data *lpc18xx_data = pwm_get_chip_data(pwm); - pwm_disable(pwm); - pwm_set_duty_cycle(pwm, 0); clear_bit(lpc18xx_data->duty_event, &lpc18xx_pwm->event_map); }