From mboxrd@z Thu Jan 1 00:00:00 1970 From: broonie@kernel.org (Mark Brown) Date: Mon, 22 Aug 2016 17:29:07 +0100 Subject: [PATCH 3/9] regulator: core: Try full range when adjusting regulators to constraints In-Reply-To: <20160821021125.1521-4-wens@csie.org> References: <20160821021125.1521-1-wens@csie.org> <20160821021125.1521-4-wens@csie.org> Message-ID: <20160822162907.GO22076@sirena.org.uk> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Sun, Aug 21, 2016 at 10:11:19AM +0800, Chen-Yu Tsai wrote: > Currently when we try to bring regulator in bounds of its constraints, > we pick either the minimum or maximum voltage as the target. This fails > if the regulator range is not continuous, and the target voltage is not > an exact value the regulator can achieve, i.e. the target is not aligned > to the step of the regulator. This seems like you have buggy constraints, constraints which allow voltages that can't physically be satisfied don't make obvious sense. > - if (current_uV < rdev->constraints->min_uV) { > + if (current_uV < rdev->constraints->min_uV || > + current_uV > rdev->constraints->max_uV) { > target_min = rdev->constraints->min_uV; > - target_max = rdev->constraints->min_uV; > - } > - > - if (current_uV > rdev->constraints->max_uV) { > - target_min = rdev->constraints->max_uV; > target_max = rdev->constraints->max_uV; > } This is most likely going to cause disruption to systems where the voltage is over the constraint voltage - it will result in the voltage being lowered to the minimum allowed which will have a much higher chance of upsetting things. This is why we don't just do a constraints run. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 473 bytes Desc: not available URL: From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Brown Subject: Re: [PATCH 3/9] regulator: core: Try full range when adjusting regulators to constraints Date: Mon, 22 Aug 2016 17:29:07 +0100 Message-ID: <20160822162907.GO22076@sirena.org.uk> References: <20160821021125.1521-1-wens@csie.org> <20160821021125.1521-4-wens@csie.org> Reply-To: broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="IpgPcFyQO6wM49Um" Return-path: Sender: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Content-Disposition: inline In-Reply-To: <20160821021125.1521-4-wens-jdAy2FN1RRM@public.gmane.org> List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , To: Chen-Yu Tsai Cc: Lee Jones , Rob Herring , Mark Rutland , Liam Girdwood , Maxime Ripard , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-Id: devicetree@vger.kernel.org --IpgPcFyQO6wM49Um Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline On Sun, Aug 21, 2016 at 10:11:19AM +0800, Chen-Yu Tsai wrote: > Currently when we try to bring regulator in bounds of its constraints, > we pick either the minimum or maximum voltage as the target. This fails > if the regulator range is not continuous, and the target voltage is not > an exact value the regulator can achieve, i.e. the target is not aligned > to the step of the regulator. This seems like you have buggy constraints, constraints which allow voltages that can't physically be satisfied don't make obvious sense. > - if (current_uV < rdev->constraints->min_uV) { > + if (current_uV < rdev->constraints->min_uV || > + current_uV > rdev->constraints->max_uV) { > target_min = rdev->constraints->min_uV; > - target_max = rdev->constraints->min_uV; > - } > - > - if (current_uV > rdev->constraints->max_uV) { > - target_min = rdev->constraints->max_uV; > target_max = rdev->constraints->max_uV; > } This is most likely going to cause disruption to systems where the voltage is over the constraint voltage - it will result in the voltage being lowered to the minimum allowed which will have a much higher chance of upsetting things. This is why we don't just do a constraints run. --IpgPcFyQO6wM49Um-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756154AbcHVQa1 (ORCPT ); Mon, 22 Aug 2016 12:30:27 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:34886 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755256AbcHVQaY (ORCPT ); Mon, 22 Aug 2016 12:30:24 -0400 Date: Mon, 22 Aug 2016 17:29:07 +0100 From: Mark Brown To: Chen-Yu Tsai Cc: Lee Jones , Rob Herring , Mark Rutland , Liam Girdwood , Maxime Ripard , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Message-ID: <20160822162907.GO22076@sirena.org.uk> References: <20160821021125.1521-1-wens@csie.org> <20160821021125.1521-4-wens@csie.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="IpgPcFyQO6wM49Um" Content-Disposition: inline In-Reply-To: <20160821021125.1521-4-wens@csie.org> X-Cookie: Satire is what closes in New Haven. User-Agent: Mutt/1.6.0 (2016-04-01) X-SA-Exim-Connect-IP: 2a01:348:6:8808:fab::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: [PATCH 3/9] regulator: core: Try full range when adjusting regulators to constraints X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --IpgPcFyQO6wM49Um Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Aug 21, 2016 at 10:11:19AM +0800, Chen-Yu Tsai wrote: > Currently when we try to bring regulator in bounds of its constraints, > we pick either the minimum or maximum voltage as the target. This fails > if the regulator range is not continuous, and the target voltage is not > an exact value the regulator can achieve, i.e. the target is not aligned > to the step of the regulator. This seems like you have buggy constraints, constraints which allow voltages that can't physically be satisfied don't make obvious sense. > - if (current_uV < rdev->constraints->min_uV) { > + if (current_uV < rdev->constraints->min_uV || > + current_uV > rdev->constraints->max_uV) { > target_min = rdev->constraints->min_uV; > - target_max = rdev->constraints->min_uV; > - } > - > - if (current_uV > rdev->constraints->max_uV) { > - target_min = rdev->constraints->max_uV; > target_max = rdev->constraints->max_uV; > } This is most likely going to cause disruption to systems where the voltage is over the constraint voltage - it will result in the voltage being lowered to the minimum allowed which will have a much higher chance of upsetting things. This is why we don't just do a constraints run. --IpgPcFyQO6wM49Um Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXuyhRAAoJECTWi3JdVIfQyk0H/3BkcroNoVv/dDOzrm1EaQjD ng6IRQ1rd7fUh+h5XHSN97aa8iHRustKNutixVQo/MIpJidGXCNjQCgGK7v4ZZOE S+JyeC9g6cuedBMScHWLAFmSsvypDwrPndbPp0Oezj8B/MDv/tJRAAd87au1spYY EBCKwoq8oguR/rGYp9MWo7jZz7hw0xJBF+9G0E9L4MHOwPqP0AO0i4x1CHbOaEic 0jLcEz9hY3wHVQkSnJ+3XOIdSx337Br2aRQOyeWvD16smxzxmzkdfXvfpUrz+dZy NnLyITi6St9FJRPXvKPh8KuROmtNirz+G1SF7vYIOIBUbrzbeqiGjsvvKiS1GTA= =sIi4 -----END PGP SIGNATURE----- --IpgPcFyQO6wM49Um--