From patchwork Mon Nov 25 01:00:12 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: 13884307 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 2BAD8D268 for ; Mon, 25 Nov 2024 01:00:16 +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=1732496420; cv=none; b=sbFSYvRP04AAx5drJ6GF+CgFJoa+3MjMe+mcfW5+F6KUbfPGbuspfeX1e/WbQu+gAO1uLF/MkGBqCfWf/aUYkVFtkf06ZroTdvgmEQJfahOXkQKTPOgRIhDfV2r/AIzCqQ2e7dp9O02pqR15m8zRSN3TxL0KvGaJ7w1Y7NhMcUg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732496420; 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=M9wvmgLbkwq8hZ+plnpOlhUZdVZ84wuxPBLw4oCazBEX02m1NpEHopLLk+ga++SUOazW6QRgyzaIt0wEdkeaF829M3gsLD0n7Lodm5ufcVo+gH8ZNxXeoOyb1sUnwQNsBANjsmmb8OC1nrb09B9EObKCaOjnXSmU2wkquY9TH0c= 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=TOtyzUt/; 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="TOtyzUt/" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4315e9e9642so35215605e9.0 for ; Sun, 24 Nov 2024 17:00:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732496415; x=1733101215; 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=TOtyzUt/rXyh125kPo6iV5EkKKLnH+vdwcuwgZOGTYl3sFk8kq3Nyxq6W3WbhZ0jp1 IniqdNyAbZjX3lmefFs61zWNmonVzGjus11MxR2lWC0DuBtErcvibYk2LQk4Y7NljEoR OGSHsLDi7ojrR3LIeysbTfuybrxBiWJLo0e4HRd1WRyNl+F/m0lBQiEtSvSJLzzu5L9A lK7L3OnhorHrdcLNwWel47fufCoxqe0KPqzIKIIw0gQYaNbBC334fGGOwkKwRju141o9 GuXl34H2M0MNG+JerHZMSBQQ3PqWwMvBg2coPz8r84pFHGIAXgwZ3E8pIVEHShOEQuDJ pG8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732496415; x=1733101215; 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=A/JVZHo61bOtgLX1857dm9sw81XUPcAPmeUpvn0kJI88Bdio5Gqg8btq6yFxEbPTk1 Gn1twtAePOeaJc3A95PR3iHc3JKBgimlrSJ3zhB2obvmQmqcY8dk320oC3XBiLkx5Iv1 BZFIebqMaeispAOPjLXO0uq2sp3ndJKxXBHCMg4d37pb00F5q/N+/H51ELu3liNO6L+c Ex150PriEr8nEHxrWr73EVApAETsfQVLajDYUjq2L+4mm2DQ8hfIQK4syebzYECWUl58 RT6/W+V32tr7JBqQ1/z3G/1XUX2DMbulJ4si+XFsWIloBqEVD6q9/FDdFbRjEEGsrUXL s1FA== X-Gm-Message-State: AOJu0YyDXDiv9Q23Xg9J6yzPp3FD/jQkNjO/63RpHwlhux6/jAakAZ+z Amei+dW97v1tWVV5FvSOYZ1tYrpYskkXplq5k61I3fpl7k9aqFdRvYMZTP0ebI9z62wDynAmUY1 /W2Y= X-Gm-Gg: ASbGncsx8uCQe53HC3vYl4q6aKReVUPugZ4MHBGV7AbIgWgLEu7odhtFvCSemXZrSV4 38F77qXu0o/njDbp3nhW/H2OgX9DOsfnpfrWeSvlerjB0uCw3aLU8qtgfNvuyBAlCj8KhQASCyP L6twMTrjn3ay1WV8nLiF/6e4iiRUJUg+QVRLuCKbpZ2Q3VK9PPAT7Fc9MJjR+L+QRVudmDOjsea 1shdl0TsbgCrOsgA7P/vkSfTxVZzzJ9xnhnJ//4r75uwXn/ENuaYLbCABo= X-Google-Smtp-Source: AGHT+IHMErZ6fryz2Oc3MCpFRq83v9PpLk8yzbEoM1+JFIaFwdXjct61irdWGrNB++dDxJOSlfOu8w== X-Received: by 2002:a05:600c:3ca2:b0:42c:bb96:340e with SMTP id 5b1f17b1804b1-433ce4b2f20mr107512995e9.31.1732496415157; Sun, 24 Nov 2024 17:00:15 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4349f0ba652sm24125125e9.40.2024.11.24.17.00.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 17:00:14 -0800 (PST) From: Bryan O'Donoghue Date: Mon, 25 Nov 2024 01:00:12 +0000 Subject: [PATCH v2 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: <20241125-b4-linux-next-24-11-18-clock-multiple-power-domains-v2-1-a5e7554d7e45@linaro.org> References: <20241125-b4-linux-next-24-11-18-clock-multiple-power-domains-v2-0-a5e7554d7e45@linaro.org> In-Reply-To: <20241125-b4-linux-next-24-11-18-clock-multiple-power-domains-v2-0-a5e7554d7e45@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 --- 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 Mon Nov 25 01:00:13 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: 13884308 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 A65CB4400 for ; Mon, 25 Nov 2024 01:00:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732496420; cv=none; b=C/jBzPP0cYwOfbs4KAhJ7QCEQLWinxjEubauLaI+Xe2Xr8nz9ZIY0IdPcmJb8P1pKjrLKlL/LKbVm8+OQetLekKRo1Xoyl9sS6EskOGdKmCzEwy87h1b+wdhSEIt0cRfoWr9/AO2lKpnKyfP9qNESzPSOV/W5QL/BJn8nVR3vb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732496420; c=relaxed/simple; bh=8Q0dwsJu+wk/Jd4PxCG5iT9YNajXnxbY7a6LSSkbWlo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WgusY21o+JBufz546wuaJ9/eWNFSqYbPn/C1JCej+izsHa/i1vaQjtVJsLDpIruNrOsdO5PVPJjr3JJsnFGEvq6ZoS3ESyjFXO7KIUUkFDQGph92ERIs1FZWSqQZDzIq9UyspUxpiIrtHqEOIUtiuJBERmLl3G/0um+BE8+OpYQ= 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=zsM+dZC2; arc=none smtp.client-ip=209.85.128.49 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="zsM+dZC2" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4315f24a6bbso33118715e9.1 for ; Sun, 24 Nov 2024 17:00:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732496417; x=1733101217; 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=4r5j9bVIpoqg4wTF7W56XBSdumsviU7AiOzIE1c3fKA=; b=zsM+dZC2Ymuw3k1AmPflBZ7MuOIi6uI5JXLoiXoS6Umso9KQ3XpdS/lz/UfXsRfHTV 1ALB0FmUHByQmkpuBQwhhzxoh3avCNo1FxpqfsvZqj8BjGS4HqRYXRBs6YAj4y5N9KCB OD0uS2qZhjUojrC0gqHwzw2Hh3mfI6LEM4fldy2xi0l9+wjcX3f5OpmY+elZC0ZeC7zE ELN91D17hgpTzaZaUuglhjwXO4GtXhaZ9i1lNshyGlKcgposrjr+oP5Dny7pIMhzLD3v UAn64OG/JW0JUgFXcM+5zVH6+HCyovbI0ToKtTGKojvnmvmkFN1Y1IsnzAqap1U6HtNo 8Ssg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732496417; x=1733101217; 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=4r5j9bVIpoqg4wTF7W56XBSdumsviU7AiOzIE1c3fKA=; b=iS3mQ3I42FovEdwURzzrCAAxLurBBcUhxVTi2pWJPBalGE3GxJyUWaEBs3t/1EQDZY 9uujiJbmyi3itrX638h83gIztIvDkgNPZHY+PAl5rs5Y9Lns0Oj2NVzdjlV5ZB3uI9li XBkpfoz/4d/lA4VmyuhS99/ukAJj9ojUvEKcP7yk+Qk3oMk2V2vihXwBnt6PWDbs4/bz nDZVauxp5nIDeiCfm86f0Ig8hUylBt1BWFwygPbCJui1eiQtdwNQIhaam+kG0CUWN4Jl bMdr9j2oQKMI9DDmJpFHfwB7qLwf6599f5iYKNAqWkWNg6j897apLufYdOYMjvisPFlc oB0Q== X-Gm-Message-State: AOJu0YxqWRPlnUDpwdIlwtggKaJdWbS8LioH7qCmDZ4vr83lMSG4bXyC TOqoX5G5c9hbzutYpoaIGUI6+QlgLeuJFncTzbfTEJqezlwGYWexWzu6i3D6UhoWyf1etqd+LQ7 I60c= X-Gm-Gg: ASbGncvL+Lm9dM9KL0WDNLqRBxab29PrOGRLKyHz7S8PtV4Ra4Balhd0VucPOch/NmU NzJvb/1lJ8byLJ5go87D3qBxSzTgnRnlPousu4FspT747nhrLCeSVMJmATQYvo1PjLdlscQrHHa DH0ze3c9Wz6JS95pb23r3Qc1CbKtu8IAtxDMMp7MYmyGSPPflvW/27B4rurZvx5J9ty7oRocBiZ +q2k9NgFuEDO9k+0PtVRTMtRrrpTHXLKWT8WnYPKMxueqw3JW65mUhkZ58= X-Google-Smtp-Source: AGHT+IE7C4rzp6H5XjRK7kkrwv5Z20pcz/Okn4VpbMU59v7Nvy+i01J+Hd+znMgP3Rc8mDIlgmvz0Q== X-Received: by 2002:a05:600c:3d8d:b0:431:4e25:fe42 with SMTP id 5b1f17b1804b1-433ce4e9e39mr85434635e9.32.1732496416711; Sun, 24 Nov 2024 17:00:16 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4349f0ba652sm24125125e9.40.2024.11.24.17.00.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 17:00:15 -0800 (PST) From: Bryan O'Donoghue Date: Mon, 25 Nov 2024 01:00:13 +0000 Subject: [PATCH v2 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: <20241125-b4-linux-next-24-11-18-clock-multiple-power-domains-v2-2-a5e7554d7e45@linaro.org> References: <20241125-b4-linux-next-24-11-18-clock-multiple-power-domains-v2-0-a5e7554d7e45@linaro.org> In-Reply-To: <20241125-b4-linux-next-24-11-18-clock-multiple-power-domains-v2-0-a5e7554d7e45@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 which power 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 Mon Nov 25 01:00:14 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: 13884309 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 2D4F0BA50 for ; Mon, 25 Nov 2024 01:00:20 +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=1732496422; cv=none; b=Oc60vCoh4dF0QIRzMyifXNkTtcyarHBDEp72MjoHuJvqKH6Wr0PnebvXdWk8nYd8dGYmDVeKHLgvF75t2I6lyxPcwS+LgwqavSMkoyPq7qgb9tGybtVnJbEAJ84DCaUv1suO8QXGc/QswiOUheKozDSrSs61JejvqJ7Vl4x5g1c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732496422; c=relaxed/simple; bh=nVHGEOrRUdBNA5gRWj0sFzT9xtelcZ3Fgi3g7ZZhzww=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RsYVf5sFeNe9RHnTlcVzM4lkyGF7uqMB+UhWX2nSlzQgT2LwMS4IPlqkDWxTA0ISFg0lGRL3UsCRuh8u1PeBeMoSJWPuwYA72OvAOiKN7bKlc8odzyjlBUUprfHYCVNSC4BS87lkAnZJEgo4tppSf1X0QybJyGGunlEyzCqq4OE= 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=t44uWrVu; 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="t44uWrVu" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4319399a411so37306345e9.2 for ; Sun, 24 Nov 2024 17:00:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732496418; x=1733101218; 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=t44uWrVum9Ut576va3ZJx5qy6asn0uTI389pmQ7Sqomh5HnIj62sDIikyVcM92L+kX 8ZavPiLQuKNvOnrFwvQ2kFpcdAPRTHLXEKx9GTOKB950XeTRtEE561hEa/cGIg0zsBVe WKUPoagDUbusnNCO/kXVqlJvKWQotOml/hUW1F0TKleOQWwjDAGOp/kXFqU4QW5emrCW AI4cfAzhpnQvGPxpY4CSUNE0CufM7algpPLCdALnJ8QabrDd22f4XGTk6aa225CRs1i4 7oVCpGhYQTwSlOEpZFzV1+7Baqt0IwAABDl+kWOl8BSm/J5dy/aafNmuLhb4YwwkVKwb PkgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732496418; x=1733101218; 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=oMsxiNMsnVJm7QOJNm9oiOaFtu6+/sOO/WHMGLNLN9JFnjYnnPRH0TGz2CydUVhlb8 yAVYtrU03g8xnv9MNCexwNgA8wkA4+02seiy4QUwtkw3ScMUsPMDA16Ak4uK32+Y8Cr9 bAZ3h/z+46a5ln0aOn9RkerxLBrQYdCyzHspUXbrBPwXlh7nAtZ/fDK+zSNQhIxnMcbq TThcX2TtQPBKckrF9WT0PwIlPz1xk6ksSAT37f7eQ4zVMjIno/HKoo3E9HCRykSMGemM OnQUvOtcuEnmG9WWxs8/7GGkUILeIfoWVzpv2tVvpB7776hQXWXV+n1riIRCmeJ+aV1V vJuQ== X-Gm-Message-State: AOJu0YxP15cXkXhr8+adau9Y4fr89o9mxkhe5MRudC7jFIwZYxe9uwPK ZYtE/jtP/olFvj0E2ibrqEPR8bCfPa+i2WGax/dsOZ8SRye5/qTYJRgMy3P13+HJ7eext1SAoxv Ao/0= X-Gm-Gg: ASbGncuSVC9RVWhUBjcoLM8TRuyLUMGenfyxtHh5/e6jwkYgy8mQF8eyZFntNMwB1Gt /Xc+aO78qUOmKx5MpJvEjvEHWA5GEDwD9xjV73lizVe09ubNFpZRMq3ajMuFxxtPlLS+iNbBZv3 BaR46TJCtJmJPuK6gUf88YuHbx88w5MBuFuPJBeVcEElHOUUNHAe59hPNMNL58avZQ1AtXnAZ8G DIKmX1RkQ3z1RjRmWBHFLNzuTt5kmH8mliRaUACCoHdapMvkiV4YQj40j8= X-Google-Smtp-Source: AGHT+IEAGlCilG8EQiX4eHWR9jCfgHPz1anIKZ3sLAgNmaQ9WHHp9Sq1Imvv7aOLcmrzWShE6SCeTg== X-Received: by 2002:a05:600c:63d4:b0:434:9c60:95a3 with SMTP id 5b1f17b1804b1-4349c60c065mr33631055e9.11.1732496418308; Sun, 24 Nov 2024 17:00:18 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4349f0ba652sm24125125e9.40.2024.11.24.17.00.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 17:00:18 -0800 (PST) From: Bryan O'Donoghue Date: Mon, 25 Nov 2024 01:00:14 +0000 Subject: [PATCH v2 3/3] driver: clk: qcom: Support attaching subdomain list 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: <20241125-b4-linux-next-24-11-18-clock-multiple-power-domains-v2-3-a5e7554d7e45@linaro.org> References: <20241125-b4-linux-next-24-11-18-clock-multiple-power-domains-v2-0-a5e7554d7e45@linaro.org> In-Reply-To: <20241125-b4-linux-next-24-11-18-clock-multiple-power-domains-v2-0-a5e7554d7e45@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