From patchwork Fri Jul 21 08:28:53 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: 123667 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp63955vqg; Fri, 21 Jul 2023 01:55:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlG5UTAGoXEE/t582Vmq+WpioNE1S2pMwIDyIC3wvhoSg0Su87EwTHq5x9LhK3jnSoLR6eaA X-Received: by 2002:a05:6358:6f1d:b0:134:e603:116e with SMTP id r29-20020a0563586f1d00b00134e603116emr962677rwn.6.1689929759090; Fri, 21 Jul 2023 01:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689929759; cv=none; d=google.com; s=arc-20160816; b=fN7rncnLvdaAtqlEd1qSSn2sVaelIpuHIC92qniHiRdlsasota9s1Ar9vwjjOXcFcF +/GCWYCqCCHwcOo5wNvmAfyfOv4bO8p9MhnF/WgsQFVAdqHnuEiELmDv1gQV7hemftDU JobYdMCSpXc6KTpJDF5wb5HbQDt+Sw82acWL8XKL40DgAHKPJwIPmDdRACxfMF0j/mAn 3B3K4H+pue/gfxQpzeeAVEjsakv6Dtm0YNQrjOz3XJ94B6387Rr4K8HCyaqHRiDgsynA brjdEfbkvfOdex9DQ4Ko/dSyecw3TZa775KxLh6ygrgpjIED26CQhIrd2imojFXUwh8N NwyQ== 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=NqcAnVxpvMo7IksBTYj7fHRMjHClyEVoFOPZWnp2zrc=; fh=SfnTO7GpW3zzB964eh5mthfKZWMy4oqbu80hrCJiJEw=; b=IgKLpFm3vuiluyQ+xsxq0qhn7AsmTiMph55fNQ6AnDuTchG17JE3kXzXan0hAgffMq GSPwG2Kx8j0N2phCNc4VNb80HDrh3hmiG1Jt2R0BhKg3aH1eWSQ4X81qB8Q+4RMx+itQ OVwOeR2RUrCOYAVsSv+LXd2BgxDHVsFdreVI+Q3MwetR5vtLU3Ocos+0Tu1xGT0N3EFG l8rp7FSU8YOF2uwiCkCUafUXs5Pc2GrFZVnV9aW+ZDJQDfVs0jt2TA2pWGtscvfHlTZX 4R/XIaBFJHRrNr+Uc4T5fV+KN/8aHx9QScxvf2UtbS3ibCB93dmq3SFy/8AQ/YtNrglE QS4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hF1OzzEu; 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 l19-20020a639853000000b0055aeedd94d3si2404895pgo.58.2023.07.21.01.55.43; Fri, 21 Jul 2023 01:55:59 -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=hF1OzzEu; 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 S231463AbjGUI3l (ORCPT + 99 others); Fri, 21 Jul 2023 04:29:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229668AbjGUI3j (ORCPT ); Fri, 21 Jul 2023 04:29:39 -0400 Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAEF22D54 for ; Fri, 21 Jul 2023 01:29:30 -0700 (PDT) Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-3460815fde5so8317465ab.2 for ; Fri, 21 Jul 2023 01:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689928170; x=1690532970; 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=NqcAnVxpvMo7IksBTYj7fHRMjHClyEVoFOPZWnp2zrc=; b=hF1OzzEufhEDtjc1xGiWd3Q09tWgNep/QKfIBNhgJHpTTbdq2kKmoY/mkJdducvuFx e09+2Wsf9hGM4/njO7eO5dATDrHIhU95LkRhtbffp/ztBgDXWaotwYu8GK7AmSFgSlKv kPbrYmWW9/r+bMdm5GbJyIDwY2rym7M9bdP3Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689928170; x=1690532970; 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=NqcAnVxpvMo7IksBTYj7fHRMjHClyEVoFOPZWnp2zrc=; b=lgRaBbONlQX+r0J9foX8T7CWWmly6rFAaWVqQzP5sMQHIc8twXle5x+IfkzpVYbyuq 2StNkbK1bMkAmzcpyJI42ht3S6eF7GoBYWNxwucdmcjW7py2B756AIB9hnmEPjeYS3hu xbDDqe7QCfys9gieAuf25U9Hd0LDUpmPjvlEeZZabv8O5HyeI7Op7bpVxAdtRZKpJIuc pzpaIXiIQqJsPqTS25hyV3RCLL0jUXjIRuJpiPTNy7S4Co3NtUJLuulK+nUzJywO6KbN 4QWVuT7vj2j/6sh7y187v0lqud6ygW019UTv0dZM47UKQzM/5tDH/dZ468TSyrOwtfUi WCPg== X-Gm-Message-State: ABy/qLbpJmrd8k7BgYI0YpI9Ds2C2HrT7NTMJ6/5U8a2Es4rKZ26GJ+B gW0chI+PztONammpI8qdGfBKKw== X-Received: by 2002:a05:6e02:164e:b0:345:d0c1:12b5 with SMTP id v14-20020a056e02164e00b00345d0c112b5mr1535037ilu.26.1689928170285; Fri, 21 Jul 2023 01:29:30 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6d86:d21:714:abab]) by smtp.gmail.com with ESMTPSA id d26-20020a63991a000000b0055fe64fd3f4sm2594382pge.9.2023.07.21.01.29.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 01:29:29 -0700 (PDT) From: Chen-Yu Tsai To: Lee Jones , 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 RESEND v2 1/7] mfd: mt6358: Add missing registers for LDO voltage calibration Date: Fri, 21 Jul 2023 16:28:53 +0800 Message-ID: <20230721082903.2038975-2-wenst@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230721082903.2038975-1-wenst@chromium.org> References: <20230721082903.2038975-1-wenst@chromium.org> MIME-Version: 1.0 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_BLOCKED,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772019787082348745 X-GMAIL-MSGID: 1772019787082348745 Most of the LDOs, except the "VSRAM_*" ones, on the MT6358 and MT6366 PMICs support a finer output voltage calibration within the range of +0 mV to +100 mV with 10 mV step. Some of the registers for this function are missing from the register table. Add the missing ones for MT6358. Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno --- include/linux/mfd/mt6358/registers.h | 6 ++++++ 1 file changed, 6 insertions(+) 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 Fri Jul 21 08:28:54 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: 123712 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp91966vqg; Fri, 21 Jul 2023 03:00:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlFPPncGgE5cy6uNFm64HIGcTfBzq9gZ3wsN/SWWiaMcyqpk9zXDyWbIIMdENg7R2deNMurH X-Received: by 2002:a17:907:778b:b0:993:f497:adbe with SMTP id ky11-20020a170907778b00b00993f497adbemr1297204ejc.19.1689933603397; Fri, 21 Jul 2023 03:00:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689933603; cv=none; d=google.com; s=arc-20160816; b=H0uWic2kNmZ3hiDWqssYmPxkVhTO7/eb3LsRNQwLymxQayODppwvr81uJ2NcEeQuuY YTOoJZkBlQgiTdfyuuWV30F7YohmfFk8sUd5ZRv3RQcg4PTtUCMEsn+jT+7jOXwD8ltz QLxUg1Fl9axDQBV56Vqma/Z5KlikeUik0WsZxA3+sL/kw72OSP6X79GpdxhWKsLayZv9 TcQnUNa5YWGDiYTOYUUV/oz2SjSH5pkglFKqJPM+SUzP7kBdybo5anz0vgznsChiOV5n BM+ZzRi1nrGXoxegOUtga/01UKovR2qZlHPntJ/lnCcJoDmfJ7TjnvaXwFVlF+hlfWZZ nDzA== 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=VIWYt/VUR+LWe3Ym6ggQYemB73LQMpv4Ia87+08eNu8=; fh=SfnTO7GpW3zzB964eh5mthfKZWMy4oqbu80hrCJiJEw=; b=V52VKr3qGhWOY02o5B4Cl7UP44epFr6FVOWkY253XvVRGoP9UolilIAzZtKyNhVpfZ QVtVfUz6+IDkJyvzhg0e3Ogo0Uk+CVr7IAIvIfajCvfzVfQrEDXh1SYVl7539Y4oXCoK ODF2v2hHsopTFs4UzPJP4T3Ck32LARvLzQNrcvtoe5RRJFBIxBpCDQQpD+HH844XNGPY A8AwiwKfnGTCJpBGg9r6ya57QG/po8aE/6GVSYJWWxS0TLYbq5yTce0oUTSVnw7CCzAY K7o2WH4k6feOhqHD2vkxwMb8rC9MnwN1WARY76IkqnuwahfOnTpa/xQZ9V5bi0yj5kZs pjXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=U8tbOuYs; 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 o18-20020a17090608d200b00977e0bdac8asi2022274eje.583.2023.07.21.02.59.39; Fri, 21 Jul 2023 03:00:03 -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=U8tbOuYs; 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 S229652AbjGUI3q (ORCPT + 99 others); Fri, 21 Jul 2023 04:29:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230136AbjGUI3k (ORCPT ); Fri, 21 Jul 2023 04:29:40 -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 40B3B2D5E for ; Fri, 21 Jul 2023 01:29:33 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-668730696a4so1130543b3a.1 for ; Fri, 21 Jul 2023 01:29:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689928173; x=1690532973; 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=VIWYt/VUR+LWe3Ym6ggQYemB73LQMpv4Ia87+08eNu8=; b=U8tbOuYsv2qAdDwgZoO+iz47dgCAAuQtft3iB/+2w3aUBrW2BKSDOKRq6XwNvVmZjn kcG5jy0Jg7hOzt1t0O6ye8LfAHv/h3rahLv+WIyqan+z6XMhf+TImBBS8QRmFUTw/EnU 5nfhMcw2R3snwZ7cBuwUgdC/XeRpSbJcm3Oag= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689928173; x=1690532973; 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=VIWYt/VUR+LWe3Ym6ggQYemB73LQMpv4Ia87+08eNu8=; b=HNiQSYYp0U8euefzkEDQjhCosB+HApBNyeg1MKQaTrIIBOTCmwdBaZTx0PKtKZKiie DOUx4EioAmkMd7HrjdLN1s2RjQeUKC3WYcMs6JunBy3YC34lyHtoyow4a1VchmzmwkA+ 1WVLighojUeQzX7a0EWJoNYtLr7zMhblUZU35UVZX0xMIlVg3xIPLwn66q2f7KTFaacH ZBfGaRp2ZTA6xq6wYQlMPz6G++klYAkPTqSPkGlg3FXGGaBwvv0wwwCtKBPS7fOJBCjC 012dDO3P9g64oJZY/kp2cM+xOb3IjP4GsllHuPJar+W1+o2iFaeTjmKn3UOitaRYZs5R /6ig== X-Gm-Message-State: ABy/qLanEybPiFTVtgplkWhUZ/8ayGhs/ptotH27VugPTiREYU5P1dDr Zh5iMjJwyrDgr9eaBgDLv4e/RQ== X-Received: by 2002:a05:6a00:2e18:b0:67a:f6f6:ccc6 with SMTP id fc24-20020a056a002e1800b0067af6f6ccc6mr1225758pfb.5.1689928172684; Fri, 21 Jul 2023 01:29:32 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6d86:d21:714:abab]) by smtp.gmail.com with ESMTPSA id d26-20020a63991a000000b0055fe64fd3f4sm2594382pge.9.2023.07.21.01.29.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 01:29:32 -0700 (PDT) From: Chen-Yu Tsai To: Lee Jones , 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 RESEND v2 2/7] regulator: mt6358: Sync VCN33_* enable status after checking ID Date: Fri, 21 Jul 2023 16:28:54 +0800 Message-ID: <20230721082903.2038975-3-wenst@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230721082903.2038975-1-wenst@chromium.org> References: <20230721082903.2038975-1-wenst@chromium.org> MIME-Version: 1.0 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_BLOCKED,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772020738915467777 X-GMAIL-MSGID: 1772023818260991132 Syncing VCN33_* enable status should be done after checking the PMIC's ID, to avoid setting random bits on other PMICs. Suggested-by: AngeloGioacchino Del Regno Fixes: 65bae54e08c1 ("regulator: mt6358: Merge VCN33_* regulators") Signed-off-by: Chen-Yu Tsai --- drivers/regulator/mt6358-regulator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c index 31a16fb28ecd..da6b40f947c4 100644 --- a/drivers/regulator/mt6358-regulator.c +++ b/drivers/regulator/mt6358-regulator.c @@ -676,10 +676,6 @@ static int mt6358_regulator_probe(struct platform_device *pdev) const struct mt6358_regulator_info *mt6358_info; int i, max_regulator, ret; - ret = mt6358_sync_vcn33_setting(&pdev->dev); - if (ret) - return ret; - if (mt6397->chip_id == MT6366_CHIP_ID) { max_regulator = MT6366_MAX_REGULATOR; mt6358_info = mt6366_regulators; @@ -688,6 +684,10 @@ static int mt6358_regulator_probe(struct platform_device *pdev) mt6358_info = mt6358_regulators; } + ret = mt6358_sync_vcn33_setting(&pdev->dev); + if (ret) + return ret; + for (i = 0; i < max_regulator; i++) { config.dev = &pdev->dev; config.regmap = mt6397->regmap; From patchwork Fri Jul 21 08:28:55 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: 123695 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp83809vqg; Fri, 21 Jul 2023 02:39:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlHUFLebjhMv/9PqH4VH4Nw08dgHwKZViO7c5eF7RnxV04aLM8cnyr5eeFszi5naO9v2026T X-Received: by 2002:a17:906:15b:b0:993:e9b8:90f4 with SMTP id 27-20020a170906015b00b00993e9b890f4mr1471941ejh.8.1689932370855; Fri, 21 Jul 2023 02:39:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689932370; cv=none; d=google.com; s=arc-20160816; b=tyZLMNY5ydDfEkgGYCxb04723FqwIgD5ev8HqIu7pqE+4jqVRapW99+kUAqVFzuWUP xlkjhEYx7YggQ3hevQvztE5eXXmDHb73uT4YZX1+0FzQkAcMBaAU/KXrGC6144Q/tVtQ o1ZwQHWcdHXqkTZ0f3biZfqebcX/K7fa316yULr+4QJrrNtM/bNQCMf8D1VWJsjC0b5c 6pOKSEs9KoL5Ccdne56IzueEL4Cnk3GyK41QzovTeLO+pcuMQgH4uqyAuOyZu1nXJbUA v1rFBX6g8lfMeCVGWcyk27tAiLXJ/j6Un1MdsOrtqThBDi2ncBtjLQZjILM5XKMP5gyp 40oA== 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=mjm1htpsgUdaRZcHsGo757GH1rkymaOgiUPQg9DWT7s=; fh=quagAReso5GuCO7sZPUeG8SoXywK0zWhBeT+ZK0yn6U=; b=yyAO5DO2/Ri8ffBPlf3IOINErMQL9K329SQyKKFGFpVcg6by4B8+fDcO17hJRUy50G DhxhuWFsCdcC3cmVIMH2CF/i/36aQTFBL31G3XMUey14NJc5kdNaOjjf6e8X1fLwRBy2 c1slvFKNCbbEncqtI6kh5+mU0ZFumz5RsXsDygsESxGY7+hDRfgD3ZddGwkeOWhuFSLh pw/FaZnm8wtrKp06GsFY2OC73P/GnOU/aJHDo3ZOQnoDLvTf3/tMqWHODlE/i9xu8tw4 x117SzHbQklXa7lMJPVlNksRvuR/DJGlHolKonOIyW0ZbplnY/L28REHSTHBdaCK/BPa Acbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RW7GYa24; 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 h11-20020a17090634cb00b00988e62b24ecsi1777529ejb.760.2023.07.21.02.39.04; Fri, 21 Jul 2023 02:39:30 -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=RW7GYa24; 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 S231551AbjGUI3u (ORCPT + 99 others); Fri, 21 Jul 2023 04:29:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229593AbjGUI3k (ORCPT ); Fri, 21 Jul 2023 04:29:40 -0400 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5FDA2D76 for ; Fri, 21 Jul 2023 01:29:35 -0700 (PDT) Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3a43cbb4343so1034448b6e.1 for ; Fri, 21 Jul 2023 01:29:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689928175; x=1690532975; 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=mjm1htpsgUdaRZcHsGo757GH1rkymaOgiUPQg9DWT7s=; b=RW7GYa24SF9OUtc1EwYBobJChC2NGH/9ryiaix+d6Lb7prlVSNmtW31odoBZ6MdhLH xGf7HcgZhS4CC2qc338kcpffmjLxhCqX7S0PN2nGX253i2MbmLXJM2aQLiaav5rxRzXS lkoLYnuPiwJNtT85A02CwFnryI1ZJ+Pyk2yuo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689928175; x=1690532975; 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=mjm1htpsgUdaRZcHsGo757GH1rkymaOgiUPQg9DWT7s=; b=Yl5O/oE1NQjWhxNizOjJtbGcVHUhpammyJK3Bqn3zLrdqiC43/HfKrTeV45t6EDkGC kIiZ+YR/EeiYSDtgzS6+EXWPBFZYUWh1ZswMNnlSoAxt9qCMZVDWOBNqe8m2h8Tvg6yi OLZ3y3Fruq3ndIexcCP4UtaqAtmE+kjfK0Zvd6gtSZL1EhWCLX9GcWjQ0u+Djply4MuH gOaZv+9QDIMKYviY0acGVSaP0Ed0puJ6qQqIv5YHysDayA9zrz6GdaeAXmUtFB0i3lif 1oLBvIEREBbG4M/WKvPbyZ0SBT8KED26Xydy9Evx3bwM88reLoI8ldfjj+Zn8JA3Mftz hKuQ== X-Gm-Message-State: ABy/qLbInhVs0micYdMGXb0MRM80NxPKJVVey0/p0MOIgWdagvUSFlI1 niuFCJX7BZ1tBF5TjSURhFMuCw== X-Received: by 2002:a05:6808:280b:b0:3a4:350e:b213 with SMTP id et11-20020a056808280b00b003a4350eb213mr1139687oib.27.1689928175257; Fri, 21 Jul 2023 01:29:35 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6d86:d21:714:abab]) by smtp.gmail.com with ESMTPSA id d26-20020a63991a000000b0055fe64fd3f4sm2594382pge.9.2023.07.21.01.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 01:29:34 -0700 (PDT) From: Chen-Yu Tsai To: Lee Jones , 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, Fei Shao Subject: [PATCH RESEND v2 3/7] regulator: mt6358: Fix incorrect VCN33 sync error message Date: Fri, 21 Jul 2023 16:28:55 +0800 Message-ID: <20230721082903.2038975-4-wenst@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230721082903.2038975-1-wenst@chromium.org> References: <20230721082903.2038975-1-wenst@chromium.org> MIME-Version: 1.0 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_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772022525272512380 X-GMAIL-MSGID: 1772022525272512380 After syncing the enable status of VCN33_WIFI to VCN33_BT, the driver will disable VCN33_WIFI. If it fails it will error out with a message. However the error message incorrectly refers to VCN33_BT. Fix the error message so that it correctly refers to VCN33_WIFI. Suggested-by: Fei Shao Fixes: 65bae54e08c1 ("regulator: mt6358: Merge VCN33_* regulators") Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno --- drivers/regulator/mt6358-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c index da6b40f947c4..b9cda2210c33 100644 --- a/drivers/regulator/mt6358-regulator.c +++ b/drivers/regulator/mt6358-regulator.c @@ -661,7 +661,7 @@ static int mt6358_sync_vcn33_setting(struct device *dev) /* Disable VCN33_WIFI */ ret = regmap_update_bits(mt6397->regmap, MT6358_LDO_VCN33_CON0_1, BIT(0), 0); if (ret) { - dev_err(dev, "Failed to disable VCN33_BT\n"); + dev_err(dev, "Failed to disable VCN33_WIFI\n"); return ret; } From patchwork Fri Jul 21 08:28:56 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: 123698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp84686vqg; Fri, 21 Jul 2023 02:41:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlEBHcUByepKEViJEAnZU0G+X0ossMTM4Ong4kLiZ4uwjCbYpfWl0qS5BN0x8nnW6IcGFX9C X-Received: by 2002:a17:907:78d9:b0:99b:4e70:d09b with SMTP id kv25-20020a17090778d900b0099b4e70d09bmr1159989ejc.46.1689932499930; Fri, 21 Jul 2023 02:41:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689932499; cv=none; d=google.com; s=arc-20160816; b=gbyA+xJYJVwChF44RPPPlgCPOPL6H5Rv4DTeTnF8OfRGZqgzCDe1PSy8sAEGFyGXAh 8J7Qv/2DBf8I/qL++nb2vrGUq152kh9lJR4LwEliduXhLKYZSSPCK6/zxudd/DHAZhJm 5fQkFfMFXIVEdIRtvYIZIhqGYVzlq/HXsOADeIvD4QZ+5gesda1BqYXROv89GGGWoeVW NU797YoUpgFaTOhX9fmowLWy2gfuzZdRVM/U2wklugFVQBvUJWqtBpoM3yRIvGT0mfBP r3QzfJ2sXownPaNDjonB5xIXxWEOQrA8ARhO5L/zgDXNOSGip3eg++3MxbNMBESpqCdf qBag== 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=ys0r8p0mIPfGi9bl8X8cEqDLnuWcCtUcJ0oWQjuIrRg=; fh=SfnTO7GpW3zzB964eh5mthfKZWMy4oqbu80hrCJiJEw=; b=HuQ2Jg7cHbXnXC06c1EHURRk+2iNFOsJ+HqnIWRK3w8r30l8uaTGKcRLHJlooJRyt6 FbzDR/8Bi4hGmo9PH1MXWWC3/1P/n5O3FX14F3+nMBqQz8JpGiAlY6i3k0s9nXQi7rqY cWwXSFq/NtW/9OICAwStJASESua3vg+Q01EV4K3CS9kZ4nChmrvKHkWxy4Ivn++mGpMz hxHusMLMtwQ+iACBg+3qlh3NFL8v7GDLBufgZ0mz3VV2/CXntVdYjKv25snCWxoBYYXH QJu/gQ9z2/wEyyUTqh5g21QefqK2G+hzjXz5Ok47/MUNFaLxDioZEu3hyU1LHzXOgzOs oLxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=J652JuDY; 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 v20-20020a170906565400b00992bdcb72desi1876526ejr.191.2023.07.21.02.41.15; Fri, 21 Jul 2023 02:41:39 -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=J652JuDY; 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 S231574AbjGUI3z (ORCPT + 99 others); Fri, 21 Jul 2023 04:29:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231530AbjGUI3l (ORCPT ); Fri, 21 Jul 2023 04:29:41 -0400 Received: from mail-oo1-xc2c.google.com (mail-oo1-xc2c.google.com [IPv6:2607:f8b0:4864:20::c2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D054273C for ; Fri, 21 Jul 2023 01:29:38 -0700 (PDT) Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-563439ea4a2so1076785eaf.0 for ; Fri, 21 Jul 2023 01:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689928178; x=1690532978; 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=ys0r8p0mIPfGi9bl8X8cEqDLnuWcCtUcJ0oWQjuIrRg=; b=J652JuDYAUtc/gckkv+10/iqRTK8vq4DdfVxBL10Azkhg6LCGGDB2uj/ANrRKkQrzL oy4UiFu28vAWj08W733djKdD6OJF2mBh8P1kPIR2sgnFzCeqE/PU4Y5AxdV4bJMUjEVP KAO+43rtUglLxW1awsbDFwicekL2Rfoh8c+10= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689928178; x=1690532978; 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=ys0r8p0mIPfGi9bl8X8cEqDLnuWcCtUcJ0oWQjuIrRg=; b=lABbo9mh2tl3xEidytpWLrBQ/dm1UODkuWDu8VFRt2qH456zhp1jlnCsmItQ+Km61l CtFxi0O9V7kRA5PFKvmyiD5CUM3ApFSP1izsldyELBUCzi02f1DYJ4RLekdDA9utmE2+ qhLH1+pLss+WR8IFKHfHn4af9ByC4an0NLnBro634yKp1wfGdylh8Yp/qwP2oWe34U0N +uKNTnDZ/Joq67rMwapKwTLaCe80t/0zKqUMqrVmCUaFQo1XaDbqh17jM+LdZrcRJEuw OayY9S7poHXVCT4Mm+i9qPf22rsnAYE4m9IRei9jiBsxJh46uoAeh6KRymyL8MMYligf cibw== X-Gm-Message-State: ABy/qLbyknlcblw2q36zJ5PiBGhkjhJpKAo5zCXv7JSE3ktbFnXYlueB 3U8r/Bzb9WctENk5YOzX/+/0+Q== X-Received: by 2002:a05:6358:27a8:b0:135:6d9:2399 with SMTP id l40-20020a05635827a800b0013506d92399mr1442813rwb.30.1689928177700; Fri, 21 Jul 2023 01:29:37 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6d86:d21:714:abab]) by smtp.gmail.com with ESMTPSA id d26-20020a63991a000000b0055fe64fd3f4sm2594382pge.9.2023.07.21.01.29.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 01:29:37 -0700 (PDT) From: Chen-Yu Tsai To: Lee Jones , 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 RESEND v2 4/7] regulator: mt6358: Fail probe on unknown chip ID Date: Fri, 21 Jul 2023 16:28:56 +0800 Message-ID: <20230721082903.2038975-5-wenst@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230721082903.2038975-1-wenst@chromium.org> References: <20230721082903.2038975-1-wenst@chromium.org> MIME-Version: 1.0 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_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772021946855131459 X-GMAIL-MSGID: 1772022660810487244 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 --- 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 b9cda2210c33..a1eae45f5fee 100644 --- a/drivers/regulator/mt6358-regulator.c +++ b/drivers/regulator/mt6358-regulator.c @@ -676,12 +676,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 Fri Jul 21 08:28:57 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: 123701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp84941vqg; Fri, 21 Jul 2023 02:42:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlHwoI9aLiM8LjjheKbo0ocHWYw623MRMTanSLlxoSnlvPKfzHn38eKKPcXuCVBGeF5qjHHf X-Received: by 2002:a17:906:32d2:b0:99b:49a6:952d with SMTP id k18-20020a17090632d200b0099b49a6952dmr1257763ejk.65.1689932539395; Fri, 21 Jul 2023 02:42:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689932539; cv=none; d=google.com; s=arc-20160816; b=TbmC4m9w+S4pJK9y5i+3QSlrWbp2zz3NcYChusDFMGiJN2mdDOpYmHG8rTDiJV4zJX wobJFr/phSBLHAsq6VzXdLD+8QJe0nqBxgbFIvRqgZihiYoraM+YAULrz1OYWQYGuxGH ewWE53pMqE3hMF/Hl2ca2r/2E74uQI+nitjYmOr6704exYNsoMTMJnnaLKdgwmlHDOY0 GHnZ2cUJQ42TbLwtFLsVhwECCp4rTrS7cg4C/Ffkp7q/EkQqHEDwi+rS2xowRy0loOeo 4+c2EZYqcO8vfBOxTrEFCkeH6mD+DPU4f5RRPD0eFqcr5XYrkrdVeKxl5VhB3yNw9hyv SfWA== 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=oBEBajXPeANrxdpiP5Fykz/Cq1TcahWs+MuTM0uJsmg=; fh=SfnTO7GpW3zzB964eh5mthfKZWMy4oqbu80hrCJiJEw=; b=BGz9M5meR3nxzvKcuHuK6d3YjPWOMsDXh5x9qUSHR/v0VEMsDlwO2w5DpQtPgWXL4R u0gfmmLiDw3TctdTUQ/TII8fy0MffM+bGeCc9jFvHBI+yTaEODfPdd63jwebpCdeZw8D h5MuDFhwz8XUMpxwCNRy5YEOqK3E5R7T53L5Hsip4YNIUyW8/9j9hqOELniWgeaH0juP 9zHiP2tTyR5l1UL63M9pk6aq5za35/rjN8mmuH8nU8OdAyZwFK/Pt27WBwPlPCqDfyhu EctU9mRfiNbd5kccb8HKKSNy0QucVVcFOQw3XUF27PbHjWl5VrT/lSVGHvT5GvssLPk7 3snQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="J/Zn4wpP"; 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 kk22-20020a170907767600b0098e1bbc2cffsi1998856ejc.958.2023.07.21.02.41.55; Fri, 21 Jul 2023 02:42:19 -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="J/Zn4wpP"; 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 S229593AbjGUIaB (ORCPT + 99 others); Fri, 21 Jul 2023 04:30:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231542AbjGUI3m (ORCPT ); Fri, 21 Jul 2023 04:29:42 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2CCF272E for ; Fri, 21 Jul 2023 01:29:40 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6682909acadso1119434b3a.3 for ; Fri, 21 Jul 2023 01:29:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689928180; x=1690532980; 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=oBEBajXPeANrxdpiP5Fykz/Cq1TcahWs+MuTM0uJsmg=; b=J/Zn4wpP5VNVOXfKPjNJkboqjmqL/vgKtUn1Rqo40UtHQXp/5DPvJfJQvJWKuaVLGO nIpiJD0itnC2zu+V1pMCfFCMJ/MTotClIBDurcZK571aT9CCR2zsKksO4eZp+GUZbO3e 4DmP3rBKaDaNyMT99ZXxzdrxHMEVTPe26OtPk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689928180; x=1690532980; 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=oBEBajXPeANrxdpiP5Fykz/Cq1TcahWs+MuTM0uJsmg=; b=MHZ89BDih4Bhe9+XvR+/ZqmZJPKPf0q9xdMItzVLrMNkqLtiUvyLuj4gC3IXmj7Y5z joMcZ5nF7kKWBHTucdY7RBRld2zgodioCGwFqPu6GnZS+5DspP5bIQQkS9/fTqSmFasY pPGa/fuMur7vb1K0+QLNyhCOxnPYu5eb34cslbtw7eod5cXjfZ3iipJMUSq482CHnUXP P+fSchFzxCDpR2IWHuuT+Ywv8cwG1bgIrMNqPg48Lm9xFUufycKi1qUjA10Hl/LMsGgb AefYSGQTU23k8eE+argnEhxpDpgvsqAK6KMP3Y8qTsJPPJqIajF2QS99s4wnSDwmXr0X xANw== X-Gm-Message-State: ABy/qLbUWCsj8beP5C/+RH1XMNlKgWGl/tD1woU66R9XCBaZuKKbLLsn OUHqCLIA2V+cvGB92xWrXUT53BRUJGzuQFNhOQ4= X-Received: by 2002:a05:6a20:b709:b0:132:d2c4:9cb9 with SMTP id fg9-20020a056a20b70900b00132d2c49cb9mr972256pzb.29.1689928180182; Fri, 21 Jul 2023 01:29:40 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6d86:d21:714:abab]) by smtp.gmail.com with ESMTPSA id d26-20020a63991a000000b0055fe64fd3f4sm2594382pge.9.2023.07.21.01.29.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 01:29:39 -0700 (PDT) From: Chen-Yu Tsai To: Lee Jones , 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 RESEND v2 5/7] regulator: mt6358: Add output voltage fine tuning to fixed regulators Date: Fri, 21 Jul 2023 16:28:57 +0800 Message-ID: <20230721082903.2038975-6-wenst@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230721082903.2038975-1-wenst@chromium.org> References: <20230721082903.2038975-1-wenst@chromium.org> MIME-Version: 1.0 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_BLOCKED,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772022702374845934 X-GMAIL-MSGID: 1772022702374845934 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/mt6358-regulator.c index a1eae45f5fee..b34ad85db771 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, From patchwork Fri Jul 21 08:28:58 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: 123664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp62963vqg; Fri, 21 Jul 2023 01:53:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlGpNMsXxiZLZrT7lqdPSITv4LZbRyXpLPUF5aWersOK1GeAgSkeZrARPEBX7GPGgUr0GS96 X-Received: by 2002:a17:906:224c:b0:993:e752:1a70 with SMTP id 12-20020a170906224c00b00993e7521a70mr1415657ejr.19.1689929612628; Fri, 21 Jul 2023 01:53:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689929612; cv=none; d=google.com; s=arc-20160816; b=Vw9wNOPRqRsKh+SnMkSHf24SJdddt08GlEcL4nDHW353nj6cxMiluHWyzfyVr8cnpj yN9ZknOQvMmUHpqTcfoy8zlg4JqRyB88s2431Zeb9bwjN8Gt+4k0wmYcaO3+MSOkhAd3 WK6XbqxgoAWZSFJsOQvVpr2osPreZdP4FM79pZqTs07KYUTEYwACeSGQ5m66jwoS5xmV GZTvNrvetbG3KVgQAsXX9nbjjylnCE2aPJUsiuVeBHy4uXnTG1QaAUXzL5dIyQt5hjF5 3eCkg7fXx+TrorzXTqL6VVI1w+bof6o31sJvOqEWYFgvUSJspuyeZ6Px6S5A7Up5M1/2 G7Qg== 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=E1lqX/d5l1l2tVWvkAbdr0J+8ANaAOV7zGUDFMNYihk=; fh=SfnTO7GpW3zzB964eh5mthfKZWMy4oqbu80hrCJiJEw=; b=ldD4TH5ZGHjJrkVt6H49vIIMbr5moOPiYj+qLmHjiH0hoiX2rkF7CM2BWe0ENiqWxm cgisetN+wRYEflmdx7iQsSFdC9MCyXDi6L0qqJTqsoy/11F251gc8Wcd5eAJTwnAJw7T X+GJ8U2R3PPVPVHuxfLxPefYzENC5aIrGpJiWKVLt4YXKhGBr+sWB84IVDBMy7iIf+MC +fg/cBqzpUT9LN70gUJTfkoGffO8tqXr2nV5+8znB/dH96X0JUwxyM9XIBXUkrcvGWKT HLC+znF4GzCoWX6eJUAIjCCGBVAmQ+fCAjJ9h8/xoSvKaVHUpn64/PvhvLUj6dRIVA5F U6OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="C/bFbSFS"; 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 l14-20020a1709065a8e00b00992acf935aesi1852593ejq.412.2023.07.21.01.53.06; Fri, 21 Jul 2023 01:53:32 -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="C/bFbSFS"; 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 S231572AbjGUIaG (ORCPT + 99 others); Fri, 21 Jul 2023 04:30:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231557AbjGUI3x (ORCPT ); Fri, 21 Jul 2023 04:29:53 -0400 Received: from mail-oo1-xc2f.google.com (mail-oo1-xc2f.google.com [IPv6:2607:f8b0:4864:20::c2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01DAF2D4C for ; Fri, 21 Jul 2023 01:29:43 -0700 (PDT) Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-56352146799so1127422eaf.3 for ; Fri, 21 Jul 2023 01:29:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689928183; x=1690532983; 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=E1lqX/d5l1l2tVWvkAbdr0J+8ANaAOV7zGUDFMNYihk=; b=C/bFbSFShhFvBbc/CRqnlO+0FV/aOcZRw7bwGRLB6qAJNM3q9GMj4DxvHMSELOQ3kx l/TlUg09XwZ/Es1XCS9zCAoeeaC9QHfav1Suok0cCqmmbBq+gAGo6K8VXLTXAAjh1ioH Dwrdi3zrv1oqBp03B03IlpAcFMFyK06dJtRb0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689928183; x=1690532983; 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=E1lqX/d5l1l2tVWvkAbdr0J+8ANaAOV7zGUDFMNYihk=; b=V6FCWfdQNdgamhKdpCNhe5Ut/stiC8+6De7jBzkcAHiOqAs5sHKhuZVi/mCxR1glX3 hhicDvpyLVZEhVJTrgz43L1GJN6QrPsavDpplu7PCpDcmh4bXip5oJLPiyVxFzCFi2sJ Q6EKjQ7gZRnojqKi5uj4u+phhxq9QsyeDxc9m2HI5khJhEqMMlrOwWEhtqkZN+grd1ar MBD4mVWgTzcv6Rga4vdUjiJAAUb3DF4ctxb+vDvRM7YryKgcRZuDEIFsDtc8XsHWS4VQ rlqKwEwNCeBB/SduKcQcRxA8nze9toRiUwAvW4ReYyEL7Tl0PJRjsBRbAOlOyaiqqSfL sLMg== X-Gm-Message-State: ABy/qLZJWT+3LzadRR91DtdTSjZdLkD8doU7XLDQpcf8i9LawyJpyTGs w8Z2PZDafaewAijGhz3Rf4m/xw== X-Received: by 2002:a05:6358:9322:b0:134:cb65:fbbe with SMTP id x34-20020a056358932200b00134cb65fbbemr1409087rwa.13.1689928182786; Fri, 21 Jul 2023 01:29:42 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6d86:d21:714:abab]) by smtp.gmail.com with ESMTPSA id d26-20020a63991a000000b0055fe64fd3f4sm2594382pge.9.2023.07.21.01.29.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 01:29:42 -0700 (PDT) From: Chen-Yu Tsai To: Lee Jones , 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 RESEND v2 6/7] regulator: mt6358: Add output voltage fine tuning to variable LDOs Date: Fri, 21 Jul 2023 16:28:58 +0800 Message-ID: <20230721082903.2038975-7-wenst@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230721082903.2038975-1-wenst@chromium.org> References: <20230721082903.2038975-1-wenst@chromium.org> MIME-Version: 1.0 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_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772019633161474889 X-GMAIL-MSGID: 1772019633161474889 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 --- 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 b34ad85db771..43cb837a6203 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, 11, 21, 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, 11, 21, 10000), + REGULATOR_LINEAR_RANGE(2700000, 22, 32, 10000), + REGULATOR_LINEAR_RANGE(3000000, 33, 43, 10000), + REGULATOR_LINEAR_RANGE(3100000, 44, 54, 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, 11, 21, 10000), + REGULATOR_LINEAR_RANGE(1500000, 22, 32, 10000), + REGULATOR_LINEAR_RANGE(1800000, 33, 43, 10000), + REGULATOR_LINEAR_RANGE(2000000, 44, 54, 10000), + REGULATOR_LINEAR_RANGE(2800000, 55, 65, 10000), + REGULATOR_LINEAR_RANGE(3000000, 66, 76, 10000), + REGULATOR_LINEAR_RANGE(3300000, 77, 87, 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, 11, 21, 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, 11, 21, 10000), + REGULATOR_LINEAR_RANGE(1100000, 22, 32, 10000), + REGULATOR_LINEAR_RANGE(1200000, 33, 43, 10000), + REGULATOR_LINEAR_RANGE(1300000, 44, 54, 10000), + REGULATOR_LINEAR_RANGE(1500000, 55, 65, 10000), + REGULATOR_LINEAR_RANGE(1800000, 66, 76, 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, 11, 21, 10000), + REGULATOR_LINEAR_RANGE(1900000, 22, 32, 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, 11, 21, 10000), + REGULATOR_LINEAR_RANGE(3300000, 22, 32, 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, 11, 21, 10000), + REGULATOR_LINEAR_RANGE(2700000, 22, 32, 10000), + REGULATOR_LINEAR_RANGE(2800000, 33, 43, 10000), + REGULATOR_LINEAR_RANGE(2900000, 44, 54, 10000), + REGULATOR_LINEAR_RANGE(3000000, 55, 65, 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, 11, 21, 10000), + REGULATOR_LINEAR_RANGE(3500000, 22, 32, 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, 11, 21, 10000), + REGULATOR_LINEAR_RANGE(3000000, 22, 32, 10000), + REGULATOR_LINEAR_RANGE(3300000, 33, 43, 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, 11, 21, 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); @@ -471,10 +426,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, @@ -534,34 +489,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), @@ -610,25 +565,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), From patchwork Fri Jul 21 08:28:59 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: 123691 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp81721vqg; Fri, 21 Jul 2023 02:34:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlEPzqzSm+f/By24OPHKuyoBmQR6tdXyCehBtO5FIMkPVGs3rGy2eG0Q4nU4UZDiF4IBtugH X-Received: by 2002:a17:907:7895:b0:99b:4bab:2838 with SMTP id ku21-20020a170907789500b0099b4bab2838mr1499691ejc.0.1689932059320; Fri, 21 Jul 2023 02:34:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689932059; cv=none; d=google.com; s=arc-20160816; b=pdozjDc7+PKC4DO/HeeScOA+ULGkGT5sosbImYpZsqsv8OOnGY3kG39wlc18lMmTIW CYRuF/RgV/q0gEVIjlj9HILXulhiMXDOElC93rm8BB8KjENaelZFScJGNBPKzpcTXOv2 oSTdHo6leXlHuH2H3QrKaaZkK/31HxnXs/1RYe4nkaxckcZrekCPBtFvyHQ7Ixbjlnvr Tv2eyCPCxFBlm1srraDtUZeT6nyPT6zefrQCQ08rQNnzdGYkBi7Zf1XFILsfeC+XMVX+ YlVPFCQrJ308WOrtrhgoKj/1CynOwDPfNpOtDATZ45z3kxCIBQx+xGHs8Lx0QttCKQEW RSTw== 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=BRGfxOjw0IcbmsCMV0/zHA7oWZTkNo2dmmtwCT8Vhjs=; fh=SfnTO7GpW3zzB964eh5mthfKZWMy4oqbu80hrCJiJEw=; b=oP0nNtRRO+3qG6AOOwiq4v8urxZsCFGtrKUjixiL2OlwvFxipKWZm4JwZ3LCnuWjrk lYASj/nHuJPTr0KvtavLGdFuQF/Kwp4RjX9aem/HVdcn5q89e1TjVDDGA+4nDafL858u D/Sc0cflvwl2V9yVNBg2qq47pyQYmxFhRPIox8qVqYEPykYiE+Vh1x45GfwzmJ/qitcR dnXzlfxPDOuaCofq5ysaLwGt+wkdjkOFuvYQOTr7PSMuvDW4rmWKKBvUbd26Ke5hS6Ae jF7lxxEynKHgIwmMZgcw3JqJNC0ogryBA1v8HWoBaipIYM3LtkNT8JcuWNuvMebW3tGs hKrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WJ4fIxCI; 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 q16-20020a1709064cd000b0099b42c9082bsi1768294ejt.508.2023.07.21.02.33.47; Fri, 21 Jul 2023 02:34:19 -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=WJ4fIxCI; 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 S231557AbjGUIaJ (ORCPT + 99 others); Fri, 21 Jul 2023 04:30:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231562AbjGUI3y (ORCPT ); Fri, 21 Jul 2023 04:29:54 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1EB72D5E for ; Fri, 21 Jul 2023 01:29:45 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-668704a5b5bso1502886b3a.0 for ; Fri, 21 Jul 2023 01:29:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689928185; x=1690532985; 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=BRGfxOjw0IcbmsCMV0/zHA7oWZTkNo2dmmtwCT8Vhjs=; b=WJ4fIxCIWwC/w03SXcaamhybV8KieQrq3hsGKL/F/+7w4K8NCozTrbzUfpfp0RODO6 GUQbX5KhU1Hb6n2eh9LjMA6geGDTaATIpyKkAJ72G9tgrb+CmefEgSN/SzZKK6Q4oV2s q1W2mQk46S42zFNJkJIMM0CJHiV+9UEsIWNVU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689928185; x=1690532985; 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=BRGfxOjw0IcbmsCMV0/zHA7oWZTkNo2dmmtwCT8Vhjs=; b=TInCgZD09Xwctu2ua3UeZ4NqV5iWW9Xet60o2OkbSpUx/VB2l+fGSyM1cROQLhEQle kTVwTntxf3EBKEim6797HqU8HQoGd53XYOODmEt2cMiTa/sUrjROWeMip4EyvSUJkJuG +aUDu2mS8hpCBdz0tyzqZzkJMQq3yJDkvlx1gpfYkbCjMEwRmV8KsiOmPhmJou/+zZZl z9PFhWG/mvwxyp+X7lECqvU4uiy9Fbbx944JL/LC4JXc1nl1cvmkhptbT91ThSwKi0Rp WbC+iKtQEykbQ4quJABUfAjQ9nU8xK+gNJSivbzqYgBnGbf7GYp8yjmeEWT20xd39etv oAgg== X-Gm-Message-State: ABy/qLaJ4eI4PGfHIbaSUoNe5oF9ERKECJFJDWyzxI/TL2MCdnIbXUfq 8k4Q3kwcKobFO6g7uwO5hFs01g== X-Received: by 2002:a05:6a20:2446:b0:12f:a373:ba8d with SMTP id t6-20020a056a20244600b0012fa373ba8dmr1552049pzc.24.1689928185246; Fri, 21 Jul 2023 01:29:45 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6d86:d21:714:abab]) by smtp.gmail.com with ESMTPSA id d26-20020a63991a000000b0055fe64fd3f4sm2594382pge.9.2023.07.21.01.29.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 01:29:44 -0700 (PDT) From: Chen-Yu Tsai To: Lee Jones , 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 RESEND v2 7/7] arm64: dts: mediatek: mt6358: Merge ldo_vcn33_* regulators Date: Fri, 21 Jul 2023 16:28:59 +0800 Message-ID: <20230721082903.2038975-8-wenst@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230721082903.2038975-1-wenst@chromium.org> References: <20230721082903.2038975-1-wenst@chromium.org> MIME-Version: 1.0 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_BLOCKED,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772020740700616593 X-GMAIL-MSGID: 1772022199347425020 The ldo_vcn33_bt and ldo_vcn33_wifi regulators are actually the same regulator, having the same voltage setting and output pin. There are simply two enable bits that are ORed together to enable the regulator. Having two regulators representing the same output pin is misleading from a design matching standpoint, and also error-prone in driver implementations. Now that the bindings have these two merged, merge them in the device tree as well. Neither vcn33 regulators are referenced in upstream device trees. As far as hardware designs go, none of the Chromebooks using MT8183 w/ MT6358 use this output. Signed-off-by: Chen-Yu Tsai --- arch/arm64/boot/dts/mediatek/mt6358.dtsi | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/arch/arm64/boot/dts/mediatek/mt6358.dtsi b/arch/arm64/boot/dts/mediatek/mt6358.dtsi index b605313bed99..186898f9384b 100644 --- a/arch/arm64/boot/dts/mediatek/mt6358.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt6358.dtsi @@ -304,15 +304,8 @@ mt6358_vrf18_reg: ldo_vrf18 { regulator-enable-ramp-delay = <120>; }; - mt6358_vcn33_bt_reg: ldo_vcn33_bt { - regulator-name = "vcn33_bt"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3500000>; - regulator-enable-ramp-delay = <270>; - }; - - mt6358_vcn33_wifi_reg: ldo_vcn33_wifi { - regulator-name = "vcn33_wifi"; + mt6358_vcn33_reg: ldo_vcn33 { + regulator-name = "vcn33"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3500000>; regulator-enable-ramp-delay = <270>;