From nobody Sun Feb 8 19:30:35 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0197A2C11CA; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; cv=none; b=AHcX1Ds8j4l7hK0sPUj3AfFO3+aQX+WzV8ycIBRrVFmZFJynxMS+6B30kge9KDwwn4+MGy/jxBiQYWEC9mCEarwBdRatitCV+tkP6bd13EmOo78KwCGm8wFOlzjgvJ8caHlv0tUdBdGDB5XyKJMjRZkbYZj+fHFjwWFa+cl3OEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; c=relaxed/simple; bh=EV5QrWGkig2YkqQcwqpy9xrJBzO9BBKdu7LlEuXELtg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Asbsul37pxOJJx5T3+K+PoTUNZUlUXoOuw00Tbqqoylt980zEM/LQJFtrPRX0a2O4+hdLvrsTd1OrBUX9g7nig7EklGdb//q4bdFf/YHEmgPucCZfbRUWWy5FTStpbj0p58xQISC0YbIluKjeNLGZwpA3ZuV1fu97KD47pf/tfQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=s/VeN30q; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="s/VeN30q" Received: by smtp.kernel.org (Postfix) with ESMTPS id 66A4CC16AAE; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767621365; bh=EV5QrWGkig2YkqQcwqpy9xrJBzO9BBKdu7LlEuXELtg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=s/VeN30qvR31CzafjknnZFpce1Mn5J1nbjbEIktwxfoL4EueMs8wczWF+ILeZYrE0 NQhiT3EfmGgD1Ufw4Ncibk0iuhM1vGGU8F5ZBLBDpZbHvXLLfqQZ67tng8Fn5JfBjD jkIDGKNJom7jPl96iySyvajBy/oen/El3G9KfrXIcZC8jdB7pyyoK/g730dxzSS4Ic KMWq/PCfdmTGTGYPHXLquKYv/jYCT3knqI0KP+y1Ep5EG81Rw8mPymNC4XiwKiZZ5F zhF1m4tgJKmY86Fo9SEScO0guDHgA+zMXJljWTe80sYOANS8aWjTHJgnksOBK8XAqr Iz12cICBOq0KQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 540A5C79F90; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 05 Jan 2026 19:25:41 +0530 Subject: [PATCH v4 1/8] PCI/pwrctrl: tc9563: Use put_device() instead of i2c_put_adapter() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260105-pci-pwrctrl-rework-v4-1-6d41a7a49789@oss.qualcomm.com> References: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> In-Reply-To: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> To: Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Bartosz Golaszewski Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Brian Norris , Krishna Chaitanya Chundru , Niklas Cassel , Alex Elder , Bartosz Golaszewski , Manivannan Sadhasivam X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1698; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=uRiBY5lL1lc1Lvu1lsi1RLw6Jbau7l8e4J6XHZ91N/0=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpW8LyrTB1/7xYHSK+ITndk1QFsfhU23hYFIvL7 TBl9/IH+36JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaVvC8gAKCRBVnxHm/pHO 9SxbCACE8dPrXxT6b8mvBa1KwOqhv2aM1gSQjgA4iFsR2qhsm/9KNgzdFO1p2DzSd3pIU4INsMk gMQrUPnL6/O4ZwBlakP41dSbtG+Zja+aJuoH1o5mOvUhaZdiT0mGLZzC06WN1F1RPTLjnwtK8CW Y5M3/YoZ/dG/vCG+jTlOdOXkzMX74ogpnqkoIdxmSVHrY9TEAGBTz1ZojR1/gM4eLD34hRxiN3c sz6DI3o6ikjFEgqYM0NdElK1m3v2bdVJ6lrU2+UCuQK2y0P1T83A9kcbBNyi/tWIDvuMhBva1h2 xk3Vs/n/dyeaaf3cVgPd9bkC7ra6CaKHvQi0HUbuJdUHTkR6 X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam The API comment for of_find_i2c_adapter_by_node() recommends using put_device() to drop the reference count of I2C adapter instead of using i2c_put_adapter(). So replace i2c_put_adapter() with put_device(). Fixes: 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563") Reviewed-by: Bartosz Golaszewski Signed-off-by: Manivannan Sadhasivam --- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c b/drivers/pci/pwrctrl= /pci-pwrctrl-tc9563.c index ec423432ac65..0a63add84d09 100644 --- a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +++ b/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c @@ -533,7 +533,7 @@ static int tc9563_pwrctrl_probe(struct platform_device = *pdev) ctx->client =3D i2c_new_dummy_device(ctx->adapter, addr); if (IS_ERR(ctx->client)) { dev_err(dev, "Failed to create I2C client\n"); - i2c_put_adapter(ctx->adapter); + put_device(&ctx->adapter->dev); return PTR_ERR(ctx->client); } =20 @@ -613,7 +613,7 @@ static int tc9563_pwrctrl_probe(struct platform_device = *pdev) tc9563_pwrctrl_power_off(ctx); remove_i2c: i2c_unregister_device(ctx->client); - i2c_put_adapter(ctx->adapter); + put_device(&ctx->adapter->dev); return ret; } =20 @@ -623,7 +623,7 @@ static void tc9563_pwrctrl_remove(struct platform_devic= e *pdev) =20 tc9563_pwrctrl_power_off(ctx); i2c_unregister_device(ctx->client); - i2c_put_adapter(ctx->adapter); + put_device(&ctx->adapter->dev); } =20 static const struct of_device_id tc9563_pwrctrl_of_match[] =3D { --=20 2.48.1 From nobody Sun Feb 8 19:30:35 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2421F315764; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; cv=none; b=uQErM/e5T3MgpxlcuRt28Y3u+UM8w0X6FQgTXcvOX0QvmvIaZPIHZLz4DByadkgLMq0whFqnAh/mcqOuSMjB9RRLmM8qhhe83jJzywsva3/o/+iItTtwX2li1kV4/GQzRgYOY1jcIK6QdFXy9aA9KjT0wWreNlEjI/ksh5IQFoc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; c=relaxed/simple; bh=Ntgzo3Vph+kP0OsAhSnb+mpngFnLkvv+Qtv5ogIVlWk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=crW24vUSvE+YB7M8dgLKYkNuHRiNbUyMrPVRXOULjq1nifr/Tq40uARBtbG0ad6AeR/SpIec+J3TmT6jCfvOuJaKqaE0e0HmhPa24F59JwnFu+eGKzoSdERCW7hSAeTq8syHYavT1etbvs7KJ3oFwi4FKlMeZLxB0Qob4ML9JY4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RM5Knto8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RM5Knto8" Received: by smtp.kernel.org (Postfix) with ESMTPS id 71C32C19424; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767621365; bh=Ntgzo3Vph+kP0OsAhSnb+mpngFnLkvv+Qtv5ogIVlWk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=RM5Knto83GnocxcisPWnvmvjIM1waWl1JG88LO3XfFmBcA5/aTF5bVh6OHkMjFCnU b9OA+2/8S058GskKivpZ6JGkp7mXiaF41c5kq9jtpuMm80Vz7bycN8LQXIk3VrlfUU xFdCIpcxKQITL+T6xjc1Q+Tf9xaROhdqtKURLNvSXDsbKGHSkmsJJBZTgKhCDnWfA+ xTtmfK9EAYhsnqg03C9zabTn/peZjtLpBnX1pBC2X2XFehA2vnkESYX2HEShScONQJ /bw3TVN2SHn5xf+yRylGvDgDgnN5OdbKLEV0qN84g2ZvSTxAuw0hZ4MxudnZEh409B 0OEsPJHq08fng== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6250BC79F9A; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 05 Jan 2026 19:25:42 +0530 Subject: [PATCH v4 2/8] PCI/pwrctrl: Add 'struct pci_pwrctrl::power_{on/off}' callbacks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260105-pci-pwrctrl-rework-v4-2-6d41a7a49789@oss.qualcomm.com> References: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> In-Reply-To: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> To: Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Bartosz Golaszewski Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Brian Norris , Krishna Chaitanya Chundru , Niklas Cassel , Alex Elder , Bartosz Golaszewski , Manivannan Sadhasivam , Chen-Yu Tsai X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=8818; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=Y2lIq8uxsjGR+WtNehymfHn7dVjmFrK7/YgN9bRdcL8=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpW8LyOIGStqYxyUDpWvFaoTJfWSrKT0poSKort 6cXJrqjLLSJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaVvC8gAKCRBVnxHm/pHO 9Wk3B/42I26fQhS89kqJwvNC17RtyhuK/o7KWfh/XCYKSO0kWxmWTvFq/6K0mgAsmcyn0/R4zjo jBdLOUZFKx4Ckcs0zQPGJrvOVPGe6arJK7SW+QqoRUz9wp9gFZqlxYV4KPjVfwlooJrqqvruYeV AoCci4nvjeCE4/FOYRIIVBP9E8Sg3twrK24+Z3+33+TuPhDf5UeWt0/pSpp5JjZaVjsoE8P5C4n ZCknW3Ohkn9BaEbBdkwIuPK0fz/jdvwdgeNbJAJmzvFlMjV+cGZJgOlobWDkrsnZ6HmQjqyDU20 fRoXxMToJqGbcGyaNmNppN7BcWZqKuoloPf6cQR0TF7C4U1O X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam To allow the pwrctrl core to control the power on/off sequences of the pwrctrl drivers, add the 'struct pci_pwrctrl::power_{on/off}' callbacks and populate them in the respective pwrctrl drivers. The pwrctrl drivers still power on the resources on their own now. So there is no functional change. Co-developed-by: Krishna Chaitanya Chundru Signed-off-by: Krishna Chaitanya Chundru Tested-by: Chen-Yu Tsai Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bartosz Golaszewski --- drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c | 27 ++++++++++++++--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 22 ++++++++++---- drivers/pci/pwrctrl/slot.c | 50 +++++++++++++++++++++++-----= ---- include/linux/pci-pwrctrl.h | 4 +++ 4 files changed, 79 insertions(+), 24 deletions(-) diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c b/drivers/pci/pwrctrl= /pci-pwrctrl-pwrseq.c index 4e664e7b8dd2..7e7093cbff3c 100644 --- a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c +++ b/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c @@ -52,11 +52,27 @@ static const struct pci_pwrctrl_pwrseq_pdata pci_pwrctr= l_pwrseq_qcom_wcn_pdata =3D .validate_device =3D pci_pwrctrl_pwrseq_qcm_wcn_validate_device, }; =20 +static int pci_pwrctrl_pwrseq_power_on(struct pci_pwrctrl *ctx) +{ + struct pci_pwrctrl_pwrseq_data *data =3D container_of(ctx, struct pci_pwr= ctrl_pwrseq_data, + ctx); + + return pwrseq_power_on(data->pwrseq); +} + +static int pci_pwrctrl_pwrseq_power_off(struct pci_pwrctrl *ctx) +{ + struct pci_pwrctrl_pwrseq_data *data =3D container_of(ctx, struct pci_pwr= ctrl_pwrseq_data, + ctx); + + return pwrseq_power_off(data->pwrseq); +} + static void devm_pci_pwrctrl_pwrseq_power_off(void *data) { - struct pwrseq_desc *pwrseq =3D data; + struct pci_pwrctrl_pwrseq_data *pwrseq_data =3D data; =20 - pwrseq_power_off(pwrseq); + pci_pwrctrl_pwrseq_power_off(&pwrseq_data->ctx); } =20 static int pci_pwrctrl_pwrseq_probe(struct platform_device *pdev) @@ -85,16 +101,19 @@ static int pci_pwrctrl_pwrseq_probe(struct platform_de= vice *pdev) return dev_err_probe(dev, PTR_ERR(data->pwrseq), "Failed to get the power sequencer\n"); =20 - ret =3D pwrseq_power_on(data->pwrseq); + ret =3D pci_pwrctrl_pwrseq_power_on(&data->ctx); if (ret) return dev_err_probe(dev, ret, "Failed to power-on the device\n"); =20 ret =3D devm_add_action_or_reset(dev, devm_pci_pwrctrl_pwrseq_power_off, - data->pwrseq); + data); if (ret) return ret; =20 + data->ctx.power_on =3D pci_pwrctrl_pwrseq_power_on; + data->ctx.power_off =3D pci_pwrctrl_pwrseq_power_off; + pci_pwrctrl_init(&data->ctx, dev); =20 ret =3D devm_pci_pwrctrl_device_set_ready(dev, &data->ctx); diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c b/drivers/pci/pwrctrl= /pci-pwrctrl-tc9563.c index 0a63add84d09..616d3caedb34 100644 --- a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +++ b/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c @@ -434,15 +434,22 @@ static int tc9563_pwrctrl_parse_device_dt(struct tc95= 63_pwrctrl_ctx *ctx, struct return 0; } =20 -static void tc9563_pwrctrl_power_off(struct tc9563_pwrctrl_ctx *ctx) +static int tc9563_pwrctrl_power_off(struct pci_pwrctrl *pwrctrl) { + struct tc9563_pwrctrl_ctx *ctx =3D container_of(pwrctrl, + struct tc9563_pwrctrl_ctx, pwrctrl); + gpiod_set_value(ctx->reset_gpio, 1); =20 regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); + + return 0; } =20 -static int tc9563_pwrctrl_bring_up(struct tc9563_pwrctrl_ctx *ctx) +static int tc9563_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl) { + struct tc9563_pwrctrl_ctx *ctx =3D container_of(pwrctrl, + struct tc9563_pwrctrl_ctx, pwrctrl); struct tc9563_pwrctrl_cfg *cfg; int ret, i; =20 @@ -502,7 +509,7 @@ static int tc9563_pwrctrl_bring_up(struct tc9563_pwrctr= l_ctx *ctx) return 0; =20 power_off: - tc9563_pwrctrl_power_off(ctx); + tc9563_pwrctrl_power_off(&ctx->pwrctrl); return ret; } =20 @@ -591,7 +598,7 @@ static int tc9563_pwrctrl_probe(struct platform_device = *pdev) goto remove_i2c; } =20 - ret =3D tc9563_pwrctrl_bring_up(ctx); + ret =3D tc9563_pwrctrl_power_on(&ctx->pwrctrl); if (ret) goto remove_i2c; =20 @@ -601,6 +608,9 @@ static int tc9563_pwrctrl_probe(struct platform_device = *pdev) goto power_off; } =20 + ctx->pwrctrl.power_on =3D tc9563_pwrctrl_power_on; + ctx->pwrctrl.power_off =3D tc9563_pwrctrl_power_off; + ret =3D devm_pci_pwrctrl_device_set_ready(dev, &ctx->pwrctrl); if (ret) goto power_off; @@ -610,7 +620,7 @@ static int tc9563_pwrctrl_probe(struct platform_device = *pdev) return 0; =20 power_off: - tc9563_pwrctrl_power_off(ctx); + tc9563_pwrctrl_power_off(&ctx->pwrctrl); remove_i2c: i2c_unregister_device(ctx->client); put_device(&ctx->adapter->dev); @@ -621,7 +631,7 @@ static void tc9563_pwrctrl_remove(struct platform_devic= e *pdev) { struct tc9563_pwrctrl_ctx *ctx =3D platform_get_drvdata(pdev); =20 - tc9563_pwrctrl_power_off(ctx); + tc9563_pwrctrl_power_off(&ctx->pwrctrl); i2c_unregister_device(ctx->client); put_device(&ctx->adapter->dev); } diff --git a/drivers/pci/pwrctrl/slot.c b/drivers/pci/pwrctrl/slot.c index 3320494b62d8..9f91f04b4ae0 100644 --- a/drivers/pci/pwrctrl/slot.c +++ b/drivers/pci/pwrctrl/slot.c @@ -17,13 +17,38 @@ struct pci_pwrctrl_slot_data { struct pci_pwrctrl ctx; struct regulator_bulk_data *supplies; int num_supplies; + struct clk *clk; }; =20 -static void devm_pci_pwrctrl_slot_power_off(void *data) +static int pci_pwrctrl_slot_power_on(struct pci_pwrctrl *ctx) { - struct pci_pwrctrl_slot_data *slot =3D data; + struct pci_pwrctrl_slot_data *slot =3D container_of(ctx, struct pci_pwrct= rl_slot_data, ctx); + int ret; + + ret =3D regulator_bulk_enable(slot->num_supplies, slot->supplies); + if (ret < 0) { + dev_err(slot->ctx.dev, "Failed to enable slot regulators\n"); + return ret; + } + + return clk_prepare_enable(slot->clk); +} + +static int pci_pwrctrl_slot_power_off(struct pci_pwrctrl *ctx) +{ + struct pci_pwrctrl_slot_data *slot =3D container_of(ctx, struct pci_pwrct= rl_slot_data, ctx); =20 regulator_bulk_disable(slot->num_supplies, slot->supplies); + clk_disable_unprepare(slot->clk); + + return 0; +} + +static void devm_pci_pwrctrl_slot_release(void *data) +{ + struct pci_pwrctrl_slot_data *slot =3D data; + + pci_pwrctrl_slot_power_off(&slot->ctx); regulator_bulk_free(slot->num_supplies, slot->supplies); } =20 @@ -31,7 +56,6 @@ static int pci_pwrctrl_slot_probe(struct platform_device = *pdev) { struct pci_pwrctrl_slot_data *slot; struct device *dev =3D &pdev->dev; - struct clk *clk; int ret; =20 slot =3D devm_kzalloc(dev, sizeof(*slot), GFP_KERNEL); @@ -46,23 +70,21 @@ static int pci_pwrctrl_slot_probe(struct platform_devic= e *pdev) } =20 slot->num_supplies =3D ret; - ret =3D regulator_bulk_enable(slot->num_supplies, slot->supplies); - if (ret < 0) { - dev_err_probe(dev, ret, "Failed to enable slot regulators\n"); - regulator_bulk_free(slot->num_supplies, slot->supplies); - return ret; - } =20 - ret =3D devm_add_action_or_reset(dev, devm_pci_pwrctrl_slot_power_off, + ret =3D devm_add_action_or_reset(dev, devm_pci_pwrctrl_slot_release, slot); if (ret) return ret; =20 - clk =3D devm_clk_get_optional_enabled(dev, NULL); - if (IS_ERR(clk)) { - return dev_err_probe(dev, PTR_ERR(clk), + slot->clk =3D devm_clk_get_optional(dev, NULL); + if (IS_ERR(slot->clk)) + return dev_err_probe(dev, PTR_ERR(slot->clk), "Failed to enable slot clock\n"); - } + + pci_pwrctrl_slot_power_on(&slot->ctx); + + slot->ctx.power_on =3D pci_pwrctrl_slot_power_on; + slot->ctx.power_off =3D pci_pwrctrl_slot_power_off; =20 pci_pwrctrl_init(&slot->ctx, dev); =20 diff --git a/include/linux/pci-pwrctrl.h b/include/linux/pci-pwrctrl.h index 4aefc7901cd1..435b822c841e 100644 --- a/include/linux/pci-pwrctrl.h +++ b/include/linux/pci-pwrctrl.h @@ -31,6 +31,8 @@ struct device_link; /** * struct pci_pwrctrl - PCI device power control context. * @dev: Address of the power controlling device. + * @power_on: Callback to power on the power controlling device. + * @power_off: Callback to power off the power controlling device. * * An object of this type must be allocated by the PCI power control devic= e and * passed to the pwrctrl subsystem to trigger a bus rescan and setup a dev= ice @@ -38,6 +40,8 @@ struct device_link; */ struct pci_pwrctrl { struct device *dev; + int (*power_on)(struct pci_pwrctrl *pwrctrl); + int (*power_off)(struct pci_pwrctrl *pwrctrl); =20 /* private: internal use only */ struct notifier_block nb; --=20 2.48.1 From nobody Sun Feb 8 19:30:35 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24298315769; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; cv=none; b=KM3s6SzvElVw1/CTrkMUbrx2Lq/kK1TN/z/eu/YaUeN9gPLA7KtWeEPEJPNvg5zDXQTN3cRX4H1r/2mDxAsV6O+eUj+aDyAzorH9JiR7UI6ZmYHeHZoJRUqwrhGRnNcACBT9dXMsL9mykWriRVQvb6kcWlbcK7zNMi5x/O9+Nvw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; c=relaxed/simple; bh=LEuYfqxHlhHjzPQJTzfjptGN5Zk+il8yubCudu2ivVI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jgJ+n82eghA25gXHFg1jiwZffiNbv8uQlB2zh9nchbkq/HKt59SYSqZqfJoVS2JhXyg62ENrg2qsFmQrPb0qTfDOJcpEuqpTV4zmMZQu5evCtFH0GbQLM0pRfXaB/Y8zOYPN4R9sYpqalV56+fC2jyevrMBqroh+C2De8ULn7kw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j6Bc015X; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="j6Bc015X" Received: by smtp.kernel.org (Postfix) with ESMTPS id 79A65C2BC86; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767621365; bh=LEuYfqxHlhHjzPQJTzfjptGN5Zk+il8yubCudu2ivVI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=j6Bc015X9LYmiVz2E78LvUL9zZuY8y66FrQSb5p3ttURvdemlEcUOhd213qpv0KKl NU25kWq+BZliS3moswdYVd23CavoyDFdRqgFZs6+Avq9B4DPP7GhwtD3aO9NR9Mc0J h18qaZg0s0RSZT25UjbVC/wXtQb4sB7YElrXIhIX6YCn1EBDeJI6cIQwUsU3tTm70q 7Um+jhC2wVDKNarZJLN13gMjJdfojDW+R6iYkFYqZ7yIXged4PEVQfWZWHa8xPbKZY AV0MK1pzQixszppGTWhbtDO811pqHARSlkcNlgGuvi5uSRSGbT+vsr1t0Jy6wFFgT4 bPDKCIphzmEBA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71C48C79F95; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 05 Jan 2026 19:25:43 +0530 Subject: [PATCH v4 3/8] PCI/pwrctrl: Add APIs for explicitly creating and destroying pwrctrl devices Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260105-pci-pwrctrl-rework-v4-3-6d41a7a49789@oss.qualcomm.com> References: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> In-Reply-To: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> To: Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Bartosz Golaszewski Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Brian Norris , Krishna Chaitanya Chundru , Niklas Cassel , Alex Elder , Bartosz Golaszewski , Manivannan Sadhasivam , Chen-Yu Tsai X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=7469; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=T+QfCX6/8oF0q3TSk7QcP7GLJsHIxnAdpabMBrw1o/g=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpW8LyW6LWO8r4POQxAcHiyQBvN6cv6A3rwNTDC x9/B5Y1oCCJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaVvC8gAKCRBVnxHm/pHO 9XFJB/4iPaBucMlRBExEgOkS7UiO2jOLZ3w5Ltz4+kvuNcMUoSI0BQhO/KvE4tU3OqqzqCVI6hk Lqzwpm53mdy/LXcfgTI6cNfN6f3H+tQFXrFr6dEns/n+BJ1ozkUb3tA/SUDwgjZl6a+lCIZ1jmQ lWAhcjn5ystQ5iDkCe+AaCwFL3VH8A4j+VUn6O9wr0JJvkO4h3sPMUKV7ZLP9HJjTcX8ENJKbAY Fn+S9WJiHEPAgVfNR/T4Q3FY6153LPzI3yXjAefVMNUTpOoJ0gc8WR6ir9KADU6wvTIbqrNjGkt ZMeCDxWC0G37ng68sYEC+gU5+uLb/RBZjk3KDRLEUvwXuTWN X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Krishna Chaitanya Chundru Previously, the PCI core created pwrctrl devices during pci_scan_device() on its own and then skipped enumeration of those devices, hoping the pwrctrl driver would power them on and trigger a bus rescan. This approach works for endpoint devices directly connected to Root Ports, but it fails for PCIe switches acting as bus extenders. When the switch requires pwrctrl support, and the pwrctrl driver is not available during the pwrctrl device creation, it's enumeration will be skipped during the initial PCI bus scan. This premature scan leads the PCI core to allocate resources (bridge windows, bus numbers) for the upstream bridge based on available downstream buses at scan time. For non-hotplug capable bridges, PCI core typically allocates resources based on the number of buses available during the initial bus scan, which happens to be just one if the switch is not powered on and enumerated at that time. When the switch gets enumerated later on, it will fail due to the lack of upstream resources. As a result, a PCIe switch powered on by the pwrctrl driver cannot be reliably enumerated currently. Either the switch has to be enabled in the bootloader or the switch pwrctrl driver has to be loaded during the pwrctrl device creation time to workaround these issues. This commit introduces new APIs to explicitly create and destroy pwrctrl devices from controller drivers by recursively scanning the PCI child nodes of the controller. These APIs allow creating pwrctrl devices based on the original criteria and are intended to be called during controller probe and removal. These APIs, together with the upcoming APIs for power on/off will allow the controller drivers to power on all the devices before starting the initial bus scan, thereby solving the resource allocation issue. Signed-off-by: Krishna Chaitanya Chundru [mani: splitted the patch, cleaned up the code, and rewrote description] Tested-by: Chen-Yu Tsai Reviewed-by: Bartosz Golaszewski Signed-off-by: Manivannan Sadhasivam --- drivers/pci/of.c | 1 + drivers/pci/pwrctrl/core.c | 113 ++++++++++++++++++++++++++++++++++++++++= ++++ include/linux/pci-pwrctrl.h | 8 +++- 3 files changed, 121 insertions(+), 1 deletion(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 3579265f1198..9bb5f258759b 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -867,6 +867,7 @@ bool of_pci_supply_present(struct device_node *np) =20 return false; } +EXPORT_SYMBOL_GPL(of_pci_supply_present); =20 #endif /* CONFIG_PCI */ =20 diff --git a/drivers/pci/pwrctrl/core.c b/drivers/pci/pwrctrl/core.c index 6bdbfed584d6..4bd67b688a68 100644 --- a/drivers/pci/pwrctrl/core.c +++ b/drivers/pci/pwrctrl/core.c @@ -3,14 +3,21 @@ * Copyright (C) 2024 Linaro Ltd. */ =20 +#define dev_fmt(fmt) "Pwrctrl: " fmt + #include #include #include +#include +#include #include #include +#include #include #include =20 +#include "../pci.h" + static int pci_pwrctrl_notify(struct notifier_block *nb, unsigned long act= ion, void *data) { @@ -145,6 +152,112 @@ int devm_pci_pwrctrl_device_set_ready(struct device *= dev, } EXPORT_SYMBOL_GPL(devm_pci_pwrctrl_device_set_ready); =20 +static int pci_pwrctrl_create_device(struct device_node *np, struct device= *parent) +{ + struct platform_device *pdev; + int ret; + + for_each_available_child_of_node_scoped(np, child) { + ret =3D pci_pwrctrl_create_device(child, parent); + if (ret) + return ret; + } + + /* Bail out if the platform device is already available for the node */ + pdev =3D of_find_device_by_node(np); + if (pdev) { + platform_device_put(pdev); + return 0; + } + + /* + * Sanity check to make sure that the node has the compatible property + * to allow driver binding. + */ + if (!of_property_present(np, "compatible")) + return 0; + + /* + * Check whether the pwrctrl device really needs to be created or not. + * This is decided based on at least one of the power supplies being + * defined in the devicetree node of the device. + */ + if (!of_pci_supply_present(np)) { + dev_dbg(parent, "Skipping OF node: %s\n", np->name); + return 0; + } + + /* Now create the pwrctrl device */ + pdev =3D of_platform_device_create(np, NULL, parent); + if (!pdev) { + dev_err(parent, "Failed to create pwrctrl device for node: %s\n", np->na= me); + return -EINVAL; + } + + return 0; +} + +/** + * pci_pwrctrl_create_devices - Create pwrctrl devices + * + * @parent: Parent PCI device for which the pwrctrl devices need to be cre= ated. + * + * This function recursively creates pwrctrl devices for the child nodes + * of the specified PCI parent device in a depth first manner. On error, a= ll + * created devices will be destroyed. + * + * Returns: 0 on success, negative error number on error. + */ +int pci_pwrctrl_create_devices(struct device *parent) +{ + int ret; + + for_each_available_child_of_node_scoped(parent->of_node, child) { + ret =3D pci_pwrctrl_create_device(child, parent); + if (ret) { + pci_pwrctrl_destroy_devices(parent); + return ret; + } + } + + return 0; +} +EXPORT_SYMBOL_GPL(pci_pwrctrl_create_devices); + +static void pci_pwrctrl_destroy_device(struct device_node *np) +{ + struct platform_device *pdev; + + for_each_available_child_of_node_scoped(np, child) + pci_pwrctrl_destroy_device(child); + + pdev =3D of_find_device_by_node(np); + if (!pdev) + return; + + of_device_unregister(pdev); + platform_device_put(pdev); + + of_node_clear_flag(np, OF_POPULATED); +} + +/** + * pci_pwrctrl_destroy_devices - Destroy pwrctrl devices + * + * @parent: Parent PCI device for which the pwrctrl devices need to be des= troyed. + * + * This function recursively destroys pwrctrl devices for the child nodes + * of the specified PCI parent device in a depth first manner. + */ +void pci_pwrctrl_destroy_devices(struct device *parent) +{ + struct device_node *np =3D parent->of_node; + + for_each_available_child_of_node_scoped(np, child) + pci_pwrctrl_destroy_device(child); +} +EXPORT_SYMBOL_GPL(pci_pwrctrl_destroy_devices); + MODULE_AUTHOR("Bartosz Golaszewski "); MODULE_DESCRIPTION("PCI Device Power Control core driver"); MODULE_LICENSE("GPL"); diff --git a/include/linux/pci-pwrctrl.h b/include/linux/pci-pwrctrl.h index 435b822c841e..44f66872d090 100644 --- a/include/linux/pci-pwrctrl.h +++ b/include/linux/pci-pwrctrl.h @@ -54,5 +54,11 @@ int pci_pwrctrl_device_set_ready(struct pci_pwrctrl *pwr= ctrl); void pci_pwrctrl_device_unset_ready(struct pci_pwrctrl *pwrctrl); int devm_pci_pwrctrl_device_set_ready(struct device *dev, struct pci_pwrctrl *pwrctrl); - +#if IS_ENABLED(CONFIG_PCI_PWRCTRL) +int pci_pwrctrl_create_devices(struct device *parent); +void pci_pwrctrl_destroy_devices(struct device *parent); +#else +static inline int pci_pwrctrl_create_devices(struct device *parent) { retu= rn 0; } +static void pci_pwrctrl_destroy_devices(struct device *parent) { } +#endif #endif /* __PCI_PWRCTRL_H__ */ --=20 2.48.1 From nobody Sun Feb 8 19:30:35 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D64132B989; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; cv=none; b=DOut3pWiahiPwBuIGmaWzuBjLu7uW0guefnvg7AUDMqWZI01Y8XYBrR2yibi1bz7UARm7/khRityIrh2Bobx4kz/gn7DaokBeTfNGQfvAcvtl0FOURDhmaV640CNaJPbzdGoI727nTt6vy6bNeqnkMJNFkwkUY4RhXPsMW7a3LA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; c=relaxed/simple; bh=ni+a3dycbmztIS++4kP4aVCZNURFK03aQMtumKHy7jU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WegQmLbxb4iQWH6I/IsN3wJDyI4OtMySSd6yh1F+qjfySYg40dlDIIqvIUReFnYIdo2+11S6dZSTE/hHFV2zNTkucvWgnmfm5wuUF53aT3Hf8++6fV1XbnhMuy7eutiEiiFE2juYvnL07z29pI94+l+JNbQarZNXlO/PsC1TIHQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t/JwNtoP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="t/JwNtoP" Received: by smtp.kernel.org (Postfix) with ESMTPS id 8F455C2BC87; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767621365; bh=ni+a3dycbmztIS++4kP4aVCZNURFK03aQMtumKHy7jU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=t/JwNtoPWuYk7Qz9eN+ej4wxIi9lawe5K4es15rlmdku0RoEH+YBIer0ufpiTseiJ tD+s0sM1gY0ZAHrejXO2hBXNNrWzdgzosPaE0FiGVH/VN9IzloELQ3h2h4eKodq3YD PxnkliUIQ5BlVLfMlRv7U2kYZm6fg/fd2BaBzN860vx9NLeVBZYkSRto0CSqntZQ3n wamhZeGnsUcBERM7YJHnigzf0M+JuV9Pv1aV2e1sfSZflZF1ZGtHtrWn4yFI8XORyk G5qs3gMj4EmKQJlK5o3BkaS67eDGT9e9rwPAHOKpZtv5BilIIwG23+5XjFpJaQQBsQ YQZiFvpAx5ewQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 811C0C79F9C; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 05 Jan 2026 19:25:44 +0530 Subject: [PATCH v4 4/8] PCI/pwrctrl: Add APIs to power on/off the pwrctrl devices Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260105-pci-pwrctrl-rework-v4-4-6d41a7a49789@oss.qualcomm.com> References: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> In-Reply-To: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> To: Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Bartosz Golaszewski Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Brian Norris , Krishna Chaitanya Chundru , Niklas Cassel , Alex Elder , Bartosz Golaszewski , Manivannan Sadhasivam , Chen-Yu Tsai , Bartosz Golaszewski X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6585; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=Fb+bpv69BElyB5En6ECdvbqRV1R+Pqvx0KEJwNE+5ZE=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpW8LyiLbA0Tx7bj7A+zXnQQ4WfuZsok9yOGXoM A7SrVdn2oaJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaVvC8gAKCRBVnxHm/pHO 9QNjB/9KKW5YcELIN6C9t2IIazLjPt+jROwu9xM/sYGBZRp0RzITMx/6Y7ab/f5U0S6+4y35fvZ 12WIHEz4m5O/DeX0IPmfgP0LN1U2CAfW68aoIrK/jdRNxh26vcmqwPBvY1/MWuLWKCYIgDaV6Xo yOWqF95zTI3kuFosEVpVKro4/o0GgaUa6uYeA/OWP1OQ8w/0+E5f+L4rYJSfpTUwy7Frv4mnuiE z80ebvHjZvR4EKJ7hZ21SDXr/dn7n2PCbpwEM6l7UJ7M4iOW/bhxCR+46Sjgznj7eAxMQqtq6qF gWl6ShrKRFHF7eUDMZ5iP3VUlZ4g3uU0iJG16BQ7aUlQyzzV X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam To fix PCIe bridge resource allocation issues when powering PCIe switches with the pwrctrl driver, introduce APIs to explicitly power on and off all related devices simultaneously. Previously, the individual pwrctrl drivers powered on/off the PCIe devices autonomously, without any control from the controller drivers. But to enforce ordering w.r.t powering on the devices, these APIs will power on/off all the devices at the same time. The pci_pwrctrl_power_on_devices() API recursively scans the PCI child nodes, makes sure that pwrctrl drivers are bind to devices, and calls their power_on() callbacks. If any of the pwrctrl driver is not bound, it will return -EPROBE_DEFER. Similarly, pci_pwrctrl_power_off_devices() API powers off devices recursively via their power_off() callbacks. These APIs are expected to be called during the controller probe and suspend/resume time to power on/off the devices. But before calling these APIs, the pwrctrl devices should've been created beforehand using the pci_pwrctrl_{create/destroy}_devices() APIs. Co-developed-by: Krishna Chaitanya Chundru Signed-off-by: Krishna Chaitanya Chundru Tested-by: Chen-Yu Tsai Reviewed-by: Bartosz Golaszewski Signed-off-by: Manivannan Sadhasivam --- drivers/pci/pwrctrl/core.c | 132 ++++++++++++++++++++++++++++++++++++++++= ++++ include/linux/pci-pwrctrl.h | 4 ++ 2 files changed, 136 insertions(+) diff --git a/drivers/pci/pwrctrl/core.c b/drivers/pci/pwrctrl/core.c index 4bd67b688a68..cb7947e347d3 100644 --- a/drivers/pci/pwrctrl/core.c +++ b/drivers/pci/pwrctrl/core.c @@ -65,6 +65,7 @@ void pci_pwrctrl_init(struct pci_pwrctrl *pwrctrl, struct= device *dev) { pwrctrl->dev =3D dev; INIT_WORK(&pwrctrl->work, rescan_work_func); + dev_set_drvdata(dev, pwrctrl); } EXPORT_SYMBOL_GPL(pci_pwrctrl_init); =20 @@ -152,6 +153,137 @@ int devm_pci_pwrctrl_device_set_ready(struct device *= dev, } EXPORT_SYMBOL_GPL(devm_pci_pwrctrl_device_set_ready); =20 +static int __pci_pwrctrl_power_off_device(struct device *dev) +{ + struct pci_pwrctrl *pwrctrl =3D dev_get_drvdata(dev); + + if (!pwrctrl) + return 0; + + return pwrctrl->power_off(pwrctrl); +} + +static void pci_pwrctrl_power_off_device(struct device_node *np) +{ + struct platform_device *pdev; + int ret; + + for_each_available_child_of_node_scoped(np, child) + pci_pwrctrl_power_off_device(child); + + pdev =3D of_find_device_by_node(np); + if (pdev) { + if (device_is_bound(&pdev->dev)) { + ret =3D __pci_pwrctrl_power_off_device(&pdev->dev); + if (ret) + dev_err(&pdev->dev, "Failed to power off device: %d", ret); + } + + platform_device_put(pdev); + } +} + +/** + * pci_pwrctrl_power_off_devices - Power off the pwrctrl devices + * + * @parent: Parent PCI device for which the pwrctrl devices need to be pow= ered + * off. + * + * This function recursively traverses all pwrctrl devices for the child n= odes + * of the specified PCI parent device, and powers them off in a depth first + * manner. + */ +void pci_pwrctrl_power_off_devices(struct device *parent) +{ + struct device_node *np =3D parent->of_node; + + for_each_available_child_of_node_scoped(np, child) + pci_pwrctrl_power_off_device(child); +} +EXPORT_SYMBOL_GPL(pci_pwrctrl_power_off_devices); + +static int __pci_pwrctrl_power_on_device(struct device *dev) +{ + struct pci_pwrctrl *pwrctrl =3D dev_get_drvdata(dev); + + if (!pwrctrl) + return 0; + + return pwrctrl->power_on(pwrctrl); +} + +/* + * Power on the devices in a depth first manner. Before powering on the de= vice, + * make sure its driver is bound. + */ +static int pci_pwrctrl_power_on_device(struct device_node *np) +{ + struct platform_device *pdev; + int ret; + + for_each_available_child_of_node_scoped(np, child) { + ret =3D pci_pwrctrl_power_on_device(child); + if (ret) + return ret; + } + + pdev =3D of_find_device_by_node(np); + if (pdev) { + if (!device_is_bound(&pdev->dev)) { + /* FIXME: Use blocking wait instead of probe deferral */ + dev_dbg(&pdev->dev, "driver is not bound\n"); + ret =3D -EPROBE_DEFER; + } else { + ret =3D __pci_pwrctrl_power_on_device(&pdev->dev); + } + platform_device_put(pdev); + + if (ret) + return ret; + } + + return 0; +} + +/** + * pci_pwrctrl_power_on_devices - Power on the pwrctrl devices + * + * @parent: Parent PCI device for which the pwrctrl devices need to be pow= ered + * on. + * + * This function recursively traverses all pwrctrl devices for the child n= odes + * of the specified PCI parent device, and powers them on in a depth first + * manner. On error, all powered on devices will be powered off. + * + * Returns: 0 on success, -EPROBE_DEFER if any pwrctrl driver is not bound= , an + * appropriate error code otherwise. + */ +int pci_pwrctrl_power_on_devices(struct device *parent) +{ + struct device_node *np =3D parent->of_node; + struct device_node *child =3D NULL; + int ret; + + for_each_available_child_of_node(np, child) { + ret =3D pci_pwrctrl_power_on_device(child); + if (ret) + goto err_power_off; + } + + return 0; + +err_power_off: + for_each_available_child_of_node_scoped(np, tmp) { + if (tmp =3D=3D child) + break; + pci_pwrctrl_power_off_device(tmp); + } + of_node_put(child); + + return ret; +} +EXPORT_SYMBOL_GPL(pci_pwrctrl_power_on_devices); + static int pci_pwrctrl_create_device(struct device_node *np, struct device= *parent) { struct platform_device *pdev; diff --git a/include/linux/pci-pwrctrl.h b/include/linux/pci-pwrctrl.h index 44f66872d090..1192a2527521 100644 --- a/include/linux/pci-pwrctrl.h +++ b/include/linux/pci-pwrctrl.h @@ -57,8 +57,12 @@ int devm_pci_pwrctrl_device_set_ready(struct device *dev, #if IS_ENABLED(CONFIG_PCI_PWRCTRL) int pci_pwrctrl_create_devices(struct device *parent); void pci_pwrctrl_destroy_devices(struct device *parent); +int pci_pwrctrl_power_on_devices(struct device *parent); +void pci_pwrctrl_power_off_devices(struct device *parent); #else static inline int pci_pwrctrl_create_devices(struct device *parent) { retu= rn 0; } static void pci_pwrctrl_destroy_devices(struct device *parent) { } +static inline int pci_pwrctrl_power_on_devices(struct device *parent) { re= turn 0; } +static void pci_pwrctrl_power_off_devices(struct device *parent) { } #endif #endif /* __PCI_PWRCTRL_H__ */ --=20 2.48.1 From nobody Sun Feb 8 19:30:35 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D55C32AACD; Mon, 5 Jan 2026 13:56:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; cv=none; b=MgquNtEACbfcXk9eJGu1n3nqCUmTKPjjyhWqt4DAGkYa/COPhROh0CeXbvJgny/UPkaCyGfdf45kKI+3pVqpRq3glonvIu7LkKBufEeUWdFLV+qRTS6PwuKQ3uX4KoFt9+XI9yC6j7BeHSR7ebIgyie3gLn6kvsJGxqW75tWiwk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; c=relaxed/simple; bh=78AwoVgGJLpZCepw3lYMpBT1DvYIDg6344iilWRS5Gw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GmWQ8SdsEEDYK7izXMVyVAJa0l4N4pV0NUDut6uABnIdQ+D8WCTzuGbrQYo4DSunruAxn2+Mz/L/YXFsHpVZHWF6Sw6fBzTC13tqJ5UalGSXzHGyi6dwUTOOd4A2a018QOnmVxE0+YbbcD1Xn88Gz9ZloEikzt4QKkNqpwVByjk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dqhTJLd+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dqhTJLd+" Received: by smtp.kernel.org (Postfix) with ESMTPS id 99C76C2BCB4; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767621365; bh=78AwoVgGJLpZCepw3lYMpBT1DvYIDg6344iilWRS5Gw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=dqhTJLd+6mIVLFghjoHO9DfWZ0emLog5pB4BSVY2bP4svjaSDvwWp5I+dGFjMxwFz Gn1eV9IFfj9pLtDoOrUqYQ3TuftzlSS1RskNgqed8yePMXCFY8jTnuBwUy8hyYOgSE axJslhJ92vjbiUmTb58HOEkvH2TcxQbtqwbIMxUw8PEAvBMNmChB5tOkeirFtiV5aV KAZlci22uDCfWB9p2IPSQcjw2MxnV3RSF8Z1S/iPx+xA2UauAVULkm2YfQtdAA8hcq 44dAjGZwDsTGoOPJUZcsM+rjT8g6cH540iTaARifdcE+Zk7p3sdnr/8C/B1PXnBgR8 U17HzOgUZBDCw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91E5CC79F90; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 05 Jan 2026 19:25:45 +0530 Subject: [PATCH v4 5/8] PCI/pwrctrl: Switch to the new pwrctrl APIs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260105-pci-pwrctrl-rework-v4-5-6d41a7a49789@oss.qualcomm.com> References: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> In-Reply-To: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> To: Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Bartosz Golaszewski Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Brian Norris , Krishna Chaitanya Chundru , Niklas Cassel , Alex Elder , Bartosz Golaszewski , Manivannan Sadhasivam , Chen-Yu Tsai X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=12782; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=JSl8b0Y6K6Fa53yBIlFpgxg3UwsEOtJI3rV1U2lzGb8=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpW8LyGZZXythC+MkcQkSIcTHsAo+VGb5yISbqu 2OYeaZUK9aJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaVvC8gAKCRBVnxHm/pHO 9RDtCACrBHLUrbGAykmOKvqaVZcrf+5iX6T+6RQrb0/c940MLuTyP3d1RPZ5LqVoIKvm4NT/zdI QKlgEqHWKVjscIrr0zevNhO4McDytwwE4DL4T463+D2kL2VVhYKlTdLVBbBq9hH5lkNv+7+4w7j Q6lvlkbnY/RD6wQuAemLnhOwfi+w6qUkmjVSUq+CgLHmlCQ1KTNMHuM8DdS/Qb+GQ5S6/PjAE0G 9WW136uWMhnG6fBiOhSD3cQjty862pDZgOAJB/vT11BIl5LVDbiW6+v35NNLs9qK0bd3Y5ri/Xk gpzE+cZL0MDsMKPs9FOoeYxmPUfE232/y/LHkDxcVk8kI2uE X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Adopt the recently introduced pwrctrl APIs to create, power on, destroy, and power off pwrctrl devices. In qcom_pcie_host_init(), call pci_pwrctrl_create_devices() to create devices, then pci_pwrctrl_power_on_devices() to power them on, both after controller resource initialization. Once successful, deassert PERST# for all devices. In qcom_pcie_host_deinit(), call pci_pwrctrl_power_off_devices() after asserting PERST#. Note that pci_pwrctrl_destroy_devices() is not called here, as deinit is only invoked during system suspend where device destruction is unnecessary. If the driver becomes removable in future, pci_pwrctrl_destroy_devices() should be called in the remove() handler. At last, remove the old pwrctrl framework code from the PCI core (including devlinks) as the new APIs are now the sole consumer of pwrctrl functionality. And also do not power on the pwrctrl drivers during probe() as this is now handled by the APIs. Co-developed-by: Krishna Chaitanya Chundru Signed-off-by: Krishna Chaitanya Chundru Tested-by: Chen-Yu Tsai Reviewed-by: Bartosz Golaszewski Signed-off-by: Manivannan Sadhasivam --- drivers/pci/bus.c | 19 ---------- drivers/pci/controller/dwc/pcie-qcom.c | 23 +++++++++++-- drivers/pci/probe.c | 59 ----------------------------= ---- drivers/pci/pwrctrl/core.c | 15 -------- drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c | 5 --- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 24 ++----------- drivers/pci/pwrctrl/slot.c | 2 -- drivers/pci/remove.c | 20 ----------- 8 files changed, 24 insertions(+), 143 deletions(-) diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 4383a36fd6ca..d60d5f108212 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -344,7 +344,6 @@ void __weak pcibios_bus_add_device(struct pci_dev *pdev= ) { } void pci_bus_add_device(struct pci_dev *dev) { struct device_node *dn =3D dev->dev.of_node; - struct platform_device *pdev; =20 /* * Can not put in pci_device_add yet because resources @@ -361,24 +360,6 @@ void pci_bus_add_device(struct pci_dev *dev) /* Save config space for error recoverability */ pci_save_state(dev); =20 - /* - * If the PCI device is associated with a pwrctrl device with a - * power supply, create a device link between the PCI device and - * pwrctrl device. This ensures that pwrctrl drivers are probed - * before PCI client drivers. - */ - pdev =3D of_find_device_by_node(dn); - if (pdev) { - if (of_pci_supply_present(dn)) { - if (!device_link_add(&dev->dev, &pdev->dev, - DL_FLAG_AUTOREMOVE_CONSUMER)) { - pci_err(dev, "failed to add device link to power control device %s\n", - pdev->name); - } - } - put_device(&pdev->dev); - } - if (!dn || of_device_is_available(dn)) pci_dev_allow_binding(dev); =20 diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index 1ca58d0264e3..198befb5be2c 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -1317,10 +1318,18 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *p= p) if (ret) goto err_deinit; =20 + ret =3D pci_pwrctrl_create_devices(pci->dev); + if (ret) + goto err_disable_phy; + + ret =3D pci_pwrctrl_power_on_devices(pci->dev); + if (ret) + goto err_pwrctrl_destroy; + if (pcie->cfg->ops->post_init) { ret =3D pcie->cfg->ops->post_init(pcie); if (ret) - goto err_disable_phy; + goto err_pwrctrl_power_off; } =20 qcom_pcie_clear_aspm_l0s(pcie->pci); @@ -1337,6 +1346,11 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp) =20 err_assert_reset: qcom_ep_reset_assert(pcie); +err_pwrctrl_power_off: + pci_pwrctrl_power_off_devices(pci->dev); +err_pwrctrl_destroy: + if (ret !=3D -EPROBE_DEFER) + pci_pwrctrl_destroy_devices(pci->dev); err_disable_phy: qcom_pcie_phy_power_off(pcie); err_deinit: @@ -1351,6 +1365,11 @@ static void qcom_pcie_host_deinit(struct dw_pcie_rp = *pp) struct qcom_pcie *pcie =3D to_qcom_pcie(pci); =20 qcom_ep_reset_assert(pcie); + /* + * No need to destroy pwrctrl devices as this function only gets called + * during system suspend as of now. + */ + pci_pwrctrl_power_off_devices(pci->dev); qcom_pcie_phy_power_off(pcie); pcie->cfg->ops->deinit(pcie); } @@ -2029,7 +2048,7 @@ static int qcom_pcie_probe(struct platform_device *pd= ev) =20 ret =3D dw_pcie_host_init(pp); if (ret) { - dev_err(dev, "cannot initialize host\n"); + dev_err_probe(dev, ret, "cannot initialize host\n"); goto err_phy_exit; } =20 diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 41183aed8f5d..6e7252404b58 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2563,56 +2563,6 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus,= int devfn, u32 *l, } EXPORT_SYMBOL(pci_bus_read_dev_vendor_id); =20 -#if IS_ENABLED(CONFIG_PCI_PWRCTRL) -static struct platform_device *pci_pwrctrl_create_device(struct pci_bus *b= us, int devfn) -{ - struct pci_host_bridge *host =3D pci_find_host_bridge(bus); - struct platform_device *pdev; - struct device_node *np; - - np =3D of_pci_find_child_device(dev_of_node(&bus->dev), devfn); - if (!np) - return NULL; - - pdev =3D of_find_device_by_node(np); - if (pdev) { - put_device(&pdev->dev); - goto err_put_of_node; - } - - /* - * First check whether the pwrctrl device really needs to be created or - * not. This is decided based on at least one of the power supplies - * being defined in the devicetree node of the device. - */ - if (!of_pci_supply_present(np)) { - pr_debug("PCI/pwrctrl: Skipping OF node: %s\n", np->name); - goto err_put_of_node; - } - - /* Now create the pwrctrl device */ - pdev =3D of_platform_device_create(np, NULL, &host->dev); - if (!pdev) { - pr_err("PCI/pwrctrl: Failed to create pwrctrl device for node: %s\n", np= ->name); - goto err_put_of_node; - } - - of_node_put(np); - - return pdev; - -err_put_of_node: - of_node_put(np); - - return NULL; -} -#else -static struct platform_device *pci_pwrctrl_create_device(struct pci_bus *b= us, int devfn) -{ - return NULL; -} -#endif - /* * Read the config data for a PCI device, sanity-check it, * and fill in the dev structure. @@ -2622,15 +2572,6 @@ static struct pci_dev *pci_scan_device(struct pci_bu= s *bus, int devfn) struct pci_dev *dev; u32 l; =20 - /* - * Create pwrctrl device (if required) for the PCI device to handle the - * power state. If the pwrctrl device is created, then skip scanning - * further as the pwrctrl core will rescan the bus after powering on - * the device. - */ - if (pci_pwrctrl_create_device(bus, devfn)) - return NULL; - if (!pci_bus_read_dev_vendor_id(bus, devfn, &l, 60*1000)) return NULL; =20 diff --git a/drivers/pci/pwrctrl/core.c b/drivers/pci/pwrctrl/core.c index cb7947e347d3..5973a83fe0d0 100644 --- a/drivers/pci/pwrctrl/core.c +++ b/drivers/pci/pwrctrl/core.c @@ -45,16 +45,6 @@ static int pci_pwrctrl_notify(struct notifier_block *nb,= unsigned long action, return NOTIFY_DONE; } =20 -static void rescan_work_func(struct work_struct *work) -{ - struct pci_pwrctrl *pwrctrl =3D container_of(work, - struct pci_pwrctrl, work); - - pci_lock_rescan_remove(); - pci_rescan_bus(to_pci_host_bridge(pwrctrl->dev->parent)->bus); - pci_unlock_rescan_remove(); -} - /** * pci_pwrctrl_init() - Initialize the PCI power control context struct * @@ -64,7 +54,6 @@ static void rescan_work_func(struct work_struct *work) void pci_pwrctrl_init(struct pci_pwrctrl *pwrctrl, struct device *dev) { pwrctrl->dev =3D dev; - INIT_WORK(&pwrctrl->work, rescan_work_func); dev_set_drvdata(dev, pwrctrl); } EXPORT_SYMBOL_GPL(pci_pwrctrl_init); @@ -95,8 +84,6 @@ int pci_pwrctrl_device_set_ready(struct pci_pwrctrl *pwrc= trl) if (ret) return ret; =20 - schedule_work(&pwrctrl->work); - return 0; } EXPORT_SYMBOL_GPL(pci_pwrctrl_device_set_ready); @@ -109,8 +96,6 @@ EXPORT_SYMBOL_GPL(pci_pwrctrl_device_set_ready); */ void pci_pwrctrl_device_unset_ready(struct pci_pwrctrl *pwrctrl) { - cancel_work_sync(&pwrctrl->work); - /* * We don't have to delete the link here. Typically, this function * is only called when the power control device is being detached. If diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c b/drivers/pci/pwrctrl= /pci-pwrctrl-pwrseq.c index 7e7093cbff3c..42b87d480fe8 100644 --- a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c +++ b/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c @@ -101,11 +101,6 @@ static int pci_pwrctrl_pwrseq_probe(struct platform_de= vice *pdev) return dev_err_probe(dev, PTR_ERR(data->pwrseq), "Failed to get the power sequencer\n"); =20 - ret =3D pci_pwrctrl_pwrseq_power_on(&data->ctx); - if (ret) - return dev_err_probe(dev, ret, - "Failed to power-on the device\n"); - ret =3D devm_add_action_or_reset(dev, devm_pci_pwrctrl_pwrseq_power_off, data); if (ret) diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c b/drivers/pci/pwrctrl= /pci-pwrctrl-tc9563.c index 616d3caedb34..66132d437ddb 100644 --- a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +++ b/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c @@ -515,8 +515,6 @@ static int tc9563_pwrctrl_power_on(struct pci_pwrctrl *= pwrctrl) =20 static int tc9563_pwrctrl_probe(struct platform_device *pdev) { - struct pci_host_bridge *bridge =3D to_pci_host_bridge(pdev->dev.parent); - struct pci_bus *bus =3D bridge->bus; struct device *dev =3D &pdev->dev; enum tc9563_pwrctrl_ports port; struct tc9563_pwrctrl_ctx *ctx; @@ -592,22 +590,6 @@ static int tc9563_pwrctrl_probe(struct platform_device= *pdev) goto remove_i2c; } =20 - if (bridge->ops->assert_perst) { - ret =3D bridge->ops->assert_perst(bus, true); - if (ret) - goto remove_i2c; - } - - ret =3D tc9563_pwrctrl_power_on(&ctx->pwrctrl); - if (ret) - goto remove_i2c; - - if (bridge->ops->assert_perst) { - ret =3D bridge->ops->assert_perst(bus, false); - if (ret) - goto power_off; - } - ctx->pwrctrl.power_on =3D tc9563_pwrctrl_power_on; ctx->pwrctrl.power_off =3D tc9563_pwrctrl_power_off; =20 @@ -615,8 +597,6 @@ static int tc9563_pwrctrl_probe(struct platform_device = *pdev) if (ret) goto power_off; =20 - platform_set_drvdata(pdev, ctx); - return 0; =20 power_off: @@ -629,7 +609,9 @@ static int tc9563_pwrctrl_probe(struct platform_device = *pdev) =20 static void tc9563_pwrctrl_remove(struct platform_device *pdev) { - struct tc9563_pwrctrl_ctx *ctx =3D platform_get_drvdata(pdev); + struct pci_pwrctrl *pwrctrl =3D dev_get_drvdata(&pdev->dev); + struct tc9563_pwrctrl_ctx *ctx =3D container_of(pwrctrl, + struct tc9563_pwrctrl_ctx, pwrctrl); =20 tc9563_pwrctrl_power_off(&ctx->pwrctrl); i2c_unregister_device(ctx->client); diff --git a/drivers/pci/pwrctrl/slot.c b/drivers/pci/pwrctrl/slot.c index 9f91f04b4ae0..dcd6ab79ca82 100644 --- a/drivers/pci/pwrctrl/slot.c +++ b/drivers/pci/pwrctrl/slot.c @@ -81,8 +81,6 @@ static int pci_pwrctrl_slot_probe(struct platform_device = *pdev) return dev_err_probe(dev, PTR_ERR(slot->clk), "Failed to enable slot clock\n"); =20 - pci_pwrctrl_slot_power_on(&slot->ctx); - slot->ctx.power_on =3D pci_pwrctrl_slot_power_on; slot->ctx.power_off =3D pci_pwrctrl_slot_power_off; =20 diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index 417a9ea59117..e9d519993853 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c @@ -17,25 +17,6 @@ static void pci_free_resources(struct pci_dev *dev) } } =20 -static void pci_pwrctrl_unregister(struct device *dev) -{ - struct device_node *np; - struct platform_device *pdev; - - np =3D dev_of_node(dev); - if (!np) - return; - - pdev =3D of_find_device_by_node(np); - if (!pdev) - return; - - of_device_unregister(pdev); - put_device(&pdev->dev); - - of_node_clear_flag(np, OF_POPULATED); -} - static void pci_stop_dev(struct pci_dev *dev) { pci_pme_active(dev, false); @@ -73,7 +54,6 @@ static void pci_destroy_dev(struct pci_dev *dev) pci_ide_destroy(dev); pcie_aspm_exit_link_state(dev); pci_bridge_d3_update(dev); - pci_pwrctrl_unregister(&dev->dev); pci_free_resources(dev); put_device(&dev->dev); } --=20 2.48.1 From nobody Sun Feb 8 19:30:35 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D86932C923; Mon, 5 Jan 2026 13:56:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; cv=none; b=sNr9x8FzeKcu/oVTNr5Z8VhBszG5pDRQGimvvPHD+u9BV28++UmM8IwEq+SZgLgGL7BB1Cc3kbZQaQ15tey1qlRRci7opA3iPn02C9H52hlKXdPh5R7TOmUNbWU94HkV3tEEOFPexof/XnAclIMHYuuDXHdSr3oYWOx8ukR/EUQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; c=relaxed/simple; bh=XzPe1lJeOXAkK+NB5NKGaViQa+wcWZzRZvh9J8kvDjo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qna61Y6id5G17Osc9QFyykEt0fr+Fv2Ps/joXPjixjOKeGfazrrOYudWnTTL5/Ig1HBg5zkLnOvhPwkwhyJiZi7IpGpsd9uvqbMZRZJKJuHYTwpEwzh9e4mTRNhe68ErQim2PIQKO9wraFxmG1Nhclquffk5mGC7Ha26lYSaXPU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hn6OpAdS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hn6OpAdS" Received: by smtp.kernel.org (Postfix) with ESMTPS id A6FA2C2BCB9; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767621365; bh=XzPe1lJeOXAkK+NB5NKGaViQa+wcWZzRZvh9J8kvDjo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=hn6OpAdSfesXIlp4EM1pc2fHe0GOeeFkFYqL6L/ALhGc9jq7od6h9VjnXI+4iJLT5 fIrnkDKkCxJOmJ5uIsl++OqnYd+XEl8qTzv/cYTWECRJmv7V2i8a/jRTX4N2hvEMtr w770Yg7y3ss2RQtqewAIXUDlCb4/HG5GjUGp8yT+q3JMmbUXLqBorGFj9sL0FfSxVa 1Cyq6hxk8AR/LPWDQ/p8zGptqVYCD+1exmlV4xIgSSmmZKhNeKphmHpxzrjRTY2pNY ikpo8s6KHv81v3mRLAANNovZvYES6lmXCiRnjQHd9sdi360VsjmOa6LunMNeHUsDVG JLDfmPc4nNXQQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FDB1C79F9B; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 05 Jan 2026 19:25:46 +0530 Subject: [PATCH v4 6/8] PCI: qcom: Drop the assert_perst() callbacks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260105-pci-pwrctrl-rework-v4-6-6d41a7a49789@oss.qualcomm.com> References: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> In-Reply-To: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> To: Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Bartosz Golaszewski Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Brian Norris , Krishna Chaitanya Chundru , Niklas Cassel , Alex Elder , Bartosz Golaszewski , Manivannan Sadhasivam X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3855; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=baYMtKTp90ApL15LaiFMPwlqAO9hm8z1KzVLol2ZneE=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpW8LyAxa1Y1E832qLma03nRs9XbUdX7ui6rLBx JBNS8HCbJSJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaVvC8gAKCRBVnxHm/pHO 9VhmB/9ricWpjy73JlNoWp6RCWQP0ryQrPLxZ/ZxxLhqA8C50EtFCZbNa69jAxZRxFtDgDJH7tw aQfxYMeJDZ/MTO5Pxcmpkt+OQ6Nw/RngKbyw9LOzLVOQ4uX2LY+VafDSVwPnc6wfVBHEKUgxX7O 63NVOCUcamxHModZUsWtHk0qyg5Lr7/pC6scG+17gPeRM1zvQnzVbSm+3wsRRALvEYYKb7fUeh/ HYHsH570W7nixnakU3sZCKRgTmuO7QJK+mCBUKc2eZ5Mp2NhIngRcmQP60TGuM4v/Hi8nayjGq4 G7BR7+YewsCLWYZVIkXaCLBUjUcop0qwoiVyZTBdXFnbhDK0 X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Previously, the pcie-qcom driver probed first, deasserted PERST#, enabled link training and scanned the bus. By the time the pwrctrl driver probe got called, link training was already enabled by the controller driver. Thus the pwrctrl drivers had to call the .assert_perst() callback, to assert PERST#, power on the needed resources, and then call the .assert_perst() callback to deassert PERST#. Now since all pwrctrl drivers and this controller driver have been converted to the new pwrctrl design where the pwrctrl drivers will first power on the devices before this driver deasserts PERST# and scan the bus. So there is no longer a need for .assert_perst() callback in this driver and in DWC core driver. Hence, drop them. Signed-off-by: Manivannan Sadhasivam --- drivers/pci/controller/dwc/pcie-designware-host.c | 9 --------- drivers/pci/controller/dwc/pcie-designware.h | 9 --------- drivers/pci/controller/dwc/pcie-qcom.c | 13 ------------- 3 files changed, 31 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pc= i/controller/dwc/pcie-designware-host.c index 372207c33a85..4862a3a059c7 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -857,19 +857,10 @@ static void __iomem *dw_pcie_ecam_conf_map_bus(struct= pci_bus *bus, unsigned int return pci->dbi_base + where; } =20 -static int dw_pcie_op_assert_perst(struct pci_bus *bus, bool assert) -{ - struct dw_pcie_rp *pp =3D bus->sysdata; - struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); - - return dw_pcie_assert_perst(pci, assert); -} - static struct pci_ops dw_pcie_ops =3D { .map_bus =3D dw_pcie_own_conf_map_bus, .read =3D pci_generic_config_read, .write =3D pci_generic_config_write, - .assert_perst =3D dw_pcie_op_assert_perst, }; =20 static struct pci_ops dw_pcie_ecam_ops =3D { diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/con= troller/dwc/pcie-designware.h index 31685951a080..da32bb5f936c 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -493,7 +493,6 @@ struct dw_pcie_ops { enum dw_pcie_ltssm (*get_ltssm)(struct dw_pcie *pcie); int (*start_link)(struct dw_pcie *pcie); void (*stop_link)(struct dw_pcie *pcie); - int (*assert_perst)(struct dw_pcie *pcie, bool assert); }; =20 struct debugfs_info { @@ -798,14 +797,6 @@ static inline void dw_pcie_stop_link(struct dw_pcie *p= ci) pci->ops->stop_link(pci); } =20 -static inline int dw_pcie_assert_perst(struct dw_pcie *pci, bool assert) -{ - if (pci->ops && pci->ops->assert_perst) - return pci->ops->assert_perst(pci, assert); - - return 0; -} - static inline enum dw_pcie_ltssm dw_pcie_get_ltssm(struct dw_pcie *pci) { u32 val; diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index 198befb5be2c..6de3ff555b9d 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -650,18 +650,6 @@ static int qcom_pcie_post_init_1_0_0(struct qcom_pcie = *pcie) return 0; } =20 -static int qcom_pcie_assert_perst(struct dw_pcie *pci, bool assert) -{ - struct qcom_pcie *pcie =3D to_qcom_pcie(pci); - - if (assert) - qcom_ep_reset_assert(pcie); - else - qcom_ep_reset_deassert(pcie); - - return 0; -} - static void qcom_pcie_2_3_2_ltssm_enable(struct qcom_pcie *pcie) { u32 val; @@ -1523,7 +1511,6 @@ static const struct qcom_pcie_cfg cfg_fw_managed =3D { static const struct dw_pcie_ops dw_pcie_ops =3D { .link_up =3D qcom_pcie_link_up, .start_link =3D qcom_pcie_start_link, - .assert_perst =3D qcom_pcie_assert_perst, }; =20 static int qcom_pcie_icc_init(struct qcom_pcie *pcie) --=20 2.48.1 From nobody Sun Feb 8 19:30:35 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EB3632C926; Mon, 5 Jan 2026 13:56:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; cv=none; b=HsYhN8EhWg+G00zl9mv0mO1TfkstuIE07+yC6H7Yu20vZ+4So4iAuqR56Uuf/9oC1670m9XDQHDuhMhLa1cDQbbFxp9jqOreR/aqLPAmvKCFEd7sirbgiWB26/XpHtgn4h+g1qi0W2TpQx4IuWNcu+/1JzUqDg+GENR/wJgkBOs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; c=relaxed/simple; bh=lHNnF+M58t9NzRqWY9vnDhJTtOdSji0qAoWQ/MNoaYo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=X9lgRa2dA5Nk4BO4hiyuoCoV4bL9u0oXg4zEB0wnPeT3CTXB6a4mznXkAjP7hRzIdd0Eui2JKANwm38NixR6iCHIjcCcJVLn50XSP1ksM59qTjUFnARRVgdwtKl1CdnS7pw9PS5eQB12KN46OdkwfPk1jG/XohEamWIt4ODElmY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qMQIXrSI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qMQIXrSI" Received: by smtp.kernel.org (Postfix) with ESMTPS id B91C0C2BCC9; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767621365; bh=lHNnF+M58t9NzRqWY9vnDhJTtOdSji0qAoWQ/MNoaYo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=qMQIXrSIaKkwfO3kl94qVYE8Vb9j3655vg/DGN3QadFLRTniHvRIrSRxhZjmPjpfO a8uFvnKUi1bsi2VkNEFLRkDBGDHmuqCUmdKgeFQYK0rskw02IHlF7wKDXdhsiBgWZ+ CNbsAFCJ/yCYvnjJwaXUFoQlSHTtkiahGq+BQz/PVE/JAeMDLaejqECnhSrcaWn6ab iBS2HOWfsofPDg46alciFyRGKbA4O3OXmVvM0I3xZf60I2+aiBL30+JVsxL36Tl9MJ E6qDcNvAss+KvJ1n21FwinfZQCxdHdL4QqlKgx5r14ztu/wccf2/o+La29n7wCY+IB kD/Q8JJDMnSxg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE3ABC79F95; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 05 Jan 2026 19:25:47 +0530 Subject: [PATCH v4 7/8] PCI: Drop the assert_perst() callback Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260105-pci-pwrctrl-rework-v4-7-6d41a7a49789@oss.qualcomm.com> References: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> In-Reply-To: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> To: Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Bartosz Golaszewski Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Brian Norris , Krishna Chaitanya Chundru , Niklas Cassel , Alex Elder , Bartosz Golaszewski , Manivannan Sadhasivam X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=825; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=mldIwFB+pfS0iHVRsCTaT7tjmBqPl6lu5qJtujWhd3Q=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpW8LyVBYfz3xhbl7+el0cIb91U5kt94P74OLiw o1Yhqe8zF6JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaVvC8gAKCRBVnxHm/pHO 9epHB/0W4m7lYWGPNArq3VBa1EUKqIQ0qyhqXo2i+3axGgso/fDwuAtXcwiy7qPUJXVhrbrx1OG FeZu7WPbVDvZCBcnW1aASyZCX0F7vG25AihVgarQSXeJPXJTNmXwhu35ITKMVLQxGS6540DFwO4 muAf/va91gx7t3s0jESMW6U/nqnu2JqpNNyC1SFS07Q+1NtTgHoflODnZY6XI435G6lUQUw/BI0 wWMJvKAykAEll5V/cmKbgbaO/IpaK7wNUmftRGhjtkcjqqO2TsWl+L2FF9SCMw9UnfvlMIiGvAl AD0cHLWjQz05llQyOu+yGJVFH0ZbxhjBwiJs+ARa6fME8pWN X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Now since all .assert_callback() implementations have been removed from the controller drivers, drop the .assert_callback callback from pci.h. Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bartosz Golaszewski --- include/linux/pci.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/linux/pci.h b/include/linux/pci.h index 864775651c6f..3eb8fd975ad9 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -854,7 +854,6 @@ struct pci_ops { void __iomem *(*map_bus)(struct pci_bus *bus, unsigned int devfn, int whe= re); int (*read)(struct pci_bus *bus, unsigned int devfn, int where, int size,= u32 *val); int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size= , u32 val); - int (*assert_perst)(struct pci_bus *bus, bool assert); }; =20 /* --=20 2.48.1 From nobody Sun Feb 8 19:30:35 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D6FF32BF2E; Mon, 5 Jan 2026 13:56:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; cv=none; b=MistjRLZxNRj7sjXb9YuFovOtPqvkr5e7Vs6GpHpL6cIfmDfMuCqlv3Hr6dRBiNHB2x9/91iVfgcWsyZ7E4o1JKC7XhmHVdyc5dUhcVSIGYqIzhO55KLy/mlopFBlQi1BBJb2Nj+apDHJ/6IoOlUXB+UdPCW4j+uoTTF/9jfx+s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767621366; c=relaxed/simple; bh=I0f87bjCTZY8llByf6tVU8Cf67d/L6DylkhuokhPqjY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CmRyTCYRbQ/yepu2gBTFpcwtC1NRgMPO45dj4I/3ohlFAlzCaVMS1FkY+aiZz2fMJcCy2YQpsKFNyeIpslOMYpLedP06m/Ub9o9TLoDOkZxUIV5lyVEYuseJklVnoEvL04GEPzp3Z6kpdlMQBzTbXCR/7PunbxA99o3IZ5V5eLY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KoFxAcbI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KoFxAcbI" Received: by smtp.kernel.org (Postfix) with ESMTPS id C525FC2BCB1; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767621365; bh=I0f87bjCTZY8llByf6tVU8Cf67d/L6DylkhuokhPqjY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=KoFxAcbI+O6Lt7lP2pldvjDAqqUWO3lptqOmU3S4UNjjUIvq2AntiEd/5O2Xy6req tqURiWbZ3Qf0707KmQR3Wu95iMqfBodLl8HGt+06GyRqWxPNEMsW1DDHqlP59kRRQJ N/m9+a0KmviJW+TyCtPa+sbXNe+h+Xx5BMKF/C6l5KY0UQHnt1XN7TDxMHdn4+pUUa yMNkdGYlU9mFK27QqPRcfMtkGJSXaMT+JnbIIROGd/yidGscgwfa0vHSC8oomUEeW6 G7xvONH8D9iNVVTNLXlzmhgKAlkH9Vj7yks5eeSEwmSKq+SaU7YmCig/WyncLz8EN9 aElRCUoiubNPA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD198C79F9A; Mon, 5 Jan 2026 13:56:05 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 05 Jan 2026 19:25:48 +0530 Subject: [PATCH v4 8/8] PCI: qcom: Rename PERST# assert/deassert helpers for uniformity Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260105-pci-pwrctrl-rework-v4-8-6d41a7a49789@oss.qualcomm.com> References: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> In-Reply-To: <20260105-pci-pwrctrl-rework-v4-0-6d41a7a49789@oss.qualcomm.com> To: Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Bartosz Golaszewski Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Brian Norris , Krishna Chaitanya Chundru , Niklas Cassel , Alex Elder , Bartosz Golaszewski , Manivannan Sadhasivam X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2860; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=NsPRggmF+WutEVzxJ+1fg6OdEWz3rN72PxavsxzAJAM=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpW8LyZODhEFyx8+ElbRBxZdd+zdYJojC1HeXrE ARGhMlm0ruJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaVvC8gAKCRBVnxHm/pHO 9So/CACVFKIGwH6FtZVklizuGvtAsCqKZFrdwyrZWHIbr7YAKwWguXf2lI7kd/bGYZqXWNPCoaw lC6txH3YOPZmpwXiCE9d5wzXb5EhribQdfZPpbOWA3qe25HACIteCkCV2MpQsQk+HfFgc/63auN MM5dOVCHcUKEqyhI4MVFnU88RJpMpufhRrh8UqOifnpVedLR7O8yR02E+URioBsZbGo38+yUHpW zEQRbJStuV/ET5+737zK2b+GYSgWuNfcZKXlEfnR/EM+tu/10l3xIgFSfpJolC1XJpD7dUn9n94 7WojLFtU26zOn3I0Wji1uNOS7SjLJuPdIbnVMi3OdgmIbgxG X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Rename the PERST# assert/deassert helpers from qcom_ep_reset_{assert/deassert}() to qcom_pcie_perst_{assert/deassert}() to maintain uniformity. Reviewed-by: Bartosz Golaszewski Signed-off-by: Manivannan Sadhasivam --- drivers/pci/controller/dwc/pcie-qcom.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index 6de3ff555b9d..a9293502e565 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -295,7 +295,7 @@ struct qcom_pcie { =20 #define to_qcom_pcie(x) dev_get_drvdata((x)->dev) =20 -static void qcom_perst_assert(struct qcom_pcie *pcie, bool assert) +static void __qcom_pcie_perst_assert(struct qcom_pcie *pcie, bool assert) { struct qcom_pcie_perst *perst; struct qcom_pcie_port *port; @@ -309,16 +309,16 @@ static void qcom_perst_assert(struct qcom_pcie *pcie,= bool assert) usleep_range(PERST_DELAY_US, PERST_DELAY_US + 500); } =20 -static void qcom_ep_reset_assert(struct qcom_pcie *pcie) +static void qcom_pcie_perst_assert(struct qcom_pcie *pcie) { - qcom_perst_assert(pcie, true); + __qcom_pcie_perst_assert(pcie, true); } =20 -static void qcom_ep_reset_deassert(struct qcom_pcie *pcie) +static void qcom_pcie_perst_deassert(struct qcom_pcie *pcie) { /* Ensure that PERST has been asserted for at least 100 ms */ msleep(PCIE_T_PVPERL_MS); - qcom_perst_assert(pcie, false); + __qcom_pcie_perst_assert(pcie, false); } =20 static int qcom_pcie_start_link(struct dw_pcie *pci) @@ -1296,7 +1296,7 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp) struct qcom_pcie *pcie =3D to_qcom_pcie(pci); int ret; =20 - qcom_ep_reset_assert(pcie); + qcom_pcie_perst_assert(pcie); =20 ret =3D pcie->cfg->ops->init(pcie); if (ret) @@ -1322,7 +1322,7 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp) =20 qcom_pcie_clear_aspm_l0s(pcie->pci); =20 - qcom_ep_reset_deassert(pcie); + qcom_pcie_perst_deassert(pcie); =20 if (pcie->cfg->ops->config_sid) { ret =3D pcie->cfg->ops->config_sid(pcie); @@ -1333,7 +1333,7 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp) return 0; =20 err_assert_reset: - qcom_ep_reset_assert(pcie); + qcom_pcie_perst_assert(pcie); err_pwrctrl_power_off: pci_pwrctrl_power_off_devices(pci->dev); err_pwrctrl_destroy: @@ -1352,7 +1352,7 @@ static void qcom_pcie_host_deinit(struct dw_pcie_rp *= pp) struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); struct qcom_pcie *pcie =3D to_qcom_pcie(pci); =20 - qcom_ep_reset_assert(pcie); + qcom_pcie_perst_assert(pcie); /* * No need to destroy pwrctrl devices as this function only gets called * during system suspend as of now. --=20 2.48.1