Message ID | 20230609083009.2822259-8-wenst@chromium.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp797409vqr; Fri, 9 Jun 2023 01:36:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ64BYZP3QVcy7LiHJB8M21gSjnBvaAxTYASo52NQOjoB478sfER3WrTOrrfYqEazKwmtfcn X-Received: by 2002:a17:903:11c6:b0:1b2:49f6:6cdb with SMTP id q6-20020a17090311c600b001b249f66cdbmr454707plh.37.1686299768449; Fri, 09 Jun 2023 01:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686299768; cv=none; d=google.com; s=arc-20160816; b=0xWuOlgBQB+pKBGbuMQgGKR3yoOCkgE1S7IKAiaLzBwzHla1DhZqaBbDPMH6NoULAf JhmGIQ6Gg1X/6J83amx8qRAGDuKy1IO/a6uaeOLbY5Z6Z+Bgbs9D7mpnFckBj5pKsNhc fr3iEGO/KtMmSIKHiU5j3yJOxwsnkpvl13wlo6PhocjODC8NP7VL8Tk4q3Ajt7Gdcx9N y1cV3NjNduHJsIBo/Uu3xq9lF45x+9Yg061fbjlha4n6Hn+QuoJ6FFS51zLwJ7KlMbes ebsbCpnQPF6QSPwHUYuhdwGB1t8uriS0U1KdP9x6Lhjz6UsgmEnCCUepF+j2mFy6oWem irhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7N2GTAVTvejg4XyTSwRcmbBdgk1J778IcSYe2G8moyk=; b=0Sz/QxlQD5V7IuMwkMfpM64J5DTyaWtl+9qaB2n7CilMs845xbemn6Xw5CaIhnt46b /9i2H6roBeYijdPfdqQdYKUVoHZ98tiJ7BhTV2qLSVzqBN4hhlkGwuXDMQ2SA2d1qayH Tu7akusoTrLTYf2XtsWlUD2qO6GRzfrBi1Dva0EYhOSQoZnwfOTCGj2vQfDGHwSfEQYu 6Q3saSKPdjQf+4V/caURk2kug0Co94jPBRqNJzYbdGI4YcMhptOKSv69FBX6ILt5x6+m KsN0QJN+zZuQ8wBDyPGWwyzLPWVFgOAQJ9BSsWyQNcre71ccrovxlCNyVeNI4j7XU9LU CGRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jhiOWWyQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d14-20020a170903230e00b001aafc6a76e1si2460466plh.69.2023.06.09.01.35.55; Fri, 09 Jun 2023 01:36:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jhiOWWyQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241058AbjFIIcc (ORCPT <rfc822;liningstudo@gmail.com> + 99 others); Fri, 9 Jun 2023 04:32:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240978AbjFIIb2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 9 Jun 2023 04:31:28 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FC632712 for <linux-kernel@vger.kernel.org>; Fri, 9 Jun 2023 01:30:56 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-653f9c7b3e4so1184526b3a.2 for <linux-kernel@vger.kernel.org>; Fri, 09 Jun 2023 01:30:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1686299452; x=1688891452; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7N2GTAVTvejg4XyTSwRcmbBdgk1J778IcSYe2G8moyk=; b=jhiOWWyQyji2Fh7ueCNL9nKUQBwj8te65HJnaRK08rO8tB8OZiLAgJdxIiWj5tbUNz OFQS9ZqqPMzNmvrN/itYzZDHeeG2yef05RZtBC7sSub2qPk2bjSRlzEFHbFVKVSIcEXn 6o3koOM9dba2BZJUpOBz3AQ608t4h9ILRdcHg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686299452; x=1688891452; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7N2GTAVTvejg4XyTSwRcmbBdgk1J778IcSYe2G8moyk=; b=CijauDtTqHtRnuewcAReH1Fj/BSKoKRUfLkxQ8cF9aBs9zZP24sKZeQk4lFETkbRuH e5A9CgA1nqX4lqwi+cygEVOTelc+1UoxsGOZApQQFwlC+A8P5qtME7OcfwxZ9xb9vcm1 hBx9iCdH+gmVYTIf8CFKSW7897tYfr5Omya3EM45X83jNYMvv6UNe9L6+TC9hGzu9H/7 CpqbbQqcuXmbsHmrYw9Fb1pG7GfZGQQZtOqcPPGqgAUgHfYNHA5T76/s1+8K3DUeV9DY NDwOFwmYfXxdutR6BT087jlvNGxoJHV/LKPcpTR/Xe5zXPvcPsVRYDcCv/33INvBxMTy RQHg== X-Gm-Message-State: AC+VfDw3/a2kLCjXl7F6GggCfmLnbVHfId/j5cOLGvz7vMUgN2n9fArF mIN/V3amJtjLcoYITrTctPVQjw== X-Received: by 2002:a05:6a00:1408:b0:65b:945:f221 with SMTP id l8-20020a056a00140800b0065b0945f221mr468676pfu.34.1686299451909; Fri, 09 Jun 2023 01:30:51 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:c2ea:d8e4:1fe8:21f0]) by smtp.gmail.com with ESMTPSA id 23-20020aa79157000000b0063b806b111csm2184327pfi.169.2023.06.09.01.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 01:30:51 -0700 (PDT) From: Chen-Yu Tsai <wenst@chromium.org> To: Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Mark Brown <broonie@kernel.org>, Liam Girdwood <lgirdwood@gmail.com>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Cc: Chen-Yu Tsai <wenst@chromium.org>, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/9] regulator: mt6358: Add output voltage fine tuning to fixed regulators Date: Fri, 9 Jun 2023 16:30:04 +0800 Message-ID: <20230609083009.2822259-8-wenst@chromium.org> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog In-Reply-To: <20230609083009.2822259-1-wenst@chromium.org> References: <20230609083009.2822259-1-wenst@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768213466141157388?= X-GMAIL-MSGID: =?utf-8?q?1768213466141157388?= |
Series |
regulator: mt6358: Remove bogus regulators and improvements
|
|
Commit Message
Chen-Yu Tsai
June 9, 2023, 8:30 a.m. UTC
The "fixed" LDO regulators found on the MT6358 and MT6366 PMICs have
either no voltage selection register, or only one valid setting.
However these do have a fine voltage calibration setting that can
slightly boost the output voltage from 0 mV to 100 mV, in 10 mV
increments.
Add support for this by changing these into linear range regulators.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
drivers/regulator/mt6358-regulator.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
Comments
Il 09/06/23 10:30, Chen-Yu Tsai ha scritto: > The "fixed" LDO regulators found on the MT6358 and MT6366 PMICs have > either no voltage selection register, or only one valid setting. > However these do have a fine voltage calibration setting that can > slightly boost the output voltage from 0 mV to 100 mV, in 10 mV > increments. > > Add support for this by changing these into linear range regulators. > > Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
On Fri, Jun 09, 2023 at 04:30:04PM +0800, Chen-Yu Tsai wrote: > The "fixed" LDO regulators found on the MT6358 and MT6366 PMICs have > either no voltage selection register, or only one valid setting. > However these do have a fine voltage calibration setting that can > slightly boost the output voltage from 0 mV to 100 mV, in 10 mV > increments. This and the followup patch break the build on both arm64 and x86_64: /build/stage/linux/drivers/regulator/mt6358-regulator.c:127:29: error: ‘MT6358_VFE28_ANA_CON0’ undeclared here (not in a function); did you mean ‘MT6358_VIO28_ANA_CON0’? 127 | .vsel_reg = MT6358_##vreg##_ANA_CON0, \ | ^~~~~~~ /build/stage/linux/drivers/regulator/mt6358-regulator.c:525:9: note: in expansion of macro ‘MT6358_REG_FIXED’ 525 | MT6358_REG_FIXED("ldo_vfe28", VFE28, MT6358_LDO_VFE28_CON0, 0, 2800000), | ^~~~~~~~~~~~~~~~ /build/stage/linux/drivers/regulator/mt6358-regulator.c:127:29: error: ‘MT6358_VCN28_ANA_CON0’ undeclared here (not in a function); did you mean ‘MT6358_VCN18_ANA_CON0’? 127 | .vsel_reg = MT6358_##vreg##_ANA_CON0, \ | ^~~~~~~ /build/stage/linux/drivers/regulator/mt6358-regulator.c:526:9: note: in expansion of macro ‘MT6358_REG_FIXED’ 526 | MT6358_REG_FIXED("ldo_vcn28", VCN28, MT6358_LDO_VCN28_CON0, 0, 2800000), | ^~~~~~~~~~~~~~~~ /build/stage/linux/drivers/regulator/mt6358-regulator.c:127:29: error: ‘MT6358_VXO22_ANA_CON0’ undeclared here (not in a function); did you mean ‘MT6358_VIO28_ANA_CON0’? 127 | .vsel_reg = MT6358_##vreg##_ANA_CON0, \ | ^~~~~~~ /build/stage/linux/drivers/regulator/mt6358-regulator.c:527:9: note: in expansion of macro ‘MT6358_REG_FIXED’ 527 | MT6358_REG_FIXED("ldo_vxo22", VXO22, MT6358_LDO_VXO22_CON0, 0, 2200000), | ^~~~~~~~~~~~~~~~ /build/stage/linux/drivers/regulator/mt6358-regulator.c:127:29: error: ‘MT6358_VAUX18_ANA_CON0’ undeclared here (not in a function); did you mean ‘MT6358_VRF18_ANA_CON0’? 127 | .vsel_reg = MT6358_##vreg##_ANA_CON0, \ | ^~~~~~~ /build/stage/linux/drivers/regulator/mt6358-regulator.c:528:9: note: in expansion of macro ‘MT6358_REG_FIXED’ 528 | MT6358_REG_FIXED("ldo_vaux18", VAUX18, | ^~~~~~~~~~~~~~~~ /build/stage/linux/drivers/regulator/mt6358-regulator.c:127:29: error: ‘MT6358_VBIF28_ANA_CON0’ undeclared here (not in a function); did you mean ‘MT6358_VIO28_ANA_CON0’? 127 | .vsel_reg = MT6358_##vreg##_ANA_CON0, \ | ^~~~~~~ /build/stage/linux/drivers/regulator/mt6358-regulator.c:530:9: note: in expansion of macro ‘MT6358_REG_FIXED’ 530 | MT6358_REG_FIXED("ldo_vbif28", VBIF28, | ^~~~~~~~~~~~~~~~ /build/stage/linux/drivers/regulator/mt6358-regulator.c:127:29: error: ‘MT6358_VAUD28_ANA_CON0’ undeclared here (not in a function); did you mean ‘MT6358_VA12_ANA_CON0’? 127 | .vsel_reg = MT6358_##vreg##_ANA_CON0, \ | ^~~~~~~ /build/stage/linux/drivers/regulator/mt6358-regulator.c:535:9: note: in expansion of macro ‘MT6358_REG_FIXED’ 535 | MT6358_REG_FIXED("ldo_vaud28", VAUD28, | ^~~~~~~~~~~~~~~~
On Thu, Jun 15, 2023 at 12:15 AM Mark Brown <broonie@kernel.org> wrote: > > On Fri, Jun 09, 2023 at 04:30:04PM +0800, Chen-Yu Tsai wrote: > > The "fixed" LDO regulators found on the MT6358 and MT6366 PMICs have > > either no voltage selection register, or only one valid setting. > > However these do have a fine voltage calibration setting that can > > slightly boost the output voltage from 0 mV to 100 mV, in 10 mV > > increments. > > This and the followup patch break the build on both arm64 and x86_64: > > /build/stage/linux/drivers/regulator/mt6358-regulator.c:127:29: error: ‘MT6358_VFE28_ANA_CON0’ undeclared here (not in a function); did you mean ‘MT6358_VIO28_ANA_CON0’? > 127 | .vsel_reg = MT6358_##vreg##_ANA_CON0, \ > | ^~~~~~~ Argh, I sequenced the patches in my tree incorrectly. I see you already merged the first six patches. I'll send a new version including a header change that this patch needs, and other fixups that reviewers suggested. ChenYu > /build/stage/linux/drivers/regulator/mt6358-regulator.c:525:9: note: in expansion of macro ‘MT6358_REG_FIXED’ > 525 | MT6358_REG_FIXED("ldo_vfe28", VFE28, MT6358_LDO_VFE28_CON0, 0, 2800000), > | ^~~~~~~~~~~~~~~~ > /build/stage/linux/drivers/regulator/mt6358-regulator.c:127:29: error: ‘MT6358_VCN28_ANA_CON0’ undeclared here (not in a function); did you mean ‘MT6358_VCN18_ANA_CON0’? > 127 | .vsel_reg = MT6358_##vreg##_ANA_CON0, \ > | ^~~~~~~ > /build/stage/linux/drivers/regulator/mt6358-regulator.c:526:9: note: in expansion of macro ‘MT6358_REG_FIXED’ > 526 | MT6358_REG_FIXED("ldo_vcn28", VCN28, MT6358_LDO_VCN28_CON0, 0, 2800000), > | ^~~~~~~~~~~~~~~~ > /build/stage/linux/drivers/regulator/mt6358-regulator.c:127:29: error: ‘MT6358_VXO22_ANA_CON0’ undeclared here (not in a function); did you mean ‘MT6358_VIO28_ANA_CON0’? > 127 | .vsel_reg = MT6358_##vreg##_ANA_CON0, \ > | ^~~~~~~ > /build/stage/linux/drivers/regulator/mt6358-regulator.c:527:9: note: in expansion of macro ‘MT6358_REG_FIXED’ > 527 | MT6358_REG_FIXED("ldo_vxo22", VXO22, MT6358_LDO_VXO22_CON0, 0, 2200000), > | ^~~~~~~~~~~~~~~~ > /build/stage/linux/drivers/regulator/mt6358-regulator.c:127:29: error: ‘MT6358_VAUX18_ANA_CON0’ undeclared here (not in a function); did you mean ‘MT6358_VRF18_ANA_CON0’? > 127 | .vsel_reg = MT6358_##vreg##_ANA_CON0, \ > | ^~~~~~~ > /build/stage/linux/drivers/regulator/mt6358-regulator.c:528:9: note: in expansion of macro ‘MT6358_REG_FIXED’ > 528 | MT6358_REG_FIXED("ldo_vaux18", VAUX18, > | ^~~~~~~~~~~~~~~~ > /build/stage/linux/drivers/regulator/mt6358-regulator.c:127:29: error: ‘MT6358_VBIF28_ANA_CON0’ undeclared here (not in a function); did you mean ‘MT6358_VIO28_ANA_CON0’? > 127 | .vsel_reg = MT6358_##vreg##_ANA_CON0, \ > | ^~~~~~~ > /build/stage/linux/drivers/regulator/mt6358-regulator.c:530:9: note: in expansion of macro ‘MT6358_REG_FIXED’ > 530 | MT6358_REG_FIXED("ldo_vbif28", VBIF28, > | ^~~~~~~~~~~~~~~~ > /build/stage/linux/drivers/regulator/mt6358-regulator.c:127:29: error: ‘MT6358_VAUD28_ANA_CON0’ undeclared here (not in a function); did you mean ‘MT6358_VA12_ANA_CON0’? > 127 | .vsel_reg = MT6358_##vreg##_ANA_CON0, \ > | ^~~~~~~ > /build/stage/linux/drivers/regulator/mt6358-regulator.c:535:9: note: in expansion of macro ‘MT6358_REG_FIXED’ > 535 | MT6358_REG_FIXED("ldo_vaud28", VAUD28, > | ^~~~~~~~~~~~~~~~
diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c index 31a16fb28ecd..26060909cf90 100644 --- a/drivers/regulator/mt6358-regulator.c +++ b/drivers/regulator/mt6358-regulator.c @@ -123,10 +123,13 @@ struct mt6358_regulator_info { .type = REGULATOR_VOLTAGE, \ .id = MT6358_ID_##vreg, \ .owner = THIS_MODULE, \ - .n_voltages = 1, \ + .n_voltages = 11, \ + .vsel_reg = MT6358_##vreg##_ANA_CON0, \ + .vsel_mask = GENMASK(3, 0), \ .enable_reg = enreg, \ .enable_mask = BIT(enbit), \ .min_uV = volt, \ + .uV_step = 10000, \ }, \ .status_reg = MT6358_LDO_##vreg##_CON1, \ .qi = BIT(15), \ @@ -219,10 +222,13 @@ struct mt6358_regulator_info { .type = REGULATOR_VOLTAGE, \ .id = MT6366_ID_##vreg, \ .owner = THIS_MODULE, \ - .n_voltages = 1, \ + .n_voltages = 11, \ + .vsel_reg = MT6358_##vreg##_ANA_CON0, \ + .vsel_mask = GENMASK(3, 0), \ .enable_reg = enreg, \ .enable_mask = BIT(enbit), \ .min_uV = volt, \ + .uV_step = 10000, \ }, \ .status_reg = MT6358_LDO_##vreg##_CON1, \ .qi = BIT(15), \ @@ -476,8 +482,13 @@ static const struct regulator_ops mt6358_volt_table_ops = { .get_status = mt6358_get_status, }; +/* "Fixed" LDOs with output voltage calibration +0 ~ +10 mV */ static const struct regulator_ops mt6358_volt_fixed_ops = { .list_voltage = regulator_list_voltage_linear, + .map_voltage = regulator_map_voltage_linear, + .set_voltage_sel = regulator_set_voltage_sel_regmap, + .get_voltage_sel = mt6358_get_buck_voltage_sel, + .set_voltage_time_sel = regulator_set_voltage_time_sel, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap,