Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3694962pxf; Mon, 29 Mar 2021 08:57:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznIAbFb54UZ2AmZi5ctXI4g8EtbnKViIJg9/ZVusc1sUiYQMwqf2S4vam6UC4/gUT5PuRZ X-Received: by 2002:aa7:da0f:: with SMTP id r15mr28931914eds.111.1617033445697; Mon, 29 Mar 2021 08:57:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617033445; cv=none; d=google.com; s=arc-20160816; b=rj1185c3fUXMyGw2LVQt9YEgig5mk4/Is4OCliAHCTDqdCzgpDyW5uC7upUpvxKuO0 wncb7+hFJObKabA/tVO86iiErjP+XfTY8Ii4LxAtrAgAz93v3iylrbAMbKqCnz67Ygw7 N0GVS0uoE+ZqVFyNdye5q5OU/YawIMktyBkE4HyOba7YIAwQixiFmd5hD7SemtX7Omom bL4G92RYU/T0pNAMcW7VVGIPPql8HmWqkB3MDS3Z0wlMeAslBpKE8lgvRnw3o4A62PcK AG4BIhy51vVQzzFyAUfvDHRTLTydO++umVISilmI/NQmP+Mqp7+sxvxVN8u6rQZkcbAW 4owg== 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=0X+D47mcD2M3ikOraaZRh7VZ/go5b5/sGNNoFlY3v/I=; b=x559I/I7hvQyNpN5xSK3uwQMy95sNKAQ+ydckzGw9QJKolGp80XHd+IFD8wVPJ6xn5 z5WYKGfSNawKXi6wau75NV3r2phddOwBQDbhRZfA+5AuWuWmeuiWbON7yJ8aKNm+Z5ym l+9NTUSorvtmyIbwDtZid3va8n/9XYBmwSpyyVJqlCmVFiIZfp0qX6W0xoI6FnFgu0g8 IkZuuYUH8l6+kM8ttX1pKFvpyRAb34MEWXjTJJUMW9gliEltBPlfAlIrBvUWQ2WuidW9 6UO+k8cxuhMCJKiDiCG0IrIcrOWOTe7Ihq5aKeshdnAJQ93ldvJaZt8VY5eKbbhxqvOH OVqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f3si12990371ejd.252.2021.03.29.08.57.02; Mon, 29 Mar 2021 08:57:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229711AbhC2P4H (ORCPT + 99 others); Mon, 29 Mar 2021 11:56:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230434AbhC2Pzd (ORCPT ); Mon, 29 Mar 2021 11:55:33 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DFAAC061762 for ; Mon, 29 Mar 2021 08:55:31 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lQuEh-00076z-Qe; Mon, 29 Mar 2021 17:55:27 +0200 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1lQuEh-0001hX-HH; Mon, 29 Mar 2021 17:55:27 +0200 Date: Mon, 29 Mar 2021 17:55:27 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Clemens Gruber Cc: linux-pwm@vger.kernel.org, Thierry Reding , Sven Van Asbroeck , linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 3/7] pwm: pca9685: Improve runtime PM behavior Message-ID: <20210329155527.q3o25ubh33pmszsi@pengutronix.de> References: <20210329125707.182732-1-clemens.gruber@pqgruber.com> <20210329125707.182732-3-clemens.gruber@pqgruber.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="anui7dfz743pecr5" Content-Disposition: inline In-Reply-To: <20210329125707.182732-3-clemens.gruber@pqgruber.com> 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --anui7dfz743pecr5 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 29, 2021 at 02:57:03PM +0200, Clemens Gruber wrote: > The chip does not come out of POR in active state but in sleep state. > To be sure (in case the bootloader woke it up) we force it to sleep in > probe. >=20 > On kernels without CONFIG_PM, we wake the chip in .probe and put it to > sleep in .remove. What is the effect of sleep state? Does it continue to oscilate it the bootloader set up some configuration? > Signed-off-by: Clemens Gruber > --- > drivers/pwm/pwm-pca9685.c | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/pwm/pwm-pca9685.c b/drivers/pwm/pwm-pca9685.c > index fb026a25fb61..4d6684b90819 100644 > --- a/drivers/pwm/pwm-pca9685.c > +++ b/drivers/pwm/pwm-pca9685.c > @@ -469,14 +469,19 @@ static int pca9685_pwm_probe(struct i2c_client *cli= ent, > return ret; > } > =20 > - /* The chip comes out of power-up in the active state */ > - pm_runtime_set_active(&client->dev); > /* > - * Enable will put the chip into suspend, which is what we > - * want as all outputs are disabled at this point > + * The chip comes out of power-up in the sleep state, > + * but force it to sleep in case it was woken up before > */ > + pca9685_set_sleep_mode(pca, true); > + pm_runtime_set_suspended(&client->dev); > pm_runtime_enable(&client->dev); > =20 > + if (!IS_ENABLED(CONFIG_PM)) { > + /* Wake the chip up on non-PM environments */ > + pca9685_set_sleep_mode(pca, false); I admit I didn't grasp all the PM framework details, but I wonder if it's right to first call set_sleep_mode(true) and then in some cases to false again. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --anui7dfz743pecr5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmBh+GwACgkQwfwUeK3K 7AkbOggAjYvZJ4yGp4lADVNTwgOi0pKpb9Dp/MLD1RJO3uK16kZsTD5MQu2W/5hu wlxYxQ4E2C0cBKwq6dpphiCf2aC+wdF91SQx+ylH1jsLoDVwsVRISHre62252aRI 6ph+w1/xoi3taNeLwB4g6Bt7/c7nKz1nFope2UJuMRvD5yq6WykfBkVvygpOxs9q I7OQuzb2swBYCRm5TVaZeU6M96yZDzqEuLoiXD3PqbsoDxjqZ5axt4cgiVUb1PTr o5xbGzjthqNZd8V1BjkBQ4cHHlZy1YO0VSiTlvTPSyu3j7zwrXTQjJODNbOOluxS OXXMPJvHfZY8h1KJvSVjlvEz32FBkA== =aroP -----END PGP SIGNATURE----- --anui7dfz743pecr5--