Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1155716pxb; Fri, 21 Jan 2022 11:02:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwz8x+eho48hNQrnYdP3mw2Rzw7AVOAM7GR901mdvWtp+qNQxzJiCwhcmGdzOo/BepdeR+v X-Received: by 2002:a17:90a:380b:: with SMTP id w11mr2075852pjb.113.1642791772184; Fri, 21 Jan 2022 11:02:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642791772; cv=none; d=google.com; s=arc-20160816; b=GueZHEeTa/ZHu3uUYGOnKtW+6F4eV30j0xOU5/nPdWHihmctIB5ZapFlW9nnL/g1CM 4R5ZXoKT3+J2Su1vtte/BS3l767Q+JQ9Ev33RGprItdEhA4G6wAMvNadHSCo9Vio/Oy1 fSzl5UbR8b1MbcFs+aaPhkvKJ35yYz7lGtAZy/0lhpN+wN4ap7JPygkYF9CZh0YkVekY a04MK/ekoIbmUsHB7071rSLi2InaRlNKdn/xgR1b+KfxK8g9JFEV2qRg7cYcUS2S4xOg aGlfYzMXg/0yJdw/LDxQbdutG3Pi8vZUAV1cALT958jRXz3fnsW8UfU7F7WzqTPBC0pu SStw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WvX/s8bbTEktU4nVsA2bYW4MFssxw4eAYf+UAFIZXJk=; b=kUNtNOwd6Dll5ZhiMkKAM8ua01cl9Ei9xl6cPEqqIIlK4H8oXbm6anDqO7w+LlORU8 x/84aQtF51KuHuPr91gcGAdKa+IwW3ROqCOPR9Tq2Zth2ZVYzKCccZJNgvvBAZuQObE9 ZAq38mAmIM0BxBfT+upEYMNloMHYmYS6k4V7gLCQKVCRrgrrV3BddP0xN1NgILUekham lkOBcfexjc4TgbHiYuENc9LGgDWgrmZWKFyMCc44bIq57ks+ccby9cpha7fS1GabOypA Y4K/pjOv40cvzEIX4yUus0KQZYSrjx9Oz/hhjueX4qtghnHBpQprgTMEsf52idsHPevO lmFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MrImzy9u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g70si7469455pgc.514.2022.01.21.11.02.39; Fri, 21 Jan 2022 11:02:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MrImzy9u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352719AbiASI6b (ORCPT + 99 others); Wed, 19 Jan 2022 03:58:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352736AbiASI6Q (ORCPT ); Wed, 19 Jan 2022 03:58:16 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1B18C061755 for ; Wed, 19 Jan 2022 00:58:15 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id h206-20020a1c21d7000000b0034d95625e1fso4676353wmh.4 for ; Wed, 19 Jan 2022 00:58:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WvX/s8bbTEktU4nVsA2bYW4MFssxw4eAYf+UAFIZXJk=; b=MrImzy9uu0iUhs/Xqm9UKJkxbxm5+Qqi8tQgEMF2ucgXP8LfgYA5r003iQkJ03ngW0 T6EAqMxa+jwHT2kUV4UkZbAa9mPEmb2UJTiKGvT3X1Vqx/hDuUZFm3duOzuXEkaCtTg8 Qhcakxx3behCG7oNL681AM7jxCA2D4LcsQ8j/2hVCjUWGBBZqn6iBdlEuaZRzfPJ2eXj Z9cWb20P7X0gv1LaQqIvqfHJTEMufI/VwH6OXs7HspX72zdeKrIiWS2iHify/xaKdI1j 6qlonQq2+YjufnyKlRx7rn7ccCHjWdBHikstr8PneqP3fgB2Jl0YmTvTvDsUdfzsbCt9 IZUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WvX/s8bbTEktU4nVsA2bYW4MFssxw4eAYf+UAFIZXJk=; b=Zl/z9gECzHVdbbMNEmwLCWYNI95Cr5V/ngNhPqj1GTI8IJiqbkIO3kVtKcUO4hJThl btRUkoadBw6nSDQanpMBZ3PMlz6LyIzr6rWMHbjclq5nGyn6kBAJUMoDQD2dVP8KwwHI Fx7RKQX901VHAAwir5DbKBc8zUpbc9dBeG5hvGDlDH1SepJCAIbB5HuZc2owmEcitMOr 4r3UtMUONKKe9ryo6zKLsqMtzw++oT0kQpuSfKtovX23+iwD5lmK7Ls8PYr4Xk9EHX9+ ECwA/l8BtJYeOwmru/AMlJ20txlU12doAgoeKiMWgBSLq9JnD3c48ZMrG+6ZB5KBLEO8 79FA== X-Gm-Message-State: AOAM5300j3DtS2dl/Dlnu0zDjdkKcma2Si4ThZ+Bz3/AF0giqSqUkpji TwUp95hU28VzyALJRj5om20ybA== X-Received: by 2002:a1c:7914:: with SMTP id l20mr2394454wme.26.1642582694514; Wed, 19 Jan 2022 00:58:14 -0800 (PST) Received: from localhost.localdomain ([2a01:e34:ed2f:f020:ef34:de48:dc4e:ad87]) by smtp.gmail.com with ESMTPSA id 10sm4491454wmc.44.2022.01.19.00.58.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jan 2022 00:58:13 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rjw@rjwysocki.net Cc: robh@kernel.org, lukasz.luba@arm.com, heiko@sntech.de, arnd@linaro.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Rockchip SoC support), linux-rockchip@lists.infradead.org (open list:ARM/Rockchip SoC support) Subject: [PATCH v6 5/5] rockchip/soc/drivers: Add DTPM description for rk3399 Date: Wed, 19 Jan 2022 09:57:19 +0100 Message-Id: <20220119085719.1357874-6-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220119085719.1357874-1-daniel.lezcano@linaro.org> References: <20220119085719.1357874-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The DTPM framework does support now the hierarchy description. The platform specific code can call the hierarchy creation function with an array of struct dtpm_node pointing to their parent. This patch provides a description of the big / Little CPUs and the GPU and tie them together under a virtual 'package' name. Only rk3399 is described now. The description could be extended in the future with the memory controller with devfreq. The description is always a module and it describes the soft dependencies. The userspace has to load the softdeps module in the right order. Signed-off-by: Daniel Lezcano --- drivers/soc/rockchip/Kconfig | 8 +++++ drivers/soc/rockchip/Makefile | 1 + drivers/soc/rockchip/dtpm.c | 59 +++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 drivers/soc/rockchip/dtpm.c diff --git a/drivers/soc/rockchip/Kconfig b/drivers/soc/rockchip/Kconfig index 25eb2c1e31bb..6dc017f02431 100644 --- a/drivers/soc/rockchip/Kconfig +++ b/drivers/soc/rockchip/Kconfig @@ -34,4 +34,12 @@ config ROCKCHIP_PM_DOMAINS If unsure, say N. +config ROCKCHIP_DTPM + tristate "Rockchip DTPM hierarchy" + depends on DTPM && DRM_PANFROST && m + help + Describe the hierarchy for the Dynamic Thermal Power + Management tree on this platform. That will create all the + power capping capable devices. + endif diff --git a/drivers/soc/rockchip/Makefile b/drivers/soc/rockchip/Makefile index 875032f7344e..05f31a4e743c 100644 --- a/drivers/soc/rockchip/Makefile +++ b/drivers/soc/rockchip/Makefile @@ -5,3 +5,4 @@ obj-$(CONFIG_ROCKCHIP_GRF) += grf.o obj-$(CONFIG_ROCKCHIP_IODOMAIN) += io-domain.o obj-$(CONFIG_ROCKCHIP_PM_DOMAINS) += pm_domains.o +obj-$(CONFIG_ROCKCHIP_DTPM) += dtpm.o diff --git a/drivers/soc/rockchip/dtpm.c b/drivers/soc/rockchip/dtpm.c new file mode 100644 index 000000000000..0b73a9cba954 --- /dev/null +++ b/drivers/soc/rockchip/dtpm.c @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright 2021 Linaro Limited + * + * Author: Daniel Lezcano + * + * DTPM hierarchy description + */ +#include +#include +#include +#include + +static struct dtpm_node __initdata rk3399_hierarchy[] = { + [0]{ .name = "rk3399", + .type = DTPM_NODE_VIRTUAL }, + [1]{ .name = "package", + .type = DTPM_NODE_VIRTUAL, + .parent = &rk3399_hierarchy[0] }, + [2]{ .name = "/cpus/cpu@0", + .type = DTPM_NODE_DT, + .parent = &rk3399_hierarchy[1] }, + [3]{ .name = "/cpus/cpu@1", + .type = DTPM_NODE_DT, + .parent = &rk3399_hierarchy[1] }, + [4]{ .name = "/cpus/cpu@2", + .type = DTPM_NODE_DT, + .parent = &rk3399_hierarchy[1] }, + [5]{ .name = "/cpus/cpu@3", + .type = DTPM_NODE_DT, + .parent = &rk3399_hierarchy[1] }, + [6]{ .name = "/cpus/cpu@100", + .type = DTPM_NODE_DT, + .parent = &rk3399_hierarchy[1] }, + [7]{ .name = "/cpus/cpu@101", + .type = DTPM_NODE_DT, + .parent = &rk3399_hierarchy[1] }, + [8]{ .name = "/gpu@ff9a0000", + .type = DTPM_NODE_DT, + .parent = &rk3399_hierarchy[1] }, + [9]{ }, +}; + +static struct of_device_id __initdata rockchip_dtpm_match_table[] = { + { .compatible = "rockchip,rk3399", .data = rk3399_hierarchy }, + {}, +}; + +static int __init rockchip_dtpm_init(void) +{ + return dtpm_create_hierarchy(rockchip_dtpm_match_table); +} +module_init(rockchip_dtpm_init); + +MODULE_SOFTDEP("pre: panfrost cpufreq-dt"); +MODULE_DESCRIPTION("Rockchip DTPM driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:dtpm"); +MODULE_AUTHOR("Daniel Lezcano