From patchwork Fri Jan 17 13:54:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 13943366 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 A8FC41FF7C1 for ; Fri, 17 Jan 2025 13:54:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737122054; cv=none; b=ijqCLyDo/dtm3ydwu1Azr9RDLN1j7rRslKY5JLFefpK2SmEhCpyb5Nd6BlIbGk4zor6zEq6MvlzZz//ppuym1bD4SJh6cSJR0yKBLNW4BlZa48nBDrN0Gb/ZWIgyp1CeS2NTb4D7BRhvSIQHts0wqJUJDrqUhf7jGNWazaYn7fQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737122054; c=relaxed/simple; bh=omQ0q5abBpkqFmtYz9fwRWfVIX08QuZYwIw+MD/b79k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bN9BdIiku/r4DV/RZihKnAh0KhSTuxRsMAMcwxHkCCXiUDGkK0uxEyKf4qkVeCH8rpXKnaUK4mdgSqkIZli9uEhUHcOunJLKOsU0Mo3+FnwuvcJDHlET9q67cn+QnCaOF/vRizupSt4KmrPsZ3VdntFHcv3KKJnshhEiJveGBLE= 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=mwrVVWG8; arc=none smtp.client-ip=209.85.221.48 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="mwrVVWG8" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-385de9f789cso1616633f8f.2 for ; Fri, 17 Jan 2025 05:54:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737122050; x=1737726850; 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=15Ks6wACBMUt+4Fhjb6F/swKHnhyTvT40HtN0zm9yGU=; b=mwrVVWG8w/RSivIzMfzqWiK5Qcb3+bwgwMj5kQ6uixnvHpWThQXSYwRvlgf2936N3N UlCoDENsk3KKsOgRGEp4RuptBjLEN9ODcIuUDmvH6cHTYvTaJwF/Mjj8MJq3h5FoloA4 PeRnVgXFpACxnGIOieCtHGoUaT+pPQDmwILSkbRAqnpTx/A61tOrCa7u7lG+uFSfI8bN 28zA4QFbHfYl5z283A03ZnqiVRlfahQrn0pVE7veTR64DJNMgmQ5zSyg0JAO6ePYm9rX 2KTjjSxBQGynbesuaHX3b5x7w7M/L3bDvL07gGvWLOTtFHGunDAIu5ckeL7cwLCFLGzZ 7pug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737122050; x=1737726850; 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=15Ks6wACBMUt+4Fhjb6F/swKHnhyTvT40HtN0zm9yGU=; b=hE3GnngvkHcaIPpqSdHF9J/+rm+aZqGjN/T6mtdsDpunbP9uFFinubLDW2QnzmopsN p9Tbvx+kEH7RQC0txIBozbu9Qu0JbFXD8YqwOtKzhMqYxSZ0mTb9Pdd8r8HPpgZES7pu U6lO1AQm7Anav1T/jQkN8xUy5i/1jP4Q3fUn3ydCZs7EXvV/uI/KQauD2HsKe8Zh46dn yRChwE36VXixdd9YjiD7nx/dYzQKSyRsGX8yLBOq4T5/E3SnWDjbXtQXqcEpKMKAnBUy UTU/TnsmmzRCYNO0I/Ygdl5aqcasj8Wdq/bQ9Rm6fUN5PopGb6DzJj2lNnRMNFT+eUQi 4fHQ== X-Forwarded-Encrypted: i=1; AJvYcCXk+Axv56fVWW8P8pZYlNEnxyCrrFdh8WaSB7utlXo/r+dAeRtprerffmtuLeiODU817tdFwmAvFa8=@vger.kernel.org X-Gm-Message-State: AOJu0Yxqwc2+OI7ZTMovf+EVkI/y3MYm6wiWkZUWuNuzgS4hsdpBmudh M7S2O3qWIgcuK9EJvWRLGqcyL5wdgn1Z5a2fA2Qqgi1rqZottRDnIUh4S08+avI= X-Gm-Gg: ASbGncuc3el7r/Yslt8ZlrzJjjXXONktLn2m4BCF95LHqR4BDq65cKeVl5kkc7cZXD5 97HsvaRbiMm67dCEDdZi4BQAAgjVROJFUbT+Ec5nnp/tpPINwzOLrU6b9pTmDrjpmmtgh0dtfRJ 4LFaCrDdetlWWt7LiLIpa4i2Mex6rztGVNEi6xcHfEsYmXM+hLkc4x1tw/2sSL+ASEhtXOC9sUd STSsIGH3NBOSyH2o8OzTILrlVB8UWsFzLM4PtnX7k7lzyBpXZ11WGBeZ+LN+xyY4w== X-Google-Smtp-Source: AGHT+IHNmLQm1j06TtGNOkJWIFaFS+c+vU1YTf1B5SrEFcW5N5PbHLEVJA/tlx1fts1YuOCHHCZpgQ== X-Received: by 2002:a05:6000:1faa:b0:38b:f04c:25e6 with SMTP id ffacd0b85a97d-38bf56626d4mr3033027f8f.14.1737122050037; Fri, 17 Jan 2025 05:54:10 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf3221bf0sm2545279f8f.28.2025.01.17.05.54.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 05:54:09 -0800 (PST) From: Bryan O'Donoghue Date: Fri, 17 Jan 2025 13:54:07 +0000 Subject: [PATCH v10 1/4] clk: qcom: gdsc: Release pm subdomains in reverse add order Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250117-b4-linux-next-24-11-18-clock-multiple-power-domains-v10-1-13f2bb656dad@linaro.org> References: <20250117-b4-linux-next-24-11-18-clock-multiple-power-domains-v10-0-13f2bb656dad@linaro.org> In-Reply-To: <20250117-b4-linux-next-24-11-18-clock-multiple-power-domains-v10-0-13f2bb656dad@linaro.org> To: Bjorn Andersson , Michael Turquette , Stephen Boyd , Dmitry Baryshkov , Vladimir Zapolskiy , Rajendra Nayak 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-1b0d6 gdsc_unregister() should release subdomains in the reverse order to the order in which those subdomains were added. I've made this patch a standalone patch because it facilitates a subsequent fix to stable. 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c index fa5fe4c2a2ee7786c2e8858f3e41301f639e5d59..bc1b1e37bf4222017c172b77603f8dedba961ed5 100644 --- a/drivers/clk/qcom/gdsc.c +++ b/drivers/clk/qcom/gdsc.c @@ -571,7 +571,7 @@ void gdsc_unregister(struct gdsc_desc *desc) size_t num = desc->num; /* Remove subdomains */ - for (i = 0; i < num; i++) { + for (i = num - 1; i >= 0; i--) { if (!scs[i]) continue; if (scs[i]->parent) From patchwork Fri Jan 17 13:54:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 13943367 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.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 A2A631FFC4C for ; Fri, 17 Jan 2025 13:54:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737122054; cv=none; b=DMK4axNUGocRUtSONvMfwOe5gqmEPQYnkSUM+XKCQ9/mJD5Ijcl7iZQJVb1p+JoCtRafq6CbwzgV3O5Zfx3FGfBqyjoxz+7liLfpBvbOIsM6kX8MftxNd0VLKaIz9jdyIYb5zfICsoYsMVU/QOR5az4F8EvXe+h2SqXeHZbaM58= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737122054; c=relaxed/simple; bh=MAgPHU1Bz2sNDNZOkc4tcdXK0ulAsoRdPInzeOCBuFw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RlnrLC5j1yQNBoZv6BGWMHztCsb0pVF2GWObnjFzgwj6yA0esR72TtNyDSjHptXh70BZKKEpDwGMUAmyitIyXVk/uuzVJ6sVtIH/MGaj/65jWBZe7VItPrDxrZ0cDfPdx7Mj9ATty9K4WJHA9Z1rb3dCrB+IeHqI1WCh3tOWKEA= 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=olwd0Whf; arc=none smtp.client-ip=209.85.221.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="olwd0Whf" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-385f07cd1a4so1716971f8f.1 for ; Fri, 17 Jan 2025 05:54:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737122051; x=1737726851; 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=XTx7trlO+qhAIZBVr4sCxA6UgBBZ6iW+pqhCeQ0jUHA=; b=olwd0WhfJHs1nlCt7ZFpe26jJ5Fkc0+UG1ZoPVuauVKFqw614ula0o2e8kqa05C8GK lTkjqnUWlff1TFbBcl5ijSIQGM/DeEqbAsZKbtBCoc4F1yoFr46Qe5MGhLpoedtZZDPf yd4S3oBpjHl3ft6NZAMIdoEn5FdNjuxbtEL0MyHyHF86YjyOtX9hU5dwAuvv2LNTsLLZ c2WSMtUkqFwoYlXjGcekGE0WNDADEWJlvdZM2sUFliy8XQFfCQXe4my2wXpbzk6g/qOT gHwVXPV5HCF6RTZdA0gaJu8gQNFm4leIgxf6bBgIkDgwqoTAFGRHe31x7KOjvz8FZOlP ArFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737122051; x=1737726851; 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=XTx7trlO+qhAIZBVr4sCxA6UgBBZ6iW+pqhCeQ0jUHA=; b=fDkvelExF5SUK0SgbRWsutdX5JaAdQ3Jz+GLjPx/10Un4JRQyjq9Y4Pa7AJV9dk4lL RfuaAu3hOFhkmu5s1BeCsJ6QrN1qwMcBGrr8GKY0YR8MZT1es4C3UmjYoRguXbx41hdm a6H6dR5FGlfC0eg8mQDyNHvp8k4kO7dEjnAo5M14lqyr4uJsd2vGaaTHO45v8iiL5etf P5dPRYvySn1q0sXRTP5VEz94+DUqqkT+geHEGr3Ll9MbIVYrVOf0FwF60Djh3i/Hkjf7 aBHky8q38/3txfzh8mYuSs3WWIS6crBEB6e5d6HtfjHws+aNEcuf3+J4yv/wD3joGtN2 53qQ== X-Forwarded-Encrypted: i=1; AJvYcCWZlgiBMztLmwlimjemFpc2pwkLyVtwlJ+3NzPOyAPBR8oOhjubN6SUcoHMR+1MXll6/Es6O8ezvSY=@vger.kernel.org X-Gm-Message-State: AOJu0Yz5KFpETPUoiiz1pd3qcdLh3m6EeUEXFwvv69X/yt/8qn3Q/NXG Mw//RFMstY/qVGGYNVdX84Hh8xD/i2RNlvk7es3gh/rLwqwDm+vLQb8Zmyzl8kI= X-Gm-Gg: ASbGnctIhkU/01WksvlT3SR1yGrkEnnVkgZXw+yUHZOUVoRvV9NoxARlFtbovKN1w2h EL3tk69RyX4AgGd8iFwaMjlIYtBBLlp6/XpedHaRh2qfRbD/Y7Dvfw6YGrAFop7XX3kIieAyEGN kXycjE4qwyWsAJi3iglMjG63a7Q60mgF8rjxqFSelsX3vXIY3nwacQjunCZPfzp6yC5d/qK7IQV +t/iOVPseDENclOC6IMaJrBs5ajLi8IBwt+zfw2jSt2COWcdfolWoXzbNXLAKJn+Q== X-Google-Smtp-Source: AGHT+IEDPXdDbnFx8QRaTJCrevmOYsul85rv9RHdhHqFBMauSQzaP+fCqw7xsorGDbZRjoKdq/HThQ== X-Received: by 2002:a05:6000:4021:b0:38a:a055:8498 with SMTP id ffacd0b85a97d-38bf57a9436mr2476005f8f.42.1737122050978; Fri, 17 Jan 2025 05:54:10 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf3221bf0sm2545279f8f.28.2025.01.17.05.54.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 05:54:10 -0800 (PST) From: Bryan O'Donoghue Date: Fri, 17 Jan 2025 13:54:08 +0000 Subject: [PATCH v10 2/4] 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: <20250117-b4-linux-next-24-11-18-clock-multiple-power-domains-v10-2-13f2bb656dad@linaro.org> References: <20250117-b4-linux-next-24-11-18-clock-multiple-power-domains-v10-0-13f2bb656dad@linaro.org> In-Reply-To: <20250117-b4-linux-next-24-11-18-clock-multiple-power-domains-v10-0-13f2bb656dad@linaro.org> To: Bjorn Andersson , Michael Turquette , Stephen Boyd , Dmitry Baryshkov , Vladimir Zapolskiy , Rajendra Nayak 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-1b0d6 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 Signed-off-by: Bryan O'Donoghue --- drivers/clk/qcom/gdsc.c | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c index bc1b1e37bf4222017c172b77603f8dedba961ed5..fdedf6dfe7b90c074b200353fc0c2b897863c79f 100644 --- a/drivers/clk/qcom/gdsc.c +++ b/drivers/clk/qcom/gdsc.c @@ -506,6 +506,23 @@ static int gdsc_init(struct gdsc *sc) return ret; } +static void gdsc_pm_subdomain_remove(struct gdsc_desc *desc, size_t num) +{ + struct device *dev = desc->dev; + struct gdsc **scs = desc->scs; + int i; + + /* Remove subdomains */ + for (i = num - 1; i >= 0; i--) { + if (!scs[i]) + continue; + if (scs[i]->parent) + 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); + } +} + int gdsc_register(struct gdsc_desc *desc, struct reset_controller_dev *rcdev, struct regmap *regmap) { @@ -555,30 +572,27 @@ 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) + goto err_pm_subdomain_remove; } return of_genpd_add_provider_onecell(dev->of_node, data); + +err_pm_subdomain_remove: + gdsc_pm_subdomain_remove(desc, i); + + return ret; } void gdsc_unregister(struct gdsc_desc *desc) { - int i; struct device *dev = desc->dev; - struct gdsc **scs = desc->scs; size_t num = desc->num; - /* Remove subdomains */ - for (i = num - 1; i >= 0; i--) { - if (!scs[i]) - continue; - if (scs[i]->parent) - 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); - } + gdsc_pm_subdomain_remove(desc, num); of_genpd_del_provider(dev->of_node); } From patchwork Fri Jan 17 13:54:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 13943368 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 AEFA8200115 for ; Fri, 17 Jan 2025 13:54:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737122056; cv=none; b=OP/goU6Lwdpg3mvqmbt2WhBpWHJ7Co6NADSRpTY6gAThewK1QlVV14pjk4VOu2lfMuu6TjypppaxWB4xPr5iQyeCVqlIY7y2lRu6FSHh+2fBKHrokFeE0dd3UqEDa3MjdqiKt1I+9eeVAdMqBGe5YPibcrmm+dVVyasSQDByoM0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737122056; c=relaxed/simple; bh=1bB7zeKYEAvds04CMWVz2vrkT1T8fqTENFgm3Croh80=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pisMw7erBUkvqsv7/53iNZ8jE+OVDiojGgexjKcqesFN090UlNXXbeWpXOVvjhO8KTUEa9XqW5f998tWYoqA6AMFkqbo4PhkREE/vjXQ8JwupcPxNSkZekgPPj+aFro+ECIYL83yDNbyD73raeotn1jks5RkYyPiYiBGzQOqn8w= 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=SnVR3NzC; arc=none smtp.client-ip=209.85.221.43 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="SnVR3NzC" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-385e0e224cbso1131091f8f.2 for ; Fri, 17 Jan 2025 05:54:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737122052; x=1737726852; 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=ZqX0V1eNStAoo4sPWKD9j/tGcT46bicfpPkCKdYvW2Y=; b=SnVR3NzCUmvpXnDtqZd4tKvH5ne1HlBhOpgAJL2Zaul60AYcGOB9AXg3ih0s7oRjBo PBS8FO89JcWfyBsXcu+6A3ZDv0f8MAYdN7kM26ll1KZugsJoUj37Ep9ne5LdWf2a1lgy a+APGVmxaEo2yVpUPDagg6qT8eRPopp6ydRtESrro88FE4afh6Yu0BTI7WaP3XFLpxAQ Dps66CkoTEvkCpnWwCWWma+KaX/dVaD4VNLBDbm/fXupn5NS3xZ7xfVXAiU3Kg3q5Cdm 0A2rxYE48MFGW2kXnJuIw2fCQNIGtRxI+G76yQL423vIpbFjLtFHxH5kvesqjoqI7qD1 gt7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737122052; x=1737726852; 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=ZqX0V1eNStAoo4sPWKD9j/tGcT46bicfpPkCKdYvW2Y=; b=XE6F3Qm8748jJscV5UFfHBDxvDLwViYG4wVPSGt3JjXoDLMCxKQFzGo/tvcYC7n3La 8Odt7iNqXmnIalG9WFUDfOEC+GnI6CqO7wdxQtIDt7NXHxl9GNbQMKt2Xvo4DN8OjWIp dI3TwoeAvV0QiNI3CYXUSgp2WoPa4q95ayErcP3inESkzYbl4iDkYoMnWtRq4HZpPPmV 8hlH2IugmblBfOgkWE29YW8yU6VTaJ4333btWdGdLtqgfBbZj6o+M3YLRuMBbYgBxsx4 vSrE5qqS4tOF6aDWzL48/87IJ5i2Y7e3TXM1kV8/ew4OergMWABn9KZFNyPgqagsUsrB F4Yw== X-Forwarded-Encrypted: i=1; AJvYcCWxUCAg44Zl6LEOOht/uen+CJhX3ZT50YzdtoMzs1dIm+cHbqUW+1qXiUzwIOl9Z/Gaz1Xgdz59i6I=@vger.kernel.org X-Gm-Message-State: AOJu0YzN6HoZt8dvtubxDk/TQhbSMJgfq+Jv97I4495xxcysmXZbLYMP QxpWmER6ZfhKDdRNicenFMKWSuT/+S025uNRLUDTq9seMlIESy21ataztIvS2iI= X-Gm-Gg: ASbGncs0RyQzzbpDB08v/FF1l0M8UMC35+D3Td5MslAs9/qC/OG5bmVZKpLPHddsjV8 At10fMBYdOwfq69AiBdvijdB1Z0jMO+DGqt9kHVwtS/YgAT9Aehepj3ZegG/J1X/FmE4vq2Wx03 zJhBCvFuDOdOg4nWW3NAPReEWXwUjZ2TMDWhgbMAJR1h2w53gn1WwM+9k+OQ8mehwXvozydD9b5 TIQO91wsfsnjDA8cjWX5QBAbXG8NU1YBgdH3IGamMg/N/jH0xS3oswhrm5V+OV+fA== X-Google-Smtp-Source: AGHT+IERIKprTfj4TGtNFTV+dziWvvun8Na1x5lCmNRgusK6uCzT/L4ml4i+lIBUsBATJIfoN1WugA== X-Received: by 2002:a05:6000:1445:b0:38a:418e:21c7 with SMTP id ffacd0b85a97d-38bf57c0546mr2616282f8f.53.1737122052049; Fri, 17 Jan 2025 05:54:12 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf3221bf0sm2545279f8f.28.2025.01.17.05.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 05:54:11 -0800 (PST) From: Bryan O'Donoghue Date: Fri, 17 Jan 2025 13:54:09 +0000 Subject: [PATCH v10 3/4] 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: <20250117-b4-linux-next-24-11-18-clock-multiple-power-domains-v10-3-13f2bb656dad@linaro.org> References: <20250117-b4-linux-next-24-11-18-clock-multiple-power-domains-v10-0-13f2bb656dad@linaro.org> In-Reply-To: <20250117-b4-linux-next-24-11-18-clock-multiple-power-domains-v10-0-13f2bb656dad@linaro.org> To: Bjorn Andersson , Michael Turquette , Stephen Boyd , Dmitry Baryshkov , Vladimir Zapolskiy , Rajendra Nayak 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-1b0d6 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 Jan 17 13:54:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 13943369 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 555452010F6 for ; Fri, 17 Jan 2025 13:54:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737122058; cv=none; b=qoJkql4DqzFBYdN8v+6Xa3USKKK83kyGBzx5zn37X5MGjENOp6Dat295EzGCa3eL4x6VkJ2ny0zI2ADFl7FL2xbSw6uYzDzw3PCTsvW7+BJhuT5u0N1rbh20IUn9MdBMQpiILpRC9Fmqdu78+9q0aXTZykWPC/oHCgRb7zb2+JI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737122058; c=relaxed/simple; bh=mMqiI/+I+zEagfKuHYtYK6UtY5ankGGl9IJrIWTvRH8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qOKji6Ug0sS08KgW2lCvH4IpIVHKXqub/6KuJfhRG5bUMybis1j82OSjJB+jvboSCkcPbjD8mWyre9IyyUJ7gClELBlajJvAXJ2lGz+aM35i9VXV1zZZcufdO52eg3lJQwvMynKvSb8Ino619c5e+CFPhvdFpZmCncr/MqtP2qw= 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=lCput38k; arc=none smtp.client-ip=209.85.221.42 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="lCput38k" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-385dece873cso1187798f8f.0 for ; Fri, 17 Jan 2025 05:54:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737122055; x=1737726855; 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=rqLgiwkb25f50FFmindGDO9xj3DpwPWvWiLB7nut8us=; b=lCput38k635S6xJaKgADG7xUt+QbFWWqQNWADURs8diRJC5hVTztDA+wRwA7Jz6mAf 1wee0ZUIme8cmiXXSaJBhJIaeGPX9S/Wb+mkzOsh4l4oxgk3ITiThU1WsEp1tDzP+a7s jvnl4MALG8FxK9TsgZl0kaepPyZPFr6Pg1zO7MucsPqT2XrfzLFKSjIhTx34ay4wHqF/ JY0ngRSwMm3qjtkMW07sFu16RH6NRjNcAvAt5h/8wTFLYd19bHo5ALERaY2GQ7TtlFMr /kLxiPhv7RZDygINgamsdDE3n7rXeqlSLMNdLYabbJBbxa/GRAIjDCBE63b5vguQK8UH au7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737122055; x=1737726855; 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=rqLgiwkb25f50FFmindGDO9xj3DpwPWvWiLB7nut8us=; b=nzIAqkTPDPCA0eT8uDSYgmmpBIoCOKll2xqe5DS8vik9b4J6jpaU2OGI3NY51DgFA5 pMHN19/LHbxzkehTGokQsIC+LDfYAgHO66ko4WwSKJ+FJ2OMGc+HTXwc626hjDc7aQbV ZwK0nMyVG7ZjDEu86gpAr4ppeTQ4OFIJ1UTdBQZIJH7zQAfrzHdV9JbBNzbV2f/aciNq vwEKmc7iKEIYWs76v6IOzMBgvzlXJgG8Q23ZEge9KtkLZeZblRpKsYS7dDHESz2sQ0gn HHyc6cTO0U2zRFPzemyhp6EZGgn21asoOpt/Gpo89fX0Cv5SfSXK36k0tYxn2zOE8lcS jIRQ== X-Forwarded-Encrypted: i=1; AJvYcCXRq1oI2nVGk4vB8nF4FDznYND80czUtoKdPTQoMxM//97K084nmSsnIsqot26FoarWzLN9seR2P4U=@vger.kernel.org X-Gm-Message-State: AOJu0Yx3Hzfsiu+YuQV+TJMmgWqNjaJKFxkPztCD4G5+8eIa1rxKn3H9 59AXKfikGjTQRaJArQ1Bwt79lv2kZg2Q9dYasIaJcJk+rWydJ7J4x/vlmbjQsb+tHOoRqZnD1Dy PbFA= X-Gm-Gg: ASbGnctCHSbq/ygQAh4duAH0XHcLo+4DRQ3c1OY+sYVSrSpyR3QRiLr6U0Ycj9bCc4y jvM+CGutIKRaXD8xhSg7xp2yh7snuHvQIgoRTRrEtnlVkDSe9Ny23N2UPg/MyWUfCwm+7gfxEEO /org8pSR6WDZVDApcZGiJW9XdD0L30VQfql4zKNfZE2DoNn7yXfoca/HiTUpBa9TXa4SUQ6p1A2 YP+JBKXrw/QTiz4qVpLNP7xSgjfDfpbkZ/yRK2M0jxtzeNmoBg93uGOgB1NvPp3lA== X-Google-Smtp-Source: AGHT+IGaJSeW2w7x6eBG4XpsNAmWHIvhG8jsJzu3RDMO/gYbJM75+0vPf6DPLMTpEA3hk3sTOsZFzg== X-Received: by 2002:a5d:4007:0:b0:38a:888c:7dec with SMTP id ffacd0b85a97d-38bf5675e61mr2124765f8f.28.1737122053112; Fri, 17 Jan 2025 05:54:13 -0800 (PST) Received: from [127.0.1.1] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf3221bf0sm2545279f8f.28.2025.01.17.05.54.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 05:54:12 -0800 (PST) From: Bryan O'Donoghue Date: Fri, 17 Jan 2025 13:54:10 +0000 Subject: [PATCH v10 4/4] 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: <20250117-b4-linux-next-24-11-18-clock-multiple-power-domains-v10-4-13f2bb656dad@linaro.org> References: <20250117-b4-linux-next-24-11-18-clock-multiple-power-domains-v10-0-13f2bb656dad@linaro.org> In-Reply-To: <20250117-b4-linux-next-24-11-18-clock-multiple-power-domains-v10-0-13f2bb656dad@linaro.org> To: Bjorn Andersson , Michael Turquette , Stephen Boyd , Dmitry Baryshkov , Vladimir Zapolskiy , Rajendra Nayak 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-1b0d6 When a clock-controller lists multiple power-domains we need make each GDSC a subdomain of each of the clock-controller's listed power-domains. GDSCs without an explicitly defined parent should be a subdomain of each of the clock-controller's listed power-domains. GDSCs with an explicitly defined parent should attach only to the parent GDSC and not the listed power-domains. Any votes will trickle through the hierarchy up to the external power-domains. ======================================== :: arch/arm64/boot/dts/example.dtsi :: ======================================== clockcc: clock-controller@0 { compat ="qcom,example-clockcc"; power-domains = <&pd_a, &pd_b>; } ======================================== :: drivers/clk/qcom/example-clockcc.c :: ======================================== static struct gdsc parent_gdsc = { .pd = { .name = "parent_gdsc", }, }; static struct gdsc child0_gdsc = { .pd = { .name = "child0_gdsc", }, .parent = &parent_gdsc.pd, }; static struct gdsc child1_gdsc = { .pd = { .name = "child1_gdsc", }, .parent = &parent_gdsc.pd, }; ======================================== :: power-subdomains :: ======================================== pm-domain::pd_a └── pm-subdomain::clockcc::parent_gdsc ├── pm-subdomain::clockcc::child0_gdsc └── pm-subdomain::clockcc::child1_gdsc pm-domain::pd_b └── pm-subdomain::clockcc::parent_gdsc ├── pm-subdomain::clockcc::child1_gdsc └── pm-subdomain::clockcc::child2_gdsc The performance states will percolate through the pm-domain hierarchy to the domains that handle the relevant states. 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 fdedf6dfe7b90c074b200353fc0c2b897863c79f..7687661491f1fd5a3076c839c4f70f430783fc51 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); + } +} + static void gdsc_pm_subdomain_remove(struct gdsc_desc *desc, size_t num) { struct device *dev = desc->dev; @@ -520,6 +550,8 @@ static void gdsc_pm_subdomain_remove(struct gdsc_desc *desc, size_t num) 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); } } @@ -575,6 +607,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) goto err_pm_subdomain_remove; } 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