From patchwork Tue Jul 11 14:22:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13308865 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC87EC04A6A for ; Tue, 11 Jul 2023 14:23:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233327AbjGKOXs (ORCPT ); Tue, 11 Jul 2023 10:23:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233930AbjGKOXV (ORCPT ); Tue, 11 Jul 2023 10:23:21 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2A321BE5 for ; Tue, 11 Jul 2023 07:22:51 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-4f95bf5c493so8623279e87.3 for ; Tue, 11 Jul 2023 07:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689085360; x=1691677360; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=I8/R65mfXAHzbxX/Yt/oiagP1RewF0H/jSZoqHRKyvw=; b=dCOHcZgRV7aQaBQJZEZkD8dFT9zvxOL0hkhcvBNSBUON9Vq4i7QBWmjlgIK0rUhj5G X8bilbLBLi4EO2GlwctmtGL0ZCFgHrPHSaGK5pf5J5yip06zF6HeHRI57NNcaOYcOh66 ZquLBr6OKIgvq5KwVU/MeHe1sfkNZ+qprXu0K3+H5E0/8ghjptf9HJb3ZHEuxzdE9Ypo wgQnTFka3NbUsTQOR7Q4yOkpIbswbJRDqOWDQQV7yvsB5kG/P2BLIRxF9WSzupo9q9OK yAl0MFVP+1ity570RkO9aeo3VDFQnA2p4hEkl0EA1DJNAVSX/NSZFHFM1jDEYHgbl1rm Wr9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689085360; x=1691677360; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=I8/R65mfXAHzbxX/Yt/oiagP1RewF0H/jSZoqHRKyvw=; b=fhs0L6YV7tEDWKcR5xVhLaavmjg2MfjeApzqwu4ZEp3PQtrgZUvaIdeb/+wg9uaXZo jhPd+h8EDTF+Fan0srXTAJRNebKk28PkdLbFpo7ET4+L8HsaZj2wqKxiQ7fCdI6rnJaf 5TA/EtAYiLnBxxS9vUjF0LPj1peZ6raiufYOUmJhf0fLeAzHu16zNk2NXzLW3SjpfegB oFlA+qcad3k6ZDN8uAr7ibCQtP5fuPtp5cGk/jP3S+StVT1X8amDBIQOlbC03yQW/7yi nRWyJeeU+QbmWF0AjmpUstzB0wjNPJ4gP3FeVkZQ+NMPAhsUyheV7IieB8yKYPcAbYr7 y9LA== X-Gm-Message-State: ABy/qLbZ/VjJCcEvjmNK41T3HfhfcE0swQmTs9L/GhZL+xM+cBtGZsFa v157mv/hJrGfQFmFR9g8P5Sbig== X-Google-Smtp-Source: APBJJlE/tivtaqrrtnHL9NcH9jALxO9JvYPsHziSzSo82znvSr4dpsGom1ZqDwK6Qbzn+voN8gwwvw== X-Received: by 2002:a05:6512:2017:b0:4fb:89e2:fc27 with SMTP id a23-20020a056512201700b004fb89e2fc27mr12392141lfb.54.1689085359868; Tue, 11 Jul 2023 07:22:39 -0700 (PDT) Received: from uffe-tuxpro14.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id eo29-20020a056512481d00b004f85885cff1sm337106lfb.134.2023.07.11.07.22.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 07:22:39 -0700 (PDT) From: Ulf Hansson To: Arnd Bergmann , Olof Johansson Cc: Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linus Walleij Subject: [PATCH v2 17/18] ARM: ux500: Convert power-domain code into a regular platform driver Date: Tue, 11 Jul 2023 16:22:37 +0200 Message-Id: <20230711142237.751837-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org To make the code more standalone and moveable, let's convert it into a platform driver. Cc: Linus Walleij Signed-off-by: Ulf Hansson Reviewed-by: Linus Walleij --- arch/arm/mach-ux500/cpu-db8500.c | 5 ----- arch/arm/mach-ux500/pm_domains.c | 25 ++++++++++++++++++++----- arch/arm/mach-ux500/pm_domains.h | 17 ----------------- 3 files changed, 20 insertions(+), 27 deletions(-) delete mode 100644 arch/arm/mach-ux500/pm_domains.h diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 7cc0dd8ed991..b1a70f203372 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c @@ -26,8 +26,6 @@ #include #include -#include "pm_domains.h" - static int __init ux500_l2x0_unlock(void) { int i; @@ -115,9 +113,6 @@ static const struct of_device_id u8500_local_bus_nodes[] = { static void __init u8500_init_machine(void) { - /* Initialize ux500 power domains */ - ux500_pm_domains_init(); - of_platform_populate(NULL, u8500_local_bus_nodes, NULL, NULL); } diff --git a/arch/arm/mach-ux500/pm_domains.c b/arch/arm/mach-ux500/pm_domains.c index 427b9ac4af6c..3d4f111ed156 100644 --- a/arch/arm/mach-ux500/pm_domains.c +++ b/arch/arm/mach-ux500/pm_domains.c @@ -6,6 +6,9 @@ * * Implements PM domains using the generic PM domain for ux500. */ +#include +#include +#include #include #include #include @@ -13,7 +16,6 @@ #include #include -#include "pm_domains.h" static int pd_power_off(struct generic_pm_domain *domain) { @@ -49,18 +51,17 @@ static struct generic_pm_domain *ux500_pm_domains[NR_DOMAINS] = { [DOMAIN_VAPE] = &ux500_pm_domain_vape, }; -static const struct of_device_id ux500_pm_domain_matches[] __initconst = { +static const struct of_device_id ux500_pm_domain_matches[] = { { .compatible = "stericsson,ux500-pm-domains", }, { }, }; -int __init ux500_pm_domains_init(void) +static int ux500_pm_domains_probe(struct platform_device *pdev) { - struct device_node *np; + struct device_node *np = pdev->dev.of_node; struct genpd_onecell_data *genpd_data; int i; - np = of_find_matching_node(NULL, ux500_pm_domain_matches); if (!np) return -ENODEV; @@ -77,3 +78,17 @@ int __init ux500_pm_domains_init(void) of_genpd_add_provider_onecell(np, genpd_data); return 0; } + +static struct platform_driver ux500_pm_domains_driver = { + .probe = ux500_pm_domains_probe, + .driver = { + .name = "ux500_pm_domains", + .of_match_table = ux500_pm_domain_matches, + }, +}; + +static int __init ux500_pm_domains_init(void) +{ + return platform_driver_register(&ux500_pm_domains_driver); +} +arch_initcall(ux500_pm_domains_init); diff --git a/arch/arm/mach-ux500/pm_domains.h b/arch/arm/mach-ux500/pm_domains.h deleted file mode 100644 index 33c55f2c6b3c..000000000000 --- a/arch/arm/mach-ux500/pm_domains.h +++ /dev/null @@ -1,17 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (C) 2014 Linaro Ltd. - * - * Author: Ulf Hansson - */ - -#ifndef __MACH_UX500_PM_DOMAINS_H -#define __MACH_UX500_PM_DOMAINS_H - -#ifdef CONFIG_PM_GENERIC_DOMAINS -extern int __init ux500_pm_domains_init(void); -#else -static inline int ux500_pm_domains_init(void) { return 0; } -#endif - -#endif