From patchwork Fri Nov 29 13:06:47 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: 13888657 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 CCEFF19C558 for ; Fri, 29 Nov 2024 13:07:42 +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=1732885664; cv=none; b=lfQ8i9EsYk4/mCskQoyFQkLUgsXR2cEVb3q7OjEGuMapEU8sqhHthJQfRgx/Fi0yr48FwJbQHpk4oXfXJSi4MYFYeOqJw43OSQsudrv2N1v65xRCShdaC+Ih6sL+CSDxHX0lYZTEKN+DtKFbxpV9ow8YFRqS1+b6+bbSia0mWEk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732885664; c=relaxed/simple; bh=mQpHD0O/4DmVLloEpdEHgH89jVyxadWEyw/hKsvGyhE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cHxkljaKOcJEJWD8CBHvCEffwJ1ylN/1j6Ubd0qa5fmIpphJIrRI2M+cZohce5bgIm/hOHa598W2z1413bibN4Wxspu4YmRQ1/35c7U8MWLRLjkjs8/cHYyAFvHerr0NWspXtSiT8O7jfsltPwq2emh84uRl0YDm7p4ikHDLQxc= 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=R5IDfDI9; 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="R5IDfDI9" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-434a742481aso16801685e9.3 for ; Fri, 29 Nov 2024 05:07:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732885661; x=1733490461; 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=R5IDfDI9TKVnyj6lHw+l5l7gbB1ICpTZkx/K+V6gG4UQVmrLCb/iNc1ra4GaZE9txO csKf2OX0dDpsciUKr84zqwTicYwS/pbfjEoDaQXfYRqTzteX65+KG7IdYwpRAjaOe6Fr /nyEivv971MqrUE2DJcTPDSL+A7nUF8ihYRr+yEi5yWg7P3U/M1fI7ae4WvHYm6LR6Kq L3T1f8fCxlWJw7ktevq7r43ujVuo+gppeTqsml0rsY2k1wnmF9Ltae9ChjAJjKziqkjK 1UD4MdXwlun1ujaOvCOdvJaXREGXpJs2vaylwQayUAPgQPQ3BkDIw7vb/KVMdQT49lem 1agQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732885661; x=1733490461; 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=eZXal9aRJPjwerqsM1WVhoS9zdQPADDnN5qpXvY3Rl2p5JKlgc4ezI6lxUg90/3b23 jTxGiC9kxp/bVg5cGH1aby9cjjv/nsdL+2hmEefoES56/CHc0vWhmMP/ZyDg8ObzFoSm a0y94nbJSflxPkIp0V8AMM5I0DihKdjTHuUw5Eg+iT978/b2fyo/9L625N+rH1CCWLhN /zV0eRXpqHacmelZRsyPamFN2YsZzNjCdEmRKRlzf3rIvplChG7y6dM3OtlMO4xc7MNP VjbrT0OFU5b4uM4lepBfpdhyJVMaCmWLu10ECq2OtnvhUZ7rPPj1O0wfb4PaIK8kIQRL ja8Q== X-Forwarded-Encrypted: i=1; AJvYcCWiNMIRELibteK/BX9ZAWWHV0UMqga67/Sfk1N1CYmcu6oRJchGwjVu1zQ4Qe7yLSA1kuDeTFC0Grg=@vger.kernel.org X-Gm-Message-State: AOJu0Yyn3iSdWVV6e4fJz04BspbkC+3LPIe2rcu4pk/ka2funfr/xrOp HIljFRJLU/hcVO9w22RMbBcNchHVnRnGgldohFxeJf7T3834DYnvLl1mWy7AZsIkq0TAOfYUkfL JuHk= X-Gm-Gg: ASbGnctkZJ9ZGE9X40h3OEMIMuk/k5jsqRhSmi4X1dor3VQakP1R5S9jMGVaP9Rpu+n uClYoCveX2l6jQxLcibkvZyz3+AoiBVL4LIstcKMvGr111ddicRFmoM+P9zAbE+k6F9VozQnn+P crNfor7OaSVUGpKnsapusnST+T6QhhKaZoc27UPCmS/eY7BuaBY1tT92c1yRatPrRhW593OKyr3 6M9anEpOUhhcQ3ChTwkv8Fq1FbhCYXwO+25qleos2r7IZOVqEEUxB/4WpU= X-Google-Smtp-Source: AGHT+IHhtPopN59nF0wT9aM0MO2ZUTkad4G2GioIMf1qnkxOPmpIkivwxwFk/94QpZ1tIVuayw0v5g== X-Received: by 2002:a05:600c:1d18:b0:426:8884:2c58 with SMTP id 5b1f17b1804b1-434a9dbbcc7mr111429935e9.4.1732885642767; Fri, 29 Nov 2024 05:07:22 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434aa77d01esm86228395e9.22.2024.11.29.05.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2024 05:07:21 -0800 (PST) From: Bryan O'Donoghue Date: Fri, 29 Nov 2024 13:06:47 +0000 Subject: [PATCH v6 1/3] clk: qcom: gdsc: Capture pm_genpd_add_subdomain result code Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241129-b4-linux-next-24-11-18-clock-multiple-power-domains-v6-1-24486a608b86@linaro.org> References: <20241129-b4-linux-next-24-11-18-clock-multiple-power-domains-v6-0-24486a608b86@linaro.org> In-Reply-To: <20241129-b4-linux-next-24-11-18-clock-multiple-power-domains-v6-0-24486a608b86@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 Fri Nov 29 13:06:48 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: 13888658 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 BED7E19D8A3 for ; Fri, 29 Nov 2024 13:07:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732885679; cv=none; b=KfJ0Ah70YxtVFbYM7ohKeBF20MqvuH5esRRpsWD8gEw4Qejk/H/22DGRMQcYGyVqhyh53oa+ZsnxTfCKhPiU0hbGgv80ZM/xOIjut28BTHDE/jjz91fUyonbWQkyd8iKp7LdmGLa3PfEED1PKSxk7KaLEeEH9anYeCVZNNkGTBw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732885679; c=relaxed/simple; bh=BCcVhjXqM/11poMT/N4HvI5IzpguMzkE/XgunRZ0xcw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=J2mH3o7SU+8M6S1A/e1Yt3XkjITuh3fI6cGzZFpo6rbZFcwQWBklzDvBPqZWDkyRdhOyY4/MuAfcVVar+SVlKEhTtlI+c2eW5norck3VSQbTM2W5jDeg/2FhySIeXRM9Vy3B2EEswl4iQGaT3G676BRkVkHnAclb1IsY2zUCenQ= 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=jprYZFwh; arc=none smtp.client-ip=209.85.128.47 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="jprYZFwh" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-434a766b475so16942725e9.1 for ; Fri, 29 Nov 2024 05:07:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732885676; x=1733490476; 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=H3Aq0nsQUak92jzQ+dzMHRTGJEDpjujxd82cAU7SdLo=; b=jprYZFwhnJqyckqOskpGO7CG5Sghfpah2uSOWzQ82l8SDHTbkUQ0ZWLx+lQJAzR12q jdj7/TVADr4wNrJ6gRN21PuvYORVwmKloFEuh/n1cbg5wTLVxc8WtsTeUX4A6R9F/prp FHcy46F3vDcXdo0fR6aAUUB2omnOpvLEk75VAZwO1RKmmCZyZ6g5FLNvDVN06Ia8rLsu inNg8+xQJshgbhvupRGuBTnzqkMF5+1JA8ygMx3a0tWreSX4SHCywrsOIF6rI0T3xMch PpVIdx3ZuRtsGnENfrLIuyVF+ZV9QHsjMTIYqUktbxdD3Zv84ympFe7Q+M7gLqNwPYPl KxDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732885676; x=1733490476; 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=H3Aq0nsQUak92jzQ+dzMHRTGJEDpjujxd82cAU7SdLo=; b=Wot5LzLlsRrC5k+HRiVlnpgPJbSTHTjYEdkaXj9P+mefYk8mxj+xsuOjjJcDgb9JCw d5udTVGBe5sdfeXgpfZey31NJv7ibu1itgNACDIf98N2BjjOJ+NA4ntFCClQ9AQKdHva WXuX/rftE0XNz9NOO+RLL8Q6P4AzQRWNyyxT9l3sO75rY20th/UTa3O0qQGfnRr3FAKb blDAtdksioFJTVeXBHM3/HrYU6MA0cMm2OB4aWhC6gmUrm9AGk3RKrSwPGwmK92r2cBO X6Hw0maFuOzuVqB2XAxwIGsUoMAdoGaCuRYrrjEwmIXHAr89Y/uGSfwtwN0fjnpr3Ozm S5mQ== X-Forwarded-Encrypted: i=1; AJvYcCVsNAXA6M7Ktm8g3b2Z6BdF3wk4nJvc3gIYZ2lHl6xmnL8nAINQcQ0xU2yJ5Gv3O/E42seBdmzNck4=@vger.kernel.org X-Gm-Message-State: AOJu0Yx3rcL147VZhT4knyJYdumZFVKcCyqtMtiOkaLMWuWpaRUctSAW xF1/sQe10j9nVnHLQQFbHRJF77MLe63TcrxHPBqmdpuyXRhHRoyjxrnpe6lH+rjmf7WGnDAwZwC kIeU= X-Gm-Gg: ASbGncv8eeo2+jYBh11gUVnbbrIAvUGtKXViDRT5vVf5yutweDWXHwm//Q4y42sJVqW 9z/mTkiTHSTTmQFgzHuwPOx/16SNN5oVsa1k6zG2HC7Oz2+FaX+y2epBTtaRkyyEDQsl+pHSFJl XrDhLaGjbFwJmeHYsNbetbJ3Pqx1gHJliM/3ZmO546rTywm0fUQ24bi2NJZt93UMOxZnh4oirQ3 ctv6hCa1mZ5b9hv299/ptBLo+ZhgblHcMmwg+ty/gjSVWRVLpE4+NBzioE= X-Google-Smtp-Source: AGHT+IEPEkoTPvIO2wDF7R7vcKE+vmysjyb1Ux8gO6F0UH8ZweTsBFFeO3yV0dgiqmcp49wUdMKE/Q== X-Received: by 2002:a05:600c:314a:b0:434:9f0d:3839 with SMTP id 5b1f17b1804b1-434a9dc3d2emr103688195e9.8.1732885662133; Fri, 29 Nov 2024 05:07:42 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434aa77d01esm86228395e9.22.2024.11.29.05.07.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2024 05:07:41 -0800 (PST) From: Bryan O'Donoghue Date: Fri, 29 Nov 2024 13:06:48 +0000 Subject: [PATCH v6 2/3] clk: qcom: common: Add support for power-domain attachment Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241129-b4-linux-next-24-11-18-clock-multiple-power-domains-v6-2-24486a608b86@linaro.org> References: <20241129-b4-linux-next-24-11-18-clock-multiple-power-domains-v6-0-24486a608b86@linaro.org> In-Reply-To: <20241129-b4-linux-next-24-11-18-clock-multiple-power-domains-v6-0-24486a608b86@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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c index 33cc1f73c69d1f875a193aea0552902268dc8716..b79e6a73b53a4113ca324d102d7be5504a9fe85e 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 @@ -299,6 +300,10 @@ int qcom_cc_really_probe(struct device *dev, if (!cc) return -ENOMEM; + ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list); + if (ret < 0 && ret != -EEXIST) + return ret; + reset = &cc->reset; reset->rcdev.of_node = dev->of_node; reset->rcdev.ops = &qcom_reset_ops; From patchwork Fri Nov 29 13:06:49 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: 13888659 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 AB9D419B5AC for ; Fri, 29 Nov 2024 13:08:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732885710; cv=none; b=RglIU5gUs8dwC4PxR6h24qQgAFj9rLkVpqSNrz3OGBqPUIx3fOlCYXf9K4EWC/U1Pmlu1ZUVW/905VnJBGXUAxrHbz6U/g31d1ol+TaExIHLEmGLXPDX2eIYeq2TOI5H7Tn7q2FFkd/+MQPnwpzqyU+JTSlUwPjhABmuJQgKzb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732885710; c=relaxed/simple; bh=efVa4M/CLkYbXoZWdPM0C8JxkwfrxcSLyzGsT8tYjCY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cMyLpK/AKmrgTqXeIO3nRMxlN1bb6oFb2TlIfz2APnlwEWcIPEESxc7DlyVuUKH/spLX6ynvX6waYHMkkFFe1OxO4gm7bbJyjfCZM+ZUJs54i0qUkILkAFCvBNEqM2dixHci7170ASaYbAMGghCLhkkvkczFgmbrXum5HbSrqQ0= 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=oXB6P5ax; arc=none smtp.client-ip=209.85.128.41 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="oXB6P5ax" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-434a044dce2so20401485e9.2 for ; Fri, 29 Nov 2024 05:08:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732885707; x=1733490507; 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=+pL+8KH4poUu1Hf/aDMaYYmGsu+QOmH/USEQcuPWz5Q=; b=oXB6P5axnjhE28AJOJQl3k51ENHjziCSOQUDrOIDvXR/MHusHXzYKWtXdvhEMQJUqv ZObD7lmk2eejy/wLUrpgz3z5tEWTSGL5W8JaHA/pNV/0s93CY0BbrWgmHHncikwky12D Bd8g/cI6cy4Z+R2sac4eIE3j6rv/CCGujbJnelwTivHRFDVYCG3+mD7wVjYLPvCG7d5V ezRWx1qFvEmCTaPLLNgpBP6O+WF2rtduB0s95SJLZv/NzhyEsNByUAWfBRt0mwNHfoIN vg75Np/YILqJmlT8UM5ip1e9itrusOX2qgO18wVtaGMszMSUgL/1RbOOo5kwremIABKd a+zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732885707; x=1733490507; 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=+pL+8KH4poUu1Hf/aDMaYYmGsu+QOmH/USEQcuPWz5Q=; b=eofq7mulH0gfrNj558FWABxPDwQ43zFa31gM/zy8ba7cDE/WSjRM3PCRe8kqy5UAjA 9nPmjJUFCXLDZ39ZNEghmU9g08L+Aj2d3DOm+y7pDpCy47eSC95Rt/vOhARpggroSYxr ylEKxcsqRav/C5X2fDUM2CQPD88GegOTdYCXRLDwUR9BNqxTqm5bBj00dmPEouuJ+u6w Ds7vcITnW64fgewLo92aazYtw5YY2j3ltave53gv9GEs8F4e8pPVoUKOZw/hQvgCTJ6y LluxByrm+y7sWhfmtmVndKNrMQ6B/b1vg071myS6igeqCORMYQEtctejjo26ARXsOlJx lD2g== X-Forwarded-Encrypted: i=1; AJvYcCVq9q8Jrfx+qZp3TQVuZlqBRmOl0b3t9hZAsVhiacvS8Qf8U43qw/JO2GO2si2DUH5JgOZqm6n6bJc=@vger.kernel.org X-Gm-Message-State: AOJu0Ywc/rijDqfFA4JAz5c76yR9xuU/kmlCqV1r/W6LafzL+nVpuVdz DYSPuh06M2GpJTv93csnACZe0/aJekVJb6ZsTKcdRQQ4ADzCfbWel/KFPzROiWY= X-Gm-Gg: ASbGnctrBKe5xZcOEIs5i5jlMwYBj8MZfdpw2LYSxDPGd21zytU6y8kU/+em9vgz7mI Y52c7Sm3OeBc0U9KjzPEM1NUQsv9Im2QvaTH7Q3hCqcqAuMBT0YDOcRs9NFU2g7YMyFZJtTLWu0 jjCR9VtSD8tU5p0sHTLdbqV4k7g3CEqsmgzIdUb3auD4Kb2CO6gTIJx0idoov1hKYYjPnb7r3Uv en3ullz5hL+9xtwmHjfWAnrTQkbbtXUpUwbPfZONsrBe08N6O0JZyn53cQ= X-Google-Smtp-Source: AGHT+IFqnjxL2YfPL0Ab/kKdB7w/mt5G61ptnPVKhh37kewWRZYO7G8+Fwcib55Ku68BT43tgDxvJg== X-Received: by 2002:a05:600c:45cd:b0:431:6083:cd30 with SMTP id 5b1f17b1804b1-434a9dbb631mr115140325e9.6.1732885688561; Fri, 29 Nov 2024 05:08:08 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434aa77d01esm86228395e9.22.2024.11.29.05.07.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2024 05:07:56 -0800 (PST) From: Bryan O'Donoghue Date: Fri, 29 Nov 2024 13:06:49 +0000 Subject: [PATCH v6 3/3] clk: qcom: Support attaching GDSCs to multiple parents Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241129-b4-linux-next-24-11-18-clock-multiple-power-domains-v6-3-24486a608b86@linaro.org> References: <20241129-b4-linux-next-24-11-18-clock-multiple-power-domains-v6-0-24486a608b86@linaro.org> In-Reply-To: <20241129-b4-linux-next-24-11-18-clock-multiple-power-domains-v6-0-24486a608b86@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 b79e6a73b53a4113ca324d102d7be5504a9fe85e..9e3380fd718198c9fe63d7361615a91c3ecb3d60 100644 --- a/drivers/clk/qcom/common.c +++ b/drivers/clk/qcom/common.c @@ -323,6 +323,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