From patchwork Thu Sep 28 08:55:26 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: 13402325 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 B2314CE7B0C for ; Thu, 28 Sep 2023 08:56:21 +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=B70I1HVdZcndWp3UgCKKWWEd0o3XW1h61Xx1jg7vsRI=; b=qXaC84U2vKgfeoQ8ePTa37vh3x MGvxPfi/APp1AX1CSsns8FhNy5oxuVRsqrvzmquK/8kKCwgTf8hJdx/OJvGtcPUuT0KDZaBdpGVJS T3G0rg8YK/ajYrtuny2gM0tF3pHL1XCGoDjjilRnRVkalTANVeFgELpwIJiDH+wxEu2l6oy+Hnl5K lN51LW1RT1cjPx9RDWuIbu2H+Iw2H5l5TImvrAQuBN8zMr22youWteLhxw2ipdgL9PybN3TMOZ5Gh kzm2y65I/0KmXFFPcRg9wgMuqBVDN31t7StfJzz0oJBn4H5rs0czt7Cdv9TFCxVFhzA9977kx5BbL 5Cm9Hisw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qlmom-002fbJ-14; Thu, 28 Sep 2023 08:56:20 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qlmoV-002fQG-1F for linux-mediatek@lists.infradead.org; Thu, 28 Sep 2023 08:56:05 +0000 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-690bc3f82a7so10714510b3a.0 for ; Thu, 28 Sep 2023 01:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695891361; x=1696496161; 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=B70I1HVdZcndWp3UgCKKWWEd0o3XW1h61Xx1jg7vsRI=; b=jjpHfKHcLaceZgLXaukjdpdXJZ9Bt7kvacdnTvEco2/FyHxb18kWckIHf+jGwgndmz 0n8oeg0pufI+wKhWloVMUXeHegIqbXpFPWpUbPhl1EL3TtoZk8HO2Q3UopGw3yKKNu3q mWWts0wLaQVmRjGa21qMET/+96jP1wdEVJLYg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695891361; x=1696496161; 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=B70I1HVdZcndWp3UgCKKWWEd0o3XW1h61Xx1jg7vsRI=; b=uwRCTyc4TdixgxbVtt9ObNKB7hQ37M3IILyG2YJZUXTDDmV48YE95LfyycG0GYiU1R Pd9KqWkYxU9lzHh3BOEUz97pRPboV9StyUDp/Jfs6AgTDC4b9OJALJ+I4+KJ160zLM+t Bj8ft3x6lkPjHYftGAaiOMyrAaoOCPKMGMgMV5GlguotlzK3LYWw9cPfWzZ709RZdAcf 0W9ZNH12n+VP5RXvgVGkxIhQYhTJ53rsXia0EHzWGC4HXxaMC1bDcJhHTJ8UzvltPFok AGtIuuE/wydTmV2KYfgxQMeERkHBbP+J6j3SUg5fb0JY7AxeblOzdHYcTlEw03AjvU+p uqPg== X-Gm-Message-State: AOJu0YxvbZR6/GaJO4yygdxAD9qkFSdIoyq2ruXqBmqxQnnluvUG6hUC 9stfe0HVwubx/xKRO/ucFm1kuA== X-Google-Smtp-Source: AGHT+IFl04ON4D1Ic/k0X0ZMnVLo7gttKdtn9tcBSXQrLi5Wav4rpOb6iw9rZiRkyCAm/WOP7TMYPw== X-Received: by 2002:a05:6a00:17a1:b0:693:3c11:4293 with SMTP id s33-20020a056a0017a100b006933c114293mr628490pfg.14.1695891361353; Thu, 28 Sep 2023 01:56:01 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6747:c12a:dbfd:2cc7]) by smtp.gmail.com with ESMTPSA id y7-20020aa78047000000b006879493aca0sm1754016pfm.26.2023.09.28.01.55.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 01:56:01 -0700 (PDT) From: Chen-Yu Tsai To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Mark Brown Cc: Chen-Yu Tsai , Lee Jones , Zhiyong Tao , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v4 03/12] regulator: dt-bindings: mt6358: Add regulator-allowed-modes property Date: Thu, 28 Sep 2023 16:55:26 +0800 Message-ID: <20230928085537.3246669-4-wenst@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20230928085537.3246669-1-wenst@chromium.org> References: <20230928085537.3246669-1-wenst@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230928_015603_444160_D5BD381D X-CRM114-Status: GOOD ( 14.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 PMIC allows changing operating modes for the buck regulators, but not the LDOs. Existing device trees and the Linux implementation already utilize this through the standard regulator-allowed-modes property. The values currently used in existing device trees are simply raw numbers. The values in the Linux driver are matching numbers defined with macros denoting the two supported modes. Turns out these two modes are common across parts of the larger MT63xx PMIC family. The MT6397 regulator binding already has macros for the two modes, with matching numbers. Codify the supported values for regulator-allowed-modes for the MT6358 in the device tree binding: 0 and 1 are supported for buck regulators, and the property should not be present for LDO regulators. Users should use the dt-bindings/regulator/mediatek,mt6397-regulator.h header for the macros, instead of using raw numbers. Signed-off-by: Chen-Yu Tsai Reviewed-by: Rob Herring --- Changes since v3: - adapt to ldo_vxo22 and ldo_vusb movement to properties Changes since v2: - new patch .../regulator/mediatek,mt6358-regulator.yaml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml index 126f502a2bda..e8c3299d698f 100644 --- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml +++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml @@ -22,12 +22,16 @@ properties: description: LDOs with fixed 2.2V output and 0~100/10mV tuning type: object $ref: regulator.yaml# + properties: + regulator-allowed-modes: false unevaluatedProperties: false ldo_vusb: description: LDOs with fixed 3.0V output and 0~100/10mV tuning type: object $ref: regulator.yaml# + properties: + regulator-allowed-modes: false unevaluatedProperties: false @@ -36,36 +40,55 @@ patternProperties: description: Buck regulators type: object $ref: regulator.yaml# + properties: + regulator-allowed-modes: + description: | + Buck regulatpr operating modes allowed. Valid values below. + Users should use the macros from dt-bindings/regulator/mediatek,mt6397-regulator.h + 0 (MT6397_BUCK_MODE_AUTO): Auto PFM/PWM mode + 1 (MT6397_BUCK_MODE_FORCE_PWM): Forced PWM mode + items: + enum: [0, 1] unevaluatedProperties: false "^ldo_v(a|rf)12$": description: LDOs with fixed 1.2V output and 0~100/10mV tuning type: object $ref: regulator.yaml# + properties: + regulator-allowed-modes: false unevaluatedProperties: false "^ldo_v((aux|cn|io|rf)18|camio)$": description: LDOs with fixed 1.8V output and 0~100/10mV tuning type: object $ref: regulator.yaml# + properties: + regulator-allowed-modes: false unevaluatedProperties: false "^ldo_v(aud|bif|cn|fe|io)28$": description: LDOs with fixed 2.8V output and 0~100/10mV tuning type: object $ref: regulator.yaml# + properties: + regulator-allowed-modes: false unevaluatedProperties: false "^ldo_vsram_(gpu|others|proc1[12])$": description: LDOs with variable output type: object $ref: regulator.yaml# + properties: + regulator-allowed-modes: false unevaluatedProperties: false "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$": description: LDOs with variable output and 0~100/10mV tuning type: object $ref: regulator.yaml# + properties: + regulator-allowed-modes: false unevaluatedProperties: false required: @@ -75,6 +98,8 @@ additionalProperties: false examples: - | + #include + regulator { compatible = "mediatek,mt6358-regulator"; @@ -84,6 +109,8 @@ examples: regulator-max-microvolt = <900000>; regulator-ramp-delay = <6250>; regulator-enable-ramp-delay = <200>; + regulator-allowed-modes = ; }; ldo_vsram_gpu {