From patchwork Wed Nov 27 15:53:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 13887162 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.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 27E2E200123 for ; Wed, 27 Nov 2024 15:54:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732722842; cv=none; b=ToL8rFqSbdPP+qV4rTLOCwMF4ujfeyLy/pp2MIf0EAbG2lUA6lFjKCpwMcnZqR9Ezr+MsLFQwxNoeUdRwijEdPAUoUdsTe5BgQjSXa365fmHgpzqmeHbDcwts6QWmhZwfvuNA5dQAyaCLokcpNcVuxJncewqrQCxj/loGLrD1HY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732722842; c=relaxed/simple; bh=mQpHD0O/4DmVLloEpdEHgH89jVyxadWEyw/hKsvGyhE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=POjOHW5ZTH4uLT74RRiFqQEURA9chm6op4qRINg/yiMsikhMaGYwqswl9ysKJedwIpWcixW0nBtsC3IVwG2nphu6zK4B+in9qpRz0q6+1SR13rjYt9I6q129QHRozkigyiPq1ykXE00NSVy5b3tlctOp5RVwMwVOAymGt9yNy2o= 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=iVuz2VU0; arc=none smtp.client-ip=209.85.128.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="iVuz2VU0" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-434a95095efso6098375e9.0 for ; Wed, 27 Nov 2024 07:54:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732722839; x=1733327639; 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=+aPv1A/6lNNGm3pKHhjnN5K2Ej+6bunOS3nenFEWG4Q=; b=iVuz2VU08c86+7CpdTHgmymTC9Xk5kQFrHI3Rm85MZzG4mMoFBbZjE894yrfX9Juju J6aPgdu2cuJbd8SjEAE5F8WKLlV71LoSiJsDXQoXKw9qxUEvv1+bybyD2oLHm/fvuARy lS9eaNc+9L+1NM2pYsvehxAjuuoZPzHNqTbvNfJUwJ1hiP+ncvfEZtKmj7WL2XiVC3zb ZLFCeeI9f6EOTO5XSG3Q61ppks8CMLfrHtTmo2UVAX+aOpieItKZbd7n9jGflbsppyi8 P7prLo67uIlVdTxFa16h2useyzLybazkRJGUT5i7ZrzdgNd0q2bbzkX/v8SSOwYQuP36 lotQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732722839; x=1733327639; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+aPv1A/6lNNGm3pKHhjnN5K2Ej+6bunOS3nenFEWG4Q=; b=cL3QEfzr8nfAC9qjUBY6eoCqfo4U8d+DhPVIatfDHXEUfU2gtLDo3ih5VbtyYeREHZ 4M1jUbM3YEegT+TywSlIMjXfgYPKEBnyDi0nNHCQriBRvV2dJPOTLwwK6xqIX59uAbWL tzbAMI7HyCU1ibidmtdcjXTkhKOBtvLHzcGDvYzvXKoCnpiDaSX+5tr1+S9qAPWfjrdZ +KqtQ/11/93fWC4A/HMQFFD7rqL/DQZ+XPuzpHwQMN+XRhEHMLJ5BU3MAWhNLy2e34eR il0geUQukL8lOURPVXQ0q5LEFFp7GxyGzucWbicQoZ9cQbTktOb2f9zF5ToUCoKTitnp 68ag== X-Gm-Message-State: AOJu0YyrAmPI9UFJ5RYqJcBu7EdqfWLLibNYsfuXn1M5xj2pXxBwMqGz yOopfm+3Ot8aFGBCkcUCid2kYeNZBFqqU5mVcnujmheysY/Res97dzeWO6ZGRFWs0h1lp74vcc3 Wkb8= X-Gm-Gg: ASbGncsueWhzOMyXjFj3Wa9w9y9gWz7zpznQJLb7Bx3hPqGWXtC3EPq/VBwadChdOJ8 gVeYbKpYfE+PpHXws00AdTLCLTRwnKMLcXb/au2gonzgDSNtNCpUjh68otMj2rXTw76abmcb9uM pc1ZL8NdkL3ICmX625SZaZJHtcv8fZIb5lsaRFNhtzjZ+U/DVnnDdhlKo0XwVM9PkFHYkwuwsXS UlV8mis5sfOfkj1gU5sUMqu/98urGltwq++ISd7Jnblx/xDuTF1ns8GtH4= X-Google-Smtp-Source: AGHT+IGCi2IOz/AsR8JkzwtkPOnmB+mXyN8jzsNxSflDpZl/p5VLachhORnZ/NXQOdxT2X5iZEFsNQ== X-Received: by 2002:a5d:588a:0:b0:382:4aab:eb9b with SMTP id ffacd0b85a97d-385bfb1e53cmr6558642f8f.27.1732722839393; Wed, 27 Nov 2024 07:53:59 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434aa7d1a90sm24795235e9.32.2024.11.27.07.53.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2024 07:53:59 -0800 (PST) From: Bryan O'Donoghue Date: Wed, 27 Nov 2024 15:53:54 +0000 Subject: [PATCH v4 1/3] clk: qcom: gdsc: Capture pm_genpd_add_subdomain result code Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-b4-linux-next-24-11-18-clock-multiple-power-domains-v4-1-4348d40cb635@linaro.org> References: <20241127-b4-linux-next-24-11-18-clock-multiple-power-domains-v4-0-4348d40cb635@linaro.org> In-Reply-To: <20241127-b4-linux-next-24-11-18-clock-multiple-power-domains-v4-0-4348d40cb635@linaro.org> To: Bjorn Andersson , Michael Turquette , Stephen Boyd , Dmitry Baryshkov Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Bryan O'Donoghue , stable@vger.kernel.org X-Mailer: b4 0.15-dev-355e8 Adding a new clause to this if/else I noticed the existing usage of pm_genpd_add_subdomain() wasn't capturing and returning the result code. pm_genpd_add_subdomain() returns an int and can fail. Capture that result code and throw it up the call stack if something goes wrong. Fixes: 1b771839de05 ("clk: qcom: gdsc: enable optional power domain support") Cc: stable@vger.kernel.org Reviewed-by: Bjorn Andersson Signed-off-by: Bryan O'Donoghue --- drivers/clk/qcom/gdsc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c index fa5fe4c2a2ee7786c2e8858f3e41301f639e5d59..4fc6f957d0b846cc90e50ef243f23a7a27e66899 100644 --- a/drivers/clk/qcom/gdsc.c +++ b/drivers/clk/qcom/gdsc.c @@ -555,9 +555,11 @@ int gdsc_register(struct gdsc_desc *desc, if (!scs[i]) continue; if (scs[i]->parent) - pm_genpd_add_subdomain(scs[i]->parent, &scs[i]->pd); + ret = pm_genpd_add_subdomain(scs[i]->parent, &scs[i]->pd); else if (!IS_ERR_OR_NULL(dev->pm_domain)) - pm_genpd_add_subdomain(pd_to_genpd(dev->pm_domain), &scs[i]->pd); + ret = pm_genpd_add_subdomain(pd_to_genpd(dev->pm_domain), &scs[i]->pd); + if (ret) + return ret; } return of_genpd_add_provider_onecell(dev->of_node, data); From patchwork Wed Nov 27 15:53:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 13887163 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.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 73E85200132 for ; Wed, 27 Nov 2024 15:54:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732722844; cv=none; b=NHT3v0isjHHd9ZF2fummieGry2Wwfq5WZxkYG8sGIwwXo/IQ6qscvvTBnnHlisIqrpWgyEzGCsaT2ZMIC1f4SatIRw1pmXeClNRpDT+XiLK+BCROTfQJ2H6UDDLC5QCjwasQS+40XmBSLj6cHLd7gAChGIwOuJEeTXBgMPx30TA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732722844; c=relaxed/simple; bh=9DcDIgyiPEQQcegeEN1oWtNvqOat5t+dI1L4z5w/npc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=efW0pCTwazboEUjQZ60dejvXcCCA5yooMs5Zpr2ZX1VoKf/7zmDS7ogyJIIYmSQJqKFJbnFfvaM86McYlAGiva6sEmhzcN/eZ6ejTXsP7AsDjWunRuwk1Y07V59MyOssUm0+X4EW5N0YYZdQ6g7JSbltDmEYMfhbZoq8iuVQkWA= 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=FoRdU7N4; arc=none smtp.client-ip=209.85.128.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="FoRdU7N4" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-434a14d6bf4so27387445e9.1 for ; Wed, 27 Nov 2024 07:54:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732722840; x=1733327640; 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=6CvPt8QMHcz942A3Oqz3/N9DPxj3tCNq+0xhS6ngyuw=; b=FoRdU7N4z/bLNPK3GWhdHpF9I8Qjhg4eE2sv7C1vvXSV44Z+qhWG+ODL5NanTIqJId K5CwNYkVDDWNDQPvMsHTR/WPK7pTDvC45CJpyz7N0D9H7FOFALQRF7tnJppyv6BYkgZR FHybeX5QOhZyVYI1aTE/8s0U7p0HR+p0jFAUelc3gXfxldExMJZt82DfAdvUPrKoT4aZ QwJvJmZxZMO6WRFwHI9j0SXMrvlhBkncVUH4fIKSaiuNsyxbrekra1rvRZ4CdafX47sF uSqpFIKPkHyPqnli7bDVhdhGp41CIEeKZdn3U7l9aTN5zV81Wr+BZyV19dzLw1xCmGjV Y1wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732722840; x=1733327640; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6CvPt8QMHcz942A3Oqz3/N9DPxj3tCNq+0xhS6ngyuw=; b=Oh/lM9oN8V5YZqL+ZGHaNxlshP5n6tOqyyxWAd8AgzChQAH23d53A97/p9uU7jzc+g aLJXF3UeFhPj0+PxnuQCvPZApI9F7zHvUNLmoIMw7LmBZ4biA1Wn4e6FJKh2BTbrGHzf bo2LfGwTy7tDmKbY6JWphIiafcNYQz3m7i8kye8EII7mT3DUmkQTel2MH0fXLvHg24RI qax9xe/m5+VzPpHiE/+X/iP1dh44n+dEpLDyY/k7DULr7gYiiPXrohHNM28lvYZthhV0 Ph+aR2qgOfreCDBD8ceqKGesgQjTsl6ZlbW/6/W4xLNFTTQGq1PHvU8E664M4NEsmArq YdyA== X-Gm-Message-State: AOJu0YyTVL7UvEAXGOYp+2Gj+27aN3d3rRKj4i1d8cagExJeSvalSwZ5 RM/hZW4L5K0qKAbQj49JRcPZ4TM2EWWvcOhDdrl7GH0fn2NtLMybPtLQ1fIyquypYIA+BqhKtFL tOYo= X-Gm-Gg: ASbGncsrFGWIJcPnOSwLAUn/05cyle/Fxm1gtTyjPrZvZc5xAj+itL1e2M3ccVVhrcH amtXQw6iuoL/KHM/Ql1h4aasKCKQdl2Tp+0og/WwRKv2eQsOu0LrOVybXdCOqvvbJZTqN+YgZ0M NP8GydgFDrp5vgNYpuayhXKvaKZuBOCf15OnIJ59COBkues8eN+9DVQGI2C0z++T0AGMiHUXO2Q SrBKaPVj+g0+F6H7WF9BBkkp1gR8XPri2Dw0qtUDlnMTBqZYdYBpWMmp40= X-Google-Smtp-Source: AGHT+IHGDQZYsAgi8Ipqt/f4XhqJRd2WRzf+LxuX9QIopr2zx3rLNuUzg/Jh4dFa9IVL5CZPYN2lfw== X-Received: by 2002:a05:600c:444f:b0:434:a5bc:7103 with SMTP id 5b1f17b1804b1-434a9dce666mr31055245e9.19.1732722840401; Wed, 27 Nov 2024 07:54:00 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434aa7d1a90sm24795235e9.32.2024.11.27.07.53.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2024 07:54:00 -0800 (PST) From: Bryan O'Donoghue Date: Wed, 27 Nov 2024 15:53:55 +0000 Subject: [PATCH v4 2/3] clk: qcom: common: Add support for power-domain attachment Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-b4-linux-next-24-11-18-clock-multiple-power-domains-v4-2-4348d40cb635@linaro.org> References: <20241127-b4-linux-next-24-11-18-clock-multiple-power-domains-v4-0-4348d40cb635@linaro.org> In-Reply-To: <20241127-b4-linux-next-24-11-18-clock-multiple-power-domains-v4-0-4348d40cb635@linaro.org> To: Bjorn Andersson , Michael Turquette , Stephen Boyd , Dmitry Baryshkov Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Bryan O'Donoghue X-Mailer: b4 0.15-dev-355e8 Right now we support one power-domain per clock controller. These single power-domains are switched on by the driver platform logic. However when we have multiple power-domains attached to a clock-controller that list of power-domains must be handled outside of driver platform logic. Use devm_pm_domain_attach_list() to automatically hook the list of given power-domains in the dtsi for the clock-controller driver. Signed-off-by: Bryan O'Donoghue --- drivers/clk/qcom/common.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c index 33cc1f73c69d1f875a193aea0552902268dc8716..7727295c57c8f6672d46d2380e1ff5ec2ac68d42 100644 --- a/drivers/clk/qcom/common.c +++ b/drivers/clk/qcom/common.c @@ -22,6 +22,7 @@ struct qcom_cc { struct qcom_reset_controller reset; struct clk_regmap **rclks; size_t num_rclks; + struct dev_pm_domain_list *pd_list; }; const @@ -283,6 +284,21 @@ static int qcom_cc_icc_register(struct device *dev, desc->num_icc_hws, icd); } +static int qcom_cc_pds_attach(struct device *dev, struct qcom_cc *cc) +{ + struct dev_pm_domain_attach_data pd_data = { + .pd_names = 0, + .num_pd_names = 0, + }; + int ret; + + ret = devm_pm_domain_attach_list(dev, &pd_data, &cc->pd_list); + if (ret < 0 && ret != -EEXIST) + return ret; + + return 0; +} + int qcom_cc_really_probe(struct device *dev, const struct qcom_cc_desc *desc, struct regmap *regmap) { @@ -299,6 +315,10 @@ int qcom_cc_really_probe(struct device *dev, if (!cc) return -ENOMEM; + ret = qcom_cc_pds_attach(dev, cc); + if (ret) + return ret; + reset = &cc->reset; reset->rcdev.of_node = dev->of_node; reset->rcdev.ops = &qcom_reset_ops; From patchwork Wed Nov 27 15:53:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 13887164 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 63374200B87 for ; Wed, 27 Nov 2024 15:54:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732722845; cv=none; b=dApynXZORly05Czg+xq2PLTxk4jl48NDIhnguMJv4g6Vtunr6YS5KLtsoqMryrazCWGN5InOTU9/piXug9r8eygviHaxy0re4aqsyRMPhePwH2BTsUYEyMe2purn6Y/UzKIsFUFnHS7LBEF3BQE7R/c0FtxpUqXstkID3dO1ipQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732722845; c=relaxed/simple; bh=Ywkm3VwcyiDMElgsGMcoFl6BepYTnvnsF0yyoau73Mg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g3ame17lZm404u5h5LgdzL0c3/a9GjOk3stW1K4dW2e3mjGJH/YytU/ySEOiLL3pD18tPKzpq9LOHxkwLTvJkQ+K1qljvQrD4hIeybLB952F7j4B2/S7BN4h6LiuoGgquX3zgdnhdz61TlGRZUv5RDsVv94E9YBgPQZslPakTgE= 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=zh4qRu+A; arc=none smtp.client-ip=209.85.128.52 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="zh4qRu+A" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-434acf1f9abso4102185e9.2 for ; Wed, 27 Nov 2024 07:54:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732722841; x=1733327641; 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=UT/CPunlwVk5ZkGQuMziuZnIeQTUwhReTxXK1l1Fb64=; b=zh4qRu+A6mQAYGALO3hlzJFiLhhHJSbtk5WElGZwth8wnKcZbh2bbFPGeRbmtuh/7Q UJWR4CAQ22gIBFwY4OZKG0AgGhwNhfPtJXi29ywajDfYYP+g8xx3BQ1gPLKNnVr3bIoo Ngss/fA8HKaRT8X7wgJvkovLQtczV7zTt9MbWZ236DVEzoYV5DOu0T5N0dsg0ldkMuwB xH6ZbOGjB/qZwySUglKvs0ReLnJXmvguFKlY5uurtz+4HZSMSE3BQWq8HSvan0yH/AYS e7ov/isqE/X+OFeXnuu9pU5xrlBwxIAZnn0Nh58C0/EF5A5IlKTFT8++ToEoHOWntnIz IJKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732722841; x=1733327641; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UT/CPunlwVk5ZkGQuMziuZnIeQTUwhReTxXK1l1Fb64=; b=cG/3gpqsERjdDJw9vuzThSNQ+eGEoqcGQ1hsFbmDLqD4QtBK1eikYKTu1fptTcKyYe dbYH7uFJt1XuxJQsATbSbUj6W6n3PiP9IZthGEKhQ6TbguuEtHxWxdEdGG2en6cXcY7c CV8qhj1Z4w5lEhq/QFm/1xwXY6U6v2tZAJOGhfHVxX+Ao/XkRZ6SJCMFkMSz6+SpanHD WoHtGqq6QifKaZ8yb85LCNNRRmj3uOPrp9g07CprmFsie4VLPv5aS6Gf44mEefQqHgff HRg1F4zPu+AeIGeJIPRUpulk2tKop8SoHSwrW4raZNYYMdnwXvIfyHqZqi0dzp5pTbZc dJsw== X-Gm-Message-State: AOJu0YxqvBp3OrAQukjviFiIZS5ytEUfy2VmmjmNuRvINUoQReMsQjNS HSrETT/zT1Bt2YhBWHorXX2VQTQsRYbBxa4ZCVRU3gnuV6pgowyhrGpNaTnS8z3A68Ct5fXfynv a0rA= X-Gm-Gg: ASbGncv6U9bJghidUSXWwa96BPA0PyXqiNh6RJfdEZMyeqea5KWO32P40FTs15/S3Of HNu6UzNGGCzRURuJrjTKlWOZD56v5cwxFtOcBwrWTa2vWmUktnoHqxPrb31+xeFzC/tScTEyUkM X5Qb6vY7cEvIyHVMug3AL9blRg89V4LXJA4PJBIca9VUOrjSY5HSuwZtS9jxBzbb/9RylnD8wdA x6sYWU26KCbArfqV7RBiVFk0tohnX3TDixb9uusQO+T1YSc3OSKdxMDr0Y= X-Google-Smtp-Source: AGHT+IGDG8qG9rsBaONX6nB7eV/I9WRbD1faH0/jeMqgzVvK1/j0F2ptVvBE6XgwNFfeg2ucdMBr/A== X-Received: by 2002:a05:600c:3b25:b0:431:5632:448b with SMTP id 5b1f17b1804b1-434a9df26c0mr28909725e9.25.1732722841551; Wed, 27 Nov 2024 07:54:01 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434aa7d1a90sm24795235e9.32.2024.11.27.07.54.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2024 07:54:01 -0800 (PST) From: Bryan O'Donoghue Date: Wed, 27 Nov 2024 15:53:56 +0000 Subject: [PATCH v4 3/3] clk: qcom: Support attaching GDSCs to multiple parents Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-b4-linux-next-24-11-18-clock-multiple-power-domains-v4-3-4348d40cb635@linaro.org> References: <20241127-b4-linux-next-24-11-18-clock-multiple-power-domains-v4-0-4348d40cb635@linaro.org> In-Reply-To: <20241127-b4-linux-next-24-11-18-clock-multiple-power-domains-v4-0-4348d40cb635@linaro.org> To: Bjorn Andersson , Michael Turquette , Stephen Boyd , Dmitry Baryshkov Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Bryan O'Donoghue X-Mailer: b4 0.15-dev-355e8 When a clock-controller has multiple power-domains we need to attach parent GDSCs in that clock-controller as subdomains of each of the power-domains. Testing on the x1e80100 reference shows that both power-domains need to be switched on for the GDSCs in the clock-controller to work. Some open questions remain. 1. Should there be a hirearchy of power-domains in the clock-controller. 2. If there should be no hirearchy should the parent GDSC inside the clock-controller attach to each power-domain in the clock-controller. 3. If there are multiple parent GDSCs in a clock-controller do we attach those top-level GDSCs to each controller power-domain. 4. Finally should performance-states be applied equally across those power-domains. It may be if we see more clock-controllers with multiple power-domains that some mixture of these questions will need to be implemented for specific hardware. Right now the approach taken here is to attach the clock-controller GDSC parent to each clock-controller power-domain. Signed-off-by: Bryan O'Donoghue --- drivers/clk/qcom/common.c | 1 + drivers/clk/qcom/gdsc.c | 35 +++++++++++++++++++++++++++++++++++ drivers/clk/qcom/gdsc.h | 1 + 3 files changed, 37 insertions(+) diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c index 7727295c57c8f6672d46d2380e1ff5ec2ac68d42..58a8397eefe51da237a4285d4e7cee967e19948f 100644 --- a/drivers/clk/qcom/common.c +++ b/drivers/clk/qcom/common.c @@ -338,6 +338,7 @@ int qcom_cc_really_probe(struct device *dev, scd->dev = dev; scd->scs = desc->gdscs; scd->num = desc->num_gdscs; + scd->pd_list = cc->pd_list; ret = gdsc_register(scd, &reset->rcdev, regmap); if (ret) return ret; diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c index 4fc6f957d0b846cc90e50ef243f23a7a27e66899..cb4afa6d584899f3dafa380d5e01be6de9711737 100644 --- a/drivers/clk/qcom/gdsc.c +++ b/drivers/clk/qcom/gdsc.c @@ -506,6 +506,36 @@ static int gdsc_init(struct gdsc *sc) return ret; } +static int gdsc_add_subdomain_list(struct dev_pm_domain_list *pd_list, + struct generic_pm_domain *subdomain) +{ + int i, ret; + + for (i = 0; i < pd_list->num_pds; i++) { + struct device *dev = pd_list->pd_devs[i]; + struct generic_pm_domain *genpd = pd_to_genpd(dev->pm_domain); + + ret = pm_genpd_add_subdomain(genpd, subdomain); + if (ret) + return ret; + } + + return 0; +} + +static void gdsc_remove_subdomain_list(struct dev_pm_domain_list *pd_list, + struct generic_pm_domain *subdomain) +{ + int i; + + for (i = 0; i < pd_list->num_pds; i++) { + struct device *dev = pd_list->pd_devs[i]; + struct generic_pm_domain *genpd = pd_to_genpd(dev->pm_domain); + + pm_genpd_remove_subdomain(genpd, subdomain); + } +} + int gdsc_register(struct gdsc_desc *desc, struct reset_controller_dev *rcdev, struct regmap *regmap) { @@ -558,6 +588,9 @@ int gdsc_register(struct gdsc_desc *desc, ret = pm_genpd_add_subdomain(scs[i]->parent, &scs[i]->pd); else if (!IS_ERR_OR_NULL(dev->pm_domain)) ret = pm_genpd_add_subdomain(pd_to_genpd(dev->pm_domain), &scs[i]->pd); + else if (desc->pd_list) + ret = gdsc_add_subdomain_list(desc->pd_list, &scs[i]->pd); + if (ret) return ret; } @@ -580,6 +613,8 @@ void gdsc_unregister(struct gdsc_desc *desc) pm_genpd_remove_subdomain(scs[i]->parent, &scs[i]->pd); else if (!IS_ERR_OR_NULL(dev->pm_domain)) pm_genpd_remove_subdomain(pd_to_genpd(dev->pm_domain), &scs[i]->pd); + else if (desc->pd_list) + gdsc_remove_subdomain_list(desc->pd_list, &scs[i]->pd); } of_genpd_del_provider(dev->of_node); } diff --git a/drivers/clk/qcom/gdsc.h b/drivers/clk/qcom/gdsc.h index 1e2779b823d1c8ca077c9b4cd0a0dbdf5f9457ef..dd843e86c05b2f30e6d9e978681580016333839d 100644 --- a/drivers/clk/qcom/gdsc.h +++ b/drivers/clk/qcom/gdsc.h @@ -80,6 +80,7 @@ struct gdsc_desc { struct device *dev; struct gdsc **scs; size_t num; + struct dev_pm_domain_list *pd_list; }; #ifdef CONFIG_QCOM_GDSC