Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5274918ybe; Tue, 10 Sep 2019 00:52:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyzy7/5Y41jK988xYXqrsIClUlhfEO8hWGvQ8OCebX2tKuwApVsllzFCS15mV/h2ksUKVzY X-Received: by 2002:aa7:c24f:: with SMTP id y15mr29794452edo.152.1568101926818; Tue, 10 Sep 2019 00:52:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568101926; cv=none; d=google.com; s=arc-20160816; b=KRPX9d9LwYW9FAVYS1v2maKjuRhlTdy03HSryZBspjt72YzFpEeJWJQU+kkMEEOScN 7B5U6UrGOkbpc7HsyKY18PHpjpBSGbGFv753wb+sVDVwXR+4YlA+N3/vciDv0G/NTSGp MG4soxlcHDHykVWQDRpZCqwO+buTpGOtByVBxrj7dWaSB9D7h2E77qtwR0BqKS6roIEq ehKWibpCxmYAjVX9eriUX+eoGb0COqoD6sdm7p0qmhI6Lav2TADhWVz9H7hTQsHg2dZe 6GZsjsGoT7HS6bNaRu91WcOYiI+2AEesxIqU3wG3VsNbumOp97q1CPt0PnamKzlZyH96 oM2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=uNPO18E9u4VFHR5eE6QVM48gJTzLZL8W/Knzhp286xk=; b=NDw78I8CDN5E9Dx51X9bQHBlwSxOgZn7HVxkdvb7gd9ycO+SPSuGSB3ik9tChruCVb YlqlGG1VvNzQnUJCrPdJrOpti9miAKDdByGqrlxoH3yVKbUBUNQ9q1L/23kiy0kZFMYt ZyCegCD2eMS6DrFNrX23SsK1w2SG4StwkHGMI+/CluO35gYSGChSA4VZZi01ttXAcTBi OEX5JRwNytDvOLvCJdi48RzIjYtoA+4lyA+cnxrP4fcobcrWo0U2olR9fqeNfkSXGm4T TyyZ1sIJoDxcvplrDXJaDV2DazL7WbONfJU+vWC71Zs+FQ4HHydGad5/dpCLRYZg2KHd GDUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kNHXD6JF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si446418edf.135.2019.09.10.00.51.42; Tue, 10 Sep 2019 00:52:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kNHXD6JF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727672AbfIINcT (ORCPT + 99 others); Mon, 9 Sep 2019 09:32:19 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:41669 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726863AbfIINcT (ORCPT ); Mon, 9 Sep 2019 09:32:19 -0400 Received: by mail-io1-f65.google.com with SMTP id r26so28566609ioh.8; Mon, 09 Sep 2019 06:32:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uNPO18E9u4VFHR5eE6QVM48gJTzLZL8W/Knzhp286xk=; b=kNHXD6JFZgQUAAdrzrOtXDHAaJeBL1xnN3iwN3mKbai6Q7jKlJxgRu39o/iTAD3TeH JvQH/prFlc7xMpZHQ9hPTCS7xrImCip45XKaKwayev6LJ0XxQdwiKuVS0NJTbQ/fdCA9 FV5FpGnJrjYoTzpr0PQYsYAjo493bmJpXO1qNDuiO8dV24MeTQyQ2wDdU+Q3ktLeMGYq lVYJ1vjR88/KtWt7zyDM1lxQFksTFp/6BgwKcTxAtl0ynEemsN44g/skL+sppOLiNvIc o4KmNbsK9gPlf0bt9xe3YyJ9Li4sQdRhj52vGN3VgAfRIXbIyO54otGYNOjHIJMEcr0N RivA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uNPO18E9u4VFHR5eE6QVM48gJTzLZL8W/Knzhp286xk=; b=byFJoyiyhf/siJL9lvyV3xc7oIa1WhP3/UFd47yYW1MQCi7yd11t3BIDgwjX+W0wNN aF2ooUlaGCJynwvdvyM7wADxSVBVn/Wm5TY0wu/fAfxNh5ojHiF7EAHaiJjLDgNoWIN/ KQ8A1QkoLltCy/ae1/E7btRYtpFxbvFeP/Kh9Carvnq+jaZrKakWX9WMicF6dwTh4BhK TddS/A+z6vp0nkuGX/hqCqA8rZd+xPFInc0R3vJ9PvDtnMgSWf48l9dsy0lPw0IBdV3u jvInAZzH41eXb0/RKg38IVPeshAknpIqxcfxiAuQq6h1jG1g64Pnz/c+bVhG7uHk8NEt xIWw== X-Gm-Message-State: APjAAAWbQpFZw+kfn/IuUJtAuBdvgHiXqCo1L+tq7gX5Reh0iPFWl5QO AIJ+gkO6tQqAQ9ZvY2sIOCQ//Ns2DtY0ci8YJYw= X-Received: by 2002:a02:b395:: with SMTP id p21mr26999521jan.52.1568035937967; Mon, 09 Sep 2019 06:32:17 -0700 (PDT) MIME-Version: 1.0 References: <20190814214319.24087-1-andreas@kemnade.info> In-Reply-To: From: Adam Ford Date: Mon, 9 Sep 2019 08:32:06 -0500 Message-ID: Subject: Re: [PATCH v2] regulator: twl: voltage lists for vdd1/2 on twl4030 To: Andreas Kemnade Cc: Tony Lindgren , Liam Girdwood , Mark Brown , Linux-OMAP , Linux Kernel Mailing List , linux-pm@vger.kernel.org, Stephen Boyd , Nishanth Menon , vireshk@kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 15, 2019 at 5:47 AM Adam Ford wrote: > > On Wed, Aug 14, 2019 at 5:18 PM Andreas Kemnade wrote: > > > > _opp_supported_by_regulators() wrongly ignored errors from > > regulator_is_supported_voltage(), so it considered errors as > > success. Since > > commit 498209445124 ("regulator: core: simplify return value on suported_voltage") > > regulator_is_supported_voltage() returns a real boolean, so > > errors make _opp_supported_by_regulators() return false. > > > > That reveals a problem with the declaration of the VDD1/2 > > regulators on twl4030. > > The VDD1/VDD2 regulators on twl4030 are neither defined with > > voltage lists nor with the continuous flag set, so > > regulator_is_supported_voltage() returns false and an error > > before above mentioned commit (which was considered success) > > The result is that after the above mentioned commit cpufreq > > does not work properly e.g. dm3730. > > > > [ 2.490997] core: _opp_supported_by_regulators: OPP minuV: 1012500 maxuV: 1012500, not supported by regulator > > [ 2.501617] cpu cpu0: _opp_add: OPP not supported by regulators (300000000) > > [ 2.509246] core: _opp_supported_by_regulators: OPP minuV: 1200000 maxuV: 1200000, not supported by regulator > > [ 2.519775] cpu cpu0: _opp_add: OPP not supported by regulators (600000000) > > [ 2.527313] core: _opp_supported_by_regulators: OPP minuV: 1325000 maxuV: 1325000, not supported by regulator > > [ 2.537750] cpu cpu0: _opp_add: OPP not supported by regulators (800000000) > > > > The patch fixes declaration of VDD1/2 regulators by > > adding proper voltage lists. > > > > Fixes: 498209445124 ("regulator: core: simplify return value on suported_voltage") > > Cc: stable@vger.kernel.org > > Signed-off-by: Andreas Kemnade > > Tested-by: Adam Ford #logicpd-torpedo-37xx-devkit > I am not sure who the right maintainer is, but as of today, cpufreq for users of twl4030 on 5.3-RC8 is still broken without this patch. Is there any way it can be applied before the final release? thank you, adam > > --- > > resent because it was rejected by mailing lists, due to technical > > issues, sorry for the noise. > > changes in v2: > > using a proper voltage list instead of misusing the continuous flag > > subject was regulator: twl: mark vdd1/2 as continuous on twl4030 > > > > drivers/regulator/twl-regulator.c | 23 ++++++++++++++++++++--- > > 1 file changed, 20 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c > > index 6fa15b2d6fb3..866b4dd01da9 100644 > > --- a/drivers/regulator/twl-regulator.c > > +++ b/drivers/regulator/twl-regulator.c > > @@ -359,6 +359,17 @@ static const u16 VINTANA2_VSEL_table[] = { > > 2500, 2750, > > }; > > > > +/* 600mV to 1450mV in 12.5 mV steps */ > > +static const struct regulator_linear_range VDD1_ranges[] = { > > + REGULATOR_LINEAR_RANGE(600000, 0, 68, 12500) > > +}; > > + > > +/* 600mV to 1450mV in 12.5 mV steps, everything above = 1500mV */ > > +static const struct regulator_linear_range VDD2_ranges[] = { > > + REGULATOR_LINEAR_RANGE(600000, 0, 68, 12500), > > + REGULATOR_LINEAR_RANGE(1500000, 69, 69, 12500) > > +}; > > + > > static int twl4030ldo_list_voltage(struct regulator_dev *rdev, unsigned index) > > { > > struct twlreg_info *info = rdev_get_drvdata(rdev); > > @@ -427,6 +438,8 @@ static int twl4030smps_get_voltage(struct regulator_dev *rdev) > > } > > > > static const struct regulator_ops twl4030smps_ops = { > > + .list_voltage = regulator_list_voltage_linear_range, > > + > > .set_voltage = twl4030smps_set_voltage, > > .get_voltage = twl4030smps_get_voltage, > > }; > > @@ -466,7 +479,8 @@ static const struct twlreg_info TWL4030_INFO_##label = { \ > > }, \ > > } > > > > -#define TWL4030_ADJUSTABLE_SMPS(label, offset, num, turnon_delay, remap_conf) \ > > +#define TWL4030_ADJUSTABLE_SMPS(label, offset, num, turnon_delay, remap_conf, \ > > + n_volt) \ > > static const struct twlreg_info TWL4030_INFO_##label = { \ > > .base = offset, \ > > .id = num, \ > > @@ -479,6 +493,9 @@ static const struct twlreg_info TWL4030_INFO_##label = { \ > > .owner = THIS_MODULE, \ > > .enable_time = turnon_delay, \ > > .of_map_mode = twl4030reg_map_mode, \ > > + .n_voltages = n_volt, \ > > + .n_linear_ranges = ARRAY_SIZE(label ## _ranges), \ > > + .linear_ranges = label ## _ranges, \ > > }, \ > > } > > > > @@ -518,8 +535,8 @@ TWL4030_ADJUSTABLE_LDO(VSIM, 0x37, 9, 100, 0x00); > > TWL4030_ADJUSTABLE_LDO(VDAC, 0x3b, 10, 100, 0x08); > > TWL4030_ADJUSTABLE_LDO(VINTANA2, 0x43, 12, 100, 0x08); > > TWL4030_ADJUSTABLE_LDO(VIO, 0x4b, 14, 1000, 0x08); > > -TWL4030_ADJUSTABLE_SMPS(VDD1, 0x55, 15, 1000, 0x08); > > -TWL4030_ADJUSTABLE_SMPS(VDD2, 0x63, 16, 1000, 0x08); > > +TWL4030_ADJUSTABLE_SMPS(VDD1, 0x55, 15, 1000, 0x08, 68); > > +TWL4030_ADJUSTABLE_SMPS(VDD2, 0x63, 16, 1000, 0x08, 69); > > /* VUSBCP is managed *only* by the USB subchip */ > > TWL4030_FIXED_LDO(VINTANA1, 0x3f, 1500, 11, 100, 0x08); > > TWL4030_FIXED_LDO(VINTDIG, 0x47, 1500, 13, 100, 0x08); > > -- > > 2.20.1 > >