From patchwork Thu Nov 28 16:38:00 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: 13888246 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 230DE1C07EE for ; Thu, 28 Nov 2024 16:38:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732811891; cv=none; b=QyO8HdDuheALPck25cdg7G9lmhn5fvXfmzx5i0uGR+eH1PIaB0Ghhds76TpSiscVkhgJoLCfkEY4YgW9KySXBMRxjirkVH2OXTHr+PZ1KTKa56xWcrduuKWdUUk4zaihoJTsDLiQVEoARVCQ+Oh0n2KM/1NSBuXKYQb8LktCzd8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732811891; c=relaxed/simple; bh=mQpHD0O/4DmVLloEpdEHgH89jVyxadWEyw/hKsvGyhE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AHJwXHi8oLykbKn/y7YXT/63PAphd0vvi+GW0IIkr4U5c4N5RKnA3YjkzyZsvTTEcl8kG79jjDp9vF3yxWKBr4cXQF+VRBl8fQN8Uzfq+gnWM+Ryaw4igvON3Qae+RfsAX2DWzluT6S7hVYrt/6UoFAPI6VDhUndUWNXTEHot2Q= 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=lpk1cOwp; arc=none smtp.client-ip=209.85.221.45 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="lpk1cOwp" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-382423f4082so762550f8f.3 for ; Thu, 28 Nov 2024 08:38:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732811888; x=1733416688; 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=lpk1cOwpdxBjD1Ktil27Zxp5XzPBNhpj8hVSXIvfzY3+10ziCMv0Ec3lRuXkXEhSo5 6ygS6H5j5fa0eaK09VlZFODDYfGKemCrnFrUjjhrJVqQwjgmuk/u1jcmlduUOIFjCeW2 hL3MuR4TkBtoVd/jim/oNe6IUKWuIa7rNIGV9IYQeozqicZ+YTkvaUl2P4bhWPIWykGY Nezt6ZQLTIGLmbL6gpObPbnxs/plSjhhGAVNyQcs7ReH3NTX9sxZyoWt9Xm24RXhylb4 N4/OsDxDTnTYN6kwFTxpVtd3jbMnBVztzDms3VmiCQbA2vQ+ntCXne092nkptm377D6Y auag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732811888; x=1733416688; 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=JJMzSdxeTGt1y93UCk43M9yIfw2IrupxF8PJ0w4m9paXyJKQR51llkq/YXDNPkOrum yiGZyxlJvpgZPyj61Xd7cFaJU178DLvbgGo7WjSbhZbqgB1WGy3Xen/E3uhv7+eWybG4 PUJ0MlKiyS5qZRCWNNnuvm761Jw3rOSfwsYtQ5YBc3K/DUF7Vosjy4o1fccMgFuaAFoc QMEJoZmSONQoOW4YPF+KkLlfu0YVMxda4Z0Dk8RxY38DK6BnA/+h0DSoT8dmdhyDR06K z/0y/XdUHk4QX4iCd8jA7qcvsKOZOofTyLfZ/NtTqNXrcllhyweTGiyKWe+BymeJD3o8 ZX2A== X-Gm-Message-State: AOJu0YxUV0hLj9pwB/ADPPAH+Hiekgc9zSgPuOZQiYdgc4GT+KHgcRoh EhqhdlGd21YUdJqaM4YbPrVfEWHqAq3E4QXmYApgtEgAwiIaDW4wu7lJkdDgVNI= X-Gm-Gg: ASbGnct/ix8vTNPyZo/ZID6wB2Q3sBGt7rYBAg1xvZHp1aEgRe8Ml3P3kwttpY1Zw2B 86+TbySY/LP+MejG9xiE6HX/aHrvowo6xaqzydJe1Ek2oNzQg90OGQSvahEEvTtCjhKMCneMkWW TiOv4UaKblpj5aN40kskCMpThCRLzautZHNaPjfvwJHNPTDu7qUYFA49gg0Al7IaoivLnVXbZp+ HwwDLY7ZUYB/XOl4kdu6swaXfmyLRlYKmg8RIvv1mijCvHuwsA49PjnBa0= X-Google-Smtp-Source: AGHT+IFubuteqggyPtPqePz0DzUO88xCM2UujedDVDd3qIVP0OzH3a8fKyNdLCe9TkJ43xBopue/pQ== X-Received: by 2002:a05:6000:2ce:b0:385:c8d2:efde with SMTP id ffacd0b85a97d-385c8d2f096mr5146870f8f.48.1732811883199; Thu, 28 Nov 2024 08:38:03 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434aa78c202sm57990155e9.26.2024.11.28.08.38.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2024 08:38:02 -0800 (PST) From: Bryan O'Donoghue Date: Thu, 28 Nov 2024 16:38:00 +0000 Subject: [PATCH v5 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: <20241128-b4-linux-next-24-11-18-clock-multiple-power-domains-v5-1-ca2826c46814@linaro.org> References: <20241128-b4-linux-next-24-11-18-clock-multiple-power-domains-v5-0-ca2826c46814@linaro.org> In-Reply-To: <20241128-b4-linux-next-24-11-18-clock-multiple-power-domains-v5-0-ca2826c46814@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 Thu Nov 28 16:38:01 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: 13888245 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 852AE1C07E2 for ; Thu, 28 Nov 2024 16:38:09 +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=1732811891; cv=none; b=FHsb7PcMh87pQg5wnFji8S3XNWlh6LUmI1j/zoGk/xsTZvV51koLegF9vjJkmCcHIGU1V0W97xNGHInhPhYKvf8IkrfqLH+wDJVPRhrl9gLUbyFUuFecu2XcvJFMMJEgAwrPxiXpoo5+fUoArrRUyZsPYnnZlRQbb6j+p19VJO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732811891; c=relaxed/simple; bh=/f9lA72X/ORQ7pcy2S3XGqJGhHnwd9S3RJbZG1bW+c8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ghyli+fk9NlYytfWf5ycAR7kLZZEwfQFMBQY0bc4BBPOyYRCyMkVslzhOLSchMDzvYazwFzYm3RPKioT2ucVxLIYcset2I0CnzJM38J1myLY7gHIaIO1BhrGYslcUe2epCu0mU7mGWKVfI/z0X6fiwDeydnLJ7piTl/NJkTKHz4= 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=PxoYXPUI; 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="PxoYXPUI" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-434a8b94fb5so6494625e9.0 for ; Thu, 28 Nov 2024 08:38:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732811888; x=1733416688; 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=fkkZ+w95DsCr21/2mV7KTwZ4aDH2tLnISRljFlMlIBg=; b=PxoYXPUI2vBwj5FTDqqQCmGmNSYCPOv+3OTuZj4NOhvUldU+BRXkF8kEL0y0EeexvF 330m4w1uZW/sKFTHe3CkiTzqI6/QQXZAKZ6eJrPm7lqRUEKU6eJ+Q0zv+z5eav4vABYS sg33teNekAy09mhny1pvTTC9RKhycOH+3aghu5SYOuzR7ZBMWx8vUW4XTBs4jRYyhEZf A1jaGQ20qpinp7Ec2rXjb9NiOPrPFhtLjyCA2wDjqONZX95yzFJeKUQMEtaUuyW0OO7R BQ1IAICUp8+spyONjdNozW8ebtslP9x8IGKBM02QDSsdPzOjx4WdQ24AzuCsMvijMDXp 5Idw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732811888; x=1733416688; 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=fkkZ+w95DsCr21/2mV7KTwZ4aDH2tLnISRljFlMlIBg=; b=eBBg63xTtfyAmt15ya0jL1S0c09WAhox8gHdRega/jkg4RjwfEvR4PCNwzhumcmBlo ZxMLx3B6aPywr0NIFKAQeHR1UrHW8nFtuK/r+G0D/Ysmw7lA4AHc9KA4V5XOfUFKw+7O RGLwwKhjokIeCSwJ2WofcGijdxb8GX/j777gzPEERUlTArTJnLjygZ4Bz5KPWftz0Cn3 1arftZYO4q5i1TFvbwsIsCe5FOlzuOSL1wQBLjri7fPLZ9tv2kQbnq+ZkqFNB4YDAWJl qTxqRj+V811GUfxULvrsEsu0dXw2cmP3z766CvKEmsOgOa9j/Coi6kDma4Eye8XSmjSB 2VbA== X-Gm-Message-State: AOJu0Ywww4auy2g1b1bPB1yaISzOzC4C8JR1OM6OU2+map9vk1WPjnIc UIIiUNbCLl3kth6u3EyOP5UBHbk1bAvptOEB+usl90oPWf9rvYLWFgXJNRr+nYc= X-Gm-Gg: ASbGnctENqmX/1xQN0WYsoWaxbWMdbqxl/WVQKpdManR6r9EnF4db8G9B1baseVLQW8 RJETTFd6VMopE08DuMQWoxGuYKuryUZtEi7MwLrdoy3fVJZ559Sznrnic0eE3W+MbF87ZyRZnKi XKGRVe60fduQOPHJmkxxdgfwVn/MQpPoTwAR8OfOL+YhjgDKdyCLujcQdvkjIsUKT9hMXmBl/Dw CrIvxT0wjVH33cDpZS5jhZvSXLgAysXKXcTF1DduZb+XuFb6l/pFya1GX4= X-Google-Smtp-Source: AGHT+IFZ0tfqwMWMoYCA98m42itlZm4kdOIHsdPFaXo48Zatt+TaoryezMrflvGllQJI70tUdXCUig== X-Received: by 2002:a05:600c:1908:b0:434:9f77:e1dd with SMTP id 5b1f17b1804b1-434afb9ff7dmr34087765e9.5.1732811884986; Thu, 28 Nov 2024 08:38:04 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434aa78c202sm57990155e9.26.2024.11.28.08.38.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2024 08:38:04 -0800 (PST) From: Bryan O'Donoghue Date: Thu, 28 Nov 2024 16:38:01 +0000 Subject: [PATCH v5 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: <20241128-b4-linux-next-24-11-18-clock-multiple-power-domains-v5-2-ca2826c46814@linaro.org> References: <20241128-b4-linux-next-24-11-18-clock-multiple-power-domains-v5-0-ca2826c46814@linaro.org> In-Reply-To: <20241128-b4-linux-next-24-11-18-clock-multiple-power-domains-v5-0-ca2826c46814@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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c index 33cc1f73c69d1f875a193aea0552902268dc8716..e6a024e95ab5f4b0776ffc6c7b3bebfbebb007fd 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 @@ -294,11 +295,19 @@ int qcom_cc_really_probe(struct device *dev, struct clk_regmap **rclks = desc->clks; size_t num_clk_hws = desc->num_clk_hws; struct clk_hw **clk_hws = desc->clk_hws; + struct dev_pm_domain_attach_data pd_data = { + .pd_names = 0, + .num_pd_names = 0, + }; cc = devm_kzalloc(dev, sizeof(*cc), GFP_KERNEL); if (!cc) return -ENOMEM; + ret = devm_pm_domain_attach_list(dev, &pd_data, &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 Thu Nov 28 16:38:02 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: 13888244 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 576231C07D4 for ; Thu, 28 Nov 2024 16:38:08 +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=1732811890; cv=none; b=FBUIwlz24+sKp3/uftYu5DpazhQjKaF9BmaeEdIQj2rhHL0R5TcrNlsr9WI1X8EwoolidwLi659WPH7n+okV99AIk5FhyW7NdW0mSC64cENFI3hzHtYD70ZOdQq9vZd0NZTMtObSVzJ+bq5t3O5UdYDgzwyCiiqeCWK1F2dQpeA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732811890; c=relaxed/simple; bh=F6kS6huYzh41NUrek9OF4eqHKfMRC4xW0zjdNZqsagU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PBdnlbD/jiTBzl8o8QBWCWgkAkyai274Bn7GFhb9CTHmL2tqxj1NmMXeVB3IrZ1qTZkHc7zj2SuSAJnTpVD5WCTfdbotPAnwz+DHrM1rB76v/tfI3ByXGNbabHF3tg+a4aNJ5QKzYgcqlOLUqReHFVFJFO2Kr57El2ofGccMR0o= 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=QuXXPswY; 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="QuXXPswY" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-434b3e32e9dso5405985e9.2 for ; Thu, 28 Nov 2024 08:38:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732811887; x=1733416687; 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=rKEN920OmL7UDlbRsVIO5F66NiW9DJp7kX5jgbOKmaU=; b=QuXXPswYhGjgpvPkcFlc9lYeRtvz448fBbn2EzkTv9/qrJkegbr6kQOdYf5GxaYoN7 aONacCqccMr1x4LAkE+zypxEInTUusRMnou8AQ5xnoTNBkkVqM2SgUq7LadV36jBpS7H BbmfwResywCng0tjEutscOgQxVTWdvrqOOImMGMxwG2vgkHLKVaCIy6okis/5E0ub8rS NLOLhgkP4slJ0tDxpB+wYK46nCRiR+nAfvytLyLdWNKpLc+e/2xgJV6mwgPIGecwoqqX hMBmydmYJXu4Mw63OhOyPjWkBs3hBbxkZWWFtsNaSvtv1UB1bqaFbp6AnTcqN6vQnISO GLjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732811887; x=1733416687; 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=rKEN920OmL7UDlbRsVIO5F66NiW9DJp7kX5jgbOKmaU=; b=shueVZugIw18ybaaRF/uhMbL8AkrswivURNGbm/lMwYxr2Zpp+tqUhKs/S8t3bBJJB nvl3qwBDeIJ6o3cru6CNvAi2Fy0lsyWAAMJHFzSXMLJ953ckL/Msbhj/f2yukjlQyRld zn2PVTW+JnORPAT8CNhul66BksFVtZ7A2rplyZz7eXNZQV1+y/vVq4nERH33TUXUprG5 X8Dr7K/Y0pG19dmY6o1QPKzuSnqcB4IL01lTjUIBfybLQ+mbpwwWSJ+hNFUJqZFXMkKg VcIOxWPwo2C/bKVdo/LvJv8Ti6+GJxIxG1MUGktZ2SgOaidwI9J7Z0o4yED/lEErQmKq exQQ== X-Gm-Message-State: AOJu0Yyqn+Owrd6dOnVXtk93dTJkAZpetBkLlSJNJqwZLj9DEHlfuzHF Dz8za54Kx4/zJ6IWx3pVnBCGa+sZkWbkg4qkl4ib9W82hV5ppCdQ1XZBrrPKmzA= X-Gm-Gg: ASbGncurjStJZD48L+0w38XpE3f32bJHA3tIQRbTBuLIDgXjh0IpnFFg2dEG5Zjxusu gKLY/Nk4cbaB4uXvEKmPg87EffgLGffpBtQn4oOevu5ppTiA7ioCbgWgsdOxOVt2js3UtjGqHgj KpyFAaWnzKDoiLJac6RVa16QmoAz+BbGX0CruaKmmrrsODxL8K6RacQXYuhxXQHSeENFT5roMXx cHdIRZZpVZbpfPlLgE/ypOHJhziEPByfuhmkOEV53gJ52i3NUQ7SzmIDcE= X-Google-Smtp-Source: AGHT+IGYGOnHp31GxTsnkxHzdJCiiotGVBTL3h8xfacleLdMq1sO1fa8QiUoPmAfnOlVz2MQ4CqEMg== X-Received: by 2002:a05:600c:5490:b0:434:a815:2b5d with SMTP id 5b1f17b1804b1-434a9de43cfmr67266455e9.24.1732811886618; Thu, 28 Nov 2024 08:38:06 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434aa78c202sm57990155e9.26.2024.11.28.08.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2024 08:38:06 -0800 (PST) From: Bryan O'Donoghue Date: Thu, 28 Nov 2024 16:38:02 +0000 Subject: [PATCH v5 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: <20241128-b4-linux-next-24-11-18-clock-multiple-power-domains-v5-3-ca2826c46814@linaro.org> References: <20241128-b4-linux-next-24-11-18-clock-multiple-power-domains-v5-0-ca2826c46814@linaro.org> In-Reply-To: <20241128-b4-linux-next-24-11-18-clock-multiple-power-domains-v5-0-ca2826c46814@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 e6a024e95ab5f4b0776ffc6c7b3bebfbebb007fd..2976e360ed383f148995efcebbf73e2ebc917c83 100644 --- a/drivers/clk/qcom/common.c +++ b/drivers/clk/qcom/common.c @@ -327,6 +327,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