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: 10685559 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3DC8A14E2 for ; Fri, 16 Nov 2018 06:52:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AB982D4B3 for ; Fri, 16 Nov 2018 06:52:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C1A72D4A6; Fri, 16 Nov 2018 06:52:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C241A2D4A6 for ; Fri, 16 Nov 2018 06:52:36 +0000 (UTC) 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 1gNXzW-0008Dw-T3; Fri, 16 Nov 2018 06:52:34 +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-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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); }