Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2339341rdb; Tue, 10 Oct 2023 00:19:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEiIqp2G3/Jua6O0ClXUfzfaGt7wKNNoXcDNf0ZRpW1sa557RNVT2HV7dK7KBE/QQpm124H X-Received: by 2002:a05:6358:2496:b0:13a:cb52:4837 with SMTP id m22-20020a056358249600b0013acb524837mr15795469rwc.31.1696922373450; Tue, 10 Oct 2023 00:19:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696922373; cv=none; d=google.com; s=arc-20160816; b=FCUZLK9Uy77+nHw/4lzOW70jIN+iSgne51N/1kIzwydZOD/7P6J8Ntj2gqTlmF26mo KVqweWUSiMItdnVd7BMZaVhcgVV4g0JLgukUCbvRlMUjA8m23WrMmbA9vGn1iEjDatH+ aXoGazd2Mdf4nwisrZO6pHlWCmIMuziZmFDFTSN3lP60idjz2LxtiRUJllt3PJQwxBRg zIWoON3v65jgcxpquQtLeOhn5Hmi5IfTE4giySrKqroDM093X0mGuxkt9anPjyInkOg5 23Jr9NG7Q6xL6riJ7PSX6H0Z3gIfRawRVanceDxS71eSKmMqPZdhp63k7tK+sn1ajzQD OTmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=LkfBQjtdENOlkDEporXPvlL7HsvFOO21pFcHYlJNA2c=; fh=tkptT/rHlLtX/rAY3DoBP1T5jIynq1g6mWpI1X70320=; b=qqC0+mJCu0uegI0kuaYxyC3Oimyf3/Nd6ml6OJgD51CQ/w9QDGmOkF0wHNezlZjUmy ZpslYqWDYQyoz15r5pqtPeMK0g0k/S6yA5zYrJ8MWUqx6BTIOagivqry8yY+qaZ0dHGs +5JbQGQBrnKxB4grVJM4iDPKnWAgN/lGLXJLEWnrQePj5oNtdAiZR51Guh9+VemYO7es UcGNiRFoK9whfEKeiQ5YxrDyQSNcej0jQD/un3wz2W24zsHYUA/iURZpG/E5uZvv6ziG JpzZ7/5DgPf2iot1SmpHCB9JV2hFdLfh9zCkSo3cKjjgfoMvn871SqDySvr1FP8RiTJ/ GnDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id il11-20020a17090b164b00b0027cd01b6caasi2818803pjb.47.2023.10.10.00.19.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 00:19:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id A17D380D159C; Tue, 10 Oct 2023 00:19:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442410AbjJJHTW (ORCPT + 99 others); Tue, 10 Oct 2023 03:19:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442394AbjJJHTV (ORCPT ); Tue, 10 Oct 2023 03:19:21 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34D18AC for ; Tue, 10 Oct 2023 00:19:20 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qq71J-00046H-8A; Tue, 10 Oct 2023 09:19:09 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qq71I-000bZx-HG; Tue, 10 Oct 2023 09:19:08 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qq71I-00CuRr-7u; Tue, 10 Oct 2023 09:19:08 +0200 Date: Tue, 10 Oct 2023 09:19:08 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Florian Fainelli Cc: linux-pwm@vger.kernel.org, Angus Clark , Thierry Reding , Broadcom internal kernel review list , Ray Jui , Scott Branden , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , open list Subject: Re: [PATCH v2] pwm: bcm2835: Add support for suspend/resume Message-ID: <20231010071908.azpqdx3eff442fxh@pengutronix.de> References: <20231009204226.3224521-1-florian.fainelli@broadcom.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="isqqdgvdw4a6nj5a" Content-Disposition: inline In-Reply-To: <20231009204226.3224521-1-florian.fainelli@broadcom.com> X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 10 Oct 2023 00:19:30 -0700 (PDT) X-Spam-Level: ** --isqqdgvdw4a6nj5a Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 09, 2023 at 01:42:26PM -0700, Florian Fainelli wrote: > Similar to other drivers, we need to make sure that the clock is > disabled during suspend and re-enabled during resume. >=20 > Reported-by: Angus Clark > Signed-off-by: Florian Fainelli > --- > Changes in v2: >=20 > - use DEFINE_SIMPLE_DEV_PM_OPS as suggested by Uwe >=20 > drivers/pwm/pwm-bcm2835.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) >=20 > diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c > index bdfc2a5ec0d6..938f993ae746 100644 > --- a/drivers/pwm/pwm-bcm2835.c > +++ b/drivers/pwm/pwm-bcm2835.c > @@ -182,6 +182,25 @@ static void bcm2835_pwm_remove(struct platform_devic= e *pdev) > clk_disable_unprepare(pc->clk); > } > =20 > +static int __maybe_unused bcm2835_pwm_suspend(struct device *dev) > +{ > + struct bcm2835_pwm *pc =3D dev_get_drvdata(dev); > + > + clk_disable_unprepare(pc->clk); > + > + return 0; > +} > + > +static int __maybe_unused bcm2835_pwm_resume(struct device *dev) With DEFINE_SIMPLE_DEV_PM_OPS you don't need the __maybe_unused (which is one of the upsides of DEFINE_SIMPLE_DEV_PM_OPS compared to SIMPLE_DEV_PM_OPS) > +{ > + struct bcm2835_pwm *pc =3D dev_get_drvdata(dev); > + > + return clk_prepare_enable(pc->clk); > +} > + > +static DEFINE_SIMPLE_DEV_PM_OPS(bcm2835_pwm_pm_ops, bcm2835_pwm_suspend, > + bcm2835_pwm_resume); > + > static const struct of_device_id bcm2835_pwm_of_match[] =3D { > { .compatible =3D "brcm,bcm2835-pwm", }, > { /* sentinel */ } > @@ -192,6 +211,7 @@ static struct platform_driver bcm2835_pwm_driver =3D { > .driver =3D { > .name =3D "bcm2835-pwm", > .of_match_table =3D bcm2835_pwm_of_match, > + .pm =3D &bcm2835_pwm_pm_ops, I think=20 + .pm =3D pm_ptr(&bcm2835_pwm_pm_ops), is the right thing here. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --isqqdgvdw4a6nj5a Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmUk+usACgkQj4D7WH0S /k5ECwf+NPkcT3mWWY2ZBSoYzazNLuQvKMVs9Lt7KSbMFBoHA7ipNqgsZABLPrXU 4hHgmDZAlpEvzTv/i5g3o2Q1GpGUA+AT42Dm7ds2oAh6g9OwyPcUhju9FztPQ2kJ R9sYJwNCdAdFw0w9QSG59Q42PR7Ad6v3wBFfokn96MweTm9GewxVdjsXxWCFa8B9 gAfv3dEv5fFHjp+wvri89clKGBKn4CCXjtyHGgfkgnV2GnZOXeCFwjagauC+VKSW H3FFc5GrhjE0p3Kl0iGoGuNv0ucPAGJdkffObP9MmkNJSfUfySJZt/rNGH54yOZT 4dkeEJf29RscME49f0Lx2BgFiEND+g== =2uy8 -----END PGP SIGNATURE----- --isqqdgvdw4a6nj5a--