From nobody Sun Feb 8 21:32:37 2026 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.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 B9444329C7F for ; Mon, 5 Jan 2026 09:01:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603704; cv=none; b=mH03Cooa3UhMNuMIvx5rGlGV2RCeFSH95SqNzYDk42wu7Sri/k4lBfC2Ef1xWzLjuwaD/6qD89W8jzLJvH05IWJnh2Zo7LwvHVklFWGB6255+aHMa9Ka2OQc92qFDmvDIZkdoNCDl/XRw7LOAJSP/73QCSMbR2wEOVyXYqZ9p9E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603704; c=relaxed/simple; bh=/tB8dmlRTUO4vkh5GgVdehbK8ogjmNaFBOWomDp+6hA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EJUSTq6P7Do9qv4aFVWQcrE6U+oSAWkDkjOOjOlY5poJyWsHi2MqDTwFYCKw6JGfNyoFjvIRSOU8BBmeBOSvHLxKadf8FrwSRmZoTmIuYPuPuwVcZGW1tE+VK3C+bs73gQ4tntmvUtjO5LZkf0DixQfsS/zsXpIGWwTircsflNI= 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=e21mUnks; arc=none smtp.client-ip=209.85.218.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="e21mUnks" Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-b79f8f7ea43so3391314066b.2 for ; Mon, 05 Jan 2026 01:01:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603701; x=1768208501; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=QcAewfHh0ra+es5CHo0kMIivfjkLmLaLZDMh7cCTg/g=; b=e21mUnksZ9bgxEeUdJ5ADO4yy3TILqCmcTjhJu1Sp6PMscJiqBgAzyzffbr51wJeAr nKRD07cQAqhcC/w0GYq5wtujsQu9/IedBPocEWtNqiWR5mWKBRk2iNjJXrUL/U9lK+gf XzRlDsDI6O921e+xbYBceiS/2I0XUDfaaG1Qa+hIjZJRz4VrqUk5SJZuMqQdHOMOmPWh 8NMLIV0Wsi87Fvl1xoJe7LRw/A1TT8T2T/QihEp4s4kTlT0ZqE5x4Illvs0wiLb9wkkq F3MUUJLb/BglYwvgkOUxQco7qa4jhymZ4npCtwqt4ULwbcBSCbr5WVgr+XkxtRpAb3Sl LfGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603701; x=1768208501; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=QcAewfHh0ra+es5CHo0kMIivfjkLmLaLZDMh7cCTg/g=; b=Iq64/Xxp8UBmogKHmrBGqFMj1RGecdWXf45lOl7ZqYlKE2AFcIM1agtEBQCKL3aWbG qc8saqJx2tw010y17Ucmy1H5hCdEVjRVxa3U8vtXS0zl+7+uwfEWEeWoqWwJl7TOF7ux eMitxDoRD6uM3o553jdA0KIayM1lX4kXkN4hu/B0q2zKq7IOW1QA1TMYqrcMfvzFPDni v+qVKTPz695iy/DGG5cCu/cr1PYe0mtkVTAo2NtR8Em1kAG1/GsARHloSql7zsMB+CZt uC7Il8T36mmMD3XBUZS9Q5UR1Icgkh1WTPhZ8rPT8xGyiWlLsKZEeZjBSj1E94oMlh4o htWg== X-Forwarded-Encrypted: i=1; AJvYcCVdCwA94xdv+tqTaS74CFPOGKLd0Yz2y1WRjLEL9YTkp2MKpawQ2Lkb9/bnixHSUWUXyIPDlFBXEXjcJb8=@vger.kernel.org X-Gm-Message-State: AOJu0YyIn2bKfZmotASF/HjEpX2ChiSyqJb6fbNggU3yiR/pYu0gG4tk QrSYQPCKah8duiBEDKmVso8KcvQXOds5nUgyHgUYb84o0bvSrRtCnmFzJ4he5nE9oVs= X-Gm-Gg: AY/fxX7j602uacXRQpvPt50ZknBWi7IkIajpvL4Jz1A8xxWW6Fs7FSzuvw5Vx1691JC SKiwnko3wOAnzWi3V3XHL4DpqkHYvC5oUxtxeTi6+GsSfTaDNNZfB7dIHqlnl0nOiHAkfs9bppo rXCeP1l99vKILXKWrGQ705t8klOqe8eG4b94lCc78MCP4WU2iV5/jCCQpTfuBRD+o5ukbOZKB0T GhO3aL67/XSYbuLKp5gQOtMP6yVcGWrRIi3XblxDItI1X9Sx4KLHzY1dvY0YDmvmuvwZSf1HLeD 0qlnEmyd8ljg0Xx/IJHNlXigtLKRVJcMDJ/4ddgDhyqCB7bZAeiXiur7oUlQbAhVGhKSwvzFVjo nzbO359y6HtHsSXXNwVlq8TJZ0rpVyHXkS9naWruSm/d9I7AvD4MMptK9Tew4QLrMhYNlydRTj4 iqei9pw6o/Sd/V9EncNmO8f9KSc7YtU9sbgeO49qdan/Dy6l16WpeZqSo7Isc5r859y8/jrUsL1 hxn5A== X-Google-Smtp-Source: AGHT+IF/CJPT01K+lN7oSi7PevRwGsCCriwWOuhAB/HKhWPK5/pKnCMo9T9pQaKGATPI5BY11XjZrg== X-Received: by 2002:a17:907:2d28:b0:b6d:9576:3890 with SMTP id a640c23a62f3a-b8037193c4amr4758339566b.45.1767603700764; Mon, 05 Jan 2026 01:01: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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:40 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:37 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-1-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 Using lowercase for the buck and ldo nodenames is preferred, as evidenced e.g. in [1]. Convert the example here to lowercase before we add any bindings describing the s2mpg1x regulators that will enforce the spelling. Link: https://lore.kernel.org/all/20250223-mysterious-infrared-civet-e5bcbf= @krzk-bin/ [1] Acked-by: Rob Herring (Arm) Signed-off-by: Andr=C3=A9 Draszik --- Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml | 4 = ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-i= pc.yaml b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.= yaml index d3bca6088d128485618bb2b538ed8596b4ba14f0..4a1e3e3c0505aad6669cadf9b7b= 58aa4c7f284cb 100644 --- a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml +++ b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml @@ -75,7 +75,7 @@ examples: interrupts-extended =3D <&gpa0 6 IRQ_TYPE_LEVEL_LOW>; =20 regulators { - LDO1 { + ldo1m { regulator-name =3D "vdd_ldo1"; regulator-min-microvolt =3D <700000>; regulator-max-microvolt =3D <1300000>; @@ -84,7 +84,7 @@ examples: =20 // ... =20 - BUCK1 { + buck8m { regulator-name =3D "vdd_mif"; regulator-min-microvolt =3D <450000>; regulator-max-microvolt =3D <1300000>; --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 2026 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.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 49A9F32AAD1 for ; Mon, 5 Jan 2026 09:01:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603706; cv=none; b=ZvnxobjfsYSAnDuKR+aBHFarSbO5OfmMFIdVn3NB6klVeJza80mziklK/BadDtyALYduz3cyN9NuFVYWNZkZa7GBBKotW2awasdIRrE/R/ECGzaA8XffGspGCheHZRuEVzrpMv412ZLr71su3fv2VXU4t11r5h1g/p5mzbiMhFc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603706; c=relaxed/simple; bh=cDTIGWVXEzPLuyGXqisxpp/99/qwRzUDF6t1zWY9mLU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CUujgqxPTe7uShQl84c4Pb9TLyrTAQMTHxqdKO0eBI83mDdLNK9HZqSx/9c3DNeS0WIjhgHixo3fsir0zSObuAACyIgCxp7iLaROgPv7B767n19P6NvgCut24l6VcN+JeyaLWJawSO286xpnki4Q6MUM9KUbs85CeJkax40+q4c= 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=Bhnccrez; arc=none smtp.client-ip=209.85.218.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="Bhnccrez" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-b8052725de4so1423704066b.0 for ; Mon, 05 Jan 2026 01:01:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603701; x=1768208501; 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=g5aG9UiTB7Vj3Otot6zn2A2WjymKMwzj8kzNU4i6XLo=; b=BhnccrezHD8NDD4vmVMM1d17cLa6u75J9l+ec4naBeMeMxDIYPpXDJDFLUJnqoQ5AV 9tkNxQey0u9b6F+F1ghgv/2Q7PqTC49uXjiO7gDO2dAxaQC8dlYF3j73fTDpbIlYSVBo onqbHSswT40jBTTEKvQ/YtgYJQKjm859Jy11q4RfkhEwV40Zgu5y22wp9ObNLfQXVPwT 69nvj6OFHeoD4iTLYnbAiDHF5r1NmVzqPurw0xjo3nrC/YLoUMnXFTSn3rnc4ksu+/mC rdVpj5frVnq/R9NfLGkvjJ9ExP0XPkl+tj+zcf+xFpEUTJvyJojNutGb3soJWqYPrqj7 RYww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603701; x=1768208501; 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=g5aG9UiTB7Vj3Otot6zn2A2WjymKMwzj8kzNU4i6XLo=; b=vrvZ2kgKro3cOpgkvwQTslQjxwB5abOlxYkuVjC9PDpIAa7bZP8o3Ax8Tm7l2CF62s lC/X/LmLw4E4v27KqsUpIQOrzbra/dnSPPnodHdwInbJJux+/uuXiU9Nz/bXB2R1WSPP glt6cTm+COTJ1SNQOVk/s4vCsLFm0QL2mr1gK5xtXeVVQCe3jbcbek2x/WFt9pUp17QD AHJoSPXVBJcXIYudq3PmJ/Aaffuj2AmaYOFSGUien69ylKf6/YIskWQaOMwaFWryVqt2 TzEtK/F2vPPVQLk8cq1ZnnXW5N1frame6xBWilBTpde5qSJwnBjAMFma5BnPTF1+0ugp p58w== X-Forwarded-Encrypted: i=1; AJvYcCVv+coSvJd39/i/6DHf3XXUbJj50nbQZ4OFSaj2IIqRmgdF3dOfKq3dJmNAxavegHxDSCdcCkzvo3m8++o=@vger.kernel.org X-Gm-Message-State: AOJu0YxMarjDmHWVld+Hvgu2irjfmZJ7RHP64vXEM2lgZLmFcVOGTJf2 AuJbfeT0c9v09PHkWkHG2aKWO23XZ99QD6K+v4NPy+gg7VlR/V9cAM1KJbPaYaaNTwA= X-Gm-Gg: AY/fxX7lSaINMcBp86JhXMwNFP7J50+Qb8jr4oRdTYNA9PQzkLL3RweD77IwI1d+1+j 6wedII7qcOrO7QzrW3Tw9GntCTrIOzphV8HosIqe7kikQ64B41MHdt/Gcp5d032+HkTxubNRrxp qMRMoFLueHFUda36w2zkFnzmd0wpFMbEq7aiiSblm/wBRWGFPMnfMXfdjDwxBrZjRUMCW8f8ry7 CXlKF1jyj0XtQmOw7rILCOqzGCq5xAUjDgyChlcmhuPjQvl7xeF0aMwJa52sHU2JMoJl8g6kKdF 6CYRE4v+oD2ntkOBE0+w+dNT0TlCfuHQAQixujjvRUqwECt6AEqBOwugsN+c5vwSs0Kfj/RL7TQ x2OTovJUZLSw2Y+AIvyrJ5HmHM5dDyObl6ejiDqax4vGZXsjzmrtWjhBdSp/6mvBacs9sPfXsg9 WN3w4Djo9pfzXqoN3l+PBVBBCw8vVXMGaO/nJ2tCsoi9PIBDQr6SSlsmQbwV1JSkk7GHG5+hXOo KjPeA== X-Google-Smtp-Source: AGHT+IFoBKeSVDsupuRxjxp2fuvvNtk/MkHxHnvNLpwYXyVfiMeBXdQyDeOmYvEJFR5Fl5glt5Wcbw== X-Received: by 2002:a17:907:fdca:b0:b7a:2ba7:1988 with SMTP id a640c23a62f3a-b8036ebbbd0mr4659371866b.9.1767603701295; Mon, 05 Jan 2026 01:01:41 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:40 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:38 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-2-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij 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 adbe6a93a3927174af26318a6eb9db667c0b4ad0..03fbdb9d1565664528e0ccf7d08= 596f80441b301 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23312,6 +23312,7 @@ F: drivers/mfd/sec*.[ch] F: drivers/regulator/s2*.c F: drivers/regulator/s5m*.c F: drivers/rtc/rtc-s5m.c +F: include/dt-bindings/regulator/samsung,s2m*.h F: include/linux/mfd/samsung/ =20 SAMSUNG S3C24XX/S3C64XX SOC SERIES CAMIF DRIVER diff --git a/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h b/in= clude/dt-bindings/regulator/samsung,s2mpg10-regulator.h new file mode 100644 index 0000000000000000000000000000000000000000..4a6bf13442f50bb1c475728722e= aebd0ec3dcbfa --- /dev/null +++ b/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Copyright 2021 Google LLC + * Copyright 2025 Linaro Ltd. + * + * Device Tree binding constants for the Samsung S2MPG1x PMIC regulators + */ + +#ifndef _DT_BINDINGS_REGULATOR_SAMSUNG_S2MPG10_H +#define _DT_BINDINGS_REGULATOR_SAMSUNG_S2MPG10_H + +/* + * Several regulators may be controlled via external signals instead of via + * software. These constants describe the possible signals for such regula= tors + * and generally correspond to the respecitve on-chip pins. + * + * S2MPG10 regulators supporting these are: + * - buck1m .. buck7m buck10m + * - ldo3m .. ldo19m + * + * ldo20m supports external control, but using a different set of control + * signals. + */ +#define S2MPG10_EXTCTRL_PWREN 0 /* PWREN pin */ +#define S2MPG10_EXTCTRL_PWREN_MIF 1 /* PWREN_MIF pin */ +#define S2MPG10_EXTCTRL_AP_ACTIVE_N 2 /* ~AP_ACTIVE_N pin */ +#define S2MPG10_EXTCTRL_CPUCL1_EN 3 /* CPUCL1_EN pin */ +#define S2MPG10_EXTCTRL_CPUCL1_EN2 4 /* CPUCL1_EN & PWREN pins */ +#define S2MPG10_EXTCTRL_CPUCL2_EN 5 /* CPUCL2_EN pin */ +#define S2MPG10_EXTCTRL_CPUCL2_EN2 6 /* CPUCL2_E2 & PWREN pins */ +#define S2MPG10_EXTCTRL_TPU_EN 7 /* TPU_EN pin */ +#define S2MPG10_EXTCTRL_TPU_EN2 8 /* TPU_EN & ~AP_ACTIVE_N pins */ +#define S2MPG10_EXTCTRL_TCXO_ON 9 /* TCXO_ON pin */ +#define S2MPG10_EXTCTRL_TCXO_ON2 10 /* TCXO_ON & ~AP_ACTIVE_N pins */ + +#define S2MPG10_EXTCTRL_LDO20M_EN2 11 /* VLDO20M_EN & LDO20M_SFR */ +#define S2MPG10_EXTCTRL_LDO20M_EN 12 /* VLDO20M_EN pin */ + +#endif /* _DT_BINDINGS_REGULATOR_SAMSUNG_S2MPG10_H */ --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 2026 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD8F032AADA for ; Mon, 5 Jan 2026 09:01:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603706; cv=none; b=VyPgHU9CxAN/N/qc0P1bb+q4uF7bGWapT3BhPANKmYIzA8z8HH0mY6YGXvtGfZu0TnZV32K53iZsBtfm57Nr+LnoHAhpZaJ+K7XUeD4SNtWhUf/L4lJcV4PP6c54eokSwLX3NRvnpppW46sSILdo0CCME2JU/O/S2RAvbrqWX+c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603706; c=relaxed/simple; bh=hCyU+UvoqAZ0y+DMEsx1d4h3jN+BwHub9jI2bDgl3kc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hd8veaMfVycWb4299S6fWguJkOUpspw6bbG+2OFyADa1twevkG6JVRaPMZpHSFDl4nj2Zln/J/r0ML2ggpOiXkwMDqzAf8+RT2121fe6yfdn2mnoeTZjT8cLoZrMH3ibP2Ltxo7Nhdx5D5eU5rSIIpeAo3zIcLEK8bc8WDhhRBE= 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=tuOOMjMW; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tuOOMjMW" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-b83d6a06304so272783066b.2 for ; Mon, 05 Jan 2026 01:01:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603702; x=1768208502; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=oYMpGHqEe3Pcj/Iu077fbSOBxW1M8Fmnn10jzmEF0+8=; b=tuOOMjMWp3eDY8wBEXiaUPXuBBddfp4TVYqPmlkyslI6skPOfTJoBSED9UqsoFqlG6 m1pYOUhlCD2qsFYrbQq4fwstcpY8SiNIasL7/yUgGd+Nj8eBL+akGw6xcU9mfnfoyhxJ ctCof64Yt5FDz1UdTUk4ehkuYOowOIkCaeNCABmXqlfLTHS2U4vvf7eKzdgAaltWnfKV gfRG358WCPVCapCLSS2zvbklr+Rod1twBakzZmUpPzL34LG0OWvYv1+xmJSbCOy2jhzO 5Ttg3f+pGjjC1yemVo+b/y5AMimeWVnAs6QAGJpSR+BJL++qsyXWxz/eRgDz9bWrAmxh wUjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603702; x=1768208502; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=oYMpGHqEe3Pcj/Iu077fbSOBxW1M8Fmnn10jzmEF0+8=; b=FXQJi5Zm5C4g+61p0/JaXFM30vkSKdQ1UhDxLQuL++u7bnubrnSfN2Z10C5TGOq88g y3T/Z+7ZuADLZCnaVvMR1rNNo8XaApwmxeSUa3T9QROAKyVLG7BRk0xsaB26JGf8UfRT YmMgjOglSmUK6ZHcCyU+9y7z939WbwefZPwhipcGiu/mIvxdf2jUfm9gfkjYE7ykhfxy IMPzZ0jwdKdHL1WgHDsKIJxvF4fEu84SSQ8Q/x2dn2ALYJUcjsO5EozmFHz4z/GoXdqS d+qsYGGTBq561Q2GHysewxqE8OmlNEoONeCZ2xNnSY3FV3l7lscuIj6+u7cMzoGILw6t JkVA== X-Forwarded-Encrypted: i=1; AJvYcCXXaK0WohilVYNdblOtwH0xycYkAVpcWuH+xTLOThSUM/cGWb1qZ9xQ1d3waoIZzyOmRM6JSvoOTOiiaqE=@vger.kernel.org X-Gm-Message-State: AOJu0YwJyHXOVe8ZOT3+sdv2WNhzScgoMrY3corfUVB3Wl9RKFlEDH00 GJqcuaBHfilo3qQC9aNoXo66UV7rz1DI9f3vfECeijK5rRyzFhKNn8Cm8OUNdQL2aNE= X-Gm-Gg: AY/fxX4SL/NGScXz7Uz/ZlGgtgGS8A0dk0Z6ejtMsznmeIEA5m8c8KnVywaX6QCrtCy U0G4gt5nPxitn8I3LGjFF8Sz8BSB2JYQoFU6RSedsOgqBiwaUhC8ZdIX3OWHXntdcZqVCCcncw4 Nq2Li2lf1Qow/2eIsQdZVb+FCYLhBCjTPhlap6I+ywyW/tVbjhfgHo1A5uo8R7IEY06vzuZWE8O KVRDvY3Z59ZfCBbimmYqEF0Od5qiGXIQAzxZBNwB+qUykLjl19PEqfTb8P8t4dkf+c7eujqT4cV 7RO4cD5DK5UFPtSF4WmiD918icRB/JBtG3/03tLBEDKtXZdz8VBlikDmIN840aw/JVjri2wc6B8 2v1OECuBJPejN2dW0lbNKG9N50T//rgNmmuxOW61wepC3e4uQGdiGBH0/JoXeBJGbFkJNeqsdRC dffXwziDgmUIf0n6MbSL0NuV6eci3Is26TSQM4qT+UAw0jKy4jVhRa3LdSeglgWxIhH34muhUzW QzLOw== X-Google-Smtp-Source: AGHT+IFwV8Ct+G3hOyx6Ngl6tjmf3FOsFqKa6gdEmM2YVLjU7hY9wNqcjVoSZDO0ut7Hbh7XWIXamg== X-Received: by 2002:a17:906:30c4:b0:b80:3c00:c980 with SMTP id a640c23a62f3a-b803c00cbb0mr3984299666b.4.1767603701852; Mon, 05 Jan 2026 01:01:41 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:41 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:39 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-3-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 The S2MPG11 PMIC is a Power Management IC for mobile applications with buck converters, various LDOs, power meters, NTC thermistor inputs, and additional GPIO interfaces. It typically complements an S2MPG10 PMIC in a main/sub configuration as the sub-PMIC. S2MPG11 has 12 buck, 1 buck-boost, and 15 LDO rails. Several of these can either be controlled via software (register writes) or via external signals, in particular by: * one out of several input pins connected to a main processor's: * GPIO pins * other pins that are e.g. firmware- or power-domain-controlled without explicit driver intervention * a combination of input pins and register writes. Control via input pins allows PMIC rails to be controlled by firmware, e.g. during standby/suspend, or as part of power domain handling where otherwise that would not be possible. Additionally toggling a pin is faster than register writes, and it also allows the PMIC to ensure that any necessary timing requirements between rails are respected automatically if multiple rails are to be enabled or disabled quasi simultaneously. While external control via input pins appears to exist on other versions of this PMIC, there is more flexibility in this version, in particular there is a selection of input pins to choose from for each rail (which must therefore be configured accordingly if in use), whereas other versions don't have this flexibility. Add documentation related to the regulator (buck & ldo) parts like devicetree definitions, regulator naming patterns, and additional properties. Since S2MPG11 is typically used as the sub-PMIC together with an S2MPG10 as the main-PMIC, the datasheet and the binding both suffix the rails with an 's'. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- Note: checkpatch suggests to update MAINTAINERS, but the new file is covered already due to using a wildcard. v4: - Krzysztof: - move additionalProperties to after allOf - use $defs, not definitions - update samsung,ext-control: description v3: - mention NTC thermistor inputs in commit message - drop PCTRLSEL values that can be described using standard properties (Krzysztof), drop useless ones, rename the remaining ones - drop maxItems:1 where not needed (Krzysztof) - samsung,ext-control-gpios -> enable-gpios (Krzysztof) - drop buckboost from 'allOf' limitation - not needed as it has its own specific description v2: - fix commit message typos: s2mp1 -> s2mpg1 - mention GPIOs in commit message --- .../regulator/samsung,s2mpg11-regulator.yaml | 136 +++++++++++++++++= ++++ .../regulator/samsung,s2mpg10-regulator.h | 14 +++ 2 files changed, 150 insertions(+) diff --git a/Documentation/devicetree/bindings/regulator/samsung,s2mpg11-re= gulator.yaml b/Documentation/devicetree/bindings/regulator/samsung,s2mpg11-= regulator.yaml new file mode 100644 index 0000000000000000000000000000000000000000..119386325d1b5b6b0fe35c1f17d= 86e3671fe0fc4 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/samsung,s2mpg11-regulator= .yaml @@ -0,0 +1,136 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/samsung,s2mpg11-regulator.yam= l# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung S2MPG11 Power Management IC regulators + +maintainers: + - Andr=C3=A9 Draszik + +description: | + This is part of the device tree bindings for the S2MG11 Power Management= IC + (PMIC). + + The S2MPG11 PMIC provides 12 buck, 1 buck-boost, and 15 LDO regulators. + + See also Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml for + additional information and example. + +properties: + buckboost: + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for the buck-boost regulator. + + properties: + regulator-ramp-delay: false + +patternProperties: + # 12 bucks + "^buck(([1-9]|10)s|[ad])$": + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for a single buck regulator. + + allOf: + - $ref: "#/$defs/s2mpg11-ext-control" + + properties: + regulator-ramp-delay: + enum: [6250, 12500, 25000] + default: 6250 + + # 11 standard LDOs + "^ldo([3-79]|1[01245])s$": + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for a single LDO regulator. + + properties: + regulator-ramp-delay: false + + # 2 LDOs with possible external control + "^ldo(8|13)s$": + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for single LDO regulator. + + allOf: + - $ref: "#/$defs/s2mpg11-ext-control" + + properties: + regulator-ramp-delay: false + + # 2 LDOs with ramp support and possible external control + "^ldo[12]s$": + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for a single LDO regulator. + + allOf: + - $ref: "#/$defs/s2mpg11-ext-control" + + properties: + regulator-ramp-delay: + enum: [6250, 12500] + default: 6250 + +$defs: + s2mpg11-ext-control: + properties: + samsung,ext-control: + description: | + These rails can be controlled via one of several possible extern= al + (hardware) signals. If so, this property configures the signal t= he PMIC + should monitor. The following values generally corresponding to = the + respective on-chip pin are valid: + - 0 # S2MPG11_EXTCTRL_PWREN - PWREN pin + - 1 # S2MPG11_EXTCTRL_PWREN_MIF - PWREN_MIF pin + - 2 # S2MPG11_EXTCTRL_AP_ACTIVE_N - ~AP_ACTIVE_N pin + - 3 # S2MPG11_EXTCTRL_G3D_EN - G3D_EN pin + - 4 # S2MPG11_EXTCTRL_G3D_EN2 - G3D_EN & ~AP_ACTIVE_N pins + - 5 # S2MPG11_EXTCTRL_AOC_VDD - AOC_VDD pin + - 6 # S2MPG11_EXTCTRL_AOC_RET - AOC_RET pin + - 7 # S2MPG11_EXTCTRL_UFS_EN - UFS_EN pin + - 8 # S2MPG11_EXTCTRL_LDO13S_EN - VLDO13S_EN pin + + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 8 + + enable-gpios: + description: + For rails where external control is done via a GPIO, this option= al + property describes the GPIO line used. + + dependentRequired: + enable-gpios: [ "samsung,ext-control" ] + +allOf: + # Bucks 4, 6, 7 and 10 can not be controlled externally - above definiti= on + # allows it and we deny it here. This approach reduces repetition. + - if: + anyOf: + - required: [buck4s] + - required: [buck6s] + - required: [buck7s] + - required: [buck10s] + then: + patternProperties: + "^buck([467]|10)s$": + properties: + samsung,ext-control: false + +additionalProperties: false diff --git a/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h b/in= clude/dt-bindings/regulator/samsung,s2mpg10-regulator.h index 4a6bf13442f50bb1c475728722eaebd0ec3dcbfa..d9c16bba4d85809df99c2887b8d= c61ea1bea5ad1 100644 --- a/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h +++ b/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h @@ -20,6 +20,10 @@ * * ldo20m supports external control, but using a different set of control * signals. + * + * S2MPG11 regulators supporting these are: + * - buck1s .. buck3s buck5s buck8s buck9s bucka buckd + * - ldo1s ldo2s ldo8s ldo13s */ #define S2MPG10_EXTCTRL_PWREN 0 /* PWREN pin */ #define S2MPG10_EXTCTRL_PWREN_MIF 1 /* PWREN_MIF pin */ @@ -36,4 +40,14 @@ #define S2MPG10_EXTCTRL_LDO20M_EN2 11 /* VLDO20M_EN & LDO20M_SFR */ #define S2MPG10_EXTCTRL_LDO20M_EN 12 /* VLDO20M_EN pin */ =20 +#define S2MPG11_EXTCTRL_PWREN 0 /* PWREN pin */ +#define S2MPG11_EXTCTRL_PWREN_MIF 1 /* PWREN_MIF pin */ +#define S2MPG11_EXTCTRL_AP_ACTIVE_N 2 /* ~AP_ACTIVE_N pin */ +#define S2MPG11_EXTCTRL_G3D_EN 3 /* G3D_EN pin */ +#define S2MPG11_EXTCTRL_G3D_EN2 4 /* G3D_EN & ~AP_ACTIVE_N pins */ +#define S2MPG11_EXTCTRL_AOC_VDD 5 /* AOC_VDD pin */ +#define S2MPG11_EXTCTRL_AOC_RET 6 /* AOC_RET pin */ +#define S2MPG11_EXTCTRL_UFS_EN 7 /* UFS_EN pin */ +#define S2MPG11_EXTCTRL_LDO13S_EN 8 /* VLDO13S_EN pin */ + #endif /* _DT_BINDINGS_REGULATOR_SAMSUNG_S2MPG10_H */ --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 2026 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.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 64EAC32AADD for ; Mon, 5 Jan 2026 09:01:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603707; cv=none; b=FgEN7mYnYypsrDssoLXpsdZ1eHCW9kYjunknF19mxbTfa5MGyFfpAAhEVfNp76fAW9OASgMqRrACAAHMLzy16VsbFkmltQH6FJJwpkIBMCw1YyXSGsVmtLMAkLJ+QdxjFxfYpnB0IEsH1q8A52M94sY35rMXtXZR0S39GNZ5ico= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603707; c=relaxed/simple; bh=Q0CedTDoxzAYvTyoSGG2JCu7m4Qn+Y6GBjY/RZepsts=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ifCbQ+iaGwZauyQXzHnIx9JM5r8iuTPMi4XmueL/0uv9fgVYP8i4YA94Ej9nEMHG1IdrNtjuuesrvCg8SrtOToH7NoneCSeZT/DaOST9VJQG+JATgb+dhQiqSr0QFoRaGfYVnbma2RyGiJJPwWgVNZZwjtbSwBIo0Gcs18YdQ3I= 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=MgTfXMRQ; arc=none smtp.client-ip=209.85.218.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="MgTfXMRQ" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-b832522b47cso1065549366b.0 for ; Mon, 05 Jan 2026 01:01:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603702; x=1768208502; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=PoAySoFSuOUGBXwBkj/tqOj8zEikF0/rK/x+6MrVKns=; b=MgTfXMRQb7z4QC8fF8udBaOyALbslF4vq3V0KGigPvYaJrUQ3OhKu5kBDco5aBzwwC ymu94mand20FlHJ9pp5edUAEN98L+DpWUpqHXdbhZ5TghFqeFbtfTgVmElTL1stqiWLa RHk/11l44ntf7rPulGzwUNljBFfPo6+rsAo6FY+RiMIrQolqKZwSphAiLu5TyFN8b0+m BPZj94wC6aFlKHFmQKf0FzRr+dT5Cgc2GtKPCcfZnLJzdh2MJs2rBDYX3cGP+QrBGKSq EulDZpUIf3Qb2DpkYMCdcucw7kXb+r1RGSnSnk5v3lTwbfMu4oovrEOBiyab4NpD7tx1 FRpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603702; x=1768208502; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=PoAySoFSuOUGBXwBkj/tqOj8zEikF0/rK/x+6MrVKns=; b=HkpPEuE5idS6rsjO4J8CLV5iMT8y5UI/vpOrgoe6zRhdkcwN56gsfhXZcBnJT1ACdx 1HwSEmqUwuMEPr6LCttrZXyQ0+lCi0v1XF7wHXHKX7VlAZvILpsw8TJXXxfvc0UyIEW9 DDd3GDx4hLFtZBOydspmvInit5GCMSJ+tFKm1DPXcgrsW6KqTtOAxqOHYIOh8CmDFqZ0 DGbhnCxsKrKl8vAklfCBNib+aMEtYCrtagPuSytKAK5Vv/RDKZ1PyZBX2jiK9BbX0lkI SWrmGgBHOaZbV0A9dBDG283c4YD4T31hWM4j5C1ZfBY2wrLn28UDtDNVSNUA0yosoPcR wwPA== X-Forwarded-Encrypted: i=1; AJvYcCU2LElO6kdJwgfmbdyYsb0T2ZSkmBPI4FJnwqbPk4x3XDnhDiaeuAHuptjVn32cVBm/PwfVWq/iY8kASCM=@vger.kernel.org X-Gm-Message-State: AOJu0YyTIc1N0vMXOEONxoELz+pNwQvA4m/Pk73mjbBAr5ttH1ZNWkN7 B9GHFUkoF5uc0ezmzkPZ7CHxvvRutYcNTcpRPxEXSdSZQVT9pCvOMr87Z1iF3h9Lt5A= X-Gm-Gg: AY/fxX7gkQvF5jA1QSUDWBjx6F9NMqv9U+lh4rJjds+usdD65C+AGzapTtqCFoea6kq +wB6CLvnoJPgq6qlk80TKp7mAVAwpRR/np2ouipHz96ZHfouF9CSzSP4UThbbpNsdumQA7R8Wfd EgomsswopBRa1EPobKpr/zMoCIthdYccuO44mvTvJnWr9X4W0OI5HfoW6/FqRSmwZZ4yficcMf+ lHNSSxKWIj8gzLrBqxZCCaT3WFgec4w6INfsH2XYhX/zOxkFYMhAiHS16zql3HNRwL0ZZybmCQ1 My42pkt9ZxGQUQSEaUU8+vK9hk8j7Qkf1RUzmYIq2+H180+jcoW4asIE65C1UCUwJclAmBrnzv2 IWjNNdB9pO8eWs7NEN2FPvEAC9zDyjZdcLIRP26bGsxDPQeCuRUmAkgGtij6e7ZcTl8RKpypXFz bvkmI9TvvgVhRBmjjPJ8/LexJCcvsGIjiiXMohQ6ao4mP5FFvDmNaYWg2hw6si5O5NG+aEIX/JO k0VpQ== X-Google-Smtp-Source: AGHT+IHLNZp+Jq1jsa53Bnqvt7GnC4A/Xve6KIieFsmmoiEgzeIhn3tFkD2eHD+IaKS3ZUoDDcDeqA== X-Received: by 2002:a17:907:5c2:b0:b73:572d:3aff with SMTP id a640c23a62f3a-b80371533ecmr4767140866b.35.1767603702389; Mon, 05 Jan 2026 01:01: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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:42 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:40 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-4-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 The samsung,s2mpg10-pmic binding is going to acquire various additional properties. To avoid making the common samsung,s2mps11 binding file too complicated due to additional nesting, split s2mpg10 out into its own file. As a side-effect, the oneOf for the interrupts is not required anymore, as the required: node is at the top-level now. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- Note: checkpatch suggests to update MAINTAINERS, but the new file is covered already due to using a wildcard. v5: - collect tags - fix a typo in commit message complicateddue -> complicated due v4: - make yaml file name match compatible - add example (Krzysztof) v3: - new patch (Krzysztof) --- .../bindings/mfd/samsung,s2mpg10-pmic.yaml | 69 ++++++++++++++++++= ++++ .../devicetree/bindings/mfd/samsung,s2mps11.yaml | 29 +-------- 2 files changed, 70 insertions(+), 28 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/samsung,s2mpg10-pmic.yam= l b/Documentation/devicetree/bindings/mfd/samsung,s2mpg10-pmic.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6475cd1d2d15e07d953c8b302c9= 0c785835985e5 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/samsung,s2mpg10-pmic.yaml @@ -0,0 +1,69 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/samsung,s2mpg10-pmic.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung S2MPG10 Power Management IC + +maintainers: + - Andr=C3=A9 Draszik + +description: | + This is part of the device tree bindings for the S2MPG family of Power + Management IC (PMIC). + + The Samsung S2MPG10 is a Power Management IC for mobile applications wit= h buck + converters, various LDOs, power meters, RTC, clock outputs, and addition= al + GPIO interfaces. + +properties: + compatible: + const: samsung,s2mpg10-pmic + + clocks: + $ref: /schemas/clock/samsung,s2mps11.yaml + description: + Child node describing clock provider. + + interrupts: + maxItems: 1 + + regulators: + type: object + description: + List of child nodes that specify the regulators. + + system-power-controller: true + + wakeup-source: true + +required: + - compatible + - interrupts + - regulators + +additionalProperties: false + +examples: + - | + #include + #include + + pmic { + compatible =3D "samsung,s2mpg10-pmic"; + interrupts-extended =3D <&gpa0 6 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&pmic_int>; + system-power-controller; + wakeup-source; + + clocks { + compatible =3D "samsung,s2mpg10-clk"; + #clock-cells =3D <1>; + clock-output-names =3D "rtc32k_ap", "peri32k1", "peri32k2"; + }; + + regulators { + }; + }; diff --git a/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml b/D= ocumentation/devicetree/bindings/mfd/samsung,s2mps11.yaml index 31d544a9c05cad878d10a0ae9b99631f08eb04a8..ac5d0c149796b6a4034b5d4245b= fa8be0433cfab 100644 --- a/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml +++ b/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml @@ -20,7 +20,6 @@ description: | properties: compatible: enum: - - samsung,s2mpg10-pmic - samsung,s2mps11-pmic - samsung,s2mps13-pmic - samsung,s2mps14-pmic @@ -59,42 +58,16 @@ properties: reset (setting buck voltages to default values). type: boolean =20 - system-power-controller: true - wakeup-source: true =20 required: - compatible + - reg - regulators =20 additionalProperties: false =20 allOf: - - if: - properties: - compatible: - contains: - const: samsung,s2mpg10-pmic - then: - properties: - reg: false - samsung,s2mps11-acokb-ground: false - samsung,s2mps11-wrstbi-ground: false - - # oneOf is required, because dtschema's fixups.py doesn't handle this - # nesting here. Its special treatment to allow either interrupt prop= erty - # when only one is specified in the binding works at the top level o= nly. - oneOf: - - required: [interrupts] - - required: [interrupts-extended] - - else: - properties: - system-power-controller: false - - required: - - reg - - if: properties: compatible: --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 2026 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29FD432ABD1 for ; Mon, 5 Jan 2026 09:01:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603707; cv=none; b=m1r+/lUM/J0ShKRjSoV9JTN5ALEb2z+mNXILrdwaYKGEiRFOG8opPobSn82b3pMmY5BcfBWKEA+KUNT3ukd3l/K5HArpnDcySDXXo5UhAdOc9DXDKfYxAHAWxH5fVDnLuxkgh7TleTr7slXE1OdIpiviPc0+3J5IPv915VoCTQs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603707; c=relaxed/simple; bh=eUj+8YlOMKUNf5NBtFGcV3w0vZQRcRxLXSHd68Howms=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GzwI8v8gDWlEpyvLA9Ng73AAcdDp7gKaRd2oV8Ajv9qNCNBQNiXHtxu3yKjAGc1jVW1y+224k9Ym6i5bV3NJrgQvktWBuF8BKijzySJ+k8/vF8JaeJSkodVv6ziil/M4tM4bZBc8RH+AKXjRhwE+nNIGdComXNQO7b2sCrkkvB8= 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=kxIckNs3; arc=none smtp.client-ip=209.85.218.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kxIckNs3" Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-b72b495aa81so2331425966b.2 for ; Mon, 05 Jan 2026 01:01:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603703; x=1768208503; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SNYCoocek2VrCaA3pJ1kEtxh2+5LCdMec/cid7tZc1Y=; b=kxIckNs3pcZk2QQHUAheYFAcP1DoI+NV0u7wLL2uwmqDBllGox4r9yrn9TrIpLTPtg zF0uQ8pUGuztmt7tdzAiTCcHMwLzZSOsL0W/ux/3IJxQj8FhGEw+4j5NCYkEtnWrgiw9 YhV4yDF+ddWTNriUB10/LcePkP4gyBNqysSD9yDh68gqrluuT8mr/pEatoPbZORlKrGe EyPIxpzwnLgWF9oS0tVFwih4d9MtLQNu60o3jkjqIDCzMkACnkyfn1ayFSBvY4kfCe4j ET4SOztw0EO58UKRUkVl6EMN5+ih7TRIiioesoCJaWTo2k7qpxsMmN0mRMXOkYC6/BSJ aULQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603703; x=1768208503; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=SNYCoocek2VrCaA3pJ1kEtxh2+5LCdMec/cid7tZc1Y=; b=Ue7T7m99QEWlBLGs5ztl3EHPZSemKbolmtRv43tAFSiOL7H/squTBQ644Tu0HSOpze vaGfXs6EXTFQ7OKzTKvRYcvOwwG/AneknRmrGi7IRaKR6XB0UtIoVH5cpowoDT0h5RVy 9vQWLlL5GmJAP4DqskWLjIolydwfysuqVrV+ZUmEcxwiqSCHA6PDmoCZUeUNJqnKM4nr jiCSqJTwUmEox5YhfQn+uvX6daLjY1+aDonV/mdODSF+BQwTUxURRDQNdPT5OK4Uo17D JNlAehtvwisRUK2gOOZ42plTx9RTc5FEHRVlJbXQOZen2VPCQjyeeI7Df9Qe+tEmPVXU BxtA== X-Forwarded-Encrypted: i=1; AJvYcCUPeSTfEufNDtqCjp8r65BtWxet5L7ki1+KM73hmOZyShNVe3iaqUKmGE2Y4Mexgoh7Q9RSj9lrKGwATYw=@vger.kernel.org X-Gm-Message-State: AOJu0Yy0kf5EhyxKTgtGTKCY1dDTiSO71Svojw7l31BCUeGyRHgl12bz qgMmo12AResjMqaKqRXkXJ4FbhtxUVMV0/NiI3ndLF3ASG2yLxyT9h+IhpWfnQ0I+e4= X-Gm-Gg: AY/fxX7+LQzg1cqv1S+iV/3kwASMVgPEiLPlnpz6mvjWKtM1j63716JbZdawEWamwoO rCoSo1owQgY833w8Wq2YAubGpOHaDy8vTIFKJsl+7VnQHkxVe7o4KqBB1VUNXTxVIMjoksjgEFP D6TOLNbeNG+H64AX0161N2TaPUgBk/bI9oIClKzO1fHT79WpiJGycSI2Ay69Dlm2tELvYwBv4Bq XHInoXcw4nTUZ/vLsri5wswmWtGW38yZBuhDt1UDZPQMvZPKrCukJhJIlPTNrUtT08v9FJ6Zuvv ECICM/TU4xutddehJzGmDtpo8YeveTYmB2PukHQLzV9nVi/xvuNoDWTWcpR6v3hhUtJ+sysTQd7 toHnyK2xeW139IT50B3poe3d0bONe7A/m3RKuzyplQa4QmaDcLg41Qp1RJWxeo+6XkbzaXd5LvL KecN3+wxeKF3g4T8O5lqznxoihsRnzt+UgUYTcvRt3UFZgYsY8yf/GAdEnOI6L2PF4fz+L0bF5F 2ZXTQ== X-Google-Smtp-Source: AGHT+IEMhCRz3n6iUPPLVom/XCfPxIRru78z7Q3ad65RUSf5g00tOnFRHp+Tss4eC3M+LwxuogmXvw== X-Received: by 2002:a17:907:94c9:b0:b70:7cd8:9098 with SMTP id a640c23a62f3a-b8037288a09mr5164076866b.61.1767603702943; Mon, 05 Jan 2026 01:01: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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:42 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:41 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-5-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 Update the regulators node to link to the correct and expected samsung,s2mpg10-regulators binding, in order to describe the regulators available on this PMIC. Additionally, describe the supply inputs of the regulator rails, with the supply names matching the datasheet. While at it, update the description and example slightly. Note: S2MPG10 is typically used as the main-PMIC together with an S2MPG11 PMIC in a main/sub configuration, hence the datasheet and the binding both suffix the supplies with an 'm'. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- v4: - separate bindings for s2mpg10-pmic and s2mpg11-pmic (Krzysztof) v3: - move to new samsung,s2mpg10.yaml file - move all patternProperties to top-level --- .../bindings/mfd/samsung,s2mpg10-pmic.yaml | 57 ++++++++++++++++++= ++-- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/samsung,s2mpg10-pmic.yam= l b/Documentation/devicetree/bindings/mfd/samsung,s2mpg10-pmic.yaml index 6475cd1d2d15e07d953c8b302c90c785835985e5..0ea1a440b983a47a55fc86d6251= b89056ba51172 100644 --- a/Documentation/devicetree/bindings/mfd/samsung,s2mpg10-pmic.yaml +++ b/Documentation/devicetree/bindings/mfd/samsung,s2mpg10-pmic.yaml @@ -10,12 +10,13 @@ maintainers: - Andr=C3=A9 Draszik =20 description: | - This is part of the device tree bindings for the S2MPG family of Power - Management IC (PMIC). + This is part of the device tree bindings for the S2MPG10 Power Managemen= t IC + (PMIC). =20 The Samsung S2MPG10 is a Power Management IC for mobile applications wit= h buck converters, various LDOs, power meters, RTC, clock outputs, and addition= al - GPIO interfaces. + GPIO interfaces and is typically complemented by S2MPG10 PMIC in a main/= sub + configuration as the main PMIC. =20 properties: compatible: @@ -31,6 +32,7 @@ properties: =20 regulators: type: object + $ref: /schemas/regulator/samsung,s2mpg10-regulator.yaml description: List of child nodes that specify the regulators. =20 @@ -38,6 +40,32 @@ properties: =20 wakeup-source: true =20 +patternProperties: + "^vinb([1-9]|10)m-supply$": + description: + Phandle to the power supply for each buck rail of this PMIC. There i= s a + 1:1 mapping of supply to rail, e.g. vinb1m-supply supplies buck1m. + + "^vinl([1-9]|1[0-5])m-supply$": + description: | + Phandle to the power supply for one or multiple LDO rails of this PM= IC. + The mapping of supply to rail(s) is as follows: + vinl1m - ldo13m + vinl2m - ldo15m + vinl3m - ldo1m, ldo5m, ldo7m + vinl4m - ldo3m, ldo8m + vinl5m - ldo16m + vinl6m - ldo17m + vinl7m - ldo6m, ldo11m, ldo24m, ldo28m + vinl8m - ldo12m + vinl9m - ldo2m, ldo4m + vinl10m - ldo9m, ldo14m, ldo18m, 19m, ldo20m, ldo25m + vinl11m - ldo23m, ldo31m + vinl12m - ldo29m + vinl13m - ldo30m + vinl14m - ldo21m + vinl15m - ldo10m, ldo22m, ldo26m, ldo27m + required: - compatible - interrupts @@ -49,6 +77,7 @@ examples: - | #include #include + #include =20 pmic { compatible =3D "samsung,s2mpg10-pmic"; @@ -58,6 +87,8 @@ examples: system-power-controller; wakeup-source; =20 + vinl3m-supply =3D <&buck8m>; + clocks { compatible =3D "samsung,s2mpg10-clk"; #clock-cells =3D <1>; @@ -65,5 +96,25 @@ examples: }; =20 regulators { + buck8m { + regulator-name =3D "vdd_mif"; + regulator-min-microvolt =3D <450000>; + regulator-max-microvolt =3D <1300000>; + regulator-ramp-delay =3D <6250>; + }; + + ldo1m { + regulator-name =3D "vdd_ldo1"; + regulator-min-microvolt =3D <700000>; + regulator-max-microvolt =3D <1300000>; + }; + + ldo20m { + regulator-name =3D "vdd_dmics"; + regulator-min-microvolt =3D <700000>; + regulator-max-microvolt =3D <1300000>; + regulator-always-on; + samsung,ext-control =3D ; + }; }; }; --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 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 6546232AACE for ; Mon, 5 Jan 2026 09:01:45 +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=1767603708; cv=none; b=UYEiFdJ9Y1GVXgZbZ4vr50R7Kazd+zp5mWkZZwDZws1t7pOO0H7bL6mwyrmA0NQp4WkpQKvbLkQNG57s+ByD5L3J1RdWUM4C6xF3PmPvvQBwLvJrpa57/7XTRBtIo9oWR898xRzue26q4dz6Df/VF8w7ijRVuRrmhat4ntZWnAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603708; c=relaxed/simple; bh=aubReYwjqANuwkLNLEVgfFzepyO8fT5RaOuCKS4xuyE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XjOUmozyeAPdFNj9epG4ic62FMYmBzVWX62vt71SNwfSu+b4UlqRKYuXYDkO82RqaJGUoIAWbYar+ssm4zjMq+MeUtbogWvS9fj+2+wAM0d0X+T4fOToNRCrzvzY6j0laFgxfcAZpvq01hf4RE5KIYvcjJLcfiw8+/ZRY3OMPic= 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=yCjSF9Cs; 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="yCjSF9Cs" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-64ba74e6892so19358070a12.2 for ; Mon, 05 Jan 2026 01:01:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603704; x=1768208504; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=5W1/4QyvrrrF6qZFn1ADTO8hKq/uJgt895DTkpi0Lzo=; b=yCjSF9CsppFCDSlhTit1XntcRS2VIfLQwiGjd2oLenlVwkBWRJl6EUPUFEuFgpAqb5 S/ReMBl/lnd3juF8P0RFiGIAg4ZDKuW49t0nM5f71P2jisD1ZDXRW7rBtIrj1l+s1MpQ 3kzhGTQh0rZrVT99GTLUpuidnQ63yFQ6tuqXyRyyqjD0EDsuU5ID7wE2sWIs/uQ4aCNa UEZIbwv7Vc0j8pg/kfwt3zU6bH/N3JyTAFeUwDcaT1KZ5erlt0ug31X+7lAcJRYpekKu H1j0JspPoOnHyoSvs4dVEHrJw4zgkEDq94qzE/GFiyPqyDgPSCeNSG4upfe2S1kiVQvw ubQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603704; x=1768208504; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=5W1/4QyvrrrF6qZFn1ADTO8hKq/uJgt895DTkpi0Lzo=; b=ERp+Nf8N64tK8dKVI/D9tSgz09qpYW4vn4EaGRcjvAZ5EBQe1SJ4eng9iW1BTNXekY w3fn/cUy1uiVC9NIWsEcRCI/LyWIfEKuVUFnuClwGo1ZAPAc1fhJwRNin/G3boKGFe9w vAOjdFTbMJ7k7+cF3cSgDS2t3+md8lp0qfDp7c79qXsiBDY1mjKSsVH30XZH0ie6bDuC kCarCVZHpO+QwIAur5HOpLBmwx9+4Xj9xD9w7vhd2H2RcQiQ8dRqhHnH5YKQJ8ASQnS/ IX1gsDmlIvYLuohJxHWxC0XO0KEbJCfONQx53JGLLkUow528kQgijrUPUgycd90gio60 z/QA== X-Forwarded-Encrypted: i=1; AJvYcCWNFCLyCeHrDkdltLxyn0Jy97FE+DE39bBgXgJe4pLRhrow+dTY8G1kkMvBa8RikVWevLARER8w/0AU5Ds=@vger.kernel.org X-Gm-Message-State: AOJu0YztXw6dodfuID/EY6fja33rZmyF6yGAH+a/ay15y7MLSpSPel4a um1kouhGNP1OqbFWuNj4XBYaZ3pRjKDKqrQAUwfI1he2JDA6ooYjscIspLhuQaPmIUA= X-Gm-Gg: AY/fxX5iuMaLn8GJ0nZmgZu+Ix/zkwp4aE8PzWfKSu1PsTKQp2jOp2ssnx/efuWL2J2 IgWqLqFzczrbE+zvax567IR4OF4goR5aqLnNI7wtWK4OkA3SiuI+bgu7i5fCeg0d/kpAu7He4jX 7SmNECU0JXP3+EFdJFq2kqAPuMGjybVQPe5L7kULjlSbqnhe+87g4CaPACDwtF+n+3q0E+8HeK7 SFNX9j0AadCXmYIbhx4G+AkCdmhcacnJOaeTUklRUZGWlviCKSSo48+cUAwqbn2Io1cC3/GN2jI Ds6PzB3epUbB5taClNxVz7pk3V6wUV8/5pDox7y8RertleZl8hGZQeRQt3kSMygbwWFitlUhCtC 5TJNlvazW8DaBrsC7YY6+DMWjcQCCJ/+XsfVtnreWbZifsIwJ+fN6whtdJjA5pZ53WNZkubuci8 GfolJZSLZqrXLd4PDfvdNLJGzIXE06tfGHZv2xh2rmtRXJNcqzMtcov3OYHXIuctqK4VJjxYBTj iLlLw== X-Google-Smtp-Source: AGHT+IHybXHHNMvOSBwJoAL1yd8LuSR2TLHTL8LaPWQ5jPyfAMZ3/vyTjIsZupiSCPkSLv6GAFSsvQ== X-Received: by 2002:a17:906:6a19:b0:b7a:1be1:86e7 with SMTP id a640c23a62f3a-b80372287a8mr4738073466b.63.1767603703497; Mon, 05 Jan 2026 01:01:43 -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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:43 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:42 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-6-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 The Samsung S2MPG11 PMIC is similar to the existing S2MPG10 PMIC supported by this binding, but still differs enough from it to justify a separate binding. It is a Power Management IC for mobile applications with buck converters, various LDOs, power meters, NTC thermistor inputs, and additional GPIO interfaces and typically complements an S2MPG10 PMIC in a main/sub configuration as the sub-PMIC. Like S2MPG10, communication is via the Samsung ACPM firmware and it therefore needs to be a child of the ACPM firmware node. Add the PMIC, the regulators node, and the supply inputs of the regulator rails, with the supply names matching the datasheet. Note: S2MPG11 is typically used as the sub-PMIC together with an S2MPG10 PMIC in a main/sub configuration, hence the datasheet and the binding both suffix the supplies with an 's'. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- v4: - Krzysztof: - move to new separate binding samsung,s2mpg11-pmic.yaml - add example v3: - move to new samsung,s2mpg10.yaml file - deny 'clocks' property - mention NTC thermistor inputs in commit message - move all patternProperties to top-level v2: - add | to vinb*-supply description for better formatting to mark as literal style - mention GPIOs in commit message --- .../bindings/mfd/samsung,s2mpg11-pmic.yaml | 88 ++++++++++++++++++= ++++ 1 file changed, 88 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/samsung,s2mpg11-pmic.yam= l b/Documentation/devicetree/bindings/mfd/samsung,s2mpg11-pmic.yaml new file mode 100644 index 0000000000000000000000000000000000000000..62cedbbd9d8c4cb7e9dfc039c1c= 747e334903b20 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/samsung,s2mpg11-pmic.yaml @@ -0,0 +1,88 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/samsung,s2mpg11-pmic.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung S2MPG11 Power Management IC + +maintainers: + - Andr=C3=A9 Draszik + +description: | + This is part of the device tree bindings for the S2MPG11 Power Managemen= t IC + (PMIC). + + The Samsung S2MPG11 is a Power Management IC for mobile applications wit= h buck + converters, various LDOs, power meters, NTC thermistor inputs, and addit= ional + GPIO interfaces and typically complements an S2MPG10 PMIC in a main/sub + configuration as the sub-PMIC. + +properties: + compatible: + const: samsung,s2mpg11-pmic + + interrupts: + maxItems: 1 + + regulators: + type: object + $ref: /schemas/regulator/samsung,s2mpg11-regulator.yaml + description: + List of child nodes that specify the regulators. + + wakeup-source: true + +patternProperties: + "^vinb(([1-9]|10)s|[abd])-supply$": + description: + Phandle to the power supply for each buck rail of this PMIC. There i= s a + 1:1 mapping of numbered supply to rail, e.g. vinb1s-supply supplies + buck1s. The remaining mapping is as follows + vinba - bucka + vinbb - buck boost + vinbd - buckd + + "^vinl[1-6]s-supply$": + description: | + Phandle to the power supply for one or multiple LDO rails of this PM= IC. + The mapping of supply to rail(s) is as follows + vinl1s - ldo1s, ldo2s + vinl2s - ldo8s, ldo9s + vinl3s - ldo3s, ldo5s, ldo7s, ldo15s + vinl4s - ldo10s, ldo11s, ldo12s, ldo14s + vinl5s - ldo4s, ldo6s + vinl6s - ldo13s + +required: + - compatible + - interrupts + - regulators + +additionalProperties: false + +examples: + - | + #include + #include + #include + + pmic { + compatible =3D "samsung,s2mpg11-pmic"; + interrupts-extended =3D <&gpa0 7 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&pmic_int>; + wakeup-source; + + vinl1s-supply =3D <&buck8m>; + vinl2s-supply =3D <&buck6s>; + + regulators { + buckd { + regulator-name =3D "vcc_ufs"; + regulator-ramp-delay =3D <6250>; + enable-gpios =3D <&gpp0 1 GPIO_ACTIVE_HIGH>; + samsung,ext-control =3D ; + }; + }; + }; --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 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 8C4A032B989 for ; Mon, 5 Jan 2026 09:01:46 +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=1767603709; cv=none; b=lN99xpTL4KbRZUz0WqYP8rp40rQyKdPyIcJT5t5SMGwio8XppWb7PEVvTHr6861lGkGeM1Tuul4yCn/0Oy+e7Xpj5c4bqqXk32RPFpNDbB6bRUhdXC1AsZSEOl4yc9e1RnDxNm/Pe3OEvn79hET52y2kJLiTFH+7vG3pLM8BUU4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603709; c=relaxed/simple; bh=hNm58sAFzxOO0mLfaUIDAAaiwFh3P1PTvPP9/eE7na0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IT4tf3igDZpOSER98yx3v2vvQcRppnGJ7Zr5j99qQLe9iOJlrZSdVkfD8Drriy/2ljn1Ny8ILi87TIWmMDuYF+Vz8OykEJFm+5wdNkNiIrDhOgzaT2VoyW2W34aG7gGqniNA+1vR4UUAZ/oTmHgw+s/Dv1MxWH5UkC4fG2I5Crs= 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=CU6sNGfP; 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="CU6sNGfP" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-64c893f3a94so2677036a12.0 for ; Mon, 05 Jan 2026 01:01:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603704; x=1768208504; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ijeoVSxEaKK4ZCy9A7Kh1hnl7BcwzYQpACu/LfWJKFI=; b=CU6sNGfPjRjGtCFF9PNwXdGiJjWjT0BEeTGyJQx3i8W+4tOFoBf5xmvKu7Hfhj+Yj7 DA3KNvyL48ydRIKq4+PoHY6pTcj1Iv6JB6+672Dq/QQqHcT2thCWTBuGx26FPtlRA1md 1cMBRbIEiICPI0zZrZh9Q+9vyxwp+sdXXlZdhxKlGCJ7wzSkjv01waaqRrTYHhW3sTSC Vb1JGdGPyc+PVanfFdYGoWXPoOVIoUUmH3KDabfonKLI2NNqHDd4P4pclu3JWCl1MRNI HimNfQVdsy1totQqOH59EMNQwpBv36Ar70exFlWiYs/KclBmBs3FqLLAEeUT92b9E7pM 6A0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603704; x=1768208504; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ijeoVSxEaKK4ZCy9A7Kh1hnl7BcwzYQpACu/LfWJKFI=; b=rxpOQNRwcITbtGcF76Equ4YIfSvqY1gmzlIYJhXQXirjBUupmrjHTdi0/4TWUuC9JH oQTqU7FGGFwo1roFWMqH9YUbcKBT2JVDDRLkkksvI27aRXCWBZQ4LmwlW8fwWNT4+5Al UYzlDcEf53JfZOl6jcGQs74TffMxoj7UwpDtjY9o0L6htP712ghGRK2uLgDWPx2k6JNx NwDrnPGC4tH+RVvCu8AxsC4i7z67NuPteM3CNGSK63Y/PHObKyQnMUssy0Z5yD5fiFOC KjxcmAnPUGla4InuUbhMd46CziEFQJJaENy5iiwuFVWuPAmp/1Nd7WxS6XTVg4IG1Izz nENw== X-Forwarded-Encrypted: i=1; AJvYcCWE0reqBKnMJO1bz0oW/lerBx3CinH0iIBU883OQCD5uTvTeepD4uT8Ak75ScxiRBIkFOzGGVHlF6o0HAA=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4B8vxq7pdiFNzmyVUESn04wu+k6QZvYqxL97RT7g8GCX0ehEF CG990xwhNtMaMCrRw8G7ZJ++ww+Uc0x8Co/XP6yj0/KqQ+WSaVS3u2WfCXLDn5pBC2k= X-Gm-Gg: AY/fxX67lEtLKAOqdKNcoCQQyKpdfdLpIfiXx7A05q+cHfcOkLCPwFP4KlZ2VDjybT2 fcFwzVCXKkFxZMc1umFXLJZ4lAZ9Shvkxl4EkGj8yulFNZNBObUTjbHI1xVTAGkP6o2cWkpyMoA yV4qzZqOxx2Ekh5jygrk1VtHJwGn4oZjr5wkmNWiNQRoIN3MlqNcZfhYYQcc+1t+cKoGjDkntPA l6foRFkOU3M2tMMvufI//N3RbgzOSnuMWsRNe4+FRo5ueKYuqdc7nY7x4Xg6wWU9S+NQdIOpX8V SATqfmBynSVZ8sg3TJZ55jLBYkap0yStx5zMWjoLj9+PQ77HcfMODULzTPk6fL3E+xQpDI7BmrT eWDXoOkz5OxEzTLuLJXDfHHvnuZ71ZhzU5i+NCUvmZ6hcHoGHxC/X8tBmLsbKBR1r/R/tStdblp aPSGeFqC67eVQOZingQ31kEJs+Wg7745t0sc4DyRcvIetpvwT7a0p3romZEWlemXQ9L0kkIPj+l Snp75M9oKGj4I9L X-Google-Smtp-Source: AGHT+IE8n/Fu/jQSAKbIUh2ys1Az7EC4ri6lI+KFhpXoGcrZlyKkPWAmWirhfo8QdIeblvQe0+kGzQ== X-Received: by 2002:a17:907:3d09:b0:b83:1341:b656 with SMTP id a640c23a62f3a-b83e275e093mr711608466b.22.1767603704037; Mon, 05 Jan 2026 01:01: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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:43 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:43 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-7-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 In a typical system using the Samsung S2MPG10 PMIC, an S2MPG11 is used as a sub-PMIC. The interface for both is the ACPM firmware protocol, so update the binding to allow the relevant node and update the example here to describe the connection for both PMICs. Since we have two PMICs here, but can not use the 'reg' property (as the addressing is based on software, i.e. the ACPM firmware), the node names reflect that with their respective suffix. The existing 'pmic' therefore becomes deprecated in favour of 'pmic-1'. While at it, update the example. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- v4: - Krzysztof: - update commit message / subject - pmic -> pmic-1, pmic2 -> pmic-2 --- .../bindings/firmware/google,gs101-acpm-ipc.yaml | 50 ++++++++++++++++++= +++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-i= pc.yaml b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.= yaml index 4a1e3e3c0505aad6669cadf9b7b58aa4c7f284cb..e68f9c3ca5e2619bacc0c8d843e= c4984c0947fd8 100644 --- a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml +++ b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml @@ -37,6 +37,7 @@ properties: maxItems: 1 =20 pmic: + deprecated: true description: Child node describing the main PMIC. type: object additionalProperties: true @@ -45,6 +46,24 @@ properties: compatible: const: samsung,s2mpg10-pmic =20 + pmic-1: + description: Child node describing the main PMIC. + type: object + additionalProperties: true + + properties: + compatible: + const: samsung,s2mpg10-pmic + + pmic-2: + description: Child node describing the sub PMIC. + type: object + additionalProperties: true + + properties: + compatible: + const: samsung,s2mpg11-pmic + shmem: description: List of phandle pointing to the shared memory (SHM) area. The memory @@ -62,7 +81,9 @@ additionalProperties: false =20 examples: - | + #include #include + #include =20 power-management { compatible =3D "google,gs101-acpm-ipc"; @@ -70,10 +91,12 @@ examples: mboxes =3D <&ap2apm_mailbox>; shmem =3D <&apm_sram>; =20 - pmic { + pmic-1 { compatible =3D "samsung,s2mpg10-pmic"; interrupts-extended =3D <&gpa0 6 IRQ_TYPE_LEVEL_LOW>; =20 + vinl3m-supply =3D <&buck8m>; + regulators { ldo1m { regulator-name =3D "vdd_ldo1"; @@ -82,7 +105,13 @@ examples: regulator-always-on; }; =20 - // ... + ldo20m { + regulator-name =3D "vdd_dmics"; + regulator-min-microvolt =3D <700000>; + regulator-max-microvolt =3D <1300000>; + regulator-always-on; + samsung,ext-control =3D ; + }; =20 buck8m { regulator-name =3D "vdd_mif"; @@ -93,4 +122,21 @@ examples: }; }; }; + + pmic-2 { + compatible =3D "samsung,s2mpg11-pmic"; + interrupts-extended =3D <&gpa0 7 IRQ_TYPE_LEVEL_LOW>; + + vinl1s-supply =3D <&buck8m>; + vinl2s-supply =3D <&buck6s>; + + regulators { + buckd { + regulator-name =3D "vcc_ufs"; + regulator-ramp-delay =3D <6250>; + enable-gpios =3D <&gpp0 1 GPIO_ACTIVE_HIGH>; + samsung,ext-control =3D ; + }; + }; + }; }; --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 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 CF99932B999 for ; Mon, 5 Jan 2026 09:01:46 +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=1767603710; cv=none; b=Acxu6PjHQZa0CrnMTB7yFBa26rhH6MnxKY0VPz7/KOYiiKGLFcf15SsQNYC80Qz8SwJawo3Jj3K/zwyj8SrtzJHngp2N9lUY9HI17ZqYGe5u9Y76OuSuictkKKHYOxietsL1yhvkKnxqK3uD1yF2Wi3O4RDIa36yw7TEpm+wkQ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603710; c=relaxed/simple; bh=Sa+/EIvgfLeQ0GYvhvwXdDpmw3zds0mNO7QpOW7aJP0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HPberfs9VOQGVK4zPMujIyOt1qJVYSG9ttCRsLR4HqSD1KypN7LSYndQiISE5kbsA+OJLQXBgEh2znAnxbI4OMngJSRizWPYM0IcClQ+EwkbLHeXynRi6H4CxHrVlFvC0OBt7eMPvQHP+fU1xCCFHPLCOWkdWFkiCJD3JotVSLM= 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=ghKjoxxp; 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="ghKjoxxp" Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-b7a72874af1so2341444966b.3 for ; Mon, 05 Jan 2026 01:01:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603705; x=1768208505; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2EsAjr4P9fU1lByYIXjwfOyDc8iScS+Mv0Ho5Wv25Qo=; b=ghKjoxxpgGapqKcMIPuji8eoGIT0j+AYbbF9JiHVeRk4JbmxxNdjNJsEkewIWMowYN YThI87ryOqwdvHgfgfPKouXO4FWdGL5IFZOVB+Or/LcUCTs6HUn1XWLAWPxUAFIwvwvg XfwZU4upfhp0qv+nxGdHTyGZXWdg+sJbRNZZVySww1A5ZElg3oa/UvGrej/qkwTmsWJD 9RLz7w5tnRElV1HZvnDbGewP7vY/jl5mTs/zJFxIntsHt10hOqGUCEOBaNn5W0o5Vs/s Us5k0kNURKu7H5k4iuS0oApjWkLBoHDJ3jTDxzg0Z+kOVcbjVEHhSWLyOugDCxEA0UVr l8DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603705; x=1768208505; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=2EsAjr4P9fU1lByYIXjwfOyDc8iScS+Mv0Ho5Wv25Qo=; b=R7+4UmLFC/tMM7Qj5kOsSFSCUIQSM6VM9jWycNgjS0M3otX/FSgQ6V+bY6mztHolJJ gw6rQdlM4KuIWX8mVe8C0OfdpmTK0iSjkEPVFzAYAgQIJ/noU3DIvowxs+kTeJ6nwPo6 9CzfV3lKFnzQzk1OOh2mZ6JE/DK8RJeWzRLQ/CjCKCeL+JVKtICJ3XXzDmGym7tv8apz wUa0SkG++R4YbWNxQCpso8wr8Ylx8EgbEc/+If31wl3T4H5WRqHaQ5Kx1knqPTTkThyo TJXen8v1kQ64FF3vwXtBAPS3tGo8nRh2vBvt//d3tae2miRGcnwoQHTMRUwrVfEMUpse vygQ== X-Forwarded-Encrypted: i=1; AJvYcCVMM7fGCv8iNLdcKDn3DDGtpcBk2BEJFwPhGE2QCEPM6GRAU3uFte5y3IuZBqxhGRFEtmPE0XANyVD1qWU=@vger.kernel.org X-Gm-Message-State: AOJu0Yz32Zum9x0qcOkZwYPT890MWyfgF2Ff5tfgrDJtBTnAKwiq/82V V33HWRfGQo1YSDW1ZeH9M2k1w7twyyX2EJNWk8TxlWVRgR+M4NAQYavODVxN26GAiY0= X-Gm-Gg: AY/fxX6iTQr7yPIX6DBImFc560GPtUpxAOMVglrlyOKVbw7cZDlRpCGH6fSC3MUWBmg ETw4hjLXZn98sa5nsaQE4STpSyLh2zhc+QjzKMweJZeAyZ1ZjS2hTn+YCDEkd22uNFhXA3YBYUC BM2WyweBv+NS0xcsXlGP+lJLgpuqF8hZJpXuefHS+Ndu23iCejeY1zZDrWguWdo9zcki/HellDm 9f1HBeUjuqzC7l6bkPqa+BIJOilQ1NG/3HKb2h2Z0rrQ1aPtB6KOdEAYRUV9C1h9ADllmoMT80U Bg5Jgq1QaAPqw1HCwQ9mo64PI46wf9uDLomt3NFOz1g8KpPdy0yM1a/JuSs8sKVPT/f+PqocGM/ Y6wcLTVetd6zrVbHsgtcTJK74IB+pQrZoAlQpPLEli8zPqYiYLWrjSOIUnuz59ieaPnrZ11b34F G5qnQCgNIz1fih1MEhq6XD3X3QzWRgX92wzHsc+qfRKkdu+kZjtpM3WU4aScb0gZlxtVlIvfxYa XDIKg== X-Google-Smtp-Source: AGHT+IGsg4QwJJ6nE7YlYsRudVVd4JOd6AfmZvrJr/Ta5DTxaAWNYoHtWSW1zCMbsyPo8hVD+zmlFA== X-Received: by 2002:a17:907:948d:b0:b7a:1bde:1224 with SMTP id a640c23a62f3a-b80371e921fmr4785349666b.65.1767603704516; Mon, 05 Jan 2026 01:01: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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:44 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:44 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-8-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 Bucks can reasonably be supplies for LDOs, but not the other way around. Since rail registration is going to be ordered by 'enum s2mpg10_regulators', it makes sense to specify bucks first, so that during LDO registration it is more likely that the corresponding supply is known already. This can improve probe speed, as no unnecessary deferrals and retries are required anymore. Signed-off-by: Andr=C3=A9 Draszik --- include/linux/mfd/samsung/s2mpg10.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/linux/mfd/samsung/s2mpg10.h b/include/linux/mfd/samsun= g/s2mpg10.h index 9f5919b89a3c286bf1cd6b3ef0e74bc993bff01a..aec248c51f366359ff323f421e4= 53a0ec1d1dfa3 100644 --- a/include/linux/mfd/samsung/s2mpg10.h +++ b/include/linux/mfd/samsung/s2mpg10.h @@ -407,6 +407,16 @@ enum s2mpg10_meter_reg { =20 /* S2MPG10 regulator IDs */ enum s2mpg10_regulators { + S2MPG10_BUCK1, + S2MPG10_BUCK2, + S2MPG10_BUCK3, + S2MPG10_BUCK4, + S2MPG10_BUCK5, + S2MPG10_BUCK6, + S2MPG10_BUCK7, + S2MPG10_BUCK8, + S2MPG10_BUCK9, + S2MPG10_BUCK10, S2MPG10_LDO1, S2MPG10_LDO2, S2MPG10_LDO3, @@ -438,16 +448,6 @@ enum s2mpg10_regulators { S2MPG10_LDO29, S2MPG10_LDO30, S2MPG10_LDO31, - S2MPG10_BUCK1, - S2MPG10_BUCK2, - S2MPG10_BUCK3, - S2MPG10_BUCK4, - S2MPG10_BUCK5, - S2MPG10_BUCK6, - S2MPG10_BUCK7, - S2MPG10_BUCK8, - S2MPG10_BUCK9, - S2MPG10_BUCK10, S2MPG10_REGULATOR_MAX, }; =20 --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 2026 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50FA332ABF1 for ; Mon, 5 Jan 2026 09:01:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603713; cv=none; b=VLrhcZ8lKuTz8NrPMh1cLJaN+UxU1PmbgZ17mxyEEJ7MFoDBQMWrxglCmPaCjNEwDHxIIdlpMIgTTm97ymjK71YEuLT8F5tQlCJ7ialJgvAMHGLNYHcUQ+86fgDeqoM6DQeO6adsdmQOXER7i848JKH5I1iyEQYReZtSNxrqtZU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603713; c=relaxed/simple; bh=yZZkGzvYwGQerFFmscbOyxyRbKuF5tXIu+UVibCOYp0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b3OMTzZ1Kb/WTB15/ptyCYJBpIjonjELOzFpA/4axbHxMv9uHOsfW8ES3Qz1toOcxrbqa4uCugsWBq1JWQByLFBRw0CYIDiwCFot4zvK42p5jzu44nPua/mCWZ7wCG5EnW9AbsVKqPwlJxkFrSL1tOoVL/qGY/T77G1IWpgP/b4= 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=wp73Ca81; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wp73Ca81" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-b7355f6ef12so2651646766b.3 for ; Mon, 05 Jan 2026 01:01:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603706; x=1768208506; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=KYTDA1f3xrFUlmoHbXpxr5Q98/BstkNpIFscwqGCaCw=; b=wp73Ca81u9EKPE+fGY8AyYZ2K67k8J30K3BnWLBVwxh/FOmNWxuv5cEeSn9I5e+ugp VqxvW5YzbbsvJG0RKHFSlfUHTmOmhnT3mvVJy+8PS96wrx47eV2gXezpzkcG0sz8NJWC WrrqTL4fWhcF7SAPdcmajcFXeB8DtjcxgeHFiQMecjNIbckRBRCl8pnURyfjP9dlT7Sy vN1fP/VSL+ubByWIOnUPqtLj9vDYL6GWeYJXvM2CP+XDSDuGacO8Vt5CnAZpduDAj7gg PKK9CQh6lji7+SN92aOR6DpIlKbYfwWNsVhejYYZPu+7QLgHX5xxHo1YEzuNEyHojmND NaJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603706; x=1768208506; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=KYTDA1f3xrFUlmoHbXpxr5Q98/BstkNpIFscwqGCaCw=; b=PbXftZ5uuZw8G60rXTmIESTBX8GU0NU32HbKiRZyw+00dejFfB2JQ+JgcEwgoqMv4/ 0h2tuF9qwMiNXSS8nrU42uWvg98e2JGd7ivgXXBRgo0XoZob4QVBMwB1/+BwZtn/eFOG Yx7s58Zlu3mk8IRQXj/LsKpFYByS9imFSGdBo4k8PMZ9y7ORGI0ty5uf8TmpY6eMHwl7 p9/00l8MUcx522QfSdZ+IqEQ5DvD19Z6PZJtYtcF4FLK67G7zEjGOYqjf/CxPd0G7opu ofAxW1UPwlAzHme6hryu2MwxwuFrMRX20efUoj2N4p3u1hDvOZJbkzy+ZIHU9Qe2arNM VMhQ== X-Forwarded-Encrypted: i=1; AJvYcCXEw+Ufcv2fcyHHBgnFNPS1TdJ9+1uQsv3tnpvx8j+rvJwBomyASdTyUxQQFnwh7TANHTQSUk6dQ1pIHfA=@vger.kernel.org X-Gm-Message-State: AOJu0YxPeJsyRlih1FDC5RPnmXT7SBMProkX8r2TeVDFR5m+Zt7SNiws zAPsva7DG1MWDnspTEC+ZVf24gLlZ572cA6qGSclv5jBKtWJxWyXdPLDgdcPc2scS/Y= X-Gm-Gg: AY/fxX4aePzxAZWr6dvhkn/IgoLjSQ5d0pmgpJLoh0T6oryuxYsG6choJfqxSDx6NlF e5fwoQAYxxg8znWDZr4vK8hhDFroZvgO4gvT2ls/FFpATG6WSiCg7BkoRGt5XEz6tuk60Wv30Tv pnJZA77RD8o9zWTai9csxxiQZGRBq/ni94nZSBbzMpi6lnyEzaeZH7qAbCiXYmpWGFtvyvO6kOE XA4JhZYL+XNW0V6+0RcD8BK9hZBoR4ZQsseoK0Z8/aGhY9z5BZtOBzSXqwhnl4Dp1O/nY0YW4f6 M1LvUuUBwUO6y4AWXZuDYDKDK5hg49wfv3CIRMeca4EQvC7uYkLAUek7bnEnN1AIk0kg9ysOuGi TqzEvaK/9BYIRykzfoCIO5c/v0wtuEjWBySD8U14jFDofFeta/4CgEbq6pmCAocKXUClkZuY+oK tmztRxpe3rF9jF6unTJaGE7xRrG+cb0mFPjoJKm432VN7FVPGkNHlu5RhGn9D6tAOvp+rHOk2qF oHYSQ== X-Google-Smtp-Source: AGHT+IErNv0ZZDraaLv8chvM0LCLBDzrrDPxYHd1p5/4AOMS8a+s7c0oPdvuULn3IaosSMzr06rRxw== X-Received: by 2002:a17:906:9f91:b0:b72:ddfd:bca7 with SMTP id a640c23a62f3a-b8037058ba5mr4765183066b.35.1767603705079; Mon, 05 Jan 2026 01:01: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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:44 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:45 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-9-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 Add support for Samsung's S2MPG11 PMIC, which is a Power Management IC for mobile applications with buck converters, various LDOs, power meters, NTC thermistor inputs, and additional GPIO interfaces. It typically complements an S2MPG10 PMIC in a main/sub configuration as the sub-PMIC. Like S2MPG10, communication is not via I2C, but via the Samsung ACPM firmware. While at it, we can also switch to asynchronous probe, which helps with probe performance, as the drivers for s2mpg10 and s2mpg11 can probe in parallel. Note: The firmware uses the ACPM channel ID and the Speedy channel ID to select the PMIC address. Since these are firmware properties, they can not be retrieved from DT, but instead are deducted from the compatible for now. Signed-off-by: Andr=C3=A9 Draszik --- Note: checkpatch suggests to update MAINTAINERS, but the new file is covered already due to using a wildcard. v5: - rebase - one MFD cell per PMIC, not per PMIC rail (Mark) - enable PROBE_PREFER_ASYNCHRONOUS v4: - rebase against next-20251121 v3: - mention NTC thermistor inputs in commit message - one instance per actual rail, not per rail type (LDO or buck) v2: - mention GPIOs in commit message --- drivers/mfd/sec-acpm.c | 171 +++++++++++++- drivers/mfd/sec-common.c | 17 +- drivers/mfd/sec-irq.c | 85 ++++++- include/linux/mfd/samsung/core.h | 1 + include/linux/mfd/samsung/irq.h | 105 +++++++++ include/linux/mfd/samsung/s2mpg11.h | 434 ++++++++++++++++++++++++++++++++= ++++ 6 files changed, 807 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/sec-acpm.c b/drivers/mfd/sec-acpm.c index 36622069a7885c9b5fc74329efec34e1e4bcc106..537ea65685bfebae205a09a9650= c162721833286 100644 --- a/drivers/mfd/sec-acpm.c +++ b/drivers/mfd/sec-acpm.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -216,6 +217,155 @@ static const struct regmap_config s2mpg10_regmap_conf= ig_meter =3D { .cache_type =3D REGCACHE_FLAT, }; =20 +static const struct regmap_range s2mpg11_common_registers[] =3D { + regmap_reg_range(0x00, 0x02), /* CHIP_ID_S, INT, INT_MASK */ + regmap_reg_range(0x0a, 0x0c), /* Speedy control */ + regmap_reg_range(0x1a, 0x27), /* Debug */ +}; + +static const struct regmap_range s2mpg11_common_ro_registers[] =3D { + regmap_reg_range(0x00, 0x01), /* CHIP_ID_S, INT */ + regmap_reg_range(0x25, 0x27), /* Debug */ +}; + +static const struct regmap_range s2mpg11_common_nonvolatile_registers[] = =3D { + regmap_reg_range(0x00, 0x00), /* CHIP_ID_S */ + regmap_reg_range(0x02, 0x02), /* INT_MASK */ + regmap_reg_range(0x0a, 0x0c), /* Speedy control */ +}; + +static const struct regmap_range s2mpg11_common_precious_registers[] =3D { + regmap_reg_range(0x01, 0x01), /* INT */ +}; + +static const struct regmap_access_table s2mpg11_common_wr_table =3D { + .yes_ranges =3D s2mpg11_common_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_common_registers), + .no_ranges =3D s2mpg11_common_ro_registers, + .n_no_ranges =3D ARRAY_SIZE(s2mpg11_common_ro_registers), +}; + +static const struct regmap_access_table s2mpg11_common_rd_table =3D { + .yes_ranges =3D s2mpg11_common_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_common_registers), +}; + +static const struct regmap_access_table s2mpg11_common_volatile_table =3D { + .no_ranges =3D s2mpg11_common_nonvolatile_registers, + .n_no_ranges =3D ARRAY_SIZE(s2mpg11_common_nonvolatile_registers), +}; + +static const struct regmap_access_table s2mpg11_common_precious_table =3D { + .yes_ranges =3D s2mpg11_common_precious_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_common_precious_registers), +}; + +static const struct regmap_config s2mpg11_regmap_config_common =3D { + .name =3D "common", + .reg_bits =3D ACPM_ADDR_BITS, + .val_bits =3D 8, + .max_register =3D S2MPG11_COMMON_SPD_DEBUG4, + .wr_table =3D &s2mpg11_common_wr_table, + .rd_table =3D &s2mpg11_common_rd_table, + .volatile_table =3D &s2mpg11_common_volatile_table, + .precious_table =3D &s2mpg11_common_precious_table, + .num_reg_defaults_raw =3D S2MPG11_COMMON_SPD_DEBUG4 + 1, + .cache_type =3D REGCACHE_FLAT, +}; + +static const struct regmap_range s2mpg11_pmic_registers[] =3D { + regmap_reg_range(0x00, 0x5a), /* All PMIC registers */ + regmap_reg_range(0x5c, 0xb7), /* All PMIC registers */ +}; + +static const struct regmap_range s2mpg11_pmic_ro_registers[] =3D { + regmap_reg_range(0x00, 0x05), /* INTx */ + regmap_reg_range(0x0c, 0x0d), /* STATUS OFFSRC */ + regmap_reg_range(0x98, 0x98), /* GPIO input */ +}; + +static const struct regmap_range s2mpg11_pmic_nonvolatile_registers[] =3D { + regmap_reg_range(0x06, 0x0b), /* INTxM */ +}; + +static const struct regmap_range s2mpg11_pmic_precious_registers[] =3D { + regmap_reg_range(0x00, 0x05), /* INTx */ +}; + +static const struct regmap_access_table s2mpg11_pmic_wr_table =3D { + .yes_ranges =3D s2mpg11_pmic_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_pmic_registers), + .no_ranges =3D s2mpg11_pmic_ro_registers, + .n_no_ranges =3D ARRAY_SIZE(s2mpg11_pmic_ro_registers), +}; + +static const struct regmap_access_table s2mpg11_pmic_rd_table =3D { + .yes_ranges =3D s2mpg11_pmic_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_pmic_registers), +}; + +static const struct regmap_access_table s2mpg11_pmic_volatile_table =3D { + .no_ranges =3D s2mpg11_pmic_nonvolatile_registers, + .n_no_ranges =3D ARRAY_SIZE(s2mpg11_pmic_nonvolatile_registers), +}; + +static const struct regmap_access_table s2mpg11_pmic_precious_table =3D { + .yes_ranges =3D s2mpg11_pmic_precious_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_pmic_precious_registers), +}; + +static const struct regmap_config s2mpg11_regmap_config_pmic =3D { + .name =3D "pmic", + .reg_bits =3D ACPM_ADDR_BITS, + .val_bits =3D 8, + .max_register =3D S2MPG11_PMIC_LDO_SENSE2, + .wr_table =3D &s2mpg11_pmic_wr_table, + .rd_table =3D &s2mpg11_pmic_rd_table, + .volatile_table =3D &s2mpg11_pmic_volatile_table, + .precious_table =3D &s2mpg11_pmic_precious_table, + .num_reg_defaults_raw =3D S2MPG11_PMIC_LDO_SENSE2 + 1, + .cache_type =3D REGCACHE_FLAT, +}; + +static const struct regmap_range s2mpg11_meter_registers[] =3D { + regmap_reg_range(0x00, 0x3e), /* Meter config */ + regmap_reg_range(0x40, 0x8a), /* Meter data */ + regmap_reg_range(0x8d, 0x9c), /* Meter data */ +}; + +static const struct regmap_range s2mpg11_meter_ro_registers[] =3D { + regmap_reg_range(0x40, 0x9c), /* Meter data */ +}; + +static const struct regmap_access_table s2mpg11_meter_wr_table =3D { + .yes_ranges =3D s2mpg11_meter_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_meter_registers), + .no_ranges =3D s2mpg11_meter_ro_registers, + .n_no_ranges =3D ARRAY_SIZE(s2mpg11_meter_ro_registers), +}; + +static const struct regmap_access_table s2mpg11_meter_rd_table =3D { + .yes_ranges =3D s2mpg11_meter_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_meter_registers), +}; + +static const struct regmap_access_table s2mpg11_meter_volatile_table =3D { + .yes_ranges =3D s2mpg11_meter_ro_registers, + .n_yes_ranges =3D ARRAY_SIZE(s2mpg11_meter_ro_registers), +}; + +static const struct regmap_config s2mpg11_regmap_config_meter =3D { + .name =3D "meter", + .reg_bits =3D ACPM_ADDR_BITS, + .val_bits =3D 8, + .max_register =3D S2MPG11_METER_LPF_DATA_NTC7_2, + .wr_table =3D &s2mpg11_meter_wr_table, + .rd_table =3D &s2mpg11_meter_rd_table, + .volatile_table =3D &s2mpg11_meter_volatile_table, + .num_reg_defaults_raw =3D S2MPG11_METER_LPF_DATA_NTC7_2 + 1, + .cache_type =3D REGCACHE_FLAT, +}; + struct sec_pmic_acpm_shared_bus_context { const struct acpm_handle *acpm; unsigned int acpm_chan_id; @@ -364,10 +514,12 @@ static int sec_pmic_acpm_probe(struct platform_device= *pdev) if (IS_ERR(regmap_pmic)) return PTR_ERR(regmap_pmic); =20 - regmap =3D sec_pmic_acpm_regmap_init(dev, shared_ctx, SEC_PMIC_ACPM_ACCES= STYPE_RTC, - pdata->regmap_cfg_rtc, true); - if (IS_ERR(regmap)) - return PTR_ERR(regmap); + if (pdata->regmap_cfg_rtc) { + regmap =3D sec_pmic_acpm_regmap_init(dev, shared_ctx, SEC_PMIC_ACPM_ACCE= SSTYPE_RTC, + pdata->regmap_cfg_rtc, true); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + } =20 regmap =3D sec_pmic_acpm_regmap_init(dev, shared_ctx, SEC_PMIC_ACPM_ACCES= STYPE_METER, pdata->regmap_cfg_meter, true); @@ -399,8 +551,18 @@ static const struct sec_pmic_acpm_platform_data s2mpg1= 0_data =3D { .regmap_cfg_meter =3D &s2mpg10_regmap_config_meter, }; =20 +static const struct sec_pmic_acpm_platform_data s2mpg11_data =3D { + .device_type =3D S2MPG11, + .acpm_chan_id =3D 2, + .speedy_channel =3D 1, + .regmap_cfg_common =3D &s2mpg11_regmap_config_common, + .regmap_cfg_pmic =3D &s2mpg11_regmap_config_pmic, + .regmap_cfg_meter =3D &s2mpg11_regmap_config_meter, +}; + static const struct of_device_id sec_pmic_acpm_of_match[] =3D { { .compatible =3D "samsung,s2mpg10-pmic", .data =3D &s2mpg10_data, }, + { .compatible =3D "samsung,s2mpg11-pmic", .data =3D &s2mpg11_data, }, { }, }; MODULE_DEVICE_TABLE(of, sec_pmic_acpm_of_match); @@ -408,6 +570,7 @@ MODULE_DEVICE_TABLE(of, sec_pmic_acpm_of_match); static struct platform_driver sec_pmic_acpm_driver =3D { .driver =3D { .name =3D "sec-pmic-acpm", + .probe_type =3D PROBE_PREFER_ASYNCHRONOUS, .pm =3D pm_sleep_ptr(&sec_pmic_pm_ops), .of_match_table =3D sec_pmic_acpm_of_match, }, diff --git a/drivers/mfd/sec-common.c b/drivers/mfd/sec-common.c index 0021f9ae8484fd0afc2e47c813a953c91fa38546..bd8b5f9686892b286a953909c6d= 3c72e1ae85199 100644 --- a/drivers/mfd/sec-common.c +++ b/drivers/mfd/sec-common.c @@ -49,6 +49,12 @@ static const struct mfd_cell s2mpg10_devs[] =3D { MFD_CELL_OF("s2mpg10-gpio", NULL, NULL, 0, 0, "samsung,s2mpg10-gpio"), }; =20 +static const struct mfd_cell s2mpg11_devs[] =3D { + MFD_CELL_NAME("s2mpg11-meter"), + MFD_CELL_NAME("s2mpg11-regulator"), + MFD_CELL_OF("s2mpg11-gpio", NULL, NULL, 0, 0, "samsung,s2mpg11-gpio"), +}; + static const struct resource s2mps11_rtc_resources[] =3D { DEFINE_RES_IRQ_NAMED(S2MPS11_IRQ_RTCA0, "alarm"), }; @@ -104,8 +110,13 @@ static void sec_pmic_dump_rev(struct sec_pmic_dev *sec= _pmic) unsigned int val; =20 /* For s2mpg1x, the revision is in a different regmap */ - if (sec_pmic->device_type =3D=3D S2MPG10) + switch (sec_pmic->device_type) { + case S2MPG10: + case S2MPG11: return; + default: + break; + } =20 /* For each device type, the REG_ID is always the first register */ if (!regmap_read(sec_pmic->regmap_pmic, S2MPS11_REG_ID, &val)) @@ -211,6 +222,10 @@ int sec_pmic_probe(struct device *dev, int device_type= , unsigned int irq, sec_devs =3D s2mpg10_devs; num_sec_devs =3D ARRAY_SIZE(s2mpg10_devs); break; + case S2MPG11: + sec_devs =3D s2mpg11_devs; + num_sec_devs =3D ARRAY_SIZE(s2mpg11_devs); + break; case S2MPS11X: sec_devs =3D s2mps11_devs; num_sec_devs =3D ARRAY_SIZE(s2mps11_devs); diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c index 11a56154d36d251d40b40e91da514db0faa15ae3..47425deae5871ce97363d4c8add= f510678fe9813 100644 --- a/drivers/mfd/sec-irq.c +++ b/drivers/mfd/sec-irq.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -79,6 +80,64 @@ static const struct regmap_irq s2mpg10_pmic_irqs[] =3D { REGMAP_IRQ_REG(S2MPG10_IRQ_PWR_WARN_CH7, 5, S2MPG10_IRQ_PWR_WARN_CH7_MASK= ), }; =20 +static const struct regmap_irq s2mpg11_irqs[] =3D { + REGMAP_IRQ_REG(S2MPG11_COMMON_IRQ_PMIC, 0, S2MPG11_COMMON_INT_SRC_PMIC), + /* No documentation or other reference for remaining bits */ + REGMAP_IRQ_REG(S2MPG11_COMMON_IRQ_UNUSED, 0, GENMASK(7, 1)), +}; + +static const struct regmap_irq s2mpg11_pmic_irqs[] =3D { + REGMAP_IRQ_REG(S2MPG11_IRQ_PWRONF, 0, S2MPG11_IRQ_PWRONF_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWRONR, 0, S2MPG11_IRQ_PWRONR_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_PIF_TIMEOUT_MIF, 0, S2MPG11_IRQ_PIF_TIMEOUT_MI= F_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_PIF_TIMEOUTS, 0, S2MPG11_IRQ_PIF_TIMEOUTS_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_WTSR, 0, S2MPG11_IRQ_WTSR_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_SPD_ABNORMAL_STOP, 0, S2MPG11_IRQ_SPD_ABNORMAL= _STOP_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_SPD_PARITY_ERR, 0, S2MPG11_IRQ_SPD_PARITY_ERR_= MASK), + + REGMAP_IRQ_REG(S2MPG11_IRQ_140C, 1, S2MPG11_IRQ_INT140C_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_120C, 1, S2MPG11_IRQ_INT120C_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_TSD, 1, S2MPG11_IRQ_TSD_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_WRST, 1, S2MPG11_IRQ_WRST_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_CYCLE_DONE, 1, S2MPG11_IRQ_NTC_CYCLE_DONE_= MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_PMETER_OVERF, 1, S2MPG11_IRQ_PMETER_OVERF_MASK= ), + + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B1S, 2, S2MPG11_IRQ_OCP_B1S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B2S, 2, S2MPG11_IRQ_OCP_B2S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B3S, 2, S2MPG11_IRQ_OCP_B3S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B4S, 2, S2MPG11_IRQ_OCP_B4S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B5S, 2, S2MPG11_IRQ_OCP_B5S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B6S, 2, S2MPG11_IRQ_OCP_B6S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B7S, 2, S2MPG11_IRQ_OCP_B7S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B8S, 2, S2MPG11_IRQ_OCP_B8S_MASK), + + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B9S, 3, S2MPG11_IRQ_OCP_B9S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B10S, 3, S2MPG11_IRQ_OCP_B10S_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_BDS, 3, S2MPG11_IRQ_OCP_BDS_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_BAS, 3, S2MPG11_IRQ_OCP_BAS_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_BBS, 3, S2MPG11_IRQ_OCP_BBS_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_WLWP_ACC, 3, S2MPG11_IRQ_WLWP_ACC_MASK), + REGMAP_IRQ_REG(S2MPG11_IRQ_SPD_SRP_PKT_RST, 3, S2MPG11_IRQ_SPD_SRP_PKT_RS= T_MASK), + + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH0, 4, S2MPG11_IRQ_PWR_WARN_CH0_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH1, 4, S2MPG11_IRQ_PWR_WARN_CH1_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH2, 4, S2MPG11_IRQ_PWR_WARN_CH2_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH3, 4, S2MPG11_IRQ_PWR_WARN_CH3_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH4, 4, S2MPG11_IRQ_PWR_WARN_CH4_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH5, 4, S2MPG11_IRQ_PWR_WARN_CH5_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH6, 4, S2MPG11_IRQ_PWR_WARN_CH6_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH7, 4, S2MPG11_IRQ_PWR_WARN_CH7_MASK= ), + + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH0, 5, S2MPG11_IRQ_NTC_WARN_CH0_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH1, 5, S2MPG11_IRQ_NTC_WARN_CH1_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH2, 5, S2MPG11_IRQ_NTC_WARN_CH2_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH3, 5, S2MPG11_IRQ_NTC_WARN_CH3_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH4, 5, S2MPG11_IRQ_NTC_WARN_CH4_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH5, 5, S2MPG11_IRQ_NTC_WARN_CH5_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH6, 5, S2MPG11_IRQ_NTC_WARN_CH6_MASK= ), + REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH7, 5, S2MPG11_IRQ_NTC_WARN_CH7_MASK= ), +}; + static const struct regmap_irq s2mps11_irqs[] =3D { REGMAP_IRQ_REG(S2MPS11_IRQ_PWRONF, 0, S2MPS11_IRQ_PWRONF_MASK), REGMAP_IRQ_REG(S2MPS11_IRQ_PWRONR, 0, S2MPS11_IRQ_PWRONR_MASK), @@ -186,7 +245,7 @@ static const struct regmap_irq s5m8767_irqs[] =3D { REGMAP_IRQ_REG(S5M8767_IRQ_WTSR, 2, S5M8767_IRQ_WTSR_MASK), }; =20 -/* All S2MPG10 interrupt sources are read-only and don't require clearing = */ +/* All S2MPG1x interrupt sources are read-only and don't require clearing = */ static const struct regmap_irq_chip s2mpg10_irq_chip =3D { .name =3D "s2mpg10", .status_base =3D S2MPG10_COMMON_INT, @@ -205,6 +264,24 @@ static const struct regmap_irq_chip s2mpg10_irq_chip_p= mic =3D { .num_irqs =3D ARRAY_SIZE(s2mpg10_pmic_irqs), }; =20 +static const struct regmap_irq_chip s2mpg11_irq_chip =3D { + .name =3D "s2mpg11", + .status_base =3D S2MPG11_COMMON_INT, + .mask_base =3D S2MPG11_COMMON_INT_MASK, + .num_regs =3D 1, + .irqs =3D s2mpg11_irqs, + .num_irqs =3D ARRAY_SIZE(s2mpg11_irqs), +}; + +static const struct regmap_irq_chip s2mpg11_irq_chip_pmic =3D { + .name =3D "s2mpg11-pmic", + .status_base =3D S2MPG11_PMIC_INT1, + .mask_base =3D S2MPG11_PMIC_INT1M, + .num_regs =3D 6, + .irqs =3D s2mpg11_pmic_irqs, + .num_irqs =3D ARRAY_SIZE(s2mpg11_pmic_irqs), +}; + static const struct regmap_irq_chip s2mps11_irq_chip =3D { .name =3D "s2mps11", .irqs =3D s2mps11_irqs, @@ -303,6 +380,11 @@ static struct regmap_irq_chip_data *sec_irq_init_s2mpg= 1x(struct sec_pmic_dev *se chained_irq_chip =3D &s2mpg10_irq_chip_pmic; chained_pirq =3D S2MPG10_COMMON_IRQ_PMIC; break; + case S2MPG11: + irq_chip =3D &s2mpg11_irq_chip; + chained_irq_chip =3D &s2mpg11_irq_chip_pmic; + chained_pirq =3D S2MPG11_COMMON_IRQ_PMIC; + break; default: return dev_err_ptr_probe(sec_pmic->dev, -EINVAL, "Unsupported device typ= e %d\n", sec_pmic->device_type); @@ -339,6 +421,7 @@ struct regmap_irq_chip_data *sec_irq_init(struct sec_pm= ic_dev *sec_pmic) sec_irq_chip =3D &s2mps14_irq_chip; break; case S2MPG10: + case S2MPG11: return sec_irq_init_s2mpg1x(sec_pmic); case S2MPS11X: sec_irq_chip =3D &s2mps11_irq_chip; diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/c= ore.h index c7c3c8cd8d5f99ef0cc3188e1c3b49031f4750f2..4480c631110a6924bedb2d3a307= a4fa7ddb2c87d 100644 --- a/include/linux/mfd/samsung/core.h +++ b/include/linux/mfd/samsung/core.h @@ -40,6 +40,7 @@ enum sec_device_type { S2DOS05, S2MPA01, S2MPG10, + S2MPG11, S2MPS11X, S2MPS13X, S2MPS14X, diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/ir= q.h index 8402a5f8e18ab62b4bec89541d785442674adee0..6eab95de6fa8376e114dc5b347e= 61552a595331f 100644 --- a/include/linux/mfd/samsung/irq.h +++ b/include/linux/mfd/samsung/irq.h @@ -166,6 +166,111 @@ enum s2mpg10_irq { S2MPG10_IRQ_NR, }; =20 +enum s2mpg11_common_irq { + /* Top-level (common) block */ + S2MPG11_COMMON_IRQ_PMIC, + S2MPG11_COMMON_IRQ_UNUSED, +}; + +enum s2mpg11_irq { + /* PMIC */ + S2MPG11_IRQ_PWRONF, + S2MPG11_IRQ_PWRONR, + S2MPG11_IRQ_PIF_TIMEOUT_MIF, + S2MPG11_IRQ_PIF_TIMEOUTS, + S2MPG11_IRQ_WTSR, + S2MPG11_IRQ_SPD_ABNORMAL_STOP, + S2MPG11_IRQ_SPD_PARITY_ERR, +#define S2MPG11_IRQ_PWRONF_MASK BIT(0) +#define S2MPG11_IRQ_PWRONR_MASK BIT(1) +#define S2MPG11_IRQ_PIF_TIMEOUT_MIF_MASK BIT(3) +#define S2MPG11_IRQ_PIF_TIMEOUTS_MASK BIT(4) +#define S2MPG11_IRQ_WTSR_MASK BIT(5) +#define S2MPG11_IRQ_SPD_ABNORMAL_STOP_MASK BIT(6) +#define S2MPG11_IRQ_SPD_PARITY_ERR_MASK BIT(7) + + S2MPG11_IRQ_140C, + S2MPG11_IRQ_120C, + S2MPG11_IRQ_TSD, + S2MPG11_IRQ_WRST, + S2MPG11_IRQ_NTC_CYCLE_DONE, + S2MPG11_IRQ_PMETER_OVERF, +#define S2MPG11_IRQ_INT140C_MASK BIT(0) +#define S2MPG11_IRQ_INT120C_MASK BIT(1) +#define S2MPG11_IRQ_TSD_MASK BIT(2) +#define S2MPG11_IRQ_WRST_MASK BIT(5) +#define S2MPG11_IRQ_NTC_CYCLE_DONE_MASK BIT(6) +#define S2MPG11_IRQ_PMETER_OVERF_MASK BIT(7) + + S2MPG11_IRQ_OCP_B1S, + S2MPG11_IRQ_OCP_B2S, + S2MPG11_IRQ_OCP_B3S, + S2MPG11_IRQ_OCP_B4S, + S2MPG11_IRQ_OCP_B5S, + S2MPG11_IRQ_OCP_B6S, + S2MPG11_IRQ_OCP_B7S, + S2MPG11_IRQ_OCP_B8S, +#define S2MPG11_IRQ_OCP_B1S_MASK BIT(0) +#define S2MPG11_IRQ_OCP_B2S_MASK BIT(1) +#define S2MPG11_IRQ_OCP_B3S_MASK BIT(2) +#define S2MPG11_IRQ_OCP_B4S_MASK BIT(3) +#define S2MPG11_IRQ_OCP_B5S_MASK BIT(4) +#define S2MPG11_IRQ_OCP_B6S_MASK BIT(5) +#define S2MPG11_IRQ_OCP_B7S_MASK BIT(6) +#define S2MPG11_IRQ_OCP_B8S_MASK BIT(7) + + S2MPG11_IRQ_OCP_B9S, + S2MPG11_IRQ_OCP_B10S, + S2MPG11_IRQ_OCP_BDS, + S2MPG11_IRQ_OCP_BAS, + S2MPG11_IRQ_OCP_BBS, + S2MPG11_IRQ_WLWP_ACC, + S2MPG11_IRQ_SPD_SRP_PKT_RST, +#define S2MPG11_IRQ_OCP_B9S_MASK BIT(0) +#define S2MPG11_IRQ_OCP_B10S_MASK BIT(1) +#define S2MPG11_IRQ_OCP_BDS_MASK BIT(2) +#define S2MPG11_IRQ_OCP_BAS_MASK BIT(3) +#define S2MPG11_IRQ_OCP_BBS_MASK BIT(4) +#define S2MPG11_IRQ_WLWP_ACC_MASK BIT(5) +#define S2MPG11_IRQ_SPD_SRP_PKT_RST_MASK BIT(7) + + S2MPG11_IRQ_PWR_WARN_CH0, + S2MPG11_IRQ_PWR_WARN_CH1, + S2MPG11_IRQ_PWR_WARN_CH2, + S2MPG11_IRQ_PWR_WARN_CH3, + S2MPG11_IRQ_PWR_WARN_CH4, + S2MPG11_IRQ_PWR_WARN_CH5, + S2MPG11_IRQ_PWR_WARN_CH6, + S2MPG11_IRQ_PWR_WARN_CH7, +#define S2MPG11_IRQ_PWR_WARN_CH0_MASK BIT(0) +#define S2MPG11_IRQ_PWR_WARN_CH1_MASK BIT(1) +#define S2MPG11_IRQ_PWR_WARN_CH2_MASK BIT(2) +#define S2MPG11_IRQ_PWR_WARN_CH3_MASK BIT(3) +#define S2MPG11_IRQ_PWR_WARN_CH4_MASK BIT(4) +#define S2MPG11_IRQ_PWR_WARN_CH5_MASK BIT(5) +#define S2MPG11_IRQ_PWR_WARN_CH6_MASK BIT(6) +#define S2MPG11_IRQ_PWR_WARN_CH7_MASK BIT(7) + + S2MPG11_IRQ_NTC_WARN_CH0, + S2MPG11_IRQ_NTC_WARN_CH1, + S2MPG11_IRQ_NTC_WARN_CH2, + S2MPG11_IRQ_NTC_WARN_CH3, + S2MPG11_IRQ_NTC_WARN_CH4, + S2MPG11_IRQ_NTC_WARN_CH5, + S2MPG11_IRQ_NTC_WARN_CH6, + S2MPG11_IRQ_NTC_WARN_CH7, +#define S2MPG11_IRQ_NTC_WARN_CH0_MASK BIT(0) +#define S2MPG11_IRQ_NTC_WARN_CH1_MASK BIT(1) +#define S2MPG11_IRQ_NTC_WARN_CH2_MASK BIT(2) +#define S2MPG11_IRQ_NTC_WARN_CH3_MASK BIT(3) +#define S2MPG11_IRQ_NTC_WARN_CH4_MASK BIT(4) +#define S2MPG11_IRQ_NTC_WARN_CH5_MASK BIT(5) +#define S2MPG11_IRQ_NTC_WARN_CH6_MASK BIT(6) +#define S2MPG11_IRQ_NTC_WARN_CH7_MASK BIT(7) + + S2MPG11_IRQ_NR, +}; + enum s2mps11_irq { S2MPS11_IRQ_PWRONF, S2MPS11_IRQ_PWRONR, diff --git a/include/linux/mfd/samsung/s2mpg11.h b/include/linux/mfd/samsun= g/s2mpg11.h new file mode 100644 index 0000000000000000000000000000000000000000..66daa3bafa6e55eef5831b50143= e8d580bb43f72 --- /dev/null +++ b/include/linux/mfd/samsung/s2mpg11.h @@ -0,0 +1,434 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2015 Samsung Electronics + * Copyright 2020 Google Inc + * Copyright 2025 Linaro Ltd. + */ + +#ifndef __LINUX_MFD_S2MPG11_H +#define __LINUX_MFD_S2MPG11_H + +/* Common registers (type 0x000) */ +enum s2mpg11_common_reg { + S2MPG11_COMMON_CHIPID, + S2MPG11_COMMON_INT, + S2MPG11_COMMON_INT_MASK, + S2MPG11_COMMON_SPD_CTRL1 =3D 0x0a, + S2MPG11_COMMON_SPD_CTRL2, + S2MPG11_COMMON_SPD_CTRL3, + S2MPG11_COMMON_MON1SEL =3D 0x1a, + S2MPG11_COMMON_MON2SEL, + S2MPG11_COMMON_MONR, + S2MPG11_COMMON_DEBUG_CTRL1, + S2MPG11_COMMON_DEBUG_CTRL2, + S2MPG11_COMMON_DEBUG_CTRL3, + S2MPG11_COMMON_DEBUG_CTRL4, + S2MPG11_COMMON_DEBUG_CTRL5, + S2MPG11_COMMON_DEBUG_CTRL6, + S2MPG11_COMMON_TEST_MODE1, + S2MPG11_COMMON_SPD_DEBUG1, + S2MPG11_COMMON_SPD_DEBUG2, + S2MPG11_COMMON_SPD_DEBUG3, + S2MPG11_COMMON_SPD_DEBUG4, +}; + +/* For S2MPG11_COMMON_INT and S2MPG11_COMMON_INT_MASK */ +#define S2MPG11_COMMON_INT_SRC GENMASK(2, 0) +#define S2MPG11_COMMON_INT_SRC_PMIC BIT(0) + +/* PMIC registers (type 0x100) */ +enum s2mpg11_pmic_reg { + S2MPG11_PMIC_INT1, + S2MPG11_PMIC_INT2, + S2MPG11_PMIC_INT3, + S2MPG11_PMIC_INT4, + S2MPG11_PMIC_INT5, + S2MPG11_PMIC_INT6, + S2MPG11_PMIC_INT1M, + S2MPG11_PMIC_INT2M, + S2MPG11_PMIC_INT3M, + S2MPG11_PMIC_INT4M, + S2MPG11_PMIC_INT5M, + S2MPG11_PMIC_INT6M, + S2MPG11_PMIC_STATUS1, + S2MPG11_PMIC_OFFSRC, + S2MPG11_PMIC_COMMON_CTRL1, + S2MPG11_PMIC_COMMON_CTRL2, + S2MPG11_PMIC_COMMON_CTRL3, + S2MPG11_PMIC_MIMICKING_CTRL, + S2MPG11_PMIC_B1S_CTRL, + S2MPG11_PMIC_B1S_OUT1, + S2MPG11_PMIC_B1S_OUT2, + S2MPG11_PMIC_B2S_CTRL, + S2MPG11_PMIC_B2S_OUT1, + S2MPG11_PMIC_B2S_OUT2, + S2MPG11_PMIC_B3S_CTRL, + S2MPG11_PMIC_B3S_OUT1, + S2MPG11_PMIC_B3S_OUT2, + S2MPG11_PMIC_B4S_CTRL, + S2MPG11_PMIC_B4S_OUT, + S2MPG11_PMIC_B5S_CTRL, + S2MPG11_PMIC_B5S_OUT, + S2MPG11_PMIC_B6S_CTRL, + S2MPG11_PMIC_B6S_OUT1, + S2MPG11_PMIC_B6S_OUT2, + S2MPG11_PMIC_B7S_CTRL, + S2MPG11_PMIC_B7S_OUT1, + S2MPG11_PMIC_B7S_OUT2, + S2MPG11_PMIC_B8S_CTRL, + S2MPG11_PMIC_B8S_OUT1, + S2MPG11_PMIC_B8S_OUT2, + S2MPG11_PMIC_B9S_CTRL, + S2MPG11_PMIC_B9S_OUT1, + S2MPG11_PMIC_B9S_OUT2, + S2MPG11_PMIC_B10S_CTRL, + S2MPG11_PMIC_B10S_OUT, + S2MPG11_PMIC_BUCKD_CTRL, + S2MPG11_PMIC_BUCKD_OUT, + S2MPG11_PMIC_BUCKA_CTRL, + S2MPG11_PMIC_BUCKA_OUT, + S2MPG11_PMIC_BB_CTRL, + S2MPG11_PMIC_BB_OUT1, + S2MPG11_PMIC_BB_OUT2, + S2MPG11_PMIC_BUCK1S_USONIC, + S2MPG11_PMIC_BUCK2S_USONIC, + S2MPG11_PMIC_BUCK3S_USONIC, + S2MPG11_PMIC_BUCK4S_USONIC, + S2MPG11_PMIC_BUCK5S_USONIC, + S2MPG11_PMIC_BUCK6S_USONIC, + S2MPG11_PMIC_BUCK7S_USONIC, + S2MPG11_PMIC_BUCK8S_USONIC, + S2MPG11_PMIC_BUCK9S_USONIC, + S2MPG11_PMIC_BUCK10S_USONIC, + S2MPG11_PMIC_BUCKD_USONIC, + S2MPG11_PMIC_BUCKA_USONIC, + S2MPG11_PMIC_BB_USONIC, + S2MPG11_PMIC_L1S_CTRL1, + S2MPG11_PMIC_L1S_CTRL2, + S2MPG11_PMIC_L2S_CTRL1, + S2MPG11_PMIC_L2S_CTRL2, + S2MPG11_PMIC_L3S_CTRL, + S2MPG11_PMIC_L4S_CTRL, + S2MPG11_PMIC_L5S_CTRL, + S2MPG11_PMIC_L6S_CTRL, + S2MPG11_PMIC_L7S_CTRL, + S2MPG11_PMIC_L8S_CTRL, + S2MPG11_PMIC_L9S_CTRL, + S2MPG11_PMIC_L10S_CTRL, + S2MPG11_PMIC_L11S_CTRL, + S2MPG11_PMIC_L12S_CTRL, + S2MPG11_PMIC_L13S_CTRL, + S2MPG11_PMIC_L14S_CTRL, + S2MPG11_PMIC_L15S_CTRL, + S2MPG11_PMIC_LDO_CTRL1, + S2MPG11_PMIC_LDO_DSCH1, + S2MPG11_PMIC_LDO_DSCH2, + S2MPG11_PMIC_DVS_RAMP1, + S2MPG11_PMIC_DVS_RAMP2, + S2MPG11_PMIC_DVS_RAMP3, + S2MPG11_PMIC_DVS_RAMP4, + S2MPG11_PMIC_DVS_RAMP5, + S2MPG11_PMIC_DVS_RAMP6, + /* Nothing @ 0x5a */ + S2MPG11_PMIC_DVS_SYNC_CTRL1 =3D 0x5c, + S2MPG11_PMIC_DVS_SYNC_CTRL2, + S2MPG11_PMIC_OFF_CTRL1, + S2MPG11_PMIC_OFF_CTRL2, + S2MPG11_PMIC_OFF_CTRL3, + S2MPG11_PMIC_SEQ_CTRL1, + S2MPG11_PMIC_SEQ_CTRL2, + S2MPG11_PMIC_SEQ_CTRL3, + S2MPG11_PMIC_SEQ_CTRL4, + S2MPG11_PMIC_SEQ_CTRL5, + S2MPG11_PMIC_SEQ_CTRL6, + S2MPG11_PMIC_SEQ_CTRL7, + S2MPG11_PMIC_SEQ_CTRL8, + S2MPG11_PMIC_SEQ_CTRL9, + S2MPG11_PMIC_SEQ_CTRL10, + S2MPG11_PMIC_SEQ_CTRL11, + S2MPG11_PMIC_SEQ_CTRL12, + S2MPG11_PMIC_SEQ_CTRL13, + S2MPG11_PMIC_SEQ_CTRL14, + S2MPG11_PMIC_SEQ_CTRL15, + S2MPG11_PMIC_SEQ_CTRL16, + S2MPG11_PMIC_SEQ_CTRL17, + S2MPG11_PMIC_SEQ_CTRL18, + S2MPG11_PMIC_SEQ_CTRL19, + S2MPG11_PMIC_SEQ_CTRL20, + S2MPG11_PMIC_SEQ_CTRL21, + S2MPG11_PMIC_SEQ_CTRL22, + S2MPG11_PMIC_SEQ_CTRL23, + S2MPG11_PMIC_SEQ_CTRL24, + S2MPG11_PMIC_SEQ_CTRL25, + S2MPG11_PMIC_SEQ_CTRL26, + S2MPG11_PMIC_SEQ_CTRL27, + S2MPG11_PMIC_OFF_SEQ_CTRL1, + S2MPG11_PMIC_OFF_SEQ_CTRL2, + S2MPG11_PMIC_OFF_SEQ_CTRL3, + S2MPG11_PMIC_OFF_SEQ_CTRL4, + S2MPG11_PMIC_OFF_SEQ_CTRL5, + S2MPG11_PMIC_OFF_SEQ_CTRL6, + S2MPG11_PMIC_OFF_SEQ_CTRL7, + S2MPG11_PMIC_OFF_SEQ_CTRL8, + S2MPG11_PMIC_OFF_SEQ_CTRL9, + S2MPG11_PMIC_OFF_SEQ_CTRL10, + S2MPG11_PMIC_OFF_SEQ_CTRL11, + S2MPG11_PMIC_OFF_SEQ_CTRL12, + S2MPG11_PMIC_OFF_SEQ_CTRL13, + S2MPG11_PMIC_OFF_SEQ_CTRL14, + S2MPG11_PMIC_OFF_SEQ_CTRL15, + S2MPG11_PMIC_OFF_SEQ_CTRL16, + S2MPG11_PMIC_OFF_SEQ_CTRL17, + S2MPG11_PMIC_PCTRLSEL1, + S2MPG11_PMIC_PCTRLSEL2, + S2MPG11_PMIC_PCTRLSEL3, + S2MPG11_PMIC_PCTRLSEL4, + S2MPG11_PMIC_PCTRLSEL5, + S2MPG11_PMIC_PCTRLSEL6, + S2MPG11_PMIC_DCTRLSEL1, + S2MPG11_PMIC_DCTRLSEL2, + S2MPG11_PMIC_DCTRLSEL3, + S2MPG11_PMIC_DCTRLSEL4, + S2MPG11_PMIC_DCTRLSEL5, + S2MPG11_PMIC_GPIO_CTRL1, + S2MPG11_PMIC_GPIO_CTRL2, + S2MPG11_PMIC_GPIO_CTRL3, + S2MPG11_PMIC_GPIO_CTRL4, + S2MPG11_PMIC_GPIO_CTRL5, + S2MPG11_PMIC_GPIO_CTRL6, + S2MPG11_PMIC_GPIO_CTRL7, + S2MPG11_PMIC_B2S_OCP_WARN, + S2MPG11_PMIC_B2S_OCP_WARN_X, + S2MPG11_PMIC_B2S_OCP_WARN_Y, + S2MPG11_PMIC_B2S_OCP_WARN_Z, + S2MPG11_PMIC_B2S_SOFT_OCP_WARN, + S2MPG11_PMIC_B2S_SOFT_OCP_WARN_X, + S2MPG11_PMIC_B2S_SOFT_OCP_WARN_Y, + S2MPG11_PMIC_B2S_SOFT_OCP_WARN_Z, + S2MPG11_PMIC_BUCK_OCP_EN1, + S2MPG11_PMIC_BUCK_OCP_EN2, + S2MPG11_PMIC_BUCK_OCP_PD_EN1, + S2MPG11_PMIC_BUCK_OCP_PD_EN2, + S2MPG11_PMIC_BUCK_OCP_CTRL1, + S2MPG11_PMIC_BUCK_OCP_CTRL2, + S2MPG11_PMIC_BUCK_OCP_CTRL3, + S2MPG11_PMIC_BUCK_OCP_CTRL4, + S2MPG11_PMIC_BUCK_OCP_CTRL5, + S2MPG11_PMIC_BUCK_OCP_CTRL6, + S2MPG11_PMIC_BUCK_OCP_CTRL7, + S2MPG11_PMIC_PIF_CTRL, + S2MPG11_PMIC_BUCK_HR_MODE1, + S2MPG11_PMIC_BUCK_HR_MODE2, + S2MPG11_PMIC_FAULTOUT_CTRL, + S2MPG11_PMIC_LDO_SENSE1, + S2MPG11_PMIC_LDO_SENSE2, +}; + +/* For S2MPG11_PMIC_PCTRLSELx */ +#define S2MPG11_PCTRLSEL_PWREN 0x1 /* PWREN pin */ +#define S2MPG11_PCTRLSEL_PWREN_TRG 0x2 /* PWREN_TRG bit in MIMICKING= _CTRL */ +#define S2MPG11_PCTRLSEL_PWREN_MIF 0x3 /* PWREN_MIF pin */ +#define S2MPG11_PCTRLSEL_PWREN_MIF_TRG 0x4 /* PWREN_MIF_TRG bit in MIMIC= KING_CTRL */ +#define S2MPG11_PCTRLSEL_AP_ACTIVE_N 0x5 /* ~AP_ACTIVE_N pin */ +#define S2MPG11_PCTRLSEL_AP_ACTIVE_N_TRG 0x6 /* ~AP_ACTIVE_N_TRG bit in MI= MICKING_CTRL */ +#define S2MPG11_PCTRLSEL_G3D_EN 0x7 /* G3D_EN pin */ +#define S2MPG11_PCTRLSEL_G3D_EN2 0x8 /* G3D_EN & ~AP_ACTIVE_N pins= */ +#define S2MPG11_PCTRLSEL_AOC_VDD 0x9 /* AOC_VDD pin */ +#define S2MPG11_PCTRLSEL_AOC_RET 0xa /* AOC_RET pin */ +#define S2MPG11_PCTRLSEL_UFS_EN 0xb /* UFS_EN pin */ +#define S2MPG11_PCTRLSEL_LDO13S_EN 0xc /* VLDO13S_EN pin */ + +/* Meter registers (type 0xa00) */ +enum s2mpg11_meter_reg { + S2MPG11_METER_CTRL1, + S2MPG11_METER_CTRL2, + S2MPG11_METER_CTRL3, + S2MPG11_METER_CTRL4, + S2MPG11_METER_CTRL5, + S2MPG11_METER_BUCKEN1, + S2MPG11_METER_BUCKEN2, + S2MPG11_METER_MUXSEL0, + S2MPG11_METER_MUXSEL1, + S2MPG11_METER_MUXSEL2, + S2MPG11_METER_MUXSEL3, + S2MPG11_METER_MUXSEL4, + S2MPG11_METER_MUXSEL5, + S2MPG11_METER_MUXSEL6, + S2MPG11_METER_MUXSEL7, + S2MPG11_METER_LPF_C0_0, + S2MPG11_METER_LPF_C0_1, + S2MPG11_METER_LPF_C0_2, + S2MPG11_METER_LPF_C0_3, + S2MPG11_METER_LPF_C0_4, + S2MPG11_METER_LPF_C0_5, + S2MPG11_METER_LPF_C0_6, + S2MPG11_METER_LPF_C0_7, + S2MPG11_METER_NTC_LPF_C0_0, + S2MPG11_METER_NTC_LPF_C0_1, + S2MPG11_METER_NTC_LPF_C0_2, + S2MPG11_METER_NTC_LPF_C0_3, + S2MPG11_METER_NTC_LPF_C0_4, + S2MPG11_METER_NTC_LPF_C0_5, + S2MPG11_METER_NTC_LPF_C0_6, + S2MPG11_METER_NTC_LPF_C0_7, + S2MPG11_METER_PWR_WARN0, + S2MPG11_METER_PWR_WARN1, + S2MPG11_METER_PWR_WARN2, + S2MPG11_METER_PWR_WARN3, + S2MPG11_METER_PWR_WARN4, + S2MPG11_METER_PWR_WARN5, + S2MPG11_METER_PWR_WARN6, + S2MPG11_METER_PWR_WARN7, + S2MPG11_METER_NTC_L_WARN0, + S2MPG11_METER_NTC_L_WARN1, + S2MPG11_METER_NTC_L_WARN2, + S2MPG11_METER_NTC_L_WARN3, + S2MPG11_METER_NTC_L_WARN4, + S2MPG11_METER_NTC_L_WARN5, + S2MPG11_METER_NTC_L_WARN6, + S2MPG11_METER_NTC_L_WARN7, + S2MPG11_METER_NTC_H_WARN0, + S2MPG11_METER_NTC_H_WARN1, + S2MPG11_METER_NTC_H_WARN2, + S2MPG11_METER_NTC_H_WARN3, + S2MPG11_METER_NTC_H_WARN4, + S2MPG11_METER_NTC_H_WARN5, + S2MPG11_METER_NTC_H_WARN6, + S2MPG11_METER_NTC_H_WARN7, + S2MPG11_METER_PWR_HYS1, + S2MPG11_METER_PWR_HYS2, + S2MPG11_METER_PWR_HYS3, + S2MPG11_METER_PWR_HYS4, + S2MPG11_METER_NTC_HYS1, + S2MPG11_METER_NTC_HYS2, + S2MPG11_METER_NTC_HYS3, + S2MPG11_METER_NTC_HYS4, + /* Nothing @ 0x3f */ + S2MPG11_METER_ACC_DATA_CH0_1 =3D 0x40, + S2MPG11_METER_ACC_DATA_CH0_2, + S2MPG11_METER_ACC_DATA_CH0_3, + S2MPG11_METER_ACC_DATA_CH0_4, + S2MPG11_METER_ACC_DATA_CH0_5, + S2MPG11_METER_ACC_DATA_CH0_6, + S2MPG11_METER_ACC_DATA_CH1_1, + S2MPG11_METER_ACC_DATA_CH1_2, + S2MPG11_METER_ACC_DATA_CH1_3, + S2MPG11_METER_ACC_DATA_CH1_4, + S2MPG11_METER_ACC_DATA_CH1_5, + S2MPG11_METER_ACC_DATA_CH1_6, + S2MPG11_METER_ACC_DATA_CH2_1, + S2MPG11_METER_ACC_DATA_CH2_2, + S2MPG11_METER_ACC_DATA_CH2_3, + S2MPG11_METER_ACC_DATA_CH2_4, + S2MPG11_METER_ACC_DATA_CH2_5, + S2MPG11_METER_ACC_DATA_CH2_6, + S2MPG11_METER_ACC_DATA_CH3_1, + S2MPG11_METER_ACC_DATA_CH3_2, + S2MPG11_METER_ACC_DATA_CH3_3, + S2MPG11_METER_ACC_DATA_CH3_4, + S2MPG11_METER_ACC_DATA_CH3_5, + S2MPG11_METER_ACC_DATA_CH3_6, + S2MPG11_METER_ACC_DATA_CH4_1, + S2MPG11_METER_ACC_DATA_CH4_2, + S2MPG11_METER_ACC_DATA_CH4_3, + S2MPG11_METER_ACC_DATA_CH4_4, + S2MPG11_METER_ACC_DATA_CH4_5, + S2MPG11_METER_ACC_DATA_CH4_6, + S2MPG11_METER_ACC_DATA_CH5_1, + S2MPG11_METER_ACC_DATA_CH5_2, + S2MPG11_METER_ACC_DATA_CH5_3, + S2MPG11_METER_ACC_DATA_CH5_4, + S2MPG11_METER_ACC_DATA_CH5_5, + S2MPG11_METER_ACC_DATA_CH5_6, + S2MPG11_METER_ACC_DATA_CH6_1, + S2MPG11_METER_ACC_DATA_CH6_2, + S2MPG11_METER_ACC_DATA_CH6_3, + S2MPG11_METER_ACC_DATA_CH6_4, + S2MPG11_METER_ACC_DATA_CH6_5, + S2MPG11_METER_ACC_DATA_CH6_6, + S2MPG11_METER_ACC_DATA_CH7_1, + S2MPG11_METER_ACC_DATA_CH7_2, + S2MPG11_METER_ACC_DATA_CH7_3, + S2MPG11_METER_ACC_DATA_CH7_4, + S2MPG11_METER_ACC_DATA_CH7_5, + S2MPG11_METER_ACC_DATA_CH7_6, + S2MPG11_METER_ACC_COUNT_1, + S2MPG11_METER_ACC_COUNT_2, + S2MPG11_METER_ACC_COUNT_3, + S2MPG11_METER_LPF_DATA_CH0_1, + S2MPG11_METER_LPF_DATA_CH0_2, + S2MPG11_METER_LPF_DATA_CH0_3, + S2MPG11_METER_LPF_DATA_CH1_1, + S2MPG11_METER_LPF_DATA_CH1_2, + S2MPG11_METER_LPF_DATA_CH1_3, + S2MPG11_METER_LPF_DATA_CH2_1, + S2MPG11_METER_LPF_DATA_CH2_2, + S2MPG11_METER_LPF_DATA_CH2_3, + S2MPG11_METER_LPF_DATA_CH3_1, + S2MPG11_METER_LPF_DATA_CH3_2, + S2MPG11_METER_LPF_DATA_CH3_3, + S2MPG11_METER_LPF_DATA_CH4_1, + S2MPG11_METER_LPF_DATA_CH4_2, + S2MPG11_METER_LPF_DATA_CH4_3, + S2MPG11_METER_LPF_DATA_CH5_1, + S2MPG11_METER_LPF_DATA_CH5_2, + S2MPG11_METER_LPF_DATA_CH5_3, + S2MPG11_METER_LPF_DATA_CH6_1, + S2MPG11_METER_LPF_DATA_CH6_2, + S2MPG11_METER_LPF_DATA_CH6_3, + S2MPG11_METER_LPF_DATA_CH7_1, + S2MPG11_METER_LPF_DATA_CH7_2, + S2MPG11_METER_LPF_DATA_CH7_3, + /* Nothing @ 0x8b 0x8c */ + S2MPG11_METER_LPF_DATA_NTC0_1 =3D 0x8d, + S2MPG11_METER_LPF_DATA_NTC0_2, + S2MPG11_METER_LPF_DATA_NTC1_1, + S2MPG11_METER_LPF_DATA_NTC1_2, + S2MPG11_METER_LPF_DATA_NTC2_1, + S2MPG11_METER_LPF_DATA_NTC2_2, + S2MPG11_METER_LPF_DATA_NTC3_1, + S2MPG11_METER_LPF_DATA_NTC3_2, + S2MPG11_METER_LPF_DATA_NTC4_1, + S2MPG11_METER_LPF_DATA_NTC4_2, + S2MPG11_METER_LPF_DATA_NTC5_1, + S2MPG11_METER_LPF_DATA_NTC5_2, + S2MPG11_METER_LPF_DATA_NTC6_1, + S2MPG11_METER_LPF_DATA_NTC6_2, + S2MPG11_METER_LPF_DATA_NTC7_1, + S2MPG11_METER_LPF_DATA_NTC7_2, +}; + +/* S2MPG11 regulator IDs */ +enum s2mpg11_regulators { + S2MPG11_BUCKBOOST, + S2MPG11_BUCK1, + S2MPG11_BUCK2, + S2MPG11_BUCK3, + S2MPG11_BUCK4, + S2MPG11_BUCK5, + S2MPG11_BUCK6, + S2MPG11_BUCK7, + S2MPG11_BUCK8, + S2MPG11_BUCK9, + S2MPG11_BUCK10, + S2MPG11_BUCKD, + S2MPG11_BUCKA, + S2MPG11_LDO1, + S2MPG11_LDO2, + S2MPG11_LDO3, + S2MPG11_LDO4, + S2MPG11_LDO5, + S2MPG11_LDO6, + S2MPG11_LDO7, + S2MPG11_LDO8, + S2MPG11_LDO9, + S2MPG11_LDO10, + S2MPG11_LDO11, + S2MPG11_LDO12, + S2MPG11_LDO13, + S2MPG11_LDO14, + S2MPG11_LDO15, + S2MPG11_REGULATOR_MAX, +}; + +#endif /* __LINUX_MFD_S2MPG11_H */ --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 2026 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 168A932BF3D for ; Mon, 5 Jan 2026 09:01:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603712; cv=none; b=d1ynkGvtaPEKaRu5HFMNKgPpKTIvZizGwGKqadtBUK1ujwQttoWZFibRHeXHFV9+w7PpUx7qNF0gOq9tzHWw7uEhjJSVgwh2hR1iX5jNwru5ffzaugFWnfHnes23Uq8PwEr3Q63gfyKnLdXK6gs9eJr+VJcC/qP+uunQ1lFt0PA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603712; c=relaxed/simple; bh=ZETZajMfvd5Cj7AwABnaIbo8YXi84LCz2hhmRM9mv6I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Bj0b+ymuQk/LxBwtaQ6eqFzXf2mXgNh7SC0u4yf9C8mved+Jztsj5A2ILaZisSzDiorZmcbNcBpOr39SMHIsbA62xy62/cmr8B4XINFzD6LfTUCEmlel9Hi6FzQiybEkK7uKVugxYRLkCNrefy6mRx4yDvo887tW0usPTbI8Yyg= 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=Kpym1xiZ; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Kpym1xiZ" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-b73161849e1so2657641266b.2 for ; Mon, 05 Jan 2026 01:01:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603706; x=1768208506; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ydYm6Jwl4gZ6fxTGOTSVWGkOP7GwrBDA3cOK9JtPOwA=; b=Kpym1xiZuf7cScimQeO1H/x48ruE1eGm8QYvaGfgU2fXZxLzpuuOnFhJ+1EBs1xjzP QaujlZYVxGg/h/y1JugiVeVo0CDtvZXhY0qtVWGOjgF3UQxuCnUtDwGBJWbQzIakKeZx daYKOAT0fvh007ZaiNjCyOdYJyMOgXg/kVcGqJdwtO1J8ZF8jT56kt+N5eBRw2nNaTQ3 76xF3vFnHnqcKuMs/wIIqlhpQab1w7tfaCSBcfE4Ca2z2UCdRIF4uocLLsTxmp8y4iwf 22WB9wHzgDq7tpJ0yGPJQK9sVVhVJCEVyy/BfBigZxj2rBvVX41owHbMBcyuZJOmZehp 2GnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603706; x=1768208506; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ydYm6Jwl4gZ6fxTGOTSVWGkOP7GwrBDA3cOK9JtPOwA=; b=IsfmW5QBIcQQqN5VQg+t3at0vEtn527lr0f6ibWhS4U1nn48O1clYQBsFqAsq0Ebyv kHg5ndjTiwxj2QhojKuQp9Xrl9ZheNRXRzpmp9A+kA08IKoan7XEYxG+VdKIWE2aLo7T hqCKSw8JOnyc1Znco7aZJMhfFbNM6psmmkZl/jnAjJC2PsadWD5KAHiXTV7b9Qy5VxDm Yy0cpyZlB2+CE7q3s1KmdoCZiS0XUJ0DXvLimRhd2euz7m6aD0H6CG5wttcxKe/Pg2x5 yqhgsq2VaygWgIfWGHniBPIuBeEiGNkyqnFob3byHxmLUZlMqaqXm8fYTlR6sQQdQSCE +KGw== X-Forwarded-Encrypted: i=1; AJvYcCWGtZxESVold8V1L7H8M73tsk3TpZuBkZ1jZhfDn92NWmmBr6qzGSgIrZhL+a2LopyAid2j5krvhb1ZFq0=@vger.kernel.org X-Gm-Message-State: AOJu0Yw48vJbDuasWawLbSMMI+l6lw8u3GuHT0NdTnyAlMiZUUIB8aqj eKQVywP+7Jq3HjvSV4JHWjd+aeUv47aMjnbbC/oRRjceM6gC0uGplnu2CCGwBQjSczg= X-Gm-Gg: AY/fxX7h9hKSZCkfFZuoQwApDqlERsWqvqZRv1tzJHdUSdT+av2zJxdgLfIa9bOrl8c q0yFNQ1wkrMJ5G/dNCqXW4PtLtE4D2CGRhQAf84ZNATy9XUtGQQCrlPTRZBeJDULASnRtXV9YoP ddBa8qz8JkYD1lz0H+62uOhp7dsrkoh/aEBFsF92WYSCHvIMGRTL8pApxI2iidkaOX5+wpYcGCd RyBgm1HbgtTbYgkryladNRplxb3oBO8II5+052+wYQ4QfJR7WwVvQtu4Yz53Z64yei1+yVhCea3 +wHMti0LispaMXk2cJqhQigKsh/u8YsdFLBbmWDLqCoKn/IoanSlNNJex/MGZ/uwcfe6QPGTryh LBmFLCMQC1qzxvWIWLUQCRwGxkGHFkjys8nmlRwY+dwTJdiD6dMM7jbORlYg6nKZV5paF3jKaVI +k7XTx5K2ruoZyxVbYGLYSXn67V0laKf7qxtBlPTjzeIb/EwDcqKoNwswrx23Bjy2MnfvFOlSbg 73CZQ== X-Google-Smtp-Source: AGHT+IHlDkTLEXnDdmXJOAB496ZocW/7AWPPvHl6kR9niuqDxJVFfo22iK/G7e68AW5rLvwMIepbdQ== X-Received: by 2002:a17:906:6a1d:b0:b79:f8ae:a893 with SMTP id a640c23a62f3a-b803719d4a1mr4700447566b.49.1767603705564; Mon, 05 Jan 2026 01:01: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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:45 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:46 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-10-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 REGULATOR_LINEAR_VRANGE is similar to REGULATOR_LINEAR_RANGE, but allows a more natural declaration of a voltage range for a regulator, in that it expects the minimum and maximum values as voltages rather than as selectors. Using voltages arguably makes this macro easier to use by drivers and code using it can become easier to read compared to REGULATOR_LINEAR_RANGE. Signed-off-by: Andr=C3=A9 Draszik --- While this commit doesn't introduce any users, the upcoming s2mpg10 and s2mpg11 drivers are using it. v3: - new patch --- include/linux/regulator/driver.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/dri= ver.h index 978cf593b6624228fe1fd9c2a3e186b53ef172f8..977755db64c6dfaea7246067eab= 0d9a2971caa01 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -53,6 +53,11 @@ enum regulator_detection_severity { #define REGULATOR_LINEAR_RANGE(_min_uV, _min_sel, _max_sel, _step_uV) \ LINEAR_RANGE(_min_uV, _min_sel, _max_sel, _step_uV) =20 +/* Initialize struct linear_range using voltages, not selectors */ +#define REGULATOR_LINEAR_VRANGE(_offs_uV, _min_uV, _max_uV, _step_uV) \ + LINEAR_RANGE(_min_uV, ((_min_uV) - (_offs_uV)) / (_step_uV), \ + ((_max_uV) - (_offs_uV)) / (_step_uV), _step_uV) + /** * struct regulator_ops - regulator operations. * --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 2026 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.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 99A6632BF49 for ; Mon, 5 Jan 2026 09:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603713; cv=none; b=Lc3jFaqQM+GqQqKJyFs6jp+KGlOdgtQt8LZA+wptmg1+IPTiP3H7uzl5V6id3hnnIkDZopNrl8/XnV62wCp/Gcjun0Fset4gd4Yir/HbeovJSda9Xn5ExHp/hCxYpNwSvlToqJsqkmsx99RhYBssR7yk4krGIg4jQ3DaK0kGYjQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603713; c=relaxed/simple; bh=6XxroTSX6ceg285T/QjRgJPmV5ju4e9igmyPsFQygJ0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y2t1d7lUztcGeg+he1jGt2TZjD4C+f0tztUlgBlasd+FpLUjYGNVZqUo1PaYQCqvtFhN/C81756kU5Fg2WGZrtmPmpOEKbGZl+B9a6fFBqBdcV1Wi5ncnCTpsFj+HOd+9PKglIXQdcwLtLMAi7wzhXo6v02emWjhbJ8mISl/OIo= 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=ScigQ+9p; arc=none smtp.client-ip=209.85.218.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="ScigQ+9p" Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-b83122f9d78so1190875766b.0 for ; Mon, 05 Jan 2026 01:01:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603706; x=1768208506; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=10d9MioQ6PzKJr2vkHmOG0REtU2UfuxyvJCr4xa57iE=; b=ScigQ+9pMifAw9W8DMfDGBzMdlpwmoLb1+sNTbTkpCOIDVI2GE/S003niyR/BJtQSv 6p/MhFEhIcR2GLTGwYXtK/9Aalc/nCoTXaEpc4mQtASS1o4gq8ns4wRrmKtJKmEgdPX0 A6FlWtoqhgv2nuxARWh1yWjAiAHeyyydLA864oLP/GvZCMQwCA9QQGn89enbovn4vO8b cCxBIRzZB0e+b7L9a0P5FUeE7j45CMq2/gpVM7Vau6ytS2aynJPyhfhAYlqyHSKlvbRP +NTZozWVf8P1Y2ZReRRr/vJPohxI/g1VL/uoKSJCWITKgx5h/gry3w7xchdPUsgvSCLC WnHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603706; x=1768208506; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=10d9MioQ6PzKJr2vkHmOG0REtU2UfuxyvJCr4xa57iE=; b=YXRbvjInqkxg+swKPrtpU4Ua5D/5KCYkdpRIe0AvFLo8mXyfyvqnIg2dO1mjZdBirM 1YpqGuz6Ef4VpGJSvMS8jq6GlJMOmekKHgrO1ROz13adjImOGWEczcO7gX1EK3TGf6fa pjcGDCtfjrMZH9RAfoAr7jBBe2XrHgWufV6CsNOqRHLIG7foN+smrNYmAj/jBBT/3XZk YyAmIpUI+JhD2wGJwRRccrHbV0A3uAYki9mglpgXsGjXM/4nsfqZxroQX0xQlEb4L1Kb uHNqegEGN1jKwfIhgL90GgNcxoetzjZ62WRNKClHecp+lVxMRJPo64CIVj6km6vYh7iC QinA== X-Forwarded-Encrypted: i=1; AJvYcCVMcmnUHmtBQCH4Z0CsMhFdnz8EbQ6I0b90LiQELcBw9acuJwKm9vouq2V6oYTraNCaY87ogZ1DXQVQcn4=@vger.kernel.org X-Gm-Message-State: AOJu0Yx8Nk3B3vudp4WMGu49tL5KHwtWcLUkJIWHGDJ5Cgy112Wpk6zD NI3hflMslWP7F1pRCVKYuijaHYKDAAruPbW6XhO1izAqIZnnv+7S61HxKICnEKlOPTY= X-Gm-Gg: AY/fxX5AN5LMMy6K61ECs6bchYlo0t6AX0YXFOkx9JCaElOigKZ2jHtWw/rgh7nyR0Y 8fbVIi3lg89BzNdGsJqOA6w+xfej2MWN/XyJLfrQqjwgCcGQXRE4vguK0QJ9ar0U/3C/hVniUD3 iwmiTUyNyKuUP+73IOmnAJ6UnzyHIrjpHMjUqijb0rHgb7bZQvKFYxr9BzbZS21b+KOzO6mQsDc /mgbi0Q2/9D01zATqPwI1il6e1LWwrgdnBtjY0Uf/gucWC9S1ZpUCjnwAe7wFv8tRRnu4cUy+m0 36q+UdTAnyaw2Lw+PtCW2uCh5vqK45rOmR941K8XP6E+OgpieenUKwoqTsVEsTtNd3kBb7Z3GsS COtzZ/CnMIa931IuvXkyjd/RBZj0DBzmm0tJhbX8slQ3eBv5y5B47wmu2pV1M4xJ0B/BsSHfAd7 pRXbuiJVYQq4sdX10Jcz4wwFXf5qSgH5weFHeaiO2R1Fk6KqBVwmyCzWF9jLO1/wX1m31+87IYP PyERw== X-Google-Smtp-Source: AGHT+IGqO2/A6qUft2Ty36ZkoKJQ250NpUeCgwtCUExj2hkku7DKz2zpfH5WwcKxMWgUdFnRgc8Tpw== X-Received: by 2002:a17:906:730d:b0:b73:b05c:38fd with SMTP id a640c23a62f3a-b8037183211mr5065467166b.50.1767603706149; Mon, 05 Jan 2026 01:01: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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:45 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:47 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-11-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 The initialisations being removed are needless, as both variables are being assigned values unconditionally further down. Additionally, doing this eager init here might lead to preventing the compiler from issuing a warning if a future code change actually forgets to assign a useful value in some code path. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- drivers/regulator/s2mps11.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 04ae9c6150bd5ae9dba47b9b3cfcfb62e4698b6d..1f51fbc6c7b6e158f9707c04d9f= 030b9eee5e842 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -1207,8 +1207,8 @@ static int s2mps11_pmic_probe(struct platform_device = *pdev) struct sec_pmic_dev *iodev =3D dev_get_drvdata(pdev->dev.parent); struct regulator_config config =3D { }; struct s2mps11_info *s2mps11; - unsigned int rdev_num =3D 0; - int i, ret =3D 0; + unsigned int rdev_num; + int i, ret; const struct regulator_desc *regulators; =20 s2mps11 =3D devm_kzalloc(&pdev->dev, sizeof(struct s2mps11_info), --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 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 7B71332BF4C for ; Mon, 5 Jan 2026 09:01:49 +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=1767603712; cv=none; b=Ged6Fj1mhSROFXczupdycYJQLBFW3c48ys2dWW/Xswjq5RIt4BHIbMXoXUAHm4EUwIHNtH3ELXmht+tOI8RxS6ottiBA7GSYzIGR91qJce1HjahNaUIU/SL+VDUPXNkXSqT7qple6qnqyqJWj7UYybrPOqOOFRDXkoHrJmjNdus= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603712; c=relaxed/simple; bh=y3nbh6FW3xPkaxUMs+BETGo9YjxcJnI/N944yZIYtZE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lM+Lg13inSlfAMX9J+x+ggwGSbJkd1NFHK4JxyzZtPnOxtmrAHgTaqHRu8+BtS5WliQFIvVJo8r94cx7GpXE6l57kBsN7xcxFf23KdpQmKhpBFFyR3EAfrjq3ayVoecdbZDy6uUGo/M5vAQ3AvxayCNaJF+CNnPNWmIC4fRz3lE= 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=ASoMsQJX; 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="ASoMsQJX" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-b79e7112398so2442392066b.3 for ; Mon, 05 Jan 2026 01:01:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603707; x=1768208507; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=QpM30Q4ohHxRfzIKhAO8xW+sYH95+aq2w1aPYa726rI=; b=ASoMsQJXiGPxRG0oXZKclWEwCMRVyOcX5KJH4medICejpD83ORI2BPJ0uFxHyiCv88 fQLFo+9+DaDILyZ8wzzaptYLoLyTuFLO1tZeJd345AcJEyj26VSGrTpeJXlRp9WqMP5d QkxvcaVQvRXETrWhzZXM4T1XNpMQCqh8W1aX1igOHO8DTyPFVBe31vb/1KsDkWaSigeB 1MOUF1JWFCzGyop1DQGW1d3KduqS33q/bCR/Z9azNix/ByT6Xy6OsWz64hOTfGtxlr3p As3LASHgqOpdvpEE1PIu7xWl7YABksIiRj+tvLqYQvcEjThwzfdycGfvLH+Cc7VseHxv SR3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603707; x=1768208507; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=QpM30Q4ohHxRfzIKhAO8xW+sYH95+aq2w1aPYa726rI=; b=lhlej5ycwms5z8zMOVZ4u0seG/7Oz4xRuNN8zqdpd4mu50dqJYN79Lm5gA7kSmhX0a I90x+h+iT4EBInSsCQiA2pDRg0mT0T5jAURpIcNBwJB185PhawydxkwXWxKEUeUyUzSQ 1pNgyWi9mWZGey4Yi9Qx7c3hiXbuiWbknbd6X0sj0ZqZEdihHW2rbX+TAbu4S8eaWlrQ KNMuuzxqZ/P1of/GjE8qro/KfcbwWbL+/OI2hR75q6yE7/r8Qrp/mH/QB6ALbVE9nUBK TTItsyzMCQzCEHWkXs9w8we89ME58u7rzseq3hyUnwNAO1TRGdQfCUeUU5E9MARw8L6w gkLA== X-Forwarded-Encrypted: i=1; AJvYcCXQ1myo5Z0wxEDOXxRVoolrbeOdIxtIrFOuMphljilYww7XWBU5NxTJFMqi9LhFLjZIGRESNITre9tVVwU=@vger.kernel.org X-Gm-Message-State: AOJu0YyUgZzzoDihe9xBKFZKdf8T8cuOgrVdtLP2AY3qw/CU65KU2PbG 07WBRGRi4u9AMDq7gOr9HL4PQhW3UGFHMWdqlJDXvppGA5atVLpyIY0Qcehnelo/GF4= X-Gm-Gg: AY/fxX7pxnR89hOqRyCwtjOVpfIbOolBD8Zl/5AoYq3/O6FJ6vbr+in09AWZ6/6gaWW xL6atXqNt31mnLdOPjabLOK1qcsHTLb3UqKozD17v4qWXdLZ58zRCm+xHZSxjGna+FkVfT1lHzA 71Xt/cDMiiWSR/7jPE7b6WkYBcAZvuqsdbogtMGbafNx9a8UeVzFtKHLrv4gtFF1uXIAttGFsuM sgFkobStNOzO11wZQ5HVtyrZ6MfOw1ICmZU7SwyLvIs+KDze7CC5RpHgkFxJEyb4GUv0OrcvpbM NG5wrI8vWbRQi45nGQIvvqjJkbbBYszgGBjFG5+vxKW1O6Ufxho8/nA3Mz40ANtA7bAdejX/6lq JIz5w8ymKxGTmDTzwh3ZRbrv86Hh9rTMrCiD/8AE+wGE0OVDR45B1HPeqrPNvpyR7yBFUf3KHC7 T7Z/doSTs1Hd4plhU+4//N6RmWpHIZoMyM/29xmCXi3pECzdB4rEZrv0QhlXv6iAHXq/mvB57gs KlUVg== X-Google-Smtp-Source: AGHT+IH7096ba/fFu26IrqBghvOzgUEHtWzoO37V1e0BEjFy5b8O7gq/dy1I+TNMiOA24hb7GdHXYA== X-Received: by 2002:a17:907:1c27:b0:b7c:eb19:6a3f with SMTP id a640c23a62f3a-b803705e31cmr4969876766b.35.1767603706655; Mon, 05 Jan 2026 01:01: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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:46 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:48 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-12-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 dev_err_probe() exists to simplify code and harmonise error messages, there's no reason not to use it here. While at it, harmonise some error messages to add regulator name and ID like in other messages in this driver, and update messages to be more similar to other child-drivers of this PMIC (e.g. RTC). Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- drivers/regulator/s2mps11.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 1f51fbc6c7b6e158f9707c04d9f030b9eee5e842..30586e9884bfb998ff07e314881= 3344b307506c0 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -1249,9 +1249,9 @@ static int s2mps11_pmic_probe(struct platform_device = *pdev) BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mpu05_regulators)); break; default: - dev_err(&pdev->dev, "Invalid device type: %u\n", - s2mps11->dev_type); - return -EINVAL; + return dev_err_probe(&pdev->dev, -ENODEV, + "Unsupported device type %d\n", + s2mps11->dev_type); } =20 s2mps11->ext_control_gpiod =3D devm_kcalloc(&pdev->dev, rdev_num, @@ -1290,21 +1290,20 @@ static int s2mps11_pmic_probe(struct platform_devic= e *pdev) devm_gpiod_unhinge(&pdev->dev, config.ena_gpiod); regulator =3D devm_regulator_register(&pdev->dev, ®ulators[i], &config); - if (IS_ERR(regulator)) { - dev_err(&pdev->dev, "regulator init failed for %d\n", - i); - return PTR_ERR(regulator); - } + if (IS_ERR(regulator)) + return dev_err_probe(&pdev->dev, PTR_ERR(regulator), + "regulator init failed for %d/%s\n", + regulators[i].id, + regulators[i].name); =20 if (config.ena_gpiod) { ret =3D s2mps14_pmic_enable_ext_control(s2mps11, - regulator); - if (ret < 0) { - dev_err(&pdev->dev, - "failed to enable GPIO control over %s: %d\n", - regulator->desc->name, ret); - return ret; - } + regulator); + if (ret < 0) + return dev_err_probe(&pdev->dev, ret, + "failed to enable GPIO control over %d/%s\n", + regulator->desc->id, + regulator->desc->name); } } =20 --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 2026 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.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 34D8232C92E for ; Mon, 5 Jan 2026 09:01:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603717; cv=none; b=WROwyUWEUXQhRyrBKpdxwfTb+qfas0tHjR77fy7ZrAfCMBDD9+MhTlsVs5MBihcbH4d46ROC1bJmr3Qo85DjH1bKK5v9l81DsSgBTYmKsMqf13WYHt8hrs4QPM1LGYroKjC4FOG5SQwNe34sw/MmupSN3Q7bK7xaBWN1QOwaO3o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603717; c=relaxed/simple; bh=e/SiWjAnIf9n3ju1+W9LofDtIoMCJ1iK1OR2/pq7g/4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XPMJ4Qlam44xHz8omirKjiVEcxDpwWnjZK8SLlTp9V7MyCpZ8QxAypthJhZTerdT4lhBJDpfaBWahoFJDY2BOJvP2R1RN6cf983gerBwta0mVmiw2gdf0MmSw0cqyHZdscJG/rWoAUlpYuC6yAvcSjJFnYG2DbVsbyMz7zJVj6o= 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=CoIahxUW; arc=none smtp.client-ip=209.85.218.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="CoIahxUW" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-b79f8f7ea43so3391343466b.2 for ; Mon, 05 Jan 2026 01:01:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603708; x=1768208508; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ZoLuiqrhFtLQqv/1rhd/SpsoL8e5z9S5UPDgQu4V1bM=; b=CoIahxUWEUKGXwD5wfSWlTEuehk7jV60T+EiZcDiHhgYoOCB0dRt+i8iqkk2BmcVtC Iii9z3m5CyswxnKtk8XDEsg3+EuVb1JfvgscIEPg+90lWPwDfPu1tD+S7X2X+T3zAEHZ 4SjLuxH24xz0u6eLK9e0YjR8HicIvB8XhmQY0N0AtvbBnjSjMec3M7bGUE9BoiWrziHg 6S4m+QLv6dI+Kwswxhb0SoyucHjsiRONPNl8NzlA/ChebKSvqI7vy3mOR2ONpwZl2eAt 9v1zSv87YuFkkYSxPBgJbdodWrDcyaoh8aHenM9VPLhdon7N4V3paCyU7SQmkaoH/upX RuKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603708; x=1768208508; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ZoLuiqrhFtLQqv/1rhd/SpsoL8e5z9S5UPDgQu4V1bM=; b=svA6OKjUqswbKzBxTbxT1hwxMVa0XJWewSWNjUpDKNlD/nX6reGF7KsIs2dbM1zIZL w7cs1ZJl2RO0yZKGUYlHt6GSbX2ynFAVJa7VkdSHD53pKfAjfnWoR1wMu4AVfmGlNwWk j7Pmh9nLBuEPF7JD9sy3YeTe+WLWG8x1BZrFpgvLRr4X3DVcynvZpGGjLQmVUtMQ3oFB Li3zHKHd5mHzjcAehNqK5WTllbapvE4w2pVfEUCUWCBWnn/H1xoRr3TB4MeIn+oT40nn X/QvqW2uYTCvTKWriSu/19CYBwKot18tPs5kuBwwvdOU/o8bkCOdDZFVMG1fo/UsTRgC m0fA== X-Forwarded-Encrypted: i=1; AJvYcCWtOrCAt7pMKnijwhGnAJzbkpIMMOMI0qTJUPRRQJ0hVpzPFooX7Nfm2AT1V0rQWyPuygNgsADt7Ysq6vo=@vger.kernel.org X-Gm-Message-State: AOJu0YynOgrYAdGi5Lj5M3PRHSRfL3byGtRJPyMl5ImWte+f0QTxOpiZ QwBoFveFuN3oSWL1sGJivWG8346xng3keoKvBOrLBi5dHdn1PbmevTbCKHmOK/43Fyg= X-Gm-Gg: AY/fxX4W1nv86Avu68x3rn7FRyJ8LYc1ptq+osjt4a0xl3Dc88+Y5zAae94OGdfmVHT NmMX5mzkvGYVoCPs0FWH9NQQa9Lx1I1zCwRqlvIp08dosDGmPnbkPk0NBgy2ii0FzVoc2wqkluN 4GaNZKHsPx8Ftrki+Gq7NP7cUJLiVHG2XpkKG/6Bcuvt3D6XH84WBwjCA/H1rqQ2vJowLv48Sye ek3x2+cuD2NbL++AD/3K0EOmjROciFT031iudx5SpJacmDYuN5jjnxI8zhTkFHCTeTI+9mKeEKL xUQqZP9gFt4E6kCglrnp9arpVGfni+6Ft5G+QkeW3E+wIDNd7EmxL8SqCLGZoeRol5TH/r5ImUV guUMV4TYoRCve584VHci77vkXyzJlcrXA9ennjyG2Y8fkcYfsgV0qimwNp4w6WRaNToanBDw1LA qnYVm9aRZOgUzTVZlQB7FfL/A7Ymfy95vNEaiLXf7S8umxyuOCXQgxVKpxdU6aVW9KrZSJcup// +7lAA== X-Google-Smtp-Source: AGHT+IG4JeAa46uy6SUlbVukzudlbhIwHtOjEK6mV3glK8apPLjD/3Y6qi1SnMN2NuRbMMnv98db7A== X-Received: by 2002:a17:907:94d2:b0:b84:201e:cd3f with SMTP id a640c23a62f3a-b84201ecd98mr40078366b.11.1767603707608; Mon, 05 Jan 2026 01:01: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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:46 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:49 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-13-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 For the lines being changed, checkpatch reports: WARNING: Comparisons should place the constant on the right side of the= test Update the code accordingly. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Andr=C3=A9 Draszik --- v3: - new patch --- drivers/regulator/s2mps11.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 30586e9884bfb998ff07e3148813344b307506c0..8a36ab67b73e4151c7f67af0555= a6465ee1e7a04 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -1221,32 +1221,32 @@ static int s2mps11_pmic_probe(struct platform_devic= e *pdev) case S2MPS11X: rdev_num =3D ARRAY_SIZE(s2mps11_regulators); regulators =3D s2mps11_regulators; - BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mps11_regulators)); + BUILD_BUG_ON(ARRAY_SIZE(s2mps11_regulators) > S2MPS_REGULATOR_MAX); break; case S2MPS13X: rdev_num =3D ARRAY_SIZE(s2mps13_regulators); regulators =3D s2mps13_regulators; - BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mps13_regulators)); + BUILD_BUG_ON(ARRAY_SIZE(s2mps13_regulators) > S2MPS_REGULATOR_MAX); break; case S2MPS14X: rdev_num =3D ARRAY_SIZE(s2mps14_regulators); regulators =3D s2mps14_regulators; - BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mps14_regulators)); + BUILD_BUG_ON(ARRAY_SIZE(s2mps14_regulators) > S2MPS_REGULATOR_MAX); break; case S2MPS15X: rdev_num =3D ARRAY_SIZE(s2mps15_regulators); regulators =3D s2mps15_regulators; - BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mps15_regulators)); + BUILD_BUG_ON(ARRAY_SIZE(s2mps15_regulators) > S2MPS_REGULATOR_MAX); break; case S2MPU02: rdev_num =3D ARRAY_SIZE(s2mpu02_regulators); regulators =3D s2mpu02_regulators; - BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mpu02_regulators)); + BUILD_BUG_ON(ARRAY_SIZE(s2mpu02_regulators) > S2MPS_REGULATOR_MAX); break; case S2MPU05: rdev_num =3D ARRAY_SIZE(s2mpu05_regulators); regulators =3D s2mpu05_regulators; - BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mpu05_regulators)); + BUILD_BUG_ON(ARRAY_SIZE(s2mpu05_regulators) > S2MPS_REGULATOR_MAX); break; default: return dev_err_probe(&pdev->dev, -ENODEV, --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 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 C0EB832D42D for ; Mon, 5 Jan 2026 09:01:52 +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=1767603721; cv=none; b=qzjzd6yeZlgb4lh1K+PpVr73/3i/OcCAMZlqpTDc6TBsSyLMow0CXUoHE71XXriAlozTNARsjcBeh9Bh2Go1IdpAohkGE4UAF3mz7y2x71UkBOAfm/w/5kfXw0kTpkGnz9ohh97nyXl8GbNviZ6NbHV2S+xnIsHf+4qW3hiQgLM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603721; c=relaxed/simple; bh=K5C3OhUoY6K0VAHET6GjBFnt0SuYQemw88dVyIhs++Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fiMoc+qYNo6NEjcgwHTiGF/sBmNwOwdS5Vnhor8YbUGr++H2SbLvpAFRJhU5aW6n/6qGA3ML/tIHICA3g9ELZlqt28xuStLc53KyJD4YAjVDwCnOM61yTtLe4YUrGL/KDMzx88GwzXxh7jRY3JAPCbWMX/fdAsEZJB93Ip7BRjI= 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=cM2Y9V0T; 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="cM2Y9V0T" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-b79ea617f55so2685175066b.3 for ; Mon, 05 Jan 2026 01:01:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603711; x=1768208511; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=nusFn6aAeugE2vgG6EjhYq+miTmPM6tuO12QEUcKzwU=; b=cM2Y9V0ThvOi7vLLTfGJchEnLaz6HS+ovIIqvEEbIJ4RIqfgnSjVbjmgCD7u+JICKZ AeaUDN4FAgUM5OIJtpMETDq0AiSC9hK8m/piUB142GfzWH2FcBNQnqBI88QvUB6b9WX+ XkvjCH1doTl9wncIJxa0/CIy2wtREIEzbiWqwxt0xn+7Bmfjd33gJAr8eghoJEvAK+JB xyd3IHKsvzPXCCw++YjeujJXr/DcjYkmq3WttQxFEWGjCOm+IIMkIKBpQ7ViL9szoCcD nuLLG7srKdFqnsnJ7o2h6h+YZxo5M8qO3+y/M7yLLf1pUWlAqliKFvzZ9jkRdlGhS7AW 2J0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603711; x=1768208511; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=nusFn6aAeugE2vgG6EjhYq+miTmPM6tuO12QEUcKzwU=; b=kiTguevRLhxrYUFwuBk4+CeKP1PPe1nhYFYTSOhZC1w/DxhE8h+nUhYg7bfmvRifRu eQWorsgIZaYZu1txM/0Y5zPcbXwKLwb0IKvDYZCgFfyAC3x4Wrs1UrZJahuOKX0HH3Rx MlQZ4d8br7flD6W9lPl/mLUnppnIhLYxFuz4UsyVV80RI1siWncmxqWffpM8sDUz3SVu YxM/xU9E+bXfsicDB0FMkdsC50Q4qpRKx2AWZZp20zIji6QPoZi5tIz3FXa99e1YpUho zeT3eKplDmykf1xjpboWfBXT68f5WCYz0N74C/J/H15BGv689UtV9i57oSL//Txp3Ye2 5K4Q== X-Forwarded-Encrypted: i=1; AJvYcCVdcASfxFH9EvUsuOK1Q8c2AVW7ZhNzbBhhR9zt2vWsi6TlBiK7eT1oxaJ6u3wxIkOExOy1AxyMtc0BaUc=@vger.kernel.org X-Gm-Message-State: AOJu0YzIvPpe2mGE+4TvPi+KrHsTtGYHqcFR2PfxWIlFhxxxS/k/wA6E bG9nw4eMSPf7Nfan8c3wOHxPmXo2G9sa0NMnfQ2AY7FAbU/7chS4ShhrXKo+UKkoiI8= X-Gm-Gg: AY/fxX6s24eMQ618O7z/xS8VC+zegdOnHTrnYiRJ8p4rzMj51AIqHiIiMdELA7+3W7g OJZzxqnhbjTfXDNKTieco012IUxHtfK2q5nYqnSYGBdhythrWws81RUt9AfcnXGuyDb8m+UpJDD nJLajA533ad9TzFDMz6wZTHe+jnkOX/whh3or5MKULWJ3+jPCaIDRs6yPD0It7LqFxZLqEl5Q/N k7nHHohfJ6K89GG8vyeVzq4Dy+aLJi/tCAvR9NbjXG/H9yLYs6lTlh0LOIeYBno07Hypy/4DrLR brlhrIRe6z6O7C9f8yHK6y1OknPHDUapAhQI4JlL9pikPa2H7rVkiJwCPtjzxCtWbxLD3E/kZ/w u+WjQ3zlUVR+L6SGXwGxHmoYKa3cqn2R/0yqQ/BHAct2XuJdX8gjav4Fk6hKao2H9hzB/WNuyUD Uklh1M7OEcG9C9pLDd5VRqpe373dPQ/vItwEfjyO3PusxxGDS4ywPiUuLC/fQCUO+UESBgG7ban FwrVz1ehxQwmldl X-Google-Smtp-Source: AGHT+IFZpiiMKEoM+bNlxEzc9xDzaIxcL1vnVA9swVqdKvu61oAUboe81BV/nwzziDLPAO0mtoXPeg== X-Received: by 2002:a17:906:6a2a:b0:b73:845f:4432 with SMTP id a640c23a62f3a-b8037178f70mr5650773066b.32.1767603708200; Mon, 05 Jan 2026 01:01: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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:47 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:50 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-14-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 For the upcoming S2MPG10 and S2MPG11 support, we need to be able to parse -supply properties in the PMIC's DT node. This currently doesn't work, because the code here currently points the regulator core at each individual regulator sub-node, and therefore the regulator core is unable to find the -supply properties. Update the code to simply let the regulator core handle all the parsing by adding the ::of_match and ::regulators_node members to all existing regulator descriptions, by adding ::of_parse_cb() to those regulators which support the vendor-specific samsung,ext-control-gpios to parse it (S2MPS14), and by dropping the explicit call to of_regulator_match(). Configuring the PMIC to respect the external control GPIOs via s2mps14_pmic_enable_ext_control() is left outside ::of_parse_cb() because the regulator core ignores errors other than -EPROBE_DEFER from that callback, while the code currently fails probe on register write errors and I believe it should stay that way. The driver can now avoid the devm_gpiod_unhinge() dance due to simpler error handling of GPIO descriptor acquisition. This change also has the advantage of reducing runtime memory consumption by quite a bit as the driver doesn't need to allocate a 'struct of_regulator_match' and a 'struct gpio_desc *' for each regulator for all PMICs as the regulator core does that. This saves 40+8 bytes on arm64 for each individual regulator on all supported PMICs (even on non-S2MPS14 due to currently unnecessarily allocating the extra memory unconditionally). With the upcoming S2MPG10 and S2MPG11 support, this amounts to 1640+328 and 1120+224 bytes respectively. Signed-off-by: Andr=C3=A9 Draszik --- v2: - fix commit message typos: s2mp1 -> s2mpg1 --- drivers/regulator/s2mps11.c | 192 ++++++++++++++++++++++++----------------= ---- 1 file changed, 105 insertions(+), 87 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 8a36ab67b73e4151c7f67af0555a6465ee1e7a04..88e21c90832a45547e5791b15cd= 1de274f81fed6 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -40,12 +40,6 @@ struct s2mps11_info { * the suspend mode was enabled. */ DECLARE_BITMAP(suspend_state, S2MPS_REGULATOR_MAX); - - /* - * Array (size: number of regulators) with GPIO-s for external - * sleep control. - */ - struct gpio_desc **ext_control_gpiod; }; =20 static int get_ramp_delay(int ramp_delay) @@ -244,7 +238,7 @@ static int s2mps11_regulator_enable(struct regulator_de= v *rdev) case S2MPS14X: if (test_bit(rdev_id, s2mps11->suspend_state)) val =3D S2MPS14_ENABLE_SUSPEND; - else if (s2mps11->ext_control_gpiod[rdev_id]) + else if (rdev->ena_pin) val =3D S2MPS14_ENABLE_EXT_CONTROL; else val =3D rdev->desc->enable_mask; @@ -334,6 +328,58 @@ static int s2mps11_regulator_set_suspend_disable(struc= t regulator_dev *rdev) rdev->desc->enable_mask, state); } =20 +static int s2mps11_of_parse_cb(struct device_node *np, + const struct regulator_desc *desc, + struct regulator_config *config) +{ + const struct s2mps11_info *s2mps11 =3D config->driver_data; + struct gpio_desc *ena_gpiod; + int ret; + + if (s2mps11->dev_type =3D=3D S2MPS14X) + switch (desc->id) { + case S2MPS14_LDO10: + case S2MPS14_LDO11: + case S2MPS14_LDO12: + break; + + default: + return 0; + } + else + return 0; + + ena_gpiod =3D fwnode_gpiod_get_index(of_fwnode_handle(np), + "samsung,ext-control", 0, + GPIOD_OUT_HIGH | + GPIOD_FLAGS_BIT_NONEXCLUSIVE, + "s2mps11-regulator"); + if (IS_ERR(ena_gpiod)) { + ret =3D PTR_ERR(ena_gpiod); + + /* Ignore all errors except probe defer. */ + if (ret =3D=3D -EPROBE_DEFER) + return ret; + + if (ret =3D=3D -ENOENT) + dev_info(config->dev, + "No entry for control GPIO for %d/%s in node %pOF\n", + desc->id, desc->name, np); + else + dev_warn_probe(config->dev, ret, + "Failed to get control GPIO for %d/%s in node %pOF\n", + desc->id, desc->name, np); + return 0; + } + + dev_info(config->dev, "Using GPIO for ext-control over %d/%s\n", + desc->id, desc->name); + + config->ena_gpiod =3D ena_gpiod; + + return 0; +} + static const struct regulator_ops s2mps11_ldo_ops =3D { .list_voltage =3D regulator_list_voltage_linear, .map_voltage =3D regulator_map_voltage_linear, @@ -362,6 +408,8 @@ static const struct regulator_ops s2mps11_buck_ops =3D { #define regulator_desc_s2mps11_ldo(num, step) { \ .name =3D "LDO"#num, \ .id =3D S2MPS11_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps11_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -378,6 +426,8 @@ static const struct regulator_ops s2mps11_buck_ops =3D { #define regulator_desc_s2mps11_buck1_4(num) { \ .name =3D "BUCK"#num, \ .id =3D S2MPS11_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps11_buck_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -395,6 +445,8 @@ static const struct regulator_ops s2mps11_buck_ops =3D { #define regulator_desc_s2mps11_buck5 { \ .name =3D "BUCK5", \ .id =3D S2MPS11_BUCK5, \ + .of_match =3D of_match_ptr("BUCK5"), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps11_buck_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -412,6 +464,8 @@ static const struct regulator_ops s2mps11_buck_ops =3D { #define regulator_desc_s2mps11_buck67810(num, min, step, min_sel, voltages= ) { \ .name =3D "BUCK"#num, \ .id =3D S2MPS11_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps11_buck_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -429,6 +483,8 @@ static const struct regulator_ops s2mps11_buck_ops =3D { #define regulator_desc_s2mps11_buck9 { \ .name =3D "BUCK9", \ .id =3D S2MPS11_BUCK9, \ + .of_match =3D of_match_ptr("BUCK9"), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps11_buck_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -502,6 +558,8 @@ static const struct regulator_ops s2mps14_reg_ops; #define regulator_desc_s2mps13_ldo(num, min, step, min_sel) { \ .name =3D "LDO"#num, \ .id =3D S2MPS13_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps14_reg_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -518,6 +576,8 @@ static const struct regulator_ops s2mps14_reg_ops; #define regulator_desc_s2mps13_buck(num, min, step, min_sel) { \ .name =3D "BUCK"#num, \ .id =3D S2MPS13_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps14_reg_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -535,6 +595,8 @@ static const struct regulator_ops s2mps14_reg_ops; #define regulator_desc_s2mps13_buck7(num, min, step, min_sel) { \ .name =3D "BUCK"#num, \ .id =3D S2MPS13_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps14_reg_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -552,6 +614,8 @@ static const struct regulator_ops s2mps14_reg_ops; #define regulator_desc_s2mps13_buck8_10(num, min, step, min_sel) { \ .name =3D "BUCK"#num, \ .id =3D S2MPS13_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps14_reg_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -634,6 +698,9 @@ static const struct regulator_ops s2mps14_reg_ops =3D { #define regulator_desc_s2mps14_ldo(num, min, step) { \ .name =3D "LDO"#num, \ .id =3D S2MPS14_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ + .of_parse_cb =3D s2mps11_of_parse_cb, \ .ops =3D &s2mps14_reg_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -649,6 +716,9 @@ static const struct regulator_ops s2mps14_reg_ops =3D { #define regulator_desc_s2mps14_buck(num, min, step, min_sel) { \ .name =3D "BUCK"#num, \ .id =3D S2MPS14_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ + .of_parse_cb =3D s2mps11_of_parse_cb, \ .ops =3D &s2mps14_reg_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -725,6 +795,8 @@ static const struct regulator_ops s2mps15_reg_buck_ops = =3D { #define regulator_desc_s2mps15_ldo(num, range) { \ .name =3D "LDO"#num, \ .id =3D S2MPS15_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps15_reg_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -740,6 +812,8 @@ static const struct regulator_ops s2mps15_reg_buck_ops = =3D { #define regulator_desc_s2mps15_buck(num, range) { \ .name =3D "BUCK"#num, \ .id =3D S2MPS15_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mps15_reg_buck_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -835,60 +909,6 @@ static int s2mps14_pmic_enable_ext_control(struct s2mp= s11_info *s2mps11, rdev->desc->enable_mask, S2MPS14_ENABLE_EXT_CONTROL); } =20 -static void s2mps14_pmic_dt_parse_ext_control_gpio(struct platform_device = *pdev, - struct of_regulator_match *rdata, struct s2mps11_info *s2mps11) -{ - struct gpio_desc **gpio =3D s2mps11->ext_control_gpiod; - unsigned int i; - unsigned int valid_regulators[3] =3D { S2MPS14_LDO10, S2MPS14_LDO11, - S2MPS14_LDO12 }; - - for (i =3D 0; i < ARRAY_SIZE(valid_regulators); i++) { - unsigned int reg =3D valid_regulators[i]; - - if (!rdata[reg].init_data || !rdata[reg].of_node) - continue; - - gpio[reg] =3D devm_fwnode_gpiod_get(&pdev->dev, - of_fwnode_handle(rdata[reg].of_node), - "samsung,ext-control", - GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE, - "s2mps11-regulator"); - if (PTR_ERR(gpio[reg]) =3D=3D -ENOENT) - gpio[reg] =3D NULL; - else if (IS_ERR(gpio[reg])) { - dev_err(&pdev->dev, "Failed to get control GPIO for %d/%s\n", - reg, rdata[reg].name); - gpio[reg] =3D NULL; - continue; - } - if (gpio[reg]) - dev_dbg(&pdev->dev, "Using GPIO for ext-control over %d/%s\n", - reg, rdata[reg].name); - } -} - -static int s2mps11_pmic_dt_parse(struct platform_device *pdev, - struct of_regulator_match *rdata, struct s2mps11_info *s2mps11, - unsigned int rdev_num) -{ - struct device_node *reg_np; - - reg_np =3D of_get_child_by_name(pdev->dev.parent->of_node, "regulators"); - if (!reg_np) { - dev_err(&pdev->dev, "could not find regulators sub-node\n"); - return -EINVAL; - } - - of_regulator_match(&pdev->dev, reg_np, rdata, rdev_num); - if (s2mps11->dev_type =3D=3D S2MPS14X) - s2mps14_pmic_dt_parse_ext_control_gpio(pdev, rdata, s2mps11); - - of_node_put(reg_np); - - return 0; -} - static int s2mpu02_set_ramp_delay(struct regulator_dev *rdev, int ramp_del= ay) { unsigned int ramp_val, ramp_shift, ramp_reg; @@ -946,6 +966,8 @@ static const struct regulator_ops s2mpu02_buck_ops =3D { #define regulator_desc_s2mpu02_ldo1(num) { \ .name =3D "LDO"#num, \ .id =3D S2MPU02_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -961,6 +983,8 @@ static const struct regulator_ops s2mpu02_buck_ops =3D { #define regulator_desc_s2mpu02_ldo2(num) { \ .name =3D "LDO"#num, \ .id =3D S2MPU02_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -976,6 +1000,8 @@ static const struct regulator_ops s2mpu02_buck_ops =3D= { #define regulator_desc_s2mpu02_ldo3(num) { \ .name =3D "LDO"#num, \ .id =3D S2MPU02_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -991,6 +1017,8 @@ static const struct regulator_ops s2mpu02_buck_ops =3D= { #define regulator_desc_s2mpu02_ldo4(num) { \ .name =3D "LDO"#num, \ .id =3D S2MPU02_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1006,6 +1034,8 @@ static const struct regulator_ops s2mpu02_buck_ops = =3D { #define regulator_desc_s2mpu02_ldo5(num) { \ .name =3D "LDO"#num, \ .id =3D S2MPU02_LDO##num, \ + .of_match =3D of_match_ptr("LDO"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1022,6 +1052,8 @@ static const struct regulator_ops s2mpu02_buck_ops = =3D { #define regulator_desc_s2mpu02_buck1234(num) { \ .name =3D "BUCK"#num, \ .id =3D S2MPU02_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_buck_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1038,6 +1070,8 @@ static const struct regulator_ops s2mpu02_buck_ops = =3D { #define regulator_desc_s2mpu02_buck5(num) { \ .name =3D "BUCK"#num, \ .id =3D S2MPU02_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1054,6 +1088,8 @@ static const struct regulator_ops s2mpu02_buck_ops = =3D { #define regulator_desc_s2mpu02_buck6(num) { \ .name =3D "BUCK"#num, \ .id =3D S2MPU02_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1070,6 +1106,8 @@ static const struct regulator_ops s2mpu02_buck_ops = =3D { #define regulator_desc_s2mpu02_buck7(num) { \ .name =3D "BUCK"#num, \ .id =3D S2MPU02_BUCK##num, \ + .of_match =3D of_match_ptr("BUCK"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1125,6 +1163,8 @@ static const struct regulator_desc s2mpu02_regulators= [] =3D { #define regulator_desc_s2mpu05_ldo_reg(num, min, step, reg) { \ .name =3D "ldo"#num, \ .id =3D S2MPU05_LDO##num, \ + .of_match =3D of_match_ptr("ldo"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_ldo_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1156,6 +1196,8 @@ static const struct regulator_desc s2mpu02_regulators= [] =3D { #define regulator_desc_s2mpu05_buck(num, which) { \ .name =3D "buck"#num, \ .id =3D S2MPU05_BUCK##num, \ + .of_match =3D of_match_ptr("buck"#num), \ + .regulators_node =3D of_match_ptr("regulators"), \ .ops =3D &s2mpu02_buck_ops, \ .type =3D REGULATOR_VOLTAGE, \ .owner =3D THIS_MODULE, \ @@ -1254,22 +1296,7 @@ static int s2mps11_pmic_probe(struct platform_device= *pdev) s2mps11->dev_type); } =20 - s2mps11->ext_control_gpiod =3D devm_kcalloc(&pdev->dev, rdev_num, - sizeof(*s2mps11->ext_control_gpiod), GFP_KERNEL); - if (!s2mps11->ext_control_gpiod) - return -ENOMEM; - - struct of_regulator_match *rdata __free(kfree) =3D - kcalloc(rdev_num, sizeof(*rdata), GFP_KERNEL); - if (!rdata) - return -ENOMEM; - - for (i =3D 0; i < rdev_num; i++) - rdata[i].name =3D regulators[i].name; - - ret =3D s2mps11_pmic_dt_parse(pdev, rdata, s2mps11, rdev_num); - if (ret) - return ret; + device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); =20 platform_set_drvdata(pdev, s2mps11); =20 @@ -1279,15 +1306,6 @@ static int s2mps11_pmic_probe(struct platform_device= *pdev) for (i =3D 0; i < rdev_num; i++) { struct regulator_dev *regulator; =20 - config.init_data =3D rdata[i].init_data; - config.of_node =3D rdata[i].of_node; - config.ena_gpiod =3D s2mps11->ext_control_gpiod[i]; - /* - * Hand the GPIO descriptor management over to the regulator - * core, remove it from devres management. - */ - if (config.ena_gpiod) - devm_gpiod_unhinge(&pdev->dev, config.ena_gpiod); regulator =3D devm_regulator_register(&pdev->dev, ®ulators[i], &config); if (IS_ERR(regulator)) @@ -1296,7 +1314,7 @@ static int s2mps11_pmic_probe(struct platform_device = *pdev) regulators[i].id, regulators[i].name); =20 - if (config.ena_gpiod) { + if (regulator->ena_pin) { ret =3D s2mps14_pmic_enable_ext_control(s2mps11, regulator); if (ret < 0) --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 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 06C2D32D0C9 for ; Mon, 5 Jan 2026 09:01:51 +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=1767603717; cv=none; b=AsRwbfPW0H9CdUJ6jdAs7OLcTwrS3bc1357QsddutEYohAfubadoHZ69d0gDfAxJK2xqs0JB6WcU0q/a3ewVeuufAqLvfV/SksoqcW8Y4mwXplTDkEzMV40CPRE2A0314Pqsu4Ou6EBtweNIg+iMkhDW5EtWAlJY0O8jooEBSAw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603717; c=relaxed/simple; bh=RBiblDYuoL7LiB6An/b16TWoN7ju2Vuj/2Yriz+avcs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GUMP95Ny5vQt5voqgLic9vw+rXa6C6txlwaz/ES/ZRayuxtKR99OxGbZBKCmNFYKcoX9o/yYnlwQr+kEwo8wQCUh0AIp5//wgUKUtIQWhZhRZSzZqwvNc8pKoXL4hf93LJfAyqvZ7UA8OXOfGIsCtOQr9oXPiDuIHm6Q4RGSkJs= 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=cJARZl2v; 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="cJARZl2v" Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-b83b72508f3so539053466b.2 for ; Mon, 05 Jan 2026 01:01:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603709; x=1768208509; 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=QCOif9oxn9Ts49wbKRM5kmB/vgWlHk9jFqT6IaUcSpc=; b=cJARZl2vlRj5yAtAmwO0+6xn7F7n9mlhRNHE5R3EVZIr/8c6v5w9VGxYDqBXSU/So3 kdYi+4IFzX55p5hM/31ZmFG3zm7Co3aKT7iK2zHfiBh7FTxNihTGlplDFTrBrShajhO4 z0uJH1h6bAlQebLBU5UWq0daTZwZogBHl6R+L9Jx14dx8DJEy90Hebmos2EeqAwRsgly e60EQDZMmvcoQ1mrbkMkOsY/POMqwUEJBeAEXuSmMRuvK5BnZp1iZI50xpzA/6E3hnkm g7PDYFGGhas1p5KvVliQ39J3WWqzzDhR2aHL9pOR4p2no/MUhg0abXNSCRR3+BrD8Xnn eJQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603709; x=1768208509; 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=QCOif9oxn9Ts49wbKRM5kmB/vgWlHk9jFqT6IaUcSpc=; b=dToYUWQI5CKS5hwywHsVBqAuBHg/dC970lpl4ueHo6NbJ6dF5zWMv1J3BhZRDgQfB3 QnRr2gr9rM7kBqROnjy4+EoH730Y+BGpz1AEXuL12hsqRsD3ClWU7GcKtZ56V5ti0N8+ L/4zTMZjE9cKI0Tsj8IJIIq+f8Y4qmD+lcLGBC9KCsmhSjOS4oPzsFBZiu7gZSBHhR0L tmomGgpiyN7X/Zc1PkB2AQiPFqLoeDkrO1jMF03MS30b1pG6CfNVkzRsxI+nJ1+efB0j zBdAsbK4wywbSSP1xo2oJt9/tGwlwmUk0eIQzhLXHbDYVlfFI73Qz8NPDsvpcfIWNlZM x5ig== X-Forwarded-Encrypted: i=1; AJvYcCWnIOL8VcYPNf3e1FGUPutWB7Clxd0NG3D+AJWKyI5KcQehFNM1SJxNIc78Co+W9aYFwNKuVNQfHUxWPho=@vger.kernel.org X-Gm-Message-State: AOJu0YzU9LNzBqUZbpUJzFf7bX+LMDWnqOsm/xngzViu10+ofNSwIKkR hop5pRyWr7hRGpp3q7iKwLtX3yXQ21mx9c5iwz6d8Wc6Ucn/UVz2GkLphgqqGTvWOOk= X-Gm-Gg: AY/fxX5KE13CmRfVU18wd97t8uWYLXYhS96W8vHPHdvQt7PcGsHz8XZzWoF6XrcZfiu d4yf4y+ejGlfZ9KRs9On1IyIuO5op/KiSb4loPkmbCw+b6Q2EZAxVv+SQVHjVCUq/pACSeeHrtW WUTwKV8NGYGM9gsBSvnx2yJ+i8WN8Y8zV/BVeas1FVsl9TMRgczf47EQCTYnD4uV4n9maFTKrGd +TzXZpVh/6Ri+rZ7aZlZRV0iqU/aPoQ1vtDDEYDiLkuzgGp5PJKcxfieYpFwx1W7fIL1YIxLJ+C Xv1JJxZHvX1h/5SD/xEkS9rPblWwURcYJAV39EVpQvPK5v+YT3CKNGRrfnuYWDL5B25+qxlh/8T Vp4FMb4onwpK+DNitoNC4qk/1QZiaaQmJH4hUH8W0A7pGMLiSpSRYANReqeO85fmkhCFjjdxfum nr8nzqLUPsA6YSuda5WMY3Uyd9qIQLFk/TOoltMdSERr8ie6CmvTdRZ2GFjo/5eE2SGxJdx5SIB OdsXQ== X-Google-Smtp-Source: AGHT+IFUVIMSn/sV3dFiXZcscsT3hGk0kSrJJy4RRYZc736gdsQg7/QBdwgX43lVqJFHn1pNi85KIg== X-Received: by 2002:a17:907:948d:b0:b83:95c7:e984 with SMTP id a640c23a62f3a-b8395c7ed4dmr1656276066b.49.1767603708754; Mon, 05 Jan 2026 01:01: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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:48 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:51 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-15-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij 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.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 2026 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81CE232D0EF for ; Mon, 5 Jan 2026 09:01:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603720; cv=none; b=MPKTTtDFGzXEREnqISm4l1nr1R2DGPJ7Dfbi/B3P/T25v0Oumq1VBAXkkzUL+aVFGikL4CrGKt3LvrltNt9NVxo/uIdGhOI0iJzg+MQViliUwQNZKVs8Ah+WFRinrSNXVmb9e45WfjikY3VW9Vtb3clgsNcU/e2blxlLkwhUPqc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603720; c=relaxed/simple; bh=1menO0fBSkUW0MtTCpqvtd42Vh4P4s4iIYyRbqhJ/ns=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P74ECxT3jBbVhlhLici+FbJmOhvyfO5JqDVpURIffsjSJjBrQRiHHn4USmaxba2f5ilB2Z3n7vQ1I4+i/VmKB9BJTaNmkvDtPv3WFJuYxuVzYd5bxPmVItRKfzaq/6j04cS9wunGrYXxNWj/4t6JcqFiQfapUgyyJSI+4kNTSVY= 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=qxMie2pP; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qxMie2pP" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-b832c65124cso1063710666b.0 for ; Mon, 05 Jan 2026 01:01:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603710; x=1768208510; 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=dC9VDRJnOwlCcRDhQPQQu53R7hQJLYaY27+igTcrXvs=; b=qxMie2pPpryCTJXoG5djMamLy1WFIh1ie0KDLG7p00D2vp6dzbIbfdqdocRwZCXWgR BDK2Aa1je/4X3hse3uTWHXBmcumtb6PAeJSYqbajYaqZedYmOzDBSuBBGo1YaSaeicue E5rYWz3B7Vdas4eosSUzzkggeECVI59T/KD2rLldibqk/F4ZHhCeCbw7YFEcWm6s4Ino 8VgakqK2DFcoUZ4uBmTEuVtoePXZ4gIpV0hLvQIaFFdVE3DtUkHkZ5gxxge+PjsOyWLr t06vgDwKq6rbTVmEWwVqrhYWOT/IxpnxSdUbaL/HVrpH15JNJ14kYQRnuz4tiWKg5NeC 1ohQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603710; x=1768208510; 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=dC9VDRJnOwlCcRDhQPQQu53R7hQJLYaY27+igTcrXvs=; b=FKIgy6SwQqp/LtKZgRX0qH6Exbiu6bcztNpuea3kMh5vqgA7LzO/s4gWCjNRBJmdim XSv1yI16tb/diCVZDWttKK5tdPsi1uCKnS/JJ+RtR2ml/DVjT/XrXI5AbIyFFC4Ce1/P 5IGAibPDUGG6WwwcwHfgZetQyZKYJBS4cbLvzRk2eMLAwXF28G+zJIgldG6AuM+7hhai ISCLJksaiqVfendUo8Bdd24wPr48zOgGbsv5xVkpPRD6Dd5QCWKJCM4zXxkb2WV+Glyy vdN0vVgrOdwLar6GaZvSRagwcHJ4oS/CwMXrdDfhRHumyKSpy660HmQhXbADU+/QSQVm 6JNQ== X-Forwarded-Encrypted: i=1; AJvYcCUrQV7bqsSgLuGkF9tfSZ4XgKFF+4SIReccWo/9KyNaHAT9cABuSLfEDz35t9qwylz4XjIIXdTY4vCx1GI=@vger.kernel.org X-Gm-Message-State: AOJu0YzlYswUr0eoqT+pyWQ+e1miQ/4VMIjRQ8mxOwZFyG8Fc65EMZ8h qvcZbd25DaQclEoHMT0aqL2fclWyyILSqe+MW+oiTfzWSMMAdvJhcwTD1j7Q5ooIogM= X-Gm-Gg: AY/fxX7ezlo+fLOJhmtLfKPtGKqOL0M9D7diGTmSQmWHvVOcKETDNNdwPQCMhWX3lzo DXRc1Ey7qnGCzXPnt73r9CYSpC73NQQrvGDoX+uYuMktuYxv5Zidj4vnHJmQP1nRhXpORQapYo3 OGzt851qOaIrTH8c9GIGtM8a7jjDOo9Ausp/ATdxzr6sE5fony29Dl+XiACO6BCFc6BZVzWZlWq 1IMusi3hrllYZf36GpB/+xlzGONxTgW8lA+AvMsqfn5Y5qmvZ5lfKNTdUtVwJc2fM0v4WCZOZJY OTWVpjXNXeJaqXrWg1Zvh5Xb3q55tOMxzTY+7DL2pJB2SxWLlPFBNZ8OERBYMJidQaiqiC/+A5c Z9drFY2KrWzGIW4rhu5jDLmbffT/SjPfQhcmQVoR73tVFHcR3KWZD3OpHyyiWBn94d65MLXdbpf +72UIrs8HHeJGcvGir8dtDJn+W5CiNY/JuCa0KtCO9jSKq4J43TfH0Ddk/wqOqnW41pVobEyWRN 6tHcg== X-Google-Smtp-Source: AGHT+IGhhOYZKctaAXiwtJlAY6LMlw15A19l/KGDBsNXnrAfc1iEEPIKY6CiPlM62gJVzelai6XHLA== X-Received: by 2002:a17:907:7e9a:b0:b76:6c85:9fd3 with SMTP id a640c23a62f3a-b8036960757mr5100493366b.0.1767603709360; Mon, 05 Jan 2026 01:01:49 -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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:49 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:52 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-16-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij 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.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 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 5200332D0D0 for ; Mon, 5 Jan 2026 09:01:52 +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=1767603719; cv=none; b=pujNGq0E2CNzqmbIjj3syEX7MCfZ2u5BnAcDU6J93S2OU1V3zF12Ym3c39jamdrOnVCcbs+bbSv988sLF57uQXnuK/dWxdwHV51JrHWIIOjyC6okRSu5lGZQM87yLmXligEDh9IWl3spuneN8X0Gkyq8PjkgrE5FhTGb5i5P7Tw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603719; c=relaxed/simple; bh=EbkA79tZJb99W8QY1jSkN69mbuMKBY7QYKTImhSxzUg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TNPucFdAJDeYrq4RMNOEzGNxzxdziFsQ8KNG4cmCjR5oxRLo+gnrdOhg0D5i05NMXLzN4ZAkcQxb+mSAjgOKaSVF5oS2inbJA2tl+YoRC67BgDpNg+gkPnOvOzVMrrJDg85M3w/Fap9GrncrKhODQlS7O6nMRp6b0l7BHCwknoM= 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=UjhoWzjG; 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="UjhoWzjG" Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-6505cac9879so300855a12.1 for ; Mon, 05 Jan 2026 01:01:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603710; x=1768208510; 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=FKm6UbDQAJQzpK/ySeYAg6jnja8QC36f4+JR5r/3xCE=; b=UjhoWzjGpM8xMCOj7KIBJFZ0SUo76s7NsAYcqLli71Kjrnm+jyixvh01bxQiN1i/g6 +4EygEmcRWS6ps+q8bAR9ffSOL7Ux1kd76jpqjdCGC6LRjW5wKLq0UCliiBl5mLxmVZJ ziwY6cOaVKmTyw4GKJWAuNHfT6gmTZWoolMHnvyW6Ld5cfIvfb7Lad9d0Q1khtP4yLAF zzLX3YFStg/OovLu9ZKB1iYNuIsYgPlUivwRz3XdMln+et013FzS2OpNKlKJG9V57pZg 0VxUmBEebFQoeYrNqpMFJAlcSdUL8xUU/dHUFNl2r1ZitVmsmiU4fW3D3ysK4P3kcntc Ui3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603710; x=1768208510; 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=FKm6UbDQAJQzpK/ySeYAg6jnja8QC36f4+JR5r/3xCE=; b=OhWFMWGSPaiOM0eaRexsg7WF4ZZNPrkhbOYiXy5i347b6SfObNFjAbSia0SCItKqFp aZC6+gXCM88kPVkZKaIYar7pm1IOhJ6rVsFrUtqP39Ji7oGWyRpgLt6wQ/uBPLP+/uYo AM4DALe7K3DQVXvK1lYmgNRGFWeRFz5Y3eQk1TZrT/XqF+Y+KW7fwH5QJ2U+bAZjZSZj WBROFjipbHAzlfxJ4fzmjz34NiAlDzMWFLBdZF8BGxgYdXszsV/pUADCcB4MaK4NxWYc bSK7JzWMYci9RQJcA+wgN8V3sSNHrtJqKFYC+86kcf0TX+0+HU1Ppxm1wViE70iCemz8 GlyA== X-Forwarded-Encrypted: i=1; AJvYcCUrn38LoPLEJj3VCF0THVDI8vqkbrcc1yUlUvM+iWGefxPhBKJlfndoA7eiXw1rEkcdBA9s9QSUSH7/HHM=@vger.kernel.org X-Gm-Message-State: AOJu0YyRACCmW5XFhspvk5y690Vdda+BdXwm9h8+4cS2Ecfj1LBroTI+ WQPAYn1IDvzgDNGCo4ZwUpj+pkyaP0KjU0pvQsW7rdvkY8MjRsNrVRuSaufecQyuONM= X-Gm-Gg: AY/fxX7AIibvRWtn7eeBc4ETHXYxskd3vCKxQY+IrriZQTm6hx+u0sGa6Fs2zfVDdx9 LAwPLmmPN3FpmvSB1ENt9Y1K26y8NWZp8bFyastJwa4OdMWNmFjcQ9Vvyx2M3eIvirmsxVCcH98 9QxXpc8gm68YvaeJGc4v3tbfN74BsHlAVS383IW6FZ6OiYYcyEHhhBbXG+r2+1ogKc8yJgGmBZk eU8TWQumckbMhRR9PRPvWGDQ4Ol89vRvUGhuvhBm8juix5VNQhrBqwFXzTtEp0pDWbV6BvqTksw /tvrpIR0yiZLi4/MF9ns15CT9O2OW9H7T37bZRUwyHBmTX6E0MfF5acvwsHDpIRI0RqQAgskIf4 q4/7EKIochiyjkltuybBMJbEjlmTQgjWfBacu/xhbAl0Yj+DxBogx2Dz7oBdt2TmmZm7K7aFBCA TYhtBohMaibj1+YjnMQQy/TOnuNrxnnU/HL7qTTRrhk0xobbiD1MmfA1aJZ4LKs+MlSNjFtMQ4G H9qhw== X-Google-Smtp-Source: AGHT+IGjvIAGvupchOOrFftG/YtkeYR3yC8EXM4cSwDm3fV3fNPQfnkzPLc0+5C+INuB5lyzg9eeMQ== X-Received: by 2002:a17:907:e109:b0:b80:3846:d46 with SMTP id a640c23a62f3a-b80384610eamr3935579266b.20.1767603709843; Mon, 05 Jan 2026 01:01:49 -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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:49 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:53 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-17-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij 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.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 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 6193632D0E3 for ; Mon, 5 Jan 2026 09:01:53 +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=1767603717; cv=none; b=MoUxBRUuo5DfeIcPASzYOkXzAbQ/3RB1LT9V9iRsqgneU5nWJQi4HTfsxhVc3m+1I48KGPdeBMfO+1+EusjZt6SXmxs8Py8vngUQsXjVAAy95qfpVgyH2C4S+9sNmnAXD9NbIM0LDNyabazskb4YgOrwX4q2bfczw0StX81akFo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603717; c=relaxed/simple; bh=pYoKo+digtWVPSZwb9N952iQQptJW29ndQ+/P5fC4eM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W40jswnm3dKOBIXmX5luix112VOBT/iryH82EMTdXc6na0lgO5aP1DF+WCfbShpDxlnVJH1Rms0iPem3hEPBudtPmIRtVUu7xFLIXfc2q7lJt9Y6P47e0nyNdhNbI/sIzV/qSfLASCAjTR276d3tecbEWCfq+DXew+6tjffYyg4= 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=pmCjTJqb; 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="pmCjTJqb" Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-64b9b0b4d5dso24223489a12.1 for ; Mon, 05 Jan 2026 01:01:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603711; x=1768208511; 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=tHyxC3mJTt3T5SfTPxkXMI8FFVxPvrKadVGkzzCyb1s=; b=pmCjTJqbUiaKuYNl5r70vd+4KkuIlwxNDQ50Xp9F+n020HYldC6x3KQ8bkfLuTLCJh Pa8fD8seBOmYc8+2nOoPJ7PBP0J1C+wAam28NhqlKqV0l0UKPKmGB1YNe0NSDbOHhG9l U7t7jHRjMdCJgskN8xJKsog1WmFM4jUCmQxgxKtCJHb06jqPKgkbUTLF2tO3PenNWTT3 y9ERfWhLLNROIQReQmlFWsm2xA3n4AJmh6U2jCKu3p2wNHXela+Tqnv6eNHrdzOnxUZW IlDLXo2P29fh62NF7ApSkOCl73B8IYaneNh433gFuY33ygcpGloLnsg3+MMyfrK90Ett GEOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603711; x=1768208511; 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=tHyxC3mJTt3T5SfTPxkXMI8FFVxPvrKadVGkzzCyb1s=; b=Np7wT1A5Up243oJlr842Vz4KLkELiXZV9DYPx/B7SBiJan/2U5twF23IrcPWs/wiCJ 6RlXLMWiwldbwa6tNcQ1oSWEsGqVhnrr5542vLoW2/bpTMU5hSW1J+3TEivQuKFrvUjo sDrONLbDt9JuM5aiYx1hAiAorp5LsOG5DbsDWKKAYPJI6tv0zf0ymPdP3WfEnD4szSIM jUXLtgj0adLgvQ8Ls0nlcglcC1tkiSRI1Zqs2AT+WwfSkZVYXQxJMrhNF6mVRQahF94F 42dqZCHjmJ9bk4iizOvETI0NSDvvNoZqI5uVcrkF81L6OqGCHyHGgoHNO7XNPnCy72cZ 64wA== X-Forwarded-Encrypted: i=1; AJvYcCXTzgfb8ba5eqGE+gksqCzbdEJ4XBqUwe/8+v4x6BXyDMtAD3/IWdiF5LqSCQEnh9qRVVAKTuLoIsykz4U=@vger.kernel.org X-Gm-Message-State: AOJu0YyPs12utYffZX2MyGRQmzXRdT52nwDzfVL9LrU9xCrjjzPC7TYm ytth+AEJg70grIv64tKWet5bqPlnmqTHPDMWm+AhGULWVKYWtcQPkUWpFaHVYSV1MjQ= X-Gm-Gg: AY/fxX4cawDFV1+QiFaV+6SCUHArGxHA/1jLteVzvDMl45ZNw95fWAHeRwRANOFjZk8 3uVhqKUCNkLhH/pG5F6XxCVrdD3pUTsONz1C9awy0JT1ItbEe7SAZzDwDM7Tj30RoduaO5M252P J1Oc7YeX09Kh6egahKr07oOEonOqmT6+YxmzyIIC8hnc+Ua4O1kQb2MM2nGTDS39db7wMV6bCZw LT1cF/YycR3Wli2hX81Ee19hgCr158EcRbjlf6m+gExLWky7Zqjiv7WrPjdXAGjUD6FD7utCfdr SnVv22Qv8shLY1Y4ZB8r8tiq1StrJvwOuRlNKaJbRwgbLYvBX6LOZFtwGvD1SgpIMIo19wm0aHH B0aMXSxwIyRc4A9xvpPQOtcptlxr2/JyShIhP4rYb3/yRvnmwN1wnPTk0wYOG0ZGmSEAEq22AoM dzj2wB6FFJVOp9/Xt3ysgdHy7VX+QVk/mW1DLtKMJbRkWcFSRKQi3dGhUnw0QMYTH8nt9ZW0ATT 0iYfA== X-Google-Smtp-Source: AGHT+IHE2Bk2ccsf+dZVQINoCVjuNssHJWZ8dARVmDYm9psJbwoyILdGIxup09aHKiJs6mnKKYTX2A== X-Received: by 2002:a17:907:7288:b0:b80:15f6:6deb with SMTP id a640c23a62f3a-b8036ebd4eamr4997195966b.1.1767603710386; Mon, 05 Jan 2026 01:01:50 -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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:50 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:54 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-18-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij 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.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 2026 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.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 F381C32E12D for ; Mon, 5 Jan 2026 09:01:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603725; cv=none; b=PiH4v1wu0xXTDNmIAZq+F270fPC/Ocw9VFqw9HlC1yajicozT5yShVsDONluIpr0dIU4rwN/tHZ7zZOFSqOQ1RtA8kbOiDhDBYIH6NnZ5GB/UcY/KDkkbhZev29hhONasrYfpngRjw5ZYSjnCkRInlgjEbJo9x+8sTpvHc5wu4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603725; c=relaxed/simple; bh=ycVNXiKFIiHgmiFK5lrPS0lR9XBMIGg07ER7XJL8XHQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BMZ3IEDLo/UqzNh5+KxxWAVRcN0F6sTt4BOOEUJywzkRPMqMfY2y35wfclkt643J+YDioFmIzmMyZfsxWRsZlWb4x0oZxQx0AhqSNK59wayNdTCJUR5ly9E/Xs9AfMoFLg6imfVsmjSOyZWbNhncsJ1j6lktimLCLbb3xUdPXSs= 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=k4hLi89z; arc=none smtp.client-ip=209.85.218.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="k4hLi89z" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-b736ffc531fso2517343466b.1 for ; Mon, 05 Jan 2026 01:01:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603712; x=1768208512; 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=lI5wHWHPkZoWa6RXJi4YHA6pI/GlnYu1Dg9xlHUDElY=; b=k4hLi89zfbMvP3FT9aF1iAO+Es+NanrnhsAoQIxJOYy7DTj46wvxifCZlRKQCJIu0B NOoMfyn14WOXjo+EVb5uXxavcyGx9vb8x1asthOXhR2j3fsM64Gq580ehZqyuIqeOFrg Lw/RZkrGfpk/DQ69czlLOQgRrvfeBE8lQydPYFucHe+Hb6L/vCFV2vJezOvCwteWGIMS 4150shOv/pviCEKkfKzeFnWhF7RNai74MfVX0Rt6qOfUFhV3FlZZQkrgy0alVOiu68aA lnQpKf6Yh7lq1SjQ6BSPMbvnsKiVqL9HE/z9RBz09wO22nqaKqOpHHu44j1NhCtvykU7 5PTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603712; x=1768208512; 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=lI5wHWHPkZoWa6RXJi4YHA6pI/GlnYu1Dg9xlHUDElY=; b=O7xgW+On+XFDNDm0PupNWeDik6xcP0Zsecalv/tZR+8Yg1WbjOEXkWHZVCBAvZENbk Vo7a+bMvrFMK88BB28IYlJ769lpZNnyE6ZALZJnIdLWaQAcef/QZ70VfOxHIjUB8MYC8 nogXZcK6lB/sE7NWOba8kciqijzOvjH7a81Bs0W81fJT7kvotAKtqlGD5/ROOotDW8qL NJIQh1QlHawOk1VtIaKTYoSq/75i/+/DDRrporLl4gMY2NGFKnzvNIiGPhIhhYf9jcSQ v/Iix/Q9kdu0bc3gGAgenoPdhNjbxAuOp18Fgd3CMyfhsqzoCRjIJShXXjxDLhljpmBj Ts8A== X-Forwarded-Encrypted: i=1; AJvYcCUc53u2rRFPhQ8tgHK0q9LjLj+9HHhRZmFXbkppyL5GiDfDg7HmTzMyyOFvXfDg9kZ5cttYYoHfKlQnm3I=@vger.kernel.org X-Gm-Message-State: AOJu0Yy+xGyqrr6W195GqOKHOvISZjM141q0dEl53fkWxzaTataEVoce jBU3yySihfycZGBAUD50SGsFkH6HbTH0XRX+SnaCGGGA+MLaXcpsuIbGVTNi/G+xkgw= X-Gm-Gg: AY/fxX6FidxObmZpzL2uZd3Rj1FlS4BU4ZXliqbiKTztFtrv5YH0G6H2Tg4fHwZRysu sqG5qt2hKNUUJrRCXGwui7Fo4C/uwaf8qPEzAEbrRuRsxz+KHh3Pw/jvs0O1ZF7mCwITUfAgJv0 FmqP6nBd7I8qbjoYWKM/DezEzI4tVzl8BWiojA8rlgUYuhr8y868yOegGFu/TRULT8AAo4ikION oXAItcglsoYCNU6WVB+8vvXTnVguKmJYkNZjW4b/MdA+h4PsTwbIN0iLmT6pdQKjGYhcRtb19lt AAT88zXi44nSEdpEGUi13m0ku7CgU3GbgZ6KY/rbOMuqLoA8oiQSvKyOEPFbqUFwz+C2aSRryy0 0LwEOAuHEAWVqGQjzAsutgSrt/brdHYpYCNkdy7UEGNQ16GNYD/6B6y4f3s2rJqLAlo0xQ1Xf6I Ika3tLEL9l39RjPYRHgvgU6++YoeWUnolqFpQB5c9HonQIxfQdfaY0RRe1YPsGRJQeBD+CSjkHJ YunEA== X-Google-Smtp-Source: AGHT+IFDmkTA3kk2LRTmChJa/Czgvet3S+Fm7/iPQj22kuMOT8Z0lHyYx+OIROySTz3sxHvejxVm4Q== X-Received: by 2002:a17:907:90d5:b0:b80:3fff:336a with SMTP id a640c23a62f3a-b803fff343cmr3541873966b.21.1767603711364; Mon, 05 Jan 2026 01:01:51 -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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:51 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:55 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-19-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij 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.351.gbe84eed79e-goog From nobody Sun Feb 8 21:32:37 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 EAAE532E126 for ; Mon, 5 Jan 2026 09:01:56 +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=1767603721; cv=none; b=S0bDhCFsfL6BpxRNuMjvbKkRguooTXjvk0u49N0oAbKygNtJlnPOvLHtOeSB8WP9lL8/iZvyNXIoLaA38rDDtYdTpYymOlHLAIWQeLa37L+ca0pcqULd4Et8/oJkWkxnOC36Ff67aBlzjqXPYVZUc9m65UVz3+pPe3WQ42+kdsI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603721; c=relaxed/simple; bh=gdA0sZvZ0YzUA5VbllhyP/LA1RBGbn5sCuJW2ofmkv8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AVgrisXBSnWEbxh0T5OqA5CLfC4ZYFircG9/j053203nYO8kxyp1Ggcbh7qCPM4npHoMZEyIsnRZMtX2JYjbrfcIbID1XntNaiKZrnBAXJ3S2BAJ8IEQUVBqUoWsmLIPZGjTy2Ez/geAhW6iue04IGi3QRe0hGLnX/jCXXDlU6s= 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=dfpL1WuY; 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="dfpL1WuY" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-b7ffbf4284dso1868018666b.3 for ; Mon, 05 Jan 2026 01:01:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603712; x=1768208512; 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=bdm4unydgK85s5YLaStWETQ4AILRmGjAlJ/lhyhIAds=; b=dfpL1WuY0jAcr/AfgQScMKsRnyEZvVotB4yzFf1kMJrEcoliiu6bpT4MYXcz9u1XHO VssTyQKnI3vJefNQI9P3KIaIyM7FfrCejcuNBfGmuOLYZ39Cb8r1Skml+55IrOlpTs/c 0K93viX0pjYkp0JO+2eTdDc96NZ/cVLYf8RCKTML8YE19ag2mVH+IzvG+Mjre66YV7NT 7F8f43ttC9ETjO9uhJx3c98/+n0UONOutbmuS0dwnogX7FiLBx4wbWdKmQfyAw9KdtMu RO/ktw2oTr8SZoJx6GCpSbjIp4kaPH6MelY8NRqwcFeSuVJIFElk5wXH4bSvbZbTubdl adGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603712; x=1768208512; 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=bdm4unydgK85s5YLaStWETQ4AILRmGjAlJ/lhyhIAds=; b=K+2QKega6zz1r7y4Z/gXw2TTX4QxAmS6N5yhjyuHEa5G04WuW7wt6fZDUXMSAegojQ AD2UBcP4mPNraMyyunXGdPAFV3IvXrNLizTKD9g0wvVe6+RregcHvu+wLZDhUYus3bNp NOO9B5wsruTSpiKHn1h7d006LbRuB5h1Dw3moOa5flPFK6+2Er1oPOBaK/CaV9tZ/kPU sQjVr4tey6CF4kxckCS6m9L3EEjrLl9RO7WGLJnh5+7OVGaQ9XW5WZoiqHPVsNsiEEfc 5RRRCoNS+ndCF1QVVPX0rGn/Exx3khayp+UDeorh4XTRzn8TorfNBRPsXG5es1gtNzIC Kf8g== X-Forwarded-Encrypted: i=1; AJvYcCXSas7RO7boZjDAxHdHfeJ3GYWVhLdmCrh2BONiKbIOpEPcZOK3mR7ADstRLe3Df9zEtmaqfmgbxjsPCOY=@vger.kernel.org X-Gm-Message-State: AOJu0Yyjl16pA1gOJqxNVX/ZVL253npvD92af+y9Ijhi4BxggYuPW/Sk IoeVUCzWijxLQVSajV+YwHDqgNb3yXBTRGmG2v1TGN6pK0YiNGt+hOHIaWyWwP0ghcU= X-Gm-Gg: AY/fxX68ZCJKhm9hTOmp75exFAeL+S1QEOSEqpzbQrMmpPIlRfhRyY6rvqXY9dc+LCG WrC7sw7aXIq7KjjBoBrZCfYelig6JwOIhpvp/9JWRiS9RlPT5mUaxvQwueHsOMp0W0lK+61UXr4 sq4sDLtvd+cgMpZzqkQaIznBeSJ3bvbrkJvi/5FB6pDyJovM5dkONlCgIcTCbtcPLRIwlZ/jgaw t/K8GddFuNITPfOCXWocWcLEHh9V7l/YdhVB+Tq0E7s5xwvWnaoB17pBhH1ptEvvhP1DzNXPC27 uFHAhUfA+YRf+I3US4ACdq4N3rFm58uvyH40G8yfwmqmb8gGT8lWjWlJ3KDKyikT2Lld5Liu6rK rKpo/Lnhe3tJUHa7l7mbdoKrYmY1QG1iLUkClSV5YfjoV/NlbjVVjJVdsIwhHG2WRHvVjGvEON3 2uJk3IBVZWKGs+Rbhk7jtMZpsx6ab6ZkgIsqoL66sdA49IUVP6xHR3IkPMFupvQIWL6ZbdazeUA CFFyg== X-Google-Smtp-Source: AGHT+IGpEAwTdgiIFqYVLwZr5Dshta5wUiaNkwk7GiDRbOtmpc5D7uh2c6qY0I7WpfIMYQ7/WqMhpQ== X-Received: by 2002:a17:907:847:b0:b83:c81a:197e with SMTP id a640c23a62f3a-b83c81a199fmr1121260466b.24.1767603711921; Mon, 05 Jan 2026 01:01:51 -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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:51 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:56 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-20-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij 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.351.gbe84eed79e-goog