From nobody Mon Feb 9 05:00:05 2026 Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) (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 B5CC43D6679 for ; Thu, 22 Jan 2026 15:43:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096619; cv=none; b=Sd+sgDIlHmZF9wg9taC5GpYbpy2oLv98OiZr6FDO3KBQCLnwLvUv3/Gw8G6qwQuN9wk7SK8aj4KOENtL3LMCEYT9Mv8svLHhg+LVkC0eN7ZhJcGuSpUltTmD4UJIc3GJcwlbARWy1L7bZ8g/hsNL2mLM1XNlO79sRE0htyhTMAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096619; c=relaxed/simple; bh=sXR9KtyAp4dsOisRc5Qon6HKDNpy4djntDCBxqC+GI4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QnhqJFhlu27Eqnq8zaAA/1/70FSLrd2WcqkfgsiOAAmvNaMuhu7dFNH08a1nUSDsddHEI1tmrhcQJVv/VnF4+m52ykqZjhE7UKkndJs6LZib1aSlVUh2zqM4RJIMu5eaqyZCC9uXwsG7n7IqMZ71UmINbqnoQTgGS76PdoutO4g= 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=KdBn/v6E; arc=none smtp.client-ip=209.85.208.65 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="KdBn/v6E" Received: by mail-ed1-f65.google.com with SMTP id 4fb4d7f45d1cf-6582e8831aeso1753273a12.1 for ; Thu, 22 Jan 2026 07:43:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096614; x=1769701414; 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=Ae68cN22St48fgKU3R1GMDois55LwnfaO6xzCLCshFk=; b=KdBn/v6EqIeTCV0UdT9q+AgE02o4VVKrv7hKTsCcR2+tdPqPL+Hb4sxDWGxzCSjp8R qw6glICslciKi8oq27QwqFUJzDyKlCyHPgjyhU/cpGgU885YZho+ihVUE1LX7Bby7UTl Ojbp1F/OT7aeS6nQROqPHGxxo7Px3wGaKurkAanJIGrjMQQ1Ksw+ZmhKE4n9oRwZpcHJ ERuSKPTdFasnuLuzBSfvLjAGyRk4NOQSLNg44gJtcSxm+Ez4JPB/3U53neg0C3JvuUQ6 +oJ6yGygMOtJDZtr4Mi6qVLNP8QbJqyUaTWUVewpV7ztN4svxkOkvQBJB3cs1CgjDg9S k0Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096614; x=1769701414; 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=Ae68cN22St48fgKU3R1GMDois55LwnfaO6xzCLCshFk=; b=Wcx+kWiSk0nGw1B/h3U+httQ8pkND6e+1kQEnS6N3w45hHYngzsRclhBlW1TEsO1La CpH1YYHAonXSL3t708OUZEGtVu7p54je3atY+f1+Qxmtfx3N7P1prWYyx1dUbiTqZ5ar erkCgkJ3ozk4ljB4tw0Rn+UEvJP0xLCdGRRvTfUTUtJOxx3PyLf3VBaonz3YmqV0xGI/ kqP+3bBxp8T6FpJAWa7S+NhxxgilxdSol/CuJIjK5gXbFYGl2lQsrG3hYJ3LpNaHwcqm SF3TOTW+FMbPZ4Omw/uLuhXWGD02xeCFwaTeIX1Ip6CjvjBUzxC41n/q39xkGjxchsIQ Ry0A== X-Forwarded-Encrypted: i=1; AJvYcCVdJV1M2BjK2ERvUzu4J+SxvBICXV9ZsCF3oFJ6mPg4Tw49mV5T1c2fIlxYblNSjsMv6TKsRSB12vND8Ys=@vger.kernel.org X-Gm-Message-State: AOJu0Yz4Gwz51StZZFRzxOa2qnsR87ndk78vXRY+tEN61iQjhr2KuuWQ rCpUijyB5f4ds7kiOeMymxiZPIsKyNKKk+wSdu9wX5RsIyo1Sq4D6t2PdN07X3EjGJc= X-Gm-Gg: AZuq6aK3zJ+C9F2IKWw2OkgdydyGjmgKEcWK4hg92Jml/htrTPF2wVHv2to2xFOoD3u MHJHPTpETj6pkitdSlx0PA28R04DCzLjzOM0CtGL/wg8mmS3sWqM5+Z3Q8Bu6lcDFB9VfXIrE1S /IEu5d7xFTja3NvOqqIkNyEw/DJv1XIPnv0Rifw2ngB17i0+w5t6Y7YRuaKFlZJPAi/Dpv7SDfz lju1PRXp0FR/6N9forTIQfr5orrCf8FUoiNXWhM0yBD+4MI6DBby3av08CIG/uXbrEe+jyJydjr 4DL0OMvBc3vpfpQgUb/ru+hxuhbfYcsSkrM80AhUHjQGxcWLVlijdVRW3apLwQQTD3O6amgOO5s zAVtzoA33GeFLlH//D7B09/3pUE0egpr9I6+svBqNCLFcCaNPLiTo50qcCdiG6pS8Cjep5nQlBC hPcEAbEgqR3qCX8eve/U+cWTjaUJqrLN3bOOWiFk++7NcW9mhq2cdfy9loe4PNSRsW51nPlF0ad jAyYQ7b+5hruGIz X-Received: by 2002:a05:6402:27d2:b0:655:ad4d:66a2 with SMTP id 4fb4d7f45d1cf-6584874b756mr38972a12.1.1769096614097; Thu, 22 Jan 2026 07:43: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-654535c49f4sm16334363a12.31.2026.01.22.07.43.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:33 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:28 +0000 Subject: [PATCH v7 01/20] 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: <20260122-s2mpg1x-regulators-v7-1-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 2026 Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) (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 DFF7740B6D2 for ; Thu, 22 Jan 2026 15:43:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.68 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096623; cv=none; b=CCdwTTIKJ411jaqp6Hoozo+ktjjGURa99jJ8HURRf65IyjrQJcEYyB0SBfAYntG+vkPVLkDlAl/iBKkatPdRwV+s7KPwKChhGLVXzFkKHp5GCFBrvbqjO1by0x8QLokE8H24WmzJdsTRv1HCf8gDuDTcQKWNrKAxkvVR7wXYnuM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096623; c=relaxed/simple; bh=IdJM14bhYFkWf52LD0C9dJhppRDj3HdvF9dTSIO9ErA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mALDTk5iG6uugD0C28hrE52XHuKdDx5ssBglJtKfXG3FUQUUA16bTAT/DrnVxZsB0huCVEcFiyBjwb92V39P6nH1KHt1U5WUzzcKz9a1x+07z36rQafnCTNaJj6+pBnqTvbvfnzvmFSU0Ou+dHbk036ZwVmJXPSoPYcmyQnlZUs= 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=A8JImzqo; arc=none smtp.client-ip=209.85.208.68 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="A8JImzqo" Received: by mail-ed1-f68.google.com with SMTP id 4fb4d7f45d1cf-65808d08423so1841334a12.1 for ; Thu, 22 Jan 2026 07:43:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096615; x=1769701415; 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=wrxuZNdFKpOadQkL2KgXIOQYBGlhSnNKxvjwkbrXw4Y=; b=A8JImzqoCRJntw5xhk7mM4Pp47d0PuEgidzrK57zhOGuHeesr7yYspttWlnLGLHci8 bpau0SeqaBIIGoxj+l3MAVr+hAGlY4duA2seXhzmpQ9Pnl7DwQtSora0oc6CI8tiAXNL owzUnW3IXyVlY4whhmbGa9CNh3eMiVG1kmriRcD7qAMtRhS/XO/cpc4Qd+8qsfZGK1R3 OfGCCRX9dGUDf/f71Fn3cJ9S/lurGyF18QkFNYLfkoATOp/QNWfOY7rfvJN7emhM3XTu /w37RXo1zmp1sIoJAQXAHkeNlDStaXcQg2Y5DuVvmI/l8glzoVKH8sphxDgDDBCmlYAp fFyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096615; x=1769701415; 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=wrxuZNdFKpOadQkL2KgXIOQYBGlhSnNKxvjwkbrXw4Y=; b=CDIsIaonttQ3zhwU6p/JQXn31nEJ10gzY7jviZDH/7TI/LhYLv1m+IV6mMX7S9azU6 bVzWcyYowWLAVV5POKBbKphJvJrTXx6DbUmagag/LAR2gn+ksjLprNRVNqqRZeRnwA4/ Tqi9t+/kIM5lNpejKmxubO6K2XPkfnau2BbPjy9kC6v2Ah8MK9SXLgc1kVWvmJq8/Gfm jmox1rnFoLUyLkNviuaDG2Lath6rlMb/va+VIezQCJA5Rt3UZAdXIXMhMNoZN8SNCgWY R1TDNOcQJN0c2uAM+UL1MZSePfiKjVHkhPuPudXy0xjSS8nOrFT8xN3AZ0MBKBiC+C1x M6GA== X-Forwarded-Encrypted: i=1; AJvYcCUHT54w9acWuS0LRximwuYZ29D89ymXbTYYAEIpdUdxSYP6KP6k7CoCEpABuWkeS3l4KWFIaoo77cK//1w=@vger.kernel.org X-Gm-Message-State: AOJu0YwDisDsFPaEv/l9u155V2jhZP2Mn5KQ7oX0TguPh3Y0ErUyqNo/ 6K+dZYb1iuHW1QUJscShGvhNM4lRxIUJ0WOmAr9ujOFcyjfMdsVmdCffp6dHEH+z9lM= X-Gm-Gg: AZuq6aJCLO22GzswYUUSFojMeVIT+t6NX6pHEO4YJJ3onQYbOv1iTTE2N134q6VIKOX VLpYyxbK9mJz8HzxztR9sXbhcXhIXntmPh5xocytq8rQ7jwK3CcpVzK8ztK48luUk3JLuDSNukf Cc4dwshlHM/Fnb2PeBUwD4tENqZhLk8LT4vxg3o/h1O6vWCXUs8Pk9TBC3CgJ5t3sGuWmTPoCfN yxPxHlO4aWMQskufUygsZJIek9Jduqdk/nG2nzDwXIXUi+zwjCDHbSG7kBqPdrwvNJQw5vAc6Ds RU7266W5IYOiog/NoqpU5lVvuscRzW6o3XfrwivbxJ7cLZ83rX80p67MzLeDIopxXGzzXjg0qIZ sMpKkU7k8zBvtlRSt9/wnNkoPM29d7ao2T2qW0DnkQkZwnY5u6Y549LP6chlG7s2I0WlNs6w8tw crh/KV2on0mzos1jN21RnAlu1fcR9HEiYavXg59cfTZ+H8D4Kif8LMIjQqu7DrLlJTls+so3zzt kNC9Q== X-Received: by 2002:a05:6402:5252:b0:658:380a:e243 with SMTP id 4fb4d7f45d1cf-658487c675fmr18470a12.25.1769096615362; Thu, 22 Jan 2026 07:43:35 -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-654535c49f4sm16334363a12.31.2026.01.22.07.43.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:35 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:29 +0000 Subject: [PATCH v7 02/20] 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: <20260122-s2mpg1x-regulators-v7-2-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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 23bf05492d349b33f4d50dc8141e9179fcb72600..4d1a09eb3673e9237ad28153e61= ce9384f5d9043 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23241,6 +23241,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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 2026 Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) (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 C3F7642883F for ; Thu, 22 Jan 2026 15:43:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.66 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096625; cv=none; b=ODXw9fcNMszlp3U5cRFCcj83euXdg42VA0ohwLtKr4R7sVX8qNyiXXNuXFLok9rs7xbGzLgI3BGr04miZfphR4e2h+A3HSk01U4mkNngXpLwMkFcg3iJrAAb1A9Y8kIBcVSBSpqgOkc8j8Q4VNdl8AkKf7eKuzvnA1dw8zb9iPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096625; c=relaxed/simple; bh=JAe9QiPX2OAOTXBK5frAvF1byeKXT5EVT6ooWSPHwtc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qq/WicRP8Ye3YsN4XEbSGrvPbS4eatHIZb+KHOFZs3XhlGAlBMP5xt3OjqQzh+rBWd0XbQOhfXKh0O0GRCWQHxEvJRuHZYYeYTHEriAGLARxXHokbI1S4F/TNOjOaoe6hY7EimcN+CGzJUpx5WCfcq5xlYCBsYbq/W4t/vXhs+k= 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=dw4onMLv; arc=none smtp.client-ip=209.85.208.66 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="dw4onMLv" Received: by mail-ed1-f66.google.com with SMTP id 4fb4d7f45d1cf-64d1ef53cf3so1461035a12.0 for ; Thu, 22 Jan 2026 07:43:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096617; x=1769701417; 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=aDdL6m1qWe1Q8DlvJrfhuA2RG1L+tnnMYwyaBqhamlM=; b=dw4onMLvkO4OWnAydALa5IpFHVSJKWHIEg8YmyXleEn4F9ro6+pQ1qSQp/sc48kWFW 67AVats6agTmJNqs0SObQRP8P1AeLStdS6cBYjctUC+7Sa1N11O95lfzJcdLsxHmZm8o weYYVUeoHzvzuU80c8pC+mVWe23uroOT2If3ylsnU+ZQgmTbUPEagvxUI2azDTl45Hqf UeGgbBMlKv8BXGEiEltYU2RxLus7wUYRzbCUHQkQCAQcTH5+F8sy3tCtVc7cwFLBHhTv GO/EFUbvMYXgexvWPQ//zRFrw6Bl9cgRQSAn+LLtFjellPZAuYUFSzAAf+PWnXCqo4MI IAJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096617; x=1769701417; 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=aDdL6m1qWe1Q8DlvJrfhuA2RG1L+tnnMYwyaBqhamlM=; b=V4DpEm7lI6Rw3ss2yu/Kr6zUpMQbSTG7srJld9fuqa+Ub85lL2Y4/4bvxhcIGnBSkM ZcvJoGpafv30MvKM+MktL3KEtkdH/IIwNV5y9pKvxoRhH0vkXMND5DrCRzM/T1WmIIWD BWawvPydi2HG5bbbBA/USBb28+vQ8oGfbC1JuhrbROWjpl1/vyIA8ZDBE37iuTAgUd8Y WTUgP7NLb57+j1jP6Y+xnYPFQCa2rgvoITM+U+b+12P/1eUlIH07zQ1TqaAxysQ+RfrW VXzNitRAXjrPf+Gxrlo3MJdslKbr2nsDch++Bez3QQYxaX4lkxGOJ4Rz97K41NFHwz3F oPPg== X-Forwarded-Encrypted: i=1; AJvYcCWzhMG0xAED26Bt6omK/sUVZn1kMUCiztrlOr2EDlc6LRgGKVOa0waLQ6yw3n4PgbsYvhwVz05V9zWPs78=@vger.kernel.org X-Gm-Message-State: AOJu0Yxr2f5sw1NOOBVd9w/vD884iWFtdedIS8Qf+/jA+JvrxncDK1uX slElRh2AmwKGRVaupibQLKVoQEFO7nMaIho0E+XIC2i+S8AscJhMw+e7hSB2d6gc4hE= X-Gm-Gg: AZuq6aKT9QebmVmC/wBS/2TFXoiouOvLqU2gmHLx2Ki8PbGMFNbvoVqzEtGxb2sssvp sJbHOlNp3XTic4bwHpHUWlXiyRVil3YwUk/QH96bchUWLdmu3ron4TNIlv+Sk+ObLSyOS7eODdB kq910JD+Rr92X4XvTvdzH/4c393bJ22W4jnap6IPPSVzoA49Ev/j9vMeiqMk4Bdy1ct4XBMTV7q 6bO/Pyy5C+539UHS3P5kH468olk/5Jj18esuxPbVazsKBXeHMCleeDHRifxt4mgXKNnHklIb52r 0zlSApcw0WUPMkgtPekuCdZQsb56IOV7UhS02qVWCqFxxfTNc6rAImgkpo5oPb91tvxyXPHQ0kH 1lHgMjLqYys5tLCDUgTWYwg1bHnnyno1JjC/88s/5lK7qpQlKF7f06IM9aEKF4uDh7H1TOB4bJx QO1YVUs1YfKS+hfxTmGOW8FHW8KhBZYuh4CfCs1CqpmVL6HupdonZC7roNDB2vvfWZO5HfZmmKp Iksd7ndZmxNdV14 X-Received: by 2002:a05:6402:26c6:b0:658:278a:7014 with SMTP id 4fb4d7f45d1cf-6584874e4b8mr46576a12.4.1769096616724; Thu, 22 Jan 2026 07:43: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-654535c49f4sm16334363a12.31.2026.01.22.07.43.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:36 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:30 +0000 Subject: [PATCH v7 03/20] 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: <20260122-s2mpg1x-regulators-v7-3-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 2026 Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) (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 C9EEF42980C for ; Thu, 22 Jan 2026 15:43:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.66 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096625; cv=none; b=tqBgZW6ZX6wSuHvBxQxA3J/ubfPmXu82DWSrSjcYYpOsBSpW0IKKxB4FzsWV8nx6V9W8HpyyZXvTwuJ5i+gjhmnq3uGi1MJ9b/7Mbh9ZSX3cmS6VIHhZVmhY5cD8WldgwMXNs0K0KUYiFsFsMGDG867BYQpnsHU2d334Jl+w6xg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096625; c=relaxed/simple; bh=Hu7CasII6Pg9XG8xVk/B520NQa20lPkG0k7c7sUpoQ8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C5lsXWeov/ns75euCjEMfVugH8+JeWZDIFZCBgBqHq6796Wrh1YWbNfUf/t2oifPCC8IqBqPfbyyL+LE6iQo8nf4N0Zff0p81cw1KJkboGQ4i9gP1TFF44ujUETlJ29bBn//L0GPTy+F3EkHfjj5nEdMoh0jPfWaNejK54U182Y= 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=LZZjqpGU; arc=none smtp.client-ip=209.85.208.66 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="LZZjqpGU" Received: by mail-ed1-f66.google.com with SMTP id 4fb4d7f45d1cf-64d02c01865so1782707a12.1 for ; Thu, 22 Jan 2026 07:43:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096618; x=1769701418; 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=nH1u7Jw3yCrczk48x55vKelT7EzPUYE5MjIgvNuKolM=; b=LZZjqpGUvxLr1a5tYCTwQ2xbMSozF+fXkDsXcNzTXk4DxSOCfkFPc4WI4r1WfXYklS wrgkifBF1Ozokv1ap4DE3EkI/e4erJn4HNWmXi2P8+Z7Lrxs09trHBdJQPvV3ZE6Q7Uo aDyJVNJ21qAUFFEGocX+lAMZRmPSEuoTI2qXJ+zFtDW+62tRseBmqqK6+PN5kMkrq8KQ b3SHHkM5RpflYHmnSWLJo371CndudnQiCbfF7C28HCXtTBqyzTbKW/Qu+F/Jd0cxkqbi dNpvw32W828HcdoXgWUlHgsjzC96ERccMtCvQKbyqbpk4giGWTViv8qjbgPKlN0Ki0T/ aY7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096618; x=1769701418; 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=nH1u7Jw3yCrczk48x55vKelT7EzPUYE5MjIgvNuKolM=; b=Sd3L9WZ/PKWKOW4nHcrjkFmzKrbD10VZbWI50Bv3EzSVj1Np5tmQe7q/Edpj+tLKJf 5lrGs71xBzbZF2/KwVat0WD7Diy9Ppyd0g0w4KSyZOG2MaTyazESPCPXuOPmN91hzy/J hH9bL2hClG6hp0hiPhgNe5gOL4wVX5ujQNQ9SeZs4tGIu72G4RvnYGEZAdtVYTBT58DI NXazy16i4Y2oXHKAB9wHYviy6IxFupTsnNMtPxgksvNI6/24BxyuuhBrxhTS7ffCNnrp ddmQq4mAHqbRmdbRMH2MTfIKvg9QUbxSnJeGp0p2DWCz0deUdMuYaxhPoL5Z5joXy9DN N5QA== X-Forwarded-Encrypted: i=1; AJvYcCWv2HpC/RYGfvJHEwhb9c0nHLvHEpt/qS90knhDEM2HCA+Y1v7l3b6lNaE7ISoXcP4C2Shwq6J1ct8JIVE=@vger.kernel.org X-Gm-Message-State: AOJu0YxVNVKB3uAldTdSjBSnRFyTPd9pUlWSGB2j3hpFTiFbProN2HQx d8P8D09duPrxXIrNxeF6MGvcDp0W2lhQw8RcWdcAl7ASz2M3f06z5/kiRoCBS47yU5o= X-Gm-Gg: AZuq6aJ298hyAcMtWY+q5ltIyEm7+t24OG+EvPc1XD0XUAvUbrSzJq48EEvKZ4b8fp8 ukhTWx1nUU6U2gn6NEkALMQazuN7RgfcF9FxbzMHNfhKY0Si7AUhsMJmDAp6xfurrEkC/jIoWAY a+Bl/BRiOzM1DniMEjcaLpfbEq+JfuEBFd8CvdE1O2qiFRLkw8GxPk2l9s6SYXTowLj+464vQ6p gBCc4FBDAiVwFZouF0Auc1bio20YOS5esHXae4SrThVZuk9H593Agk+oQCz85ehkWGXY9ZoexpT pLjrmGNigNDgcpLbBiL0OMwXD1UCSSxsQVIvV0/NgcCVHJ2XLix+ox7tU0D5UrooGOUePJXlZXd Z29Y+NuAIcUXQb1QHR4vLpAybeSD+5p295bazTyXRGdiBDBH/yvMRkF/yRAXPahZFIMEhW94P1+ CnYopKPYcFVjnrAOfq8TqMMxvhaCZdyIR4aIeFIVISAkp49Zovm8Qlr3Zx1Z8BCICAvul9HSlBE uDREw== X-Received: by 2002:a05:6402:51cb:b0:658:1224:3d51 with SMTP id 4fb4d7f45d1cf-658487c99edmr20114a12.32.1769096618033; Thu, 22 Jan 2026 07:43:38 -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-654535c49f4sm16334363a12.31.2026.01.22.07.43.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:36 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:31 +0000 Subject: [PATCH v7 04/20] 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: <20260122-s2mpg1x-regulators-v7-4-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 2026 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (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 D94313F0743 for ; Thu, 22 Jan 2026 15:43:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096628; cv=none; b=W0AkTWULWUHqyluBE5McIwBBhd0ZkqS0HOjGbmQWp03h13wil2/uzow5NaSxzBIQ0Wi8u/W8LzgBB0l4rrL99fvC/sWI3QTDzka8CwLFTQl8cYg6M59WR66gS5a42N2b5RG+Vz/+wYvJEiEbvdKS+1gbWf9e9FrMIiCU83Irhf0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096628; c=relaxed/simple; bh=LOORAY9pMK8aYglYEfvAWMcpI0Yqtaw7s6Ex0EGCPkw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nrhNaoLh+zT461lNuTUgz7QUTokyl+7OhvGj169ixwq4j+CO5dxypDXqbwcJOh/NkN7yrjyfokenp6LLlPWQaxZ7TV9ophOTeFmSOJgmi8cRbnExkkizjX5QsXxLLbXHUBIouUke30iMtACCYa2XlxawBmgpmdZRIrRMkZhTrSE= 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=ATI/XPGI; arc=none smtp.client-ip=209.85.208.52 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="ATI/XPGI" Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-65807a2012fso1874144a12.0 for ; Thu, 22 Jan 2026 07:43:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096619; x=1769701419; 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=/cev7GX1j0sgIdefoqITFqaZrJh3oQgkUM/rFT3vkdM=; b=ATI/XPGIpFMIQN/VgxJxYDZU3PJ57Jd2HfxKcZ6/s1pCVG2BLAg3e5gByQbw1Ekxxx 7of0ecQVEbx3a5vqqa5Nh9FRN4ppDT9CKg9Qn7IZam7LkpT1Bs9L0CcUDI+XDaLJxCcQ xiZQmH7sH8ulET+2wbDonqLOBo+gYnLGuqlx0dslXIPpsj5IUb0TjD8AJgdOaDkiNYcq qbwl1Kw/z51VXiLLaL4ed/Rl7p1yCXtlHv/e2pbT2f5qSbH9IooEKVaIuAUVjuZ63DNt hugFz7QwzbVSgk56TBPY91gVBOsIs92NzCf5NCMM8t7jfl3cXLDI5jpVNxoJSnOtYiXS J8kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096619; x=1769701419; 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=/cev7GX1j0sgIdefoqITFqaZrJh3oQgkUM/rFT3vkdM=; b=be5oBWHLQeGLf23+0TXxTc0TzyIAUf3hAG8BU9LsW6L5wK4Yk2fnLpVhg4X31sXR40 F4ouPYqnSIeJp7Oi5fSaxWnRt1xxwVN3J88vmA7hkcfEv3btWP7v/0pQQbQi1ab4YtFL FMxdgrVbpnahmwAkhuVPxV7bV5+FJbpppdDNwso4wpLKihQxy5elqptDYAoMJzHr0RgA +nFf/iwqfwSdA3j4aTPKdKiwtziVpBvO2s4satQRC+EqiOloEkgp4uIGhXm8pyCWMW6t dNEyoxne6cyaMP2QSYDBLa2T4lDn/3+XGoUjSM/CYxLII8SCnp/Z0ACVQP6cqgYTPinn NL8w== X-Forwarded-Encrypted: i=1; AJvYcCUkjSCAWZxIFIKG7m5xKMuomKFw2DPZwIu3J+HMu/MrqZACS6/h096vNXfOJlMeO+StpvkrUKBPaW/Yyjw=@vger.kernel.org X-Gm-Message-State: AOJu0YwoRVm5f74H8cBgGArV82bnVLFzohKlSJHBLX+grwQKT2uEFT1C 54xa+B4HTj08oXzaMWD/2SyRd0UaQybIvxu3TvFQa5jeeI+LbcB7w9zeD2pa2UphF4k= X-Gm-Gg: AZuq6aKwfhH7YSKyHtH3mARXkOyCTPwACka78pexD70YY1v+5uTFXVdBqkJD3I70I6G qKsC51h/5UANdEiYlXi6kmnnnmKldbWUbvbXuj4Vz21oeozryxxb2zprROzfQBxuA/UGeXBT938 yZalSWXmjBJn2S2Lki38GcbrdMjp46DYovVJOFO23zcsZi5yOzgmm7zci6zt+0ewVc5sK8PJOaR t+LunIMoUu2+wiTFbJgAxvkvtQ6H7X+m3JUh9IXiT+acrnLOOhh+KQch33NyuQ5rW+l+lzJ/13a CrPhQ5bCYN/S7L7pDbAcWke1Ep4/0rMHh3/hpPaE6xnbaMPItqisn1j5hPC0igYA0H+6hMzEyst KV8m5lW5HugMbZKbyBENKu0vbtxwrt15xgxLncuT6ddB5+jZVPy1C9xgELRuLZO90xCQkjDl4oh PrFJkEFrDUm/wHgnVkEgCMHKAqfpcZXm99ChQIhcVwX/KU0Bc3kqv0vKdJbbwAPGakwlWhJY+MC q6LxA== X-Received: by 2002:a17:907:1b25:b0:b80:4030:1eca with SMTP id a640c23a62f3a-b880023748emr702788866b.2.1769096619311; Thu, 22 Jan 2026 07:43: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-654535c49f4sm16334363a12.31.2026.01.22.07.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:38 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:32 +0000 Subject: [PATCH v7 05/20] 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: <20260122-s2mpg1x-regulators-v7-5-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 2026 Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) (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 EE7C144A710 for ; Thu, 22 Jan 2026 15:43:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.67 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096628; cv=none; b=M1tuV8uxmbIE4eEKmX7bJcOxEhyyy9qW/NMB7ErN0Tjam2m20OMpy/ulQ8YBd+T+eChhJFOFyxByX3rNJhTYokscCkMufV4pCtdkc+gjMEktIIpqCkoS6pRk6Ce8c2Spsw8NG6fbRlvWhkH4GlK5UYlZ0utm2hBHfS9aG4vopbw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096628; c=relaxed/simple; bh=YUkqG+cd93/H4MGNBfFqJc8uR/siDaryijnkiWMGqeA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UsCVnDZY1S8l5cJjpg1csDghY2f+HuNLipobdgcdozUbOiUaxITqWz2f/OLiflncfbuMIXcWr9UetWWFRaSQmk2eF6Gc0+dCxpATPMSsAKaod8s4ju9CPfKD9m28tkjrXt7VkD6EfZAAJuEgt6gRaliX39/hyfr6ybHibav/Xpk= 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=g6lkpCWd; arc=none smtp.client-ip=209.85.208.67 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="g6lkpCWd" Received: by mail-ed1-f67.google.com with SMTP id 4fb4d7f45d1cf-6505d141d02so1602570a12.3 for ; Thu, 22 Jan 2026 07:43:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096620; x=1769701420; 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=Y1HXah54KngjOwkG60AMif3yC1M7LQ9vhDlbA9LVhoE=; b=g6lkpCWdzXv/F3EGWVYmIQVKGeIfkDiiCYY2xeDytmjDBF1ucVSU8v3CzTpNfiWN1F kPWzkQxWdkSUoGh6jBh6ZwErs9aveQH2XkLhqnx4C9Zx4sYiQsRPsj5mrUX6roeafERE yy0Aq1AOG9HHK03RlyGsETNAJfkRbJKhid+7/dj7oDiSc2QMwgXXfJUHCXJ0Z6/X6EQA ZGRAchgvrLQ/KuhudkuorI2QgzBI7nQ6ch8xqSbjuME+8mG8X/3BaHVhivT3o7wl4KL7 mGZ6Wjzq9nMUctmGS+p+9hjLIzHjKcYwuRry3TaC8TxHOHBD1Lgn/Ori89/BWTJOHDIL 9Ssg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096620; x=1769701420; 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=Y1HXah54KngjOwkG60AMif3yC1M7LQ9vhDlbA9LVhoE=; b=BUFaFcxITeFnjsRH/eWIaAppc3I/8bx8c40a4WtaViKeplveC4C7j1OitP1eEdN2OB VhyK4sBi6zDTZgygSvZlDfBsW87Y5gq1MQyoBzQZY7gKWFtThDNxosb28giRaRiIbKz+ xyaz6ZOgrXyJEWNJWzo3sR5JyONgssmok8DNfBm7mJ49NaSikEzTJvFMBO5OxhyWmNNr xRnNaw8XRnyChan0lZ/deZxCioNYey3EaJp2GIQ0YA16kbeg+IzBTShyZ7SSDVzmqucD Rf6wXKQ0jI6Eys6wqrh9pd7qxposBsihg0WVbcOxeRHWEc8BhXCgMBeY9OwHJzqvkDL4 UniQ== X-Forwarded-Encrypted: i=1; AJvYcCUcLjb27eRnBh2evphGHcMM8LA55RJQCBuwSCS5UafbDAYY1itAlSeMfX5540PSiCWkC4TWM4ImYEfTbLk=@vger.kernel.org X-Gm-Message-State: AOJu0Yz3dzTmAfbiSrrRvOUHPMQ3DhT1QdBP0Xk8m54dXHyh9S70N0mf VXVR3/rBGevVtWykcRG2FDMzv8aErY/UJf3ZLxuk71jnxMJ4K3pRDFz27V9IksOTL2E= X-Gm-Gg: AZuq6aKvxTYzKJbHiOr19Nj870NcbRIdejpCaNN2+qJKkCRikkBezJfqhd68Y3gUr1I jz25H/7W37NfC8bdcV0767SnMAQIM5PyfOWC3EL0WAfQvftXiItxrCQJxdnbkRSbtnI/64XrFSN LSp6IVv7T1tc4VBWTyuu1O1HjYODVG2y0k6DPEPphGNV4UkQ9XuJLeiOGJ4/T7NJ9NWftQwAEl4 lPpjbtvc/6WGiVf7wJA63Ez9+GbHgGpJVY3LHmD29f3NojplH4QV3ZlK6MnJ8fiE4SzGvoUyQAk +gCwjTgjDjQ0CP6Jp1O5KRyE7lrJNknMwSxAxnFkUautRdDjwa7odNRUu0y9Aq4+o2HwEgJd6fx qyQZS79H4BsZRAYOoiBIUzUzk60+TYxP4Mvw3ALRdFGCbTHv+OXmwYlbvoHQXy3+vekE6ytpunR X6NhxAR76cVJe6VogsRthtSUilS2vnmNuwDafDIkk2tk2IePC+36AHu8+zrYzjEFFntUllpwc6+ 1PmqzdYE7QiuGOO X-Received: by 2002:a05:6402:40d3:b0:64d:540e:c68e with SMTP id 4fb4d7f45d1cf-658487b1d8bmr18992a12.26.1769096619853; Thu, 22 Jan 2026 07:43: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-654535c49f4sm16334363a12.31.2026.01.22.07.43.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:39 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:33 +0000 Subject: [PATCH v7 06/20] 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: <20260122-s2mpg1x-regulators-v7-6-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 2026 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 443983F076C for ; Thu, 22 Jan 2026 15:43:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096629; cv=none; b=DIuntq3fgNKissJyuyQ9+7c5CXZVvH98PsPbr4sxIz1CJggbnoFXZTLynlJmugEivIoWCZousT0hjCxJzvf9PTdi3hEb7EccEPdXIKcNiWe6O36W34BRCA/0PhcGcHT9kd3n/6N3am3/HetHJ1pVfku0C7VuQYySMDg5ilVS6ho= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096629; c=relaxed/simple; bh=Bnqejdaa4hI/3mIGtB3IlQTGMv1yS7F4oLEOhXH3rRk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XLCWy1IQHK9gwlBBI8aP3kXSK1p5PDszK5jkLQXcyXSoNWIts9fLxWhO6pzSKS+rbcuOYbRl458xrnV7ETTHrhonnAaZs/dIBfqrpsPwVya2MHAT9ZUDs14dgdy+o20235MZCRrNytVXmLJlnLzaP4bBlYO2RCqed8VgIIKunpY= 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=HdOd9E/p; arc=none smtp.client-ip=209.85.208.43 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="HdOd9E/p" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-658078d6655so2302344a12.3 for ; Thu, 22 Jan 2026 07:43:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096620; x=1769701420; 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=qODehQYebDqLL7EwCAh2DU2WeYX+gdQf3MnpwlxtGlw=; b=HdOd9E/pCSyg0dubV/wmVSvRQtr2CwTMubYBhisE6Ok+jZ9Ftr/hMT1qc0Qei2vV2J kUMBuxbfbLJGXM9bcmcMr1PpUGUpixQs0dMUxXB8WeI62DF49BrMCZZyv8YmLF4SnCzM 6bvhgQaM1ye1lM8vKXWee8FR162RYr+5xj1EG+7qTyL5juAhl1OeSrn9koG4PE2OJRTG Bb58U+Bg3gnFQdUmoQLb7IzRhr2MVBz6H2ze+ABT3gHLX2Cf0vZXBNYepCS8Ij55tCh/ eKdRr0fj7Doa0TZxEhOlqY2lsO8Gqg90wuWqhFxOQORetYOYwNEdnLSFvwLCffGv4pRH zUpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096620; x=1769701420; 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=qODehQYebDqLL7EwCAh2DU2WeYX+gdQf3MnpwlxtGlw=; b=ZIFX5CZjF3eDxMTBSwkz8oU5qhfYh/qR0E3gkiFIimj7QLz/x3h699Q5/8Dk0bPuaH 2DJUeoGE6ViQDydpdoWeKRiDku9w5YsgnbtbCXqhKg7yCBUL2JpTNP24Cx0q6bQNnxEU jNsEWLRYODdJZVgrhGZBGTfFFcvNlRi1UvcVsAOT6NV1rqCvIPzHt24a7fRMGRdnXrE7 O2Ad+S3n/4F034hXRXR2gHWPeoSqmQpfVtc7eLG0UTq/CqVau321dRWIKVwscrnAKpAF bEEYKLkWEx+/8e7TsVe8PJvqJt6VDbUWK88h+OK5TLjuZrUPuMaw2eP3XNV8PMu9LnHx G8Cg== X-Forwarded-Encrypted: i=1; AJvYcCUio9Kvl6H4DAgr5DFG7BgNVauYVGJ7n9rZVNc4fl1xfqH2T16HyUg4mQiD34AYCzNt6EF5XUWi/UfVAvk=@vger.kernel.org X-Gm-Message-State: AOJu0YwcKlnq0f66xB+YF4KYVqQPjNIdNUWbvvQneMKkvjqn5+7PyQkb V9KcFRJ1l2ZYAuTZa/vQwhcDt7ph3CZkSqjqcpax66GkhWaVBxEDYQ+S8Td3UBkjYTk= X-Gm-Gg: AZuq6aL3XEFDgSgvwwVGZDf3bGSZQ6lIMdFi5UE2cHtmBW8pm3PmPKI23C2m/2LxMUJ blvXVwTd0IPu74ZQV/ynx1cyO3CpIubU02juFgX3BlCO4EFHcFtGPROAMgcEpWG350Sb10mNbay loOlIxfdc8BP+NZ+Y3Ejg+8xeMd1ocVti/qj9y4lwtrvfWMUHjk+pcnAIHC4QuXp7x7xR0x/TkZ CgQ0ZPeyh+yJ6H2FbIgj21WaoxBRAPhmXW5Ywfcw+2+rvK8edVYJeCVCeQINSIflTx1cA5TbSHa M0Q3lBZKm0cwXCq5qevv2ez2sPNtzw6NvjZS/B2+nb059nVTM4N2c+4ejpQHHhJsXgLP6pcDQFU Y0LJ+Wuf2gb0j1s3sekwNWSWN8KqgURcvJPuGMJHyvrccF1sfbbfLzVkuJWG9hPIMi7VADRcWQu JdEkoiC7Je6pYHk5Q5ipFxc616sFBME/rUS2GebRB3xKDdhvjp7SLCQm6pfLYbJbJV+bQTDOtHN Hmuhw== X-Received: by 2002:a05:6402:268f:b0:658:1274:382c with SMTP id 4fb4d7f45d1cf-65848770a7cmr40127a12.15.1769096620351; Thu, 22 Jan 2026 07:43: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-654535c49f4sm16334363a12.31.2026.01.22.07.43.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:40 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:34 +0000 Subject: [PATCH v7 07/20] 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: <20260122-s2mpg1x-regulators-v7-7-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 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 7799844A72B for ; Thu, 22 Jan 2026 15:43:43 +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=1769096629; cv=none; b=BgbB8heVv+XIUPonVtPP7j13amrM4st9uLE3Heur3aF6GYynRMZG8KodS5MN/MDDXDJ+BoxNMjQdU7xpbq/+Jwy+uf0kCXTdx0YB1Qj2TI12SSeF87B317btrLbWuSq/vTncXqJiw+olRJ9xSQ+0xpNF072guXxhGOxTsnqXpyc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096629; c=relaxed/simple; bh=mvLpDBDtjjTy7WC1hkY3vl1ccJiFCt7eD41ttUSpx+U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=krYxX3Os2gYSB/yv6M3dCHoQMdPNf+KjfM2UvFHqFxhAqTBXJb5vGISjKNdlEkXv1TDkcGRUBD8wpSy2xV98ZEttZC9IkMHvC5JdQTfsEMGKVhtIvdYAR2RoxHkp+/gV0AkcciLVFOahRrt5TC0KHpP40w4bxk87JFHgPcsyEeM= 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=D8Aa+9Nf; 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="D8Aa+9Nf" Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-658034ce0e3so2055430a12.3 for ; Thu, 22 Jan 2026 07:43:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096621; x=1769701421; 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=JjAudqG82zBneeIXc6AyLX5P/jBbCjeUnuIz0dqoYGk=; b=D8Aa+9NfSwRfvFE9J8LVFGnQBCFxZJBJUpfzXI8sfw61cgY2YjNsctyot9MjAdXTgh +4kCgmTz6FVYOiAxXSOVpb0plaTkuuVNVLqdZ+x8sMSiHlMg4Gmqd/XSCE2bZ5JQW9+9 drNe2yWNV8yMvo54IGIKoTJ0Ao3xyc9HKdjH2lKRHG91SDzTZ4ToSSZx/rDjIRGPnn1h GkavFaMbwHm016ZByak6DnTOqpHThlZ02GMArS7e9m5uHJW3e4aGExlhzp5gbsDN0QlK wNng27pp0xj3VfSo2rlJx7qNlEFV3rZ4wclAsqPpvd/KySQatvb4xBjgzACAvUP5GTIL /o/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096621; x=1769701421; 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=JjAudqG82zBneeIXc6AyLX5P/jBbCjeUnuIz0dqoYGk=; b=CEKcPL+Zof24bGMTMWplVuEW0zZSfM95+W3eKO30wVj2aB7TRUdXQVFXATh6r6I7s5 D2kdWAve1AcwK+YNuIUbHOFOXutcWS2+mPi6MbXkhFCeeVxFfdnhJ4FuMOk4qZn0aScI vUnVTzMkP29hZzsKxX6qqhPQSTLqSQIoIojbjKNhsDgHto0aTGsCH+g+OZXGIogA9E4U QM2X3sx5FZ5baK29135RpXFLw+v4BmXuKAH7zn0V7JiMslQMT9ek0jl1yenUe7Z8RYFE a5dSdAqwBH3KclhYoahCKBk/JO8vQv5TQJqfv+S/fUh+kOYdMsm1wpmJKSgDfolajEeZ REWQ== X-Forwarded-Encrypted: i=1; AJvYcCUOiAFf58y+FoT3HpnA+4eplmhVyump360ujJsxs9RCqw1C+aPjW93SdvSKyo3a9fNqDQLXRsZYamUvJaw=@vger.kernel.org X-Gm-Message-State: AOJu0YxMDJOi0xsDBQB3LYGnSwORiAeFC1KCY26rD3yMpyRQmMlA9t/B /JpqkdLYS8OZHzi7j+1/RD4sr6yyqkZZ0puHhhNw0AGbPld6PBLpmZ4LFCJRCPzxH4Y= X-Gm-Gg: AZuq6aKsWZ/skmFA0ClF1+a7kqi/RhMmCOjIAS4BqpeS/FWoJfa/DrD0NUDmxA5LBog XbU6y6X7L2hRmqiQnT2dSxY/YkbhRU8obzNHnxFAGMFQxMRXTRBPk7NJrNJPOJMvubrE5SonTe7 midgx3qazlgqolkQkU3OEgABmRA4HaPQAnQnYAY7g0oxfiKhAR+p8Ckz+duoj8JzqE6DWQwZeiz u14n+fPin2GlD7fUCxOtw8k9/uvV3Y+V4J5LxFQXKieJqqdc6H+/DSLwUng8esLUMO8B+pJibLS hO5BpZkiGLUs2bPlkSM1UfmHC+QTmnMdZqvI6D+wBihDWk8yS8w39QQC3nd902aaF5EtSsZDmIf ZagQxaJM+qUPKCnezKdg/MmQjJTsX/emtsP+Ckykup7wSCiAu8ra2BSs9F5ZYkp2Bj9D5LFbP+W t4RJ7zE5EBFV8Oa74eROvRwKl/tlwN3uricL94rfhak9QATruyZap+VSTl8KBO9eEr2HuSwzRIa dX9Ow== X-Received: by 2002:a05:6402:350c:b0:64c:fc09:c956 with SMTP id 4fb4d7f45d1cf-658487b7eb7mr24682a12.29.1769096620921; Thu, 22 Jan 2026 07:43: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-654535c49f4sm16334363a12.31.2026.01.22.07.43.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:40 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:35 +0000 Subject: [PATCH v7 08/20] 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: <20260122-s2mpg1x-regulators-v7-8-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 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 09BEE44CAEE for ; Thu, 22 Jan 2026 15:43:46 +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=1769096658; cv=none; b=D/IQf4qz+LwkYNQFZeNzVhSXAGy1NHplE8X/iiw/K6hxLP/JSvvNrGJcgbW/TAK9fWt9uepwpE09+z9flmveaKVsKJMSwm2tOEWnlaiAxqyg3E+Ls8TxS74WthdpITXr2uO5P/E4VJCa1KDTUayYC6VMrObDKwxuLVHgVcm1a0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096658; c=relaxed/simple; bh=8oXl6C3Gghkcgv8YQ0zxuAP9BQ/isgNF0zZyFN1H9FI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qPkmH5gqwCL7lX/Sxg+LdC+MbbkJHq0+hm5pe+C6rK2O9WHYy65pXp9K3f/II4NxPJklUYYodKn1HT/DaAby1jCLVUb3pO5rObS1ymZ76czrxuq7Y4QvUrXSUvIBpDN7sPXYuwJp0CfxI58tXf7CScRM+xo9yVxle7tpP0VJrtE= 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=PFCK5wRc; 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="PFCK5wRc" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-b8707005183so183546866b.0 for ; Thu, 22 Jan 2026 07:43:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096622; x=1769701422; 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=nIZShjrTY0dOdax944oyYlZm29MMkhX8362UuKqaGZ4=; b=PFCK5wRcBC1SXGNxjPW0m6eWgTmlTWJrtTGxIc2RyWEzgPy6FL6oqo90zUl2rtL78l USIg+mwHD7zX4b7h+ZZihDbmSJK5euskiFX3loWHx+l0S/wTIbBwTPcKt6b3nfXUmAIK JVR4eIf/WLQULiY/h3By56sxEy24s9KIwC1Aw4fjQYqzCtXoZbH91cb4AL4arY7I6vRI qFclFsCvGJ4/3B3+8H3ylkX3gTsWe+BWLV2Efcf7pOuCUPVt4/lPY8C/aJw3Lscmi/lk 0E0dHEYhWhdYcJ8myLSSAkeBrjKrbEY4veDp8IdUCvwQPspQk7eVfn3PCVGwyHmpOQe3 Zy8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096622; x=1769701422; 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=nIZShjrTY0dOdax944oyYlZm29MMkhX8362UuKqaGZ4=; b=aR8b9MWGcmhUlQh8fUFezY7CH39PDAtWNAPIZIX20a1v0+iHBl8WxgMh2iJtqIPNn5 HdCeiVcM2S2rk264Qlx0X3V6ewTDcu8+jEiWMk7TalY6KoA8EQhlGFyIAMKA/ImzzLvQ ZnXcbuwm94uRXoOL8NdBGPmMRxFhfiaNfBd0UGwO5TAdxQIQC6r9nAiv7DvQXHvHetKi I3w1DGGnBMWQtZeLTgZRiPkS3DM8F034zZD2QlsBu88+d60MR5wDRV1WAgVDYYVwFP96 5jxuG7/3JE17gZszujGRWCbUU4HRSE8ECxC7lR5jH0TLMQuMEB5B2MX/MXjPPxjA78Do iJrQ== X-Forwarded-Encrypted: i=1; AJvYcCUqN6VWAyg9K8BbK0TQQvyrblPHH9JAuq3W/RlEhwklL7kBJ+5IZccKZ6SEJBV/QLelRFEQd7o5qBL97jw=@vger.kernel.org X-Gm-Message-State: AOJu0YxkBSYxD7fR6QqixtoxI1Hck0xbEtMnPkaD7n5hGO9zsRd6TzZR obzfcvKjs1EcUA/HykIkZIBXDEwebi9KBOFe8DN7sQHytwM81oykZj3v8Y3zrH8WRes= X-Gm-Gg: AZuq6aI9eHuK5HaayXy7N1H3Dft7W/5OnZIO7PLOXiLz6kqKOrl4VaIhO4zPYJrAap4 HT6bNg/Q5OvMypxe/SHbZQna93kl3MZqCOxqP5mpZhva2g3IM4Es0/WrW/niQClVH5C1MZ3tpwP V3DwhTuQWtT2e95FsgyoHOnwyGD63xmxwJNJSncklBtHJPKfRhjJeiiCUbkujZLGW9PLNqvtIxX Iri/aGoPXJBXxZDLnE/4ELOd2IYbTm+EWhz09UvLYB6TsKyyXrO2nbyO0GWNFv0GY2k0Gtn7C+W 9kvgztaKxr47fy4NAYcS+43KJuTKXYLPclhvLZ5JCgYhGjZcCx4Ns0bUhyTZtTnEIlItpnz61BC WANMfr3WlM1NeHSUvdVMd0ooaaj+hDbOu/TwKs8a8Ctud1udu/JNDKSizAcqIXhdK4IPtsGPAKm Ju6qsKHnPBBVGnhW3D1jKzFa+3k8k8+ERnE6zDGpi+JhIa6S65VJ6zhRYfzROI7eyrcM1hntFK3 qEPsA== X-Received: by 2002:a17:907:3d42:b0:b87:35fc:ae6e with SMTP id a640c23a62f3a-b879327dfb1mr1815866566b.46.1769096622292; Thu, 22 Jan 2026 07:43:42 -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-654535c49f4sm16334363a12.31.2026.01.22.07.43.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:41 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:36 +0000 Subject: [PATCH v7 09/20] 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: <20260122-s2mpg1x-regulators-v7-9-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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 | 86 ++++++- include/linux/mfd/samsung/core.h | 1 + include/linux/mfd/samsung/irq.h | 105 +++++++++ include/linux/mfd/samsung/s2mpg11.h | 434 ++++++++++++++++++++++++++++++++= ++++ 6 files changed, 808 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 4c0faf4c998931515003bd8f8744861e1ffbaf82..133188391f7c255e20aac56acb3= 8ad89875cab18 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, @@ -206,6 +265,25 @@ 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", + .domain_suffix =3D "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, @@ -304,6 +382,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 +422,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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 2026 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 5F4AC44CF2C for ; Thu, 22 Jan 2026 15:43:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096648; cv=none; b=C9PRU4BPwDgaMihu+wZYh+CH6suZWkGNlYwMVErAaPY29/bjYAAPVDO1bCi/E8pDP0t/UAr5OQhQuChplhWlY7phcs/Qz2B5JFrC/GOZlxrqjiL5OW+NiMvbYCfpIebl6mk+8yCVo8AHatIfVvAIQvp47Ck1cu3LJCIf3lchmO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096648; c=relaxed/simple; bh=GVzTile/yZwpKHms32vEGpKMdnPMenoAs31RnHnr0vo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UyOfBrxV6Gotv3sYDSG6uQr8NTeu34y5UynO+pSSj24ztzAN1Pp44TV8n8wnwY3I9kX/3sn6iFlYsQE+P63pzrG3+s5bu0dip5RCiNsXSb3+mEcRoS8+XhRRjtfLNS8I10ipT6Tc0nb3LQRO/vK87goOTSog6RBwM+zEhqdEejc= 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=IZa+UIUn; arc=none smtp.client-ip=209.85.208.43 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="IZa+UIUn" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-65801ce918eso2393231a12.2 for ; Thu, 22 Jan 2026 07:43:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096623; x=1769701423; 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=5mnYMLTw+v58WgRJpE4wU5fkf6SbugO2jmsGWp983LU=; b=IZa+UIUnxuvCSVrceV9c9aeWUpLVihpwcjYklH+anAqCNWYmznLgqdLr5ZiVC5Ywrd y60FCfX2LBUzMHwuLysQWqMnOOltb4KsoVDyUsLf9i9ku6kcrlxVPLnjGSClJxciFikO anp7vvJGjmepNZ1R0yZ0J8QJ+Xi+KdAF4MKNCJdYpkjAo3Zzh2BqlhdEMTPxAfweQ9aY s0/pyr+f4Mh9/BS4X/IHzOdQG8g0dImjxrz0ELzyVGEniNEFs/ep7gAD4d1O6omWVjhp z2YIw9yhwhB70p1R+F8HrWhkNEpEDfqUOAz5QCnwCQJLqySgpfeuy5nxejPkE9W7qgFs g6vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096623; x=1769701423; 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=5mnYMLTw+v58WgRJpE4wU5fkf6SbugO2jmsGWp983LU=; b=ciPVA4aa4fXJrq0LvalUteSRm0MVq52W1eggSOmNiVmsudJnQNL5VaVlKeZw1Oupc9 ojMzXRxeRTxEfi4MYILVEG8C0f+Z5YRErbgW0DR+hqqZiPpHJKGhn3w5aIOMBakgRzom RgEf5KJXqHhltZrJfpGfuEpZqkD/kO8qycLOh/2Z6GPCfz1hPQQ+4Qvf8klHjG57lQBh wDS8Z4/lo+avL12Og2k/5Gt6e6Q5MleSCepDnuKodtNmEhc3/0B90lDw7MT9iTAA2/nD rn8FodT+74ScToeQGxv1cccwC88sefoFW8RBanZHLf0MeGwjPxzmNjbCVe28IG3i9Les c9Ug== X-Forwarded-Encrypted: i=1; AJvYcCVYkRz7ekyPLKbzM5jO9crZFLJFcT2A5p0ub/g/VRzzJzgBlj5THfBOYOjvfWecxQi41z0jRjbIDxLHUEs=@vger.kernel.org X-Gm-Message-State: AOJu0Yw58Gy/7BlI9A1Dal5sG+ci7yLyEQlw1mhKlj4mb4yUewWo6eXa zOisT9mGQ5OJaHKJVstIMNRyTxiT6Ct9GqnG5F1rgbJIHPCdMpHxxKw9+crQ0XqXtZk= X-Gm-Gg: AZuq6aLedx34HSDqUdQok9iZiffygei5hDZahymDbsQKVcEQo8PQxhQAID7XNLw/HF3 fhPWThclmcqyIYbeq21A/ZzG4JTLD3wJmuyc1DwkpH8Ook857IBCrvZLg1kOEPuXpceVLwSDLjy xbWs/2taISmIJHjJtgIjdN5VHX7jOhWeIAsxO+2GmPfHW+AQWg8tORZjOMdjr0SLgdL7u+v0TV1 rex0Mat+EboIK9OlbM0wh+H3wLCSWEn33eSCK8JyqiVlZTMmPhKDB9bvRDw5OAB/OVtQojDq/L1 A5g+/4n978RtxuvqYhiL+WWeg+ikKFIhtP4JhlMafWwX8/6HoOQJHjf7QZ3QdutFPbl1kuEHC2G AmEeiIQE3+tItU3vc0gK9Q1SkH8JEbveP9EW8pSgfLIPoUSjz/lfhc1vqJc/t6A1gjahidRVvK3 M08dGJxEMgeeEZQcuyPqwXSx5rQOf5DKRaMx+mEslYX08fIe8bA5jbAjJN1NrzEJmNlqWt04FdJ TJuvQ== X-Received: by 2002:a05:6402:50c9:b0:64d:2082:d027 with SMTP id 4fb4d7f45d1cf-658487b933amr25772a12.29.1769096622839; Thu, 22 Jan 2026 07:43:42 -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-654535c49f4sm16334363a12.31.2026.01.22.07.43.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:42 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:37 +0000 Subject: [PATCH v7 10/20] 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: <20260122-s2mpg1x-regulators-v7-10-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 2026 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (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 5B89C44D02C for ; Thu, 22 Jan 2026 15:43:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096637; cv=none; b=nnVkYvIewfUPcAyJvIpz4uyN7bs87qnU6moEC2jKk/5rUO6jo+7Ag85Xghf2GsOMd1ubJ+sUtZ5/jtAUef+zidioz1/Z21W5qmCjKAbMcTNdQxiTgZ3Lt1qVK4Db4HWMHUDCJH4ay/vSlHu50n1cJJAIYRZt0DYfuqRoE1+zXQo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096637; c=relaxed/simple; bh=wZmkgKDnx+gLs+hVAjzPq8Ts28TSMZhJDdmeEe4ghKo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Hev945+0A3vVQ450BeTaNnlRX+mxBm1hfYz8VxVN86Dhz5/9FzzGzoLA9s1ILfzGFM9xKONDaFjCJ4+1oAf66VsWOE65iOVH8pxnYlkHrDS+NJKjunymeQZ9jRuH5daFnQprCG9tm/WEYvugQkA9LNNjd3iciDeOcz0nO8kr/84= 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=UbQTwfBd; arc=none smtp.client-ip=209.85.208.47 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="UbQTwfBd" Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-64b92abe63aso2315402a12.0 for ; Thu, 22 Jan 2026 07:43:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096624; x=1769701424; 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=hFHwW2bdepIoOkuLol6lBUlgXwxd7Z9UOUy1vWjRyW8=; b=UbQTwfBdZb9doROzA8I17uUkU+CXostUYYsbS9z50MVXeJYl8CsD43wk04GlqAyoSh 9MpxhLSxXaEiRkRLKh2zV2nuQOOBFYUhmBg02hhRcLJD4XW9gO0pRLeUC3S/dk1stWtA WG0oIOuR+yNPGRTKn0bEGKpzzlEfEeHHuqpnzH3Lpg0MRx+ySE542AFXSr22Th5wDzoo upTzLC2rpTaZamVS694rIFqJiW0OwqbOjaKjnh/IT4nQqvRwz0LEvcmiaXbGafphHmI0 d7D18Jxhlju6VgrD3PXx4agWXHoZjNPiO+L6vsVn0iVBuBxeHZbBNO2olNhE38qg0lt0 l9XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096624; x=1769701424; 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=hFHwW2bdepIoOkuLol6lBUlgXwxd7Z9UOUy1vWjRyW8=; b=F0Dt4tbEd8uZhrx43uWYp9ohZASGN2wrWQbd83hpI7nXE5WPMycjpu4za4xYCbXOyH qH6JMKPYHGQ3mxDAJaJc7wANi05Q674M6cJZK097Bn7DQXLhuwoLkIA4SlLyrmnIx14N yO6pOWzbKyJBp1DiSQYcJ8WbX5hRDHr19RwB4l6yVw8nCtlRlofbSHQoAhJVdKYNwDvL 9XOUhe4P0aY0vHlzF6CoXa7zoIs+xhetXumsihXqYD0K27lBzdhCn7vF391tIxgd9BVt shnheNSVafkgX4gr/SExLfrKRgrylMMhcz3vmZfK2WpO3f1yVbHqqTw+ERu94k35+2If 3mPQ== X-Forwarded-Encrypted: i=1; AJvYcCVNrMJ0L/DU9yggKvtc7vUqCdy71QxzDEUsLGcrNBRGX3bkgOGXssEcJTLLb5GhjifTP/H2Narkj5VKENw=@vger.kernel.org X-Gm-Message-State: AOJu0YwszzM9224f2lnDkNcBYTAogv0o0Y8E5Y4QKixeU3RNVA1gRVkP H5aofukPISththBKdZ1vlHEQjnnSwkoZl9oCDk9gFm7MnBUVKM4UCY3uz0VMmzYQklQ= X-Gm-Gg: AZuq6aKNde/bbTE9mxjBNb67kRSZU6SArscBIRciV1aF9P9NE9pM9OjZNU9cYOyn6pJ RXdSOmV0iE5kpWlZB9hj21d6X0XNk6eJbKqeJ75zJlPXHb4zbWltwqVXPWBWT3owssnjjlkjV0R o7407osMoTMkj75OY0iY2X/LLNqv+uqXBj0Ge0rhnvRZ954MNY4sBQkPvk5WlBoG/iO97LqnoCC 3RvdQl7+tyx7K/ClHJ91ccOrmf8h/v80rfuKKy1qvnWFBcMatuMpeuSqhWc5bJOCf+Jn0w6ahrX HP7gMNO/KoMKakeb497I466F8Tjo71UCub9he2SCXJpcKRssdRQ4LCqhcirwAhY6SJcsGpFO+rg SJCWgrtc/qLigPu7UBX5IWFHqqdZYemktm3FkSGerTwcIRPcu5bNpa18uHlmtqhwLwmxwq5r9rl uZbblYwEq/GaAf6UfHR0HuicxUP4CrdOPtvHo5A8H+XmNCs9laBL3YYYY6TFuhZenfqc991BxZw MkBYg== X-Received: by 2002:a05:6402:1d50:b0:64b:3225:b771 with SMTP id 4fb4d7f45d1cf-6584874e664mr45457a12.6.1769096624145; Thu, 22 Jan 2026 07:43:44 -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-654535c49f4sm16334363a12.31.2026.01.22.07.43.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:43 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:38 +0000 Subject: [PATCH v7 11/20] 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: <20260122-s2mpg1x-regulators-v7-11-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 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 CB82E44CF42 for ; Thu, 22 Jan 2026 15:43:47 +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=1769096643; cv=none; b=HIWr1KrW9ZVfHomP1pPPRqUxwsVXAy53R3gDdYP2dtrMMD+xzIgZFfl2eVIzbwzDHgjshhGt+ck/r5GSWhQ6Oc0d1UM7EA3kIVOt+BTIXUUjE215iO0CU3NeXciYwVJK1U4ohv126idcuvmtAuU6M4TRxCNh6nEIBtMT4MFdA64= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096643; c=relaxed/simple; bh=Uql4wLrPIchDLzM+Qxxz/zEpZfEFgb0aDGiWtLWAr5Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N650IWoPBrWt1CNuoxLMjxNeRfH42VboLYgmbJg9/TkkUY0mtYQuxlxyjRUgKWZYuIPzzZT+h7voBUjZ4Ojpbdal/ZpUAfMfYlwN5CJKJeWNYNyhvP+awxvGVcKxuvFNouD9NI2xh199P9cXlvmSxCgXUqM2j2lFKEFOh334unY= 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=W24v/O/6; 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="W24v/O/6" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-6581327d6baso1789048a12.3 for ; Thu, 22 Jan 2026 07:43:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096625; x=1769701425; 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=bweKrz1EAxpVR/K3C13UOoNEyjPdH8YKZynfcS9WhMU=; b=W24v/O/6peMIUrlUcf8CRKAPI1riHUG+qu6g6zRwcglS9UEOX5aOsSdP6Z5k974Xx3 D11Z6LiUKmo4Mn6Cpj9/YLCi2VjhrNe8LAo4U7xVcN5eW08++PdvzXGGMWKT9hozqSqE S3oA9udxnFa9749495UFEJTW+J37AE1/Fw2IhPYBt3U0EShBVL1zpw6a0QDy/0vwcioI ObgnSAhaHTSBHqTHyQAE43uYyGdokUGm3PsZkleQCXHzTF1HDVoQFlkOAFmxZh5RqYan K7o9g3aaHNS93+yfu8jSYPhnPSy4qQcY2yZk+7rzpc8iexrBtivcL3TQJyl+cKJ5fezy iISA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096625; x=1769701425; 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=bweKrz1EAxpVR/K3C13UOoNEyjPdH8YKZynfcS9WhMU=; b=ttf7pl53NT/LHq3sFHO/uJuppJem29fexUo7/YlnX2LmOzXEFEdQlLT0KTqly6+DgH mnCTwPDOKXr2iHQDFuA6C0iKgEOpaEIdVH/dvIzH93mlLyNnptzwJR4nq7Db2SSb9a8n 1lmg4DjIsSpXidFO02ispdVCjHKvnZ73nTQvL3SoE8HfVtDjOkfSaQUadph0UDfWWMsL nPSPf94bb3uqWNxkLBuUXHKpcJ4CN4Wh5HnsQSK9+qz7jrG4UdTeB4aL2qSR43ZgM0j5 mOVjStAklW2CNLVVj7trdmDog8as7In7Mbylqdo3VBGhilZwhBvBqn5HKpWGAAqS4OYO 8Krw== X-Forwarded-Encrypted: i=1; AJvYcCWHtNj5gpLDsrDfLGh+6fpBsSVPa5UTlD2wbiLlIDuDwZGY2graGh11T/q3Taso0tkhfi+UYwQcB59sLOY=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8JZu6HEymh0juaPkpGmR9o1BmT1YHqG7StnLFQJf+hxVKA+zJ gMSSoqerpQ7+12cw0Jm3iV3TQzdVyBcqn+R7SRT9XbTpk3//nu5x20+igpRrPngK4As= X-Gm-Gg: AZuq6aLpN9iN2YwsaXBw/2IYE1gRBOBp+uPSMd2wvWWFf4BwrW+Z2vbGE22LBSn58e5 7ETlNL9RGXYKX6wt5nww3QQ3CVAK8+GGn1qpJQwDHz9VOhtE6mstZBpE/Lxg99gKzJbmx6wZKei ockeH7hBgn6jH9Z8+vZ3X1y+rgzyLEryzpDmAq3NkBinM3u8fmoBgyE36TdORlFqBd8sl0d0Bmz BBuU/r8OARsOKeXg/eZW/KaQ3zObxs0f9sQOZ+21R49UGbOmZNxBLtNp7N0gxJs/rsF3fC+TQJA bnOYWCAlO3IfrzoctKJNtvTsS/Dg48xunT+GwgfK5LH7Oixgrc98E1zyS6QQ/KMt4CEIyinkD5K qtTfMrd1Y3y0cT5bRzXC9BXjFBX50MYHX1RXcUU8VauOqKeP2FotVnAdCiwprWSJF4mBDi1GnA/ T9gN5+36Oi43Tkm/ZBnrKO36yva1HsuW2w12GIikHmm78OYf21sOC50x7M3xrsXFde1qyngXPeF juvCRpM+7OqJkLy X-Received: by 2002:a05:6402:1468:b0:64d:ab6b:17cf with SMTP id 4fb4d7f45d1cf-658487d5f67mr15227a12.33.1769096624685; Thu, 22 Jan 2026 07:43:44 -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-654535c49f4sm16334363a12.31.2026.01.22.07.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:44 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:39 +0000 Subject: [PATCH v7 12/20] 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: <20260122-s2mpg1x-regulators-v7-12-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 2026 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (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 5680744D020 for ; Thu, 22 Jan 2026 15:43:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096648; cv=none; b=t7VlpnPrQrLjfrwYbwXPIcr5s6NOKdI9XLvuoFPTJ3FfqjAABP9aECtAlj5ZYqWuFhbUWTZbEP5o8Qf5S5IX7GLBH6uFBEf5PPMTUfzbwdxwTxRMB24IQXaWnk1+vGCyo1L8zq6mfx4bNcUMbDSHwFhplCPj9Fm2aVWQlJ5rpC4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096648; c=relaxed/simple; bh=nXl8zH7iFzy229o62R7F4gj8miBQeEJTl9anBMuQRqI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JZMe8N5LDw194tctbHW1/tEraJFVysL18huUgAReX/UIv8vuR1KAhcelP3XfIzPJBpiUxKgfJ3glhUV4U22Kh4Kf6reCzZl6xhpHzLvCFcxTEasWq2uCNPW76FH4heGdIAMCM2T820ntLs8pQ5jpYZtgbufSm88OXELwtghXai0= 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=tO2LSVuG; arc=none smtp.client-ip=209.85.218.47 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="tO2LSVuG" Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-b8715a4d9fdso139523666b.0 for ; Thu, 22 Jan 2026 07:43:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096625; x=1769701425; 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=tXknWTh3C9IVP1+uTVL0nex1jtU7FLYUPa9Q3sm6Lzo=; b=tO2LSVuGx5cP1FioAQVwAi0naXXshHkUE5pkByQqralZGQ/nhKQ9Pb3nEPMPB7qc3Y MOPAN8rDcaIh9bS7TxU9mm3YDfmZn6WzMP9xFQzutOBdf1xHmAicpbiSlUiaeZYrFmLd cdX/oFZW3Bl0oprKRuilltjCkuhd6H1qoAY9t3iRIYUC2X8nDO21OxNeWo843PyI3Ali sDg+fo4WYKlJInY7UUvHQN/QzmeiwWNO2KCiHJx4aBcBEGGZe6tJVG7xzOGLMX0YEif4 GCfGwGyfGsY836+mdkIGvAmtHQXG6lqQOPBbc5hkx9p6AfwBSe8dEOE2gILP+/2ZOVDY Ih8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096625; x=1769701425; 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=tXknWTh3C9IVP1+uTVL0nex1jtU7FLYUPa9Q3sm6Lzo=; b=OVthdfmK3zzwzJr8PCcTkr1i4AUBryZaz1q3Hl64iji/v3FxS7jWeYnfIDcpQsiDNQ 9/9mOmvWQEIsEB+2RosG1tW7RQKzFTRZnI7+l7Ds684wdXr0B2oG9ssmJp8dqoBIlY5C g7kK0PDrywOB5/DVjRXxn7HQB3sMjlv/ch/DQ+3mttLACOcFeioJ0/o6U+NLNxPC4HKA cMrPzxKZs21gvKS9z3V+0tQiQ76u6P0njkgOKvce0xvwgGDF8gvHukssP3dbgsZSZIVs lPklUEdnhvc/n0jcKRZemKQ0ASCLCz57CvvTgwmzBIE6E5bniEd6X/mNCFZZFULOix7C qUsA== X-Forwarded-Encrypted: i=1; AJvYcCU8Huzw8dLmBgUuhoLYyxDhhioSh3dK0k0xT2BmdJWWi0XZqNpxQOImBLJwWgzE8e0DMGJRkwfZlaQpC/w=@vger.kernel.org X-Gm-Message-State: AOJu0YwzC6YzoyJhPO28ZEKLp29rAXU69k+z4ocLSX6CaL9iJF2mr29V WkCTZWsA/nrAfkeSQ+rLlP40DlgLh3Ye5PNz5xxdQSPI/ypC7PNq98Wwh6Fuw2uCeOo= X-Gm-Gg: AZuq6aI2uIBMm9On3kK8bHnu7eMOmTFcLVLXzYnNc0fIFiMxYjeBILdC6FC5gtjGy+H uFYtpovExJCk2imkX9wDYR32dN2rCUHV42fpT8rxnwIIO4SDdp1jQXdbGF4pSUSXKsHGYk5Is6/ cX6iJdkPqafkvOX7XVlxjs3QNcQaUHfmKOrgDdfetoVSZWMkrFw//vUK8m48gYWhQd+4vze346o i6MCSIXlt+iaH94pNLNduryTKkcm+QaaQUtXZVy4YrnRNwoJCcUrckvoU9HHdaxaK/dfbMYP2fC Gaby60xL1nIYR0eJHDs96A6jBuzHR/chpRxcjsADS/Fs5oQthywSnQw11NzvK6ind3v12beA4lc Lh3b4zSq5c11jg1hUeWHopEDD+PUSWco6KgIYg+qUBRO/Zke2lFrontfJJlFc2k+fnzJxlNBG7J IvBfBd7h+Gb/lnGLQ0GD6sj09VTvemyMJ03XciAQP+cPTz/OCpxEL5YZnC8uaIf6x292BsBxyhi ceWzwuWZ+vvRCgO X-Received: by 2002:a17:907:724e:b0:b88:47b4:7626 with SMTP id a640c23a62f3a-b8847b48388mr122935766b.27.1769096625207; Thu, 22 Jan 2026 07:43:45 -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-654535c49f4sm16334363a12.31.2026.01.22.07.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:44 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:40 +0000 Subject: [PATCH v7 13/20] 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: <20260122-s2mpg1x-regulators-v7-13-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 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 5C3A744D032 for ; Thu, 22 Jan 2026 15:43:48 +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=1769096640; cv=none; b=V5Acs663FHUo2hQ7NTao9uZyrcDhUep4efs4T+7PUdRIoHE/Bs50GLEXuznkKOJuWlVJtRrUszXk7aQZvbkYC0jTCd4KJsYiOszPkRJzTAYfNkv7gDdnHyzpjD7YMFcmfxUkpCCkZsSInEbYTV3puCHONruIzrVwSx9KznMPUgg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096640; c=relaxed/simple; bh=O6E1oBzcHJ3atkV2DwEu5tERI3HsNipga0qQEq/zrTw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tbQbOpDBl2liPEhrb64if0TiZdfrHxmSk99oM/3H9Nd+FDZP4cwiVQzbK2b8wWuWWi71rpIyTJyhYnvHB70Ilkhm486/zTwgfSXv+tT5zRMhJokNFm99ltriTgQ8GRtfD74xsV0sW4OJ7rXr3HsTSQWEVCotnU7ObYJavK50aN0= 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=fKbnDvPK; 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="fKbnDvPK" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-658381b28e8so1173910a12.0 for ; Thu, 22 Jan 2026 07:43:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096626; x=1769701426; 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=r9R4sdV0X4f3rCdWBswRhoDoemnav4Yx5S8zKBTb/5Q=; b=fKbnDvPKDxcw6D1RRQsEDIYb8hoV9Of28jPSG3R4Vf8JudrqtlTeZSBFrKrkVGea8m olS2W7b6ZxljBcI8t2/dSDETyAm/0bumLa5xg5LLqIotSoX53FBIvnIa2biI6y+s0tQP HApiDJOUy0SxuMJKPbD9Gy0sJf5z3SBSnZx06+aEetjZFxjB6DnkmNKAj8agJFdA24gF 4sAZw+aMtA3O3kZOxoqXTpBPrsOOLLobJBn/PGQZkMHdD7cKG/TDyhwKf5QGnKQDE/eG d2C1oOAjwvSIpZAeNK44frhNwRokOpOX5O4i5eXrjRF6rztqjXdcnqc48ENmsugB2b/M WS4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096626; x=1769701426; 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=r9R4sdV0X4f3rCdWBswRhoDoemnav4Yx5S8zKBTb/5Q=; b=F4234DX8dY8dyAfB9TpgIvFAieWS+Rbnqk/tBlDOUjnQX5mSW5pQoTeLBkVpiFGh32 +fB1jSFAI39SroQcKtRpUigUdX/iIdeUfntulXsO4Q8jm+WEImwrZHxlHRqSYhC+Mnqq G9fbmzk4IGWT0cTv6Fk+4NmY3uRABDQLOwU9O/K0F24HZVVZG14+jZGSutxTFeg1uWEO qzjE5vCCnzOeGJfo9aIP30ogT1QT/g/lxJUDuHPc6KGoHoVULnMxc2I83VcMkltKidRX RVO4TjmxBcnU/SPwFsrvFquyi2mndy28iy1I6PgryS238mK6IUkX0ldq8vbzQKZ1DBk2 d4YA== X-Forwarded-Encrypted: i=1; AJvYcCUyXzJQCbljULQQxm/W2fFmBhzmN2NQhX8hTsq/N1fKK9dwatCSxdiegGTuxqGisxIJy7PUrk+AaT6Rtuo=@vger.kernel.org X-Gm-Message-State: AOJu0YzXEHejNKOt9vYURcOjEwXMcDYgJKptTZxtaknJ91j5alihkAA3 GOM3KEfU6Q/5QthBpOQKxIy552C7Do1VahKzGAEQithcATB4n1+gCI1M5uSZM9XRBeA= X-Gm-Gg: AZuq6aIZH7902t9w2/djI6mX81JYGcH242uMV4V5Z3JVP2V5O2esJT01kv9n67gfMx3 oDCX2UyI2NYb2mtAN7ct+b43iIhC6Ttr29UseUsv/bIFHJaGi4kxq4SjShWFW6O9AMVawVx065Y IaPQUHT61GNaibDgKsmGX/QBrYCsyZzNr/c0Q/6aidZDbLnVPwna54X/gxrdd4+iczOmHovcybC k/C5lXhcllPWG29S6CgFO0FOBBU1D0sZBMlLUz3UhB3qUnKCYTTCi9CMAdSKtb1RvGPFvVGwMR4 OXj4DuKq8tFLsJlxH5d/KJHUMWqBTEZzIR7z1JOrLQVk3nmiN4kEuZII9+TDt4BgI0hL1xM8N1V ZppJYdGUrKSo3u/axXZQ37Dxki0vDY4/rfYQCqbaKQeMJPX9m4f7Sckmv28jzO1/MBn0p3uBixb 8+jxF/icXN2q1schAGA1OHzWHDv2LdzEvpmYnoVGGkp9DF8MvO+d7Na1aLXnmQLxqVxTglstERA QIFiA== X-Received: by 2002:a05:6402:50c9:b0:64b:82da:abb7 with SMTP id 4fb4d7f45d1cf-658487a3ef0mr27447a12.18.1769096625751; Thu, 22 Jan 2026 07:43:45 -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-654535c49f4sm16334363a12.31.2026.01.22.07.43.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:45 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:41 +0000 Subject: [PATCH v7 14/20] 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: <20260122-s2mpg1x-regulators-v7-14-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 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 7F7744508E4 for ; Thu, 22 Jan 2026 15:43:50 +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=1769096642; cv=none; b=j7/FmyUQRK0TI54uVezkxOM2Pz8Y7Sijkxgd3zF2WTv8wv804Wii3SbbjeELAJXrrIWN/O+1B908a/P/r9pH2CXvVoEaF1ELd3/SVErgjlvg8gAAv6t52UVaelKvR3TdkTUT+Lq688FxM3x23+otGnERAtFSEKKeMwN75Vg2V48= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096642; c=relaxed/simple; bh=qZwi0VBdEjXKYAJmcVLy03jwB2048b4QRMXyR5EnHQs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TmA95udlgRRd/pb4+l8A3dFk3SrL3EBCkR4fdKEngJeew6E+TabzyEihma0R8P1PotZul1fYiivImw5Ov9xY7xMgNYP+BCuCMVzVYoyu73YPSe5gZRoa0zAplKjQzLWwt2nfv9Ks19woBqbc0EGcXiUCJLfNHxACZIsqYX0jz20= 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=MID5vbQF; 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="MID5vbQF" Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-64b791b5584so1742401a12.0 for ; Thu, 22 Jan 2026 07:43:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096626; x=1769701426; 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=IbATD9gH/jg77F2vOXb69VjDypI/0O8i8+As0LO3lMk=; b=MID5vbQFsDMz35KD2z4l5ykRaDPTNQqqeR7q+DPXdU7fdSr4zVkf9V3I0rzFz6uT2H 0tqdw1pF858TMcfWi5uDuxWH+fNMk/1MgXncI39eiqri8FDklAQO1uuPqxRQhfjmAYXu 3MikbyEbDnMfTUr0dZa74CQd9dT555rul2EiI7Yh7uXFim6lvQElrNnUJNWPbRX/Ky2G cbWy9+UudeAP7Oom8AmVPCGs0oIlKElSvtTgJlE3eWsUDeFWcs8SDOL5xgMzMFVi9qHZ KMrlPn7WkaGpzNvpIm/W4u4jUmJDf2hXcCfpi4XEvExQySpnOgjWEVHW5MTQkvm/n/tl DmrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096626; x=1769701426; 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=IbATD9gH/jg77F2vOXb69VjDypI/0O8i8+As0LO3lMk=; b=L4qZ+EzHP9jucugY21g4z9D/GA3ujUkupNiRb2E5A+xAYeZoyulBRXDWm2M28SpoA5 27o7i/B1ZYuMgTK6UiKL2iX3NiCVGPEaL/8EfIecwehaiyoH453snT/8N/8GaDmlBrKW stH/jqmX24uOFURzECFK/9HEjJqrmoerNaxk0pSz8/qGmaawEVV1JXK3kz863CxDXNgE oYgZY/s9eN5bnPQ3DIU4FzlhZhZiSMTLV768Rra5ptigIHOslGTyfzjL0U4OMCvS9E3Q UWOGnNPxyxC4UEF4lMWF0JxKb0HVLoaNwHEJkVb8HpRw4uA4y9jzSIIiMDfawv/3Ef0J wsxA== X-Forwarded-Encrypted: i=1; AJvYcCWoRg4goh3OJbS/daObdRElqW4h7tNc3/UG93UvOdQ4rymqBQDNa5OfqlSweMMG9XQZVUB2bPhjdyQbVzc=@vger.kernel.org X-Gm-Message-State: AOJu0YzyVhMruMvX+eOaURmIeixM1qkDXOT5DuH8LdQJ+i0WxK9WnhHQ sU8hwc2Cty91N4vuB6AG1J5KYU7kerd1mAw/R/MaBzy9G2arbjk7FKx70mJG4fLy8bw= X-Gm-Gg: AZuq6aJ2qIBR0crfuAFaEfS2fSK5KArNWJTKlhyB/yY8RUw0nu6qr0yIkZ9jAeaLIav 4m+IIXjLsO837lT5/KYmaZRGj7L7TQKoRCz+X3qp+0RtQGgaNzlLDXnSRHERS7Jqiq+4KSzLffX ojOZgmgwhmVUZ1Gqp5gQKKeIvT9CzWNNNi+zgvnIeGOZF/WuGAuHjke1mZUN4IZqdrqG0/tynfI 5FKdoNNu5WssqLf4xc1jIJLVM9j4lxIP4u/nbkwvZSOgaJ6bzRgMeoqElL/1fNslrZM91OlrxZb N7COhtWMrUbYwUyKTF5Yyzk3A1XYqqN3oNE6UzgjVSZU8XbC+ALmWzdE2YnnKEH03SrakhRAl3q X67Oz1M1l5UQxOa8FDwXlY2cKEZ0k5FIQlfXHQolsGzTIYn1Anw8/hQlbuZ1lWU/frY9fXDOOqF m1gbnL7T0yFT+jugD9tSvAI/Xz/Fj3wmisOav5XGRqHnFPVQabQDtF4J6b/mnd2Cm8lCkB+mZlJ Xbe6g== X-Received: by 2002:a05:6402:2552:b0:64f:cfa0:9008 with SMTP id 4fb4d7f45d1cf-6584874e1bbmr49315a12.4.1769096626312; Thu, 22 Jan 2026 07:43:46 -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-654535c49f4sm16334363a12.31.2026.01.22.07.43.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:46 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:42 +0000 Subject: [PATCH v7 15/20] 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: <20260122-s2mpg1x-regulators-v7-15-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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. This also includes the following to avoid further updates in follow-up commits: * On S2MPG10 and S2MPG11, external rail control can be via GPIO or via non-GPIO signals, hence passing a GPIO is allowed to be optional. This avoids inappropriate verbose driver messages. * Prepare to allow use of standard DT property name 'enable-gpios' for newer platforms instead of vendor-specific 'samsung,ext-control'. Signed-off-by: Andr=C3=A9 Draszik --- v2: - add 'optional' flag to this commit (Bartosz) - add 'con_id' to this commit --- drivers/regulator/s2mps11.c | 100 +++++++++++++++++++++++++++++-----------= ---- 1 file changed, 67 insertions(+), 33 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 88e21c90832a45547e5791b15cd1de274f81fed6..7f4db6673b43ebd533c2afb568a= e3481351a9c60 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -328,29 +328,15 @@ 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 char *con_id, bool optional, + 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, + ena_gpiod =3D fwnode_gpiod_get_index(of_fwnode_handle(np), con_id, 0, GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE, "s2mps11-regulator"); @@ -361,14 +347,19 @@ static int s2mps11_of_parse_cb(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 @@ -380,6 +371,29 @@ 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, "samsung,ext-control", false, 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 +917,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 +1264,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 +1354,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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 2026 Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) (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 7900C44E051 for ; Thu, 22 Jan 2026 15:43:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096637; cv=none; b=Zc9XyOTuL0fVv2oZZEK1yV3nHsrGudufq1AtaVQUKN4hWqbc6RT56URkf9JrJnnS9+DJPOWTWb+vPE1qFuoX0wGXRZDIQpPz+5Hqt3Zs/Bfp+sbw7zRJ4JGEGatUPThxs7ZyiHNLaRty/S4gWg8PinnFD+cD/qbW3RbByuWGaEc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096637; c=relaxed/simple; bh=Xvp2z65CjyjgDGVtm3Rrac1JE1o/TbXF7GbbHL5fSVk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hCplzC2DtMMCFk4L2oETXpXF3l9p5CBzyaaFOdxO/KqM5AlvwFVtTDfM3774F+D8oW52P++VLMjWKo7rNG94YH5xdEZxr9w7bHV8EWkNsiZbub8pYrh8AZ2cTM+brvyMTL9hPNUv8nds3DebarMDVk6DVV3DHQUzz8J0NSqOCpQ= 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=jyOZLYt6; arc=none smtp.client-ip=209.85.208.65 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="jyOZLYt6" Received: by mail-ed1-f65.google.com with SMTP id 4fb4d7f45d1cf-64bea6c5819so1625790a12.3 for ; Thu, 22 Jan 2026 07:43:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096627; x=1769701427; 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=8dvkTVoHHglLB1pK4Kp1fDP5scGP6VBQvi9j8Hi44+4=; b=jyOZLYt6kv1RYJybVjc6oxBkgEVA8zCV41F5X8plBCqakesF1LoZO8z9sgCFzC/I3P aKGBzFXpyGniEcKBE+uRoukN4fpjbwpCDUe5l16cFdYRkiKusa43EI2njyuAMvs9Qx6R AiWsom2A6+HzESbQevx7Et3FEZIPsNesFcAf4zJQx/5AG18i5pfapYG/yM2NnZuXYNBP 0G+5gWUXwhIiic4SlB79ShsiguvU7R90UkXuzQphwb48r50irgwBIRkClV8iqtSu/HUx 7+1OhHMtEjbc7RcRvN0UjtHyO6h7j9HBdKY11X6FGKpIcjknaQkjV2+aGlrDMcIbERXS eBaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096627; x=1769701427; 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=8dvkTVoHHglLB1pK4Kp1fDP5scGP6VBQvi9j8Hi44+4=; b=EQGGA6fmGk2Vh3OiNYlUCJ50WuidNU3pYbBnfcVhKSGJmcdfFKoa6LoreIr39oK+dh 0gMxe5f4vDw7M/dg54QV8LpSx4xP5b/FjV7/S29L9j9dL2d5ujoEjtKHOeLH/PSt/Dyz MaY+HUkRrYFdXte5hBB5Ae47qCq2bvPCytuGSg2o59LqItzamtEoAEuikgVH+VlCwY8o +ZyK4vM5+iRM/vtQ9M6/3LmB/I/p+OD6dfguJPRw3R7F1ovW7I5fA65vZ+u25zdQFlI2 muFLFrp8CsxINEfPQjQITyRlSb52m919CIAwwAGVIPtH2R1bK2nmyjvCxh6s23UNNTnt gz3A== X-Forwarded-Encrypted: i=1; AJvYcCUSPI5CIa7BCgE+L1HjgTGdcDaCBN9XxCr/aKd6XBqH+q3Rjgpt/gMlc7QbP7I1AcfF4IidvZYMUWaJvGc=@vger.kernel.org X-Gm-Message-State: AOJu0YzVB9RgE4/BymhRf8BzwVyxHSC8V7X8SvLCqsTwsx/BmWl4iRGq DJR6h32ZIONuZuzCsLp8OY47NSoamkA2pl+kygGvveVLGHr9zBMh2ISNIlkq4e8HlyI= X-Gm-Gg: AZuq6aJSrdXWuAIn/aK1n08ezvFKIxwBd18u/St7aC+3Rh11ya1UfmK39Sb/yGSuNdE Vd8/XryUdnqDi8yJ53TWNjJdE1Eugp68d2NVCRwZyQosXSAXXD9tZ7yRq1ZXTCz2QpzHd8aXATT kyjXMmGBhurIdoYfaoCHom+SDCWjEROPd+6sPB0EzQuPVDjeubFEHNMmHtCT1gzy9DRSKWDrJsO RNbgw6vd1SpRPGDweaL6QARJFAMapTUl8tRYfSZ5FMMyAPbAjae1s5mCfTdQyI40l998V70m9BI iMyqb1bP2eJwxCNBmtaKvwhLfQ71keKUK/V74ORjGc9YVceagDUOPs/PnxS4Q4BgREa6nkOpGO1 H7g0Z4JUtF9qCABwKwnpIRRkDvZhfkiK6UCnMOZHIJzoFz9DKo65Z2zmedg6Zcyt5L9gf5pjipG YJ9YAgf3ZTsDaB7hlpdK0TS8xozLx8hajAWgPwioTM7Nb5CkdUyRWHTLm1Y5r9DfQroAOXFHN35 xz+Ow== X-Received: by 2002:a05:6402:f20:b0:658:2f40:1f7d with SMTP id 4fb4d7f45d1cf-6584868fed9mr49431a12.0.1769096626870; Thu, 22 Jan 2026 07:43:46 -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-654535c49f4sm16334363a12.31.2026.01.22.07.43.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:46 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:43 +0000 Subject: [PATCH v7 16/20] 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: <20260122-s2mpg1x-regulators-v7-16-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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 | 587 ++++++++++++++++++++++++++++++++= +++- include/linux/mfd/samsung/s2mpg10.h | 24 ++ 2 files changed, 608 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 7f4db6673b43ebd533c2afb568ae3481351a9c60..0b6b28ce6465bdbc98ed72f627d= c5565479ec7c0 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; @@ -394,6 +416,530 @@ static int s2mps11_of_parse_cb(struct device_node *np, config); } =20 +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", true, 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); +} + +/* + * 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, @@ -1277,6 +1823,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; } @@ -1292,6 +1850,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); @@ -1300,6 +1859,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; @@ -1336,6 +1900,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); @@ -1344,15 +1919,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) @@ -1363,6 +1943,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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 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 CD2DB3EF0B7 for ; Thu, 22 Jan 2026 15:43:51 +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=1769096654; cv=none; b=faHSryzcSs/4BdfS9qvGaKj97umBv3zeXtWNwLN9sHQNI1GdaTsuioPPs+wObbXe+FtmPYzvr6n1kBjeOBCwMJVAAdFcOtZThjcx9iyNOv7DPk8oSqPtndzkMVsSdioIKziS+y61Y2NWyK8j3PZEQmx+phsGqUXfPXOHPS9BRuA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096654; c=relaxed/simple; bh=CV/1AntRv4i6Nx8kbTbv/dJgDCUxidMgMOHRqzlspiM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VBcpJ4OrnROPkld1sWUXrbQAMtPPBqMV9UMf13XQxXi8LKGtc0MnPHbFTGasEW6YvgiLIXhmz4DOy6I1nuUqdYTTVCDBFXbjhG64Vyfd9b7ZXNdHZT8w4G+xuwtBuJsRGDH+eVaY5oVKbRo7tq3ab8zm8MaCO2O7WqqMSMHmSR4= 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=yreLf6gx; 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="yreLf6gx" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-6505d3b84bcso1477847a12.3 for ; Thu, 22 Jan 2026 07:43:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096627; x=1769701427; 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=q0vnLX9gJoSUgj6PsEAnovUE20jhGMuNkb9xOcVBvuw=; b=yreLf6gxFTMDiCSuL/QPpteElIX5CalBHW6acpzCNfoYvNCO44mtHTgJR8Kloc3nqJ 48CBvMOl6pMC3pDasDUaBZt/9wiUmdJUTmUWQ+OwGyWa/uWYST7raiDIlQtjzbf7gDg6 SQq0I9id8ATFVnwepuAyPOtBa0dmLCmWvexMABxOSrhrX3GLNtDoUfnwa4jkEJWYluZy ZGt1E+Iej5mAY/8c1k+jXPpdWPK4eE7sIC00YzsqrBVl5yntXtl/E0nzwuPbJA0rk8UM W2CXJPvhvwXhFkoLcBp93vhWmLhtNW/BX+c5knis5MABOM/1yUocE4Vdvd26YlF0ex3+ oC9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096627; x=1769701427; 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=q0vnLX9gJoSUgj6PsEAnovUE20jhGMuNkb9xOcVBvuw=; b=j2oNqyIK8QNBYnTo4d6I2k9YmnPYOxxBb2P7vsoUSjGFAkhMLrREatu9+rk8LB4vJV HBNbGd/9WoKW3nBNDZN5RQCd4kIR+oLsfpE7hcH3msvrk3Y8oDJm6KSHTY2daLt4tuR6 EGNLTfbYEYwEUP7NmXLwZ6FswpAQrCUe7hxtdaMxAV1wSABS4Q9EjBEYs9X5Yc2GG2S5 AbaNmNQ7UswCDMdJi/QIgAHD0xkHhKh4n5CGAVC8P7D5JH5PSpXuw4jn7njKegChMALa fCMWH6yFmfbZeqXNunDagvBopt7rsZdasM5gD+vX2uqbXBP9DFWO8fnynVqWQpqEDzHl kKrg== X-Forwarded-Encrypted: i=1; AJvYcCXcXdWfGFGkEh+ZV/EikCGYiYd7S2UmvLdbVYws4l3Ce/lvUmghteFXc6mdYhl45zNadsVdF9OTYfn2ILk=@vger.kernel.org X-Gm-Message-State: AOJu0YyKzL1J8Pi8lK3AbVJ1lQdvVEV/T43h2+kqi7vOz8Pzn4AL6cyF o3VPBbGvZLimMCp9rqK0gF2w/n2O9/oRUXfvvwE+HrecRosRtxzeNhyHRe1M2CjFQ4A= X-Gm-Gg: AZuq6aLG6pfWX2fzQw5Vvs7yrnoW6Ygd8FjkhxoaxN9Oe2XouOfkttXLYtFNr9kL4fz LC1vpp6xZwLy3g+/N5Kl8TFTAyZwZqrQ+IPkJDlaVyt/SEYHKyO5FVNdjKg919G6VyfR9kO6NDB m5IuRJLxwqmBNZ/wr1QTjEsLjSsZfnlqLo/0peEi8g6og/c17auX3dkfJY1o9B6h/IzIqgpx+HD AlPlxExLP9b5AG0G+pCLizWb3zbRHvJbdZt9XLP6eP0KkKXaWkikwGmIlBHTGDLw1mpmglwfoCQ nd4mctR3pob9H4v4fMYz6URungF3xK9/jnNVb2xf9OPp0qafEfl3sbBvPRk2i1YyxE2qPQIJufn hlfAyWyvQ0SBKrYB/N4BtiwFn0IgS4yeyOjZZqMv04DQOUEADVjMFTnOIVds9lGcoOi8Yj2Vky5 xhLexDuh88N1xPhDN65jrBPtStmb2T684rGapWWRVC8zOT5b6x5uQIlkey1IYuMUOqVwXVKGyD3 Xdlcg== X-Received: by 2002:a05:6402:2115:b0:649:a63f:bea9 with SMTP id 4fb4d7f45d1cf-6584879fd4fmr26109a12.16.1769096627408; Thu, 22 Jan 2026 07:43:47 -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-654535c49f4sm16334363a12.31.2026.01.22.07.43.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:47 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:44 +0000 Subject: [PATCH v7 17/20] 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: <20260122-s2mpg1x-regulators-v7-17-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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 0b6b28ce6465bdbc98ed72f627dc5565479ec7c0..5e35840605472e20019ef936d28= 3be2c38146854 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -566,26 +566,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; @@ -595,6 +592,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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 2026 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 AAF334508F5 for ; Thu, 22 Jan 2026 15:43:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096637; cv=none; b=WEOvZpBKCa8SP5cL7jLrVKDCHhlSLFHIQ4TmxrcB0I9ZTfBK57d8F2G+GOHNyPLngwys6pYUm5bZv8AVKkPY1o9njKD6FN3tH7ZBe6h/J1rs1lgrfQYPTCAE4WAP/a2UFT/Py8ak88yvYr7L1LEvfTeYwd8CHUxU8B6giEzP+x8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096637; c=relaxed/simple; bh=lqjbDdNWSJrnaJi8miRBh8DUbskE90bI5Ur0NXbCs8Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g+UnwNLSU+xCdAODntmiPoETTfqnn+sWtCWijAlJ/XRbyFcz1ocF7SjGqoMZsmTinzq51vKC+0ZqYuvIrV/JEo2xfc2PRA54YATAVxvDN5e7xi8hQFM9Q1yleOei4v9SjHMv+ceF5Iz0rcG1X3KPjhYH8Q6hM86Ri5sgiLhTfMQ= 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=PZ5QyDOa; arc=none smtp.client-ip=209.85.208.43 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="PZ5QyDOa" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-6505cac9879so1716564a12.1 for ; Thu, 22 Jan 2026 07:43:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096628; x=1769701428; 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=TZKycJAcIJqnrGSflaAeR7shFcRh4bNAutczw98J1/M=; b=PZ5QyDOa8agN8sQQTOkJgqZ/+AKxL5DCadwU2gMNDNnQSW6vEo35ZgJPp+CMe+pQ4Y WUmTwC8lJ91vjjY5t8Z9HLnon64tkfLwC0oZRAEWP4jk15BooeQDLMTxNqxuTJeDatBG e7u2lr8tGyhGARZMuCoYzEA/GD4HhONgqBzzv5w5fBNT3Lx24CRGXtIlyhojmmMxTqTm A/a1/2r5GIBTI+YoGtIlRJppV8KFROBSqORGDD/e5rfSOAYEBtGwjQvhwsAE7i5Kj9Oy CcRe6fXMMTwyPtSbXNwSl0wgRppN8sgOEcQosFvqR4UBG7cfgmarGNZnhINOtk52LKZp odGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096628; x=1769701428; 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=TZKycJAcIJqnrGSflaAeR7shFcRh4bNAutczw98J1/M=; b=V6pnuDtcJzxEL9VxtiBVlcUDO2uUgPhpc3bqY9EYf7P3BxR1w7zrS92GhdQpXN1ln6 vb5rKbzc0qwj4vAxVDMAwdPmCswcIlye2+ft3E5ozmsxCKpAvObAGJUXmO5d2v+NON03 QicGXPPhEIzUFmtryyjAP6Mo5+DByXhPF8MrfIzrTDbjNbjnSc0qdvCKQUgklNRxi16x CJEU65xR7QzI4Hc9grOcH7M9XEHuqybsxeFRAsfdG1u32jbPZKlYDq++kEwuTE4baaZW y/mFX6TX14K7t5MMEpZGrIEG3B4VmyozmPZXqc7GMDCKjaN7ltHd3EefHO5vHN+34941 3W+A== X-Forwarded-Encrypted: i=1; AJvYcCVimomcfdN2Ub+uvngbGghlkdlgnKAcOO7HtIKzVQOLtyTb2MzcY/ZZ/HP7IEgh2rjuXtO5+1ZbMxjO6Kk=@vger.kernel.org X-Gm-Message-State: AOJu0YxwI89CYE+o7xl/p4joGJzSq9mQlGbGVCVzt7FbIm7L3FuMBBut yR8SK/twM5L7VP13ig47RdSGnZquseCNGj4JMRm/DkU4k7LMwt3hnUpAE8F5M2eqnpg= X-Gm-Gg: AZuq6aJKyi+GOtW80qZzRIPDgZcTHVpmliWGiTOWcq7LxtOEq6sLcVfVUum95UxYAcQ ajBShcIVLC+EpgB1qgxobAohFFe7gOpBora9VdAE2+Yzg3flAy0WHbJ1I004/803dqja7/z6Xd9 Z3S6E6MkOO08Xy+G6Tv4RYPOJKcpUREeup1EMiwAwqSKt4Xd8f9vY/NNmwI5YesholStua21TyJ /Rp6YTJknMMBX9pElVJwFgc7zmDqmmqDCcigxrs8G4z23hEmO8x9EeYHTGfcin500LIelBpECYN S1eLFEQQAyu9Fplq4r8YVnUGPso1PHcN+Fz5vM9RBFVj6nEBKMTE9gVaUnMokjazoVJDxewORbl 4/tkN++4UGZkl6P4nBq5qiJgK2YQ2mYz2D/ublHIPHVvMqZGVj7fz1VsrefywjAVkz9z9/2NnO7 /NPz8CvW1Ei1ojOCeDKWSCHlOukIcQQCyk/Ykl2qcDntSeVuiCdLJ/OxqxVmpAWuuVrsUam1M5U U07OQ== X-Received: by 2002:a05:6402:4306:b0:64b:a1e6:800e with SMTP id 4fb4d7f45d1cf-658487625fbmr37115a12.8.1769096627899; Thu, 22 Jan 2026 07:43:47 -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-654535c49f4sm16334363a12.31.2026.01.22.07.43.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:47 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:45 +0000 Subject: [PATCH v7 18/20] 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: <20260122-s2mpg1x-regulators-v7-18-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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 5e35840605472e20019ef936d283be2c38146854..c75ee0bd34377b9888b74e8b561= 727c51b630127 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -655,31 +655,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 @@ -743,24 +756,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, \ @@ -775,10 +788,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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 2026 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.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 5DDB344E02E for ; Thu, 22 Jan 2026 15:43:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096643; cv=none; b=JX7WFtnfrX9QhfqL8BcV842Ld7F83Bdxvk+c/gxMUPIboGWCPtD0qGiY4TLo119SAN0w+wc553WJsXhTEUGHRBmIL4GUMqwLwgWLTax4pRJdftILCjwUiGUR3sDaeVmiEU5UbgA2bavTOqkD/2Jg7bPx575eVwbx0E0xvqNoW38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096643; c=relaxed/simple; bh=bPq5CAXG3k+LGhtOMfCTP8Cxa/8SkZ6mqWdqddkTLIA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jcmPwLMvBaPOfs3IENuyjE204PfZpU/4LFK/zGBlknS8FXvx4j+MlfkBpQyxsuZ8/g6RLsH9ms9GJviNbxwogoF3e3wuAyEWEG73RRvmDcL/p5foUkz7FxdqryebM4Ex80aQWh8IzzIZWPYn82ksE68Xfw2LcSLg6KbWcVTui6g= 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=Az/SXKpw; arc=none smtp.client-ip=209.85.218.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="Az/SXKpw" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-b8842e5a2a1so104597166b.2 for ; Thu, 22 Jan 2026 07:43:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096629; x=1769701429; 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=UQrX9SBsqYabMr0G5mRPqyj81nd2aFVUohMGYXB1PHk=; b=Az/SXKpwiX0HpZjljhv9aj+RpGLaFOsOT6LceNP3ZgxjDtfSPPejQQ0fFfNkzWNTU0 hBxqHSBN9OTmL+hpeFaGf5t7um52LmikdScEJAMzIa7suObfiLnyatX/Ndq5H7XxSBnx uaLDKs9Ro4QLPIdh9M/ZadmHsVZ0leRn2LY6+dm8cJPfKXUt1wCWc7YwUe6O7rYjRFWi 8OjrU5ajSRPWk6ry8+4uvwoj3BA/+OLrqjaB0vQyD5abjrQhblqvnt12zk6lHKbaArMa UtRNtOoxtirwOCQSF44CJh5mZSeUHG2Gy+mwnE7l4R1WK5H/buzA/NL7qRq7CVx54AJC 5MmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096629; x=1769701429; 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=UQrX9SBsqYabMr0G5mRPqyj81nd2aFVUohMGYXB1PHk=; b=rTcJHLY+Do0Aaq27vttz3b1bk0SFl6XqGi4INeKNoDuQN+Lxd103Kmd537qiA5uG/w cpdik3an6OaRm1dwGEAlCk0B1Z7c87ePG2y1h/9dHtC6Uc5zB7m/lymKQPFTGDWy1fsh hCE3DYl4C18+Ny63UonGy5MU5PeTVwtpeZVqRp5zO6doDSVxwXEosJ5+qbHWWLWY3R+Y Ccwmgh74LAz9PIhIl07fczsTzSS6URZ9H8VOS8gcoeuFFp9OQ2n7jbPmkgKWj/otATq2 czb5kxJl80huHBLYQku2LQnGxJEcDrJVM4Z6RYhc6uhkupVgQig87tTLydLWqdgk8b67 I53w== X-Forwarded-Encrypted: i=1; AJvYcCV1wLrY6sSbRpVxbeLiLGDIWSKbIIB4Hcs09lBhyAjq+rwSTKoIC8jip6p5t0M/gFPSP+wjOc8xmzNqJ0E=@vger.kernel.org X-Gm-Message-State: AOJu0YywE+5i0vIejAOT0GS5gNgOaNuofigHPqboS9V3cHjKAjJ+UA1J M9ZVjWj35mdpHhUbcw3NVknlU3+WB9ROOMsxR/EI35yorRPqAWYcdA66IVkGwRAxuoc= X-Gm-Gg: AZuq6aINsOl3Hf6z4o+aEJmJjkG5+/25UPiC5GFmQeg37JKsiwACat0yetSIpHuYiRJ s7fl95CJQ7nwMllE34fZ1gwLy4v3W3Jjz140f1WRAQShofr3Be2dMrRbe9Ul1lIalF8Mz/RTk3w 3f/xAZ2sEFuy93Z9UAhD5xOiYBIwzApMiA17BU5SdQLzuqY/0c+Lvgb3ccdkOKiaLcKQrxGz9jj 0h57Ti1BeFbLp40nSAAT3AU9ITtDurQnyoBmS4NWfvQ3WvJFRtWebTuuTJ4nA0gT38ENCo9p2wV 9CpDfF5yTTQRBOAKqcCri+/5DHxZ5s9FJbPehgd2GAPIjGS5Gps5YOd6zX9RkBZzJ6BTjYubAzn R9JQQdOCHr2e6ayDyW0vRf94VdAHXyGDy19VA4U6LvlvWd+u1nDUUC6OcMg77Q75+6QS3xExQNf I2s9EBpz1CwPwVRr6gE85tCiOnO07RK+oa5QuBka6WjeojOxNbN6C7kuVJLcX8GIN4Vqj5W9y4I eVDDvTI5GB33IaK X-Received: by 2002:a17:907:6d08:b0:b87:1a92:b621 with SMTP id a640c23a62f3a-b879324e841mr1755715266b.64.1769096628459; Thu, 22 Jan 2026 07:43:48 -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-654535c49f4sm16334363a12.31.2026.01.22.07.43.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:48 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:46 +0000 Subject: [PATCH v7 19/20] 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: <20260122-s2mpg1x-regulators-v7-19-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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 c75ee0bd34377b9888b74e8b561727c51b630127..4a9d70947f17cb7520e0e820d3d= 1b9eb370ff600 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -437,9 +438,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)) @@ -470,6 +482,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; } @@ -507,6 +544,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 @@ -607,6 +645,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 @@ -967,6 +1020,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, @@ -1851,6 +2144,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, @@ -1891,6 +2185,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; @@ -1971,6 +2270,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.457.g6b5491de43-goog From nobody Mon Feb 9 05:00:05 2026 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.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 A1BEC45BD77 for ; Thu, 22 Jan 2026 15:43:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096648; cv=none; b=dtnJzXEV0kBh9ahi0NaGAG5ZrrMGST90enE6b3WIbOOtL95niw6g2AvXvw+e85OnWFFluucbiTZFUmBR2Ru5489QygCqN8yJ6vI2EqRVt7QSWf9ccKO7u78n5+tvXLG/VJtOUDOObA8LOA+Ip+VWENuU3qzF/pWWsGvZPXQ9KX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096648; c=relaxed/simple; bh=fvS/dFCro9ZHFc5w+Z6ZcYVzHaBeI4A1V0hAZLvZGMw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i8qeLhApMDQ/ayPp8i6Emm0sR//CufDoCBhET1CLgk47uc715rxaweWhQW+HEqvsQbVOQs97p5N8u/SPXIsadTY5ipxCG67e6Kn90Tsj7LiqGxFx//3N8Tm/BK9F73hc9iqZgVtmFFx1+aQl+m/3rV72d8BMADSloy4BDKNjZ/4= 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=q6eXGSeC; arc=none smtp.client-ip=209.85.218.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="q6eXGSeC" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-b8845cb580bso108756866b.3 for ; Thu, 22 Jan 2026 07:43:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096629; x=1769701429; 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=YHOuCyW6EXubWNPSSTKgH38OWUudqlrjbcjJqHW6R9g=; b=q6eXGSeC6xQtTszI24s4UCfblfJr1UGkDEM5OfhYx2iKEskE6fHH5JaSKdz1Q+je47 1UuyErgGIpPxrpvXA1SaklTDNGGtlpUBR2+kVyOxA7KHEcZznyELDQ7apQP04cSqM14n IJORFrwl+bqg0OPkX8IpCDBPCYK17DmZjxCyPIrORiL5IsMv/chmydL9xWmxCLQ4Tetm //DIVXiJNVz6BoxiHM4yYUovkTUddK1jB9EhfwJNtAfAjYC+4060egsScebCh6y3qmwO F6YiNOIoYCVngPxLz/zCqPbNSokUC7DCa2nKJ4Ke3eYM7mFePbrMK1L1cTpPZz9KP3Yu YYBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096629; x=1769701429; 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=YHOuCyW6EXubWNPSSTKgH38OWUudqlrjbcjJqHW6R9g=; b=IzbWewa1MEbqdS5GpNqu9l7g3SmB91PlIEipRxDcGR57X/AY/yVkJUfzESJGGyplTc 3eZGcAZZ//ODhMKuKP+SBcejWWGWgxlLH/TxOShIQqggvQboygoaRkHH/mLyz2lLPsmR 7WoWYyhg3pJpoTTdrx5u6F+50PVIhMQon1PF+mDD9Rh0EYmQ1qZVP2b9kwE85mFJW1FM 817uc2nUfzuavQF8TQv7S98iZKZ++2sFZNEqveh3l5LnrxRsDboVjFvh9+zXNLGvBnxn 6pfjOY8tQ/RLzrpEv4okRQH6ifb2nbfDnnMWUcAteTLgEX8qxfojDWe81iEb3N1rLj7o nFHw== X-Forwarded-Encrypted: i=1; AJvYcCVOF5nsgi2swk7xf1xV3eaf27wTpvCXlBQD+GfagwTAufQC3Xo/3U3DKBHBthnlP2hyKQHzFJaRs9xQOh8=@vger.kernel.org X-Gm-Message-State: AOJu0Yx2z/ANc99fH2f3ovD0yKd/1vEX33EfdTDyfxeHeOfX1PrKuNGb xf5ao3zOjfXlNV2FNQYlpcnsSdH0Mf90G7LsV0kTvUUATkfJ3g26xeDUTO3Ma7fi6mQ= X-Gm-Gg: AZuq6aIVcTs05BW5pX9+6U30TwnVXnZNlGaMQ1ciC7kxhTTLDfEVsG5/zEaXut7AmJq z1O3o9apsO3bMm642kjIKxOEjISEMvnM7fSZQTuJHndsKEbpgCvxFmLI96aLAsSw2h1VUDyqUR5 jrkB0p0uQHX8U013BuNfJ/YKj3LKJywKqR4Z14WUBXKvlwG4bXz8CcMjAaWOqtd3smRfT6UzdJ5 sJ3mNO0D7idtxb2bOK1BkF6CW3Cw844oq11u840EHz9LGUI925sPzrVRviHC688l9Wew6CCb/Ji gWJBfWe9XmmnZGVZXYdFly62svslR8XJqTNU0YFCLf/4W7M7gjj/oUoUVS16e4aNoX+pgDXf4gZ pMhzpE/mACxoQEoKQn5Q9V6ZmlMrwis7xg3JOeFpLWsp6jDigAA58BqwkE6mF/90i8dZj2vZvyo pqCi0CZ7Chs7ukHJABql8rQFhD/VTD5VoYu+QqIp3fHv32jCCJgbUBImgTHqf2dGb2BWiVbZNtJ fKDyQ== X-Received: by 2002:a17:907:7ba8:b0:b87:6ce:1267 with SMTP id a640c23a62f3a-b8796bf624amr1670208066b.64.1769096628967; Thu, 22 Jan 2026 07:43:48 -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-654535c49f4sm16334363a12.31.2026.01.22.07.43.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:48 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:47 +0000 Subject: [PATCH v7 20/20] 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: <20260122-s2mpg1x-regulators-v7-20-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@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?= , Bartosz Golaszewski 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. Reviewed-by: Bartosz Golaszewski Signed-off-by: Andr=C3=A9 Draszik --- 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 4a9d70947f17cb7520e0e820d3d1b9eb370ff600..2d5510acd0780ab6f9296c48ddc= de5efe15ff488 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.457.g6b5491de43-goog