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: 13887167 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 01ECB20011F for ; Wed, 27 Nov 2024 15:54:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732722842; cv=none; b=Ys3x+36dOaJe4qcmz0v93bdVw2ejzQvl2/gqYeklSoLOhmm1Wie+IkR8a0dmyxxFkKxBVgweykNClv3tQcl86TLipJVqPXGvcm4AZOGalJRP6AQvtQlXZnCbaLkVtX8VatbSfbLcS+6+X3Vmd9fUyaraP4QouoXqTbaHl/LqgF8= 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.44 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-f44.google.com with SMTP id 5b1f17b1804b1-434a95095efso6098335e9.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=r4aHVNw2EfRpfM7Xl7iFyeooXA+L4e+MezXlAoCYFQYuyU8GQLvCx8+JM2LihVXAKA AKxGBq5VrnkHHTIbqbNKbndAp+pbH2RnPQm8bGz3+aBYnFOeRbcHx4I/M/MgZUlJl2fS JQ5+qerV5bVuCzbJoBD6Jx/5kmsjgondRfmBOxYJKDwn8ONEshto+WAKLau/2SIRNiR2 MspkLO6G6Os8ltXVM/1VkA9nj3xhZIBcC/8tu3zjRVoGz+JPaX2x8wq9ZJzvgpoIwvkF u5L/8GwB7KZA9Uaq6N37wN+1Q/cnbgD0lR/+xgBZcAVqUQ4/my4N7zWCA4wZpTdXajNn Qf3g== X-Forwarded-Encrypted: i=1; AJvYcCXCbIYiXMQAzxCsOAg+wuRLuVPE7dgL886nXOv55lYeHKjeQZYeYBTvjVSQAhTiF6IH4olo4NvheXo=@vger.kernel.org X-Gm-Message-State: AOJu0YwnqkpvYdZW5+fA90c/IeOeJQNIEbmfbS/pTb/tPlbeb6KZUgIu iskE+Kr+q4ymbmpTAErIlPA8N0zaMeBoSQjR0tllF+GwOQtoJXRCtJfkGHRjR+8= X-Gm-Gg: ASbGncveaInr/1642gQk8SB9y+jh7fUVrPZ6Wm6wyxqIJLkKnLUzOoFOAeJJ4A0ae5N Nbv4TBvgDLNHgbuoFifgRk0/ohPfCp2JXW1LWf3Sbn4z3XDZ2eqc8HA4GdzNodvWnKsmo801mvw 7lEV+qpI1F775dRpwnzQgbDrA07j8uu0PjpToQJ1KyJvj+ibFLPfgqOyMfQUjSkv0mpZxSCKzcQ 8AAB1ARRU20lX0eTPQZyygP2hrJMcsF5cYJSqR70Y6hjP0LASIIFRtolos= 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-clk@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: 13887168 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 10BB1200129 for ; Wed, 27 Nov 2024 15:54:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732722843; cv=none; b=Qf62qgy+CBVp+Wfzx18Cl5zQ6JFlc4DdFDaN7q3uankB7QDa4Q+q4aGrvvtvXS1cvBgxgMY7B6Z3bja1c/jkAz3399FuF7c2sv4eA8gh+aa3KbSjFiw3NJ+1HSlzyyNLvlIQgcEQkTZHe165NMO5ufxxHVJtVQM2KbevsOOn2n0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732722843; c=relaxed/simple; bh=9DcDIgyiPEQQcegeEN1oWtNvqOat5t+dI1L4z5w/npc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=q9vXS95/dI+bQWkwtY4srOh/K4CV/1dPyXfRDJeNvyDQbGieyzux7lfDlSZ5JpKA8x6sUGZiXQyAq41eWnoSg3wzHLTYLvprFij/pnrHFTYzSU4Bygio0TAeBSQY+dVRIXn8U8td3v2mv0O3QFQIXpwkoavbEqM2TruWTo7loyA= 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.44 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-f44.google.com with SMTP id 5b1f17b1804b1-434a14d6bf4so27387355e9.1 for ; Wed, 27 Nov 2024 07:54:01 -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=S1+pLEYJ8OV/1ss8RPw3Hy2O2exxE6pdXAMBX5bJutXbQ4LWanwRKs6FDEuMH62e6D rRniWUHl1QAZf7Agk8U1JrSjwGIAOoysTdsZw64YgWm0HlPk6WTsj5kDRt9XVejFv3qr gE8qql1Sz+hHTmXPQRd8V/qpgs/ORN9RQeJDDS/otxyPAAk/Iba2Sq4xlrxzSqmWKeok 6b4CKmMawlTu3B1NJ4bCuBCrABkHnLxUVez3x8SVeS9AtrcCsxAXJKcQ7jH15i6kTNMU chc3m1HRvFt93rivg5hzzNa/N1gcJ50V7dAXB0119SlU2B5KSemaDtF59jXeG1G9DpgG TBfw== X-Forwarded-Encrypted: i=1; AJvYcCUqJnO01ukGHC6uG9V0eKCt3W/I7f/2rY8iv7GrJCehXo6IQ0iG0dqXfyqGGeIaMZCI1jqmeKhHXQs=@vger.kernel.org X-Gm-Message-State: AOJu0YwICCmflK+cUwpvx/lavANzMhx8HuioBzSycArIYenj8EelHjPf 5GSVYHsgzHTcKDK88njUfHNl2gDKfbgpWgps741DnlFRBu1BGwRisjP69gnVEzA= X-Gm-Gg: ASbGncsJan/2sW+oW4k8nAAnEgfw7wDPSWMRtoRtYlihXAHRENQMEaurRU5Gc56NT9k uhVYfLM9HsoWFxV2gfQ4Guty7ztlHdEnwoOh8hBgX5UIJclOuGMsj0hUamymBIXs6eiZBExU2lv j9RufAFl/slqd68lwfidfEJwIhKT+9QAzPL9tFVcJXY5mtkLMHsJX8+xXPRE+5lcEm6U0mmhI7j B7vACCPmLcUKvAGFDXkRXY6j8y9SJQV5eVf6+iVSUXbTZfjRBhMxcqsJEE= 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-clk@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: 13887169 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 26E55200B82 for ; Wed, 27 Nov 2024 15:54:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732722844; cv=none; b=VZGE/OfCGhPrL+19p/LfHmPY2DXMK4WxjIoeA0vYAPYRNOVHydEmt84b157kvPj7u0QpJe4quhgkjCPOhFlxMNPbW5/DY6XZesAPWCpWgiP7gpwe02YaqG565ENo7rIuQeX3sOy1vohm1XaqB7lDuUFRP52wHczQxmieWjq4bq8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732722844; c=relaxed/simple; bh=Ywkm3VwcyiDMElgsGMcoFl6BepYTnvnsF0yyoau73Mg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jgeehpDs4c2Dvp+GH+wCY1XICpN5hMzLsQOI0P3XbGy097Q8qBzhGZMAElkEmqfHefBNZD9J16CyVO78PLLE3pfKWgRs/wGyWIacnfUv3DLpsWy9LNitGioFPq7ImgbdO+DBwO4lMcp2pECKhr8Ht3NFqk7jJCUMdSBMSxMWgG8= 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.54 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-f54.google.com with SMTP id 5b1f17b1804b1-434a852bb6eso14998305e9.3 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=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=VWApqMa7zQ21VDFQCRFZLs8FgBlfxQ1lyb7g6iZPHhgJ+Vblf4j0arRX/ztQ05ZmqF 2upiD9bm4Gf3mdopOPW6oRi9Ml2krymCv+tptXCgacI48U5G3YqRWoldVssYRsqYrpCT H+a3DoSU6tGnk9oDtYzv5BwYUyZtYBhMUQKyK4l1j7vdMABnNDspqUE6l94uPzHIYEog RSYfq9/YFYtj+fmz1uqf8OfcGESqGWvsbXxOx+9XEnvhleZR/dogkJlEa7IEzRZSikWK dLT7veRdG2AiTOfHIMCU0yk+XvY2IUXFuRFkbSduqv9UJNIKCWaH3BmE+IBuY157esJs m5iA== X-Forwarded-Encrypted: i=1; AJvYcCUYZZdgLKo0IrX2lpuQCAeEKJzk3fRxzuX52UdfNDSVjRAOuaarTQJqSLvrbO8082M/RfTGpNkj2cs=@vger.kernel.org X-Gm-Message-State: AOJu0YwqDTnykrnf5fwwoglwk3+KIJbrrU3Y6fuSoXZJjKxkhZxQpXBz f5VgxyPr6+4WlD4da2abz8YK6sUni29pa7xT9jdr7VIiwUXpsPE2iY04M3/bllA= X-Gm-Gg: ASbGncsz80ckcDZwi9x6af0zXtIGoWHQFffEadRpuMKwXa79m5Z3PwE/m5960u5K6K+ A9liEk5Mvw/KF08/MgsKNNFFKOqLpQ0xFmMd50pFG/GqQdGrA3VXVFFeWLf0Vy3+Jkl7f00DA5l w2CHYT9jABnzYYlwPbZWE/W66PbmupcO3lQYcb+HZQzW0VKw8moUZragSXjvjmQLRBABEaHz2Kp i86syMZ+Fqu9d39tfWj+hQiUjcR4/QqDpqlW3hARN6XmGMU1L9OWoHK0wU= 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-clk@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