From patchwork Fri Jun 9 08:29: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: 13273474 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 4F146C7EE25 for ; Fri, 9 Jun 2023 08:31:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=v1nhCCsnDcbF1kpIciRBxfTY7rxdLjabZrTD+r/aHkM=; b=xJ4VlCx8oDv3XV AA14Dz0hDO8Nrrragc6Q2nOd6iBFtfjDPlQlHEJ21FZFfyvPgg6Tl4p4K+iZ+vVSlNcuX2niJqB9Q wNizH/0W6Yys+pHv5rrMSFIqyPefInCd+qbBXevo5XuJJ90t8PY/iA+PH0hht3TZKwPtSkWkIBweJ Z3i6lGS/AznXUeB+LhT9gbCJJptYy/Bi466M1GHiF/1LhAFipZb3pcK/g+1260kEu0M8rOKWY5Zo2 yUxWswjJnRYVWOkWymEpWQCtzRSO6xNmK707mqi58FFN4LB5urze6bKdrcnUwE0ZmGYMEfLcQGnt1 alchKO3TTYQm/ZEFdXTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q7XW5-00CEZb-1S; Fri, 09 Jun 2023 08:30:41 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q7XW2-00CEY2-1p for linux-arm-kernel@lists.infradead.org; Fri, 09 Jun 2023 08:30:40 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-652d76be8c2so1597114b3a.3 for ; Fri, 09 Jun 2023 01:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1686299435; x=1688891435; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=AFGD2wbog2bLEzZcMSA5NeQN0FooPgViUDH/kJdJu7g=; b=VxhiTdCBLxIsBltzObFF5Ym1+vwcIDLSkmfzPbm/DGoU4AfLRLWFTTi0hHFiBZPDV8 Is4Wmq9C2828uo2zXCjZ19F2WivyaaiuCV17Co/i1luMzZCUg+0OncdpjzZkeDvwoSNV oNiEWRGo02+aYzvGoDQwSyjFIiVUGTMEeSt4I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686299435; x=1688891435; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=AFGD2wbog2bLEzZcMSA5NeQN0FooPgViUDH/kJdJu7g=; b=T/ulm8xkQWqtmhXyX5OwBUlZOlSVrdzUDD2KiAuSYHLsA+oSNfl4F8QpXJt11ijVrS 9VP1riranaFmyA72wEKxB0G86vfbGS2hh5Mz88DUWxWL3sEpCxYfJgp5qQfXuyu6QnYn 874UiU9asEaDv+fflPc99DGpf8lHW0znLpomCAAGJwDYg2KLog7XothRT3BULVtgVzev MOc95lgv1QI/AH84N/wfrrLAAo+wufmz4tNjweqfns+QJQcPp7i6/im64vlEpUt0oTzF MazZ11Xp+Ofd1eB8x1EUGBX9Ol0+MQzG9t2XycX5bmPk2CiJd42fTGVhiDgdmV9s/g98 36vA== X-Gm-Message-State: AC+VfDx/q5MhhO7nK9WgqBr3Mv79gHyFfilV/td1TYs4c8l+m2YQHgUq 8gtngnqaaVmB52ydx54blJQdyA== X-Google-Smtp-Source: ACHHUZ5udhhInSJ2+0MKW14NrN54X3Z/UNROlsx8dyPSioAo/cbj2o66CYh4A8eq4yqkuAQhXJI5cw== X-Received: by 2002:a05:6a20:2d23:b0:111:26ee:8e5 with SMTP id g35-20020a056a202d2300b0011126ee08e5mr616594pzl.62.1686299435416; Fri, 09 Jun 2023 01:30:35 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:c2ea:d8e4:1fe8:21f0]) by smtp.gmail.com with ESMTPSA id 23-20020aa79157000000b0063b806b111csm2184327pfi.169.2023.06.09.01.30.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 01:30:35 -0700 (PDT) From: Chen-Yu Tsai To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Mark Brown , Liam Girdwood , Matthias Brugger , AngeloGioacchino Del Regno Cc: Chen-Yu Tsai , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/9] regulator: mt6358: Remove bogus regulators and improvements Date: Fri, 9 Jun 2023 16:29:57 +0800 Message-ID: <20230609083009.2822259-1-wenst@chromium.org> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230609_013038_658775_1BB5CB09 X-CRM114-Status: GOOD ( 22.02 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, This series is a cleanup and improvement of the MT6358 regulator driver. Various discrepancies were found while preparing to upstream MT8186 device trees, which utilize the MT6366 PMIC, that is also covered by this driver. Patches 1~8 should go through the regulator tree, and patch 9 through the soc tree. This series (patches 7 and 8) depends on "regulator: Use bitfield values for range selectors" [1] I sent out earlier. This series can be seen as three parts: Part 1 - Fixing bogus regulators (patches 1~4 and 9) There are some regulators listed in the bindings and driver that have no corresponding pin on the actual hardware. MediaTek says these are a hardware construct for shared control of the same regulator in the VCN33 case and an alternative control scheme for low power suspend. In the VCN33 case, there's only one actual regulator, so we merge the two and rename them to match the hardware pin. No existing devices use these AFAICT, so this should be safe to change. In the *_SSHUB case, the two extra regulators refer to alternative configuration registers of the same regulators. They are intended for the SoC's low power mode companion processor to use, not the main processor or OS. It should be left to the implementation to choose which set of registers to actually control. Part 2 - Code cleanup (patches 5 and 6) Various tables in the regulator driver were not constant, even though they are just lookup tables. With some reworking of the code, they are made constant. Also, some regulators that have a single linear range were using linear range helpers. This is more complicated than just declaring the range and step directly in the description. This is simplified to use the latter approach. Part 3 - Output voltage fine tuning support (patches 7 and 8) Many of the LDOs on these PMIC support an extra level of output voltage fine tuning. Most default to no offset, but a couple have a non-zero offset by default. Previously this was unaccounted for in the driver and device tree constraints. On the outputs with non-zero offset, this ends up becoming a discrepancy between the device tree and actual hardware. These two patches adds support for this second level of tuning, modeled as bunch of linear ranges. While it's unlikely we need this level of control, it's nice to be able to read back the accurate hardware settings. Please have a look. After this series is done I'll send out patches for the MT6366 PMIC, which is what started this. That will also include updated YAML bindings for MT6366. I think we can merge MT6358 bindings into them afterwards. Thanks ChenYu [1] https://lore.kernel.org/linux-arm-kernel/20230609075032.2804554-1-wenst@chromium.org/ Chen-Yu Tsai (9): regulator: dt-bindings: mt6358: Merge ldo_vcn33_* regulators regulator: dt-bindings: mt6358: Drop *_sshub regulators regulator: mt6358: Merge VCN33_* regulators regulator: mt6358: Drop *_SSHUB regulators regulator: mt6358: Const-ify mt6358_regulator_info data structures regulator: mt6358: Use linear voltage helpers for single range regulators regulator: mt6358: Add output voltage fine tuning to fixed regulators regulator: mt6358: Add output voltage fine tuning to variable LDOs arm64: dts: mediatek: mt6358: Merge ldo_vcn33_* regulators .../bindings/regulator/mt6358-regulator.txt | 34 +- arch/arm64/boot/dts/mediatek/mt6358.dtsi | 11 +- drivers/regulator/mt6358-regulator.c | 499 ++++++++---------- include/linux/regulator/mt6358-regulator.h | 10 +- 4 files changed, 234 insertions(+), 320 deletions(-)