From patchwork Tue Nov 26 23:44:27 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: 13886437 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 7DC331DFE15 for ; Tue, 26 Nov 2024 23:44:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732664676; cv=none; b=V6fyaDSOEjoPkvYwty4KfSxOJwnMbBgaSjGpzmTeU+9lzOqnUY6EzEk9MjFkbbrASMtb0c5hAyBK/H+unGXD6Lpy8tUePqkcXuPhTIic1YLfXif3H7KBqWQD+1soZfLbM0vMMCeu243UxjHErY/LqCLFdn5g8kprTJbNyu+hbGA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732664676; c=relaxed/simple; bh=CdkYU+QJ7VGTHMAgD+J6/KS8Mhb64oBSKmpBnvb/LZU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LrWL262qb8pDKShfvhtiPvwqF6BJa2pvDFUjTgjVb0inxSqCEFN+IUrGW3hTLU1/1vfbE2SSdJyTkBWpmyKOrxu4eexsv5JF0tpC+4GnZaED7dMElY9ATBdU1y1UFeFyvAICosi/NjDI2rPDWbew/KrV2VUuXletWVd8atVeqUQ= 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=HPkmxrDh; arc=none smtp.client-ip=209.85.221.53 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="HPkmxrDh" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3824aef833bso4458282f8f.0 for ; Tue, 26 Nov 2024 15:44:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732664673; x=1733269473; 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=+O0H/HlytTMZjW4JWV/layUzk6y2v65D7CAbQ2KVEWY=; b=HPkmxrDh0+CPbjb4L7WbvT5rXL8iMM9EZfu9l9WQMey5BAkbsfWWS4urUyEphohcbE m3t8rYNefwbCdh/ls0U8ldwX7WLYCtHRTsPoNFYNuxQkrMoDbAfntNsKd3+P7ZuaVjD/ HwmvEoHAZL9IoAqcZyK9eADMJIv9/O2Aw+92MYxzL8aLIS6dFarUoo+X8QtQg/NSJtZ5 Ogkc8cnZI6UU0BXMiygTxuI4bEssry3Ihn3eii4FAg5rQrqITrbzG1hD2BhvkZ76+dQ1 Lg7NT7cIpmaD6NT5NQr7jxN2DDHD/BS/gIp7Eur93kdU0iK3kiEDlBXT/WO2n3/948En xjBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732664673; x=1733269473; 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=+O0H/HlytTMZjW4JWV/layUzk6y2v65D7CAbQ2KVEWY=; b=r35Jy7rrFan/mfHhknvmyu/5MKSNN371TXeyYLduWA7+m4v0BxhhQE4tECgeq6vBJU NdqM29UHZFp1X6EmOV7MRHM6oRmDtbv/yIVSKN4u1dDlOJAcbXfwlMV7/RqSZbmdHH3w pfpOQAyvBTN7oHlrFHZ2znkrdkiOyNphduuXKlctkWfCI2w8/l/fOJOZHvWVA6sGhOuW 6c38AjytegqqMcMoo8lKAGoUjaF6SnZZkgHevwva5wDZXG7FO9myeknYKhsKGOcL4aUG ZupzmG1XdVYj33JNzBx2i7cdWZUk4IVwSlWtzrHHmPRBcbcOp47kOIFKJIbgRQHFpoMB NuNQ== X-Forwarded-Encrypted: i=1; AJvYcCV101vMe+NEmRShaPMdHTH7HSt1eeVGMNpB+rCW2dchuHD2DcHL6dB4l/xK+yFlksWISEVqg2NV64s=@vger.kernel.org X-Gm-Message-State: AOJu0YzvHNCO5AcMbWkMSfdOd9OWu36KJR8VPcdMiBs/ExW8a9Vf+gBv nhEdFNHjF1BZcC0qkfLBLqxujbS54bDFzMpoZFUt1KLBxP5zok3k+1LQC1T0UWI= X-Gm-Gg: ASbGnctpW07bdKW8Unnv31TY8AEfZJCQcnMpIHjXiOBFG13dIgjcCyzxy6kBWXDcXle qQV+ZVMkehwYbfagD3H9KLqBki/iM+aHZoEfaAyYEDGcEmMYWWmxshlr5pa+Ii/qf7j32j+/aII /+XcehQn1S0dQ+eK/23CzD3R0Gib+9mSrTUwvjmGGCsPF+WvewnI6UPURdCLaNU96E9e0MDBu/2 UnfA9cHfl11vfhc+DqKmedqvSwftNXngNsc2NzAQOJRNkCej6d95bkyfzk= X-Google-Smtp-Source: AGHT+IF/jcs8cjb4B6GiHnOvpr78M0lvjd/SOOBsND3Uk6XPO25NFtr3q9aIzztmUerymlOVowuCsQ== X-Received: by 2002:a05:6000:2a9:b0:382:5010:c8cd with SMTP id ffacd0b85a97d-385c6ed7749mr578127f8f.44.1732664672853; Tue, 26 Nov 2024 15:44:32 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825fafe338sm14482899f8f.33.2024.11.26.15.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 15:44:31 -0800 (PST) From: Bryan O'Donoghue Date: Tue, 26 Nov 2024 23:44:27 +0000 Subject: [PATCH v3 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: <20241126-b4-linux-next-24-11-18-clock-multiple-power-domains-v3-1-836dad33521a@linaro.org> References: <20241126-b4-linux-next-24-11-18-clock-multiple-power-domains-v3-0-836dad33521a@linaro.org> In-Reply-To: <20241126-b4-linux-next-24-11-18-clock-multiple-power-domains-v3-0-836dad33521a@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 and 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 Signed-off-by: Bryan O'Donoghue Reviewed-by: Bjorn Andersson --- 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 Tue Nov 26 23:44:28 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: 13886438 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.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 07C601DFE35 for ; Tue, 26 Nov 2024 23:44:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732664677; cv=none; b=TkTbPMl1NYsCrVrOVsg9MZVZX40Wl99dkMRFwYp+qswr+w4YlxpU04vqrnwosE4bKBgss2+URSdU67peTpjAOJ+Ucza1V6TWX0Dg0M7dnRbZHNyJqZX/9ZWkVPI+Oo/522+QLwwGqVy3NvbLRSBUgjX4dJmeD/z3kH8Rg3TmbRM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732664677; c=relaxed/simple; bh=9DcDIgyiPEQQcegeEN1oWtNvqOat5t+dI1L4z5w/npc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jXcH1ZRzh+j5M/lB7YDuK64DHXjks9lDfHmY3tCWZyqxffM1AbLHd/vBd22amWqZ6KXabdKdcTn+OukNoYGJ45tdsJkAM6Wd/CVqXHrd7l0EZSutVEVcBcFWITRtgLJkOPdsXlIkZLcJ+9MLzTv1a/o/KAQuvJ/fUsejlBSzXV8= 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=f6AKDNje; arc=none smtp.client-ip=209.85.221.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="f6AKDNje" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-382442b7d9aso4704287f8f.1 for ; Tue, 26 Nov 2024 15:44:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732664674; x=1733269474; 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=f6AKDNjeC/ddGcJ/pTrP7RqmpxnNaWdSofMYY3TPXNbF6hvkg2of2rKa+C/GSW6vjv 1RpNC3zm24hAhgBtMYpuS5yw1/4wgsw8q6cLrEdBu6mfyWb+Dw60om71rEIDXWRX3tKl YTOc0PLpO/QnFAe0jXk5kEjZqzd3RZXEWS+vb4egTeOurBFnMD+FNO0XRr06vFHH73Y/ 2Q+a2bBF+EEVOP0Oh+hHKUx6HxDwWA8mCcGoUCyhbAPfIYBjWmjr6kFViBQmCEXoFoO0 qMMMoJf+hYMoA0cS9BaV6mYied2HpNCRbEm2e6FQwYoFytnngRksEp2aPwoX/VSnGkeO lGzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732664674; x=1733269474; 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=aX5PwsdZh3Xy9uV4QuTEIL2ZK8UCPYtjx7vczfQ1yowQtILbq7JIVgb3Ai9zx9TM+U 0Av6aOcNDwKdImE6aFZitqT+41uFNYcTpAjUj3nhNIVApYJznkxJMhxPoDP/xPgpfHw1 lXj/6u2th1XujzgIvRGJGuVLLtVYSQZSnxH4W/Q7zjpM4xmuwqGduXCUOtWJFFVP34ry hbGrtpEz+Wu7uc+7hjGxiwdCHYTDmCbnF1uJGqQubKLoqYLHXt4Cszgyx6ZvShy8hyLZ MowOuneQUJ9ZFIN4GZuO5qjbYCgHMGmo6Zs/yArqUGNRW1xBu1jxPysQDejIuvFYzxj8 CRRA== X-Forwarded-Encrypted: i=1; AJvYcCUVME7RQPxd5CkFpSI4sPqDA4EaCMQRvmTSQ0IFQ/KwBu4MIoApfQxivZ+/dP2meLNWJzF+5tsBtn4=@vger.kernel.org X-Gm-Message-State: AOJu0Yyc603n5nBq7XSJGUKnPwSO8VZ1DC2qCt406nBM2KrRIERNS8GW VVZCD4O2sczOIBMnCC9URbNDl0ftU3y9fUMcYwmPgzIVDBlFMKfCIvo0zZqPHHw= X-Gm-Gg: ASbGncv+YT6ykF7WehhCja8ktvIIV9H8tLhClx7KM4+c9NKuFqVe2WdUIWATgxkmZJ5 q0Fdl6vYWSHeDY+rMHgpOSWu8ql6fQ9f9sbg8fAzrhG3/OhNFqF3t03tf1anROuPRZqnvNQ/HGX XClOQqgoY9zFWfuqAgJ12B0Mz80q408y/UScQ3NYypDU5J18ePs8Vcei1zy+2arMPinbM4VSyyQ KIJLv8+bdys9ei6ImBMsqfR32bYv9CtYWD4139J7sTHzkJnkSx7Os4Z6nU= X-Google-Smtp-Source: AGHT+IE+Oglm7E2t7Ut5iZpBl+SAvEqAXWb/9nqHNfrjK8E3TwWYDWN8olld0Ah29+gOrPXAKM3mBQ== X-Received: by 2002:a5d:5888:0:b0:382:4378:4652 with SMTP id ffacd0b85a97d-385c6edd47bmr520166f8f.45.1732664674376; Tue, 26 Nov 2024 15:44:34 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825fafe338sm14482899f8f.33.2024.11.26.15.44.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 15:44:34 -0800 (PST) From: Bryan O'Donoghue Date: Tue, 26 Nov 2024 23:44:28 +0000 Subject: [PATCH v3 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: <20241126-b4-linux-next-24-11-18-clock-multiple-power-domains-v3-2-836dad33521a@linaro.org> References: <20241126-b4-linux-next-24-11-18-clock-multiple-power-domains-v3-0-836dad33521a@linaro.org> In-Reply-To: <20241126-b4-linux-next-24-11-18-clock-multiple-power-domains-v3-0-836dad33521a@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 Tue Nov 26 23:44:29 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: 13886439 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 06BA41E048E for ; Tue, 26 Nov 2024 23:44:37 +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=1732664679; cv=none; b=n9U1c149T6i0eDRfPnWq8GuefO6rJkimiCLy8SwMLuiFZ5KUgOq/5DDf5ALsol36Ov4JkdjN1LMPuZ516dzlE7nx580b3oWEoTAtpZTpdH/7xGmKvqmlttM1o/TS94zpbn2nsuZvEG3+SeHcyNf0/RFCiOIcHIx4wfRGs2lJIKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732664679; c=relaxed/simple; bh=nVHGEOrRUdBNA5gRWj0sFzT9xtelcZ3Fgi3g7ZZhzww=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ClQUew+AO1t+FoQHZyIGaK+a6vtdp35fRymx0jg8XnZWyWMGSMliJi7Iy+2yUZqGpnRYSvVw0dnjRKG0mHmFqm2CIoFB9azrVl04qXdLcxY5Tm28bROY5ZIkzhhzNCMeLgmCFCP9NyqvyvWUGXVaHIXjXXdOV15j1rZBM248kcc= 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=JxG539p/; 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="JxG539p/" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4315e9e9642so57035435e9.0 for ; Tue, 26 Nov 2024 15:44:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732664676; x=1733269476; 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=QK080mMzdkSHpObUIjIterv6PuoIM1SQM8FNf9+Umao=; b=JxG539p/bnkKA/TwZTCcEQ7syyPsoN4yl43pdhfBegBFA+PKgVZhZdVR2Y2mPySnMN ENWByUqYgO9C0WRp8eJJKZ9TGUjQ7cxsNerfLjnsbI0ZZzOaT3yNT6AO57SGRIwuPEqV C3nfzjSQzWW6H0r/Zxq8RGwJ6iRW2kSeVBl1RG7Rr9oRxmam6LW7eZ/qd6neMQqHWkxp Tw7ehbmIhzQ9d6GbgStisa8NmDzARED90SfAeJv+jbzYP5ndHUggVD3RiaA7NhS+m8F/ /mRkY195lWjO9SHEntCsA3vS7V+RJO9gqqLyNGNE1pnzq8RZIDQ72mpEeGwVB26F00g6 wJJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732664676; x=1733269476; 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=QK080mMzdkSHpObUIjIterv6PuoIM1SQM8FNf9+Umao=; b=puwBLDsbirdNUbkIsXiNdwe09v7EMV/uv6uZO25Bds/ximLoa31Y858gY0jhZWM+wY QpWSJAd5vj+KvoyH1vlEvJDDKI2sDSTXDOnZCYlF2RgOZTIQJOIJGd/Sf/EKc411At/G LMfuLDcO1rVEJc3r3LR7akC/Sm+llKQ5vNcRGBRo4QcQueLcfPglUgJc7LWy6Yg0TVep J1x/E0d6eod7DPNh7I6OT37J0qPLtnA9UdgJeCiXx1ddBWwGa+erabzwt81yc4KYIhGm 26A6HsPKgCrtUNTm8Xlrqy50Mqd8Ep73lfGPKefbR+zSfF4fvn0k+VDe1q7Ul/upGycU qXbw== X-Forwarded-Encrypted: i=1; AJvYcCVOfcCgCsA8Fz2Sxk6tcjcx1Bj5noCS/H/tpRCcRkLUxLFzv/IGtD7ifF0nFNGBcTAWKL4wRN6k8V4=@vger.kernel.org X-Gm-Message-State: AOJu0Yy7ObqlNjTfrhb8KHu4H7JeXXMB+UStF96fNjFyi7KVc6CJ9nA4 L7kHKF4Zd5hseg/PQutveJ16duc1UDr1iOT97yrXQrlJCuTKHdR90ABXj+Iht1M= X-Gm-Gg: ASbGnctRyy4P+FZplYtEsdR1OaIt3wgMBKA+v3c7evYGGBOsiaQRCog8cTAuT3AO85W gJMFev4DPQRSZXHZrTVjv4dc1SFE6FTXjmJoHjTvcNlRs1xtle12c8HjDAR2P3A7ZV+9T7/dhfB YqSl9nwS+CMG3hcH9eBGDwPWiJsijqCbfYQt/HBrzBLXQM8rzKZhL30jYabzehceW9Wh2rLiFkJ LxaXXXmc1ixZiFedRz/pqOLfwhTWXjRlr3/cMZnrlpDDF2tHzK4xJPYQuw= X-Google-Smtp-Source: AGHT+IGd+fjrVRUKvsVcA1pohdHvtSxuhDJA0UKE8GpD7PEO4QQLWsNHgyLqbxvvvkEfp+17KqBElA== X-Received: by 2002:a05:600c:1d18:b0:434:9936:c823 with SMTP id 5b1f17b1804b1-434a9dc694fmr9606295e9.18.1732664676497; Tue, 26 Nov 2024 15:44:36 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825fafe338sm14482899f8f.33.2024.11.26.15.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 15:44:35 -0800 (PST) From: Bryan O'Donoghue Date: Tue, 26 Nov 2024 23:44:29 +0000 Subject: [PATCH v3 3/3] driver: clk: qcom: Support attaching subdomain list 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: <20241126-b4-linux-next-24-11-18-clock-multiple-power-domains-v3-3-836dad33521a@linaro.org> References: <20241126-b4-linux-next-24-11-18-clock-multiple-power-domains-v3-0-836dad33521a@linaro.org> In-Reply-To: <20241126-b4-linux-next-24-11-18-clock-multiple-power-domains-v3-0-836dad33521a@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. 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