From nobody Thu Apr 9 18:46:45 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 8203E37E31E for ; Fri, 6 Mar 2026 10:30:02 +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=1772793009; cv=none; b=UCMYttxqDYUTvzy6IFVaF+rhcfK6QYbT9NrdneQoCq0w6lhYjSP4I3xzgZTMy5Xpg6p6HKKx056CMLG6VA6TvZjQKyaSE6DUd78LAGDSGfqulB4udWT1UUz+orcVSEGRGbboWTchHBn14FgK5gh0HytWjHaWue1l0M8H+/VngTU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772793009; c=relaxed/simple; bh=NS+1Od4aVlTq9Wx7bCSooHKRSz+R9G4t7LsBp+nXiI4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=vEV9AU/rPcPW5oFX09FvA8ecD793VXLuqXc9PwuAJJC9tFBKnIa7NmQgy/fewZZsnciNgHMX38TVO+nDfsnS1RqKO4VmYnhRXBYJ3kmBTMqqhr5gv5KVhonQRI9TU8emPg0L3yHTc48fUdCkxslRMEgnjPUCr/kGQ6WPR3/5h40= 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=xgrMqsqP; 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="xgrMqsqP" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-660fc3f30c1so3931753a12.1 for ; Fri, 06 Mar 2026 02:30:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772793001; x=1773397801; 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=Z+RpBQOuQW07kF7dgJNXDXfeT4g3XJJZS09GBpqTzzg=; b=xgrMqsqPCyPpiMffrm7NgJB0YV6/Kycvu/OwRzErzGYUSpggnw154a4M6ckLlUa6mu YfNYM7Abq6VYMtbJvh+yDu4yo71yPBW4JsJZ+m03IB7FqQQNanjbWv9jsN9VBDQwsa54 vcJpME/h/zLJ6aqITJ+4Roqzm2nbCQyik5uwvCp2sYzITKZI3qRktJ4RzJFZgF4APCUb u/7lhVBgpPqXVy/2YQGxgmnRIS7g/QtY61wkt28wsaykgQmqCgJnzWbbrkvpVSi2lhi1 z2k9ZSyEBfu/KPxoIhauH+Vc7kj6c+UNg5tumKT0P7DicyW++VhVkl9Zl5LddwhApHJJ 4k9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772793001; x=1773397801; 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=Z+RpBQOuQW07kF7dgJNXDXfeT4g3XJJZS09GBpqTzzg=; b=iAvgXyQOMxQOqKu3VUhk8RDCLPsNU0Q+4JtPCs5H9kfa1cXNRI1kdIjbzlE3j8gUFj o+AUORRbSZMVXiN7SPN4utsxZM3e0ciPnIj6o2zgxrVWBHWDWCnmehqxrltWbs29rXQm P++Pqz1IP6WBr6NE5ZGFZp49/TP1yQQZQ0E6Ux1Ygupexc2xdQTKLUuDMvSR1ZwwgJIl 1kB258j+U5AwU9RSfP54gxnea2Hf7luPiLeZ6657B8KzO5dKlStN7XOcQ8oiJzCxu7It VEMvZM8xjg08hJoPxgE2uIbquHrPDAnyOvIkc3bM7TJUDlzq/Qt5FstTWkZ22HWoKAne BayA== X-Forwarded-Encrypted: i=1; AJvYcCVX0Kv5W0fnG2JNlFRZcNS/lMulIfHW89Z0TN4Y9icRNmWlPA609ZFKNwZEEUouEwemZWRy7aV3ZLaTsR8=@vger.kernel.org X-Gm-Message-State: AOJu0YzcLimcDBWMJjykv/TC1fVeEmSfoI1hma/ulboYBxKFBpFsklaJ n1/sMpRIrcumlu8VIqNknSn7eKvr7xGg7E5yp+kHr8R6mnO8WWxwlDKThCHPfDJcfTc= X-Gm-Gg: ATEYQzzkyAMLCrT+4eaECFhNLTcIb89ol8SREU9IRQ35f2wk9HoaO8Ja7oJRl3U4JZw hWTw6ltLTY3i6FlGkU6wXEAQPLHW2e2oNYdqRUUaAt2QohM/1/Sv5PutuJGTukRDt2VX9eGH0ZH 8WA7cc0ShJriE8YFOrGmKKeBbxyCM9YJRFz2etWbClcU0WHq3naN10KJXPvw0YSXLZvuknRqon8 jZxQiEyZCHMnJEoyzcAJfoMvQ9b+oaTdmH8P4YbLZjAbH9Bq5NIUVkN1T0r6Ll4PjvwFzE3pJuP OBaMTWz3jbaFSIklnFtIKzR/bWF/JPjz312QytR3HQVQPne+MdxieNFgFsbbxg5gb579nNAX0qS ZJ89oH5tSxa1iHX2YAAk5dF6UI34EOBZ7dOySKUaeqOP+yA7nQSPnXuw4AGX99o9HNgE17lMY5g dDxSCjDFTtYeYMvYmIRBU4rGezIYXWKsGjPxs6Ot/1rqWwy7Fz0O/Jj0+mR0r3gvuI/cK/FklpA rpmT14FOL8XXyU= X-Received: by 2002:a17:906:f59a:b0:b93:4d73:e8af with SMTP id a640c23a62f3a-b942e0315e5mr100179566b.58.1772793000481; Fri, 06 Mar 2026 02:30:00 -0800 (PST) Received: from puffmais2.c.googlers.com (221.210.91.34.bc.googleusercontent.com. [34.91.210.221]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b942ef8c95csm42907266b.21.2026.03.06.02.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 02:30:00 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Fri, 06 Mar 2026 10:30:01 +0000 Subject: [PATCH v7 10/10] pmdomain: samsung: implement domain-supply 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: <20260306-gs101-pd-v7-10-03f7c7965ba5@linaro.org> References: <20260306-gs101-pd-v7-0-03f7c7965ba5@linaro.org> In-Reply-To: <20260306-gs101-pd-v7-0-03f7c7965ba5@linaro.org> To: Krzysztof Kozlowski , Alim Akhtar , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Ulf Hansson , Liam Girdwood , Mark Brown Cc: Peter Griffin , Tudor Ambarus , Juan Yescas , Will McVicker , kernel-team@android.com, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.3 Some power domains on Exynos are fed by a regulator rail and therefore regulator control needs be implemented for Exynos power domains. On Google gs101, HSI0 (USB) is one example of such a power domain. While at it, add a to_exynos_pd() to avoid direct use of container_of() in various additional places, and update existing code to use it. Signed-off-by: Andr=C3=A9 Draszik Reviewed-by: Peter Griffin --- drivers/pmdomain/samsung/exynos-pm-domains.c | 53 ++++++++++++++++++++++++= +--- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomai= n/samsung/exynos-pm-domains.c index f59986b56213..ed7a5807555b 100644 --- a/drivers/pmdomain/samsung/exynos-pm-domains.c +++ b/drivers/pmdomain/samsung/exynos-pm-domains.c @@ -20,12 +20,15 @@ #include #include #include +#include =20 #define EXYNOS_SMC_CMD_PREPARE_PD_ONOFF 0x82000410 #define EXYNOS_GET_IN_PD_DOWN 0 #define EXYNOS_WAKEUP_PD_DOWN 1 #define EXYNOS_RUNTIME_PM_TZPC_GROUP 2 =20 +#define to_exynos_pd(gpd) container_of_const(gpd, struct exynos_pm_domain,= pd) + struct exynos_pm_domain_config { /* Value for LOCAL_PWR_CFG and STATUS fields for each domain */ u32 local_pwr_cfg; @@ -39,6 +42,7 @@ struct exynos_pm_domain_config { struct exynos_pm_domain { struct regmap *regmap; struct device *dev; + struct regulator *supply; struct generic_pm_domain pd; const struct exynos_pm_domain_config *cfg; u32 configuration_reg; @@ -64,12 +68,10 @@ static int exynos_pd_access_controller_power(struct exy= nos_pm_domain *pd, =20 static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on) { - struct exynos_pm_domain *pd; + struct exynos_pm_domain *pd =3D to_exynos_pd(domain); u32 timeout, pwr; int err; =20 - pd =3D container_of(domain, struct exynos_pm_domain, pd); - if (!power_on) { err =3D exynos_pd_access_controller_power(pd, power_on); if (err) { @@ -126,14 +128,45 @@ static int exynos_pd_power(struct generic_pm_domain *= domain, bool power_on) return err; } =20 +static int exynos_pd_regulator_enable(struct regulator *supply) +{ + return supply ? regulator_enable(supply) : 0; +} + +static int exynos_pd_regulator_disable(struct regulator *supply) +{ + return supply ? regulator_disable(supply) : 0; +} + static int exynos_pd_power_on(struct generic_pm_domain *domain) { - return exynos_pd_power(domain, true); + struct exynos_pm_domain *pd =3D to_exynos_pd(domain); + int ret; + + ret =3D exynos_pd_regulator_enable(pd->supply); + if (ret) + return ret; + + ret =3D exynos_pd_power(domain, true); + if (ret) + exynos_pd_regulator_disable(pd->supply); + + return ret; } =20 static int exynos_pd_power_off(struct generic_pm_domain *domain) { - return exynos_pd_power(domain, false); + struct exynos_pm_domain *pd =3D to_exynos_pd(domain); + int ret; + + ret =3D exynos_pd_power(domain, false); + if (ret) + return ret; + + /* Ignore regulator errors - the domain was disabled after all. */ + exynos_pd_regulator_disable(pd->supply); + + return 0; } =20 static const struct exynos_pm_domain_config exynos4210_cfg =3D { @@ -283,6 +316,16 @@ static int exynos_pd_probe(struct platform_device *pde= v) if (ret) return ret; =20 + /* get the domain power supply if required */ + pd->supply =3D devm_regulator_get_optional(dev, "domain"); + if (IS_ERR(pd->supply)) { + if (PTR_ERR(pd->supply) !=3D -ENODEV) + return dev_err_probe(dev, PTR_ERR(pd->supply), + "failed to get domain supply"); + + pd->supply =3D NULL; + } + /* * Some Samsung platforms with bootloaders turning on the splash-screen * and handing it over to the kernel, requires the power-domains to be --=20 2.53.0.473.g4a7958ca14-goog