From nobody Thu Nov 14 06:20:14 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B55E0C88C85 for ; Fri, 9 Jun 2023 08:32:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241186AbjFIIcd (ORCPT ); Fri, 9 Jun 2023 04:32:33 -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 ); 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 ; Fri, 9 Jun 2023 01:30:56 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-653f9c7b3e4so1184526b3a.2 for ; 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-Google-Smtp-Source: ACHHUZ5lDIRC/zAwCIUKvqzUz89u9ILnKYLfuUpakL+u3IyTJ/LdwHmfnWZrLngRPiMikJDodvdkjQ== 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 To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Mark Brown , Liam Girdwood , Matthias Brugger , AngeloGioacchino Del Regno Cc: Chen-Yu Tsai , 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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: AngeloGioacchino Del Regno --- drivers/regulator/mt6358-regulator.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt635= 8-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 =3D REGULATOR_VOLTAGE, \ .id =3D MT6358_ID_##vreg, \ .owner =3D THIS_MODULE, \ - .n_voltages =3D 1, \ + .n_voltages =3D 11, \ + .vsel_reg =3D MT6358_##vreg##_ANA_CON0, \ + .vsel_mask =3D GENMASK(3, 0), \ .enable_reg =3D enreg, \ .enable_mask =3D BIT(enbit), \ .min_uV =3D volt, \ + .uV_step =3D 10000, \ }, \ .status_reg =3D MT6358_LDO_##vreg##_CON1, \ .qi =3D BIT(15), \ @@ -219,10 +222,13 @@ struct mt6358_regulator_info { .type =3D REGULATOR_VOLTAGE, \ .id =3D MT6366_ID_##vreg, \ .owner =3D THIS_MODULE, \ - .n_voltages =3D 1, \ + .n_voltages =3D 11, \ + .vsel_reg =3D MT6358_##vreg##_ANA_CON0, \ + .vsel_mask =3D GENMASK(3, 0), \ .enable_reg =3D enreg, \ .enable_mask =3D BIT(enbit), \ .min_uV =3D volt, \ + .uV_step =3D 10000, \ }, \ .status_reg =3D MT6358_LDO_##vreg##_CON1, \ .qi =3D BIT(15), \ @@ -476,8 +482,13 @@ static const struct regulator_ops mt6358_volt_table_op= s =3D { .get_status =3D mt6358_get_status, }; =20 +/* "Fixed" LDOs with output voltage calibration +0 ~ +10 mV */ static const struct regulator_ops mt6358_volt_fixed_ops =3D { .list_voltage =3D regulator_list_voltage_linear, + .map_voltage =3D regulator_map_voltage_linear, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .get_voltage_sel =3D mt6358_get_buck_voltage_sel, + .set_voltage_time_sel =3D regulator_set_voltage_time_sel, .enable =3D regulator_enable_regmap, .disable =3D regulator_disable_regmap, .is_enabled =3D regulator_is_enabled_regmap, --=20 2.41.0.162.gfafddb0af9-goog