From nobody Mon Feb 9 06:50:56 2026 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E0EF32E721 for ; Sat, 27 Dec 2025 12:24:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838270; cv=none; b=eDfVTFRDNmJCZcVCJ8xcElE96CfpBV0LoafaM85bqWtJo3brMW8pqzvjpvduWNc5OHgX2Y4hXL9op/dQzLtucU6qji66w3y7tup8D/TFNtIYGAfqsY+UWJGe7khZK7Fdzsvrq001UO2DPe4blkblXYXWs5nsaFaSVX2duP4cdoM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838270; c=relaxed/simple; bh=/tB8dmlRTUO4vkh5GgVdehbK8ogjmNaFBOWomDp+6hA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N5Cj9atj9QPpx9/u6K82QiwEHh6bR4EjukwnxrVJ6worPX6Pn/9SeAwmQClRfU/AB20iWBPYVPW1qvhz1Q5VuB8ksX6+5QmW9yt0PCts1Nv/aIWutmpKfMKcPFz4+nq9AEsmDzc4srZJUDeAKszYXdNiBpLaA6eFJPEG2+K8Krk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=kT7COl8P; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kT7COl8P" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-64daeb28c56so5070789a12.2 for ; Sat, 27 Dec 2025 04:24:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838267; x=1767443067; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=QcAewfHh0ra+es5CHo0kMIivfjkLmLaLZDMh7cCTg/g=; b=kT7COl8PmHd00JLE9uJz44LGaWNGl76KzUAlWv+Z3ctrMo9Om9n4ZJr0ZYUZr7XUqu pt8bLFBZNLLxHmThCesk7e5gAQE5Jhu0Ss5DtepF796tRurfHy+yG2RML8J5SnRt3Q3r D8+pXbCzqfR0B4DAjCsg9rqxcZlZhnlP30Xrj6goDZe64yDiCKlByrLGRm0enzyLadQq zGxTQgasMQBWCE3tPpCW9EqtwfR53MBdhOaEwX5weIY0TJ2GkiLgrx7+vH8SQZIGmqeA 09p9ZFAC9fhiDMy7dR0rMyEbS/byFYI4kQrCzcUieAoumO20sWeWa1LUzDbm4199ce75 uGnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838267; x=1767443067; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=QcAewfHh0ra+es5CHo0kMIivfjkLmLaLZDMh7cCTg/g=; b=fqWg2ZMpX2flh+0rJXfnZkY+gilRgQdUTHDUlb7SPTq8fU3BN/RM6Y9Hpab0dNNGjr Xigf831FbtggkB6FDdfIpW9WdWoNRdWdJG/OdgE4e2y2fPbBJWqbsI7An6a6vIHKWHRg GuDvQ5od/hF0pIl3pMnPgmKht2pGZBxL2ZYuB/uyXtZDroeUh18yd8n/WTJOv29hFD7K bQiKFphfn1lrWrqVTh4RqAMBK+wQ6sBi5LCwUfENAnUeG0q39P7XAZAr9poZHi/b7H5T xZ1TTXwV5TJqHWZrFoTV1MrF6Rw9+hNdhxxJsFtxkQaAxafz8uueIktPgecv1YaAvnou w2IA== X-Forwarded-Encrypted: i=1; AJvYcCUxptQPhUcS1egDrsKiJieO5x2Iyz3yD0pfHTbmHytqfn2cOkglw8giQgatHqgm+CFmYWy4CctRvcKBJzA=@vger.kernel.org X-Gm-Message-State: AOJu0YwV0Sscupm1/Z1eGnvygn+QWlR1adBKlXUEt7mrziff5ix7D2er loC+g8KfCbuWeQYFvjsCqrcKxi2D0FIbHj3J3uQ/vAdfkY23uA8S9u1P27TI6OEXLrM= X-Gm-Gg: AY/fxX6J9h8BRhAx7xsrbmuph8aCjwz5PkIjGKRCnI7wdcbvAWEOoFQUDyrzZ/oNPe3 h1y8z6R0uaexCE2jcJHkQu5XFktBHpWd8MV6GSltA503M22RGvftxcRkyGecHggSuSYM6JHWuak bA+o4nIyzRYdRmFWl4EHLDZ30U+1XGEe3sPp2x0befGBZOy7eBYGX4y7x29X+lNY979s+Zq+JF1 l7emJb4OHIr3OA4+qN/1uUfAjlSYZpIwR2/rtrjFoqceSKktKZkYY1LlYo5Ad/lr5XfI9ZeY4Hz yWo+in8FpiDultn0rtPeQb4mCOw5aVlZunn5aU5hEAEzt6grBl8siqp9nmwaiwlwYZin7xQlfmh lWCUYy0jyrI0/NNF8FFMLcEKbkR67TNaUhcJkFcmhRWW3sI6k9P/EI7KVB2QPkbCLkgbfUFfufq yTtuiA0KNzxaMdWwsnuwdI3meJP/VwZRjmaNZbik41GR2Kbu2FhmsUueuKtaibW7ckjL5fIgmZw mHBEFhv9cdpcU+r X-Google-Smtp-Source: AGHT+IHfxIKkawssFAmJbt6V7WKCqao0Obp/Ho9JCvRAUKVxzP0PR8MNZQXegHjF1wJtOlHsDcU6Gw== X-Received: by 2002:a05:6402:5107:b0:64b:474a:d295 with SMTP id 4fb4d7f45d1cf-64b8eb619bamr23379736a12.18.1766838266916; Sat, 27 Dec 2025 04:24:26 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:26 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:23 +0000 Subject: [PATCH v5 01/21] dt-bindings: firmware: google,gs101-acpm-ipc: convert regulators to lowercase Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-1-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 Using lowercase for the buck and ldo nodenames is preferred, as evidenced e.g. in [1]. Convert the example here to lowercase before we add any bindings describing the s2mpg1x regulators that will enforce the spelling. Link: https://lore.kernel.org/all/20250223-mysterious-infrared-civet-e5bcbf= @krzk-bin/ [1] Acked-by: Rob Herring (Arm) Signed-off-by: Andr=C3=A9 Draszik --- Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml | 4 = ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-i= pc.yaml b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.= yaml index d3bca6088d128485618bb2b538ed8596b4ba14f0..4a1e3e3c0505aad6669cadf9b7b= 58aa4c7f284cb 100644 --- a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml +++ b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml @@ -75,7 +75,7 @@ examples: interrupts-extended =3D <&gpa0 6 IRQ_TYPE_LEVEL_LOW>; =20 regulators { - LDO1 { + ldo1m { regulator-name =3D "vdd_ldo1"; regulator-min-microvolt =3D <700000>; regulator-max-microvolt =3D <1300000>; @@ -84,7 +84,7 @@ examples: =20 // ... =20 - BUCK1 { + buck8m { regulator-name =3D "vdd_mif"; regulator-min-microvolt =3D <450000>; regulator-max-microvolt =3D <1300000>; --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:56 2026 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A81D01397 for ; Sat, 27 Dec 2025 12:24:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838271; cv=none; b=Lu9EZ7C6GlHj9jZDhNNZAEOWEd4fCgKTeY4j4GMFAt+p19jiISuYxy/h5DTGW/yfejCOdU8pGR+GzoyskMO3nIof7RC74XueuFCCcBfKUu8a2ig+RJf7YmlUtnHbHh4ligCqRP6uC6zHDvX5t+l/aUJTJ0/6RURNJWJ3YMkDsYU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838271; c=relaxed/simple; bh=2d0/0d8m3hoPTVwM5bL/RvUwiky6FkNHvNZvc4rhp20=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QSCQqa4WGZPWuilkHzKvrDPk8CtVwpaTvGPoOEbxs8C/sT5oosDejuzeYFw2Ttg4MlwRRuFPMejWV4Rnh7rpnre3CL8ukw9rkIKOwLoO7V5Z9osDuZT267fElTSe9hOEafPgP8vDy3PcvRPTBDBrPErDO+ddwnldJjU9QWNvr34= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=o6vfb/N8; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="o6vfb/N8" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-64b9dfc146fso9604295a12.0 for ; Sat, 27 Dec 2025 04:24:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838268; x=1767443068; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=nnmKgwlb3Memk9Nw/lLRlBwA50fe1rJg2Ys2TdZg8gU=; b=o6vfb/N87o5yuvwT6MJuk/ti8/VV5CDDZ+PqSvbI9VrRiQa44zUOuGQ19q3ZfOB5mN Cd8EH9deBHJzt7XrqNrY0UZSvwVaB4uTSgZMt9VLE4OxysUKsH/Yolvo+qC0muEUfNmW SupDPI9EKILYtXDHCYKTs/nlmujAShRYgNm8v1o4MVxb5YPUylxMLPpJTO1qKRE6g02i qs7Dg/gl7Idu7yOI5GEEhjJ2jyJSwD3HsScwbGCQwMIVPUaxHpSsF3D6ws0zx3k4Al9z FQQkNyOdpABkIkX91n8tU8RiAOEImmc82NhXy8C9ZuNkerdaUX0BojbqV2odRcW9vZ7g PWdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838268; x=1767443068; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=nnmKgwlb3Memk9Nw/lLRlBwA50fe1rJg2Ys2TdZg8gU=; b=aIVGDnVHXpkecQJfBiSljNG+ngtUGYAuxlYULX1jPhbXZIurJseEXqovKHR/kaNx7R wmYJAhtTDkTdzgjaS6ZOOonTpcL45A0tSEPdaGgaar/BraVWeyBfA0L6qXMYxE/W1M9z oKy5ubFAb2tmvnDupHZ09pLmve3e+48MS4qf3iv4Wvllf/Cj4ldN6H6uqUWYMSR/A8ua 7HJv/YWEFd3nD1NcnggSJzkiHnbKf1h86YgyZyaJEFgKze9QLrwbffY+IM7g43L6cMm0 jly/XjHyqNIEEFNXHvIAyqvBOQkM0NItlYq9BvnmZ0+6LTtTmA5eMOLVm269TRIWihMH shXw== X-Forwarded-Encrypted: i=1; AJvYcCUO6NTE+8Rmb/khUdKkmkdAmbHKS8vFFOuytDos8vlP9ckvdPP0nPGBZ2mWVPWxRAFVcJc5zNwM84dQgEs=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1p86IZ9HXwAIaklMmPPpZw2i04bymSogdLtqvU3nxOOsRBazf ekH6DUm3cBwKTBXRJIayuHQlhZtPRmERMAIPDoT8T1CYtqHiakZWWzIP34MOh+ejZAH+xbJvzig ytMv9huU= X-Gm-Gg: AY/fxX7+el2/nPkJcAWFfU8k7EQm1UCdgVyAel5r9QNzDjauAMZxix9rRZX2knjWX3p eGVwW9vBCNSUWyB1Roe+nQTNQQAGuJHsdEwSvG+AMvEClgARraKEu5KpXTYnqd0lfX/9WtaTH8H ZHos/PUCVghHTxPdDsnyxxfF+46xEOBJPBzJrcHsxHuWzUPFVJxk73ohC9Hhj5jpcyS9Uplhjhv aXXBNURbUUkJ3Gz7QgaE32qYvs7VsNZs3i2m57Mq610/TOeq65rR5Vfc4/KnPz4DtSihPtdKiW5 vkVuPx9IiAhL90yFOWFvlVmUt6DroN0LV718Ibza+YbxzabJKnpCAqJRg+D+JTsM7KUd4mUoG4Y PwM2l1S8BOCc6AHWacw+3fJXj2r2nMzZ8hqeW9g2C24i9YiUPR/j9ZYo0OyMAKT8vybty/8hhub yJQgzxZC5HcQ5e887JsDjBwr5flFivcxzlDAam64gDa7tJ2mr/wmkstu+tPdJfrOFrej282c1By 7MnVg== X-Google-Smtp-Source: AGHT+IGAcCMtQHlT4XKKFtGADWVcFNE1VJZMxUrv/NHf8LsqTZUlbV8TWqIQWo02tj9Et2Cnmt9Aaw== X-Received: by 2002:a05:6402:2386:b0:640:93ea:8ff3 with SMTP id 4fb4d7f45d1cf-64b584ec371mr19471561a12.13.1766838267912; Sat, 27 Dec 2025 04:24:27 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:27 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:24 +0000 Subject: [PATCH v5 02/21] regulator: dt-bindings: add s2mpg10-pmic regulators Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-2-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 The S2MPG10 PMIC is a Power Management IC for mobile applications with buck converters, various LDOs, power meters, RTC, clock outputs, and additional GPIO interfaces. It has 10 buck and 31 LDO rails. Several of these can either be controlled via software (register writes) or via external signals, in particular by: * one out of several input pins connected to a main processor's: * GPIO pins * other pins that are e.g. firmware- or power-domain-controlled without explicit driver intervention * a combination of input pins and register writes. Control via input pins allows PMIC rails to be controlled by firmware, e.g. during standby/suspend, or as part of power domain handling where otherwise that would not be possible. Additionally toggling a pin is faster than register writes, and it also allows the PMIC to ensure that any necessary timing requirements between rails are respected automatically if multiple rails are to be enabled or disabled quasi simultaneously. While external control via input pins appears to exist on other versions of this PMIC, there is more flexibility in this version, in particular there is a selection of input pins to choose from for each rail (which must therefore be configured accordingly if in use), whereas other versions don't have this flexibility. Add documentation related to the regulator (buck & ldo) parts like devicetree definitions, regulator naming patterns, and additional properties. S2MPG10 is typically used as the main-PMIC together with an S2MPG11 PMIC in a main/sub configuration, hence the datasheet and the binding both suffix the rails with an 'm'. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- v4: - Krzysztof: - move additionalProperties to after allOf - use $defs, not definitions v3: - drop PCTRLSEL values that can be described using standard properties (Krzysztof), drop useless ones, rename the remaining ones - drop maxItems:1 where not needed (Krzysztof) - samsung,ext-control-gpios -> enable-gpios (Krzysztof) - fix LDO20M_EN pin name -> VLDO20M_EN v2: - drop | (literal style mark) from samsung,ext-control-gpios description --- .../regulator/samsung,s2mpg10-regulator.yaml | 158 +++++++++++++++++= ++++ MAINTAINERS | 1 + .../regulator/samsung,s2mpg10-regulator.h | 39 +++++ 3 files changed, 198 insertions(+) diff --git a/Documentation/devicetree/bindings/regulator/samsung,s2mpg10-re= gulator.yaml b/Documentation/devicetree/bindings/regulator/samsung,s2mpg10-= regulator.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7252f94b3a8f3ae339ff6cf3080= 786ba88d44f7e --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/samsung,s2mpg10-regulator= .yaml @@ -0,0 +1,158 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/samsung,s2mpg10-regulator.yam= l# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung S2MPG10 Power Management IC regulators + +maintainers: + - Andr=C3=A9 Draszik + +description: | + This is part of the device tree bindings for the S2MG10 Power Management= IC + (PMIC). + + The S2MPG10 PMIC provides 10 buck and 31 LDO regulators. + + See also Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml for + additional information and example. + +properties: + # 1 LDO with possible (but limited) external control + ldo20m: + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for a single LDO regulator. + + allOf: + - $ref: "#/$defs/s2mpg10-ext-control" + + properties: + regulator-ramp-delay: false + + samsung,ext-control: + minimum: 11 + +patternProperties: + # 10 bucks + "^buck([1-9]|10)m$": + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for a single buck regulator. + + allOf: + - $ref: "#/$defs/s2mpg10-ext-control" + + properties: + regulator-ramp-delay: + enum: [6250, 12500, 25000] + default: 6250 + + samsung,ext-control: + maximum: 10 + + # 12 standard LDOs + "^ldo(2[1-9]?|3[0-1])m$": + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for single LDO regulator. + + properties: + regulator-ramp-delay: false + + # 12 LDOs with possible external control + "^ldo([3-689]|1[046-9])m$": + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for a single LDO regulator. + + allOf: + - $ref: "#/$defs/s2mpg10-ext-control" + + properties: + regulator-ramp-delay: false + + samsung,ext-control: + maximum: 10 + + # 6 LDOs with ramp support, 5 out of those with possible external control + "^ldo(1[1235]?|7)m$": + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for a single LDO regulator. + + allOf: + - $ref: "#/$defs/s2mpg10-ext-control" + + properties: + regulator-ramp-delay: + enum: [6250, 12500] + default: 6250 + + samsung,ext-control: + maximum: 10 + +$defs: + s2mpg10-ext-control: + properties: + samsung,ext-control: + description: | + These rails can be controlled via one of several possible extern= al + (hardware) signals. If so, this property configures the signal t= he PMIC + should monitor. For S2MPG10 rails where external control is poss= ible other + than ldo20m, the following values generally corresponding to the + respective on-chip pin are valid: + - 0 # S2MPG10_EXTCTRL_PWREN - PWREN pin + - 1 # S2MPG10_EXTCTRL_PWREN_MIF - PWREN_MIF pin + - 2 # S2MPG10_EXTCTRL_AP_ACTIVE_N - ~AP_ACTIVE_N pin + - 3 # S2MPG10_EXTCTRL_CPUCL1_EN - CPUCL1_EN pin + - 4 # S2MPG10_EXTCTRL_CPUCL1_EN2 - CPUCL1_EN & PWREN pins + - 5 # S2MPG10_EXTCTRL_CPUCL2_EN - CPUCL2_EN pin + - 6 # S2MPG10_EXTCTRL_CPUCL2_EN2 - CPUCL2_E2 & PWREN pins + - 7 # S2MPG10_EXTCTRL_TPU_EN - TPU_EN pin + - 8 # S2MPG10_EXTCTRL_TPU_EN2 - TPU_EN & ~AP_ACTIVE_N pins + - 9 # S2MPG10_EXTCTRL_TCXO_ON - TCXO_ON pin + - 10 # S2MPG10_EXTCTRL_TCXO_ON2 - TCXO_ON & ~AP_ACTIVE_N pins + + For S2MPG10 ldo20m, the following values are valid + - 11 # S2MPG10_EXTCTRL_LDO20M_EN2 - VLDO20M_EN & LDO20M_SFR + - 12 # S2MPG10_EXTCTRL_LDO20M_EN - VLDO20M_EN pin + + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 12 + + enable-gpios: + description: + For rails where external control is done via a GPIO, this option= al + property describes the GPIO line used. + + dependentRequired: + enable-gpios: [ "samsung,ext-control" ] + +allOf: + # Bucks 8, 9, and LDO 1 can not be controlled externally - above definit= ion + # allows it and we deny it here. This approach reduces repetition. + - if: + anyOf: + - required: [buck8m] + - required: [buck9m] + - required: [ldo1m] + then: + patternProperties: + "^(buck[8-9]|ldo1)m$": + properties: + samsung,ext-control: false + +additionalProperties: false diff --git a/MAINTAINERS b/MAINTAINERS index 0dbf349fc1edb33a57894e5ef1610b350ddf13a5..c1a93a6b005355bc109da954849= 3b3eb28e391fa 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23277,6 +23277,7 @@ F: drivers/mfd/sec*.[ch] F: drivers/regulator/s2*.c F: drivers/regulator/s5m*.c F: drivers/rtc/rtc-s5m.c +F: include/dt-bindings/regulator/samsung,s2m*.h F: include/linux/mfd/samsung/ =20 SAMSUNG S3C24XX/S3C64XX SOC SERIES CAMIF DRIVER diff --git a/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h b/in= clude/dt-bindings/regulator/samsung,s2mpg10-regulator.h new file mode 100644 index 0000000000000000000000000000000000000000..4a6bf13442f50bb1c475728722e= aebd0ec3dcbfa --- /dev/null +++ b/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Copyright 2021 Google LLC + * Copyright 2025 Linaro Ltd. + * + * Device Tree binding constants for the Samsung S2MPG1x PMIC regulators + */ + +#ifndef _DT_BINDINGS_REGULATOR_SAMSUNG_S2MPG10_H +#define _DT_BINDINGS_REGULATOR_SAMSUNG_S2MPG10_H + +/* + * Several regulators may be controlled via external signals instead of via + * software. These constants describe the possible signals for such regula= tors + * and generally correspond to the respecitve on-chip pins. + * + * S2MPG10 regulators supporting these are: + * - buck1m .. buck7m buck10m + * - ldo3m .. ldo19m + * + * ldo20m supports external control, but using a different set of control + * signals. + */ +#define S2MPG10_EXTCTRL_PWREN 0 /* PWREN pin */ +#define S2MPG10_EXTCTRL_PWREN_MIF 1 /* PWREN_MIF pin */ +#define S2MPG10_EXTCTRL_AP_ACTIVE_N 2 /* ~AP_ACTIVE_N pin */ +#define S2MPG10_EXTCTRL_CPUCL1_EN 3 /* CPUCL1_EN pin */ +#define S2MPG10_EXTCTRL_CPUCL1_EN2 4 /* CPUCL1_EN & PWREN pins */ +#define S2MPG10_EXTCTRL_CPUCL2_EN 5 /* CPUCL2_EN pin */ +#define S2MPG10_EXTCTRL_CPUCL2_EN2 6 /* CPUCL2_E2 & PWREN pins */ +#define S2MPG10_EXTCTRL_TPU_EN 7 /* TPU_EN pin */ +#define S2MPG10_EXTCTRL_TPU_EN2 8 /* TPU_EN & ~AP_ACTIVE_N pins */ +#define S2MPG10_EXTCTRL_TCXO_ON 9 /* TCXO_ON pin */ +#define S2MPG10_EXTCTRL_TCXO_ON2 10 /* TCXO_ON & ~AP_ACTIVE_N pins */ + +#define S2MPG10_EXTCTRL_LDO20M_EN2 11 /* VLDO20M_EN & LDO20M_SFR */ +#define S2MPG10_EXTCTRL_LDO20M_EN 12 /* VLDO20M_EN pin */ + +#endif /* _DT_BINDINGS_REGULATOR_SAMSUNG_S2MPG10_H */ --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C77032E73B for ; Sat, 27 Dec 2025 12:24:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838272; cv=none; b=aLdGEIVl05U90T6Cvki1dKLbCk4YCge09z2xO/KSlCTJBco+ChnYebNftgPV6aiA51BOCEequnK1G58p+uuOQtp5JMOTt+xua1mt76Vs0ddqnvPvsdMhlg6+ZljpB3c38qT7mZnALUDfwSyfcu7MvAoFL+IMH0Xa4lCSgW6kPUA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838272; c=relaxed/simple; bh=hCyU+UvoqAZ0y+DMEsx1d4h3jN+BwHub9jI2bDgl3kc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eBf8wBRK/6mHraln+4rOow07Tu0OYA+N42N86OucV/wKj6rEs2YkhaWwOssWpvygeNMdYL4v5+6v4JNCtGo8TP4afg+BVnB+dXKc6zMsSPttltLcTRsS93ePTvdLmjtgCt4OskDtCOAv4W7YgByLp+JrnAQD/pYNHpQPjAgu+xg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=n+pYYOfx; arc=none smtp.client-ip=209.85.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="n+pYYOfx" Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-64ba9a00b5aso8881478a12.2 for ; Sat, 27 Dec 2025 04:24:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838268; x=1767443068; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=oYMpGHqEe3Pcj/Iu077fbSOBxW1M8Fmnn10jzmEF0+8=; b=n+pYYOfx+3BcnnYj0Lf/7kGYZV00r1T/M3g/Z/QUr2HwZsiLCNqQIVlqsqVyYyE912 rSsMdwhWEzG8/Pb0BlmL3MyeXv1D8mk3Ij3Tb4pGi89Mw1mn0xzI4a5U5gGNcndi3SUk v5SkPWTJ7EeQcm12QJ3pMIVesUqC2kofwIk4PD6DM0vcFziSplEBdIYyAUKTrryElwGm CP6htp6P5i0WSOmsoYv60jJf6G6V9xSvntn47TStvRJ+4bkVIKVbppwwjq7YW04VQPob 70O4CnjUYEKzVl0Soe3HbjA0gVYBCGltl5cYGlENOqhTcuedBHb1yS6ANXy8vA3cuPbW f6Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838268; x=1767443068; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=oYMpGHqEe3Pcj/Iu077fbSOBxW1M8Fmnn10jzmEF0+8=; b=iycg5AsTD4ow87kQ5zFKMlbcQftfUzm59qO2fz/adlw3S4vZ+0aHOoXu1nW6SMGbtz s7yRyKJZl0BEGp3GpfPDXYgMEh/zT5k6h79vqL3tfIXIm24OqkkqN2D2yZh95UVBoHxq hxVvgOTwOF3C6baNvWFKQCxAY2+z56kEbz52akfXMf444JUzkQ4GiDOWWivtjrSTlvi7 xlYXOs0btpkTIpSsKIu+LD6n9XfgiNmEksLMxM5+E9Jdjqe6wkBMhmYk1NmBG5Ixbbe8 NNOYDSY+NX0cZTodE67Gr8T9mggakhXej1HhcUg3YZMGrQoREP45Z7nomw3fecqG0XZF MFxw== X-Forwarded-Encrypted: i=1; AJvYcCXnKf+53GHeGflzCggJQCXAsJLm2DPBrTbfvCvMPebLgT70z7/qjuVSlWlk0nxErtbIkOWSpM2GTZIdlCA=@vger.kernel.org X-Gm-Message-State: AOJu0YxlIV875R1M3XwpVHnhGUgua3RA7mxdh0TQ2KS+dxw9B32mc5ND qIkuIAwaG8kpeBPaX6PD+2pVFkCGFIIpEMnXN5qJyAKIXFE4LbUBptHL18A9Y4Zye2U= X-Gm-Gg: AY/fxX5PGoK+S6wNJWmJ32cwg0cNg2FFs/jFs16lSrLrqxCVzRwC8G4iQRyksR1RXpn oc+9WOifnOZ4Z27TXxzsyMBnAxiNA1HceZ5X/jvDGE+w8WDskUDv5dYwkj/yPVabs0Im4DC9AZq fyhftIbxqSpxlORavzKHwfKFJKgmmIw08zeaLhOeOnFq5gVoCr5QmUDlxrtR4h0lqqMsy6+Ca3H jMlGI5hAtUC4aR1FWC1zQvuKolyYR7yvrglSM99TM55LX9Urq+z3X6r7tDJgmH60d9Kcu/qvL/Y eMgzc8t8PH+/SKlg+XrsBjB+CIQgzzw+kg1svcLnem17CeetpG8sjTOGwbb88x47DY23ZDTSgKR rfXY/ATLiQ2g6JUNpllKIVE2wThtlvxlJ0d/92Ii7dMacyx4HH+JN0VUT2Y3C+Kchl94ETlIPRv bPu2IRy9J+n4NxsV8Uxt6EmiDOe83C7vCgXaM188Aybyc0gHMOdwWm8F2rZRK/iaXcrB0fRzWrO zsSuBpCVQhH/Y4U X-Google-Smtp-Source: AGHT+IFvyBuqAZVJcAozcjdd53m/LBVDlibKqGXngB5R5irvk0HKcI3nzx0//hHmWtl6MYgm4HdjHg== X-Received: by 2002:a05:6402:2755:b0:64d:4894:774c with SMTP id 4fb4d7f45d1cf-64d48947a3emr18801127a12.7.1766838268423; Sat, 27 Dec 2025 04:24:28 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:28 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:25 +0000 Subject: [PATCH v5 03/21] regulator: dt-bindings: add s2mpg11-pmic regulators Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-3-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 The S2MPG11 PMIC is a Power Management IC for mobile applications with buck converters, various LDOs, power meters, NTC thermistor inputs, and additional GPIO interfaces. It typically complements an S2MPG10 PMIC in a main/sub configuration as the sub-PMIC. S2MPG11 has 12 buck, 1 buck-boost, and 15 LDO rails. Several of these can either be controlled via software (register writes) or via external signals, in particular by: * one out of several input pins connected to a main processor's: * GPIO pins * other pins that are e.g. firmware- or power-domain-controlled without explicit driver intervention * a combination of input pins and register writes. Control via input pins allows PMIC rails to be controlled by firmware, e.g. during standby/suspend, or as part of power domain handling where otherwise that would not be possible. Additionally toggling a pin is faster than register writes, and it also allows the PMIC to ensure that any necessary timing requirements between rails are respected automatically if multiple rails are to be enabled or disabled quasi simultaneously. While external control via input pins appears to exist on other versions of this PMIC, there is more flexibility in this version, in particular there is a selection of input pins to choose from for each rail (which must therefore be configured accordingly if in use), whereas other versions don't have this flexibility. Add documentation related to the regulator (buck & ldo) parts like devicetree definitions, regulator naming patterns, and additional properties. Since S2MPG11 is typically used as the sub-PMIC together with an S2MPG10 as the main-PMIC, the datasheet and the binding both suffix the rails with an 's'. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- Note: checkpatch suggests to update MAINTAINERS, but the new file is covered already due to using a wildcard. v4: - Krzysztof: - move additionalProperties to after allOf - use $defs, not definitions - update samsung,ext-control: description v3: - mention NTC thermistor inputs in commit message - drop PCTRLSEL values that can be described using standard properties (Krzysztof), drop useless ones, rename the remaining ones - drop maxItems:1 where not needed (Krzysztof) - samsung,ext-control-gpios -> enable-gpios (Krzysztof) - drop buckboost from 'allOf' limitation - not needed as it has its own specific description v2: - fix commit message typos: s2mp1 -> s2mpg1 - mention GPIOs in commit message --- .../regulator/samsung,s2mpg11-regulator.yaml | 136 +++++++++++++++++= ++++ .../regulator/samsung,s2mpg10-regulator.h | 14 +++ 2 files changed, 150 insertions(+) diff --git a/Documentation/devicetree/bindings/regulator/samsung,s2mpg11-re= gulator.yaml b/Documentation/devicetree/bindings/regulator/samsung,s2mpg11-= regulator.yaml new file mode 100644 index 0000000000000000000000000000000000000000..119386325d1b5b6b0fe35c1f17d= 86e3671fe0fc4 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/samsung,s2mpg11-regulator= .yaml @@ -0,0 +1,136 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/samsung,s2mpg11-regulator.yam= l# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung S2MPG11 Power Management IC regulators + +maintainers: + - Andr=C3=A9 Draszik + +description: | + This is part of the device tree bindings for the S2MG11 Power Management= IC + (PMIC). + + The S2MPG11 PMIC provides 12 buck, 1 buck-boost, and 15 LDO regulators. + + See also Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml for + additional information and example. + +properties: + buckboost: + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for the buck-boost regulator. + + properties: + regulator-ramp-delay: false + +patternProperties: + # 12 bucks + "^buck(([1-9]|10)s|[ad])$": + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for a single buck regulator. + + allOf: + - $ref: "#/$defs/s2mpg11-ext-control" + + properties: + regulator-ramp-delay: + enum: [6250, 12500, 25000] + default: 6250 + + # 11 standard LDOs + "^ldo([3-79]|1[01245])s$": + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for a single LDO regulator. + + properties: + regulator-ramp-delay: false + + # 2 LDOs with possible external control + "^ldo(8|13)s$": + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for single LDO regulator. + + allOf: + - $ref: "#/$defs/s2mpg11-ext-control" + + properties: + regulator-ramp-delay: false + + # 2 LDOs with ramp support and possible external control + "^ldo[12]s$": + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for a single LDO regulator. + + allOf: + - $ref: "#/$defs/s2mpg11-ext-control" + + properties: + regulator-ramp-delay: + enum: [6250, 12500] + default: 6250 + +$defs: + s2mpg11-ext-control: + properties: + samsung,ext-control: + description: | + These rails can be controlled via one of several possible extern= al + (hardware) signals. If so, this property configures the signal t= he PMIC + should monitor. The following values generally corresponding to = the + respective on-chip pin are valid: + - 0 # S2MPG11_EXTCTRL_PWREN - PWREN pin + - 1 # S2MPG11_EXTCTRL_PWREN_MIF - PWREN_MIF pin + - 2 # S2MPG11_EXTCTRL_AP_ACTIVE_N - ~AP_ACTIVE_N pin + - 3 # S2MPG11_EXTCTRL_G3D_EN - G3D_EN pin + - 4 # S2MPG11_EXTCTRL_G3D_EN2 - G3D_EN & ~AP_ACTIVE_N pins + - 5 # S2MPG11_EXTCTRL_AOC_VDD - AOC_VDD pin + - 6 # S2MPG11_EXTCTRL_AOC_RET - AOC_RET pin + - 7 # S2MPG11_EXTCTRL_UFS_EN - UFS_EN pin + - 8 # S2MPG11_EXTCTRL_LDO13S_EN - VLDO13S_EN pin + + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 8 + + enable-gpios: + description: + For rails where external control is done via a GPIO, this option= al + property describes the GPIO line used. + + dependentRequired: + enable-gpios: [ "samsung,ext-control" ] + +allOf: + # Bucks 4, 6, 7 and 10 can not be controlled externally - above definiti= on + # allows it and we deny it here. This approach reduces repetition. + - if: + anyOf: + - required: [buck4s] + - required: [buck6s] + - required: [buck7s] + - required: [buck10s] + then: + patternProperties: + "^buck([467]|10)s$": + properties: + samsung,ext-control: false + +additionalProperties: false diff --git a/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h b/in= clude/dt-bindings/regulator/samsung,s2mpg10-regulator.h index 4a6bf13442f50bb1c475728722eaebd0ec3dcbfa..d9c16bba4d85809df99c2887b8d= c61ea1bea5ad1 100644 --- a/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h +++ b/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h @@ -20,6 +20,10 @@ * * ldo20m supports external control, but using a different set of control * signals. + * + * S2MPG11 regulators supporting these are: + * - buck1s .. buck3s buck5s buck8s buck9s bucka buckd + * - ldo1s ldo2s ldo8s ldo13s */ #define S2MPG10_EXTCTRL_PWREN 0 /* PWREN pin */ #define S2MPG10_EXTCTRL_PWREN_MIF 1 /* PWREN_MIF pin */ @@ -36,4 +40,14 @@ #define S2MPG10_EXTCTRL_LDO20M_EN2 11 /* VLDO20M_EN & LDO20M_SFR */ #define S2MPG10_EXTCTRL_LDO20M_EN 12 /* VLDO20M_EN pin */ =20 +#define S2MPG11_EXTCTRL_PWREN 0 /* PWREN pin */ +#define S2MPG11_EXTCTRL_PWREN_MIF 1 /* PWREN_MIF pin */ +#define S2MPG11_EXTCTRL_AP_ACTIVE_N 2 /* ~AP_ACTIVE_N pin */ +#define S2MPG11_EXTCTRL_G3D_EN 3 /* G3D_EN pin */ +#define S2MPG11_EXTCTRL_G3D_EN2 4 /* G3D_EN & ~AP_ACTIVE_N pins */ +#define S2MPG11_EXTCTRL_AOC_VDD 5 /* AOC_VDD pin */ +#define S2MPG11_EXTCTRL_AOC_RET 6 /* AOC_RET pin */ +#define S2MPG11_EXTCTRL_UFS_EN 7 /* UFS_EN pin */ +#define S2MPG11_EXTCTRL_LDO13S_EN 8 /* VLDO13S_EN pin */ + #endif /* _DT_BINDINGS_REGULATOR_SAMSUNG_S2MPG10_H */ --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5743832E737 for ; Sat, 27 Dec 2025 12:24:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838274; cv=none; b=tBxBN3irIlGY40yU2Fu82DFvQoXGZ9+5CAFxzuf50jgau4euNhnoUyS6BJAffHyabQEkLgJLw5AaJKECC2eR7nkK6/Ff2VWnHDmjr0FVwlObBupU2Q3R66QDadenbAGntGBiyaEwu0E6IaEaI+R2wE+Ou2mQ1TTh8ZfocRpjs5o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838274; c=relaxed/simple; bh=Q0CedTDoxzAYvTyoSGG2JCu7m4Qn+Y6GBjY/RZepsts=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QqDRw3bapOyXcWFD0ibrNazH43c/3JvtF58mo21UY8rigpXSfqA6ZnWARGDQoI3zP5ppsjGzzJMyhEnJVGtqlDjdl4C4hrCfR3cxTQB/BwBQROd9YR2KODRVOnqmipw08k/ORO4bOMepe5tfyd887ZP5F72JZkaD5XCpsRuvZw0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=XXiktJ+l; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="XXiktJ+l" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-b802d5e9f06so1002388966b.1 for ; Sat, 27 Dec 2025 04:24:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838270; x=1767443070; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=PoAySoFSuOUGBXwBkj/tqOj8zEikF0/rK/x+6MrVKns=; b=XXiktJ+lCvjhbzo3SHLREtSuT1TMjnJ6SC5DTDmlXxrDFQFw7DapSpAmOKbqXOMp/B KVdJz6cltOVSUxMxLMiR0aEL8L1VCcC9OEyWArtzmS4JgsaEQBmQRskLRdCS7hkNq/Q7 EKRLa791bfSHqfwg71+a5fBE2HbBmj2A/leKIoiBYvkoh8R9EG/tqivkluRZhNqoIyGS 9d/zR9vqUGQID0GWTK9Xh15EF7dGhQMipw7Z6ktzWygvhMna0mSXWIsu2K3vCx4BAS/j CwNvkUfz//+oyuWtKDGn5d/HfXrwi15fKhp04DM5QR1APwJureRF9ZwaGSAJBKv6Tq9r HuAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838270; x=1767443070; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=PoAySoFSuOUGBXwBkj/tqOj8zEikF0/rK/x+6MrVKns=; b=Z8WPn9yj9rT6fGb1aTwA3GjUkXjfSIs0P2khegpwEo34hErvwv0FF5DX05o815Cr5l 5qAVmPq1JjwrhRN/9PObdIdjyq0KCqcMiWNPJKcgvPxJejHppEfuY6Kank2EiwDVzouq YjOlKfT2CFJWB+eG8UB+imVyGva7LqY0pvHlbji2u1alBluf1WDG+SnxlQ6lnUTCWtYu cpyw6jEdOsYskrnhz7x5g0kg706oxVvYluuI6iZ9m8u75Rl86gsN46/taFA0vHB+nQ/h 2Ovu9cMp/wzeWWkfPH3xwIb6J9WVeH8VgrVOd6Nmuj3CoapKY0OIanb0t/fuawOyStW/ ol0A== X-Forwarded-Encrypted: i=1; AJvYcCVLiVotlZlmXStM9rM4LScTMWvXREaPVXAvcz4F4QVAkRPUwjra2ajjYpLMZhJda702EgSE2xr9KvX3TCY=@vger.kernel.org X-Gm-Message-State: AOJu0YzfQuAfFngUC1hEwBb2PqS076lkxu5yhvg8l1iLvW4tLjeWPMy2 hiPcID5Rrg7D6r8VDO7B0PSCYBlt9bVbXX922nae8rlu3Un+W7vZ2KfrOHNAME9wRog= X-Gm-Gg: AY/fxX6BmTEYuwpyuudXOARLnWkIXkun+ODa0i/GpCRxDcVPRUxJ6LrT3j6tCqup/A3 ig6J4nDmSrR+j2aJjs/09Zb6cWAXvPdxoXDHWU20129wBkcfvgOE4ONTAJsFbzAYN9rsK6bRtS6 WZbzfNtiB4ADu0fTdqyEadNIq5vGdYRVLJyTEqLWIDin0CMzpTMghweW9KRmh+ttQ1+lPxfAWQ4 UdKa7cahj8dTli+AprCS91fuGY0fJ7DpF46sdKKJ3qWIyGa4D/Ev+hpVMM3OcWHHn1Zzc5x/Znv A9kcUT9dg8Vzq1TXUX0NwFsMyA3DSH6xhkZ85ozxJM+sBL37HXuZBzcisZA/ymGR5mN/GEgaPwf KfNalbvckblrhtN1/g1ciNdBTg8XHvWxWcp70mglPc0c8AP2SnqqyX6nzmq0Rdo71r8uH/KnOIF gQPXv6onyztkrOqv+l1HkMMh/4qn27VkRDjpOaIyLFTDB2whxwasPO8w/ZNUxJiWbid1P/4kTlC 1j2Ow== X-Google-Smtp-Source: AGHT+IFwPaGUh7AedhbGKdobDVIl693E5xOS7bnu/0qiOYY00HsSelAVrn/J5vSA6RYOmzMZGsd4tg== X-Received: by 2002:a17:907:3da8:b0:b7a:1be1:983 with SMTP id a640c23a62f3a-b80372699eemr2839825066b.63.1766838269649; Sat, 27 Dec 2025 04:24:29 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:28 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:26 +0000 Subject: [PATCH v5 04/21] dt-bindings: mfd: samsung,s2mps11: Split s2mpg10-pmic into separate file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-4-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 The samsung,s2mpg10-pmic binding is going to acquire various additional properties. To avoid making the common samsung,s2mps11 binding file too complicated due to additional nesting, split s2mpg10 out into its own file. As a side-effect, the oneOf for the interrupts is not required anymore, as the required: node is at the top-level now. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- Note: checkpatch suggests to update MAINTAINERS, but the new file is covered already due to using a wildcard. v5: - collect tags - fix a typo in commit message complicateddue -> complicated due v4: - make yaml file name match compatible - add example (Krzysztof) v3: - new patch (Krzysztof) --- .../bindings/mfd/samsung,s2mpg10-pmic.yaml | 69 ++++++++++++++++++= ++++ .../devicetree/bindings/mfd/samsung,s2mps11.yaml | 29 +-------- 2 files changed, 70 insertions(+), 28 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/samsung,s2mpg10-pmic.yam= l b/Documentation/devicetree/bindings/mfd/samsung,s2mpg10-pmic.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6475cd1d2d15e07d953c8b302c9= 0c785835985e5 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/samsung,s2mpg10-pmic.yaml @@ -0,0 +1,69 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/samsung,s2mpg10-pmic.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung S2MPG10 Power Management IC + +maintainers: + - Andr=C3=A9 Draszik + +description: | + This is part of the device tree bindings for the S2MPG family of Power + Management IC (PMIC). + + The Samsung S2MPG10 is a Power Management IC for mobile applications wit= h buck + converters, various LDOs, power meters, RTC, clock outputs, and addition= al + GPIO interfaces. + +properties: + compatible: + const: samsung,s2mpg10-pmic + + clocks: + $ref: /schemas/clock/samsung,s2mps11.yaml + description: + Child node describing clock provider. + + interrupts: + maxItems: 1 + + regulators: + type: object + description: + List of child nodes that specify the regulators. + + system-power-controller: true + + wakeup-source: true + +required: + - compatible + - interrupts + - regulators + +additionalProperties: false + +examples: + - | + #include + #include + + pmic { + compatible =3D "samsung,s2mpg10-pmic"; + interrupts-extended =3D <&gpa0 6 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&pmic_int>; + system-power-controller; + wakeup-source; + + clocks { + compatible =3D "samsung,s2mpg10-clk"; + #clock-cells =3D <1>; + clock-output-names =3D "rtc32k_ap", "peri32k1", "peri32k2"; + }; + + regulators { + }; + }; diff --git a/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml b/D= ocumentation/devicetree/bindings/mfd/samsung,s2mps11.yaml index 31d544a9c05cad878d10a0ae9b99631f08eb04a8..ac5d0c149796b6a4034b5d4245b= fa8be0433cfab 100644 --- a/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml +++ b/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml @@ -20,7 +20,6 @@ description: | properties: compatible: enum: - - samsung,s2mpg10-pmic - samsung,s2mps11-pmic - samsung,s2mps13-pmic - samsung,s2mps14-pmic @@ -59,42 +58,16 @@ properties: reset (setting buck voltages to default values). type: boolean =20 - system-power-controller: true - wakeup-source: true =20 required: - compatible + - reg - regulators =20 additionalProperties: false =20 allOf: - - if: - properties: - compatible: - contains: - const: samsung,s2mpg10-pmic - then: - properties: - reg: false - samsung,s2mps11-acokb-ground: false - samsung,s2mps11-wrstbi-ground: false - - # oneOf is required, because dtschema's fixups.py doesn't handle this - # nesting here. Its special treatment to allow either interrupt prop= erty - # when only one is specified in the binding works at the top level o= nly. - oneOf: - - required: [interrupts] - - required: [interrupts-extended] - - else: - properties: - system-power-controller: false - - required: - - reg - - if: properties: compatible: --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE72E32E6BE for ; Sat, 27 Dec 2025 12:24:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838276; cv=none; b=NTdOOyOYXTcVCHMoPLsmMhctzCN4Cnesx6lwYr4QeUoAykQpBhP9nJW3375CYQlO/cn+ZHxB8BiAe2YrJR0XtFRqfE6zg0Qosy6Tg51ocXiy3TZhz2TXtyXJAJLrXjVRuux00BeLS/TsFx4eCQqQhb2stOHCx1FuV/P+sdy8p5I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838276; c=relaxed/simple; bh=eUj+8YlOMKUNf5NBtFGcV3w0vZQRcRxLXSHd68Howms=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i+ZmZ+vqooSQ9MUHDi3n2lokcwq9oAiXQEQ7z8bBIPKDDRvKXzdAVgpdGwh3j2HkqOfZQrN6MOZa4oRPYkJ6rK3IUvIQwJu8vTSUCIZeelnF0auccpVOu7RRsAw2WjSt05OU3KDUhQyPQUv3dMRpXxaoizYHlq1XXC85E5s2zhU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=s7HXxYxt; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="s7HXxYxt" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-64b9d01e473so10537752a12.2 for ; Sat, 27 Dec 2025 04:24:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838270; x=1767443070; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SNYCoocek2VrCaA3pJ1kEtxh2+5LCdMec/cid7tZc1Y=; b=s7HXxYxtHm7QKhtecTjJOzXWTEcTulQLkQBBziOHCliTsUgApqwMWr19cE1Pio6HvS 3b9M0QEe8a5AgTiOa/15RN5Dzu8qcWkCmzHlnLf1hzACz0ESHBrp6UEonKk2+15Rraal UZbiuNieRIzEKEfrFZcNu/xy+geeLC3vsuCz9FKt4FOIr3BXY7E4F4Vveb725WsANVRz xco/e2Ks5lM2/9gKz7U3ceoA2ZBaJqDiBR1jVDeswmk1Whi4kL18jKIioEkSB4NtuKIY QHNTvwgVLA/1jD/SCzD5GJSyEWRGLGmVFIvv289OfOtnaS0mUS4RcwXcwkCyeoyKxI2F SEAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838270; x=1767443070; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=SNYCoocek2VrCaA3pJ1kEtxh2+5LCdMec/cid7tZc1Y=; b=gEBwAW+XhXSZ9qpBDh8v/tbbQSJ2l9B5GCLdkpJ3ljNUSsKuBGRyl8+41KzyhoHO/K hhNZ5k3N1T9FqBB/IQU9lsrIRP3mNp0gmj8JrNrnb1iSvupQ5iMalTBeKkr5LLTaBJxG TLipTkgdxrHLEHdXmi3i6XXH9dOpaQC24gn8RF2zMF7DiGDRPRSthotvevSQb1Ax1JbW 9chPggAa8hx66ffSE7fsgrr7UcQEwAUk1A1hSYU23+S7M+wfQ8QDtj33MbWR2ZQeoRvg uliUWe7xn7N4KQ+UN1M8JWIkS5KI4vhn1RoCTPL3Rxic52R7f4JcdC2N633bjEusPRdC H8+g== X-Forwarded-Encrypted: i=1; AJvYcCW6w3coO3WEPSLS1eQA/pqFd2AzYyv9fgtNY+EyvNjY6hP7jMjSQgqJAjmpp8rw8792e5xUc0VaLn66e/o=@vger.kernel.org X-Gm-Message-State: AOJu0Yw4gyb5wbZyFYMHkhY9ojWszGf0MUYlfET/DoK871tQCT6Y+7i9 Wkj++QoWaQSbDkfQT/MfPD7n1JiTX/+bxd7OQ2rSPO4WZbwpQQ5bAPSvvt0Y9GULGEM= X-Gm-Gg: AY/fxX7/I9Vsr/YdXqSIXAi9Hd5G/ZKONcnSaGbqLBytYU3WHpkniHU+jySfTEyQNF8 doA8KbNpLqKuCEh32F3586+/CiHk/N4epcetd2QFTeGnUALtCkafP2UubJhGb9vvI1K8E7fp0fD +Ilot8UG1sjFSYHi0KG1J0bekobWW15pcLwby1+gdEc96uWg25WhWhu3ZXaW7c/JeXhzHGcaHcg 6k+MJ4Vi9Df2R0mg/0Qifrs++Ys8OmOi3l6xgPGnTPN8YQ5ghSnq93MzWcMbVSP4YYR5PYVkoJF e9sNgciIltKebaeIaFDpLuMwxAYtgGvOKmMeHpWD3LdzHuIwgClID8WzNBEOXkbEa06W0vtZ54f ubyZmPHd+SMT9ZTbfsXmzTmdz6ZhiqQyqi98XcWkRPZLd0hd9MvcXYFYlG3BlnQylxthIUvfJtu spMYtbVo8x65PCxdJUUvkFRuDwJjF4toBSnajuTVp38CBX+Kwd+DkMCKb9xfD3rEzkxc9c3NcyF 8joZA== X-Google-Smtp-Source: AGHT+IHdzwZJtexRIcWn/+xe4M9EI9DTqd9NWIK8B+RdKJRz9/fkaZ7FEbohni14WsyusLd1OU/7tA== X-Received: by 2002:a05:6402:3550:b0:64b:5885:87d6 with SMTP id 4fb4d7f45d1cf-64b8eca9ba6mr21097989a12.24.1766838270141; Sat, 27 Dec 2025 04:24:30 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:29 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:27 +0000 Subject: [PATCH v5 05/21] dt-bindings: mfd: samsung,s2mpg10-pmic: Link to its regulators Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-5-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 Update the regulators node to link to the correct and expected samsung,s2mpg10-regulators binding, in order to describe the regulators available on this PMIC. Additionally, describe the supply inputs of the regulator rails, with the supply names matching the datasheet. While at it, update the description and example slightly. Note: S2MPG10 is typically used as the main-PMIC together with an S2MPG11 PMIC in a main/sub configuration, hence the datasheet and the binding both suffix the supplies with an 'm'. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- v4: - separate bindings for s2mpg10-pmic and s2mpg11-pmic (Krzysztof) v3: - move to new samsung,s2mpg10.yaml file - move all patternProperties to top-level --- .../bindings/mfd/samsung,s2mpg10-pmic.yaml | 57 ++++++++++++++++++= ++-- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/samsung,s2mpg10-pmic.yam= l b/Documentation/devicetree/bindings/mfd/samsung,s2mpg10-pmic.yaml index 6475cd1d2d15e07d953c8b302c90c785835985e5..0ea1a440b983a47a55fc86d6251= b89056ba51172 100644 --- a/Documentation/devicetree/bindings/mfd/samsung,s2mpg10-pmic.yaml +++ b/Documentation/devicetree/bindings/mfd/samsung,s2mpg10-pmic.yaml @@ -10,12 +10,13 @@ maintainers: - Andr=C3=A9 Draszik =20 description: | - This is part of the device tree bindings for the S2MPG family of Power - Management IC (PMIC). + This is part of the device tree bindings for the S2MPG10 Power Managemen= t IC + (PMIC). =20 The Samsung S2MPG10 is a Power Management IC for mobile applications wit= h buck converters, various LDOs, power meters, RTC, clock outputs, and addition= al - GPIO interfaces. + GPIO interfaces and is typically complemented by S2MPG10 PMIC in a main/= sub + configuration as the main PMIC. =20 properties: compatible: @@ -31,6 +32,7 @@ properties: =20 regulators: type: object + $ref: /schemas/regulator/samsung,s2mpg10-regulator.yaml description: List of child nodes that specify the regulators. =20 @@ -38,6 +40,32 @@ properties: =20 wakeup-source: true =20 +patternProperties: + "^vinb([1-9]|10)m-supply$": + description: + Phandle to the power supply for each buck rail of this PMIC. There i= s a + 1:1 mapping of supply to rail, e.g. vinb1m-supply supplies buck1m. + + "^vinl([1-9]|1[0-5])m-supply$": + description: | + Phandle to the power supply for one or multiple LDO rails of this PM= IC. + The mapping of supply to rail(s) is as follows: + vinl1m - ldo13m + vinl2m - ldo15m + vinl3m - ldo1m, ldo5m, ldo7m + vinl4m - ldo3m, ldo8m + vinl5m - ldo16m + vinl6m - ldo17m + vinl7m - ldo6m, ldo11m, ldo24m, ldo28m + vinl8m - ldo12m + vinl9m - ldo2m, ldo4m + vinl10m - ldo9m, ldo14m, ldo18m, 19m, ldo20m, ldo25m + vinl11m - ldo23m, ldo31m + vinl12m - ldo29m + vinl13m - ldo30m + vinl14m - ldo21m + vinl15m - ldo10m, ldo22m, ldo26m, ldo27m + required: - compatible - interrupts @@ -49,6 +77,7 @@ examples: - | #include #include + #include =20 pmic { compatible =3D "samsung,s2mpg10-pmic"; @@ -58,6 +87,8 @@ examples: system-power-controller; wakeup-source; =20 + vinl3m-supply =3D <&buck8m>; + clocks { compatible =3D "samsung,s2mpg10-clk"; #clock-cells =3D <1>; @@ -65,5 +96,25 @@ examples: }; =20 regulators { + buck8m { + regulator-name =3D "vdd_mif"; + regulator-min-microvolt =3D <450000>; + regulator-max-microvolt =3D <1300000>; + regulator-ramp-delay =3D <6250>; + }; + + ldo1m { + regulator-name =3D "vdd_ldo1"; + regulator-min-microvolt =3D <700000>; + regulator-max-microvolt =3D <1300000>; + }; + + ldo20m { + regulator-name =3D "vdd_dmics"; + regulator-min-microvolt =3D <700000>; + regulator-max-microvolt =3D <1300000>; + regulator-always-on; + samsung,ext-control =3D ; + }; }; }; --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4F9C32ED5B for ; Sat, 27 Dec 2025 12:24:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838275; cv=none; b=Bnbx32IY4MhZrCsRw2SYWQvuAMrSzF4Ity0iW/GbIOpJVGGE6b7jDY1u3rMU9NQk53PiY0cE3V0GDE9zJGxtMGFisUI5pVYgMrR/mZBbD7RshObPeRNasJ+xLjevVa97ZpvRzmjZoNU9s6/fNazBeBbAC9ml4IVv7rY07Of4auk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838275; c=relaxed/simple; bh=aubReYwjqANuwkLNLEVgfFzepyO8fT5RaOuCKS4xuyE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a95Kbcgq3PL+SNmeyRMJZBAiuEvagwXQw61rixLLGDteD4lILtLmd/bdePAhlMw7eNxVU/RD7H9plCvYO2GqNaz9CqGZuj7LzNxuI4pxAOeoRQvfohAhV5JyRghYrkzENjKFV+zdodwkYJJq+yUp03I9Wa84MsbjLCBqyAx+AEw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=DOluwDvN; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DOluwDvN" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-64b791b5584so11335172a12.0 for ; Sat, 27 Dec 2025 04:24:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838271; x=1767443071; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=5W1/4QyvrrrF6qZFn1ADTO8hKq/uJgt895DTkpi0Lzo=; b=DOluwDvN7MVa81mgJVKi1f/zYUnMuMESjeuXZmeDMhPO0uanfabtbYVTAk44OdDCxl khxhFP4lh1L1Fyw/Flj7vqaILNIrft4GJoWTDRwqLFeE3zJX7jff7dgwI3gRwqIQoYV5 L9KEr1UtNb3XN47Bl0hjCSGnPL6/5Jv31AtT9j7uk8zOJcf+tPDNL/ARfcjqZI5SYZRR 5OgDlfG+ASHSX32PwgN8Ll/Bqwah+skmq3ilHK14+z68p6YEXppQ90G/P58ICs7boNP8 qrK2oeoXGjwskOxzWsdRuyhIBb+G4Gl8DcOdqqXopLuEFL7FWcm0PGUjoKITM+r3hMqR /n5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838271; x=1767443071; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=5W1/4QyvrrrF6qZFn1ADTO8hKq/uJgt895DTkpi0Lzo=; b=qENcFM+IuVqj0MthgC66kfFtf70Gixg6ac6mwRSe4UuiNHh/4lBlpxRlo2QaVLt0lc IfuLGqqMzAoqf5DbpKHGWgcVCQzuaeI/AgRGrYlExWBnLfx+Pbt7X/JC/EGboU2RCGER O1lttuTt7Nm8Igrm6V/Gbb9+pqsm1eTvdanwngG8wfvXSlL1s+jwJCwXyPu/ZpEceK/u Yasg8Bsiylpyv6vDOgoQQHlqlk06LdJSXLesOaJp7lthP+P2du2+u/nXqhtQJbIXsy0p XTTF479kNGsxXXYkjYbs6dzy+c0M1z6CiVo9khXz4jU5IguYslxu5qFIB9iFKAIXF3jI 7chA== X-Forwarded-Encrypted: i=1; AJvYcCWXQl3QNp7ltm0sZNQv83ySsh3p9sxatSWYWdnH9DyUkAvgVir5puCjtC/7246NrYGferUqZcEkoNjgfWw=@vger.kernel.org X-Gm-Message-State: AOJu0Yztjd0o1PnwMLe5X5tMC9QnEBV8MW3M/G49idw7Q39P98xYeq15 d5nrIiWd0A0E1ipU/Kx47vyfLrZjRW+uVEjGcdPRjYtXqlmWiwZVgePLPCKnjS1wUC0= X-Gm-Gg: AY/fxX45cBgLmxj2OuOF10cpdUuGUHwbyWqos9lUIO7kPpEKzs1HQCVWwVuGOh7+s40 6ih14PdBTzI3Q6sOhMwR3tB5VdJFYPZdN2mX1XcRPXfmsn8qS9Y3zKZEYsD1X+LS8lnUgWpjJJq wJ0vvWJn9LIRNtQFV0KHTe5bLMfgT+BRPoF/KHRnQGQZWx5/Nhy5J1I16lZLE4/9JZ2PMaubZ6k fBxnOiW/+rmBFA0Jk5kz9XZr9kZ8lfrO8qFky0BIQj2q6Cq3cwyJqJTsempm27Yz8dEKH1wiWPn TSXGG1HSZJdqmAzy1HBYOgeqDcgaPH9JIEkml3orJLOSu5wLiUYMoI36u32nckIczaM9haskFQN EWkrbw1wCbk6ZiuyeiHnNrMtcp6KPqBhhJAHRC68Mv0Gxr4sfrFELeGT/jBrH85Sq1/4mjaMZYv gK+QZgVCGVcji0kAICNVsg8kiJFIseN+eptFZ+d0uOqMAweFF9Fg5WHL+8L/uHU2Za/rVLw8kRo 3jYfA== X-Google-Smtp-Source: AGHT+IHKNrgbFALiao/cpd7mt183lE5L6kyEfG9J/2ltABs41Gj1m0uvaXUI2oj79RKqq8FnsABI3w== X-Received: by 2002:a05:6402:51cc:b0:64b:a1e6:8018 with SMTP id 4fb4d7f45d1cf-64ba1e6832dmr21235958a12.31.1766838270685; Sat, 27 Dec 2025 04:24:30 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:30 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:28 +0000 Subject: [PATCH v5 06/21] dt-bindings: mfd: Add samsung,s2mpg11-pmic Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-6-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 The Samsung S2MPG11 PMIC is similar to the existing S2MPG10 PMIC supported by this binding, but still differs enough from it to justify a separate binding. It is a Power Management IC for mobile applications with buck converters, various LDOs, power meters, NTC thermistor inputs, and additional GPIO interfaces and typically complements an S2MPG10 PMIC in a main/sub configuration as the sub-PMIC. Like S2MPG10, communication is via the Samsung ACPM firmware and it therefore needs to be a child of the ACPM firmware node. Add the PMIC, the regulators node, and the supply inputs of the regulator rails, with the supply names matching the datasheet. Note: S2MPG11 is typically used as the sub-PMIC together with an S2MPG10 PMIC in a main/sub configuration, hence the datasheet and the binding both suffix the supplies with an 's'. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- v4: - Krzysztof: - move to new separate binding samsung,s2mpg11-pmic.yaml - add example v3: - move to new samsung,s2mpg10.yaml file - deny 'clocks' property - mention NTC thermistor inputs in commit message - move all patternProperties to top-level v2: - add | to vinb*-supply description for better formatting to mark as literal style - mention GPIOs in commit message --- .../bindings/mfd/samsung,s2mpg11-pmic.yaml | 88 ++++++++++++++++++= ++++ 1 file changed, 88 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/samsung,s2mpg11-pmic.yam= l b/Documentation/devicetree/bindings/mfd/samsung,s2mpg11-pmic.yaml new file mode 100644 index 0000000000000000000000000000000000000000..62cedbbd9d8c4cb7e9dfc039c1c= 747e334903b20 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/samsung,s2mpg11-pmic.yaml @@ -0,0 +1,88 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/samsung,s2mpg11-pmic.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung S2MPG11 Power Management IC + +maintainers: + - Andr=C3=A9 Draszik + +description: | + This is part of the device tree bindings for the S2MPG11 Power Managemen= t IC + (PMIC). + + The Samsung S2MPG11 is a Power Management IC for mobile applications wit= h buck + converters, various LDOs, power meters, NTC thermistor inputs, and addit= ional + GPIO interfaces and typically complements an S2MPG10 PMIC in a main/sub + configuration as the sub-PMIC. + +properties: + compatible: + const: samsung,s2mpg11-pmic + + interrupts: + maxItems: 1 + + regulators: + type: object + $ref: /schemas/regulator/samsung,s2mpg11-regulator.yaml + description: + List of child nodes that specify the regulators. + + wakeup-source: true + +patternProperties: + "^vinb(([1-9]|10)s|[abd])-supply$": + description: + Phandle to the power supply for each buck rail of this PMIC. There i= s a + 1:1 mapping of numbered supply to rail, e.g. vinb1s-supply supplies + buck1s. The remaining mapping is as follows + vinba - bucka + vinbb - buck boost + vinbd - buckd + + "^vinl[1-6]s-supply$": + description: | + Phandle to the power supply for one or multiple LDO rails of this PM= IC. + The mapping of supply to rail(s) is as follows + vinl1s - ldo1s, ldo2s + vinl2s - ldo8s, ldo9s + vinl3s - ldo3s, ldo5s, ldo7s, ldo15s + vinl4s - ldo10s, ldo11s, ldo12s, ldo14s + vinl5s - ldo4s, ldo6s + vinl6s - ldo13s + +required: + - compatible + - interrupts + - regulators + +additionalProperties: false + +examples: + - | + #include + #include + #include + + pmic { + compatible =3D "samsung,s2mpg11-pmic"; + interrupts-extended =3D <&gpa0 7 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&pmic_int>; + wakeup-source; + + vinl1s-supply =3D <&buck8m>; + vinl2s-supply =3D <&buck6s>; + + regulators { + buckd { + regulator-name =3D "vcc_ufs"; + regulator-ramp-delay =3D <6250>; + enable-gpios =3D <&gpp0 1 GPIO_ACTIVE_HIGH>; + samsung,ext-control =3D ; + }; + }; + }; --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFBB632F741 for ; Sat, 27 Dec 2025 12:24:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838276; cv=none; b=lR1Rk+wl/44O94ZEbQtpZGhRr/H2PDmCeMFWgkSlQtOx1KhUmyf5QkdlmDq3pMrQIQn+uMi7kdHBlMWQbs4i53XggcxHTb1Sjoj9VCrDsc4RZxgE4RSN8EUr4l98hYaB4mIszKixCFlaHbhllu1PcFRe1U/k/JbAPSZKJnhyVuc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838276; c=relaxed/simple; bh=hNm58sAFzxOO0mLfaUIDAAaiwFh3P1PTvPP9/eE7na0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FcN/w9ARg0tKAYlFVFfwlIQ4yCRKpG5whtLuGnIaZdzIORXG/4GsuMvq9zZmMdX73WVnIF7u5RJyexATicv8nt7Tf/5vj5lmUpqFtz6n6XK32KAZmKLebyohSawqovQdP2OhXYqTgpRCNYLCPA/Es6We8vZmAy2hegXi5NkSdJk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=hUTcqBfY; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hUTcqBfY" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-64b81ec3701so12287385a12.1 for ; Sat, 27 Dec 2025 04:24:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838271; x=1767443071; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ijeoVSxEaKK4ZCy9A7Kh1hnl7BcwzYQpACu/LfWJKFI=; b=hUTcqBfYxiG/4Y+wIMOkmqQtTWHzwU8IvJfIPttMG7ZbN+vMnOytnjzv3UP+sE0t15 Qro0CnHMUQZ4vF/5+Y14EKRWQpp4DlBRkxkBm+X74+DdJuswWfNV0WZeL2jF0izbsk15 sJP835BU4AV8rdOewy3F4ZkFydgAI6fHIB8d3kQn/GlYZUyYiNC36v2bPIpuXuBY0vGQ sY1+pNk7Gvv607DNgZpGK9y8n5QQ+0LpToUBy5iTj9asa9aSwm8sziIeYE0/jhsWMT0p ZVrFj6pxqk3tP1uhRhD2zRlzrzb3VdJw1oac3g82Ls+4hl7z4whwqd7fZhOs8QyJEIE/ TJow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838271; x=1767443071; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ijeoVSxEaKK4ZCy9A7Kh1hnl7BcwzYQpACu/LfWJKFI=; b=StoN13mhlv2/JA3ZRGVrbdguiGg1LwZAcveALcEMgpO1XW9Aj53ErIsTMfN2GrSYnm FQMeR8T+iHLZdd9plKI9Qf1TmXY5rS3sRjb5/lGwLiydm4LIuyhYAZ5SnhJCgNmM/Xmi i9KyUuChzgL3Sx5VyzC5oTvXzTqxbTsDZHiPxPF+Mek+dlmNx8i1TL+mlqGRbfCLRA78 /QAI7+EJDKpkjXPlNrp44the2mgxHTuIbmafyWQku1NMU1J0eHI7E2pnqCbvfGHpIu0/ YhSx4UPE4K+OnF73HxRqllfpsixe0AeaVmsqiVWFWWqvYLLZJJYIIR0qHmxFFHNVl9sh QQaw== X-Forwarded-Encrypted: i=1; AJvYcCU+vJHMyNFptxGpxkjIBSx4/kcqFHcAsWB2eZziWh7URacbt4BBpbefdN73mzUWiG5QYZISP8F2i+kvexY=@vger.kernel.org X-Gm-Message-State: AOJu0YwI0j7Vgl8AsSpVkXSLcmqS+yYI1hIWqQoWuhDr7XZRuqt2WgTs XOU9DXkbO/4VqcSHt0d/hm8391xIiAlTMoMECySOhFonHLETyyNV4ioEol6bOAGS6OA= X-Gm-Gg: AY/fxX6UDpUhyl3Ot6SFM1Pd989kKttuOqgz8Fnh0bqjk0e3b2tASrhipGIRDmSrHgK zC5uVm58R++ZLLxx3+VieMY2APXER0CL2iD7pqxOqO8ZqQrd1GhEWeUHdBQ7z9vVsBGaH9vlOAo qLVQfWj3bA6rIw8F4ZgAPqoCeegf4Z4/LCYQ5iDaKIJJTEBQE2KXeiHJ178nC1A/sgsgjgpa6Mt 7xNkgsujynDZSFbGLJfD/C4BF11lTVN4um5pWioPTrB7Czy2tifGxMTD47Opl1+q1NdT/BU8tce /3LWWW+yIaT7W0EJ7omGOqtnMsQzg3UiqEUh2oPS1CIHAtXK37QNo1kiDvb0kDNgsJnwt3cd8NI RZhz72W44nfWgf4ABbVXIpkmtULuHgS2HFk+k8nqdvUzsN8H454JO5BP1UrL2w3O/sD9y9OlK+O lYclP4bID+1RWZbSGRIhjBRobzOlw+01moZFz3z2y737CaO0cOI7ZkWa68tWaUE6FBCgX1aPGqr wdcgQ== X-Google-Smtp-Source: AGHT+IEBSl+0hYWrK+DC8PhG+Ph6J1GOfmGHMm4fDyffFTq5iRMAUOqC0B5ilD6HzpC8eImZz7CR8A== X-Received: by 2002:a05:6402:1e92:b0:64d:589a:572b with SMTP id 4fb4d7f45d1cf-64d589a59f3mr20595200a12.17.1766838271162; Sat, 27 Dec 2025 04:24:31 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:30 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:29 +0000 Subject: [PATCH v5 07/21] dt-bindings: firmware: google,gs101-acpm-ipc: add S2MPG11 secondary PMIC Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-7-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 In a typical system using the Samsung S2MPG10 PMIC, an S2MPG11 is used as a sub-PMIC. The interface for both is the ACPM firmware protocol, so update the binding to allow the relevant node and update the example here to describe the connection for both PMICs. Since we have two PMICs here, but can not use the 'reg' property (as the addressing is based on software, i.e. the ACPM firmware), the node names reflect that with their respective suffix. The existing 'pmic' therefore becomes deprecated in favour of 'pmic-1'. While at it, update the example. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- v4: - Krzysztof: - update commit message / subject - pmic -> pmic-1, pmic2 -> pmic-2 --- .../bindings/firmware/google,gs101-acpm-ipc.yaml | 50 ++++++++++++++++++= +++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-i= pc.yaml b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.= yaml index 4a1e3e3c0505aad6669cadf9b7b58aa4c7f284cb..e68f9c3ca5e2619bacc0c8d843e= c4984c0947fd8 100644 --- a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml +++ b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml @@ -37,6 +37,7 @@ properties: maxItems: 1 =20 pmic: + deprecated: true description: Child node describing the main PMIC. type: object additionalProperties: true @@ -45,6 +46,24 @@ properties: compatible: const: samsung,s2mpg10-pmic =20 + pmic-1: + description: Child node describing the main PMIC. + type: object + additionalProperties: true + + properties: + compatible: + const: samsung,s2mpg10-pmic + + pmic-2: + description: Child node describing the sub PMIC. + type: object + additionalProperties: true + + properties: + compatible: + const: samsung,s2mpg11-pmic + shmem: description: List of phandle pointing to the shared memory (SHM) area. The memory @@ -62,7 +81,9 @@ additionalProperties: false =20 examples: - | + #include #include + #include =20 power-management { compatible =3D "google,gs101-acpm-ipc"; @@ -70,10 +91,12 @@ examples: mboxes =3D <&ap2apm_mailbox>; shmem =3D <&apm_sram>; =20 - pmic { + pmic-1 { compatible =3D "samsung,s2mpg10-pmic"; interrupts-extended =3D <&gpa0 6 IRQ_TYPE_LEVEL_LOW>; =20 + vinl3m-supply =3D <&buck8m>; + regulators { ldo1m { regulator-name =3D "vdd_ldo1"; @@ -82,7 +105,13 @@ examples: regulator-always-on; }; =20 - // ... + ldo20m { + regulator-name =3D "vdd_dmics"; + regulator-min-microvolt =3D <700000>; + regulator-max-microvolt =3D <1300000>; + regulator-always-on; + samsung,ext-control =3D ; + }; =20 buck8m { regulator-name =3D "vdd_mif"; @@ -93,4 +122,21 @@ examples: }; }; }; + + pmic-2 { + compatible =3D "samsung,s2mpg11-pmic"; + interrupts-extended =3D <&gpa0 7 IRQ_TYPE_LEVEL_LOW>; + + vinl1s-supply =3D <&buck8m>; + vinl2s-supply =3D <&buck6s>; + + regulators { + buckd { + regulator-name =3D "vcc_ufs"; + regulator-ramp-delay =3D <6250>; + enable-gpios =3D <&gpp0 1 GPIO_ACTIVE_HIGH>; + samsung,ext-control =3D ; + }; + }; + }; }; --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4570332E749 for ; Sat, 27 Dec 2025 12:24:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838279; cv=none; b=JyChhtRwa738y/P+oE5b+oyvr8KaM39iUTTzmjFH+rBKY6A1DhXQK2Sf0/i+vdBojJCEU+TH7JSwGSG9SLMCDZruzxkHnYDWSg+bizPOf1rpls8JLyfe2aZ96OtfKNn8LHXEaCrXtACdJSd3RmWTef7t9S5Vvb7VH/zeuyHXXKg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838279; c=relaxed/simple; bh=Sa+/EIvgfLeQ0GYvhvwXdDpmw3zds0mNO7QpOW7aJP0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N4YG9rKFA2x/wjSHWo8X2ohiRldQFYkJG5qsQla7mlu9gZW8NnbWfHbwfGbMN5mYgal9uWtzmgXCjZC9f9XhhAQ1LrNXCOF3VDjUtobYpySlcjR2QJbC9y+ET57cyjfiw7/mXfnu5WK2EKVc8wCoHUxvriFcwpnnsAGgmHkH8T0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=q+Imsscd; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="q+Imsscd" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-64b4f730a02so13008448a12.0 for ; Sat, 27 Dec 2025 04:24:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838272; x=1767443072; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2EsAjr4P9fU1lByYIXjwfOyDc8iScS+Mv0Ho5Wv25Qo=; b=q+Imsscd6e3Io91cQKSmMv0AG+p7pknEnMbtNQPVu85ElFe0qpUPeccsUfzPzW5gNm 3kW95v4PIALX8ZRw9IJDkMuFdFslgB9iaISpxjCgFKj8EaUtikf1yWzuAJed+wDCElFK XFTCNNH6S7q520+Wr0xyD+92RSGLFfTmLQHNMYDQw2aAYZe81rLrDxONAwboxzu1i8AM cm+9l6AUuTTVN84Zrm7O7d3GTFZUZ+XS1Rr0WNjbL8JI78m5P+ItVAe+nfQUd4Yl1/hn GWErdSDamiQJm0did2yucRI2NYHEaHIjV/9+b7WK9surdmEw9pPTSPTSX3CtVVyFdwmY BO6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838272; x=1767443072; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=2EsAjr4P9fU1lByYIXjwfOyDc8iScS+Mv0Ho5Wv25Qo=; b=Hb7qgpLEa2BKdunSU7uuMzx6wOwgEI7cvqnBLrUD8n+OAw3vVPTV/m1FOrIGOMWoFB NZfuJPXsxtN6XCtiKA1d9066Fuda8u96GRhW1BmZUdcO4vzkzgLblN28s1EcTnjPbuwx GaomHkTN3bh1dgoOXgdzexR4VEO3VrWhOpcyvtcd8Oa/hvonFobUO6OY+YXF5bXnYcSf p+PmvlXNYRp8aZqO1ZN4VHWDxa6fa9/oKv3TZyxbJUV9b4xjtK6mmVlE74YFhJ4v41PT Sm9d9pGN8c1O95OC2ypCFyphMTwD7C5izKelrdocxUTV6cMZpeMsbmBsbLtxenGF56CW /5Jw== X-Forwarded-Encrypted: i=1; AJvYcCUcAXH3gYDCbjuFVw1AcPe2NuAR/I5sOSWhiAXW4kbgJg1TwG6DdW08uxxLdJnOS2MkgwCRhszvli/rnjc=@vger.kernel.org X-Gm-Message-State: AOJu0Yy7bwny1HVACEqNqN10mVlYTFp8w0LXYGmshC0nWMPF7zrInwdm 40mqDQUsXz84tn6KovW/Mm2ke/zrmonnHGvnn43RGL/irIK7oalamEYmM+eGme38hpU= X-Gm-Gg: AY/fxX7RY9EOS7BKcVrXdqBpPL7tLnxmjqnD9itGrJ5dXl33f34n2AEQFkmI/4uvgcI GDrqe3E41eI4lMlvfcl3VejYUn+ZgDhxEORf5gewuQgfpH5DZEuMFk78qctEScybnu7Qx9a6w3+ BuaLMEuAIEnQgoNw3+slnpktIAZlFSvx/TCygbUtFg4bQMsjbBmMBvUfg90mjazzUJVXF21s+tm 0fHDmlaNIHkh4qsj8JTA2nh0xTO0R5zIOMLHSJVNjHG1uMkm7LUgQxyBD48V8jQRO2Qi4LQjtfO Um2e23dbB/RRQvcU7l6QR4hXWFtD4Cjn9lVResmgj5u7im3A6zTHU/Lk/3bG2+qAq54u3k4PRmE hn+e9PKxBqlUUcsI7SxqsqbVYV2uaDDzUChKxHMKMh2xSOpWaDyCAE0Ve+bNVbNIgsVBDEesKTS rJ1aqo+kz4YgPn3UoUg9zRBghUVRGFhFqvJdlELZSZVYbNnWgqiii2jkCvf1befVTWL3a5NF684 VgJ6w== X-Google-Smtp-Source: AGHT+IHjKhYBTBvWqO2W8/12tTR4DWjtT3htxTA2IN9EmSRdLTSfBMLtisk7LyXjZOtzhcPGroxtMg== X-Received: by 2002:a05:6402:1ed6:b0:64d:1f6b:f59c with SMTP id 4fb4d7f45d1cf-64d1f6bf81fmr18185315a12.32.1766838271649; Sat, 27 Dec 2025 04:24:31 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:31 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:30 +0000 Subject: [PATCH v5 08/21] mfd: sec: s2mpg10: reorder regulators for better probe performance Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-8-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 Bucks can reasonably be supplies for LDOs, but not the other way around. Since rail registration is going to be ordered by 'enum s2mpg10_regulators', it makes sense to specify bucks first, so that during LDO registration it is more likely that the corresponding supply is known already. This can improve probe speed, as no unnecessary deferrals and retries are required anymore. Signed-off-by: Andr=C3=A9 Draszik --- include/linux/mfd/samsung/s2mpg10.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/linux/mfd/samsung/s2mpg10.h b/include/linux/mfd/samsun= g/s2mpg10.h index 9f5919b89a3c286bf1cd6b3ef0e74bc993bff01a..aec248c51f366359ff323f421e4= 53a0ec1d1dfa3 100644 --- a/include/linux/mfd/samsung/s2mpg10.h +++ b/include/linux/mfd/samsung/s2mpg10.h @@ -407,6 +407,16 @@ enum s2mpg10_meter_reg { =20 /* S2MPG10 regulator IDs */ enum s2mpg10_regulators { + S2MPG10_BUCK1, + S2MPG10_BUCK2, + S2MPG10_BUCK3, + S2MPG10_BUCK4, + S2MPG10_BUCK5, + S2MPG10_BUCK6, + S2MPG10_BUCK7, + S2MPG10_BUCK8, + S2MPG10_BUCK9, + S2MPG10_BUCK10, S2MPG10_LDO1, S2MPG10_LDO2, S2MPG10_LDO3, @@ -438,16 +448,6 @@ enum s2mpg10_regulators { S2MPG10_LDO29, S2MPG10_LDO30, S2MPG10_LDO31, - S2MPG10_BUCK1, - S2MPG10_BUCK2, - S2MPG10_BUCK3, - S2MPG10_BUCK4, - S2MPG10_BUCK5, - S2MPG10_BUCK6, - S2MPG10_BUCK7, - S2MPG10_BUCK8, - S2MPG10_BUCK9, - S2MPG10_BUCK10, S2MPG10_REGULATOR_MAX, }; =20 --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3366C32FA29 for ; Sat, 27 Dec 2025 12:24:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838281; cv=none; b=Nlo9ODT8yv3V+vMYUk9rf8p6rtX9FUnB3nfESkUZFa+3GYTaf50s7JtC/oYkEUkapFUsPYF3AlRcKzp0st8zYfcQjguuGAxC2SrhVtxgdki9DfHyfGIfenCyz4wN8tcR0ohcoiG8IoyTJVRwXGGOToMaK2FXwYuzWZFpqu3yYTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838281; c=relaxed/simple; bh=yZZkGzvYwGQerFFmscbOyxyRbKuF5tXIu+UVibCOYp0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qUMwo6ITjjUl607qlTVpAqKaK9MvCahABSFs5fxZ3Yg1GAz8duPaQg0sgx3CDTDt5JPFaUBaQJ44Qj16r5RdGAFhH0btaV3V7WwGT08LEzAAZlSQ27ej/nnWDlhpUY6lGM8kQ8YktL1YDogSd31NhwzeAgi4jaMeAYlRy2U8Xs8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=V6yf4uXg; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="V6yf4uXg" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-64b9d01e473so10537784a12.2 for ; Sat, 27 Dec 2025 04:24:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838272; x=1767443072; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=KYTDA1f3xrFUlmoHbXpxr5Q98/BstkNpIFscwqGCaCw=; b=V6yf4uXgSwJK2t1T/+ycUtBzwSiMYjNlu8UW/rEr05EneSZe8HLEppeNHQFnocUDN1 IHtz6oJHlSM/9xl93c+bQl2dSzb0uHQX6jQ9jyGsJAzKXfjRbX63itIcm32Gf22nUxG5 cNfx9o7ATeJoRUxp4BOtGEd1bCBeGPf9IFofTObDXB3AvPrA30YPhjA/sCOiPFrSPVjU M0S/rLX61A8qUJr9Ms4d8RVNgEq6vvy3hn1BLGMNYMgi/L4mvFpGbwRUYXUlDw5lJ+YP BfxyDgThEN73oApkusMnMaVsocsUdsbPyrZuh2PHohUxJR4DOg40uI+W9i4DuG2WIZhs S6xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838272; x=1767443072; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=KYTDA1f3xrFUlmoHbXpxr5Q98/BstkNpIFscwqGCaCw=; b=M7yz9nug5f4EeEkODDtLBAGDrU+21fpNTsGN7xpPBY1AcZhP0JiVP9cBWk7gqTSgr1 83kCprC+EZM2GU/gwCSkoj5/kamHHW8vJ5u7kigkakV4D1mv6wlFOLKENOFdPD6WD1Ds P8vY2BpY+lAG7BqnEpenchtFaaR/IhYzGNYPLmBL3xKXp0REk+E7KHx3B7ABjlSN0Y4i A4UE23SGUtJGNQnsyHQyLKnwpq/244/035Sw+//MaReANeF/alZ3sOS3/jvoTOkoAAJe qzZyPH4n9v7KLrzfBHpgbn7q2T5+13bnPUJFNMjaufprISOgc3UDUA+2qKSS11oo7Rhg 7rdQ== X-Forwarded-Encrypted: i=1; AJvYcCUx8inrsxry3sF2g/I2UPj/o6vprsIQA6yGCMAGtWWe8yGOFkA51bDQGQRaW36PJlE1HaQ1pK6imPY2Pas=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1Ufn/5AToS0gQF049UWYxh5JcLL3mBqmrAnFI6Wt0/DyoEXoc H5F9RgKuD1dXppbM/Bt2Ka8yqoUoiDjtHhjVtlOJtqRhuNMN8wbqTd8sfir/SlpC/t4= X-Gm-Gg: AY/fxX66efqJJW1kU6kadQuheQVHkFg+9PMqXOHZx/hV3rT7LqpIN3ko057X/0hsJ5o V5Lbajg5zll74pEE2NoQL7xnZwbWtBmsdolEgNgV58SKoDsMaIhO7u8yCdZQSnMDzcJ7AW3SqFN ssYOBdtwBGjDzUMJ1larXTca5sOyYClfoPRStJgmt8zCh+4tThppeXfzey0rgpkg36qcJKv0zZ3 pg9eCnITu8gdXGxa9u0DKeCfvO461GLqQOdjLq7/TDuggqTUg2edow0hFjmLBazJLEhh5tthnEV Dpuxg48a1sSEMRvz6lcJjIcCSrTOcndyIyiLW+TbODoEVnlpGFLYvR4oSpHBQ3U5vQUl8rWXe2M Z872mwkIHT/k2OJvhDTt1/ko/ReNzKVXW1Nz1N0ZwsbV4UHsxDMAisXho/30NCi1xyyhq8LznyS yxENJY6DN06NwHYhKJADYYvE6SBLvMnDhS3TXqCTTwVpIjQK6BbstSV6aFHewaXE6++x10PHcyM pGAHKoyUFM0iB7p X-Google-Smtp-Source: AGHT+IGgiv1HVmk75u4Im5qnyRJ6RKDBgwSFPIpeF98k10F/dq7PBbFCXsLWgPngt64eHj70jeEAyg== X-Received: by 2002:a05:6402:2809:b0:647:9380:103c with SMTP id 4fb4d7f45d1cf-64b8e94d9d4mr29763953a12.13.1766838272181; Sat, 27 Dec 2025 04:24:32 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:31 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:31 +0000 Subject: [PATCH v5 09/21] mfd: sec: Add support for S2MPG11 PMIC via ACPM Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-9-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 Add support for Samsung's S2MPG11 PMIC, which is a Power Management IC for mobile applications with buck converters, various LDOs, power meters, NTC thermistor inputs, and additional GPIO interfaces. It typically complements an S2MPG10 PMIC in a main/sub configuration as the sub-PMIC. Like S2MPG10, communication is not via I2C, but via the Samsung ACPM firmware. While at it, we can also switch to asynchronous probe, which helps with probe performance, as the drivers for s2mpg10 and s2mpg11 can probe in parallel. Note: The firmware uses the ACPM channel ID and the Speedy channel ID to select the PMIC address. Since these are firmware properties, they can not be retrieved from DT, but instead are deducted from the compatible for now. Signed-off-by: Andr=C3=A9 Draszik --- Note: checkpatch suggests to update MAINTAINERS, but the new file is covered already due to using a wildcard. v5: - rebase - one MFD cell per PMIC, not per PMIC rail (Mark) - enable PROBE_PREFER_ASYNCHRONOUS v4: - rebase against next-20251121 v3: - mention NTC thermistor inputs in commit message - one instance per actual rail, not per rail type (LDO or buck) v2: - mention GPIOs in commit message --- drivers/mfd/sec-acpm.c | 171 +++++++++++++- drivers/mfd/sec-common.c | 17 +- drivers/mfd/sec-irq.c | 85 ++++++- include/linux/mfd/samsung/core.h | 1 + include/linux/mfd/samsung/irq.h | 105 +++++++++ include/linux/mfd/samsung/s2mpg11.h | 434 ++++++++++++++++++++++++++++++++= ++++ 6 files changed, 807 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/sec-acpm.c b/drivers/mfd/sec-acpm.c index 36622069a7885c9b5fc74329efec34e1e4bcc106..537ea65685bfebae205a09a9650= c162721833286 100644 --- a/drivers/mfd/sec-acpm.c +++ b/drivers/mfd/sec-acpm.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -216,6 +217,155 @@ static const struct regmap_config s2mpg10_regmap_conf= ig_meter =3D { .cache_type =3D REGCACHE_FLAT, }; =20 +static const struct regmap_range s2mpg11_common_registers[] =3D { + regmap_reg_range(0x00, 0x02), /* CHIP_ID_S, INT, INT_MASK */ + regmap_reg_range(0x0a, 0x0c), /* Speedy control */ + regmap_reg_range(0x1a, 0x27), /* Debug */ +}; + +static const struct regmap_range s2mpg11_common_ro_registers[] =3D { + regmap_reg_range(0x00, 0x01), /* CHIP_ID_S, INT */ + regmap_reg_range(0x25, 0x27), /* Debug */ +}; + +static const struct regmap_range s2mpg11_common_nonvolatile_registers[] = =3D { + regmap_reg_range(0x00, 0x00), /* CHIP_ID_S */ + regmap_reg_range(0x02, 0x02), /* INT_MASK */ + regmap_reg_range(0x0a, 0x0c), /* Speedy control */ +}; + +static const struct regmap_range s2mpg11_common_precious_registers[] =3D { + regmap_reg_range(0x01, 0x01), /* INT */ +}; + +static const struct regmap_access_table s2mpg11_common_wr_table =3D { + .yes_ranges =3D s2mpg11_common_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_common_registers), + .no_ranges =3D s2mpg11_common_ro_registers, + .n_no_ranges =3D ARRAY_SIZE(s2mpg11_common_ro_registers), +}; + +static const struct regmap_access_table s2mpg11_common_rd_table =3D { + .yes_ranges =3D s2mpg11_common_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_common_registers), +}; + +static const struct regmap_access_table s2mpg11_common_volatile_table =3D { + .no_ranges =3D s2mpg11_common_nonvolatile_registers, + .n_no_ranges =3D ARRAY_SIZE(s2mpg11_common_nonvolatile_registers), +}; + +static const struct regmap_access_table s2mpg11_common_precious_table =3D { + .yes_ranges =3D s2mpg11_common_precious_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_common_precious_registers), +}; + +static const struct regmap_config s2mpg11_regmap_config_common =3D { + .name =3D "common", + .reg_bits =3D ACPM_ADDR_BITS, + .val_bits =3D 8, + .max_register =3D S2MPG11_COMMON_SPD_DEBUG4, + .wr_table =3D &s2mpg11_common_wr_table, + .rd_table =3D &s2mpg11_common_rd_table, + .volatile_table =3D &s2mpg11_common_volatile_table, + .precious_table =3D &s2mpg11_common_precious_table, + .num_reg_defaults_raw =3D S2MPG11_COMMON_SPD_DEBUG4 + 1, + .cache_type =3D REGCACHE_FLAT, +}; + +static const struct regmap_range s2mpg11_pmic_registers[] =3D { + regmap_reg_range(0x00, 0x5a), /* All PMIC registers */ + regmap_reg_range(0x5c, 0xb7), /* All PMIC registers */ +}; + +static const struct regmap_range s2mpg11_pmic_ro_registers[] =3D { + regmap_reg_range(0x00, 0x05), /* INTx */ + regmap_reg_range(0x0c, 0x0d), /* STATUS OFFSRC */ + regmap_reg_range(0x98, 0x98), /* GPIO input */ +}; + +static const struct regmap_range s2mpg11_pmic_nonvolatile_registers[] =3D { + regmap_reg_range(0x06, 0x0b), /* INTxM */ +}; + +static const struct regmap_range s2mpg11_pmic_precious_registers[] =3D { + regmap_reg_range(0x00, 0x05), /* INTx */ +}; + +static const struct regmap_access_table s2mpg11_pmic_wr_table =3D { + .yes_ranges =3D s2mpg11_pmic_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_pmic_registers), + .no_ranges =3D s2mpg11_pmic_ro_registers, + .n_no_ranges =3D ARRAY_SIZE(s2mpg11_pmic_ro_registers), +}; + +static const struct regmap_access_table s2mpg11_pmic_rd_table =3D { + .yes_ranges =3D s2mpg11_pmic_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_pmic_registers), +}; + +static const struct regmap_access_table s2mpg11_pmic_volatile_table =3D { + .no_ranges =3D s2mpg11_pmic_nonvolatile_registers, + .n_no_ranges =3D ARRAY_SIZE(s2mpg11_pmic_nonvolatile_registers), +}; + +static const struct regmap_access_table s2mpg11_pmic_precious_table =3D { + .yes_ranges =3D s2mpg11_pmic_precious_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_pmic_precious_registers), +}; + +static const struct regmap_config s2mpg11_regmap_config_pmic =3D { + .name =3D "pmic", + .reg_bits =3D ACPM_ADDR_BITS, + .val_bits =3D 8, + .max_register =3D S2MPG11_PMIC_LDO_SENSE2, + .wr_table =3D &s2mpg11_pmic_wr_table, + .rd_table =3D &s2mpg11_pmic_rd_table, + .volatile_table =3D &s2mpg11_pmic_volatile_table, + .precious_table =3D &s2mpg11_pmic_precious_table, + .num_reg_defaults_raw =3D S2MPG11_PMIC_LDO_SENSE2 + 1, + .cache_type =3D REGCACHE_FLAT, +}; + +static const struct regmap_range s2mpg11_meter_registers[] =3D { + regmap_reg_range(0x00, 0x3e), /* Meter config */ + regmap_reg_range(0x40, 0x8a), /* Meter data */ + regmap_reg_range(0x8d, 0x9c), /* Meter data */ +}; + +static const struct regmap_range s2mpg11_meter_ro_registers[] =3D { + regmap_reg_range(0x40, 0x9c), /* Meter data */ +}; + +static const struct regmap_access_table s2mpg11_meter_wr_table =3D { + .yes_ranges =3D s2mpg11_meter_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_meter_registers), + .no_ranges =3D s2mpg11_meter_ro_registers, + .n_no_ranges =3D ARRAY_SIZE(s2mpg11_meter_ro_registers), +}; + +static const struct regmap_access_table s2mpg11_meter_rd_table =3D { + .yes_ranges =3D s2mpg11_meter_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_meter_registers), +}; + +static const struct regmap_access_table s2mpg11_meter_volatile_table =3D { + .yes_ranges =3D s2mpg11_meter_ro_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_meter_ro_registers), +}; + +static const struct regmap_config s2mpg11_regmap_config_meter =3D { + .name =3D "meter", + .reg_bits =3D ACPM_ADDR_BITS, + .val_bits =3D 8, + .max_register =3D S2MPG11_METER_LPF_DATA_NTC7_2, + .wr_table =3D &s2mpg11_meter_wr_table, + .rd_table =3D &s2mpg11_meter_rd_table, + .volatile_table =3D &s2mpg11_meter_volatile_table, + .num_reg_defaults_raw =3D S2MPG11_METER_LPF_DATA_NTC7_2 + 1, + .cache_type =3D REGCACHE_FLAT, +}; + struct sec_pmic_acpm_shared_bus_context { const struct acpm_handle *acpm; unsigned int acpm_chan_id; @@ -364,10 +514,12 @@ static int sec_pmic_acpm_probe(struct platform_device= *pdev) if (IS_ERR(regmap_pmic)) return PTR_ERR(regmap_pmic); =20 - regmap =3D sec_pmic_acpm_regmap_init(dev, shared_ctx, SEC_PMIC_ACPM_ACCES= STYPE_RTC, - pdata->regmap_cfg_rtc, true); - if (IS_ERR(regmap)) - return PTR_ERR(regmap); + if (pdata->regmap_cfg_rtc) { + regmap =3D sec_pmic_acpm_regmap_init(dev, shared_ctx, SEC_PMIC_ACPM_ACCE= SSTYPE_RTC, + pdata->regmap_cfg_rtc, true); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + } =20 regmap =3D sec_pmic_acpm_regmap_init(dev, shared_ctx, SEC_PMIC_ACPM_ACCES= STYPE_METER, pdata->regmap_cfg_meter, true); @@ -399,8 +551,18 @@ static const struct sec_pmic_acpm_platform_data s2mpg1= 0_data =3D { .regmap_cfg_meter =3D &s2mpg10_regmap_config_meter, }; =20 +static const struct sec_pmic_acpm_platform_data s2mpg11_data =3D { + .device_type =3D S2MPG11, + .acpm_chan_id =3D 2, + .speedy_channel =3D 1, + .regmap_cfg_common =3D &s2mpg11_regmap_config_common, + .regmap_cfg_pmic =3D &s2mpg11_regmap_config_pmic, + .regmap_cfg_meter =3D &s2mpg11_regmap_config_meter, +}; + static const struct of_device_id sec_pmic_acpm_of_match[] =3D { { .compatible =3D "samsung,s2mpg10-pmic", .data =3D &s2mpg10_data, }, + { .compatible =3D "samsung,s2mpg11-pmic", .data =3D &s2mpg11_data, }, { }, }; MODULE_DEVICE_TABLE(of, sec_pmic_acpm_of_match); @@ -408,6 +570,7 @@ MODULE_DEVICE_TABLE(of, sec_pmic_acpm_of_match); static struct platform_driver sec_pmic_acpm_driver =3D { .driver =3D { .name =3D "sec-pmic-acpm", + .probe_type =3D PROBE_PREFER_ASYNCHRONOUS, .pm =3D pm_sleep_ptr(&sec_pmic_pm_ops), .of_match_table =3D sec_pmic_acpm_of_match, }, diff --git a/drivers/mfd/sec-common.c b/drivers/mfd/sec-common.c index 0021f9ae8484fd0afc2e47c813a953c91fa38546..bd8b5f9686892b286a953909c6d= 3c72e1ae85199 100644 --- a/drivers/mfd/sec-common.c +++ b/drivers/mfd/sec-common.c @@ -49,6 +49,12 @@ static const struct mfd_cell s2mpg10_devs[] =3D { MFD_CELL_OF("s2mpg10-gpio", NULL, NULL, 0, 0, "samsung,s2mpg10-gpio"), }; =20 +static const struct mfd_cell s2mpg11_devs[] =3D { + MFD_CELL_NAME("s2mpg11-meter"), + MFD_CELL_NAME("s2mpg11-regulator"), + MFD_CELL_OF("s2mpg11-gpio", NULL, NULL, 0, 0, "samsung,s2mpg11-gpio"), +}; + static const struct resource s2mps11_rtc_resources[] =3D { DEFINE_RES_IRQ_NAMED(S2MPS11_IRQ_RTCA0, "alarm"), }; @@ -104,8 +110,13 @@ static void sec_pmic_dump_rev(struct sec_pmic_dev *sec= _pmic) unsigned int val; =20 /* For s2mpg1x, the revision is in a different regmap */ - if (sec_pmic->device_type =3D=3D S2MPG10) + switch (sec_pmic->device_type) { + case S2MPG10: + case S2MPG11: return; + default: + break; + } =20 /* For each device type, the REG_ID is always the first register */ if (!regmap_read(sec_pmic->regmap_pmic, S2MPS11_REG_ID, &val)) @@ -211,6 +222,10 @@ int sec_pmic_probe(struct device *dev, int device_type= , unsigned int irq, sec_devs =3D s2mpg10_devs; num_sec_devs =3D ARRAY_SIZE(s2mpg10_devs); break; + case S2MPG11: + sec_devs =3D s2mpg11_devs; + num_sec_devs =3D ARRAY_SIZE(s2mpg11_devs); + break; case S2MPS11X: sec_devs =3D s2mps11_devs; num_sec_devs =3D ARRAY_SIZE(s2mps11_devs); diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c index 11a56154d36d251d40b40e91da514db0faa15ae3..47425deae5871ce97363d4c8add= f510678fe9813 100644 --- a/drivers/mfd/sec-irq.c +++ b/drivers/mfd/sec-irq.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -79,6 +80,64 @@ static const struct regmap_irq s2mpg10_pmic_irqs[] =3D { REGMAP_IRQ_REG(S2MPG10_IRQ_PWR_WARN_CH7, 5, S2MPG10_IRQ_PWR_WARN_CH7_MASK= ), }; =20 +static const struct regmap_irq s2mpg11_irqs[] =3D { + REGMAP_IRQ_REG(S2MPG11_COMMON_IRQ_PMIC, 0, S2MPG11_COMMON_INT_SRC_PMIC), + /* No documentation or other reference for remaining bits */ + REGMAP_IRQ_REG(S2MPG11_COMMON_IRQ_UNUSED, 0, GENMASK(7, 1)), +}; + +static const struct regmap_irq s2mpg11_pmic_irqs[] =3D { + REGMAP_IRQ_REG(S2MPG11_IRQ_PWRONF, 0, S2MPG11_IRQ_PWRONF_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWRONR, 0, S2MPG11_IRQ_PWRONR_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_PIF_TIMEOUT_MIF, 0, S2MPG11_IRQ_PIF_TIMEOUT_MI= F_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_PIF_TIMEOUTS, 0, S2MPG11_IRQ_PIF_TIMEOUTS_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_WTSR, 0, S2MPG11_IRQ_WTSR_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_SPD_ABNORMAL_STOP, 0, S2MPG11_IRQ_SPD_ABNORMAL= _STOP_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_SPD_PARITY_ERR, 0, S2MPG11_IRQ_SPD_PARITY_ERR_= MASK), + + REGMAP_IRQ_REG(S2MPG11_IRQ_140C, 1, S2MPG11_IRQ_INT140C_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_120C, 1, S2MPG11_IRQ_INT120C_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_TSD, 1, S2MPG11_IRQ_TSD_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_WRST, 1, S2MPG11_IRQ_WRST_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_CYCLE_DONE, 1, S2MPG11_IRQ_NTC_CYCLE_DONE_= MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_PMETER_OVERF, 1, S2MPG11_IRQ_PMETER_OVERF_MASK= ), + + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B1S, 2, S2MPG11_IRQ_OCP_B1S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B2S, 2, S2MPG11_IRQ_OCP_B2S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B3S, 2, S2MPG11_IRQ_OCP_B3S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B4S, 2, S2MPG11_IRQ_OCP_B4S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B5S, 2, S2MPG11_IRQ_OCP_B5S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B6S, 2, S2MPG11_IRQ_OCP_B6S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B7S, 2, S2MPG11_IRQ_OCP_B7S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B8S, 2, S2MPG11_IRQ_OCP_B8S_MASK), + + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B9S, 3, S2MPG11_IRQ_OCP_B9S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B10S, 3, S2MPG11_IRQ_OCP_B10S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_BDS, 3, S2MPG11_IRQ_OCP_BDS_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_BAS, 3, S2MPG11_IRQ_OCP_BAS_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_BBS, 3, S2MPG11_IRQ_OCP_BBS_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_WLWP_ACC, 3, S2MPG11_IRQ_WLWP_ACC_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_SPD_SRP_PKT_RST, 3, S2MPG11_IRQ_SPD_SRP_PKT_RS= T_MASK), + + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH0, 4, S2MPG11_IRQ_PWR_WARN_CH0_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH1, 4, S2MPG11_IRQ_PWR_WARN_CH1_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH2, 4, S2MPG11_IRQ_PWR_WARN_CH2_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH3, 4, S2MPG11_IRQ_PWR_WARN_CH3_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH4, 4, S2MPG11_IRQ_PWR_WARN_CH4_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH5, 4, S2MPG11_IRQ_PWR_WARN_CH5_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH6, 4, S2MPG11_IRQ_PWR_WARN_CH6_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH7, 4, S2MPG11_IRQ_PWR_WARN_CH7_MASK= ), + + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH0, 5, S2MPG11_IRQ_NTC_WARN_CH0_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH1, 5, S2MPG11_IRQ_NTC_WARN_CH1_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH2, 5, S2MPG11_IRQ_NTC_WARN_CH2_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH3, 5, S2MPG11_IRQ_NTC_WARN_CH3_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH4, 5, S2MPG11_IRQ_NTC_WARN_CH4_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH5, 5, S2MPG11_IRQ_NTC_WARN_CH5_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH6, 5, S2MPG11_IRQ_NTC_WARN_CH6_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH7, 5, S2MPG11_IRQ_NTC_WARN_CH7_MASK= ), +}; + static const struct regmap_irq s2mps11_irqs[] =3D { REGMAP_IRQ_REG(S2MPS11_IRQ_PWRONF, 0, S2MPS11_IRQ_PWRONF_MASK), REGMAP_IRQ_REG(S2MPS11_IRQ_PWRONR, 0, S2MPS11_IRQ_PWRONR_MASK), @@ -186,7 +245,7 @@ static const struct regmap_irq s5m8767_irqs[] =3D { REGMAP_IRQ_REG(S5M8767_IRQ_WTSR, 2, S5M8767_IRQ_WTSR_MASK), }; =20 -/* All S2MPG10 interrupt sources are read-only and don't require clearing = */ +/* All S2MPG1x interrupt sources are read-only and don't require clearing = */ static const struct regmap_irq_chip s2mpg10_irq_chip =3D { .name =3D "s2mpg10", .status_base =3D S2MPG10_COMMON_INT, @@ -205,6 +264,24 @@ static const struct regmap_irq_chip s2mpg10_irq_chip_p= mic =3D { .num_irqs =3D ARRAY_SIZE(s2mpg10_pmic_irqs), }; =20 +static const struct regmap_irq_chip s2mpg11_irq_chip =3D { + .name =3D "s2mpg11", + .status_base =3D S2MPG11_COMMON_INT, + .mask_base =3D S2MPG11_COMMON_INT_MASK, + .num_regs =3D 1, + .irqs =3D s2mpg11_irqs, + .num_irqs =3D ARRAY_SIZE(s2mpg11_irqs), +}; + +static const struct regmap_irq_chip s2mpg11_irq_chip_pmic =3D { + .name =3D "s2mpg11-pmic", + .status_base =3D S2MPG11_PMIC_INT1, + .mask_base =3D S2MPG11_PMIC_INT1M, + .num_regs =3D 6, + .irqs =3D s2mpg11_pmic_irqs, + .num_irqs =3D ARRAY_SIZE(s2mpg11_pmic_irqs), +}; + static const struct regmap_irq_chip s2mps11_irq_chip =3D { .name =3D "s2mps11", .irqs =3D s2mps11_irqs, @@ -303,6 +380,11 @@ static struct regmap_irq_chip_data *sec_irq_init_s2mpg= 1x(struct sec_pmic_dev *se chained_irq_chip =3D &s2mpg10_irq_chip_pmic; chained_pirq =3D S2MPG10_COMMON_IRQ_PMIC; break; + case S2MPG11: + irq_chip =3D &s2mpg11_irq_chip; + chained_irq_chip =3D &s2mpg11_irq_chip_pmic; + chained_pirq =3D S2MPG11_COMMON_IRQ_PMIC; + break; default: return dev_err_ptr_probe(sec_pmic->dev, -EINVAL, "Unsupported device typ= e %d\n", sec_pmic->device_type); @@ -339,6 +421,7 @@ struct regmap_irq_chip_data *sec_irq_init(struct sec_pm= ic_dev *sec_pmic) sec_irq_chip =3D &s2mps14_irq_chip; break; case S2MPG10: + case S2MPG11: return sec_irq_init_s2mpg1x(sec_pmic); case S2MPS11X: sec_irq_chip =3D &s2mps11_irq_chip; diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/c= ore.h index c7c3c8cd8d5f99ef0cc3188e1c3b49031f4750f2..4480c631110a6924bedb2d3a307= a4fa7ddb2c87d 100644 --- a/include/linux/mfd/samsung/core.h +++ b/include/linux/mfd/samsung/core.h @@ -40,6 +40,7 @@ enum sec_device_type { S2DOS05, S2MPA01, S2MPG10, + S2MPG11, S2MPS11X, S2MPS13X, S2MPS14X, diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/ir= q.h index 8402a5f8e18ab62b4bec89541d785442674adee0..6eab95de6fa8376e114dc5b347e= 61552a595331f 100644 --- a/include/linux/mfd/samsung/irq.h +++ b/include/linux/mfd/samsung/irq.h @@ -166,6 +166,111 @@ enum s2mpg10_irq { S2MPG10_IRQ_NR, }; =20 +enum s2mpg11_common_irq { + /* Top-level (common) block */ + S2MPG11_COMMON_IRQ_PMIC, + S2MPG11_COMMON_IRQ_UNUSED, +}; + +enum s2mpg11_irq { + /* PMIC */ + S2MPG11_IRQ_PWRONF, + S2MPG11_IRQ_PWRONR, + S2MPG11_IRQ_PIF_TIMEOUT_MIF, + S2MPG11_IRQ_PIF_TIMEOUTS, + S2MPG11_IRQ_WTSR, + S2MPG11_IRQ_SPD_ABNORMAL_STOP, + S2MPG11_IRQ_SPD_PARITY_ERR, +#define S2MPG11_IRQ_PWRONF_MASK BIT(0) +#define S2MPG11_IRQ_PWRONR_MASK BIT(1) +#define S2MPG11_IRQ_PIF_TIMEOUT_MIF_MASK BIT(3) +#define S2MPG11_IRQ_PIF_TIMEOUTS_MASK BIT(4) +#define S2MPG11_IRQ_WTSR_MASK BIT(5) +#define S2MPG11_IRQ_SPD_ABNORMAL_STOP_MASK BIT(6) +#define S2MPG11_IRQ_SPD_PARITY_ERR_MASK BIT(7) + + S2MPG11_IRQ_140C, + S2MPG11_IRQ_120C, + S2MPG11_IRQ_TSD, + S2MPG11_IRQ_WRST, + S2MPG11_IRQ_NTC_CYCLE_DONE, + S2MPG11_IRQ_PMETER_OVERF, +#define S2MPG11_IRQ_INT140C_MASK BIT(0) +#define S2MPG11_IRQ_INT120C_MASK BIT(1) +#define S2MPG11_IRQ_TSD_MASK BIT(2) +#define S2MPG11_IRQ_WRST_MASK BIT(5) +#define S2MPG11_IRQ_NTC_CYCLE_DONE_MASK BIT(6) +#define S2MPG11_IRQ_PMETER_OVERF_MASK BIT(7) + + S2MPG11_IRQ_OCP_B1S, + S2MPG11_IRQ_OCP_B2S, + S2MPG11_IRQ_OCP_B3S, + S2MPG11_IRQ_OCP_B4S, + S2MPG11_IRQ_OCP_B5S, + S2MPG11_IRQ_OCP_B6S, + S2MPG11_IRQ_OCP_B7S, + S2MPG11_IRQ_OCP_B8S, +#define S2MPG11_IRQ_OCP_B1S_MASK BIT(0) +#define S2MPG11_IRQ_OCP_B2S_MASK BIT(1) +#define S2MPG11_IRQ_OCP_B3S_MASK BIT(2) +#define S2MPG11_IRQ_OCP_B4S_MASK BIT(3) +#define S2MPG11_IRQ_OCP_B5S_MASK BIT(4) +#define S2MPG11_IRQ_OCP_B6S_MASK BIT(5) +#define S2MPG11_IRQ_OCP_B7S_MASK BIT(6) +#define S2MPG11_IRQ_OCP_B8S_MASK BIT(7) + + S2MPG11_IRQ_OCP_B9S, + S2MPG11_IRQ_OCP_B10S, + S2MPG11_IRQ_OCP_BDS, + S2MPG11_IRQ_OCP_BAS, + S2MPG11_IRQ_OCP_BBS, + S2MPG11_IRQ_WLWP_ACC, + S2MPG11_IRQ_SPD_SRP_PKT_RST, +#define S2MPG11_IRQ_OCP_B9S_MASK BIT(0) +#define S2MPG11_IRQ_OCP_B10S_MASK BIT(1) +#define S2MPG11_IRQ_OCP_BDS_MASK BIT(2) +#define S2MPG11_IRQ_OCP_BAS_MASK BIT(3) +#define S2MPG11_IRQ_OCP_BBS_MASK BIT(4) +#define S2MPG11_IRQ_WLWP_ACC_MASK BIT(5) +#define S2MPG11_IRQ_SPD_SRP_PKT_RST_MASK BIT(7) + + S2MPG11_IRQ_PWR_WARN_CH0, + S2MPG11_IRQ_PWR_WARN_CH1, + S2MPG11_IRQ_PWR_WARN_CH2, + S2MPG11_IRQ_PWR_WARN_CH3, + S2MPG11_IRQ_PWR_WARN_CH4, + S2MPG11_IRQ_PWR_WARN_CH5, + S2MPG11_IRQ_PWR_WARN_CH6, + S2MPG11_IRQ_PWR_WARN_CH7, +#define S2MPG11_IRQ_PWR_WARN_CH0_MASK BIT(0) +#define S2MPG11_IRQ_PWR_WARN_CH1_MASK BIT(1) +#define S2MPG11_IRQ_PWR_WARN_CH2_MASK BIT(2) +#define S2MPG11_IRQ_PWR_WARN_CH3_MASK BIT(3) +#define S2MPG11_IRQ_PWR_WARN_CH4_MASK BIT(4) +#define S2MPG11_IRQ_PWR_WARN_CH5_MASK BIT(5) +#define S2MPG11_IRQ_PWR_WARN_CH6_MASK BIT(6) +#define S2MPG11_IRQ_PWR_WARN_CH7_MASK BIT(7) + + S2MPG11_IRQ_NTC_WARN_CH0, + S2MPG11_IRQ_NTC_WARN_CH1, + S2MPG11_IRQ_NTC_WARN_CH2, + S2MPG11_IRQ_NTC_WARN_CH3, + S2MPG11_IRQ_NTC_WARN_CH4, + S2MPG11_IRQ_NTC_WARN_CH5, + S2MPG11_IRQ_NTC_WARN_CH6, + S2MPG11_IRQ_NTC_WARN_CH7, +#define S2MPG11_IRQ_NTC_WARN_CH0_MASK BIT(0) +#define S2MPG11_IRQ_NTC_WARN_CH1_MASK BIT(1) +#define S2MPG11_IRQ_NTC_WARN_CH2_MASK BIT(2) +#define S2MPG11_IRQ_NTC_WARN_CH3_MASK BIT(3) +#define S2MPG11_IRQ_NTC_WARN_CH4_MASK BIT(4) +#define S2MPG11_IRQ_NTC_WARN_CH5_MASK BIT(5) +#define S2MPG11_IRQ_NTC_WARN_CH6_MASK BIT(6) +#define S2MPG11_IRQ_NTC_WARN_CH7_MASK BIT(7) + + S2MPG11_IRQ_NR, +}; + enum s2mps11_irq { S2MPS11_IRQ_PWRONF, S2MPS11_IRQ_PWRONR, diff --git a/include/linux/mfd/samsung/s2mpg11.h b/include/linux/mfd/samsun= g/s2mpg11.h new file mode 100644 index 0000000000000000000000000000000000000000..66daa3bafa6e55eef5831b50143= e8d580bb43f72 --- /dev/null +++ b/include/linux/mfd/samsung/s2mpg11.h @@ -0,0 +1,434 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2015 Samsung Electronics + * Copyright 2020 Google Inc + * Copyright 2025 Linaro Ltd. + */ + +#ifndef __LINUX_MFD_S2MPG11_H +#define __LINUX_MFD_S2MPG11_H + +/* Common registers (type 0x000) */ +enum s2mpg11_common_reg { + S2MPG11_COMMON_CHIPID, + S2MPG11_COMMON_INT, + S2MPG11_COMMON_INT_MASK, + S2MPG11_COMMON_SPD_CTRL1 =3D 0x0a, + S2MPG11_COMMON_SPD_CTRL2, + S2MPG11_COMMON_SPD_CTRL3, + S2MPG11_COMMON_MON1SEL =3D 0x1a, + S2MPG11_COMMON_MON2SEL, + S2MPG11_COMMON_MONR, + S2MPG11_COMMON_DEBUG_CTRL1, + S2MPG11_COMMON_DEBUG_CTRL2, + S2MPG11_COMMON_DEBUG_CTRL3, + S2MPG11_COMMON_DEBUG_CTRL4, + S2MPG11_COMMON_DEBUG_CTRL5, + S2MPG11_COMMON_DEBUG_CTRL6, + S2MPG11_COMMON_TEST_MODE1, + S2MPG11_COMMON_SPD_DEBUG1, + S2MPG11_COMMON_SPD_DEBUG2, + S2MPG11_COMMON_SPD_DEBUG3, + S2MPG11_COMMON_SPD_DEBUG4, +}; + +/* For S2MPG11_COMMON_INT and S2MPG11_COMMON_INT_MASK */ +#define S2MPG11_COMMON_INT_SRC GENMASK(2, 0) +#define S2MPG11_COMMON_INT_SRC_PMIC BIT(0) + +/* PMIC registers (type 0x100) */ +enum s2mpg11_pmic_reg { + S2MPG11_PMIC_INT1, + S2MPG11_PMIC_INT2, + S2MPG11_PMIC_INT3, + S2MPG11_PMIC_INT4, + S2MPG11_PMIC_INT5, + S2MPG11_PMIC_INT6, + S2MPG11_PMIC_INT1M, + S2MPG11_PMIC_INT2M, + S2MPG11_PMIC_INT3M, + S2MPG11_PMIC_INT4M, + S2MPG11_PMIC_INT5M, + S2MPG11_PMIC_INT6M, + S2MPG11_PMIC_STATUS1, + S2MPG11_PMIC_OFFSRC, + S2MPG11_PMIC_COMMON_CTRL1, + S2MPG11_PMIC_COMMON_CTRL2, + S2MPG11_PMIC_COMMON_CTRL3, + S2MPG11_PMIC_MIMICKING_CTRL, + S2MPG11_PMIC_B1S_CTRL, + S2MPG11_PMIC_B1S_OUT1, + S2MPG11_PMIC_B1S_OUT2, + S2MPG11_PMIC_B2S_CTRL, + S2MPG11_PMIC_B2S_OUT1, + S2MPG11_PMIC_B2S_OUT2, + S2MPG11_PMIC_B3S_CTRL, + S2MPG11_PMIC_B3S_OUT1, + S2MPG11_PMIC_B3S_OUT2, + S2MPG11_PMIC_B4S_CTRL, + S2MPG11_PMIC_B4S_OUT, + S2MPG11_PMIC_B5S_CTRL, + S2MPG11_PMIC_B5S_OUT, + S2MPG11_PMIC_B6S_CTRL, + S2MPG11_PMIC_B6S_OUT1, + S2MPG11_PMIC_B6S_OUT2, + S2MPG11_PMIC_B7S_CTRL, + S2MPG11_PMIC_B7S_OUT1, + S2MPG11_PMIC_B7S_OUT2, + S2MPG11_PMIC_B8S_CTRL, + S2MPG11_PMIC_B8S_OUT1, + S2MPG11_PMIC_B8S_OUT2, + S2MPG11_PMIC_B9S_CTRL, + S2MPG11_PMIC_B9S_OUT1, + S2MPG11_PMIC_B9S_OUT2, + S2MPG11_PMIC_B10S_CTRL, + S2MPG11_PMIC_B10S_OUT, + S2MPG11_PMIC_BUCKD_CTRL, + S2MPG11_PMIC_BUCKD_OUT, + S2MPG11_PMIC_BUCKA_CTRL, + S2MPG11_PMIC_BUCKA_OUT, + S2MPG11_PMIC_BB_CTRL, + S2MPG11_PMIC_BB_OUT1, + S2MPG11_PMIC_BB_OUT2, + S2MPG11_PMIC_BUCK1S_USONIC, + S2MPG11_PMIC_BUCK2S_USONIC, + S2MPG11_PMIC_BUCK3S_USONIC, + S2MPG11_PMIC_BUCK4S_USONIC, + S2MPG11_PMIC_BUCK5S_USONIC, + S2MPG11_PMIC_BUCK6S_USONIC, + S2MPG11_PMIC_BUCK7S_USONIC, + S2MPG11_PMIC_BUCK8S_USONIC, + S2MPG11_PMIC_BUCK9S_USONIC, + S2MPG11_PMIC_BUCK10S_USONIC, + S2MPG11_PMIC_BUCKD_USONIC, + S2MPG11_PMIC_BUCKA_USONIC, + S2MPG11_PMIC_BB_USONIC, + S2MPG11_PMIC_L1S_CTRL1, + S2MPG11_PMIC_L1S_CTRL2, + S2MPG11_PMIC_L2S_CTRL1, + S2MPG11_PMIC_L2S_CTRL2, + S2MPG11_PMIC_L3S_CTRL, + S2MPG11_PMIC_L4S_CTRL, + S2MPG11_PMIC_L5S_CTRL, + S2MPG11_PMIC_L6S_CTRL, + S2MPG11_PMIC_L7S_CTRL, + S2MPG11_PMIC_L8S_CTRL, + S2MPG11_PMIC_L9S_CTRL, + S2MPG11_PMIC_L10S_CTRL, + S2MPG11_PMIC_L11S_CTRL, + S2MPG11_PMIC_L12S_CTRL, + S2MPG11_PMIC_L13S_CTRL, + S2MPG11_PMIC_L14S_CTRL, + S2MPG11_PMIC_L15S_CTRL, + S2MPG11_PMIC_LDO_CTRL1, + S2MPG11_PMIC_LDO_DSCH1, + S2MPG11_PMIC_LDO_DSCH2, + S2MPG11_PMIC_DVS_RAMP1, + S2MPG11_PMIC_DVS_RAMP2, + S2MPG11_PMIC_DVS_RAMP3, + S2MPG11_PMIC_DVS_RAMP4, + S2MPG11_PMIC_DVS_RAMP5, + S2MPG11_PMIC_DVS_RAMP6, + /* Nothing @ 0x5a */ + S2MPG11_PMIC_DVS_SYNC_CTRL1 =3D 0x5c, + S2MPG11_PMIC_DVS_SYNC_CTRL2, + S2MPG11_PMIC_OFF_CTRL1, + S2MPG11_PMIC_OFF_CTRL2, + S2MPG11_PMIC_OFF_CTRL3, + S2MPG11_PMIC_SEQ_CTRL1, + S2MPG11_PMIC_SEQ_CTRL2, + S2MPG11_PMIC_SEQ_CTRL3, + S2MPG11_PMIC_SEQ_CTRL4, + S2MPG11_PMIC_SEQ_CTRL5, + S2MPG11_PMIC_SEQ_CTRL6, + S2MPG11_PMIC_SEQ_CTRL7, + S2MPG11_PMIC_SEQ_CTRL8, + S2MPG11_PMIC_SEQ_CTRL9, + S2MPG11_PMIC_SEQ_CTRL10, + S2MPG11_PMIC_SEQ_CTRL11, + S2MPG11_PMIC_SEQ_CTRL12, + S2MPG11_PMIC_SEQ_CTRL13, + S2MPG11_PMIC_SEQ_CTRL14, + S2MPG11_PMIC_SEQ_CTRL15, + S2MPG11_PMIC_SEQ_CTRL16, + S2MPG11_PMIC_SEQ_CTRL17, + S2MPG11_PMIC_SEQ_CTRL18, + S2MPG11_PMIC_SEQ_CTRL19, + S2MPG11_PMIC_SEQ_CTRL20, + S2MPG11_PMIC_SEQ_CTRL21, + S2MPG11_PMIC_SEQ_CTRL22, + S2MPG11_PMIC_SEQ_CTRL23, + S2MPG11_PMIC_SEQ_CTRL24, + S2MPG11_PMIC_SEQ_CTRL25, + S2MPG11_PMIC_SEQ_CTRL26, + S2MPG11_PMIC_SEQ_CTRL27, + S2MPG11_PMIC_OFF_SEQ_CTRL1, + S2MPG11_PMIC_OFF_SEQ_CTRL2, + S2MPG11_PMIC_OFF_SEQ_CTRL3, + S2MPG11_PMIC_OFF_SEQ_CTRL4, + S2MPG11_PMIC_OFF_SEQ_CTRL5, + S2MPG11_PMIC_OFF_SEQ_CTRL6, + S2MPG11_PMIC_OFF_SEQ_CTRL7, + S2MPG11_PMIC_OFF_SEQ_CTRL8, + S2MPG11_PMIC_OFF_SEQ_CTRL9, + S2MPG11_PMIC_OFF_SEQ_CTRL10, + S2MPG11_PMIC_OFF_SEQ_CTRL11, + S2MPG11_PMIC_OFF_SEQ_CTRL12, + S2MPG11_PMIC_OFF_SEQ_CTRL13, + S2MPG11_PMIC_OFF_SEQ_CTRL14, + S2MPG11_PMIC_OFF_SEQ_CTRL15, + S2MPG11_PMIC_OFF_SEQ_CTRL16, + S2MPG11_PMIC_OFF_SEQ_CTRL17, + S2MPG11_PMIC_PCTRLSEL1, + S2MPG11_PMIC_PCTRLSEL2, + S2MPG11_PMIC_PCTRLSEL3, + S2MPG11_PMIC_PCTRLSEL4, + S2MPG11_PMIC_PCTRLSEL5, + S2MPG11_PMIC_PCTRLSEL6, + S2MPG11_PMIC_DCTRLSEL1, + S2MPG11_PMIC_DCTRLSEL2, + S2MPG11_PMIC_DCTRLSEL3, + S2MPG11_PMIC_DCTRLSEL4, + S2MPG11_PMIC_DCTRLSEL5, + S2MPG11_PMIC_GPIO_CTRL1, + S2MPG11_PMIC_GPIO_CTRL2, + S2MPG11_PMIC_GPIO_CTRL3, + S2MPG11_PMIC_GPIO_CTRL4, + S2MPG11_PMIC_GPIO_CTRL5, + S2MPG11_PMIC_GPIO_CTRL6, + S2MPG11_PMIC_GPIO_CTRL7, + S2MPG11_PMIC_B2S_OCP_WARN, + S2MPG11_PMIC_B2S_OCP_WARN_X, + S2MPG11_PMIC_B2S_OCP_WARN_Y, + S2MPG11_PMIC_B2S_OCP_WARN_Z, + S2MPG11_PMIC_B2S_SOFT_OCP_WARN, + S2MPG11_PMIC_B2S_SOFT_OCP_WARN_X, + S2MPG11_PMIC_B2S_SOFT_OCP_WARN_Y, + S2MPG11_PMIC_B2S_SOFT_OCP_WARN_Z, + S2MPG11_PMIC_BUCK_OCP_EN1, + S2MPG11_PMIC_BUCK_OCP_EN2, + S2MPG11_PMIC_BUCK_OCP_PD_EN1, + S2MPG11_PMIC_BUCK_OCP_PD_EN2, + S2MPG11_PMIC_BUCK_OCP_CTRL1, + S2MPG11_PMIC_BUCK_OCP_CTRL2, + S2MPG11_PMIC_BUCK_OCP_CTRL3, + S2MPG11_PMIC_BUCK_OCP_CTRL4, + S2MPG11_PMIC_BUCK_OCP_CTRL5, + S2MPG11_PMIC_BUCK_OCP_CTRL6, + S2MPG11_PMIC_BUCK_OCP_CTRL7, + S2MPG11_PMIC_PIF_CTRL, + S2MPG11_PMIC_BUCK_HR_MODE1, + S2MPG11_PMIC_BUCK_HR_MODE2, + S2MPG11_PMIC_FAULTOUT_CTRL, + S2MPG11_PMIC_LDO_SENSE1, + S2MPG11_PMIC_LDO_SENSE2, +}; + +/* For S2MPG11_PMIC_PCTRLSELx */ +#define S2MPG11_PCTRLSEL_PWREN 0x1 /* PWREN pin */ +#define S2MPG11_PCTRLSEL_PWREN_TRG 0x2 /* PWREN_TRG bit in MIMICKING= _CTRL */ +#define S2MPG11_PCTRLSEL_PWREN_MIF 0x3 /* PWREN_MIF pin */ +#define S2MPG11_PCTRLSEL_PWREN_MIF_TRG 0x4 /* PWREN_MIF_TRG bit in MIMIC= KING_CTRL */ +#define S2MPG11_PCTRLSEL_AP_ACTIVE_N 0x5 /* ~AP_ACTIVE_N pin */ +#define S2MPG11_PCTRLSEL_AP_ACTIVE_N_TRG 0x6 /* ~AP_ACTIVE_N_TRG bit in MI= MICKING_CTRL */ +#define S2MPG11_PCTRLSEL_G3D_EN 0x7 /* G3D_EN pin */ +#define S2MPG11_PCTRLSEL_G3D_EN2 0x8 /* G3D_EN & ~AP_ACTIVE_N pins= */ +#define S2MPG11_PCTRLSEL_AOC_VDD 0x9 /* AOC_VDD pin */ +#define S2MPG11_PCTRLSEL_AOC_RET 0xa /* AOC_RET pin */ +#define S2MPG11_PCTRLSEL_UFS_EN 0xb /* UFS_EN pin */ +#define S2MPG11_PCTRLSEL_LDO13S_EN 0xc /* VLDO13S_EN pin */ + +/* Meter registers (type 0xa00) */ +enum s2mpg11_meter_reg { + S2MPG11_METER_CTRL1, + S2MPG11_METER_CTRL2, + S2MPG11_METER_CTRL3, + S2MPG11_METER_CTRL4, + S2MPG11_METER_CTRL5, + S2MPG11_METER_BUCKEN1, + S2MPG11_METER_BUCKEN2, + S2MPG11_METER_MUXSEL0, + S2MPG11_METER_MUXSEL1, + S2MPG11_METER_MUXSEL2, + S2MPG11_METER_MUXSEL3, + S2MPG11_METER_MUXSEL4, + S2MPG11_METER_MUXSEL5, + S2MPG11_METER_MUXSEL6, + S2MPG11_METER_MUXSEL7, + S2MPG11_METER_LPF_C0_0, + S2MPG11_METER_LPF_C0_1, + S2MPG11_METER_LPF_C0_2, + S2MPG11_METER_LPF_C0_3, + S2MPG11_METER_LPF_C0_4, + S2MPG11_METER_LPF_C0_5, + S2MPG11_METER_LPF_C0_6, + S2MPG11_METER_LPF_C0_7, + S2MPG11_METER_NTC_LPF_C0_0, + S2MPG11_METER_NTC_LPF_C0_1, + S2MPG11_METER_NTC_LPF_C0_2, + S2MPG11_METER_NTC_LPF_C0_3, + S2MPG11_METER_NTC_LPF_C0_4, + S2MPG11_METER_NTC_LPF_C0_5, + S2MPG11_METER_NTC_LPF_C0_6, + S2MPG11_METER_NTC_LPF_C0_7, + S2MPG11_METER_PWR_WARN0, + S2MPG11_METER_PWR_WARN1, + S2MPG11_METER_PWR_WARN2, + S2MPG11_METER_PWR_WARN3, + S2MPG11_METER_PWR_WARN4, + S2MPG11_METER_PWR_WARN5, + S2MPG11_METER_PWR_WARN6, + S2MPG11_METER_PWR_WARN7, + S2MPG11_METER_NTC_L_WARN0, + S2MPG11_METER_NTC_L_WARN1, + S2MPG11_METER_NTC_L_WARN2, + S2MPG11_METER_NTC_L_WARN3, + S2MPG11_METER_NTC_L_WARN4, + S2MPG11_METER_NTC_L_WARN5, + S2MPG11_METER_NTC_L_WARN6, + S2MPG11_METER_NTC_L_WARN7, + S2MPG11_METER_NTC_H_WARN0, + S2MPG11_METER_NTC_H_WARN1, + S2MPG11_METER_NTC_H_WARN2, + S2MPG11_METER_NTC_H_WARN3, + S2MPG11_METER_NTC_H_WARN4, + S2MPG11_METER_NTC_H_WARN5, + S2MPG11_METER_NTC_H_WARN6, + S2MPG11_METER_NTC_H_WARN7, + S2MPG11_METER_PWR_HYS1, + S2MPG11_METER_PWR_HYS2, + S2MPG11_METER_PWR_HYS3, + S2MPG11_METER_PWR_HYS4, + S2MPG11_METER_NTC_HYS1, + S2MPG11_METER_NTC_HYS2, + S2MPG11_METER_NTC_HYS3, + S2MPG11_METER_NTC_HYS4, + /* Nothing @ 0x3f */ + S2MPG11_METER_ACC_DATA_CH0_1 =3D 0x40, + S2MPG11_METER_ACC_DATA_CH0_2, + S2MPG11_METER_ACC_DATA_CH0_3, + S2MPG11_METER_ACC_DATA_CH0_4, + S2MPG11_METER_ACC_DATA_CH0_5, + S2MPG11_METER_ACC_DATA_CH0_6, + S2MPG11_METER_ACC_DATA_CH1_1, + S2MPG11_METER_ACC_DATA_CH1_2, + S2MPG11_METER_ACC_DATA_CH1_3, + S2MPG11_METER_ACC_DATA_CH1_4, + S2MPG11_METER_ACC_DATA_CH1_5, + S2MPG11_METER_ACC_DATA_CH1_6, + S2MPG11_METER_ACC_DATA_CH2_1, + S2MPG11_METER_ACC_DATA_CH2_2, + S2MPG11_METER_ACC_DATA_CH2_3, + S2MPG11_METER_ACC_DATA_CH2_4, + S2MPG11_METER_ACC_DATA_CH2_5, + S2MPG11_METER_ACC_DATA_CH2_6, + S2MPG11_METER_ACC_DATA_CH3_1, + S2MPG11_METER_ACC_DATA_CH3_2, + S2MPG11_METER_ACC_DATA_CH3_3, + S2MPG11_METER_ACC_DATA_CH3_4, + S2MPG11_METER_ACC_DATA_CH3_5, + S2MPG11_METER_ACC_DATA_CH3_6, + S2MPG11_METER_ACC_DATA_CH4_1, + S2MPG11_METER_ACC_DATA_CH4_2, + S2MPG11_METER_ACC_DATA_CH4_3, + S2MPG11_METER_ACC_DATA_CH4_4, + S2MPG11_METER_ACC_DATA_CH4_5, + S2MPG11_METER_ACC_DATA_CH4_6, + S2MPG11_METER_ACC_DATA_CH5_1, + S2MPG11_METER_ACC_DATA_CH5_2, + S2MPG11_METER_ACC_DATA_CH5_3, + S2MPG11_METER_ACC_DATA_CH5_4, + S2MPG11_METER_ACC_DATA_CH5_5, + S2MPG11_METER_ACC_DATA_CH5_6, + S2MPG11_METER_ACC_DATA_CH6_1, + S2MPG11_METER_ACC_DATA_CH6_2, + S2MPG11_METER_ACC_DATA_CH6_3, + S2MPG11_METER_ACC_DATA_CH6_4, + S2MPG11_METER_ACC_DATA_CH6_5, + S2MPG11_METER_ACC_DATA_CH6_6, + S2MPG11_METER_ACC_DATA_CH7_1, + S2MPG11_METER_ACC_DATA_CH7_2, + S2MPG11_METER_ACC_DATA_CH7_3, + S2MPG11_METER_ACC_DATA_CH7_4, + S2MPG11_METER_ACC_DATA_CH7_5, + S2MPG11_METER_ACC_DATA_CH7_6, + S2MPG11_METER_ACC_COUNT_1, + S2MPG11_METER_ACC_COUNT_2, + S2MPG11_METER_ACC_COUNT_3, + S2MPG11_METER_LPF_DATA_CH0_1, + S2MPG11_METER_LPF_DATA_CH0_2, + S2MPG11_METER_LPF_DATA_CH0_3, + S2MPG11_METER_LPF_DATA_CH1_1, + S2MPG11_METER_LPF_DATA_CH1_2, + S2MPG11_METER_LPF_DATA_CH1_3, + S2MPG11_METER_LPF_DATA_CH2_1, + S2MPG11_METER_LPF_DATA_CH2_2, + S2MPG11_METER_LPF_DATA_CH2_3, + S2MPG11_METER_LPF_DATA_CH3_1, + S2MPG11_METER_LPF_DATA_CH3_2, + S2MPG11_METER_LPF_DATA_CH3_3, + S2MPG11_METER_LPF_DATA_CH4_1, + S2MPG11_METER_LPF_DATA_CH4_2, + S2MPG11_METER_LPF_DATA_CH4_3, + S2MPG11_METER_LPF_DATA_CH5_1, + S2MPG11_METER_LPF_DATA_CH5_2, + S2MPG11_METER_LPF_DATA_CH5_3, + S2MPG11_METER_LPF_DATA_CH6_1, + S2MPG11_METER_LPF_DATA_CH6_2, + S2MPG11_METER_LPF_DATA_CH6_3, + S2MPG11_METER_LPF_DATA_CH7_1, + S2MPG11_METER_LPF_DATA_CH7_2, + S2MPG11_METER_LPF_DATA_CH7_3, + /* Nothing @ 0x8b 0x8c */ + S2MPG11_METER_LPF_DATA_NTC0_1 =3D 0x8d, + S2MPG11_METER_LPF_DATA_NTC0_2, + S2MPG11_METER_LPF_DATA_NTC1_1, + S2MPG11_METER_LPF_DATA_NTC1_2, + S2MPG11_METER_LPF_DATA_NTC2_1, + S2MPG11_METER_LPF_DATA_NTC2_2, + S2MPG11_METER_LPF_DATA_NTC3_1, + S2MPG11_METER_LPF_DATA_NTC3_2, + S2MPG11_METER_LPF_DATA_NTC4_1, + S2MPG11_METER_LPF_DATA_NTC4_2, + S2MPG11_METER_LPF_DATA_NTC5_1, + S2MPG11_METER_LPF_DATA_NTC5_2, + S2MPG11_METER_LPF_DATA_NTC6_1, + S2MPG11_METER_LPF_DATA_NTC6_2, + S2MPG11_METER_LPF_DATA_NTC7_1, + S2MPG11_METER_LPF_DATA_NTC7_2, +}; + +/* S2MPG11 regulator IDs */ +enum s2mpg11_regulators { + S2MPG11_BUCKBOOST, + S2MPG11_BUCK1, + S2MPG11_BUCK2, + S2MPG11_BUCK3, + S2MPG11_BUCK4, + S2MPG11_BUCK5, + S2MPG11_BUCK6, + S2MPG11_BUCK7, + S2MPG11_BUCK8, + S2MPG11_BUCK9, + S2MPG11_BUCK10, + S2MPG11_BUCKD, + S2MPG11_BUCKA, + S2MPG11_LDO1, + S2MPG11_LDO2, + S2MPG11_LDO3, + S2MPG11_LDO4, + S2MPG11_LDO5, + S2MPG11_LDO6, + S2MPG11_LDO7, + S2MPG11_LDO8, + S2MPG11_LDO9, + S2MPG11_LDO10, + S2MPG11_LDO11, + S2MPG11_LDO12, + S2MPG11_LDO13, + S2MPG11_LDO14, + S2MPG11_LDO15, + S2MPG11_REGULATOR_MAX, +}; + +#endif /* __LINUX_MFD_S2MPG11_H */ --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94D6832ED37 for ; Sat, 27 Dec 2025 12:24:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838281; cv=none; b=HfnNmXctjSIyKRZ7OQLHlNrbTlndZsVzbJOgon4exNeADFxv99cXGMV8z35ZfeBZa0COaUGUjbHX61t7ld8I9Y9XFp7phKO4s5XQFP3GtoEYV1o9Zsa7+GDthHBlzWb+3wId0MIJsWTnr6OwK5JJLXMbAnoJU2H3I74n4Pe3KVQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838281; c=relaxed/simple; bh=ZETZajMfvd5Cj7AwABnaIbo8YXi84LCz2hhmRM9mv6I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KrKi4tO/a+f8vOPOXF8KmOWLAy6KarX8NX3QeB7DFnXK3Fnoo//+fyK1jkwWhpPiVhppJpIjLkDOZX7K7m3rfi2Z1zH6uL/sdHa6a9tWYWjw4uqwTgLR5cLq2aJ2J6F1GjR5iUn4RVf9vcIIVIG4LiZY8+O4zY6r4i6z7/yv6cM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=JVdSOk3v; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JVdSOk3v" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-64b83949fdaso10191820a12.2 for ; Sat, 27 Dec 2025 04:24:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838273; x=1767443073; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ydYm6Jwl4gZ6fxTGOTSVWGkOP7GwrBDA3cOK9JtPOwA=; b=JVdSOk3vCMomAwy8cm71LE1sMdttZxiV6D9ZzAACcub7eaQ252VliCAxzqQrCPeezu GLNKu3vWJNb6omFnwI8kXbNCaZpexqVadyvlqn+7V0bLHxxziUa0d1urTvxGHNSWqMCn 7vpkNm502YsFg6w/dDiIlLPrvImSHLbfZ0vFOR79xW3rHhWiTda4cAw7yoiIsB+DWWCG TXW8uIWkzjS4R9YDX6mFDsrFFl2KTi/+Z3ixRRh4UaaUSU7OC3HAI34kNArNsVaz49d0 eQiO4p81sPLfAJN44j5/zHIyjeZ1iJNb0HTxLRGd2dFaP5yiZb998QS1b5g8p2I4+byl TZww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838273; x=1767443073; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ydYm6Jwl4gZ6fxTGOTSVWGkOP7GwrBDA3cOK9JtPOwA=; b=ssijEVW+Nq9HefmJ1SPaDy0Su5B8B3lqCOeqe22q6Qp58AzVsAzmZd+3DcAA0zLdiO s7qeZH0rJeU42DXjJCzBA0WE4Unfs+CVtW7ktMXwmzC1M5HC248RxwuU5QN5mg6BsBGO OZXXSX/Qpg8jsll35ngUThyeRER0XGVpgOYTIA1flv1skTmUR76HEaXZ2il1HA5DB5vE /GMCyRTE+M6pF+48VK3dURbBOvtH/S9X8ZVH1iNKNFDZnitQOcg/W3qOS3wOmIWVa2Mf N0iYFXevEJCstXzzoxAA6CRilPDIvnlQdq0+qTh3TazqKAJBumTuYMI9dYY/xYCwLAWA DXvA== X-Forwarded-Encrypted: i=1; AJvYcCX1Cn2Ds4htnLPcGhs+RvsNRjGQPyhsSsVEb1PYmXFLvaEV+LlYRk0seBFhvq7uMGzV7mRWamAGnpaWJZ4=@vger.kernel.org X-Gm-Message-State: AOJu0YwRGAJ3uSrYSRr38aaHTjUWBXpI+DPYEi4+a4d+Hi362iWtYpQU wLHNYx/xDYqNcrpRg6Fbr0PoPWqk0HZjWSuSdrtb98Sd05DbjGSvt1AEeWDx3X8AdZo= X-Gm-Gg: AY/fxX6XiRQr4lWdwyS+x6qIBiI9RbJpsrmEbavNuDv2Ke49qYHdgJTYsBQF8fxCIgE NGZHcDQhg081AkCKpklsME930oKybcEWVp0se0iyZ5NnxHLhmqE4WxkyF8OCwUDMi81+uoQH62B i+GAGpKMHwTaOrvRmJmjWnCjzJ/xNPtIpqFh6gYEE7M5h+q2dk34uF7/gElZ4rXyk6v8nuUN+dn ZeR6VxlPvZMPrjQCJix4IHh3/Ct8hW+k5T6vZkELRINkyQyhEzsURsTI+ZeUplByLr6ytJtKGtH UQ53IKwcEyKowsHXSi0yjCuxCqL/7ss0r4bg+WHkIIb3/dmuH/+XwirRTlYKGQ2Fx+pIM4A9ygj GY3l/CIvJQN9fyTV4mXHRVQsP+maVvqZatHsRwXIvYsf3lvi/ocIaSj08wqwiDrtTzBnJYbfA35 49LWRFzXgDdtTKUL0Okg7A7UND+Z2hcKkxcfn/CGLWm3E0Ouu4M5qu/qYNi6lBKbq/DxqyRcgPT wc9GA== X-Google-Smtp-Source: AGHT+IGmVBStv7QqUeeTdiGjFu04kQuUG0+cc+BTzhSqsOpYCHbA58GXVMsLwp+XBrPv+6vtCMAYWg== X-Received: by 2002:a05:6402:4414:b0:64b:70cd:ac2c with SMTP id 4fb4d7f45d1cf-64b8ede3550mr23179595a12.32.1766838273410; Sat, 27 Dec 2025 04:24:33 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:33 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:32 +0000 Subject: [PATCH v5 10/21] regulator: add REGULATOR_LINEAR_VRANGE macro Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-10-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 REGULATOR_LINEAR_VRANGE is similar to REGULATOR_LINEAR_RANGE, but allows a more natural declaration of a voltage range for a regulator, in that it expects the minimum and maximum values as voltages rather than as selectors. Using voltages arguably makes this macro easier to use by drivers and code using it can become easier to read compared to REGULATOR_LINEAR_RANGE. Signed-off-by: Andr=C3=A9 Draszik --- While this commit doesn't introduce any users, the upcoming s2mpg10 and s2mpg11 drivers are using it. v3: - new patch --- include/linux/regulator/driver.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/dri= ver.h index 978cf593b6624228fe1fd9c2a3e186b53ef172f8..977755db64c6dfaea7246067eab= 0d9a2971caa01 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -53,6 +53,11 @@ enum regulator_detection_severity { #define REGULATOR_LINEAR_RANGE(_min_uV, _min_sel, _max_sel, _step_uV) \ LINEAR_RANGE(_min_uV, _min_sel, _max_sel, _step_uV) =20 +/* Initialize struct linear_range using voltages, not selectors */ +#define REGULATOR_LINEAR_VRANGE(_offs_uV, _min_uV, _max_uV, _step_uV) \ + LINEAR_RANGE(_min_uV, ((_min_uV) - (_offs_uV)) / (_step_uV), \ + ((_max_uV) - (_offs_uV)) / (_step_uV), _step_uV) + /** * struct regulator_ops - regulator operations. * --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9ABBD33031C for ; Sat, 27 Dec 2025 12:24:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838279; cv=none; b=UqcEyLBadi1cFT1SnUeXcno7RvhUUrZV2tcduzdAqm141Pv5+sdDuPCzKVhkrkwASagATMUQT+8CpkgEJDOf6Zkp6Yu9ZXJd5LYsAo/Cuu4bGe+bJFP64+dST89nq3MHS/fS6zG1QuIy7bFUQUI8qPdCpgxmjh7XUgnWxpnUxuc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838279; c=relaxed/simple; bh=6XxroTSX6ceg285T/QjRgJPmV5ju4e9igmyPsFQygJ0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DVA39BKNCuZm8IPx4Dd3q+yCBWg8ow4rtXLQLRAGMkJbDPp5Nd2ydoSqaOzDtKzS7e6S55ySlYnOf8zS0xVN90IQvb1tQr4WOGblB5fPQL/py7RpAphY880dsS30uqkZ0bP4hfn+a5R8BFGQVxvI063wvRbqSVJ8kGSmivc83jI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=WKW5uqxf; arc=none smtp.client-ip=209.85.208.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WKW5uqxf" Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-64b5ed53d0aso11233007a12.3 for ; Sat, 27 Dec 2025 04:24:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838274; x=1767443074; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=10d9MioQ6PzKJr2vkHmOG0REtU2UfuxyvJCr4xa57iE=; b=WKW5uqxfAOHdjS47fUJahRY6oBRnl6oCH6WDe2Joob5HexBYd8+jzLtVn0dIyVS/LE 3xjeoeibbEWe4enf8XFK4/bBQuZjL6FRLFkjKlQgXpEH0SkEM/KGzzQsynRi4odLCtxX fStYkmCL9fsPGfh2apnelE073KVs1pL0UggD+/7gsTj0oeKcHHX0w4bCfIama1cR1hsi jo8JbamkGgILyOlW3lWs8jOzu0IWHxWVVoS03DE91W4uF0s08S8t+0fOp2I81R/tPKLx iS7MFhQVZmCRIXbjEy4RQyoVjppKXeZOULYJhdWik5DIX2hErfAS3ThqR4DGxTQ1B0Bj CbHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838274; x=1767443074; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=10d9MioQ6PzKJr2vkHmOG0REtU2UfuxyvJCr4xa57iE=; b=aYGkbdi9CMkIyr8dx5vJ+MWRuJWp0yBmcklcJM2oxLSLSAFEyME3ecwKsjMX9JA0Cf i9VjXzqvquo/y3juBVPSOv61wLzNngrN8ojphouq++g/8s8uV6S33xvTPO/8UcACDnyE Ad3PIHY4Fp1JKMyqd37qe3z+EFwK6itFpU5u+U/vx82Xmr8ArgFS4IEIx+SmLw9m99vp 82hge7axJfhuQbcLIzUv7lSRfiV23SdX3MNizFT4LDqWhGPIJdNFri0tQOFOsra4Reir n/KF+j1FZlcpR4+IKt1l7BcA/Go4FJT181fJBjX8cSSEOuJqlBAr74AT0Y0v8eRuLaKS 7Xcw== X-Forwarded-Encrypted: i=1; AJvYcCV9pbJb+Q85bndac9WHRA3uh7J3RwFAf+rgimYXm6uVN/aWiVsd6EiLtnVUqPS69VDHqmNgyViyp2z/ZmQ=@vger.kernel.org X-Gm-Message-State: AOJu0YysLntCJx4l3GO3U0DyoxKKQjnFvXEjBsrS8JcIXibEuUeaJh4I qEvhR2jG95iIo1TkjQaIgJJUKIO9wi+zklYg63I8AN8QwlG9k0b+gORjQZRN18qwHFQ= X-Gm-Gg: AY/fxX4SwdyQAPRoPzC9kwMAleK2/gAq7SFmKMaOgEJ/yxnTEz+ORDzhq6U+igk1tdo W59Obq25hWZ3tK+NBi/Ylm9gQsWCj1BocPraMJTKP4mmfgikOy+m41yDM65izzdRfo8GeJEedgJ z18PVgj7mDyqBY0Liefa46l54D5O3bOdd49q5d7rLa9RBP6mj+DxQ94rz1nTMl3ZOUCCfA3IVDu /+zMBwLOQb3qsbh8WU8uohKg5oINydYlF8cqefWXg+KS9PJdU7BBwu9KQuYsUq6uJ1jybeK+swo LjbX84bXtoIpy7Jc3Y4WVWrjsFOJBD8ZfO2/eoFWc9SSqimZzE9YQaG71IZp35lzQgbgyptZsSo +GpMdDe8AmXIuDJbmY8uPQtTprTRgZdlSZve7Uw8HTKer7RBn5mBWWEWcv05ST9rxbrhRLGj8iT ST3sBEksCGHuVjNcvxxjNU2oNQ91xCgISclTzydIL8y+HLsMyHL/tZGU7ph2HdQLou9YAixSVok vAlAw== X-Google-Smtp-Source: AGHT+IG6Z9bYMcuGRg69WSp8yaR92k8YtvKMhYw/xt3cg0I4I04maY0SK1m8WoeJjsZm7hG2dL35Jg== X-Received: by 2002:a05:6402:27d3:b0:64c:fc09:c972 with SMTP id 4fb4d7f45d1cf-64cfc09cb6cmr23518296a12.17.1766838273894; Sat, 27 Dec 2025 04:24:33 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:33 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:33 +0000 Subject: [PATCH v5 11/21] regulator: s2mps11: drop two needless variable initialisations Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-11-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 The initialisations being removed are needless, as both variables are being assigned values unconditionally further down. Additionally, doing this eager init here might lead to preventing the compiler from issuing a warning if a future code change actually forgets to assign a useful value in some code path. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- drivers/regulator/s2mps11.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 04ae9c6150bd5ae9dba47b9b3cfcfb62e4698b6d..1f51fbc6c7b6e158f9707c04d9f= 030b9eee5e842 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -1207,8 +1207,8 @@ static int s2mps11_pmic_probe(struct platform_device = *pdev) struct sec_pmic_dev *iodev =3D dev_get_drvdata(pdev->dev.parent); struct regulator_config config =3D { }; struct s2mps11_info *s2mps11; - unsigned int rdev_num =3D 0; - int i, ret =3D 0; + unsigned int rdev_num; + int i, ret; const struct regulator_desc *regulators; =20 s2mps11 =3D devm_kzalloc(&pdev->dev, sizeof(struct s2mps11_info), --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96DC4330318 for ; Sat, 27 Dec 2025 12:24:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838281; cv=none; b=lYStjkIPz3RglbZo3IijPlNAPOHjocdHmMxCInFqQsboD+5H0FeFuMcIn+gU3RvPzvYtg2WJEQYF2/2tlY/Ar+DtBFWcOOAf/zVA6U+F5/DgaOX+KFIkdXmnd7sNuwRm5GSkArIm2nWZapv9p+nPUbVJizIN+McvEbEBNKGQfmI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838281; c=relaxed/simple; bh=y3nbh6FW3xPkaxUMs+BETGo9YjxcJnI/N944yZIYtZE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KY42xncIbZowqnUpqziZ0WXySOsIGIr3J9LkOKpQg9DWOR9T0WpS5gKM+rOgM6xfZTM06BOrXK8NkQTAuYeiYjLx3TlQ2NdTKvNFBJAakwtqk5ci2PIOrm/3A23pzT6EklaLXCgvGPd9tA3UU3Mt2RDSNCJN4m/mycMJJVkaN34= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=C2jzbZK8; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="C2jzbZK8" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-b728a43e410so1464629266b.1 for ; Sat, 27 Dec 2025 04:24:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838274; x=1767443074; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=QpM30Q4ohHxRfzIKhAO8xW+sYH95+aq2w1aPYa726rI=; b=C2jzbZK81UiGsI1lDuNBdt0fgLmHIFIQLKPg8kJo+9ZDUL4D68w4Q1uotX/lVetswv tboRZLnnl/NdMkc/R+SaxdNJ/TLnOO4NVjrQ/PzLz5YuHb/bLNBtrFW17n/+89AQBmfc Fhc7ehamvwf0mSkv/+6A7kC4bf7Je5biKMvqG/ZafmsxDma/SBvMEelrTXd4s3XdPChJ Ap+wI/qhWTgShZtiER/nhoygEtjejgBqQNAOomc/KmjEHwjUx8gw7HFPcok2QuTyHifn KqFsc5X7gl2yWYjL/Lv3J1pNrkBPuqLo3ED+RazwrqY09Ta+SE27+XZIIn/+FwmjSdwL 6Dcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838274; x=1767443074; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=QpM30Q4ohHxRfzIKhAO8xW+sYH95+aq2w1aPYa726rI=; b=TfROsg2ycunElmZyHK5YRg3aeqCfH3Kp4Av24ZSrGMmajIBBeMGLgj9uoQbPHiD86D e6yVcvUkfunN5NiZq3f+2iRi6I1sivQi0Aaw5LzU40niM4rlg8JHFzpXcVmY7HMYwFDx p664GTBg//l8e+e0cA9SYfnxC+yPj2QLwkpkeLUsymzbz6jw0okmzBR4XsBbTGjNRI+6 6lGSZBjAhhn8ssitLBJ+zE9pcuPdPnSJB5vFTjT6nDWt8gyrgU26veV2LZOztqtC1w+c WifVbzKx7k1yP8yn1RLOmIZznTeUdzAAPDXz45b9HDmAdyQ0hTGa/zZzTCEEUm+RXfCK y5JQ== X-Forwarded-Encrypted: i=1; AJvYcCXho++b6f69Ng/qzhTlP7S8QogEUXvfxmIACzbbqL6Q13MpW2OBw4fHNpY8o3oCK9RcByK9brBt6BHmU9A=@vger.kernel.org X-Gm-Message-State: AOJu0YyasrGHCpVgqiEhZnv/m36ZzqJmbXkrfdtmOJWKqeq/XXOTMcsl LkWrT4HAjJj3zqdHTt+nz/MnW2b2VtiTZTOeY60wTuqRixIJLNumnPGI/62XZ8E2oXg= X-Gm-Gg: AY/fxX6FY1z8lBKcNGV3GbzyksoT6mNtQgZzgFXO6bmlK5ViSbNtPBzaNF5KldBu5in MNP7IwpXEo7WzOyADbXku4rKajKVjP6cXdMl37TYq7POMn1XxIdadkcJg11pYy8jSOK8vb3rjdM ufArZGC2LEjpJ5/4ro0h7NSN/gVpoH8M7y/rBrLmcGHyj08mAmfbh9hAhIyLapRLIiwfXmS28zq PTnmb9YdJo4Cg21O0gUgqz+c+fsJfIVUI42tHKEpwizuClBEgK2sStvkjC5tG2J8CNUHvSk3aQP lVn38Ve7I+OD36d+q593TOdfZagTnvi5c/2n7YQbNy9IoRxmIF2iAzeakP8+qEvCQKEwuSPzhP5 p0lLToxTteqzFyEOxMtwGSDpcZUnfjdiWk3N4wBu37OsaVThyWnGz3NP3KRKGILNG9B7B3wAJql D4OYoUe0XT52x0vzKHuiOj2fruDmX6XUIif5Rpxna7suCK6uN6sQNVot/GTX3AqOMeZptvdrWsH Ibujg== X-Google-Smtp-Source: AGHT+IHtdsEKevcGZACNYlScwlHYSPODCqmM2Kf20iK43UH8EKdkTB+qjN++AicNMGPFsLLBY/Fh2g== X-Received: by 2002:a17:907:97cf:b0:b79:e99d:913d with SMTP id a640c23a62f3a-b8037058bb0mr2497508866b.42.1766838274376; Sat, 27 Dec 2025 04:24:34 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:34 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:34 +0000 Subject: [PATCH v5 12/21] regulator: s2mps11: use dev_err_probe() where appropriate Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-12-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 dev_err_probe() exists to simplify code and harmonise error messages, there's no reason not to use it here. While at it, harmonise some error messages to add regulator name and ID like in other messages in this driver, and update messages to be more similar to other child-drivers of this PMIC (e.g. RTC). Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- drivers/regulator/s2mps11.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 1f51fbc6c7b6e158f9707c04d9f030b9eee5e842..30586e9884bfb998ff07e314881= 3344b307506c0 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -1249,9 +1249,9 @@ static int s2mps11_pmic_probe(struct platform_device = *pdev) BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mpu05_regulators)); break; default: - dev_err(&pdev->dev, "Invalid device type: %u\n", - s2mps11->dev_type); - return -EINVAL; + return dev_err_probe(&pdev->dev, -ENODEV, + "Unsupported device type %d\n", + s2mps11->dev_type); } =20 s2mps11->ext_control_gpiod =3D devm_kcalloc(&pdev->dev, rdev_num, @@ -1290,21 +1290,20 @@ static int s2mps11_pmic_probe(struct platform_devic= e *pdev) devm_gpiod_unhinge(&pdev->dev, config.ena_gpiod); regulator =3D devm_regulator_register(&pdev->dev, ®ulators[i], &config); - if (IS_ERR(regulator)) { - dev_err(&pdev->dev, "regulator init failed for %d\n", - i); - return PTR_ERR(regulator); - } + if (IS_ERR(regulator)) + return dev_err_probe(&pdev->dev, PTR_ERR(regulator), + "regulator init failed for %d/%s\n", + regulators[i].id, + regulators[i].name); =20 if (config.ena_gpiod) { ret =3D s2mps14_pmic_enable_ext_control(s2mps11, - regulator); - if (ret < 0) { - dev_err(&pdev->dev, - "failed to enable GPIO control over %s: %d\n", - regulator->desc->name, ret); - return ret; - } + regulator); + if (ret < 0) + return dev_err_probe(&pdev->dev, ret, + "failed to enable GPIO control over %d/%s\n", + regulator->desc->id, + regulator->desc->name); } } =20 --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5812032E74B for ; Sat, 27 Dec 2025 12:24:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838282; cv=none; b=kdr3hCoapDXcBbZ02gy2f6qErpRGwbGl+WWLw5qTaGw5hxNpEoL/XDjvZDfLb/yKCcDOz7yxN5A2/Qouy1VjKjBy8tcC6/rDBf4wbH8XJmWiNuLQJI/16Ehk55qrDV8GPzchDpy0+HOoWEQfkrj/35cbrjjECXrb8324xQQzeZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838282; c=relaxed/simple; bh=e/SiWjAnIf9n3ju1+W9LofDtIoMCJ1iK1OR2/pq7g/4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eqH7DiV1uK+aJOnzEbbX2xCda2+e0lQrUCbIvzEN7nh6xI0hYPF7TvrrgJNBDeDMDcxm6oeSlBVA8mfERlo7QcLvlHzgwmZAAOyIOA5IBjceJLSRhw5femPj48Lca7Boq+pRBdAzBxkCk+7iuQ9oHNfHaB0fxpzI27RoeLlDtG0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=uaqAa0Ny; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uaqAa0Ny" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-64b9cb94ff5so9046899a12.2 for ; Sat, 27 Dec 2025 04:24:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838275; x=1767443075; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ZoLuiqrhFtLQqv/1rhd/SpsoL8e5z9S5UPDgQu4V1bM=; b=uaqAa0NyAXnC6DivFTOCG5MkBvSoGl9LYeqAKBVBLPAcRjntCGsnx7z4C1TE6sWBi6 tirNm+L4sMdUNEDZMxD5tcfUpu75iI7CQQLh4lNx+CkJyCJC3EnaAhh837lt3G5bWan1 M7ReAYSQQ27n8sl2QlvqXbTef1YeE2h4NWU8bifVLskzCPfyxGDCoCTt2e4F/FI5P60R LLlgRY2qk6J9dKG/bXyhWlhxGwxyea/ef/Ml2ZUc77gQPdSc6w0cCcz6bKK8JUhLXp+y jpUPwzQ2BV3s4BbOSGHfFc9gos32ez/ZY53Q43vglEuYttGXKsL7g+oS5E9JySEQDsU0 c9mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838275; x=1767443075; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ZoLuiqrhFtLQqv/1rhd/SpsoL8e5z9S5UPDgQu4V1bM=; b=vEW0NiMZlR/0/QNqw58H9F5dZFhytMhnIuzyJ2IcKgNt+48VjfE+XUZtXaYKhlIVGA pTKEW5JqoexGwYTRaD3BkAijzOC/B8ot4Zn0x87kmwddnOIqrrBKZnHFTuSOxh9HiPE2 2/ha2isyMsakg9xot9JjiKGXk4uO8o5v7r5RqxfwE1NcsME563Q0qtgjgS5qqSvoBbRS Si/TpIOYz/jo5nFy8lsL7/DNuJ7BCqk68E4xQ+2IUMMjamAZUzTcLdtCx1Zb2PQ/LfNR GS8m1Zm2FPpP9uSzBNjcyUe5USCh1mWJZOzx6FgcVTsKJRvSzt5IhZFiWMMeRBqByOO5 eLbw== X-Forwarded-Encrypted: i=1; AJvYcCUkA6qzGWUgtxuZGUXKkYde3jGpoLLDU7+LVGh8bgHkVspiCXDf6tmiO3dDBJ5YocoPUXFFuZTI3klC+v0=@vger.kernel.org X-Gm-Message-State: AOJu0YzWGhzyILNlQD1s+C+29y1LnxxW67xTywTUh9dqpm08qftDncOW oTGj3+5r6ima080Z3gMVq9lRpUGKRs6qbnoZwTemS1TUlElsZwuH2s1SsWGi5rJ6Rro= X-Gm-Gg: AY/fxX5qN/+MW/QjQMjpdOw9vea50F6uGOFSpa3gHA8fVqz8yfTjNMyGNP1EyDOLnbA gE9yMwO+UPu9aL2FOt0Pg5Xjj6ndXE6u4k6M3vSWN8FGSx1YKiCLK4+EaFQCpD4r+ylsqyDrmxw EaRsNgVm59cQjZnGVoWRU6tnwem3FEfxzlCIh11eYh1SnuF3WGgJ/EyMDpJVEBvQQy6Hsog15Ij YMOSNaxlxnMTIVS1xxqL8tUmzFMjZj23+ndxIWOfdzRd0j8KvnPTFvcGIrxTdQd34/bHIoofG1n UHLJVxJMz0coaProyHmELl7I3nT42IBXFuC5dqMd2/Ea/zBuGapu8NRV5t2o2xjTdNy7OPmYnEl Nt7k2uLX57p7RiRoBRl/i80HMKwHXZGF/TCw26aFikg5la8RVpCoNaf/mVTOY+O5/sHQDHqgF7h am/SCJFNV+76l5kcrCKXiaLgYX8d95gdLDx3cYFZNQFBooyqu0ksTFDPX00w6CHbUwaxaYVgj8x ilyuA== X-Google-Smtp-Source: AGHT+IH7wAJ/P+jJVtNfBeGnpt1N0Pf3Mi2lV6vQQtLZoDkUjgfiXG+M7CBhMUY0mH3GH8enwH+fbQ== X-Received: by 2002:a05:6402:144a:b0:64b:6e44:2c6c with SMTP id 4fb4d7f45d1cf-64b8ec9b1d3mr26064195a12.16.1766838274892; Sat, 27 Dec 2025 04:24:34 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:34 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:35 +0000 Subject: [PATCH v5 13/21] regulator: s2mps11: place constants on right side of comparison tests Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-13-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 For the lines being changed, checkpatch reports: WARNING: Comparisons should place the constant on the right side of the= test Update the code accordingly. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- v3: - new patch --- drivers/regulator/s2mps11.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 30586e9884bfb998ff07e3148813344b307506c0..8a36ab67b73e4151c7f67af0555= a6465ee1e7a04 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -1221,32 +1221,32 @@ static int s2mps11_pmic_probe(struct platform_devic= e *pdev) case S2MPS11X: rdev_num =3D ARRAY_SIZE(s2mps11_regulators); regulators =3D s2mps11_regulators; - BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mps11_regulators)); + BUILD_BUG_ON(ARRAY_SIZE(s2mps11_regulators) > S2MPS_REGULATOR_MAX); break; case S2MPS13X: rdev_num =3D ARRAY_SIZE(s2mps13_regulators); regulators =3D s2mps13_regulators; - BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mps13_regulators)); + BUILD_BUG_ON(ARRAY_SIZE(s2mps13_regulators) > S2MPS_REGULATOR_MAX); break; case S2MPS14X: rdev_num =3D ARRAY_SIZE(s2mps14_regulators); regulators =3D s2mps14_regulators; - BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mps14_regulators)); + BUILD_BUG_ON(ARRAY_SIZE(s2mps14_regulators) > S2MPS_REGULATOR_MAX); break; case S2MPS15X: rdev_num =3D ARRAY_SIZE(s2mps15_regulators); regulators =3D s2mps15_regulators; - BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mps15_regulators)); + BUILD_BUG_ON(ARRAY_SIZE(s2mps15_regulators) > S2MPS_REGULATOR_MAX); break; case S2MPU02: rdev_num =3D ARRAY_SIZE(s2mpu02_regulators); regulators =3D s2mpu02_regulators; - BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mpu02_regulators)); + BUILD_BUG_ON(ARRAY_SIZE(s2mpu02_regulators) > S2MPS_REGULATOR_MAX); break; case S2MPU05: rdev_num =3D ARRAY_SIZE(s2mpu05_regulators); regulators =3D s2mpu05_regulators; - BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mpu05_regulators)); + BUILD_BUG_ON(ARRAY_SIZE(s2mpu05_regulators) > S2MPS_REGULATOR_MAX); break; default: return dev_err_probe(&pdev->dev, -ENODEV, --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70BB033067B for ; Sat, 27 Dec 2025 12:24:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838288; cv=none; b=Lso5PIbovpArsCr8rtMiBSN0X0lYRGQWJhsp5ua3sZKSc37udxOxi2q5RAQcl/X6NSdUfdYhDCM9qsvTTC0yFRWCMlulmoKaUUgCwfT//NjTDgapDPqEYaNcPEj6RqcOmCqfT9hkasoX65VY+GbLksX/xH6vALwTxOHQzlNjqxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838288; c=relaxed/simple; bh=K5C3OhUoY6K0VAHET6GjBFnt0SuYQemw88dVyIhs++Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JRaDLGSE+M6wQUQqTG+dWFa72SawKnoMPJtqIdVd12rJw3u/6VgrpUex9nbHTVZgPPQzhw2su8y3h+stIU8wp14dphbluSkQiNZ6Wv1hDW90uGIZUP92iURHqVNR1ssitbn2Bo3PB+tEaJWdFZ65FQrilr/MWfG/0Cb7I9Op474= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=MedivdGO; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MedivdGO" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-64b608ffca7so9548472a12.3 for ; Sat, 27 Dec 2025 04:24:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838276; x=1767443076; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=nusFn6aAeugE2vgG6EjhYq+miTmPM6tuO12QEUcKzwU=; b=MedivdGOQrktSMAQTuxcfnAskfQH48jyiAbs7yg1b6+Lv5gZostcBxm+7fWEsQ42OC 5RNqsFIoSUeG0OHK1Br+AKltDGb4xgGrtB2q6RRfR9mkTN18diW8P2+x7OdKP/wjTzTn hTfHmm5l7IvjuhWQL4NlysINeQjof9bkMsmS0GD6Cf4ZT5BHZHa6yk8Cd0yKkF5ufqRR wokWPH8qWHR3quwSI74++QbAM+7NRlg97hTmB65gLsGQXr4jrNg9x3ZGNIoLBrbxx9Zj 792+/dQkqLfxcEbUzjOUgwQoF+qRpSWi1EWFFFsqRG5qziwuDEf4MblEn9rNwBe2eBch szSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838276; x=1767443076; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=nusFn6aAeugE2vgG6EjhYq+miTmPM6tuO12QEUcKzwU=; b=WRtwMlo1T6L37VGrNZQg3EwlsrTBVjYNi5OoewhRJIhBioY1TwrDO7p1TMEzhhKDoC XnBmiPNCxUHOB9MnaH2pO5o+i/WNBRGNZchlCBzVNzHuYgeWXWV0Y3GTuQ7WH68pxzjU h8MY7cCVIRvOAc/WNlh2B1ZW3buoA69QJ1ovEtWxTaPPio6heT4FTjWlvKwMC7GKBpl8 IGZBkvizLSzkKaqb9NCwyWtRDjsKM1IXDCGYBSaKnJFhAW/eeGGm+e4DpaRIsyWGuUY4 WEkPCh9apn++eRldjamJAJYFOikm/C2GxKNIIzBr56VRUIcSyzBZFg4Dv9uOulirFORJ 4MMA== X-Forwarded-Encrypted: i=1; AJvYcCWuLpeCm0vjWNZfgJ9YreH1es+rt4evq202vwu4vBhTPPhzej8lJxtogZVds0G95z+Xix50zH+1/We6Z+Y=@vger.kernel.org X-Gm-Message-State: AOJu0YznaTNdXLlyRKy923U2Dr3G5SeK3CxN56HNMq9WDQbLxUvOhWkZ sKkPmOXVE1B9h3dbNNFCh+54ynNOD0QvgAb1f3kkave0Lx7rxtxQU63u6eaXYnGvpxE= X-Gm-Gg: AY/fxX64jxLVbgvFOnyLR8jZ2g8E9Tj5LV2/uIdLv6Wkq4HtQUn2yFJq3/DnBDOb4tQ bsEt1CeMeD9didgEk6+WOAy/X1oKYYnNkmbxmKxRLbUnqNWttm1RdjkeFWYMpo3XvRaBolv1fHZ 7yqGcC1mBFrf7hO3YFNT49zhDbH2q6FSH0ih2PmJeVvfwwSh/+vcW5tX3Lg4HjfWAka0HRloM3/ LhuErdSAXWdRB8OOo+P4JEQEaXodfkYYkKeJzL3UEhulraBxigfVUdky9Fvv+jTIGcUt/RkxZQ6 KxGOpAGSBAJdKMrpGb87aV5mOt6QL0PoTDP1/Pmll9oZa/h/T0lhtOsekQ+RydlLmCzSY98Km5x IB4n3q0B5RCq3GJ3wax0m+W3J/71lq9mYV2Q0H9XzMl1poCA+frCatvlxD78gCOme9gEB9hxd2/ rkJQUBuNR7xBemEvpI/tFCzdJtlxHLbqQd0tB+tV39AliESa60x2E7m9SibBEZbIBHiM1izey6F fkQNQ== X-Google-Smtp-Source: AGHT+IEIqcGcSS6mIcDBNoC+avV4XUeWeYLBgtXTmnK1R1dtlFQ9RfE+Rlj8btfSCd7iQqIMJ9c11A== X-Received: by 2002:a05:6402:1ed6:b0:64d:1f6b:f59c with SMTP id 4fb4d7f45d1cf-64d1f6bf81fmr18185444a12.32.1766838276161; Sat, 27 Dec 2025 04:24:36 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:35 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:36 +0000 Subject: [PATCH v5 14/21] regulator: s2mps11: update node parsing (allow -supply properties) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-14-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 For the upcoming S2MPG10 and S2MPG11 support, we need to be able to parse -supply properties in the PMIC's DT node. This currently doesn't work, because the code here currently points the regulator core at each individual regulator sub-node, and therefore the regulator core is unable to find the -supply properties. Update the code to simply let the regulator core handle all the parsing by adding the ::of_match and ::regulators_node members to all existing regulator descriptions, by adding ::of_parse_cb() to those regulators which support the vendor-specific samsung,ext-control-gpios to parse it (S2MPS14), and by dropping the explicit call to of_regulator_match(). Configuring the PMIC to respect the external control GPIOs via s2mps14_pmic_enable_ext_control() is left outside ::of_parse_cb() because the regulator core ignores errors other than -EPROBE_DEFER from that callback, while the code currently fails probe on register write errors and I believe it should stay that way. The driver can now avoid the devm_gpiod_unhinge() dance due to simpler error handling of GPIO descriptor acquisition. This change also has the advantage of reducing runtime memory consumption by quite a bit as the driver doesn't need to allocate a 'struct of_regulator_match' and a 'struct gpio_desc *' for each regulator for all PMICs as the regulator core does that. This saves 40+8 bytes on arm64 for each individual regulator on all supported PMICs (even on non-S2MPS14 due to currently unnecessarily allocating the extra memory unconditionally). With the upcoming S2MPG10 and S2MPG11 support, this amounts to 1640+328 and 1120+224 bytes respectively. Signed-off-by: Andr=C3=A9 Draszik --- v2: - fix commit message typos: s2mp1 -> s2mpg1 --- drivers/regulator/s2mps11.c | 192 ++++++++++++++++++++++++----------------= ---- 1 file changed, 105 insertions(+), 87 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 8a36ab67b73e4151c7f67af0555a6465ee1e7a04..88e21c90832a45547e5791b15cd= 1de274f81fed6 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -40,12 +40,6 @@ struct s2mps11_info { * the suspend mode was enabled. */ DECLARE_BITMAP(suspend_state, S2MPS_REGULATOR_MAX); - - /* - * Array (size: number of regulators) with GPIO-s for external - * sleep control. - */ - struct gpio_desc **ext_control_gpiod; }; =20 static int get_ramp_delay(int ramp_delay) @@ -244,7 +238,7 @@ static int s2mps11_regulator_enable(struct regulator_de= v *rdev) case S2MPS14X: if (test_bit(rdev_id, s2mps11->suspend_state)) val =3D S2MPS14_ENABLE_SUSPEND; - else if (s2mps11->ext_control_gpiod[rdev_id]) + else if (rdev->ena_pin) val =3D S2MPS14_ENABLE_EXT_CONTROL; else val =3D rdev->desc->enable_mask; @@ -334,6 +328,58 @@ static int s2mps11_regulator_set_suspend_disable(struc= t regulator_dev *rdev) rdev->desc->enable_mask, state); } =20 +static int s2mps11_of_parse_cb(struct device_node *np, + const struct regulator_desc *desc, + struct regulator_config *config) +{ + const struct s2mps11_info *s2mps11 =3D config->driver_data; + struct gpio_desc *ena_gpiod; + int ret; + + if (s2mps11->dev_type =3D=3D S2MPS14X) + switch (desc->id) { + case S2MPS14_LDO10: + case S2MPS14_LDO11: + case S2MPS14_LDO12: + break; + + default: + return 0; + } + else + return 0; + + ena_gpiod =3D fwnode_gpiod_get_index(of_fwnode_handle(np), + "samsung,ext-control", 0, + GPIOD_OUT_HIGH | + GPIOD_FLAGS_BIT_NONEXCLUSIVE, + "s2mps11-regulator"); + if (IS_ERR(ena_gpiod)) { + ret =3D PTR_ERR(ena_gpiod); + + /* Ignore all errors except probe defer. */ + if (ret =3D=3D -EPROBE_DEFER) + return ret; + + if (ret =3D=3D -ENOENT) + dev_info(config->dev, + "No entry for control GPIO for %d/%s in node %pOF\n", + desc->id, desc->name, np); + else + dev_warn_probe(config->dev, ret, + "Failed to get control GPIO for %d/%s in node %pOF\n", + desc->id, desc->name, np); + return 0; + } + + dev_info(config->dev, "Using GPIO for ext-control over %d/%s\n", + desc->id, desc->name); + + config->ena_gpiod =3D ena_gpiod; + + return 0; +} + static const struct regulator_ops s2mps11_ldo_ops =3D { .list_voltage =3D regulator_list_voltage_linear, .map_voltage =3D regulator_map_voltage_linear, @@ -362,6 +408,8 @@ static const struct regulator_ops s2mps11_buck_ops =3D { #define regulator_desc_s2mps11_ldo(num, step) { \ .name =3D "LDO"#num, \ .id =3D S2MPS11_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps11_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -378,6 +426,8 @@ static const struct regulator_ops s2mps11_buck_ops =3D { #define regulator_desc_s2mps11_buck1_4(num) { \ .name =3D "BUCK"#num, \ .id =3D S2MPS11_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps11_buck_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -395,6 +445,8 @@ static const struct regulator_ops s2mps11_buck_ops =3D { #define regulator_desc_s2mps11_buck5 { \ .name =3D "BUCK5", \ .id =3D S2MPS11_BUCK5, \ + .of_match =3D of_match_ptr("BUCK5"), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps11_buck_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -412,6 +464,8 @@ static const struct regulator_ops s2mps11_buck_ops =3D { #define regulator_desc_s2mps11_buck67810(num, min, step, min_sel, voltages= ) { \ .name =3D "BUCK"#num, \ .id =3D S2MPS11_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps11_buck_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -429,6 +483,8 @@ static const struct regulator_ops s2mps11_buck_ops =3D { #define regulator_desc_s2mps11_buck9 { \ .name =3D "BUCK9", \ .id =3D S2MPS11_BUCK9, \ + .of_match =3D of_match_ptr("BUCK9"), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps11_buck_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -502,6 +558,8 @@ static const struct regulator_ops s2mps14_reg_ops; #define regulator_desc_s2mps13_ldo(num, min, step, min_sel) { \ .name =3D "LDO"#num, \ .id =3D S2MPS13_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps14_reg_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -518,6 +576,8 @@ static const struct regulator_ops s2mps14_reg_ops; #define regulator_desc_s2mps13_buck(num, min, step, min_sel) { \ .name =3D "BUCK"#num, \ .id =3D S2MPS13_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps14_reg_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -535,6 +595,8 @@ static const struct regulator_ops s2mps14_reg_ops; #define regulator_desc_s2mps13_buck7(num, min, step, min_sel) { \ .name =3D "BUCK"#num, \ .id =3D S2MPS13_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps14_reg_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -552,6 +614,8 @@ static const struct regulator_ops s2mps14_reg_ops; #define regulator_desc_s2mps13_buck8_10(num, min, step, min_sel) { \ .name =3D "BUCK"#num, \ .id =3D S2MPS13_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps14_reg_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -634,6 +698,9 @@ static const struct regulator_ops s2mps14_reg_ops =3D { #define regulator_desc_s2mps14_ldo(num, min, step) { \ .name =3D "LDO"#num, \ .id =3D S2MPS14_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ + .of_parse_cb =3D s2mps11_of_parse_cb, \ .ops =3D &s2mps14_reg_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -649,6 +716,9 @@ static const struct regulator_ops s2mps14_reg_ops =3D { #define regulator_desc_s2mps14_buck(num, min, step, min_sel) { \ .name =3D "BUCK"#num, \ .id =3D S2MPS14_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ + .of_parse_cb =3D s2mps11_of_parse_cb, \ .ops =3D &s2mps14_reg_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -725,6 +795,8 @@ static const struct regulator_ops s2mps15_reg_buck_ops = =3D { #define regulator_desc_s2mps15_ldo(num, range) { \ .name =3D "LDO"#num, \ .id =3D S2MPS15_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps15_reg_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -740,6 +812,8 @@ static const struct regulator_ops s2mps15_reg_buck_ops = =3D { #define regulator_desc_s2mps15_buck(num, range) { \ .name =3D "BUCK"#num, \ .id =3D S2MPS15_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps15_reg_buck_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -835,60 +909,6 @@ static int s2mps14_pmic_enable_ext_control(struct s2mp= s11_info *s2mps11, rdev->desc->enable_mask, S2MPS14_ENABLE_EXT_CONTROL); } =20 -static void s2mps14_pmic_dt_parse_ext_control_gpio(struct platform_device = *pdev, - struct of_regulator_match *rdata, struct s2mps11_info *s2mps11) -{ - struct gpio_desc **gpio =3D s2mps11->ext_control_gpiod; - unsigned int i; - unsigned int valid_regulators[3] =3D { S2MPS14_LDO10, S2MPS14_LDO11, - S2MPS14_LDO12 }; - - for (i =3D 0; i < ARRAY_SIZE(valid_regulators); i++) { - unsigned int reg =3D valid_regulators[i]; - - if (!rdata[reg].init_data || !rdata[reg].of_node) - continue; - - gpio[reg] =3D devm_fwnode_gpiod_get(&pdev->dev, - of_fwnode_handle(rdata[reg].of_node), - "samsung,ext-control", - GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE, - "s2mps11-regulator"); - if (PTR_ERR(gpio[reg]) =3D=3D -ENOENT) - gpio[reg] =3D NULL; - else if (IS_ERR(gpio[reg])) { - dev_err(&pdev->dev, "Failed to get control GPIO for %d/%s\n", - reg, rdata[reg].name); - gpio[reg] =3D NULL; - continue; - } - if (gpio[reg]) - dev_dbg(&pdev->dev, "Using GPIO for ext-control over %d/%s\n", - reg, rdata[reg].name); - } -} - -static int s2mps11_pmic_dt_parse(struct platform_device *pdev, - struct of_regulator_match *rdata, struct s2mps11_info *s2mps11, - unsigned int rdev_num) -{ - struct device_node *reg_np; - - reg_np =3D of_get_child_by_name(pdev->dev.parent->of_node, "regulators"); - if (!reg_np) { - dev_err(&pdev->dev, "could not find regulators sub-node\n"); - return -EINVAL; - } - - of_regulator_match(&pdev->dev, reg_np, rdata, rdev_num); - if (s2mps11->dev_type =3D=3D S2MPS14X) - s2mps14_pmic_dt_parse_ext_control_gpio(pdev, rdata, s2mps11); - - of_node_put(reg_np); - - return 0; -} - static int s2mpu02_set_ramp_delay(struct regulator_dev *rdev, int ramp_del= ay) { unsigned int ramp_val, ramp_shift, ramp_reg; @@ -946,6 +966,8 @@ static const struct regulator_ops s2mpu02_buck_ops =3D { #define regulator_desc_s2mpu02_ldo1(num) { \ .name =3D "LDO"#num, \ .id =3D S2MPU02_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -961,6 +983,8 @@ static const struct regulator_ops s2mpu02_buck_ops =3D { #define regulator_desc_s2mpu02_ldo2(num) { \ .name =3D "LDO"#num, \ .id =3D S2MPU02_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -976,6 +1000,8 @@ static const struct regulator_ops s2mpu02_buck_ops =3D= { #define regulator_desc_s2mpu02_ldo3(num) { \ .name =3D "LDO"#num, \ .id =3D S2MPU02_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -991,6 +1017,8 @@ static const struct regulator_ops s2mpu02_buck_ops =3D= { #define regulator_desc_s2mpu02_ldo4(num) { \ .name =3D "LDO"#num, \ .id =3D S2MPU02_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1006,6 +1034,8 @@ static const struct regulator_ops s2mpu02_buck_ops = =3D { #define regulator_desc_s2mpu02_ldo5(num) { \ .name =3D "LDO"#num, \ .id =3D S2MPU02_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1022,6 +1052,8 @@ static const struct regulator_ops s2mpu02_buck_ops = =3D { #define regulator_desc_s2mpu02_buck1234(num) { \ .name =3D "BUCK"#num, \ .id =3D S2MPU02_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_buck_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1038,6 +1070,8 @@ static const struct regulator_ops s2mpu02_buck_ops = =3D { #define regulator_desc_s2mpu02_buck5(num) { \ .name =3D "BUCK"#num, \ .id =3D S2MPU02_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1054,6 +1088,8 @@ static const struct regulator_ops s2mpu02_buck_ops = =3D { #define regulator_desc_s2mpu02_buck6(num) { \ .name =3D "BUCK"#num, \ .id =3D S2MPU02_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1070,6 +1106,8 @@ static const struct regulator_ops s2mpu02_buck_ops = =3D { #define regulator_desc_s2mpu02_buck7(num) { \ .name =3D "BUCK"#num, \ .id =3D S2MPU02_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1125,6 +1163,8 @@ static const struct regulator_desc s2mpu02_regulators= [] =3D { #define regulator_desc_s2mpu05_ldo_reg(num, min, step, reg) { \ .name =3D "ldo"#num, \ .id =3D S2MPU05_LDO##num, \ + .of_match =3D of_match_ptr("ldo"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1156,6 +1196,8 @@ static const struct regulator_desc s2mpu02_regulators= [] =3D { #define regulator_desc_s2mpu05_buck(num, which) { \ .name =3D "buck"#num, \ .id =3D S2MPU05_BUCK##num, \ + .of_match =3D of_match_ptr("buck"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_buck_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1254,22 +1296,7 @@ static int s2mps11_pmic_probe(struct platform_device= *pdev) s2mps11->dev_type); } =20 - s2mps11->ext_control_gpiod =3D devm_kcalloc(&pdev->dev, rdev_num, - sizeof(*s2mps11->ext_control_gpiod), GFP_KERNEL); - if (!s2mps11->ext_control_gpiod) - return -ENOMEM; - - struct of_regulator_match *rdata __free(kfree) =3D - kcalloc(rdev_num, sizeof(*rdata), GFP_KERNEL); - if (!rdata) - return -ENOMEM; - - for (i =3D 0; i < rdev_num; i++) - rdata[i].name =3D regulators[i].name; - - ret =3D s2mps11_pmic_dt_parse(pdev, rdata, s2mps11, rdev_num); - if (ret) - return ret; + device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); =20 platform_set_drvdata(pdev, s2mps11); =20 @@ -1279,15 +1306,6 @@ static int s2mps11_pmic_probe(struct platform_device= *pdev) for (i =3D 0; i < rdev_num; i++) { struct regulator_dev *regulator; =20 - config.init_data =3D rdata[i].init_data; - config.of_node =3D rdata[i].of_node; - config.ena_gpiod =3D s2mps11->ext_control_gpiod[i]; - /* - * Hand the GPIO descriptor management over to the regulator - * core, remove it from devres management. - */ - if (config.ena_gpiod) - devm_gpiod_unhinge(&pdev->dev, config.ena_gpiod); regulator =3D devm_regulator_register(&pdev->dev, ®ulators[i], &config); if (IS_ERR(regulator)) @@ -1296,7 +1314,7 @@ static int s2mps11_pmic_probe(struct platform_device = *pdev) regulators[i].id, regulators[i].name); =20 - if (config.ena_gpiod) { + if (regulator->ena_pin) { ret =3D s2mps14_pmic_enable_ext_control(s2mps11, regulator); if (ret < 0) --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52E0F32E73A for ; Sat, 27 Dec 2025 12:24:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838285; cv=none; b=MjwGtwOcY+wkeUguhqWmpMl/GQBlC2H7LVEFB6wpJHPgXH4C/0RPu7vySuEXaqttOUtLd0AXWSE2DZToYfarDvwf6qKIHwt11xOfXlQzAvRQpI2XLKM/tgfR/3V720qhtXSj9JBeqKgRR8Y4Y9PdAcf7DopNUP4UNaULtnvqCGo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838285; c=relaxed/simple; bh=gcmMj0lW5ijk42JS1tB+r6D2gRIG50rpU99wl7DZYkU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CbdIe9y07KSbAu4WYNy8ItnWI0bKzJk5w8cY7ImZ7/R5CeAL0mWqA5bkiL6THcNqSf4PShUekAVHxCfEbrkqeQ2foCPiLpJ+ParT6bH5P3I8cd2I3fVD0PP5glG0y3Q+AXI8xWK91T+9kEpFwwolc1Ddh86Yhj/ajRVlFmjXdZY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=VtG3zIUO; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VtG3zIUO" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-64bea6c5819so8699200a12.3 for ; Sat, 27 Dec 2025 04:24:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838277; x=1767443077; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=eNIKQi6FypzlBSQpep9GNEuVSqSkRmoCXE/UOfNk9wU=; b=VtG3zIUOypfrUk1CaQsF6pzeuW4feyPaItKvO3yoFzyppD6JCWL4Fru4ty/x19n2zN Mr61FrAPuAVoqxvONwwKZwN0JnEpoIPSxZxw9nUDUuIxYUz2Otz6Psd4kcKH+HArfCjx 9sV7kKkLEyJY1gbIICdqbskpwjv3BoIAh/y7bPg7ZKyf1ARLjYSK7ooQAwFSkWFPu+Jb apXV46L9fSGrSMAp02YNFPZ/DkokO1BEwRMB3UtO7X75Ba526l7cp9BJAjBwignZnKVL XxJm5GnBFsGmnTjRIF+EfjXK9FWAHeu8Ii08+tcb9vTEdjtUWJgxIAWwGRRgn+a085sy H5tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838277; x=1767443077; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=eNIKQi6FypzlBSQpep9GNEuVSqSkRmoCXE/UOfNk9wU=; b=g2YNAyxpdXZhYmro9EDPvVuNyMWZqtm/jGXMEb4lvIkM5ziQY9xTBe6sxOUmVc0X37 OAW0ZrZo76ijon/ksGE0ujjbujDVw2rHNxKcLRMUJa3IgsGrt2YmjBnvtc2aLLX047Qx CHmzJN19CesUVRTsp5opf8Wm2jkvcByddaB9g0++yZpCcRyKfKcr3tdzNpPcnW3xzTPk 6jjsdmnI+Sfo5H5HcWqpJdzqmuOqBXGrdQ3+UxneuwLLqVZo6/eKeck40YC2xVC4tkM/ 0dFVSsh/0Qgq/vUwovUHX4Ovj2Hs15Kdy+9uLcKhPxxNLg5v8mtBJciodckuMPY1+dY1 ytIA== X-Forwarded-Encrypted: i=1; AJvYcCXP8d3tH9EyPe8+jWYWoSX8BMT2zVa88X1d4+dCzVNtAgBpPcTWKtA7sCBCSXgIiWwPXq3R6gWGyfuvryc=@vger.kernel.org X-Gm-Message-State: AOJu0YwaETN0NZSbq3LQNP3TDEiCuxGzdyzAiYXFZnEfrT4iJLeTrTlR /mXyByqFH4imGxEpj+Ad1UYCUn4HOEIRdDFOnQsvvsFquR/vXr+zj2hanAeRkRvJQBGmBGAv5nh nU42MgVg= X-Gm-Gg: AY/fxX77b0NkKhbyL28tSjE2BOwPrZ7jdVwBlHI24BEkR2KhButym6F/Qhbr7nbCrR6 aDlni2dlSsDvOp+8x/0lA9+XlbXEcrTsLmxCKmZ6tSY7CjCLAIB1JIR8brnEL1rT7q9sTdMjOXl vbut5eotlWfgGrEARZVIzHY7vHi45949QlWmkqhcorr8jINUQyPA7j2rlZPctA3bScHWS8Gh5q4 yeW54jrs+jnfxfsadGgt6/PK6otYg4xFr23jl/ZjOEeicOc0wg+JxV0bNDoB6OWnbGvcfQOARnl Fes0lzRtOp7dnuwIblimuT4w1BQ9to09vHIFTMzvq9ofFeBuXUNiROejj5fZNZWqVswKhS4nRaM a3ZttqALXq7TDAX3/1ZdzrhwIx3Safex6EbmFebSiEPjq+JfHH5YvDjkPaOhBIyqOidfnb9e2Yx E39uPt+AaZSCenbW3x4+WVRpI/ZHaoVuNH6o6a8lcohbwR9uwISU/WfcSzxzXZbKkKZNHRDlHBm P4XQQ== X-Google-Smtp-Source: AGHT+IGqWTGCZOPY2JQdi50khJ1KN4h2RSLhajLM1rIsDEEW0RykHTL4Lf3cTVEpMQkeptRnlkYXCA== X-Received: by 2002:a05:6402:1454:b0:649:b492:70b1 with SMTP id 4fb4d7f45d1cf-64b8e2a6fb8mr27864621a12.0.1766838276650; Sat, 27 Dec 2025 04:24:36 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:36 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:37 +0000 Subject: [PATCH v5 15/21] regulator: s2mps11: refactor handling of external rail control Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-15-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 Refactor s2mps14_pmic_enable_ext_control() and s2mps11_of_parse_cb() slightly as a preparation for adding S2MPG10 and S2MPG11 support, as both of those PMICs also support control of rails via GPIOs. Signed-off-by: Andr=C3=A9 Draszik --- drivers/regulator/s2mps11.c | 86 ++++++++++++++++++++++++++++++-----------= ---- 1 file changed, 57 insertions(+), 29 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 88e21c90832a45547e5791b15cd1de274f81fed6..bb0a4f35ef47551f7171321fdde= 2c0202ce86ede 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -328,27 +328,13 @@ static int s2mps11_regulator_set_suspend_disable(stru= ct regulator_dev *rdev) rdev->desc->enable_mask, state); } =20 -static int s2mps11_of_parse_cb(struct device_node *np, - const struct regulator_desc *desc, - struct regulator_config *config) +static int s2mps11_of_parse_gpiod(struct device_node *np, + const struct regulator_desc *desc, + struct regulator_config *config) { - const struct s2mps11_info *s2mps11 =3D config->driver_data; struct gpio_desc *ena_gpiod; int ret; =20 - if (s2mps11->dev_type =3D=3D S2MPS14X) - switch (desc->id) { - case S2MPS14_LDO10: - case S2MPS14_LDO11: - case S2MPS14_LDO12: - break; - - default: - return 0; - } - else - return 0; - ena_gpiod =3D fwnode_gpiod_get_index(of_fwnode_handle(np), "samsung,ext-control", 0, GPIOD_OUT_HIGH | @@ -380,6 +366,28 @@ static int s2mps11_of_parse_cb(struct device_node *np, return 0; } =20 +static int s2mps11_of_parse_cb(struct device_node *np, + const struct regulator_desc *desc, + struct regulator_config *config) +{ + const struct s2mps11_info *s2mps11 =3D config->driver_data; + + if (s2mps11->dev_type =3D=3D S2MPS14X) + switch (desc->id) { + case S2MPS14_LDO10: + case S2MPS14_LDO11: + case S2MPS14_LDO12: + break; + + default: + return 0; + } + else + return 0; + + return s2mps11_of_parse_gpiod(np, desc, config); +} + static const struct regulator_ops s2mps11_ldo_ops =3D { .list_voltage =3D regulator_list_voltage_linear, .map_voltage =3D regulator_map_voltage_linear, @@ -903,10 +911,16 @@ static const struct regulator_desc s2mps15_regulators= [] =3D { }; =20 static int s2mps14_pmic_enable_ext_control(struct s2mps11_info *s2mps11, - struct regulator_dev *rdev) + struct regulator_dev *rdev) { - return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, - rdev->desc->enable_mask, S2MPS14_ENABLE_EXT_CONTROL); + int ret =3D regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, + rdev->desc->enable_mask, + S2MPS14_ENABLE_EXT_CONTROL); + if (ret < 0) + return dev_err_probe(rdev_get_dev(rdev), ret, + "failed to enable GPIO control over %d/%s\n", + rdev->desc->id, rdev->desc->name); + return 0; } =20 static int s2mpu02_set_ramp_delay(struct regulator_dev *rdev, int ramp_del= ay) @@ -1244,6 +1258,26 @@ static const struct regulator_desc s2mpu05_regulator= s[] =3D { regulator_desc_s2mpu05_buck45(5), }; =20 +static int s2mps11_handle_ext_control(struct s2mps11_info *s2mps11, + struct regulator_dev *rdev) +{ + int ret; + + switch (s2mps11->dev_type) { + case S2MPS14X: + if (!rdev->ena_pin) + return 0; + + ret =3D s2mps14_pmic_enable_ext_control(s2mps11, rdev); + break; + + default: + return 0; + } + + return ret; +} + static int s2mps11_pmic_probe(struct platform_device *pdev) { struct sec_pmic_dev *iodev =3D dev_get_drvdata(pdev->dev.parent); @@ -1314,15 +1348,9 @@ static int s2mps11_pmic_probe(struct platform_device= *pdev) regulators[i].id, regulators[i].name); =20 - if (regulator->ena_pin) { - ret =3D s2mps14_pmic_enable_ext_control(s2mps11, - regulator); - if (ret < 0) - return dev_err_probe(&pdev->dev, ret, - "failed to enable GPIO control over %d/%s\n", - regulator->desc->id, - regulator->desc->name); - } + ret =3D s2mps11_handle_ext_control(s2mps11, regulator); + if (ret < 0) + return ret; } =20 return 0; --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA03A32E6B4 for ; Sat, 27 Dec 2025 12:24:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838290; cv=none; b=uzz5biweHCcgknIwp5DJeuO3RT8RH7YyAS9M6qoAWH0j1hFJ1uQqhAVvvT93W/dvThFaWJvG8QHMvOPAx8Jw26FywNXsF43cnuKWFykDRxhoGaQnvUmoZblvqtot3FxkQP5K8rlBsjSqoNA9zldynhD6l8P2X0dB9YQ5L9GmYQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838290; c=relaxed/simple; bh=QmWzIeVN9tJnbQ3Ktz4CTCAGSbSyKZfp+7/YRGH9LBc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eIHlS/R8GXRdMxjJzquZjVIK6eW3jnzHZErHcVBdxZH8pBEPiLU5OTMxHRj7uIkDLkm68/sqPli9z6r/zOKjKQZTv2P2xtHdw5SkliUBQljDKYsf3YcUdkn29dBY61INlmmO6q/Iv4FsENfP7O88hvqX1mIWNC8p5OuaoxSf/lI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=mATqaV38; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mATqaV38" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-64daeb28c56so5070876a12.2 for ; Sat, 27 Dec 2025 04:24:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838278; x=1767443078; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6m3tchf9L5NLKkDQFa6porSG5T4/4hufw9rrhPAP9ZU=; b=mATqaV38mDkOcTOOQxNDWQm/fXzb6DwnEo+EHYHPqPGW0OfS76Tz4B2fZORdJKDefW qaI9BBBWJKQNNEFZNyybg7ArHz8aEbdMunexaYOIsVzQKqgSJ3FJl3JJgbuh7jxsYL01 bRhxTpLIymBNtEelZtUo2XqgQKQCXP8BbQcI/jeaQlzyILQ90tUUcM40sq6TZz9palnk khhILyJbaey716zel1Ct8XdxTFYI4mloxBkGobtCPw2zom+Sfks6kReIymT7rxAEZbR7 n/OSVICyEKyCA6RNIru3v+I/Hqz7rQczYpY3Fv/jRiDEUQ7wCsZ1mmfnXZ6hXkJ3IhT0 0ROg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838278; x=1767443078; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=6m3tchf9L5NLKkDQFa6porSG5T4/4hufw9rrhPAP9ZU=; b=DP/3g5bab2lxyuGWBo1PuTtBuUCKtUMFsPiQ0POHlnUnaSf8NynXmDm/APzrPlyDgP P/L/g+mVW+Cf1+v+xkBrskRoKdK/Auk/GVjRZTnOPu/IQh5NrToDMgvlXRZYcsM/id0c 1NNXA8my/LvAMxN1+qFKz6l4yCKeSqFuXVdiq20Sc3AcL8Woyq3z0wLjv9YR/+7oZa1G +hXfSu/sZcLOOTMFfzZk/jV7y4olzhKdtEQ99xLvoxgiwrMjpV85/Mm9w5lCRtorCYlC uF5zkpndJu1cQtFo/+cnkRXR9eA32Nwkf234UwkLgyB12lUMeZSe4avoQxbbRTL7W319 YnxA== X-Forwarded-Encrypted: i=1; AJvYcCXE/yhJBe6NZ1hX5GH1M7EGb3e2Zh7zXagmFT44p/VoJ7psbBZsghAT8ilUEyxkfloiUp6vVqiB1fUtwkY=@vger.kernel.org X-Gm-Message-State: AOJu0Ywd0Yd87w2muLPSfdQjNyVU5Sa+cwvSHBlpryorp9mMruuFfr6Y lfwCsrQrSN/obS6Q8c+jmCKTbJn49UR/rjC/Q3IKEdIOv17PdwpeD806wx7t5Sbr6xg= X-Gm-Gg: AY/fxX5OODyCLXp56i2iFwNZbOQ/ujKEYAkPOjbRPda3GO18KvfdaiiB6rUAgouzf4n PSnrCXPwKVgFj4o/drD5PTcrV/Xv8m84LlNDfBNHxd6QuzCLAHojFcW1JxVmNgzVn44Kfzt1tiF 4JS7u0On6l4RE725DrO0aQhqD6N8ldc85CYS8kMlRxV8vITWoyGFce/CdMqrC2c7m5hy2GhFuxn d91/CgXivahGo/VbzeK1Z+cJ9kYNJISzhJuH4ZfwLyMjgBGUIf+qfdFo89EqCGHfAbaFr5D9Vis N330Keq6b5lrO9Gk/8ZKf8PJ3m9/KIyzjERmDKsBHrxNjj7V6kE5MARyEIIMCMID3b5dQhZzPu0 XdhrPFCMJmDrmtdX4LYXn7t3H90H1GfrS4JJocpizoYj/sjpGxedUoP4LxUzA5rvk3OWlxdOZlQ BQQIF0A7wSeJd0mN0qR042xlLryL1o2+t8HKkfzYTO9jXG+kJcDNLGBtjCvunfRCOZ4a1Z4i0VT mC4Iw== X-Google-Smtp-Source: AGHT+IEFm2AmaMI9JChcErAnJi93GaGfE0ONmpcs0Oze9Ykj95grCSk2cOtyedRzzI9t/mhiucjcgQ== X-Received: by 2002:a05:6402:42c4:b0:649:aa03:6d7f with SMTP id 4fb4d7f45d1cf-64b8eb7268amr24469363a12.23.1766838277902; Sat, 27 Dec 2025 04:24:37 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:36 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:38 +0000 Subject: [PATCH v5 16/21] regulator: s2mps11: add S2MPG10 regulator Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-16-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 The S2MPG10 PMIC is a Power Management IC for mobile applications with buck converters, various LDOs, power meters, RTC, clock outputs, and additional GPIO interfaces. It has 10 buck and 31 LDO rails. Several of these can either be controlled via software (register writes) or via external signals, in particular by: * one out of several input pins connected to a main processor's: * GPIO pins * other pins that are e.g. firmware- or power-domain-controlled without explicit driver intervention * a combination of input pins and register writes. Control via input pins allows PMIC rails to be controlled by firmware, e.g. during standby/suspend, or as part of power domain handling where otherwise that would not be possible. Additionally toggling a pin is faster than register writes, and it also allows the PMIC to ensure that any necessary timing requirements between rails are respected automatically if multiple rails are to be enabled or disabled quasi simultaneously. This commit implements support for all these rails and control combinations. Additional data needs to be stored for each regulator, e.g. the input pin for external control, or a rail-specific ramp-rate for when enabling a buck-rail. Therefore, probe() is updated slightly to make that possible. Note1: For an externally controlled rail, the regulator_ops provide an empty ::enable() and no ::disable() implementations, even though Linux can not enable the rail and one might think ::enable could be NULL. Without ops->enable(), the regulator core will assume enabling such a rail failed, though, and in turn never add a reference to its parent (supplier) rail. Once a different (Linux-controlled) sibling (consumer) rail on that same parent rail gets disabled, the parent gets disabled (cutting power to the externally controlled rail although it should stay on), and the system will misbehave. Note2: While external control via input pins appears to exist on other versions of this PMIC, there is more flexibility in this version, in particular there is a selection of input pins to choose from for each rail (which must therefore be configured accordingly if in use), whereas other versions don't have this flexibility. Signed-off-by: Andr=C3=A9 Draszik --- v5: - one instance per PMIC, not per rail or rail type (Mark) v3: - one instance per actual rail, not per rail type (LDO or buck) - use REGULATOR_LINEAR_VRANGE macro - sort s2mpg10 bucks before LDOs throughout (alphabetic ordering) - LDO 1 and 7 also support setting a ramp rate - add ::enable() to ops for signal-controlled rails and update commit message detailing why - more details around signal controlled rails in commit message - switch to 'enable-gpios' instead of samsung,ext-control-gpios for OS-controlled GPIOs (Krzysztof) v2: - move assignment of ::of_parse_cb in regulator_desc_s2mpg10_buck() to match order of struct definition --- drivers/regulator/s2mps11.c | 593 ++++++++++++++++++++++++++++++++= +++- include/linux/mfd/samsung/s2mpg10.h | 24 ++ 2 files changed, 611 insertions(+), 6 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index bb0a4f35ef47551f7171321fdde2c0202ce86ede..4924c48ee7502c63f7a1fc620a2= d252b7d8ed828 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -3,6 +3,7 @@ // Copyright (c) 2012-2014 Samsung Electronics Co., Ltd // http://www.samsung.com =20 +#include #include #include #include @@ -16,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -23,6 +25,11 @@ #include #include =20 +enum { + S2MPG10_REGULATOR_OPS_STD, + S2MPG10_REGULATOR_OPS_EXTCONTROL, +}; + /* The highest number of possible regulators for supported devices. */ #define S2MPS_REGULATOR_MAX S2MPS13_REGULATOR_MAX struct s2mps11_info { @@ -42,6 +49,21 @@ struct s2mps11_info { DECLARE_BITMAP(suspend_state, S2MPS_REGULATOR_MAX); }; =20 +#define to_s2mpg10_regulator_desc(x) container_of((x), struct s2mpg10_regu= lator_desc, desc) + +struct s2mpg10_regulator_desc { + struct regulator_desc desc; + + /* Ramp rate during enable, valid for bucks only. */ + unsigned int enable_ramp_rate; + + /* Registers for external control of rail. */ + unsigned int pctrlsel_reg; + unsigned int pctrlsel_mask; + /* Populated from DT. */ + unsigned int pctrlsel_val; +}; + static int get_ramp_delay(int ramp_delay) { unsigned char cnt =3D 0; @@ -329,14 +351,14 @@ static int s2mps11_regulator_set_suspend_disable(stru= ct regulator_dev *rdev) } =20 static int s2mps11_of_parse_gpiod(struct device_node *np, + const char *con_id, const struct regulator_desc *desc, struct regulator_config *config) { struct gpio_desc *ena_gpiod; int ret; =20 - ena_gpiod =3D fwnode_gpiod_get_index(of_fwnode_handle(np), - "samsung,ext-control", 0, + ena_gpiod =3D fwnode_gpiod_get_index(of_fwnode_handle(np), con_id, 0, GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE, "s2mps11-regulator"); @@ -385,9 +407,533 @@ static int s2mps11_of_parse_cb(struct device_node *np, else return 0; =20 - return s2mps11_of_parse_gpiod(np, desc, config); + return s2mps11_of_parse_gpiod(np, "samsung,ext-control", desc, config); +} + +static int s2mpg10_of_parse_cb(struct device_node *np, + const struct regulator_desc *desc, + struct regulator_config *config) +{ + const struct s2mps11_info *s2mps11 =3D config->driver_data; + struct s2mpg10_regulator_desc *s2mpg10_desc =3D to_s2mpg10_regulator_desc= (desc); + static const u32 ext_control_s2mpg10[] =3D { + [S2MPG10_EXTCTRL_PWREN] =3D S2MPG10_PCTRLSEL_PWREN, + [S2MPG10_EXTCTRL_PWREN_MIF] =3D S2MPG10_PCTRLSEL_PWREN_MIF, + [S2MPG10_EXTCTRL_AP_ACTIVE_N] =3D S2MPG10_PCTRLSEL_AP_ACTIVE_N, + [S2MPG10_EXTCTRL_CPUCL1_EN] =3D S2MPG10_PCTRLSEL_CPUCL1_EN, + [S2MPG10_EXTCTRL_CPUCL1_EN2] =3D S2MPG10_PCTRLSEL_CPUCL1_EN2, + [S2MPG10_EXTCTRL_CPUCL2_EN] =3D S2MPG10_PCTRLSEL_CPUCL2_EN, + [S2MPG10_EXTCTRL_CPUCL2_EN2] =3D S2MPG10_PCTRLSEL_CPUCL2_EN2, + [S2MPG10_EXTCTRL_TPU_EN] =3D S2MPG10_PCTRLSEL_TPU_EN, + [S2MPG10_EXTCTRL_TPU_EN2] =3D S2MPG10_PCTRLSEL_TPU_EN2, + [S2MPG10_EXTCTRL_TCXO_ON] =3D S2MPG10_PCTRLSEL_TCXO_ON, + [S2MPG10_EXTCTRL_TCXO_ON2] =3D S2MPG10_PCTRLSEL_TCXO_ON2, + [S2MPG10_EXTCTRL_LDO20M_EN2] =3D S2MPG10_PCTRLSEL_LDO20M_EN2, + [S2MPG10_EXTCTRL_LDO20M_EN] =3D S2MPG10_PCTRLSEL_LDO20M_EN, + }; + u32 ext_control; + + if (s2mps11->dev_type !=3D S2MPG10) + return 0; + + if (of_property_read_u32(np, "samsung,ext-control", &ext_control)) + return 0; + + switch (s2mps11->dev_type) { + case S2MPG10: + switch (desc->id) { + case S2MPG10_BUCK1 ... S2MPG10_BUCK7: + case S2MPG10_BUCK10: + case S2MPG10_LDO3 ... S2MPG10_LDO19: + if (ext_control > S2MPG10_EXTCTRL_TCXO_ON2) + return -EINVAL; + break; + + case S2MPG10_LDO20: + if (ext_control < S2MPG10_EXTCTRL_LDO20M_EN2 || + ext_control > S2MPG10_EXTCTRL_LDO20M_EN) + return -EINVAL; + break; + + default: + return -EINVAL; + } + + if (ext_control > ARRAY_SIZE(ext_control_s2mpg10)) + return -EINVAL; + ext_control =3D ext_control_s2mpg10[ext_control]; + break; + + default: + return -EINVAL; + } + + /* + * If the regulator should be configured for external control, then: + * 1) the PCTRLSELx register needs to be set accordingly + * 2) regulator_desc::enable_val needs to be: + * a) updated and + * b) written to the hardware + * 3) we switch to the ::ops that provide an empty ::enable() and no + * ::disable() implementations + * + * Points 1) and 2b) will be handled in _probe(), after + * devm_regulator_register() returns, so that we can properly act on + * failures, since the regulator core ignores most return values from + * this parse callback. + */ + s2mpg10_desc->pctrlsel_val =3D ext_control; + s2mpg10_desc->pctrlsel_val <<=3D (ffs(s2mpg10_desc->pctrlsel_mask) - 1); + + s2mpg10_desc->desc.enable_val =3D S2MPG10_PMIC_CTRL_ENABLE_EXT; + s2mpg10_desc->desc.enable_val <<=3D (ffs(desc->enable_mask) - 1); + + ++s2mpg10_desc->desc.ops; + + return s2mps11_of_parse_gpiod(np, "enable", desc, config); +} + +static int s2mpg10_enable_ext_control(struct s2mps11_info *s2mps11, + struct regulator_dev *rdev) +{ + const struct s2mpg10_regulator_desc *s2mpg10_desc; + int ret; + + switch (s2mps11->dev_type) { + case S2MPG10: + s2mpg10_desc =3D to_s2mpg10_regulator_desc(rdev->desc); + break; + + default: + return 0; + } + + ret =3D regmap_update_bits(rdev_get_regmap(rdev), + s2mpg10_desc->pctrlsel_reg, + s2mpg10_desc->pctrlsel_mask, + s2mpg10_desc->pctrlsel_val); + if (ret) + return dev_err_probe(rdev_get_dev(rdev), ret, + "failed to configure pctrlsel for %s\n", + rdev->desc->name); + + /* + * When using external control, the enable bit of the regulator still + * needs to be set. The actual state will still be determined by the + * external signal. + */ + ret =3D regulator_enable_regmap(rdev); + if (ret) + return dev_err_probe(rdev_get_dev(rdev), ret, + "failed to enable regulator %s\n", + rdev->desc->name); + + return 0; +} + +static int s2mpg10_regulator_enable_nop(struct regulator_dev *rdev) +{ + /* + * We need to provide this, otherwise the regulator core's enable on + * this regulator will return a failure and subsequently disable our + * parent regulator. + */ + return 0; +} + +static int s2mpg10_regulator_buck_enable_time(struct regulator_dev *rdev) +{ + const struct s2mpg10_regulator_desc * const s2mpg10_desc =3D + to_s2mpg10_regulator_desc(rdev->desc); + const struct regulator_ops * const ops =3D rdev->desc->ops; + int vsel, curr_uV; + + vsel =3D ops->get_voltage_sel(rdev); + if (vsel < 0) + return vsel; + + curr_uV =3D ops->list_voltage(rdev, vsel); + if (curr_uV < 0) + return curr_uV; + + return (rdev->desc->enable_time + + DIV_ROUND_UP(curr_uV, s2mpg10_desc->enable_ramp_rate)); +} + +static int s2mpg10_regulator_buck_set_voltage_time(struct regulator_dev *r= dev, + int old_uV, int new_uV) +{ + unsigned int ramp_reg, ramp_sel, ramp_rate; + int ret; + + if (old_uV =3D=3D new_uV) + return 0; + + ramp_reg =3D rdev->desc->ramp_reg; + if (old_uV > new_uV) + /* The downwards ramp is at a different offset. */ + ramp_reg +=3D S2MPG10_PMIC_DVS_RAMP4 - S2MPG10_PMIC_DVS_RAMP1; + + ret =3D regmap_read(rdev->regmap, ramp_reg, &ramp_sel); + if (ret) + return ret; + + ramp_sel &=3D rdev->desc->ramp_mask; + ramp_sel >>=3D ffs(rdev->desc->ramp_mask) - 1; + if (ramp_sel >=3D rdev->desc->n_ramp_values || + !rdev->desc->ramp_delay_table) + return -EINVAL; + + ramp_rate =3D rdev->desc->ramp_delay_table[ramp_sel]; + + return DIV_ROUND_UP(abs(new_uV - old_uV), ramp_rate); } =20 +/* + * We assign both, ::set_voltage_time() and ::set_voltage_time_sel(), beca= use + * only if the latter is !=3D NULL, the regulator core will call neither d= uring + * DVS if the regulator is disabled. If the latter is NULL, the core always + * calls the ::set_voltage_time() callback, which would give incorrect res= ults + * if the regulator is off. + * At the same time, we do need ::set_voltage_time() due to differing upwa= rds + * and downwards ramps and we can not make that code dependent on the regu= lator + * enable state, as that would break regulator_set_voltage_time() which + * expects a correct result no matter the enable state. + */ +static const struct regulator_ops s2mpg10_reg_buck_ops[] =3D { + [S2MPG10_REGULATOR_OPS_STD] =3D { + .list_voltage =3D regulator_list_voltage_linear_range, + .map_voltage =3D regulator_map_voltage_linear_range, + .is_enabled =3D regulator_is_enabled_regmap, + .enable =3D regulator_enable_regmap, + .disable =3D regulator_disable_regmap, + .enable_time =3D s2mpg10_regulator_buck_enable_time, + .get_voltage_sel =3D regulator_get_voltage_sel_regmap, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .set_voltage_time =3D s2mpg10_regulator_buck_set_voltage_time, + .set_voltage_time_sel =3D regulator_set_voltage_time_sel, + .set_ramp_delay =3D regulator_set_ramp_delay_regmap, + }, + [S2MPG10_REGULATOR_OPS_EXTCONTROL] =3D { + .list_voltage =3D regulator_list_voltage_linear_range, + .map_voltage =3D regulator_map_voltage_linear_range, + .enable =3D s2mpg10_regulator_enable_nop, + .get_voltage_sel =3D regulator_get_voltage_sel_regmap, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .set_voltage_time =3D s2mpg10_regulator_buck_set_voltage_time, + .set_voltage_time_sel =3D regulator_set_voltage_time_sel, + .set_ramp_delay =3D regulator_set_ramp_delay_regmap, + } +}; + +#define s2mpg10_buck_to_ramp_mask(n) (GENMASK(1, 0) << (((n) % 4) * 2)) + +/* + * The ramp_delay during enable is fixed (12.5mV/=CE=BCs), while the ramp = during + * DVS can be adjusted. Linux can adjust the ramp delay via DT, in which c= ase + * the regulator core will modify the regulator's constraints and call our + * .set_ramp_delay() which updates the DVS ramp in ramp_reg. + * For enable, our .enable_time() unconditionally uses enable_ramp_rate + * (12.5mV/=CE=BCs) while our ::set_voltage_time() takes the value in ramp= _reg + * into account. + */ +#define regulator_desc_s2mpg10_buck(_num, _vrange, _r_reg) { \ + .name =3D "buck"#_num "m", \ + .supply_name =3D "vinb"#_num "m", \ + .of_match =3D of_match_ptr("buck"#_num "m"), \ + .regulators_node =3D of_match_ptr("regulators"), \ + .of_parse_cb =3D s2mpg10_of_parse_cb, \ + .id =3D S2MPG10_BUCK##_num, \ + .ops =3D &s2mpg10_reg_buck_ops[0], \ + .type =3D REGULATOR_VOLTAGE, \ + .owner =3D THIS_MODULE, \ + .linear_ranges =3D _vrange, \ + .n_linear_ranges =3D ARRAY_SIZE(_vrange), \ + .n_voltages =3D _vrange##_count, \ + .vsel_reg =3D S2MPG10_PMIC_B##_num##M_OUT1, \ + .vsel_mask =3D 0xff, \ + .enable_reg =3D S2MPG10_PMIC_B##_num##M_CTRL, \ + .enable_mask =3D GENMASK(7, 6), \ + .ramp_reg =3D S2MPG10_PMIC_##_r_reg, \ + .ramp_mask =3D s2mpg10_buck_to_ramp_mask(S2MPG10_BUCK##_num \ + - S2MPG10_BUCK1), \ + .ramp_delay_table =3D s2mpg10_buck_ramp_table, \ + .n_ramp_values =3D ARRAY_SIZE(s2mpg10_buck_ramp_table), \ + .enable_time =3D 30, /* + V/enable_ramp_rate */ \ +} + +#define s2mpg10_regulator_desc_buck_cm(_num, _vrange, _r_reg) \ + .desc =3D regulator_desc_s2mpg10_buck(_num, _vrange, _r_reg), \ + .enable_ramp_rate =3D 12500 + +#define s2mpg10_regulator_desc_buck_gpio(_num, _vrange, _r_reg, \ + _pc_reg, _pc_mask) \ + [S2MPG10_BUCK##_num] =3D { \ + s2mpg10_regulator_desc_buck_cm(_num, _vrange, _r_reg), \ + .pctrlsel_reg =3D S2MPG10_PMIC_##_pc_reg, \ + .pctrlsel_mask =3D _pc_mask, \ + } + +#define s2mpg10_regulator_desc_buck(_num, _vrange, _r_reg) \ + [S2MPG10_BUCK##_num] =3D { \ + s2mpg10_regulator_desc_buck_cm(_num, _vrange, _r_reg), \ + } + +/* ops for S2MPG1x LDO regulators without ramp control */ +static const struct regulator_ops s2mpg10_reg_ldo_ops[] =3D { + [S2MPG10_REGULATOR_OPS_STD] =3D { + .list_voltage =3D regulator_list_voltage_linear_range, + .map_voltage =3D regulator_map_voltage_linear_range, + .is_enabled =3D regulator_is_enabled_regmap, + .enable =3D regulator_enable_regmap, + .disable =3D regulator_disable_regmap, + .get_voltage_sel =3D regulator_get_voltage_sel_regmap, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .set_voltage_time_sel =3D regulator_set_voltage_time_sel, + }, + [S2MPG10_REGULATOR_OPS_EXTCONTROL] =3D { + .list_voltage =3D regulator_list_voltage_linear_range, + .map_voltage =3D regulator_map_voltage_linear_range, + .enable =3D s2mpg10_regulator_enable_nop, + .get_voltage_sel =3D regulator_get_voltage_sel_regmap, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .set_voltage_time_sel =3D regulator_set_voltage_time_sel, + } +}; + +/* ops for S2MPG1x LDO regulators that have ramp control */ +static const struct regulator_ops s2mpg10_reg_ldo_ramp_ops[] =3D { + [S2MPG10_REGULATOR_OPS_STD] =3D { + .list_voltage =3D regulator_list_voltage_linear_range, + .map_voltage =3D regulator_map_voltage_linear_range, + .is_enabled =3D regulator_is_enabled_regmap, + .enable =3D regulator_enable_regmap, + .disable =3D regulator_disable_regmap, + .get_voltage_sel =3D regulator_get_voltage_sel_regmap, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .set_voltage_time_sel =3D regulator_set_voltage_time_sel, + .set_ramp_delay =3D regulator_set_ramp_delay_regmap, + }, + [S2MPG10_REGULATOR_OPS_EXTCONTROL] =3D { + .list_voltage =3D regulator_list_voltage_linear_range, + .map_voltage =3D regulator_map_voltage_linear_range, + .enable =3D s2mpg10_regulator_enable_nop, + .get_voltage_sel =3D regulator_get_voltage_sel_regmap, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .set_voltage_time_sel =3D regulator_set_voltage_time_sel, + .set_ramp_delay =3D regulator_set_ramp_delay_regmap, + } +}; + +#define regulator_desc_s2mpg10_ldo_cmn(_num, _supply, _ops, _vrange, \ + _vsel_reg_sfx, _vsel_mask, _en_reg, _en_mask, \ + _ramp_delay, _r_reg, _r_mask, _r_table, _r_table_sz) { \ + .name =3D "ldo"#_num "m", \ + .supply_name =3D _supply, \ + .of_match =3D of_match_ptr("ldo"#_num "m"), \ + .regulators_node =3D of_match_ptr("regulators"), \ + .of_parse_cb =3D s2mpg10_of_parse_cb, \ + .id =3D S2MPG10_LDO##_num, \ + .ops =3D &(_ops)[0], \ + .type =3D REGULATOR_VOLTAGE, \ + .owner =3D THIS_MODULE, \ + .linear_ranges =3D _vrange, \ + .n_linear_ranges =3D ARRAY_SIZE(_vrange), \ + .n_voltages =3D _vrange##_count, \ + .vsel_reg =3D S2MPG10_PMIC_L##_num##M_##_vsel_reg_sfx, \ + .vsel_mask =3D _vsel_mask, \ + .enable_reg =3D S2MPG10_PMIC_##_en_reg, \ + .enable_mask =3D _en_mask, \ + .ramp_delay =3D _ramp_delay, \ + .ramp_reg =3D _r_reg, \ + .ramp_mask =3D _r_mask, \ + .ramp_delay_table =3D _r_table, \ + .n_ramp_values =3D _r_table_sz, \ + .enable_time =3D 130, /* startup 20+-10 + ramp 30..100=CE=BCs */ \ +} + +#define s2mpg10_regulator_desc_ldo_cmn(_num, _supply, _ops, _vrange, \ + _vsel_reg_sfx, _vsel_mask, _en_reg, _en_mask, \ + _ramp_delay, _r_reg, _r_mask, _r_table, _r_table_sz, \ + _pc_reg, _pc_mask) \ + [S2MPG10_LDO##_num] =3D { \ + .desc =3D regulator_desc_s2mpg10_ldo_cmn(_num, _supply, \ + _ops, \ + _vrange, _vsel_reg_sfx, _vsel_mask, \ + _en_reg, _en_mask, \ + _ramp_delay, _r_reg, _r_mask, _r_table, \ + _r_table_sz), \ + .pctrlsel_reg =3D _pc_reg, \ + .pctrlsel_mask =3D _pc_mask, \ + } + +/* standard LDO via LxM_CTRL */ +#define s2mpg10_regulator_desc_ldo(_num, _supply, _vrange) \ + s2mpg10_regulator_desc_ldo_cmn(_num, _supply, \ + s2mpg10_reg_ldo_ops, _vrange, CTRL, GENMASK(5, 0), \ + L##_num##M_CTRL, BIT(7), \ + 0, 0, 0, NULL, 0, \ + 0, 0) + +/* standard LDO but possibly GPIO controlled */ +#define s2mpg10_regulator_desc_ldo_gpio(_num, _supply, _vrange, \ + _pc_reg, _pc_mask) \ + s2mpg10_regulator_desc_ldo_cmn(_num, _supply, \ + s2mpg10_reg_ldo_ops, _vrange, CTRL, GENMASK(5, 0), \ + L##_num##M_CTRL, GENMASK(7, 6), \ + 0, 0, 0, NULL, 0, \ + S2MPG10_PMIC_##_pc_reg, _pc_mask) + +/* LDO with ramp support and possibly GPIO controlled */ +#define s2mpg10_regulator_desc_ldo_ramp(_num, _supply, _vrange, \ + _en_mask, _r_reg, _pc_reg, _pc_mask) \ + s2mpg10_regulator_desc_ldo_cmn(_num, _supply, \ + s2mpg10_reg_ldo_ramp_ops, _vrange, CTRL1, GENMASK(6, 0), \ + LDO_CTRL2, _en_mask, \ + 6250, S2MPG10_PMIC_##_r_reg, GENMASK(1, 0), \ + s2mpg10_ldo_ramp_table, \ + ARRAY_SIZE(s2mpg10_ldo_ramp_table), \ + S2MPG10_PMIC_##_pc_reg, _pc_mask) + +#define S2MPG10_VOLTAGE_RANGE(_prefix, _idx, _offs_uV, _min_uV, \ + _max_uV, _step_uV) \ +static const struct linear_range _prefix##_vranges##_idx[] =3D { \ + REGULATOR_LINEAR_VRANGE(_offs_uV, _min_uV, _max_uV, _step_uV) \ +}; \ +static const unsigned int _prefix##_vranges##_idx##_count =3D \ + ((((_max_uV) - (_offs_uV)) / (_step_uV)) + 1) + +/* voltage range for s2mpg10 BUCK 1, 2, 3, 4, 5, 7, 8, 9, 10 */ +S2MPG10_VOLTAGE_RANGE(s2mpg10_buck, 1, 200000, 450000, 1300000, STEP_6_25_= MV); + +/* voltage range for s2mpg10 BUCK 6 */ +S2MPG10_VOLTAGE_RANGE(s2mpg10_buck, 6, 200000, 450000, 1350000, STEP_6_25_= MV); + +static const unsigned int s2mpg10_buck_ramp_table[] =3D { + 6250, 12500, 25000 +}; + +/* voltage range for s2mpg10 LDO 1, 11, 12 */ +S2MPG10_VOLTAGE_RANGE(s2mpg10_ldo, 1, 300000, 700000, 1300000, STEP_12_5_M= V); + +/* voltage range for s2mpg10 LDO 2, 4, 9, 14, 18, 19, 20, 23, 25, 29, 30, = 31 */ +S2MPG10_VOLTAGE_RANGE(s2mpg10_ldo, 2, 700000, 1600000, 1950000, STEP_25_MV= ); + +/* voltage range for s2mpg10 LDO 3, 5, 6, 8, 16, 17, 24, 28 */ +S2MPG10_VOLTAGE_RANGE(s2mpg10_ldo, 3, 725000, 725000, 1300000, STEP_12_5_M= V); + +/* voltage range for s2mpg10 LDO 7 */ +S2MPG10_VOLTAGE_RANGE(s2mpg10_ldo, 7, 300000, 450000, 1300000, STEP_12_5_M= V); + +/* voltage range for s2mpg10 LDO 13, 15 */ +S2MPG10_VOLTAGE_RANGE(s2mpg10_ldo, 13, 300000, 450000, 950000, STEP_12_5_M= V); + +/* voltage range for s2mpg10 LDO 10 */ +S2MPG10_VOLTAGE_RANGE(s2mpg10_ldo, 10, 1800000, 1800000, 3350000, STEP_25_= MV); + +/* voltage range for s2mpg10 LDO 21, 22, 26, 27 */ +S2MPG10_VOLTAGE_RANGE(s2mpg10_ldo, 21, 1800000, 2500000, 3300000, STEP_25_= MV); + +/* possible ramp values for s2mpg10 LDO 1, 7, 11, 12, 13, 15 */ +static const unsigned int s2mpg10_ldo_ramp_table[] =3D { + 6250, 12500 +}; + +static const struct s2mpg10_regulator_desc s2mpg10_regulators[] =3D { + s2mpg10_regulator_desc_buck_gpio(1, s2mpg10_buck_vranges1, DVS_RAMP1, + PCTRLSEL1, GENMASK(3, 0)), + s2mpg10_regulator_desc_buck_gpio(2, s2mpg10_buck_vranges1, DVS_RAMP1, + PCTRLSEL1, GENMASK(7, 4)), + s2mpg10_regulator_desc_buck_gpio(3, s2mpg10_buck_vranges1, DVS_RAMP1, + PCTRLSEL2, GENMASK(3, 0)), + s2mpg10_regulator_desc_buck_gpio(4, s2mpg10_buck_vranges1, DVS_RAMP1, + PCTRLSEL2, GENMASK(7, 4)), + s2mpg10_regulator_desc_buck_gpio(5, s2mpg10_buck_vranges1, DVS_RAMP2, + PCTRLSEL3, GENMASK(3, 0)), + s2mpg10_regulator_desc_buck_gpio(6, s2mpg10_buck_vranges6, DVS_RAMP2, + PCTRLSEL3, GENMASK(7, 4)), + s2mpg10_regulator_desc_buck_gpio(7, s2mpg10_buck_vranges1, DVS_RAMP2, + PCTRLSEL4, GENMASK(3, 0)), + s2mpg10_regulator_desc_buck(8, s2mpg10_buck_vranges1, DVS_RAMP2), + s2mpg10_regulator_desc_buck(9, s2mpg10_buck_vranges1, DVS_RAMP3), + s2mpg10_regulator_desc_buck_gpio(10, s2mpg10_buck_vranges1, DVS_RAMP3, + PCTRLSEL4, GENMASK(7, 4)), + /* + * Standard LDO via LxM_CTRL but non-standard (greater) V-range and with + * ramp support. + */ + s2mpg10_regulator_desc_ldo_cmn(1, "vinl3m", s2mpg10_reg_ldo_ramp_ops, + s2mpg10_ldo_vranges1, + CTRL, GENMASK(6, 0), + L1M_CTRL, BIT(7), + 6250, S2MPG10_PMIC_DVS_RAMP6, + GENMASK(5, 4), s2mpg10_ldo_ramp_table, + ARRAY_SIZE(s2mpg10_ldo_ramp_table), + 0, 0), + s2mpg10_regulator_desc_ldo(2, "vinl9m", s2mpg10_ldo_vranges2), + s2mpg10_regulator_desc_ldo_gpio(3, "vinl4m", s2mpg10_ldo_vranges3, + PCTRLSEL5, GENMASK(3, 0)), + s2mpg10_regulator_desc_ldo_gpio(4, "vinl9m", s2mpg10_ldo_vranges2, + PCTRLSEL5, GENMASK(7, 4)), + s2mpg10_regulator_desc_ldo_gpio(5, "vinl3m", s2mpg10_ldo_vranges3, + PCTRLSEL6, GENMASK(3, 0)), + s2mpg10_regulator_desc_ldo_gpio(6, "vinl7m", s2mpg10_ldo_vranges3, + PCTRLSEL6, GENMASK(7, 4)), + /* + * Ramp support, possibly GPIO controlled, non-standard (greater) V- + * range and enable reg & mask. + */ + s2mpg10_regulator_desc_ldo_cmn(7, "vinl3m", s2mpg10_reg_ldo_ramp_ops, + s2mpg10_ldo_vranges7, + CTRL, GENMASK(6, 0), + LDO_CTRL1, GENMASK(4, 3), + 6250, S2MPG10_PMIC_DVS_RAMP6, + GENMASK(7, 6), s2mpg10_ldo_ramp_table, + ARRAY_SIZE(s2mpg10_ldo_ramp_table), + S2MPG10_PMIC_PCTRLSEL7, GENMASK(3, 0)), + s2mpg10_regulator_desc_ldo_gpio(8, "vinl4m", s2mpg10_ldo_vranges3, + PCTRLSEL7, GENMASK(7, 4)), + s2mpg10_regulator_desc_ldo_gpio(9, "vinl10m", s2mpg10_ldo_vranges2, + PCTRLSEL8, GENMASK(3, 0)), + s2mpg10_regulator_desc_ldo_gpio(10, "vinl15m", s2mpg10_ldo_vranges10, + PCTRLSEL8, GENMASK(7, 4)), + s2mpg10_regulator_desc_ldo_ramp(11, "vinl7m", s2mpg10_ldo_vranges1, + GENMASK(1, 0), DVS_SYNC_CTRL3, + PCTRLSEL9, GENMASK(3, 0)), + s2mpg10_regulator_desc_ldo_ramp(12, "vinl8m", s2mpg10_ldo_vranges1, + GENMASK(3, 2), DVS_SYNC_CTRL4, + PCTRLSEL9, GENMASK(7, 4)), + s2mpg10_regulator_desc_ldo_ramp(13, "vinl1m", s2mpg10_ldo_vranges13, + GENMASK(5, 4), DVS_SYNC_CTRL5, + PCTRLSEL10, GENMASK(3, 0)), + s2mpg10_regulator_desc_ldo_gpio(14, "vinl10m", s2mpg10_ldo_vranges2, + PCTRLSEL10, GENMASK(7, 4)), + s2mpg10_regulator_desc_ldo_ramp(15, "vinl2m", s2mpg10_ldo_vranges13, + GENMASK(7, 6), DVS_SYNC_CTRL6, + PCTRLSEL11, GENMASK(3, 0)), + s2mpg10_regulator_desc_ldo_gpio(16, "vinl5m", s2mpg10_ldo_vranges3, + PCTRLSEL11, GENMASK(7, 4)), + s2mpg10_regulator_desc_ldo_gpio(17, "vinl6m", s2mpg10_ldo_vranges3, + PCTRLSEL12, GENMASK(3, 0)), + s2mpg10_regulator_desc_ldo_gpio(18, "vinl10m", s2mpg10_ldo_vranges2, + PCTRLSEL12, GENMASK(7, 4)), + s2mpg10_regulator_desc_ldo_gpio(19, "vinl10m", s2mpg10_ldo_vranges2, + PCTRLSEL13, GENMASK(3, 0)), + s2mpg10_regulator_desc_ldo_gpio(20, "vinl10m", s2mpg10_ldo_vranges2, + PCTRLSEL13, GENMASK(7, 4)), + s2mpg10_regulator_desc_ldo(21, "vinl14m", s2mpg10_ldo_vranges21), + s2mpg10_regulator_desc_ldo(22, "vinl15m", s2mpg10_ldo_vranges21), + s2mpg10_regulator_desc_ldo(23, "vinl11m", s2mpg10_ldo_vranges2), + s2mpg10_regulator_desc_ldo(24, "vinl7m", s2mpg10_ldo_vranges3), + s2mpg10_regulator_desc_ldo(25, "vinl10m", s2mpg10_ldo_vranges2), + s2mpg10_regulator_desc_ldo(26, "vinl15m", s2mpg10_ldo_vranges21), + s2mpg10_regulator_desc_ldo(27, "vinl15m", s2mpg10_ldo_vranges21), + s2mpg10_regulator_desc_ldo(28, "vinl7m", s2mpg10_ldo_vranges3), + s2mpg10_regulator_desc_ldo(29, "vinl12m", s2mpg10_ldo_vranges2), + s2mpg10_regulator_desc_ldo(30, "vinl13m", s2mpg10_ldo_vranges2), + s2mpg10_regulator_desc_ldo(31, "vinl11m", s2mpg10_ldo_vranges2) +}; + static const struct regulator_ops s2mps11_ldo_ops =3D { .list_voltage =3D regulator_list_voltage_linear, .map_voltage =3D regulator_map_voltage_linear, @@ -1271,6 +1817,18 @@ static int s2mps11_handle_ext_control(struct s2mps11= _info *s2mps11, ret =3D s2mps14_pmic_enable_ext_control(s2mps11, rdev); break; =20 + case S2MPG10: + /* + * If desc.enable_val is !=3D 0, then external control was + * requested. We can not test s2mpg10_desc::ext_control, + * because 0 is a valid value. + */ + if (!rdev->desc->enable_val) + return 0; + + ret =3D s2mpg10_enable_ext_control(s2mps11, rdev); + break; + default: return 0; } @@ -1286,6 +1844,7 @@ static int s2mps11_pmic_probe(struct platform_device = *pdev) unsigned int rdev_num; int i, ret; const struct regulator_desc *regulators; + const struct s2mpg10_regulator_desc *s2mpg1x_regulators =3D NULL; =20 s2mps11 =3D devm_kzalloc(&pdev->dev, sizeof(struct s2mps11_info), GFP_KERNEL); @@ -1294,6 +1853,11 @@ static int s2mps11_pmic_probe(struct platform_device= *pdev) =20 s2mps11->dev_type =3D platform_get_device_id(pdev)->driver_data; switch (s2mps11->dev_type) { + case S2MPG10: + rdev_num =3D ARRAY_SIZE(s2mpg10_regulators); + s2mpg1x_regulators =3D s2mpg10_regulators; + BUILD_BUG_ON(ARRAY_SIZE(s2mpg10_regulators) > S2MPS_REGULATOR_MAX); + break; case S2MPS11X: rdev_num =3D ARRAY_SIZE(s2mps11_regulators); regulators =3D s2mps11_regulators; @@ -1330,6 +1894,17 @@ static int s2mps11_pmic_probe(struct platform_device= *pdev) s2mps11->dev_type); } =20 + if (s2mpg1x_regulators) { + size_t regulators_sz =3D rdev_num * sizeof(*s2mpg1x_regulators); + + s2mpg1x_regulators =3D devm_kmemdup(&pdev->dev, + s2mpg1x_regulators, + regulators_sz, + GFP_KERNEL); + if (!s2mpg1x_regulators) + return -ENOMEM; + } + device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); =20 platform_set_drvdata(pdev, s2mps11); @@ -1338,15 +1913,20 @@ static int s2mps11_pmic_probe(struct platform_devic= e *pdev) config.regmap =3D iodev->regmap_pmic; config.driver_data =3D s2mps11; for (i =3D 0; i < rdev_num; i++) { + const struct regulator_desc *rdesc; struct regulator_dev *regulator; =20 + if (s2mpg1x_regulators) + rdesc =3D &s2mpg1x_regulators[i].desc; + else + rdesc =3D ®ulators[i]; + regulator =3D devm_regulator_register(&pdev->dev, - ®ulators[i], &config); + rdesc, &config); if (IS_ERR(regulator)) return dev_err_probe(&pdev->dev, PTR_ERR(regulator), "regulator init failed for %d/%s\n", - regulators[i].id, - regulators[i].name); + rdesc->id, rdesc->name); =20 ret =3D s2mps11_handle_ext_control(s2mps11, regulator); if (ret < 0) @@ -1357,6 +1937,7 @@ static int s2mps11_pmic_probe(struct platform_device = *pdev) } =20 static const struct platform_device_id s2mps11_pmic_id[] =3D { + { "s2mpg10-regulator", S2MPG10}, { "s2mps11-regulator", S2MPS11X}, { "s2mps13-regulator", S2MPS13X}, { "s2mps14-regulator", S2MPS14X}, diff --git a/include/linux/mfd/samsung/s2mpg10.h b/include/linux/mfd/samsun= g/s2mpg10.h index aec248c51f366359ff323f421e453a0ec1d1dfa3..8e5cf21cbd5a0bcfa36c89b8300= a8c3247d6c6f8 100644 --- a/include/linux/mfd/samsung/s2mpg10.h +++ b/include/linux/mfd/samsung/s2mpg10.h @@ -290,6 +290,30 @@ enum s2mpg10_pmic_reg { S2MPG10_PMIC_LDO_SENSE4, }; =20 +/* Rail controlled externally, based on PCTRLSELx */ +#define S2MPG10_PMIC_CTRL_ENABLE_EXT BIT(0) + +/* For S2MPG10_PMIC_PCTRLSELx */ +#define S2MPG10_PCTRLSEL_PWREN 0x1 /* PWREN pin */ +#define S2MPG10_PCTRLSEL_PWREN_TRG 0x2 /* PWREN_TRG bit in MIMICKING= _CTRL */ +#define S2MPG10_PCTRLSEL_PWREN_MIF 0x3 /* PWREN_MIF pin */ +#define S2MPG10_PCTRLSEL_PWREN_MIF_TRG 0x4 /* PWREN_MIF_TRG bit in MIMIC= KING_CTRL */ +#define S2MPG10_PCTRLSEL_AP_ACTIVE_N 0x5 /* ~AP_ACTIVE_N pin */ +#define S2MPG10_PCTRLSEL_AP_ACTIVE_N_TRG 0x6 /* ~AP_ACTIVE_N_TRG bit in MI= MICKING_CTRL */ +#define S2MPG10_PCTRLSEL_CPUCL1_EN 0x7 /* CPUCL1_EN pin */ +#define S2MPG10_PCTRLSEL_CPUCL1_EN2 0x8 /* CPUCL1_EN & PWREN pins */ +#define S2MPG10_PCTRLSEL_CPUCL2_EN 0x9 /* CPUCL2_EN pin */ +#define S2MPG10_PCTRLSEL_CPUCL2_EN2 0xa /* CPUCL2_E2 & PWREN pins */ +#define S2MPG10_PCTRLSEL_TPU_EN 0xb /* TPU_EN pin */ +#define S2MPG10_PCTRLSEL_TPU_EN2 0xc /* TPU_EN & ~AP_ACTIVE_N pins= */ +#define S2MPG10_PCTRLSEL_TCXO_ON 0xd /* TCXO_ON pin */ +#define S2MPG10_PCTRLSEL_TCXO_ON2 0xe /* TCXO_ON & ~AP_ACTIVE_N pin= s */ + +/* For S2MPG10_PMIC_PCTRLSELx of LDO20M */ +#define S2MPG10_PCTRLSEL_LDO20M_EN2 0x1 /* VLDO20M_EN & LDO20M_SFR */ +#define S2MPG10_PCTRLSEL_LDO20M_EN 0x2 /* VLDO20M_EN pin */ +#define S2MPG10_PCTRLSEL_LDO20M_SFR 0x3 /* LDO20M_SFR bit in LDO_CTRL= 1 register */ + /* Meter registers (type 0xa00) */ enum s2mpg10_meter_reg { S2MPG10_METER_CTRL1, --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAC8F32F754 for ; Sat, 27 Dec 2025 12:24:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838287; cv=none; b=Ov1UzY7QSHsqMFt8yqWiHgmeGLOG0MRyaRkCoLoeV/ypPKJHhtYZ77E6DcUenNZLlCYRbQ+HFn5DQXXweggU7Cg7BHXjMTJh1FzQOw+BUWaysSyFf0iQXD7Qe46SvgL8GE87pXC3qPHCdQ5A0MXsnvTYxWkDVEXEoMd41WxUFcc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838287; c=relaxed/simple; bh=ZtimU7gm1PrFcEfk0MV7OaApuuKINQ3TVVyW7YAfhJo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=crkjmvGuGyBHMJ2L8iCV1fM1r7T/TX1xMrrxzLJSFeC0QJPiWYvVb774jrc0QXy+tQ36JNRr9k4QJw/2bOUTr+HObDrIraBPpODS0oTMZZBUk2n9S5FcYTExAykQdYQpvq7FAVZgxgC/naMq4qQqCJ1IFbQXFInmBmRJ/hThDjY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=a5D2lvHh; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="a5D2lvHh" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-64b9230f564so9036907a12.1 for ; Sat, 27 Dec 2025 04:24:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838279; x=1767443079; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=mqjJPQ+Kki9Vjm0bw/2XeIC3VM9xGuMuLb0QgtHhylQ=; b=a5D2lvHht8oyyQOW/Q3Ixnu7h8kTS2EvkzTL3e+uzTSWZl5rcG99yzWmr2RV85MGag mOGcmnNIBOYxsP0sb/ElwrPjtazrr8DzV9SxwkxDgGZ9mOYSGc6B1tZ3D48bWlchpYDa YCBhOYc+1OLDktZ+PvAXVPqViAORGU/rdkC+za3nOe8HqeGWik9bneFxuHm8rks5oU2u 9kNjb3yC56rRC+gef1xI3/czxoFFh7hWZwOJqJRGgHSegl6qFiEvJLBBTUTSjszGyeDY DyB8Rwtr/IgEa9mWH5xMwfeiQ2xr/NRia1uNx73et+uW8X0ZeDsRT95dQL5zP29hjMwW zaXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838279; x=1767443079; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=mqjJPQ+Kki9Vjm0bw/2XeIC3VM9xGuMuLb0QgtHhylQ=; b=undgdh7/aB8bW/ZSZ3zaccuzgyl8W07gmRiWrZQMl/tkRKfRZRH2i6OfKNxW5joK1O WWza8E0tO/mydpaQjMKNSmzd6DoEL0xQEEYzm0lhDo8+Fya4cDMzC3oaWM2kVAZHATHi G9CuVj0vWo6bOH1g8O3h5stJ0kgdvxIcUwa7N7FUg+GBzmQNBRYgxlvOXgvBo6C39xii 0eFPx/SUuDtFpQ3CQskgQyeDe07YNljxg/5aEWenbPvbnDtZYuVDiKQD7+lIe5xgWPiR FS4wjCC3GdTTTxaWN2Zg2S/LftZ3aRtiXFQJDKn79V0ufxxZORM0rrv/uH9MdSQJgMhY 1u8g== X-Forwarded-Encrypted: i=1; AJvYcCVud9VM7/LsmgRrtQyk13haIg8Z9w3Pcqg51tTsr05U7qHqYpxUfAyBc92MKxVno3aILU288z6ZS3DzvEw=@vger.kernel.org X-Gm-Message-State: AOJu0YxYFvfrqGRy7VzrRezcfXcw1e6Rck5fu1AVAWNwFphgS3GtgZJd uaQtIqAKTX54/ufJY6Qjwsy7ZB627sano9dtJbzIuUW52NVaUuWu1uxs45Op1d81nnQ= X-Gm-Gg: AY/fxX4FbEFC1qZo5hJQmFpbpUDs1aK+M0TdyLvIgx66torgMjsdcKiOdCMugSXTLaj 6y6GCDv+QNnKvNOni/x1V2psSikmIt8Bk7tcbQv2duoWke5cVyCeh6RkYhtNwPteWqMaEBRwsL6 MqY2i8AjpG6JfI/4zG6NQz6KhNH2CvyaY46n5fKF6Tu1kXMejheE6rH1wuJXp+mRSrT7eFjqt8u xuT+8Mro08mr7LQMA1NbQKG/oLOkEDuGnAnWXaojdp7flJX/OvFeqN/zkCMzrJytRch94Zuu1H9 neGwlC0geo5bLOVBgSL+NcGvuORTmRKvHGudiD14yO+nJ1Vxdso4zN6heW/Dt1mbrtVHndQ5YhY g6FsAqVJzDMwXPJuqwOGUSq1bvDs8flZCGK3F2SluXiftFEoZDay05CevO7sCu+DygRv0sPq5qc bIZ0HhUVF8Ij+uQuXwRt7fZ9BaXXZ7IH5zyzTCKyB5Nc7GqA04SxP04zlCSP6g62/tqLRakqBov eXlyA== X-Google-Smtp-Source: AGHT+IE+QRrVPaBCy56QCbI4QkrRX7vUwMKYczTApOAlpziFFNN55uPCnxuQ1egJcYibXo+YhY/13A== X-Received: by 2002:a05:6402:2755:b0:64d:4894:774c with SMTP id 4fb4d7f45d1cf-64d48947a3emr18801609a12.7.1766838279224; Sat, 27 Dec 2025 04:24:39 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:38 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:39 +0000 Subject: [PATCH v5 17/21] regulator: s2mps11: refactor S2MPG10 ::set_voltage_time() for S2MPG11 reuse Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-17-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 The upcoming S2MPG11 support needs a similar, but different version of ::set_voltage_time(). For S2MPG10, the downwards and upwards ramps for a rail are at different offsets at the same bit positions, while for S2MPG11 the ramps are at the same offset at different bit positions. Refactor the existing version slightly to allow reuse. Signed-off-by: Andr=C3=A9 Draszik --- drivers/regulator/s2mps11.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 4924c48ee7502c63f7a1fc620a2d252b7d8ed828..beff85c72580efaa0bbfaaefe6b= 4386edcb00919 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -560,26 +560,23 @@ static int s2mpg10_regulator_buck_enable_time(struct = regulator_dev *rdev) + DIV_ROUND_UP(curr_uV, s2mpg10_desc->enable_ramp_rate)); } =20 -static int s2mpg10_regulator_buck_set_voltage_time(struct regulator_dev *r= dev, - int old_uV, int new_uV) +static int s2mpg1x_regulator_buck_set_voltage_time(struct regulator_dev *r= dev, + int old_uV, int new_uV, + unsigned int ramp_reg, + unsigned int ramp_mask) { - unsigned int ramp_reg, ramp_sel, ramp_rate; + unsigned int ramp_sel, ramp_rate; int ret; =20 if (old_uV =3D=3D new_uV) return 0; =20 - ramp_reg =3D rdev->desc->ramp_reg; - if (old_uV > new_uV) - /* The downwards ramp is at a different offset. */ - ramp_reg +=3D S2MPG10_PMIC_DVS_RAMP4 - S2MPG10_PMIC_DVS_RAMP1; - ret =3D regmap_read(rdev->regmap, ramp_reg, &ramp_sel); if (ret) return ret; =20 - ramp_sel &=3D rdev->desc->ramp_mask; - ramp_sel >>=3D ffs(rdev->desc->ramp_mask) - 1; + ramp_sel &=3D ramp_mask; + ramp_sel >>=3D ffs(ramp_mask) - 1; if (ramp_sel >=3D rdev->desc->n_ramp_values || !rdev->desc->ramp_delay_table) return -EINVAL; @@ -589,6 +586,21 @@ static int s2mpg10_regulator_buck_set_voltage_time(str= uct regulator_dev *rdev, return DIV_ROUND_UP(abs(new_uV - old_uV), ramp_rate); } =20 +static int s2mpg10_regulator_buck_set_voltage_time(struct regulator_dev *r= dev, + int old_uV, int new_uV) +{ + unsigned int ramp_reg; + + ramp_reg =3D rdev->desc->ramp_reg; + if (old_uV > new_uV) + /* The downwards ramp is at a different offset. */ + ramp_reg +=3D S2MPG10_PMIC_DVS_RAMP4 - S2MPG10_PMIC_DVS_RAMP1; + + return s2mpg1x_regulator_buck_set_voltage_time(rdev, old_uV, new_uV, + ramp_reg, + rdev->desc->ramp_mask); +} + /* * We assign both, ::set_voltage_time() and ::set_voltage_time_sel(), beca= use * only if the latter is !=3D NULL, the regulator core will call neither d= uring --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A936832F744 for ; Sat, 27 Dec 2025 12:24:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838290; cv=none; b=j86avwW5cSTUxzIlqdVewlitIVtsCMFSGlFMbFZaNH3e5qbgmZUSOhOJPZvHBnZgAbTSbxLuF9JwT5irIcGRh3o9buNADFPofEQmB4gF1kRnq+A4ag/NadAlmfp0I79rF+KacoAKMT36tyfJt6OQAbYSohxvbxgOszcHzeK8vLE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838290; c=relaxed/simple; bh=GmHLRlu6EXu3rlO6sUUFoarZmSsasrc3xFXNGExeInA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VDOOGuKzF3TQcOp/Fx2GbbPpOk/I+6RXVFFbFv8y/R6oHEgrjiR4urNnIUQpX22BIF9MF7oY36FkENOOb9gpKmkOEa7iilLrdfj5iK5ygj3Bjval8StJHyFIkDOeLFwzHPj7vei3qroK3l8i1tiw2l6XefSl4BtThRhsJimr8s8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=T0YCToUV; arc=none smtp.client-ip=209.85.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="T0YCToUV" Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-64d80a47491so9427826a12.1 for ; Sat, 27 Dec 2025 04:24:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838280; x=1767443080; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Mh3sOgyslUyQirT0DcDP+95jn+8TlJEJs45se+3aQEY=; b=T0YCToUVr5aSfTvL9z9DSQPkqJ/s3b/IMMLGH4Jhrv7tSYxAvhXNPYrfWgdEPOMWQy B2CppFhrcxoHrJWhX0HthYSeaaqYsvRzYBuMBcd8kL1RKHpOWOAMfRj07Q7vUZMINid6 r7Lmz9hO8hlvhtmEwEokfHXHDvCmLGz3JfduNiNxPfYiZvr9YIX23My9FdygfA65D48B RqZ6MK5DTMUzikPqfjuZKURJkTgvlk1ZWNjRIJRPV/7bJM88rQeVIEBhMH/kh/otYadS jw8OUeJJJwQl6VN3JFkWgUiJkjSDZ0ZygnZCbzwQThqGWh/oFGhTezVxtQgQv7Qtz/V3 Xftw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838280; x=1767443080; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Mh3sOgyslUyQirT0DcDP+95jn+8TlJEJs45se+3aQEY=; b=gHyvLhO5JpDe2lrEdCljQPyyvi3RoeLuzfshEI+Ltqj7nJVwSDnhYMNWB6yAg4RgZQ Gc9zcXvIE5l2S+t2NRSoS+HNR7I2KksSQk8WluopwLl7z15Fl98hYTnLDEJjAfalBW3f 38Ipoe/e5zx81qeroo534PWo6xdDUt574NB41kHi4lOmvSIw8oUi/2kA5kbODJiDmLDt I1zR/0qwjMB4MUSjoEPG7bxh59EqiAIiDUrxNMesj8Wgc+E8qYIUuApFCF1ZQSxW3vlN 4cJdixxiAtyFMVNvXEpzqSKzQAdY1kWXjk3vnKrNUwe7kPhO1FEp6Get+hxoduddVKEZ vi1g== X-Forwarded-Encrypted: i=1; AJvYcCVwCUjNz4o/iDVXQ+Db8sD5XSDDGhV/w0NYQiLwCjRZcv/uGnXNUEYt7KiyKEgyC6D+Du8DqfjgYgSrvVY=@vger.kernel.org X-Gm-Message-State: AOJu0Yw85AwSlNoftnlt9ZKkJSjivnKwl8y6StHX+53o+6h6M2xgy0+K T4nHQ1tizRy3S5K0SbdysQ+GcliNCe/SOIJjG8tjyK6mya+zA+klQ9LRkERjGCo/QV8= X-Gm-Gg: AY/fxX7z7zB89quKi7NZxxqb4syPorOzbbwYTCui7Vk16W9Hmg0SPFioOhEflEiRARX tkRcRrER2iUBpPVxgHbzk9ruhLAK9HoZyGLxkmQPW8nF1pBW2LQ/jCLKUap8VwT0fyYVxnJrAyx 3s4DSr6BHZSdgNYOuKoCjNZRWOmParun8cHlubviOrq1rF7RvE3tamsBRRIEIwOk1krdcMuItTF JSyShmhUOZJ6+9eU309u7lh8Pq85kA6IiWEiRK9ylZCbBw6hpffKdf2eCfUudaIVKch78u+lNxM /7O8JUrMfyapgo+x9D/30R0ZSLS0NzsnrsaC1JS4TrnC3A30g9zxHKkJ6gDZFqtHNREwYh6GsuQ 1fSjQyzH13VOSjrs75bF1pmCpHGGa5qx2z+PvM76w8dEm4hugJaIN08EH4s+uPMh++cXq0xwBOQ Sm+9NVe1cCBSwhd3lgmKwrTwczzRQFDluXCZ4j2xVs7b1Bh3eIJ94HHoj3wXqiwXqgza59Y45k5 zEx9Er6KqUAstjO X-Google-Smtp-Source: AGHT+IGFfpQSFxXNOZag/yIOo6Cnxa4IbO76rSSEb1gcHw8glndKrlYDwAIcv23/8DvUWbbUCEuOuQ== X-Received: by 2002:a05:6402:2078:b0:643:eae:b1b6 with SMTP id 4fb4d7f45d1cf-64b584d700dmr22012364a12.12.1766838279747; Sat, 27 Dec 2025 04:24:39 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:39 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:40 +0000 Subject: [PATCH v5 18/21] regulator: s2mps11: refactor S2MPG10 regulator macros for S2MPG11 reuse Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-18-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 Rails in the S2MPG11 share a very similar set of properties with S2MPG10 with slight differences. Update the existing macros to allow reuse by the upcoming S2MPG11 driver. Signed-off-by: Andr=C3=A9 Draszik --- Note: checkpatch complains about unused macro arguments _r_mask, _r_table, and _r_table_sz, but these are false-positives due to patch context. v2: - fix commit message typos: s2mp1 -> s2mpg1 - drop duplicated assignment of ::of_parse_cb in regulator_desc_s2mpg1x_buck_cmn() macro --- drivers/regulator/s2mps11.c | 69 +++++++++++++++++++++++++++--------------= ---- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index beff85c72580efaa0bbfaaefe6b4386edcb00919..34f82762d9549b854d730a1626e= d0450c19fbe2e 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -649,31 +649,44 @@ static const struct regulator_ops s2mpg10_reg_buck_op= s[] =3D { * (12.5mV/=CE=BCs) while our ::set_voltage_time() takes the value in ramp= _reg * into account. */ -#define regulator_desc_s2mpg10_buck(_num, _vrange, _r_reg) { \ - .name =3D "buck"#_num "m", \ - .supply_name =3D "vinb"#_num "m", \ - .of_match =3D of_match_ptr("buck"#_num "m"), \ +#define regulator_desc_s2mpg1x_buck_cmn(_name, _id, _supply, _ops, \ + _vrange, _vsel_reg, _vsel_mask, _en_reg, _en_mask, \ + _r_reg, _r_mask, _r_table, _r_table_sz, \ + _en_time) { \ + .name =3D "buck" _name, \ + .supply_name =3D _supply, \ + .of_match =3D of_match_ptr("buck" _name), \ .regulators_node =3D of_match_ptr("regulators"), \ .of_parse_cb =3D s2mpg10_of_parse_cb, \ - .id =3D S2MPG10_BUCK##_num, \ - .ops =3D &s2mpg10_reg_buck_ops[0], \ + .id =3D _id, \ + .ops =3D &(_ops)[0], \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ .linear_ranges =3D _vrange, \ .n_linear_ranges =3D ARRAY_SIZE(_vrange), \ .n_voltages =3D _vrange##_count, \ - .vsel_reg =3D S2MPG10_PMIC_B##_num##M_OUT1, \ - .vsel_mask =3D 0xff, \ - .enable_reg =3D S2MPG10_PMIC_B##_num##M_CTRL, \ - .enable_mask =3D GENMASK(7, 6), \ - .ramp_reg =3D S2MPG10_PMIC_##_r_reg, \ - .ramp_mask =3D s2mpg10_buck_to_ramp_mask(S2MPG10_BUCK##_num \ - - S2MPG10_BUCK1), \ - .ramp_delay_table =3D s2mpg10_buck_ramp_table, \ - .n_ramp_values =3D ARRAY_SIZE(s2mpg10_buck_ramp_table), \ - .enable_time =3D 30, /* + V/enable_ramp_rate */ \ + .vsel_reg =3D _vsel_reg, \ + .vsel_mask =3D _vsel_mask, \ + .enable_reg =3D _en_reg, \ + .enable_mask =3D _en_mask, \ + .ramp_reg =3D _r_reg, \ + .ramp_mask =3D _r_mask, \ + .ramp_delay_table =3D _r_table, \ + .n_ramp_values =3D _r_table_sz, \ + .enable_time =3D _en_time, /* + V/enable_ramp_rate */ \ } =20 +#define regulator_desc_s2mpg10_buck(_num, _vrange, _r_reg) \ + regulator_desc_s2mpg1x_buck_cmn(#_num "m", S2MPG10_BUCK##_num, \ + "vinb"#_num "m", s2mpg10_reg_buck_ops, _vrange, \ + S2MPG10_PMIC_B##_num##M_OUT1, GENMASK(7, 0), \ + S2MPG10_PMIC_B##_num##M_CTRL, GENMASK(7, 6), \ + S2MPG10_PMIC_##_r_reg, \ + s2mpg10_buck_to_ramp_mask(S2MPG10_BUCK##_num \ + - S2MPG10_BUCK1), \ + s2mpg10_buck_ramp_table, \ + ARRAY_SIZE(s2mpg10_buck_ramp_table), 30) + #define s2mpg10_regulator_desc_buck_cm(_num, _vrange, _r_reg) \ .desc =3D regulator_desc_s2mpg10_buck(_num, _vrange, _r_reg), \ .enable_ramp_rate =3D 12500 @@ -737,24 +750,24 @@ static const struct regulator_ops s2mpg10_reg_ldo_ram= p_ops[] =3D { } }; =20 -#define regulator_desc_s2mpg10_ldo_cmn(_num, _supply, _ops, _vrange, \ - _vsel_reg_sfx, _vsel_mask, _en_reg, _en_mask, \ +#define regulator_desc_s2mpg1x_ldo_cmn(_name, _id, _supply, _ops, \ + _vrange, _vsel_reg, _vsel_mask, _en_reg, _en_mask, \ _ramp_delay, _r_reg, _r_mask, _r_table, _r_table_sz) { \ - .name =3D "ldo"#_num "m", \ + .name =3D "ldo" _name, \ .supply_name =3D _supply, \ - .of_match =3D of_match_ptr("ldo"#_num "m"), \ + .of_match =3D of_match_ptr("ldo" _name), \ .regulators_node =3D of_match_ptr("regulators"), \ .of_parse_cb =3D s2mpg10_of_parse_cb, \ - .id =3D S2MPG10_LDO##_num, \ + .id =3D _id, \ .ops =3D &(_ops)[0], \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ .linear_ranges =3D _vrange, \ .n_linear_ranges =3D ARRAY_SIZE(_vrange), \ .n_voltages =3D _vrange##_count, \ - .vsel_reg =3D S2MPG10_PMIC_L##_num##M_##_vsel_reg_sfx, \ + .vsel_reg =3D _vsel_reg, \ .vsel_mask =3D _vsel_mask, \ - .enable_reg =3D S2MPG10_PMIC_##_en_reg, \ + .enable_reg =3D _en_reg, \ .enable_mask =3D _en_mask, \ .ramp_delay =3D _ramp_delay, \ .ramp_reg =3D _r_reg, \ @@ -769,10 +782,12 @@ static const struct regulator_ops s2mpg10_reg_ldo_ram= p_ops[] =3D { _ramp_delay, _r_reg, _r_mask, _r_table, _r_table_sz, \ _pc_reg, _pc_mask) \ [S2MPG10_LDO##_num] =3D { \ - .desc =3D regulator_desc_s2mpg10_ldo_cmn(_num, _supply, \ - _ops, \ - _vrange, _vsel_reg_sfx, _vsel_mask, \ - _en_reg, _en_mask, \ + .desc =3D regulator_desc_s2mpg1x_ldo_cmn(#_num "m", \ + S2MPG10_LDO##_num, _supply, _ops, \ + _vrange, \ + S2MPG10_PMIC_L##_num##M_##_vsel_reg_sfx, \ + _vsel_mask, \ + S2MPG10_PMIC_##_en_reg, _en_mask, \ _ramp_delay, _r_reg, _r_mask, _r_table, \ _r_table_sz), \ .pctrlsel_reg =3D _pc_reg, \ --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CB4A331200 for ; Sat, 27 Dec 2025 12:24:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838294; cv=none; b=bMMpgvhpik8Lb3nMk0J108vobwqMqwp+lm2BX4VK6GWA34fiR21u1v1nO56nMdnb4k9Mpl69LojU/CfN4uOTcZPNIZ6yHidOGhquvJB9jQX773aVoLJctaeDN4LfkGCG6F6SO1ntcOZ7Tn04T16U4GU0NA0VlAq7aLt3Zjp5wKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838294; c=relaxed/simple; bh=k7oN6ife544EjcWrtawTh194Tl2+a01m8uErSm1Rji0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Clz1w2ZlPIgl5MO1fh6fb8X90qg1XAFqGjn754pqM77S1dZbZMQ2kKcPByPx9AGFMLJMUDUWIX5UpC5rD25pKMYSaLlre6fuODEKl79wAdprjTLdMY6vPwZ4Kn3uzlMyYHWVs1NfZ9lAg5y0lx5tXdUNwpJMn+0HrFCLhbpAOZs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=uneXmVzb; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uneXmVzb" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-64b8123c333so11455303a12.3 for ; Sat, 27 Dec 2025 04:24:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838280; x=1767443080; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=HC83JyXzDTDKNvXKaw5rKiyyvSPfwLkZKXqVCz6oetw=; b=uneXmVzb3EuTbP1fwWquko7biHCjxYu6isMCf1RwMQZ4Om9VpKQOW08eZ6vgMhSdX8 slZbE4wmwHCtRt2EaChsyfCN0l9gtOSVVNaf2jxtqYD1BRnq22JJ2H/DMQ+frLpTQbwy 2EPAz5zuxis2lsAr+jTw+2j3Ai+VkaZ5dlH5/j/79GhiWxoj//Uv/CGwfkGqO1CRti1J cR/ULSqpUhcSsVWsFWvkJWlnpUytI1O829s8FJTSzx062QmlmU4CzuxUsOtGnafU1u0x oF3Li1WfEspuk5cTsOn6MojuXsL9tybTxhxzgAKhxldAdqjeDNHEZW6uQH5XVWUs9caQ 3ASg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838280; x=1767443080; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=HC83JyXzDTDKNvXKaw5rKiyyvSPfwLkZKXqVCz6oetw=; b=T7ky0gxK/AmbFBZNmwz+SjlLzOLKFQDIYaIPPZl2FMfoIrtCJDnfXydZnyMgqK53YN jjbVzZ1/No2PX9iHd46/ROOgQGeSmWUE5GZDNQtiwFntulrnk2FmI6rCfnCPzMkYImY4 JUTaF9l4npnr6mJAYy5BEH6ZnMkwinbdu4vumO5PiRsQTZmOPuNsc3XrCaJGG2HzdVKY oLVbkSW6u4DGsSXblCeT40+yOyBAUSTcPQmmf0gt9xFq2WGjbEgnFLhjbXLip52eyV8r UKBWRg25ypEJS8iVlD4ytu/v9Q43itvaA/FrBfFCo4BLB0UKVS3ZoDCPuzoJw8ZNUZH8 xkFQ== X-Forwarded-Encrypted: i=1; AJvYcCWTZXrRpCwh+Zi9GrpUGLP4Il7wrqcBk7aArK6shFSvURsBpySgwa9oGBQYZZtFWW2LRhPM3E5y/i/ekDQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwEgjkmhm/e09P83DhoDoT3sloaS15urmoeOHKm7U/ZJFX2j9DJ kbSBEWyR9nDef4FgPGj/08q/8Ku9WrrgTLaPpz3IhJkqDFMXGxFqhAsyUbedtypwvF8= X-Gm-Gg: AY/fxX7BT8GMfus+wPMngBx1B0zsDgtRiZXxrdenX396okZ2G8QofEc4i5nrjkdUyiH Gkgnyd/SD1Shf6lxHiJEmxReADZ48lj8GkSiBkozOvyMPoFZ+yrau6cZccgq8sDWM6FkzrCJJK8 qcs7HxyGwF5uqZ3C6ElWxUSKrUmcYqGtbVvxA3zUwf7gwYOTIXOawX+uwesQX/G5QPyLTlCKanm 6xazrdBBUIAPqPp40KqIz1J03FHXIXsV74wTnVCVZxLZuhcYKfw/RjL35Wv//j31xk248TlZnzC 3pH+rYRMG28/nJxm6Fp4P9kxOoHtiBQiy/1pZGMIhh8nAr5jAbtDbHAG1uZUdX5CwM63rx4qGg0 uKFI2tRkvQb5zoH4QSk7ciher5p4GO24wcfrg53fc//G9D0GTIJkunHMllY1XCmrAT3DEYGQA5W LELOEtgRmiblGqqvQy+YbD58BkhNf9sgD/+sMhWD43l24h8sXX3b2+W7eaEGc8CE3tX0wIG8jmC JsY/Q== X-Google-Smtp-Source: AGHT+IFcynhxXT3+YjnxpFsPe+YiX+cHhWIBqvKPnMnsr+JwHM0KbLg4/lgHTMYqFpU4YEwyY9Sx7Q== X-Received: by 2002:aa7:d70f:0:b0:64b:6bcf:96b2 with SMTP id 4fb4d7f45d1cf-64b8ecb3df7mr17522097a12.29.1766838280289; Sat, 27 Dec 2025 04:24:40 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:39 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:41 +0000 Subject: [PATCH v5 19/21] regulator: s2mps11: add S2MPG11 regulator Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-19-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 The S2MPG11 PMIC is a Power Management IC for mobile applications with buck converters, various LDOs, power meters, and additional GPIO interfaces. It typically complements an S2MPG10 PMIC in a main/sub configuration as the sub-PMIC. It has 12 buck, 1 buck-boost, and 15 LDO rails. Several of these can either be controlled via software (register writes) or via external signals, in particular by: * input pins connected to a main processor's: * GPIO pins * other pins that are e.g. firmware- or power-domain-controlled without explicit driver intervention * a combination of input pins and register writes. Control via input pins allows PMIC rails to be controlled by firmware, e.g. during standby/suspend or as part of power domain handling where otherwise that would not be possible. Additionally toggling a pin is faster than register writes, and it also allows the PMIC to ensure that any necessary timing requirements between rails are respected automatically if multiple rails are to be enabled or disabled quasi simultaneously. This commit implements support for all these rails and control combination. Note1: For an externally controlled rail, the regulator_ops provide an empty ::enable() and no ::disable() implementations, even though Linux can not enable the rail and one might think ::enable could be NULL. Without ops->enable(), the regulator core will assume enabling such a rail failed, though, and in turn never add a reference to its parent (supplier) rail. Once a different (Linux-controlled) sibling (consumer) rail on that same parent rail gets disabled, the parent gets disabled (cutting power to the externally controlled rail although it should stay on), and the system will misbehave. Note2: While external control via input pins appears to exist on other versions of this PMIC, there is more flexibility in this version, in particular there is a selection of input pins to choose from for each rail (which must therefore be configured accordingly if in use), whereas other versions don't have this flexibility. Signed-off-by: Andr=C3=A9 Draszik --- v5: - typos S2MPG10_LDOxx -> S2MPG11_LDOxx in s2mpg10_of_parse_cb() - one instance per PMIC, not per rail or rail type (Mark) v3: - one instance per actual rail, not per rail type (LDO or buck) - assign correct ::ops for LDOs with ramp support - sort s2mpg11 bucks before LDOs throughout (alphabetic ordering) - add ::enable() to ops for signal-controlled rails and update commit message detailing why - more details around signal controlled rails in commit message v2: - fix commit message typo - mention GPIOs in commit message --- drivers/regulator/s2mps11.c | 302 ++++++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 301 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 34f82762d9549b854d730a1626ed0450c19fbe2e..f068b795ab51845bddac84eca08= be0efdcf4f164 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -431,9 +432,20 @@ static int s2mpg10_of_parse_cb(struct device_node *np, [S2MPG10_EXTCTRL_LDO20M_EN2] =3D S2MPG10_PCTRLSEL_LDO20M_EN2, [S2MPG10_EXTCTRL_LDO20M_EN] =3D S2MPG10_PCTRLSEL_LDO20M_EN, }; + static const u32 ext_control_s2mpg11[] =3D { + [S2MPG11_EXTCTRL_PWREN] =3D S2MPG10_PCTRLSEL_PWREN, + [S2MPG11_EXTCTRL_PWREN_MIF] =3D S2MPG10_PCTRLSEL_PWREN_MIF, + [S2MPG11_EXTCTRL_AP_ACTIVE_N] =3D S2MPG10_PCTRLSEL_AP_ACTIVE_N, + [S2MPG11_EXTCTRL_G3D_EN] =3D S2MPG10_PCTRLSEL_CPUCL1_EN, + [S2MPG11_EXTCTRL_G3D_EN2] =3D S2MPG10_PCTRLSEL_CPUCL1_EN2, + [S2MPG11_EXTCTRL_AOC_VDD] =3D S2MPG10_PCTRLSEL_CPUCL2_EN, + [S2MPG11_EXTCTRL_AOC_RET] =3D S2MPG10_PCTRLSEL_CPUCL2_EN2, + [S2MPG11_EXTCTRL_UFS_EN] =3D S2MPG10_PCTRLSEL_TPU_EN, + [S2MPG11_EXTCTRL_LDO13S_EN] =3D S2MPG10_PCTRLSEL_TPU_EN2, + }; u32 ext_control; =20 - if (s2mps11->dev_type !=3D S2MPG10) + if (s2mps11->dev_type !=3D S2MPG10 && s2mps11->dev_type !=3D S2MPG11) return 0; =20 if (of_property_read_u32(np, "samsung,ext-control", &ext_control)) @@ -464,6 +476,31 @@ static int s2mpg10_of_parse_cb(struct device_node *np, ext_control =3D ext_control_s2mpg10[ext_control]; break; =20 + case S2MPG11: + switch (desc->id) { + case S2MPG11_BUCK1 ... S2MPG11_BUCK3: + case S2MPG11_BUCK5: + case S2MPG11_BUCK8: + case S2MPG11_BUCK9: + case S2MPG11_BUCKD: + case S2MPG11_BUCKA: + case S2MPG11_LDO1: + case S2MPG11_LDO2: + case S2MPG11_LDO8: + case S2MPG11_LDO13: + if (ext_control > S2MPG11_EXTCTRL_LDO13S_EN) + return -EINVAL; + break; + + default: + return -EINVAL; + } + + if (ext_control > ARRAY_SIZE(ext_control_s2mpg11)) + return -EINVAL; + ext_control =3D ext_control_s2mpg11[ext_control]; + break; + default: return -EINVAL; } @@ -501,6 +538,7 @@ static int s2mpg10_enable_ext_control(struct s2mps11_in= fo *s2mps11, =20 switch (s2mps11->dev_type) { case S2MPG10: + case S2MPG11: s2mpg10_desc =3D to_s2mpg10_regulator_desc(rdev->desc); break; =20 @@ -601,6 +639,21 @@ static int s2mpg10_regulator_buck_set_voltage_time(str= uct regulator_dev *rdev, rdev->desc->ramp_mask); } =20 +static int s2mpg11_regulator_buck_set_voltage_time(struct regulator_dev *r= dev, + int old_uV, int new_uV) +{ + unsigned int ramp_mask; + + ramp_mask =3D rdev->desc->ramp_mask; + if (old_uV > new_uV) + /* The downwards mask is at a different position. */ + ramp_mask >>=3D 2; + + return s2mpg1x_regulator_buck_set_voltage_time(rdev, old_uV, new_uV, + rdev->desc->ramp_reg, + ramp_mask); +} + /* * We assign both, ::set_voltage_time() and ::set_voltage_time_sel(), beca= use * only if the latter is !=3D NULL, the regulator core will call neither d= uring @@ -961,6 +1014,246 @@ static const struct s2mpg10_regulator_desc s2mpg10_r= egulators[] =3D { s2mpg10_regulator_desc_ldo(31, "vinl11m", s2mpg10_ldo_vranges2) }; =20 +static const struct regulator_ops s2mpg11_reg_buck_ops[] =3D { + [S2MPG10_REGULATOR_OPS_STD] =3D { + .list_voltage =3D regulator_list_voltage_linear_range, + .map_voltage =3D regulator_map_voltage_linear_range, + .is_enabled =3D regulator_is_enabled_regmap, + .enable =3D regulator_enable_regmap, + .disable =3D regulator_disable_regmap, + .get_voltage_sel =3D regulator_get_voltage_sel_regmap, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .set_voltage_time =3D s2mpg11_regulator_buck_set_voltage_time, + .set_voltage_time_sel =3D regulator_set_voltage_time_sel, + .enable_time =3D s2mpg10_regulator_buck_enable_time, + .set_ramp_delay =3D regulator_set_ramp_delay_regmap, + }, + [S2MPG10_REGULATOR_OPS_EXTCONTROL] =3D { + .list_voltage =3D regulator_list_voltage_linear_range, + .map_voltage =3D regulator_map_voltage_linear_range, + .enable =3D s2mpg10_regulator_enable_nop, + .get_voltage_sel =3D regulator_get_voltage_sel_regmap, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .set_voltage_time =3D s2mpg11_regulator_buck_set_voltage_time, + .set_voltage_time_sel =3D regulator_set_voltage_time_sel, + .enable_time =3D s2mpg10_regulator_buck_enable_time, + .set_ramp_delay =3D regulator_set_ramp_delay_regmap, + } +}; + +#define s2mpg11_buck_to_ramp_mask(n) (GENMASK(3, 2) << (((n) % 2) * 4)) + +#define regulator_desc_s2mpg11_buckx(_name, _id, _supply, _vrange, \ + _vsel_reg, _en_reg, _en_mask, _r_reg) \ + regulator_desc_s2mpg1x_buck_cmn(_name, _id, _supply, \ + s2mpg11_reg_buck_ops, _vrange, \ + S2MPG11_PMIC_##_vsel_reg, GENMASK(7, 0), \ + S2MPG11_PMIC_##_en_reg, _en_mask, \ + S2MPG11_PMIC_##_r_reg, \ + s2mpg11_buck_to_ramp_mask(_id - S2MPG11_BUCK1), \ + s2mpg10_buck_ramp_table, \ + ARRAY_SIZE(s2mpg10_buck_ramp_table), 30) + +#define s2mpg11_regulator_desc_buck_xm(_num, _vrange, _vsel_reg_sfx, \ + _en_mask, _r_reg, _en_rrate) \ + .desc =3D regulator_desc_s2mpg11_buckx(#_num"s", \ + S2MPG11_BUCK##_num, "vinb"#_num"s", \ + _vrange, \ + B##_num##S_##_vsel_reg_sfx, \ + B##_num##S_CTRL, _en_mask, \ + _r_reg), \ + .enable_ramp_rate =3D _en_rrate + +#define s2mpg11_regulator_desc_buck_cm(_num, _vrange, _vsel_reg_sfx, \ + _en_mask, _r_reg) \ + [S2MPG11_BUCK##_num] =3D { \ + s2mpg11_regulator_desc_buck_xm(_num, _vrange, \ + _vsel_reg_sfx, _en_mask, _r_reg, 12500), \ + } + +#define s2mpg11_regulator_desc_buckn_cm_gpio(_num, _vrange, \ + _vsel_reg_sfx, _en_mask, _r_reg, _pc_reg, _pc_mask) \ + [S2MPG11_BUCK##_num] =3D { \ + s2mpg11_regulator_desc_buck_xm(_num, _vrange, \ + _vsel_reg_sfx, _en_mask, _r_reg, 12500), \ + .pctrlsel_reg =3D S2MPG11_PMIC_##_pc_reg, \ + .pctrlsel_mask =3D _pc_mask, \ + } + +#define s2mpg11_regulator_desc_buck_vm(_num, _vrange, _vsel_reg_sfx, \ + _en_mask, _r_reg) \ + [S2MPG11_BUCK##_num] =3D { \ + s2mpg11_regulator_desc_buck_xm(_num, _vrange, \ + _vsel_reg_sfx, _en_mask, _r_reg, 25000), \ + } + +#define s2mpg11_regulator_desc_bucka(_num, _num_lower, _r_reg, \ + _pc_reg, _pc_mask) \ + [S2MPG11_BUCK##_num] =3D { \ + .desc =3D regulator_desc_s2mpg11_buckx(#_num_lower, \ + S2MPG11_BUCK##_num, "vinb"#_num_lower, \ + s2mpg11_buck_vranges##_num_lower, \ + BUCK##_num##_OUT, \ + BUCK##_num##_CTRL, GENMASK(7, 6), \ + _r_reg), \ + .enable_ramp_rate =3D 25000, \ + .pctrlsel_reg =3D S2MPG11_PMIC_##_pc_reg, \ + .pctrlsel_mask =3D _pc_mask, \ + } + +#define s2mpg11_regulator_desc_buckboost() \ + [S2MPG11_BUCKBOOST] =3D { \ + .desc =3D regulator_desc_s2mpg1x_buck_cmn("boost", \ + S2MPG11_BUCKBOOST, "vinbb", \ + s2mpg10_reg_ldo_ops, \ + s2mpg11_buck_vrangesboost, \ + S2MPG11_PMIC_BB_OUT1, GENMASK(6, 0), \ + S2MPG11_PMIC_BB_CTRL, BIT(7), \ + 0, 0, NULL, 0, 35), \ + .enable_ramp_rate =3D 17500, \ + } + +#define s2mpg11_regulator_desc_ldo_cmn(_num, _supply, _ops, \ + _vrange, _vsel_reg_sfx, _vsel_mask, _en_reg, _en_mask, \ + _ramp_delay, _r_reg, _r_mask, _r_table, _r_table_sz, \ + _pc_reg, _pc_mask) \ + [S2MPG11_LDO##_num] =3D { \ + .desc =3D regulator_desc_s2mpg1x_ldo_cmn(#_num "s", \ + S2MPG11_LDO##_num, _supply, _ops, \ + _vrange, \ + S2MPG11_PMIC_L##_num##S_##_vsel_reg_sfx, \ + _vsel_mask, \ + S2MPG11_PMIC_##_en_reg, _en_mask, \ + _ramp_delay, _r_reg, _r_mask, _r_table, \ + _r_table_sz), \ + .pctrlsel_reg =3D _pc_reg, \ + .pctrlsel_mask =3D _pc_mask, \ + } + +/* standard LDO via LxM_CTRL */ +#define s2mpg11_regulator_desc_ldo(_num, _supply, _vrange) \ + s2mpg11_regulator_desc_ldo_cmn(_num, _supply, \ + s2mpg10_reg_ldo_ops, _vrange, CTRL, GENMASK(5, 0), \ + L##_num##S_CTRL, BIT(7), \ + 0, 0, 0, NULL, 0, \ + 0, 0) + +/* standard LDO but possibly GPIO controlled */ +#define s2mpg11_regulator_desc_ldo_gpio(_num, _supply, _vrange, \ + _pc_reg, _pc_mask) \ + s2mpg11_regulator_desc_ldo_cmn(_num, _supply, \ + s2mpg10_reg_ldo_ops, _vrange, CTRL, GENMASK(5, 0), \ + L##_num##S_CTRL, GENMASK(7, 6), \ + 0, 0, 0, NULL, 0, \ + S2MPG11_PMIC_##_pc_reg, _pc_mask) + +/* LDO with ramp support and possibly GPIO controlled */ +#define s2mpg11_regulator_desc_ldo_ramp(_num, _supply, _vrange, \ + _en_mask, _r_reg, _pc_reg, _pc_mask) \ + s2mpg11_regulator_desc_ldo_cmn(_num, _supply, \ + s2mpg10_reg_ldo_ramp_ops, _vrange, CTRL1, GENMASK(6, 0), \ + LDO_CTRL1, _en_mask, \ + 6250, S2MPG11_PMIC_##_r_reg, GENMASK(1, 0), \ + s2mpg10_ldo_ramp_table, \ + ARRAY_SIZE(s2mpg10_ldo_ramp_table), \ + S2MPG11_PMIC_##_pc_reg, _pc_mask) + +/* voltage range for s2mpg11 BUCK 1, 2, 3, 4, 8, 9, 10 */ +S2MPG10_VOLTAGE_RANGE(s2mpg11_buck, 1, 200000, 450000, 1300000, STEP_6_25_= MV); + +/* voltage range for s2mpg11 BUCK 5 */ +S2MPG10_VOLTAGE_RANGE(s2mpg11_buck, 5, 200000, 400000, 1300000, STEP_6_25_= MV); + +/* voltage range for s2mpg11 BUCK 6 */ +S2MPG10_VOLTAGE_RANGE(s2mpg11_buck, 6, 200000, 1000000, 1500000, STEP_6_25= _MV); + +/* voltage range for s2mpg11 BUCK 7 */ +S2MPG10_VOLTAGE_RANGE(s2mpg11_buck, 7, 600000, 1500000, 2200000, STEP_12_5= _MV); + +/* voltage range for s2mpg11 BUCK D */ +S2MPG10_VOLTAGE_RANGE(s2mpg11_buck, d, 600000, 2400000, 3300000, STEP_12_5= _MV); + +/* voltage range for s2mpg11 BUCK A */ +S2MPG10_VOLTAGE_RANGE(s2mpg11_buck, a, 600000, 1700000, 2100000, STEP_12_5= _MV); + +/* voltage range for s2mpg11 BUCK BOOST */ +S2MPG10_VOLTAGE_RANGE(s2mpg11_buck, boost, + 2600000, 3000000, 3600000, STEP_12_5_MV); + +/* voltage range for s2mpg11 LDO 1, 2 */ +S2MPG10_VOLTAGE_RANGE(s2mpg11_ldo, 1, 300000, 450000, 950000, STEP_12_5_MV= ); + +/* voltage range for s2mpg11 LDO 3, 7, 10, 11, 12, 14, 15 */ +S2MPG10_VOLTAGE_RANGE(s2mpg11_ldo, 3, 700000, 1600000, 1950000, STEP_25_MV= ); + +/* voltage range for s2mpg11 LDO 4, 6 */ +S2MPG10_VOLTAGE_RANGE(s2mpg11_ldo, 4, 1800000, 2500000, 3300000, STEP_25_M= V); + +/* voltage range for s2mpg11 LDO 5 */ +S2MPG10_VOLTAGE_RANGE(s2mpg11_ldo, 5, 1600000, 1600000, 1950000, STEP_12_5= _MV); + +/* voltage range for s2mpg11 LDO 8 */ +S2MPG10_VOLTAGE_RANGE(s2mpg11_ldo, 8, 979600, 1130400, 1281200, 5800); + +/* voltage range for s2mpg11 LDO 9 */ +S2MPG10_VOLTAGE_RANGE(s2mpg11_ldo, 9, 725000, 725000, 1300000, STEP_12_5_M= V); + +/* voltage range for s2mpg11 LDO 13 */ +S2MPG10_VOLTAGE_RANGE(s2mpg11_ldo, 13, 1800000, 1800000, 3350000, STEP_25_= MV); + +static const struct s2mpg10_regulator_desc s2mpg11_regulators[] =3D { + s2mpg11_regulator_desc_buckboost(), + s2mpg11_regulator_desc_buckn_cm_gpio(1, s2mpg11_buck_vranges1, + OUT1, GENMASK(7, 6), DVS_RAMP1, + PCTRLSEL1, GENMASK(3, 0)), + s2mpg11_regulator_desc_buckn_cm_gpio(2, s2mpg11_buck_vranges1, + OUT1, GENMASK(7, 6), DVS_RAMP1, + PCTRLSEL1, GENMASK(7, 4)), + s2mpg11_regulator_desc_buckn_cm_gpio(3, s2mpg11_buck_vranges1, + OUT1, GENMASK(7, 6), DVS_RAMP2, + PCTRLSEL2, GENMASK(3, 0)), + s2mpg11_regulator_desc_buck_cm(4, s2mpg11_buck_vranges1, + OUT, BIT(7), DVS_RAMP2), + s2mpg11_regulator_desc_buckn_cm_gpio(5, s2mpg11_buck_vranges5, + OUT, GENMASK(7, 6), DVS_RAMP3, + PCTRLSEL2, GENMASK(7, 4)), + s2mpg11_regulator_desc_buck_cm(6, s2mpg11_buck_vranges6, + OUT1, BIT(7), DVS_RAMP3), + s2mpg11_regulator_desc_buck_vm(7, s2mpg11_buck_vranges7, + OUT1, BIT(7), DVS_RAMP4), + s2mpg11_regulator_desc_buckn_cm_gpio(8, s2mpg11_buck_vranges1, + OUT1, GENMASK(7, 6), DVS_RAMP4, + PCTRLSEL3, GENMASK(3, 0)), + s2mpg11_regulator_desc_buckn_cm_gpio(9, s2mpg11_buck_vranges1, + OUT1, GENMASK(7, 6), DVS_RAMP5, + PCTRLSEL3, GENMASK(7, 4)), + s2mpg11_regulator_desc_buck_cm(10, s2mpg11_buck_vranges1, + OUT, BIT(7), DVS_RAMP5), + s2mpg11_regulator_desc_bucka(D, d, DVS_RAMP6, PCTRLSEL4, GENMASK(3, 0)), + s2mpg11_regulator_desc_bucka(A, a, DVS_RAMP6, PCTRLSEL4, GENMASK(7, 4)), + s2mpg11_regulator_desc_ldo_ramp(1, "vinl1s", s2mpg11_ldo_vranges1, + GENMASK(5, 4), DVS_SYNC_CTRL1, + PCTRLSEL5, GENMASK(3, 0)), + s2mpg11_regulator_desc_ldo_ramp(2, "vinl1s", s2mpg11_ldo_vranges1, + GENMASK(7, 6), DVS_SYNC_CTRL2, + PCTRLSEL5, GENMASK(7, 4)), + s2mpg11_regulator_desc_ldo(3, "vinl3s", s2mpg11_ldo_vranges3), + s2mpg11_regulator_desc_ldo(4, "vinl5s", s2mpg11_ldo_vranges4), + s2mpg11_regulator_desc_ldo(5, "vinl3s", s2mpg11_ldo_vranges5), + s2mpg11_regulator_desc_ldo(6, "vinl5s", s2mpg11_ldo_vranges4), + s2mpg11_regulator_desc_ldo(7, "vinl3s", s2mpg11_ldo_vranges3), + s2mpg11_regulator_desc_ldo_gpio(8, "vinl2s", s2mpg11_ldo_vranges8, + PCTRLSEL6, GENMASK(3, 0)), + s2mpg11_regulator_desc_ldo(9, "vinl2s", s2mpg11_ldo_vranges9), + s2mpg11_regulator_desc_ldo(10, "vinl4s", s2mpg11_ldo_vranges3), + s2mpg11_regulator_desc_ldo(11, "vinl4s", s2mpg11_ldo_vranges3), + s2mpg11_regulator_desc_ldo(12, "vinl4s", s2mpg11_ldo_vranges3), + s2mpg11_regulator_desc_ldo_gpio(13, "vinl6s", s2mpg11_ldo_vranges13, + PCTRLSEL6, GENMASK(7, 4)), + s2mpg11_regulator_desc_ldo(14, "vinl4s", s2mpg11_ldo_vranges3), + s2mpg11_regulator_desc_ldo(15, "vinl3s", s2mpg11_ldo_vranges3) +}; + static const struct regulator_ops s2mps11_ldo_ops =3D { .list_voltage =3D regulator_list_voltage_linear, .map_voltage =3D regulator_map_voltage_linear, @@ -1845,6 +2138,7 @@ static int s2mps11_handle_ext_control(struct s2mps11_= info *s2mps11, break; =20 case S2MPG10: + case S2MPG11: /* * If desc.enable_val is !=3D 0, then external control was * requested. We can not test s2mpg10_desc::ext_control, @@ -1885,6 +2179,11 @@ static int s2mps11_pmic_probe(struct platform_device= *pdev) s2mpg1x_regulators =3D s2mpg10_regulators; BUILD_BUG_ON(ARRAY_SIZE(s2mpg10_regulators) > S2MPS_REGULATOR_MAX); break; + case S2MPG11: + rdev_num =3D ARRAY_SIZE(s2mpg11_regulators); + s2mpg1x_regulators =3D s2mpg11_regulators; + BUILD_BUG_ON(ARRAY_SIZE(s2mpg11_regulators) > S2MPS_REGULATOR_MAX); + break; case S2MPS11X: rdev_num =3D ARRAY_SIZE(s2mps11_regulators); regulators =3D s2mps11_regulators; @@ -1965,6 +2264,7 @@ static int s2mps11_pmic_probe(struct platform_device = *pdev) =20 static const struct platform_device_id s2mps11_pmic_id[] =3D { { "s2mpg10-regulator", S2MPG10}, + { "s2mpg11-regulator", S2MPG11}, { "s2mps11-regulator", S2MPS11X}, { "s2mps13-regulator", S2MPS13X}, { "s2mps14-regulator", S2MPS14X}, --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9586E330D50 for ; Sat, 27 Dec 2025 12:24:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838290; cv=none; b=hdgR0qu9vvT1sRBeW9h3HrcPzj/A1GInMfCNQmTPo2WA9fh+CNaR8a7+mUQMUdDl7DXUZ7VTws9KVHeSKrtr6n+3wMuy/aYxySOoRZgcUdpSqMAH+i/m4emrd5dhZPH/3+JC37wnr+a3Q7mnqaeyUzavtkj9e2n3Pbr6//JY2iE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838290; c=relaxed/simple; bh=zY4HDzqBb7/UAvPLwmWGSo1BI//NAtywMvqMn/JOYCQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LWzuFKg1kGexcm0ZGPFQBx2PNj8Dj7ZXuwH8FjIoVEOmYujzLrkkr5zd080UwwZt09MLZIv64AkXuRhn9U7mwuqalQHen7nqFZ+TqhPgNVhxAMtPeevSFift6cvuJEr9FcfwQoGLY2Q1n8EXlppvOZpVc59+TPV4ElRgsUj8Liw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=xwLpD/5q; arc=none smtp.client-ip=209.85.208.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xwLpD/5q" Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-64b9b0b4d5dso12608982a12.1 for ; Sat, 27 Dec 2025 04:24:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838281; x=1767443081; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ERvEdThlWsJXRM1ZMwEPHPXp21IS92Dke7PuPKQGFoY=; b=xwLpD/5qgkDKyLQpDuUWqEBnsrnBa5zvvw40CZ2JEnWBcs35b4+5E5yrfj3lftMRwR lKYMUY3iL+ygfZoxV9071Uuaw+BYFXnQk4zMSrYuZ/syAk7ymGNbCD1bUwIUYOAbymTb OjTJLkUF9YkNge9LtmNmLSM4Jq2SNWcF/z8IGs9m+7GDlTgiQd3glHB47QAaCY4mwzV3 lRFu8hRbvMGRO+Q9qWlUfjNbKZ4LbwStwlk/ONOalhTlQVAuTe8Hxi89NK5rBgVtoyAl GtpBMvT5faDWNtAxpI4OrB8vvC8xa8lQFZxEyodZKkRHSe45sJB4wtDU3gz10E28aIUF IMWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838281; x=1767443081; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ERvEdThlWsJXRM1ZMwEPHPXp21IS92Dke7PuPKQGFoY=; b=IS54uDzhgOCuHiO7Pe5lORcrugFLjpLcU1J6DiHZA/IaY1qrXk+W42yDYk+1F/IC1p 9hdkSYk8OWNi/K0X1XE/nWmNQkqUfrbDcS3vW/WFL4i4t1lkqEv9YSgykPYhda9Jl39C r+GZwLi2I+RR4yC8hlRh1wZUyOpa5TbYHVVhP/n00a1/yRVod2ZngjKyQHAslTF3nB0i 0l6zn34QKkqK9nbEC/0fTRWFQZTTXO3FDg1krPL4gOxMCFOJpiQw/7/qlthJOpH4bQKt gJVvRcOyMupF6jmpWt0QxXkt65gnfXr36jiytayKmWjwyOYW7ZGSV1PqVXbrMhj2jQhK JDQg== X-Forwarded-Encrypted: i=1; AJvYcCXk0wt0Mrv/p1QgyjcnaFSJv58fZlFbsbkAAPFeOnn8kHaO2JLldp/pHVXekzzQSHGq57ewI/FBPYuCPtE=@vger.kernel.org X-Gm-Message-State: AOJu0Yxjdbhvad0VNPzRZ+ox0nYRycCCWBgObtjaYSnnd3YblOMMtPRg kxNiDgNhWEJY5B42ashhMmSy7h0vyjsfhv4BOil9X+vCsvgK8rvYUwIJSsTedJ2o1jk= X-Gm-Gg: AY/fxX6UdhbhOHao+iS6Z6ihHtuC3f9ZDcH/f5n1seGXnlBncjiwuoPJ99p2EaW3p2d ++jJQxcXFRlNCvr1JYnvSWU3xTgzCiemnpMCIBif7+NcbcLibNbiTwqcBNp4vcQiOVI+hYr2IZd sa/gdG+gQlx2nRFX1WkXniCvpOQIM2iPnbF/l2h6BuNDbscYBPxw494733If4rdz2xJgBnklAhf wYlD3RVYXELeaqC7cf19F14077ni8SebIWK72xFTPx+ZzywT+Ayx8TGi4eCEYyPd80HzLwfuxfA YzbRTiczKgG7Z57sKKAFpV0P9OLP8/eMqk6znVdAfIvRKFDRDcEFLKzUys+GyJsFk1GO1NyQ3XT yUcYQO7vuBkf0E4jV3jhb+yl6dbpDBLFm3wNeZiAgN8MLu/t+G3N+ENHYgUciQhkLk0zzT6fDL0 omJlSB8GicreDFMrXwOw1RcTw/EXuGzSYWaZ6rkd7v5Yt4pUTonkl/XJMGCd9XHfwGMVMS4wd8D qv7Sg== X-Google-Smtp-Source: AGHT+IHycmOXztf3tQPqUFMR3ZDzjnCJajLUop6kueKe0OALY79Qu3QaZ0E1mu52XExCIbSh/groQw== X-Received: by 2002:a17:907:7eaa:b0:b76:d89d:3710 with SMTP id a640c23a62f3a-b8036ebbe32mr2775195166b.8.1766838280740; Sat, 27 Dec 2025 04:24:40 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:40 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:42 +0000 Subject: [PATCH v5 20/21] regulator: s2mps11: more descriptive gpio consumer name Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-20-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 Currently, GPIOs claimed by this driver for external rail control all show up with "s2mps11-regulator" as consumer, which is not very informative. Switch to using the regulator name via desc->name instead, using the device name as fallback. Signed-off-by: Andr=C3=A9 Draszik Reviewed-by: Bartosz Golaszewski --- drivers/regulator/s2mps11.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index f068b795ab51845bddac84eca08be0efdcf4f164..178a032c0dc192874118906aee4= 5441a1bbd8515 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -362,7 +362,8 @@ static int s2mps11_of_parse_gpiod(struct device_node *n= p, ena_gpiod =3D fwnode_gpiod_get_index(of_fwnode_handle(np), con_id, 0, GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE, - "s2mps11-regulator"); + desc->name + ? : dev_name(config->dev)); if (IS_ERR(ena_gpiod)) { ret =3D PTR_ERR(ena_gpiod); =20 --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 06:50:57 2026 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 242BC330B29 for ; Sat, 27 Dec 2025 12:24:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838288; cv=none; b=d25yuxYT03rW2ZJrEkMZ3IQWQXnsxvbQb9cEeMrLjFRNCwriWU0E9ivh+xlKbloOcLr8Lqpbxc5279yDSRyY7J3DgaJUzSKvnE/t8bOMw9gJ0vObTFZ9UPW5rZYh2IbLzbrd+ft6cgONgVogLCqLJKAxhBntCM+0jVf0ADI1g/U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838288; c=relaxed/simple; bh=61ADjJrgT2o/i8020WOTVait6ro421Ajicl8SlsuO9U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qICxkyUxDPqoJBSXQylAsK+VZTWv2KOaB2ePMRTseuhGTSd3+wxFfrJf5JbeOQDe6tsI6N5msD3KXtfoMiMnBDeKF2vqiI7CbiKxhBn8yPOdy2zNMwbPWev2a4q1l+ukPgaBn94kVa0ZdOuY91uwE5T/hI9tuDwNXD+eBVyb2jQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=QgjuHIvC; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QgjuHIvC" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-64b9d01e473so10537896a12.2 for ; Sat, 27 Dec 2025 04:24:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838281; x=1767443081; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6RGJHpYPSzzQbbGCB4wy3BgFrQgesxTAcE0/qZgwEOg=; b=QgjuHIvCQ5py7O52/Jj4oZR6bhc4rf8+nVBWdogTfdPsRyC/OHquSadTl163SPvG5A WC9pZDOdodVBwMOWLdIjqDfI4jB/Qb7Er7CXvgSF37SeU8urtVHUDtY0AsI2Rm9wt+4x Lqp+yvsS1Mr1Fnuv+nlmaV13syk3+cgmJsQEoZizieoRVTEUSeJzfMMp3zGqLcJVsdS2 znauhuMBjhkCbiTFRABwdht5p/l7tHC0as8ZmgWrSW97+YTbDbq7jF9Ak2ll+nx7l4D1 V1XA8gtit4mE/Au8GeCuydaaIYGD3Qf5WKOK2KDV3QxR+qyxCAYldONbMzciJFzOB4NK DM7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838281; x=1767443081; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=6RGJHpYPSzzQbbGCB4wy3BgFrQgesxTAcE0/qZgwEOg=; b=U7PldSOUcBmlrcyzMLtmpCScJ9hzSg2ihqAVZaJ+NvIw00ADHK1RKML3iGRx9Evlhy Gs+rn6LUC+OGmnRkpMPwRRiNo1hGHZGL/r8N+VV8oI/kbcHM4kBx/9ykdPTmEMF8ioY7 603ByfzYTFPDHOKkBK9Xkc893YLJVFTiyxaoyKH6DA3qMlDUTsGEETDfvh6fZUpSt/D/ QPkXo/+2PmU8/NNDcKC4Obv1f047AFYAsDrC+bxJrYbhj9EQVOIDTNdZ+KmBkE09eJ+U xLdJflj7F0GuYWretAS4x+7fStXsKNiL4R0YmMJjijKTZde99UFOPo52FkWOamkiuC5c vO4A== X-Forwarded-Encrypted: i=1; AJvYcCUp0DUXUL35WOnI29TaHzdVH3tX98taJ0EuWh2/riWFpwEmmzFXJD+ddlw+ekd4EkCB1j5dM5DDbLEB86M=@vger.kernel.org X-Gm-Message-State: AOJu0YzQcsJ1Dwg+VD7T/rJ8dyGgc87q8xmsjoHpzYuNVAwNT9L0kJd5 wCxgcgbCsrHsmJdXbbijUVzuP2/gPg3VJla5iPL0qOJ+3l+sxlKZCbyOfQuhIvfospI= X-Gm-Gg: AY/fxX5cOxM1xgJT59YZVrcmdBsGygJYrDrm338SLGVNZWzWlTnpj8Q272HRmvX4+lp 9KMLQeiSpnoODHKFKMBdxHmCWsmQwowZLbgPPqFkN6aB604Diu2c7PDS+mCRSpGPpYn+RY3Paml 6eaU6zI5afutM4533NHUERy2RUuF9L0HXI6oSjiTqdqS9eKwr/2pLBWES3eopmJ3x/wWoN2U3xS WMwAO3Frg32axsNRkwJcR1zZxtBc/Mwf6ZfPYE/WezQScKZdiH+90UEd3kqmG4iOb/4ub6SYrlf eELkH+LjFh6VGDhZh0q1a1pqe/VJSbG5mp51dd01bO5o8LwG4BGvCnNypI+P3kPhWjLmOmgaLwO HeP9zhH/Q/RHwWcsw+NNfbVhK6sZhOWDjqrtaVCqmqmOdnu5xbmAticRJV2cK18jJ1VbQ/uTgVw d3QDU6OIBffp76lV6zDVgaTolb0diUdN46NEfft15dTERs92Uy/x2YhgpH38hriB0mrXuHgBV4m v/4aw== X-Google-Smtp-Source: AGHT+IEZhhM0KME5WuKQ84Ts8cerCjpsb60R6tSjSyudT0VTKXNA6pzXYu7jRUwWEVFLnHJWn9IpIQ== X-Received: by 2002:a05:6402:51cb:b0:64b:3eeb:80b1 with SMTP id 4fb4d7f45d1cf-64b8ec6cb05mr22638603a12.22.1766838281265; Sat, 27 Dec 2025 04:24:41 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b916adc61sm25932659a12.31.2025.12.27.04.24.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:41 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:43 +0000 Subject: [PATCH v5 21/21] regulator: s2mps11: enable-gpios is optional on s2mpg1x Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251227-s2mpg1x-regulators-v5-21-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 For s2mpg1x, enable-gpios is optional, but when not given, the driver is complaining quite verbosely about the missing property. Refactor the code slightly to avoid printing those messages to the kernel log in that case. Signed-off-by: Andr=C3=A9 Draszik --- drivers/regulator/s2mps11.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 178a032c0dc192874118906aee45441a1bbd8515..2d5510acd0780ab6f9296c48ddc= de5efe15ff488 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -352,7 +352,7 @@ static int s2mps11_regulator_set_suspend_disable(struct= regulator_dev *rdev) } =20 static int s2mps11_of_parse_gpiod(struct device_node *np, - const char *con_id, + const char *con_id, bool optional, const struct regulator_desc *desc, struct regulator_config *config) { @@ -371,14 +371,19 @@ static int s2mps11_of_parse_gpiod(struct device_node = *np, if (ret =3D=3D -EPROBE_DEFER) return ret; =20 - if (ret =3D=3D -ENOENT) + if (ret =3D=3D -ENOENT) { + if (optional) + return 0; + dev_info(config->dev, "No entry for control GPIO for %d/%s in node %pOF\n", desc->id, desc->name, np); - else + } else { dev_warn_probe(config->dev, ret, "Failed to get control GPIO for %d/%s in node %pOF\n", desc->id, desc->name, np); + } + return 0; } =20 @@ -409,7 +414,8 @@ static int s2mps11_of_parse_cb(struct device_node *np, else return 0; =20 - return s2mps11_of_parse_gpiod(np, "samsung,ext-control", desc, config); + return s2mps11_of_parse_gpiod(np, "samsung,ext-control", false, desc, + config); } =20 static int s2mpg10_of_parse_cb(struct device_node *np, @@ -528,7 +534,7 @@ static int s2mpg10_of_parse_cb(struct device_node *np, =20 ++s2mpg10_desc->desc.ops; =20 - return s2mps11_of_parse_gpiod(np, "enable", desc, config); + return s2mps11_of_parse_gpiod(np, "enable", true, desc, config); } =20 static int s2mpg10_enable_ext_control(struct s2mps11_info *s2mps11, --=20 2.52.0.351.gbe84eed79e-goog