From patchwork Wed Sep 13 08:29:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 13382589 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C6C36CA5507 for ; Wed, 13 Sep 2023 08:29:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vVZVDk0nVt9xPkuQ7kA0rk+skb+IlHVfGj8ZHv+S3fY=; b=IDgCFfN3MsNdZ+QswH7gcWeOuZ D6N+y3XEd8i77QyYngG21/uJKM9DoJjev6m5qYTuLhhQsthda5k2n3FnbDq9QGC9K/NBIuPhLDfM/ Zl5FIg0QxQZk8IF/YsyeFQ7fappb01JfMB2B20I3peAcK22udT2MFDlu6liYTIiLQl+Mlfy7HJ/q4 oV6HnZRmCreE5xU4mp3YcsRNBOpFVZh06db2O3yxZB7XA5U3iiMz0lehQGjP3+ySrBUskL74SfGXM 9pypknh341kKykU577QlqsIa6RD6wKlVWTyuR/JqJbFsEXheS4g/floXHnIeqfVTQD0c5Ddcvbnj1 i120Sk3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qgLFm-0056FN-1u; Wed, 13 Sep 2023 08:29:42 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qgLFj-0056Bi-1h for linux-mediatek@lists.infradead.org; Wed, 13 Sep 2023 08:29:40 +0000 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-573f8afe1d9so4902292a12.0 for ; Wed, 13 Sep 2023 01:29:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1694593775; x=1695198575; darn=lists.infradead.org; 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=vVZVDk0nVt9xPkuQ7kA0rk+skb+IlHVfGj8ZHv+S3fY=; b=LZpwk7mNGonEg0mdhFNJBmdsWHMT0EfpYYBZPhYyHcd+nVDhLR3eJ4hLGjrrboEI9V 6E3iBLqcwyunBM8b7rJ+Gipp4VrUKiYDT1CaNEt+3kAxPtD2hI/pezhJ2hg1JH5tTVZ1 xSAcGfoS/dcfDTeR0vxxU5U99e5e572Ob4YFA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694593775; x=1695198575; 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=vVZVDk0nVt9xPkuQ7kA0rk+skb+IlHVfGj8ZHv+S3fY=; b=VAMABJiwyEDWdeSVsy7Yb9wqCPhjY4CQ62ceILobkw4rhp789fXJSMTdaM+33VixaQ 2QK2Fd1fhZ7gROB9rW+9mFr2wqcB7vPWBvz+U+Q0/AO7HpsFqDuz0NXxGPhxPy19nWpT jBSkc+tZjkN1nle7YVhVhyGqemHUMaOCxBNpK6Kniw3b74264NnzUws8abf3cZfENZqY k3GyBPtPVs5cAc6nOnRFeOp1DIQFPgViv0KYQmfT1rrfM2TCyO++NLeTkykir0iSKZKl nqUkr2NYNYm2YE3St0NY1yLWKLMyHN6+alp/+EQLBGCw2cgCseiwtInB+8BJh3jVNbOI Ow/A== X-Gm-Message-State: AOJu0Yw8yXg05U9iXg8MUcAuS5XqkRwwOGkj7e5Zg0tl3UrmiaMr6W7a +lXZF0rfs/4jUHaaOtf2+7ZBzw== X-Google-Smtp-Source: AGHT+IEF2Cbs43/GwH2qUvBaNCgggY8+SfaBpnPQY9+z0cUqRzQ1FP5ckChyMhczwlBC41km5t3GYA== X-Received: by 2002:a05:6a20:2444:b0:134:30a8:9df5 with SMTP id t4-20020a056a20244400b0013430a89df5mr2039361pzc.43.1694593775198; Wed, 13 Sep 2023 01:29:35 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:b24c:3be4:d952:d3b1]) by smtp.gmail.com with ESMTPSA id g6-20020aa78746000000b006901bd3a9e4sm418781pfo.104.2023.09.13.01.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 01:29:34 -0700 (PDT) From: Chen-Yu Tsai To: Lee Jones , Matthias Brugger , AngeloGioacchino Del Regno , Mark Brown Cc: Chen-Yu Tsai , Zhiyong Tao , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 1/3] regulator: mt6358: Fail probe on unknown chip ID Date: Wed, 13 Sep 2023 16:29:16 +0800 Message-ID: <20230913082919.1631287-2-wenst@chromium.org> X-Mailer: git-send-email 2.42.0.283.g2d96d420d3-goog In-Reply-To: <20230913082919.1631287-1-wenst@chromium.org> References: <20230913082919.1631287-1-wenst@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230913_012939_567604_112C4E46 X-CRM114-Status: GOOD ( 16.94 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org The MT6358 and MT6366 PMICs, and likely many others from MediaTek, have a chip ID register, making the chip semi-discoverable. The driver currently supports two PMICs and expects to be probed on one or the other. It does not account for incorrect mfd driver entries or device trees. While these should not happen, if they do, it could be catastrophic for the device. The driver should be sure the hardware is what it expects. Make the driver fail to probe if the chip ID presented is not a known one. Suggested-by: AngeloGioacchino Del Regno Fixes: f0e3c6261af1 ("regulator: mt6366: Add support for MT6366 regulator") Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno --- drivers/regulator/mt6358-regulator.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c index 120c60d40ed4..935c7ad56c7e 100644 --- a/drivers/regulator/mt6358-regulator.c +++ b/drivers/regulator/mt6358-regulator.c @@ -682,12 +682,18 @@ static int mt6358_regulator_probe(struct platform_device *pdev) const struct mt6358_regulator_info *mt6358_info; int i, max_regulator, ret; - if (mt6397->chip_id == MT6366_CHIP_ID) { - max_regulator = MT6366_MAX_REGULATOR; - mt6358_info = mt6366_regulators; - } else { + switch (mt6397->chip_id) { + case MT6358_CHIP_ID: max_regulator = MT6358_MAX_REGULATOR; mt6358_info = mt6358_regulators; + break; + case MT6366_CHIP_ID: + max_regulator = MT6366_MAX_REGULATOR; + mt6358_info = mt6366_regulators; + break; + default: + dev_err(&pdev->dev, "unsupported chip ID: %d\n", mt6397->chip_id); + return -EINVAL; } ret = mt6358_sync_vcn33_setting(&pdev->dev); From patchwork Wed Sep 13 08:29:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 13382591 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF10ACA5508 for ; Wed, 13 Sep 2023 08:29:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HdHiqmsycYyIT3/cC+/dOfMKn4pKdIqRmHbcGwVnX5s=; b=rc7Ijlju0vn7uvCWgusj5pvQAL slqBJKDO7WIvjYmA+M3Jy3U9LSjkOaKkcfqqLoPUHJE3CPI8sH9ogFZ+LYhsv8z04z7me6rEnHu+6 3TTfiQRUBgGD9PQaAHbs93XjR7E4P/kDZ9sJGvMrKeXBQW7jDsOGFp/lDp01/qHMirMiue1pqL98T YKXqpxYy6cG/gFDa57szGcoDRyoFodQWff9VY+YwdUXhaZtVp9oOtxQFAtdmbtH/sMh3KSKA/j3gF FO6sRocT2m+Iq/h6do+lhrygFq8NhPc3wtBQsSJ8txGj+rnE/NxIvNmwY318nrw3oA6+1k+ThOGIa B+VRgSNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qgLFu-0056JV-38; Wed, 13 Sep 2023 08:29:50 +0000 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qgLFl-0056CE-0O for linux-mediatek@lists.infradead.org; Wed, 13 Sep 2023 08:29:44 +0000 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-6bdcbde9676so4483776a34.3 for ; Wed, 13 Sep 2023 01:29:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1694593777; x=1695198577; darn=lists.infradead.org; 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=HdHiqmsycYyIT3/cC+/dOfMKn4pKdIqRmHbcGwVnX5s=; b=ThEFDgwoB6NHOnW01vOOKOSBfPNGPmgOzHCEBXHtOjDbXcPALY7/uv9zYa3qN1bufd T6JQk6Sx5r3V940D7f9VpWwv/hlzoHARPyAGUg6FfVBkmLbIXZ9CDq3R7kgTlfmOwj4i bnaOVTXg5Ftgo1wD1skOstRc/csJckVUIhPCo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694593777; x=1695198577; 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=HdHiqmsycYyIT3/cC+/dOfMKn4pKdIqRmHbcGwVnX5s=; b=K3uJMHDE+gvM9PdIQHYGbfjD0T4UD9FLaBaVv+fqgi6f/F2t9asn4BLlw0AwKvZMVX JtvMFdHoVQhmCD2jNXvJSi8ZJYSJxCQk2YEcHSnwzJYi+i5BHx+FpiGms6TZBOmjwfGQ RJPVLd5NTJJHrnIBgJwfBM2wJYTEdECcK5mNnUwy2hq7HJCC2/phJnjUk+jB3+uxlKwY q0zGOUxSwweRvFOU6jPEm0U2PgDJkxoQxbnjI34qiK3Ipbu626AMkQik9hx/bCIwlDZ1 /MNhrkYKUMJbfxhkBZMrQJrASiIs7m7olGzJ2vVYxx9RuS6teRb83KhfsZlUyBs37fOs YXFg== X-Gm-Message-State: AOJu0YxPiTAe4Prnjo+dkDhXbVVCG+XjQ78R918M997RngkyxjMqS3+A o+dtYlB8t6EnVDVogR001NOi9w== X-Google-Smtp-Source: AGHT+IEAk04XlqXXsbF3kNq6HWqUzflUESMdvKxSa9IgjgSc+RGUwJ6TTDvbnhxYl19Rn4xSY68iwA== X-Received: by 2002:a05:6358:42a1:b0:135:4003:7841 with SMTP id s33-20020a05635842a100b0013540037841mr2163234rwc.13.1694593777309; Wed, 13 Sep 2023 01:29:37 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:b24c:3be4:d952:d3b1]) by smtp.gmail.com with ESMTPSA id g6-20020aa78746000000b006901bd3a9e4sm418781pfo.104.2023.09.13.01.29.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 01:29:36 -0700 (PDT) From: Chen-Yu Tsai To: Lee Jones , Matthias Brugger , AngeloGioacchino Del Regno , Mark Brown Cc: Chen-Yu Tsai , Zhiyong Tao , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 2/3] regulator: mt6358: Add output voltage fine tuning to fixed regulators Date: Wed, 13 Sep 2023 16:29:17 +0800 Message-ID: <20230913082919.1631287-3-wenst@chromium.org> X-Mailer: git-send-email 2.42.0.283.g2d96d420d3-goog In-Reply-To: <20230913082919.1631287-1-wenst@chromium.org> References: <20230913082919.1631287-1-wenst@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230913_012941_214585_8B27A333 X-CRM114-Status: GOOD ( 14.00 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org 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. Some register definitions that are missing are also added. Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno Acked-by: Lee Jones --- This patch needs an ack from Lee. drivers/regulator/mt6358-regulator.c | 15 +++++++++++++-- include/linux/mfd/mt6358/registers.h | 6 ++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c index 935c7ad56c7e..ecb2cd1eb34f 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), \ @@ -482,8 +488,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, diff --git a/include/linux/mfd/mt6358/registers.h b/include/linux/mfd/mt6358/registers.h index 3d33517f178c..5ea2590be710 100644 --- a/include/linux/mfd/mt6358/registers.h +++ b/include/linux/mfd/mt6358/registers.h @@ -262,6 +262,12 @@ #define MT6358_LDO_VBIF28_CON3 0x1db0 #define MT6358_VCAMA1_ANA_CON0 0x1e08 #define MT6358_VCAMA2_ANA_CON0 0x1e0c +#define MT6358_VFE28_ANA_CON0 0x1e10 +#define MT6358_VCN28_ANA_CON0 0x1e14 +#define MT6358_VBIF28_ANA_CON0 0x1e18 +#define MT6358_VAUD28_ANA_CON0 0x1e1c +#define MT6358_VAUX18_ANA_CON0 0x1e20 +#define MT6358_VXO22_ANA_CON0 0x1e24 #define MT6358_VCN33_ANA_CON0 0x1e28 #define MT6358_VSIM1_ANA_CON0 0x1e2c #define MT6358_VSIM2_ANA_CON0 0x1e30 From patchwork Wed Sep 13 08:29:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 13382592 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6097CCA5507 for ; Wed, 13 Sep 2023 08:29:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ef5OCfOkv8S2pr1WqDspyiJtRgwSD+1amDKVNYL+cmM=; b=0YW8Rrpw707Y5TP3kNQedhxKGC 8KRFFAO15qwwPOQf42PYDP9Aitw7jomA6VuNbVUxo7OBXElgBJ+dd1z+eqV1vsL6XiFGsV9rv7aY8 kCv+Stt3Um/woIkhw3Ns37V4Sd3fZsnmEsKSGoQA3srHeD+zkP+Zu215A9rFki6pyiwwD0+x6xo1R uJf5iOqk3Zat9SdNSL9aOtrEC39pxh67oV2kJYz5hTN1qqEQVcpq7WjvoxYnjsL5a90JHE/YdhlJe lKHH2/uiX/iJlymqYApBOmRfbfvwKzsMeC+xt/CfRj4ywqPMbAi1/yDVi9ycPqaeBz2VyJnbuaxov DWfbKkxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qgLFv-0056Jk-0u; Wed, 13 Sep 2023 08:29:51 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qgLFl-0056DI-1o for linux-mediatek@lists.infradead.org; Wed, 13 Sep 2023 08:29:45 +0000 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-5778fe9d183so1923791a12.3 for ; Wed, 13 Sep 2023 01:29:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1694593779; x=1695198579; darn=lists.infradead.org; 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=ef5OCfOkv8S2pr1WqDspyiJtRgwSD+1amDKVNYL+cmM=; b=b/Ac0UKu0yN2D4hK2wwG27TaOsUx1/7lv1SHRPjunp+BkOCt/ZoDb5fDMWBLA5EfVQ 3Sb7XlIgul6RTqVql4mZ28gls8cyyYkEnzxYEWwTCunuRyKZkrZrPyIdaSjbcVces8fY Jhs3hQ4wDsUmbLzdLghyqX3EhDwBYJ8fA+EE4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694593779; x=1695198579; 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=ef5OCfOkv8S2pr1WqDspyiJtRgwSD+1amDKVNYL+cmM=; b=b14iJj+ySmNEq6QLwG/LJ+HaWa6T2oHryzf8x9pkZ3J6jjq866x+K4Ks5GZJIcnd/x ddUMRJF62wtkmWQi0JzkwzR9xVEOL63QtQogmnGq6hBdjLd3vtK/9yU0KWFCHkG0Eshc iQwafKg0NNKPcbKPh0n9GodVbeJb1o1WePiwzIltb+Xjv4sFoqS5TBavrBbqMLpH7zaR RdJDxsbR/xy9FBONqRBhpMRpc4biEVYynlf2rdN9+Na7O2oZroMNMTuIz2myiuwEl9rV arSZovGp9Mhnbe6MXrcQb45Y1HRTYmai8WzxMM1Zr+mPtujOib49skFU09qaoWbz8lrR xauQ== X-Gm-Message-State: AOJu0YwuZl9E2/lwL2UkjSc7a0ZgHkfrUUI7Uv5iPm48Po4GDA4IIM9i pCf1HWaz+t72Q/2w0okjA9LQVVTJ+RkMRWv7tcc= X-Google-Smtp-Source: AGHT+IHUGqrZdfW8Y35Nm54D33zR4iMwVCYGMzp4WoCBKc4josfo1/oalhs/oTUIdHbDyMvGOfhjWA== X-Received: by 2002:a05:6a20:9381:b0:13d:315f:26b7 with SMTP id x1-20020a056a20938100b0013d315f26b7mr2031045pzh.1.1694593779451; Wed, 13 Sep 2023 01:29:39 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:b24c:3be4:d952:d3b1]) by smtp.gmail.com with ESMTPSA id g6-20020aa78746000000b006901bd3a9e4sm418781pfo.104.2023.09.13.01.29.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 01:29:39 -0700 (PDT) From: Chen-Yu Tsai To: Lee Jones , Matthias Brugger , AngeloGioacchino Del Regno , Mark Brown Cc: Chen-Yu Tsai , Zhiyong Tao , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 3/3] regulator: mt6358: Add output voltage fine tuning to variable LDOs Date: Wed, 13 Sep 2023 16:29:18 +0800 Message-ID: <20230913082919.1631287-4-wenst@chromium.org> X-Mailer: git-send-email 2.42.0.283.g2d96d420d3-goog In-Reply-To: <20230913082919.1631287-1-wenst@chromium.org> References: <20230913082919.1631287-1-wenst@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230913_012941_605545_34E8949F X-CRM114-Status: GOOD ( 16.23 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Some of the LDO regulators in the MT6358/MT6366 have sparsely populated voltage tables, supported by custom get/set operators. While it works, it requires more code and an extra field to store the lookup table. These LDOs also have fine voltage calibration settings that can slightly boost the output voltage from 0 mV to 100 mV, in 10 mV increments. These combined could be modeled as a pickable set of linear ranges. The coarse voltage setting is modeled as the range selector, while each range has 11 selectors, starting from the range's base voltage, up to +100 mV, in 10mV increments. Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno --- Changes since v2: - selector values for all the linear ranges have been fixed. I misinterpreted how the selector values for the pickable linear ranges should be filled in. Angelo's reviewed-by has been dropped as a result of the change. drivers/regulator/mt6358-regulator.c | 275 +++++++++++---------------- 1 file changed, 115 insertions(+), 160 deletions(-) diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c index ecb2cd1eb34f..4a6ad0ccf03b 100644 --- a/drivers/regulator/mt6358-regulator.c +++ b/drivers/regulator/mt6358-regulator.c @@ -26,8 +26,6 @@ struct mt6358_regulator_info { struct regulator_desc desc; u32 status_reg; u32 qi; - const u32 *index_table; - unsigned int n_table; u32 da_vsel_reg; u32 da_vsel_mask; u32 modeset_reg; @@ -64,9 +62,7 @@ struct mt6358_regulator_info { .modeset_mask = BIT(_modeset_shift), \ } -#define MT6358_LDO(match, vreg, ldo_volt_table, \ - ldo_index_table, enreg, enbit, vosel, \ - vosel_mask) \ +#define MT6358_LDO(match, vreg, volt_ranges, enreg, enbit, vosel, vosel_mask) \ [MT6358_ID_##vreg] = { \ .desc = { \ .name = #vreg, \ @@ -75,17 +71,19 @@ struct mt6358_regulator_info { .type = REGULATOR_VOLTAGE, \ .id = MT6358_ID_##vreg, \ .owner = THIS_MODULE, \ - .n_voltages = ARRAY_SIZE(ldo_volt_table), \ - .volt_table = ldo_volt_table, \ - .vsel_reg = vosel, \ - .vsel_mask = vosel_mask, \ + .n_voltages = ARRAY_SIZE(volt_ranges##_ranges) * 11, \ + .linear_ranges = volt_ranges##_ranges, \ + .linear_range_selectors_bitfield = volt_ranges##_selectors, \ + .n_linear_ranges = ARRAY_SIZE(volt_ranges##_ranges), \ + .vsel_range_reg = vosel, \ + .vsel_range_mask = vosel_mask, \ + .vsel_reg = MT6358_##vreg##_ANA_CON0, \ + .vsel_mask = GENMASK(3, 0), \ .enable_reg = enreg, \ .enable_mask = BIT(enbit), \ }, \ .status_reg = MT6358_LDO_##vreg##_CON1, \ .qi = BIT(15), \ - .index_table = ldo_index_table, \ - .n_table = ARRAY_SIZE(ldo_index_table), \ } #define MT6358_LDO1(match, vreg, min, max, step, \ @@ -163,9 +161,7 @@ struct mt6358_regulator_info { .modeset_mask = BIT(_modeset_shift), \ } -#define MT6366_LDO(match, vreg, ldo_volt_table, \ - ldo_index_table, enreg, enbit, vosel, \ - vosel_mask) \ +#define MT6366_LDO(match, vreg, volt_ranges, enreg, enbit, vosel, vosel_mask) \ [MT6366_ID_##vreg] = { \ .desc = { \ .name = #vreg, \ @@ -174,17 +170,19 @@ struct mt6358_regulator_info { .type = REGULATOR_VOLTAGE, \ .id = MT6366_ID_##vreg, \ .owner = THIS_MODULE, \ - .n_voltages = ARRAY_SIZE(ldo_volt_table), \ - .volt_table = ldo_volt_table, \ - .vsel_reg = vosel, \ - .vsel_mask = vosel_mask, \ + .n_voltages = ARRAY_SIZE(volt_ranges##_ranges) * 11, \ + .linear_ranges = volt_ranges##_ranges, \ + .linear_range_selectors_bitfield = volt_ranges##_selectors, \ + .n_linear_ranges = ARRAY_SIZE(volt_ranges##_ranges), \ + .vsel_range_reg = vosel, \ + .vsel_range_mask = vosel_mask, \ + .vsel_reg = MT6358_##vreg##_ANA_CON0, \ + .vsel_mask = GENMASK(3, 0), \ .enable_reg = enreg, \ .enable_mask = BIT(enbit), \ }, \ .status_reg = MT6358_LDO_##vreg##_CON1, \ .qi = BIT(15), \ - .index_table = ldo_index_table, \ - .n_table = ARRAY_SIZE(ldo_index_table), \ } #define MT6366_LDO1(match, vreg, min, max, step, \ @@ -235,95 +233,95 @@ struct mt6358_regulator_info { } -static const unsigned int vdram2_voltages[] = { - 600000, 1800000, -}; - -static const unsigned int vsim_voltages[] = { - 1700000, 1800000, 2700000, 3000000, 3100000, -}; - -static const unsigned int vibr_voltages[] = { - 1200000, 1300000, 1500000, 1800000, - 2000000, 2800000, 3000000, 3300000, +/* VDRAM2 voltage selector not shown in datasheet */ +static const unsigned int vdram2_selectors[] = { 0, 12 }; +static const struct linear_range vdram2_ranges[] = { + REGULATOR_LINEAR_RANGE(600000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(1800000, 0, 10, 10000), }; -static const unsigned int vusb_voltages[] = { - 3000000, 3100000, +static const unsigned int vsim_selectors[] = { 3, 4, 8, 11, 12 }; +static const struct linear_range vsim_ranges[] = { + REGULATOR_LINEAR_RANGE(1700000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(1800000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(2700000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(3000000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(3100000, 0, 10, 10000), }; -static const unsigned int vcamd_voltages[] = { - 900000, 1000000, 1100000, 1200000, - 1300000, 1500000, 1800000, +static const unsigned int vibr_selectors[] = { 0, 1, 2, 4, 5, 9, 11, 13 }; +static const struct linear_range vibr_ranges[] = { + REGULATOR_LINEAR_RANGE(1200000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(1300000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(1500000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(1800000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(2000000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(2800000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(3000000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(3300000, 0, 10, 10000), }; -static const unsigned int vefuse_voltages[] = { - 1700000, 1800000, 1900000, +/* VUSB voltage selector not shown in datasheet */ +static const unsigned int vusb_selectors[] = { 3, 4 }; +static const struct linear_range vusb_ranges[] = { + REGULATOR_LINEAR_RANGE(3000000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(3100000, 0, 10, 10000), }; -static const unsigned int vmch_vemc_voltages[] = { - 2900000, 3000000, 3300000, +static const unsigned int vcamd_selectors[] = { 3, 4, 5, 6, 7, 9, 12 }; +static const struct linear_range vcamd_ranges[] = { + REGULATOR_LINEAR_RANGE(900000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(1000000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(1100000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(1200000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(1300000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(1500000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(1800000, 0, 10, 10000), }; -static const unsigned int vcama_voltages[] = { - 1800000, 2500000, 2700000, - 2800000, 2900000, 3000000, +static const unsigned int vefuse_selectors[] = { 11, 12, 13 }; +static const struct linear_range vefuse_ranges[] = { + REGULATOR_LINEAR_RANGE(1700000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(1800000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(1900000, 0, 10, 10000), }; -static const unsigned int vcn33_voltages[] = { - 3300000, 3400000, 3500000, +static const unsigned int vmch_vemc_selectors[] = { 2, 3, 5 }; +static const struct linear_range vmch_vemc_ranges[] = { + REGULATOR_LINEAR_RANGE(2900000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(3000000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(3300000, 0, 10, 10000), }; -static const unsigned int vmc_voltages[] = { - 1800000, 2900000, 3000000, 3300000, +static const unsigned int vcama_selectors[] = { 0, 7, 9, 10, 11, 12 }; +static const struct linear_range vcama_ranges[] = { + REGULATOR_LINEAR_RANGE(1800000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(2500000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(2700000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(2800000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(2900000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(3000000, 0, 10, 10000), }; -static const unsigned int vldo28_voltages[] = { - 2800000, 3000000, +static const unsigned int vcn33_selectors[] = { 1, 2, 3 }; +static const struct linear_range vcn33_ranges[] = { + REGULATOR_LINEAR_RANGE(3300000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(3400000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(3500000, 0, 10, 10000), }; -static const u32 vdram2_idx[] = { - 0, 12, +static const unsigned int vmc_selectors[] = { 4, 10, 11, 13 }; +static const struct linear_range vmc_ranges[] = { + REGULATOR_LINEAR_RANGE(1800000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(2900000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(3000000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(3300000, 0, 10, 10000), }; -static const u32 vsim_idx[] = { - 3, 4, 8, 11, 12, -}; - -static const u32 vibr_idx[] = { - 0, 1, 2, 4, 5, 9, 11, 13, -}; - -static const u32 vusb_idx[] = { - 3, 4, -}; - -static const u32 vcamd_idx[] = { - 3, 4, 5, 6, 7, 9, 12, -}; - -static const u32 vefuse_idx[] = { - 11, 12, 13, -}; - -static const u32 vmch_vemc_idx[] = { - 2, 3, 5, -}; - -static const u32 vcama_idx[] = { - 0, 7, 9, 10, 11, 12, -}; - -static const u32 vcn33_idx[] = { - 1, 2, 3, -}; - -static const u32 vmc_idx[] = { - 4, 10, 11, 13, -}; - -static const u32 vldo28_idx[] = { - 1, 3, +static const unsigned int vldo28_selectors[] = { 1, 3 }; +static const struct linear_range vldo28_ranges[] = { + REGULATOR_LINEAR_RANGE(2800000, 0, 10, 10000), + REGULATOR_LINEAR_RANGE(3000000, 0, 10, 10000), }; static unsigned int mt6358_map_mode(unsigned int mode) @@ -332,49 +330,6 @@ static unsigned int mt6358_map_mode(unsigned int mode) REGULATOR_MODE_NORMAL : REGULATOR_MODE_FAST; } -static int mt6358_set_voltage_sel(struct regulator_dev *rdev, - unsigned int selector) -{ - const struct mt6358_regulator_info *info = to_regulator_info(rdev->desc); - int idx, ret; - const u32 *pvol; - - pvol = info->index_table; - - idx = pvol[selector]; - idx <<= ffs(info->desc.vsel_mask) - 1; - ret = regmap_update_bits(rdev->regmap, info->desc.vsel_reg, - info->desc.vsel_mask, idx); - - return ret; -} - -static int mt6358_get_voltage_sel(struct regulator_dev *rdev) -{ - const struct mt6358_regulator_info *info = to_regulator_info(rdev->desc); - int idx, ret; - u32 selector; - const u32 *pvol; - - ret = regmap_read(rdev->regmap, info->desc.vsel_reg, &selector); - if (ret != 0) { - dev_info(&rdev->dev, - "Failed to get mt6358 %s vsel reg: %d\n", - info->desc.name, ret); - return ret; - } - - selector = (selector & info->desc.vsel_mask) >> - (ffs(info->desc.vsel_mask) - 1); - pvol = info->index_table; - for (idx = 0; idx < info->desc.n_voltages; idx++) { - if (pvol[idx] == selector) - return idx; - } - - return -EINVAL; -} - static int mt6358_get_buck_voltage_sel(struct regulator_dev *rdev) { const struct mt6358_regulator_info *info = to_regulator_info(rdev->desc); @@ -477,10 +432,10 @@ static const struct regulator_ops mt6358_volt_range_ops = { }; static const struct regulator_ops mt6358_volt_table_ops = { - .list_voltage = regulator_list_voltage_table, - .map_voltage = regulator_map_voltage_iterate, - .set_voltage_sel = mt6358_set_voltage_sel, - .get_voltage_sel = mt6358_get_voltage_sel, + .list_voltage = regulator_list_voltage_pickable_linear_range, + .map_voltage = regulator_map_voltage_pickable_linear_range, + .set_voltage_sel = regulator_set_voltage_sel_pickable_regmap, + .get_voltage_sel = regulator_get_voltage_sel_pickable_regmap, .set_voltage_time_sel = regulator_set_voltage_time_sel, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, @@ -540,34 +495,34 @@ static const struct mt6358_regulator_info mt6358_regulators[] = { MT6358_REG_FIXED("ldo_vrf18", VRF18, MT6358_LDO_VRF18_CON0, 0, 1800000), MT6358_REG_FIXED("ldo_vaud28", VAUD28, MT6358_LDO_VAUD28_CON0, 0, 2800000), - MT6358_LDO("ldo_vdram2", VDRAM2, vdram2_voltages, vdram2_idx, + MT6358_LDO("ldo_vdram2", VDRAM2, vdram2, MT6358_LDO_VDRAM2_CON0, 0, MT6358_LDO_VDRAM2_ELR0, 0xf), - MT6358_LDO("ldo_vsim1", VSIM1, vsim_voltages, vsim_idx, + MT6358_LDO("ldo_vsim1", VSIM1, vsim, MT6358_LDO_VSIM1_CON0, 0, MT6358_VSIM1_ANA_CON0, 0xf00), - MT6358_LDO("ldo_vibr", VIBR, vibr_voltages, vibr_idx, + MT6358_LDO("ldo_vibr", VIBR, vibr, MT6358_LDO_VIBR_CON0, 0, MT6358_VIBR_ANA_CON0, 0xf00), - MT6358_LDO("ldo_vusb", VUSB, vusb_voltages, vusb_idx, + MT6358_LDO("ldo_vusb", VUSB, vusb, MT6358_LDO_VUSB_CON0_0, 0, MT6358_VUSB_ANA_CON0, 0x700), - MT6358_LDO("ldo_vcamd", VCAMD, vcamd_voltages, vcamd_idx, + MT6358_LDO("ldo_vcamd", VCAMD, vcamd, MT6358_LDO_VCAMD_CON0, 0, MT6358_VCAMD_ANA_CON0, 0xf00), - MT6358_LDO("ldo_vefuse", VEFUSE, vefuse_voltages, vefuse_idx, + MT6358_LDO("ldo_vefuse", VEFUSE, vefuse, MT6358_LDO_VEFUSE_CON0, 0, MT6358_VEFUSE_ANA_CON0, 0xf00), - MT6358_LDO("ldo_vmch", VMCH, vmch_vemc_voltages, vmch_vemc_idx, + MT6358_LDO("ldo_vmch", VMCH, vmch_vemc, MT6358_LDO_VMCH_CON0, 0, MT6358_VMCH_ANA_CON0, 0x700), - MT6358_LDO("ldo_vcama1", VCAMA1, vcama_voltages, vcama_idx, + MT6358_LDO("ldo_vcama1", VCAMA1, vcama, MT6358_LDO_VCAMA1_CON0, 0, MT6358_VCAMA1_ANA_CON0, 0xf00), - MT6358_LDO("ldo_vemc", VEMC, vmch_vemc_voltages, vmch_vemc_idx, + MT6358_LDO("ldo_vemc", VEMC, vmch_vemc, MT6358_LDO_VEMC_CON0, 0, MT6358_VEMC_ANA_CON0, 0x700), - MT6358_LDO("ldo_vcn33", VCN33, vcn33_voltages, vcn33_idx, + MT6358_LDO("ldo_vcn33", VCN33, vcn33, MT6358_LDO_VCN33_CON0_0, 0, MT6358_VCN33_ANA_CON0, 0x300), - MT6358_LDO("ldo_vcama2", VCAMA2, vcama_voltages, vcama_idx, + MT6358_LDO("ldo_vcama2", VCAMA2, vcama, MT6358_LDO_VCAMA2_CON0, 0, MT6358_VCAMA2_ANA_CON0, 0xf00), - MT6358_LDO("ldo_vmc", VMC, vmc_voltages, vmc_idx, + MT6358_LDO("ldo_vmc", VMC, vmc, MT6358_LDO_VMC_CON0, 0, MT6358_VMC_ANA_CON0, 0xf00), - MT6358_LDO("ldo_vldo28", VLDO28, vldo28_voltages, vldo28_idx, + MT6358_LDO("ldo_vldo28", VLDO28, vldo28, MT6358_LDO_VLDO28_CON0_0, 0, MT6358_VLDO28_ANA_CON0, 0x300), - MT6358_LDO("ldo_vsim2", VSIM2, vsim_voltages, vsim_idx, + MT6358_LDO("ldo_vsim2", VSIM2, vsim, MT6358_LDO_VSIM2_CON0, 0, MT6358_VSIM2_ANA_CON0, 0xf00), MT6358_LDO1("ldo_vsram_proc11", VSRAM_PROC11, 500000, 1293750, 6250, MT6358_LDO_VSRAM_PROC11_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON0, 0x7f), @@ -616,25 +571,25 @@ static const struct mt6358_regulator_info mt6366_regulators[] = { MT6366_REG_FIXED("ldo_vrf18", VRF18, MT6358_LDO_VRF18_CON0, 0, 1800000), MT6366_REG_FIXED("ldo_vaud28", VAUD28, MT6358_LDO_VAUD28_CON0, 0, 2800000), - MT6366_LDO("ldo_vdram2", VDRAM2, vdram2_voltages, vdram2_idx, + MT6366_LDO("ldo_vdram2", VDRAM2, vdram2, MT6358_LDO_VDRAM2_CON0, 0, MT6358_LDO_VDRAM2_ELR0, 0x10), - MT6366_LDO("ldo_vsim1", VSIM1, vsim_voltages, vsim_idx, + MT6366_LDO("ldo_vsim1", VSIM1, vsim, MT6358_LDO_VSIM1_CON0, 0, MT6358_VSIM1_ANA_CON0, 0xf00), - MT6366_LDO("ldo_vibr", VIBR, vibr_voltages, vibr_idx, + MT6366_LDO("ldo_vibr", VIBR, vibr, MT6358_LDO_VIBR_CON0, 0, MT6358_VIBR_ANA_CON0, 0xf00), - MT6366_LDO("ldo_vusb", VUSB, vusb_voltages, vusb_idx, + MT6366_LDO("ldo_vusb", VUSB, vusb, MT6358_LDO_VUSB_CON0_0, 0, MT6358_VUSB_ANA_CON0, 0x700), - MT6366_LDO("ldo_vefuse", VEFUSE, vefuse_voltages, vefuse_idx, + MT6366_LDO("ldo_vefuse", VEFUSE, vefuse, MT6358_LDO_VEFUSE_CON0, 0, MT6358_VEFUSE_ANA_CON0, 0xf00), - MT6366_LDO("ldo_vmch", VMCH, vmch_vemc_voltages, vmch_vemc_idx, + MT6366_LDO("ldo_vmch", VMCH, vmch_vemc, MT6358_LDO_VMCH_CON0, 0, MT6358_VMCH_ANA_CON0, 0x700), - MT6366_LDO("ldo_vemc", VEMC, vmch_vemc_voltages, vmch_vemc_idx, + MT6366_LDO("ldo_vemc", VEMC, vmch_vemc, MT6358_LDO_VEMC_CON0, 0, MT6358_VEMC_ANA_CON0, 0x700), - MT6366_LDO("ldo_vcn33", VCN33, vcn33_voltages, vcn33_idx, + MT6366_LDO("ldo_vcn33", VCN33, vcn33, MT6358_LDO_VCN33_CON0_0, 0, MT6358_VCN33_ANA_CON0, 0x300), - MT6366_LDO("ldo_vmc", VMC, vmc_voltages, vmc_idx, + MT6366_LDO("ldo_vmc", VMC, vmc, MT6358_LDO_VMC_CON0, 0, MT6358_VMC_ANA_CON0, 0xf00), - MT6366_LDO("ldo_vsim2", VSIM2, vsim_voltages, vsim_idx, + MT6366_LDO("ldo_vsim2", VSIM2, vsim, MT6358_LDO_VSIM2_CON0, 0, MT6358_VSIM2_ANA_CON0, 0xf00), MT6366_LDO1("ldo_vsram_proc11", VSRAM_PROC11, 500000, 1293750, 6250, MT6358_LDO_VSRAM_PROC11_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON0, 0x7f),