From nobody Thu Apr 2 01:49:44 2026 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2B433E51D4 for ; Wed, 18 Mar 2026 15:28:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773847692; cv=none; b=JxmhNg7he+GKrWMTsf9ou9Hxg3oKUKbjX7KMYlrhLQ7pZpAhqIXwmTYxURp752a751klXPKKpvxhX1b1438kxAUlj+s4zgdpWM00r+H/prB9j2gvR2n1EjBF1YJ/LbKBO7Jq4HI7i5dnKdr9I2lD1DYVk/7Bu33SD4DmvlOGzAg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773847692; c=relaxed/simple; bh=UkTCfc6XZM2Ar1gydVKi5SOEwg4Ph7SOC1EYcnOcfC4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Vq0an4mQt5qajnX8wJy5CZs8gtpVXYMwBRMYY637g5srERkpQPiZughP0CE/2Yponxt+xTAyI6PMy6iZzdQLgvy4Dh7HxISmgzimd97skOd5O7PrlVc+L0NWrYouACrcCg1SR85NOItriYaUbTs8iaiZFkcB6wx0lqrFZ9fUaFk= 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=zttRsLUH; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zttRsLUH" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-66732a99928so63027a12.0 for ; Wed, 18 Mar 2026 08:28:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1773847684; x=1774452484; 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=cLahL8mmAQrPbIGTcTRAY4s4CIuPNd3v6Qz0S44aYi4=; b=zttRsLUH3tXyV2A5jd/Pl9ynVZ+cY7dd1FefnrmywgllXYqyRp2CCDCNXg/ddhQ1jr h3axC8miEzCn0uPaoAt7kfGrUppvHBDGzF78/X+5Iyd3R3RDWPWoWvgL3jQ4tx/eYrSl /3IInzOygclkCsgw9wVHqSAlZS6MPnr5fNdxnuq4VU6XWztuG0JJrc7Xj9ZlQFfYFlcb C+9c9VXbtjhLcmzWxzpB7+Mgk8P/ceSLTPkjiKq1oE8HZd7aZwHVWIvbBljpdJUATl72 iAAHpVxMop6ThxQHYgbNLAxNryl8a0zqhqBka6qiBU64wo1RUHUdXujh5f2sDLl5sTmw oJdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773847684; x=1774452484; 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=cLahL8mmAQrPbIGTcTRAY4s4CIuPNd3v6Qz0S44aYi4=; b=m6a48TifOk+p0XOWHPMd5AYxe5GyOuYb7GCAZpJx4MzdgAupiUxa4b/D5v7BVZgv0k XHu2aYLsUZj46hxHAzQdGNISUCIJRzhjr/fiy705guFHOXMPIHhFXtQY4aWCXcn/PCvd bSdN1xfLCHQq85UsKN/1di33U4fneiMOIWp0ilxrwMB1ycm7/x4F6FXRZPN9+B44GJcS 0Pe2ur331p4XHI+TPFiCtDVuyi5TYnyoQ+F1RlnwMdZTEcHfJ0elW5f6SvkOwNKJN0E2 aZARv2lzonkPRCKdestSYo09pqbjGsMa3UEKXzYSPR/U7SmqPV2su7vBKDIMub01qSdj 0B6w== X-Forwarded-Encrypted: i=1; AJvYcCW93wV2tvx9x1jqVHRmKlDnKuylyqG8wxn17unhWo1rzTqXyeU0rLdojap3fStQJhcaooCc09cGxIWdu5E=@vger.kernel.org X-Gm-Message-State: AOJu0Yxy82rSIZYnr83GgNkbhmwT5Hvtjr9CHfDxkauL4Pr+HgUsyNEY AJ5tMV59SQFJuezkswgHKXcJs1LDamC9MYAEPy1f6slH1abXigsgKr+JxRjJJwwZ7yo= X-Gm-Gg: ATEYQzwIsbeEsrA5APJnVWOgXVQewY3aBY41eBHpKDwUkUBlxDTZDhAqPDE9ZO4hMKs M6uy1RyJQsSMvMDAdpqc8UfT/tQpRvDKEjd8oHJuuWJMnxqpjdsIO9VICQ/eEwv3RTNWvg7sxyt 36m9aV4PgGUFt6efPf6GdpAwuNtc/8Oumon/cdHCfHT+LVFDTtySgCRsyPCUjE90dFvbXgYG8LV UCrIprMBnF72R8ySsRiRALJFhSvmFeLjKwrFqF0AHdXezlHtpKNJAqFzLJSycXx66hQSN4CmyNZ XC64WW8I+kg/QYA0fQM+FcZTKJxwH4nQ6tZ3ij/O4RidKRkEsqghs0oGv1UbK4snHeDpE9Fp+1i iH63ozmfffBwvAUu59hbk4AhxNoNIO/6DnX8fAO8Sv46GsrVskF9sSKkc7nqIZcnDDUGdE7PdQF nj799C6Ub2+geN2Ep8Fq+3m5NZsrjU1zYBHDpfdtJPXtTEuM1T0CmOKmvFIXRRFMB1vQqPiXALW GX19c7NK2soi3s= X-Received: by 2002:a17:906:7f13:b0:b97:f12a:3f8c with SMTP id a640c23a62f3a-b97f493e995mr155819266b.20.1773847682553; Wed, 18 Mar 2026 08:28:02 -0700 (PDT) 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-b97f173a3e3sm226989566b.61.2026.03.18.08.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 08:28:02 -0700 (PDT) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Wed, 18 Mar 2026 15:27:52 +0000 Subject: [PATCH v8 07/10] pmdomain: samsung: add support for google,gs101-pd 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: <20260318-gs101-pd-v8-7-241523460b10@linaro.org> References: <20260318-gs101-pd-v8-0-241523460b10@linaro.org> In-Reply-To: <20260318-gs101-pd-v8-0-241523460b10@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?= , Marek Szyprowski X-Mailer: b4 0.14.3 On Google gs101, direct mmio register access to the PMU registers doesn't work and access must happen via a regmap created by the PMU driver instead. Add a flag to the device match data to denote this case, and obtain the regmap using the parent node in DT if true, while keeping to use the traditional direct mmio regmap otherwise. Additionally, the status is just one bit on gs101. Tested-by: Marek Szyprowski Signed-off-by: Andr=C3=A9 Draszik --- v8: - Update offset calculation into parent regmap. DT's ranges property now properly denotes PD address space to be an offset into parent node. Change code to account for that and subtract parent start address to get the offset back. v4: - add 'use_parent_regmap' flag instead of going by 'syscon' compatible in parent, as it's not a given that the parent provides a syscon- compatible regmap (it actually doesn't anymore after recent changes on gs101) I've still kept Marek's Tested-by from v3, as legacy Exynos code doesn't change. We need the offset as we use the parent's regmap. --- drivers/pmdomain/samsung/exynos-pm-domains.c | 74 ++++++++++++++++++++----= ---- 1 file changed, 54 insertions(+), 20 deletions(-) diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomai= n/samsung/exynos-pm-domains.c index 3aba00b9ddef..f8c0d11e9b33 100644 --- a/drivers/pmdomain/samsung/exynos-pm-domains.c +++ b/drivers/pmdomain/samsung/exynos-pm-domains.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -21,6 +22,7 @@ struct exynos_pm_domain_config { /* Value for LOCAL_PWR_CFG and STATUS fields for each domain */ u32 local_pwr_cfg; + bool use_parent_regmap; }; =20 /* @@ -93,8 +95,16 @@ static const struct exynos_pm_domain_config exynos5433_c= fg =3D { .local_pwr_cfg =3D 0xf, }; =20 +static const struct exynos_pm_domain_config gs101_cfg =3D { + .local_pwr_cfg =3D BIT(0), + .use_parent_regmap =3D true, +}; + static const struct of_device_id exynos_pm_domain_of_match[] =3D { { + .compatible =3D "google,gs101-pd", + .data =3D &gs101_cfg, + }, { .compatible =3D "samsung,exynos4210-pd", .data =3D &exynos4210_cfg, }, { @@ -122,17 +132,9 @@ static int exynos_pd_probe(struct platform_device *pde= v) struct of_phandle_args child, parent; struct exynos_pm_domain *pd; struct resource *res; - void __iomem *base; unsigned int val; int on, ret; =20 - struct regmap_config reg_config =3D { - .reg_bits =3D 32, - .val_bits =3D 32, - .reg_stride =3D 4, - .use_relaxed_mmio =3D true, - }; - pm_domain_cfg =3D of_device_get_match_data(dev); pd =3D devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); if (!pd) @@ -143,25 +145,57 @@ static int exynos_pd_probe(struct platform_device *pd= ev) return -ENOMEM; =20 /* - * The resource typically points into the address space of the PMU. + * The resource typically points into the address space of the PMU and + * we have to consider two cases: + * 1) some implementations require a custom regmap (from PMU parent) + * 2) this driver might map the same addresses as the PMU driver * Therefore, avoid using devm_platform_get_and_ioremap_resource() and - * instead use platform_get_resource() and devm_ioremap() to avoid + * instead use platform_get_resource() here, and below for case 1) use + * syscon_node_to_regmap() while for case 2) use devm_ioremap() to avoid * conflicts due to address space overlap. */ res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) return dev_err_probe(dev, -ENXIO, "missing IO resources\n"); =20 - base =3D devm_ioremap(dev, res->start, resource_size(res)); - if (!base) - return dev_err_probe(dev, -ENOMEM, - "failed to ioremap PMU regs\n"); - - reg_config.max_register =3D resource_size(res) - reg_config.reg_stride; - pd->regmap =3D devm_regmap_init_mmio(dev, base, ®_config); - if (IS_ERR(pd->regmap)) - return dev_err_probe(dev, PTR_ERR(base), - "failed to init regmap\n"); + if (pm_domain_cfg->use_parent_regmap) { + const struct resource *pres; + + pres =3D platform_get_resource(to_platform_device(dev->parent), + IORESOURCE_MEM, 0); + if (!pres) + return dev_err_probe(dev, -ENXIO, + "missing parent IO resources\n"); + + pd->regmap =3D syscon_node_to_regmap(dev->parent->of_node); + if (IS_ERR(pd->regmap)) + return dev_err_probe(dev, PTR_ERR(pd->regmap), + "failed to acquire PMU regmap\n"); + + pd->configuration_reg =3D res->start - pres->start; + pd->status_reg =3D res->start - pres->start; + } else { + void __iomem *base; + + const struct regmap_config reg_config =3D { + .reg_bits =3D 32, + .val_bits =3D 32, + .reg_stride =3D 4, + .use_relaxed_mmio =3D true, + .max_register =3D (resource_size(res) + - reg_config.reg_stride), + }; + + base =3D devm_ioremap(dev, res->start, resource_size(res)); + if (!base) + return dev_err_probe(dev, -ENOMEM, + "failed to ioremap PMU regs\n"); + + pd->regmap =3D devm_regmap_init_mmio(dev, base, ®_config); + if (IS_ERR(pd->regmap)) + return dev_err_probe(dev, PTR_ERR(base), + "failed to init regmap\n"); + } =20 pd->pd.power_off =3D exynos_pd_power_off; pd->pd.power_on =3D exynos_pd_power_on; --=20 2.53.0.851.ga537e3e6e9-goog