From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED,USER_AGENT_NEOMUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6728BC43387 for ; Tue, 8 Jan 2019 09:13:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 395622089F for ; Tue, 8 Jan 2019 09:13:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727872AbfAHJNF (ORCPT ); Tue, 8 Jan 2019 04:13:05 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:47381 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727107AbfAHJNF (ORCPT ); Tue, 8 Jan 2019 04:13:05 -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 1ggnRV-0000jv-P5; Tue, 08 Jan 2019 10:13:01 +0100 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1ggnRT-0001tf-Uu; Tue, 08 Jan 2019 10:12:59 +0100 Date: Tue, 8 Jan 2019 10:12:59 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Yoshihiro Shimoda Cc: "thierry.reding@gmail.com" , "linux-pwm@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" Subject: Re: [PATCH v2 2/4] pwm: rcar: Use "atomic" API on rcar_pwm_resume() Message-ID: <20190108091259.knpn5mcr3e3m6oht@pengutronix.de> References: <1546918094-13960-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> <1546918094-13960-3-git-send-email-yoshihiro.shimoda.uh@renesas.com> <20190108074749.d23mpcr3wscr6s5j@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-renesas-soc@vger.kernel.org Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org On Tue, Jan 08, 2019 at 08:46:30AM +0000, Yoshihiro Shimoda wrote: > Hello Uwe, > > > From: Uwe Kleine-Konig, Sent: Tuesday, January 8, 2019 4:48 PM > > > diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c > > > index ba70e83..4987c12 100644 > > > --- a/drivers/pwm/pwm-rcar.c > > > +++ b/drivers/pwm/pwm-rcar.c > > > @@ -316,18 +316,16 @@ static int rcar_pwm_suspend(struct device *dev) > > > static int rcar_pwm_resume(struct device *dev) > > > { > > > struct pwm_device *pwm = rcar_pwm_dev_to_pwm_dev(dev); > > > + struct pwm_state state; > > > > > > if (!test_bit(PWMF_REQUESTED, &pwm->flags)) > > > return 0; > > > > > > pm_runtime_get_sync(dev); > > > > > > - rcar_pwm_config(pwm->chip, pwm, pwm->state.duty_cycle, > > > - pwm->state.period); > > > - if (pwm_is_enabled(pwm)) > > > - rcar_pwm_enable(pwm->chip, pwm); > > > + pwm_get_state(pwm, &state); > > > > > > - return 0; > > > + return rcar_pwm_apply(pwm->chip, pwm, &state); > > > } > > > > Orthogonal to this patch I wonder what the intended behaviour for a pwm > > is on suspend. Should it stop oscilating unconditionally? Or should it > > only stop if the consumer stops it as part of its own suspend callback? > > I think the second one is better. I agree. @Thierry: Do you agree, too? Then we should document that. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |