Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

spi: cadence-quadspi: fix runtime pm and clock imbalance on unbind

Make sure to balance the runtime PM usage count before returning on
probe failure (to allow the controller to suspend after a probe
deferral) and to only drop the usage count on driver unbind to avoid a
clock disable imbalance.

Also restore the autosuspend setting.

Fixes: 0578a6dbfe75 ("spi: spi-cadence-quadspi: add runtime pm support")
Cc: stable@vger.kernel.org # 6.7
Cc: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260421125354.1534871-5-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Johan Hovold and committed by
Mark Brown
5e8bb0cc 233db2cb

+10 -7
+10 -7
drivers/spi/spi-cadence-quadspi.c
··· 1860 1860 if (irq < 0) 1861 1861 return -ENXIO; 1862 1862 1863 - ret = pm_runtime_set_active(dev); 1864 - if (ret) 1865 - return ret; 1866 - 1867 1863 ret = clk_bulk_prepare_enable(CLK_QSPI_NUM, cqspi->clks); 1868 1864 if (ret) { 1869 1865 dev_err(dev, "Cannot enable QSPI clocks.\n"); ··· 1958 1962 cqspi->sclk = 0; 1959 1963 1960 1964 if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) { 1961 - pm_runtime_enable(dev); 1962 1965 pm_runtime_set_autosuspend_delay(dev, CQSPI_AUTOSUSPEND_TIMEOUT); 1963 1966 pm_runtime_use_autosuspend(dev); 1964 1967 pm_runtime_get_noresume(dev); 1968 + pm_runtime_set_active(dev); 1969 + pm_runtime_enable(dev); 1965 1970 } 1966 1971 1967 1972 host->num_chipselect = cqspi->num_chipselect; ··· 1993 1996 if (cqspi->rx_chan) 1994 1997 dma_release_channel(cqspi->rx_chan); 1995 1998 disable_rpm: 1996 - if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) 1999 + if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) { 1997 2000 pm_runtime_disable(dev); 2001 + pm_runtime_set_suspended(dev); 2002 + pm_runtime_put_noidle(dev); 2003 + pm_runtime_dont_use_autosuspend(dev); 2004 + } 1998 2005 cqspi_controller_enable(cqspi, 0); 1999 2006 disable_clks: 2000 2007 clk_bulk_disable_unprepare(CLK_QSPI_NUM, cqspi->clks); ··· 2034 2033 } 2035 2034 2036 2035 if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) { 2037 - pm_runtime_put_sync(&pdev->dev); 2038 2036 pm_runtime_disable(&pdev->dev); 2037 + pm_runtime_set_suspended(&pdev->dev); 2038 + pm_runtime_put_noidle(&pdev->dev); 2039 + pm_runtime_dont_use_autosuspend(&pdev->dev); 2039 2040 } 2040 2041 } 2041 2042