Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp741892rdb; Fri, 22 Dec 2023 03:53:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IHzz9BPxPfaFnBgQJMnrwXZQNy2EroMhTCZFMO3tvRUM2l/Vs3cn4fJRWSA+mp4E/CS48kK X-Received: by 2002:a17:907:76f0:b0:a23:ff8:8503 with SMTP id kg16-20020a17090776f000b00a230ff88503mr666610ejc.64.1703246039239; Fri, 22 Dec 2023 03:53:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703246039; cv=none; d=google.com; s=arc-20160816; b=BTYkVMpsg2X68P45W3r2i3LNHiM5VUkQxSydWhpH5P+xQkYypQCTxJlRSUg4N1MHti 8/kPq17QCH2yKcSaZZJJFfe8H5/ERyajeaipBM/yZ9oTbjGX3wD8i+//0lji4a17X5nu K7W4XMPxyFhuY/Ciun9XZ0yM8dmgBaHNe+6eu7hVdrQ1n1mvMNEKPPm0dv0i5FQ/T65m nsVA98MYU4ixvfodeyVbYfIxQCJxo79VehQ4/7zoMJzwvJ0QTuT04ggHNC5y8kjgBbyD KcChTQ/0sRfuRwK7OGLvrVaGYDsp7QFOsJyuBGC4W22BwvXB8M6FsSMjw+YFU12ZLPXS vcuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=zd1nXRiHxYnoWTYqTPm88rIfaxYMnMQ96xpm/EH/wWU=; fh=EplDcDx3o5yHc95RjMQ6ZDFK2PGqPsasgeBs1LRmWSE=; b=rOq1NjzuN/Aza34m3fW7n0WY6OEDBR7UC4VYmy5qVp6UiplhWGsBNePTnNFCMuTZ4m jbeDi9vVlZKvSsKpoIRhVrZq2a4g+B4vsQBEA9gGTh5z3c4ags4/IPuH4E10twT7/5h9 wBLqv5G6GPMlH6rL96yY/u8mQBO7P6Nsuat21ahm1ZoRjT98pf25ybPd1kl4fejRGFfR MF8umtcyeSVnzgUNHrYqZOxTYkrQ/L0x73FCKa/IByUqhKOikOEPot5Y+1557u5A1Lf2 cz5/rjlpZU3Ab5+nnCI4iCSy4tFfYEoHpSE2EPT6QDCUYVxINvgQdQskZwRNY8wVnwl0 Koxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hrqUVWwB; spf=pass (google.com: domain of linux-kernel+bounces-9676-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9676-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t12-20020a1709066bcc00b00a235aae3975si1673334ejs.713.2023.12.22.03.53.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 03:53:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9676-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hrqUVWwB; spf=pass (google.com: domain of linux-kernel+bounces-9676-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9676-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C76901F2422E for ; Fri, 22 Dec 2023 11:53:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E0B218B19; Fri, 22 Dec 2023 11:53:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hrqUVWwB" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7369618AE5; Fri, 22 Dec 2023 11:53:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF083C433C9; Fri, 22 Dec 2023 11:53:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703246029; bh=NB+xhNYLL2YOdGSpb6W2PV8TAmLE5kyfK0/CSF8eFIg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hrqUVWwBAexAmLH6SS89GdnnPZVenC6P6AoqYY0UThGRiUAno75Gh6cHuyckYQINa 1Jj+4RW1ipA/uzJyVng4YogC9NnCoVqqG87AO2yIjoi25EGrPE06YyXvpPZsycCT5w v9tr41gtXiPbx7purKSLuw/zjsyao1Xxse05sA2kNtAi0Zux31V4aYOZd7LXWispLx X2reeQDUco/vioRoNOs1JgYoRx7gozydCH3INKjBUBvDKW8s6z868oFgaM+SWyVhWb rctVbS2HVc9lLYWRtgpR9MTJU4wdTtBiCNJOdpJt9DBVUNedKKmQTvwqqyzMAgcZzL UK4pucHaUaDuA== Date: Fri, 22 Dec 2023 11:53:44 +0000 From: Mark Brown To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: Martin Blumenstingl , lgirdwood@gmail.com, linux-pwm@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Thierry Reding , Heiner Kallweit , Dmitry Rokosov Subject: Re: [RFC PATCH v1] regulator: pwm-regulator: Fix continuous get_voltage for disabled PWM Message-ID: <54905287-855d-47b4-880f-bfb1b8b1f49d@sirena.org.uk> References: <20231221211222.1380658-1-martin.blumenstingl@googlemail.com> <0c99b575-5cf2-4bd6-8cfd-af19f5fd58da@sirena.org.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="KJDHjVYfXsFaJRDn" Content-Disposition: inline In-Reply-To: X-Cookie: Familiarity breeds attempt. --KJDHjVYfXsFaJRDn Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 21, 2023 at 11:07:41PM +0100, Uwe Kleine-K=F6nig wrote: > On Thu, Dec 21, 2023 at 09:45:49PM +0000, Mark Brown wrote: > > > - voltage =3D pwm_get_relative_duty_cycle(&pstate, duty_unit); > > > + if (pstate.enabled) > > > + voltage =3D pwm_get_relative_duty_cycle(&pstate, duty= _unit); > > > + else if (max_uV_duty < min_uV_duty) > > > + voltage =3D max_uV_duty; > > > + else > > > + voltage =3D min_uV_duty; > > AFAICT this means that enabling the PWM changes the voltage read back > > which isn't what we expect (other than a change from 0 to target) and is > > likely to cause issues. get_voltage() should not change after an > > enable(), and indeed I'm unclear how this change works? I'd expect a > > change in the init_state() function, possibly one that programs the PWM > > to reflect the actual hardware state but I'm not 100% confident on that > > without digging into the PWM API more. > What is your question here? Looking at pwm_regulator_set_voltage() I > think this lacks a > pstate.enabled =3D true; > which might also fix Martin's problem? That's not really a question, it's a statement - I don't see how the change works at all and as it stands it introduces a problem with the behaviour when the regulator is enabled. --KJDHjVYfXsFaJRDn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmWFeMcACgkQJNaLcl1U h9DDmAf+MtgUxQLU77WJx9BvRbmHOIj3BusmZ5Vz4wKLhcxHaZ6kCJ6cqgwBBMv0 HLih1IgKLkKVBYuFGW3v3I2a8KjNglIqo9zDArCmFI16cB7zJ/XB7/oOQoBipnxd ttQtIshQIlBeLbxFQcdK9iecfoyYw4uxVoDdmCwo4OKvTIGYz8DEY2ahHEZdDl20 BpfrAA9JeECG/IuFn3SbSlrKzJ5uNwnctynsPfTOMVqKh7bD6kK2OpVx7W2huR7G Gsd8LXK2UGABOa5zc4dC5pe4pG2aqRbwRHoUbHOlC6N1ZF0NNP4cmDxQ8YnJZZG3 sQafS5nyBfCGJlWOmwecR7JkXeEFhg== =Hl8j -----END PGP SIGNATURE----- --KJDHjVYfXsFaJRDn--