armbian_build/patch/kernel/archive/sunxi-6.12/patches.megous/spi-fixes.patch
2025-01-05 10:15:14 +01:00

67 lines
2.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Sun, 25 Feb 2024 04:22:51 +0100
Subject: spi fixes
---
drivers/spi/spi-rockchip.c | 15 ++++------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 111111111111..222222222222 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -781,7 +781,7 @@ static int rockchip_spi_enable_clocks(struct rockchip_spi *rs, bool en)
clk_disable_unprepare(rs->apb_pclk);
}
- rs->clk_enabled = en;
+ rs->clk_enabled = !!en;
return 0;
}
@@ -828,6 +828,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
return PTR_ERR(rs->spiclk);
}
+ rs->clk_enabled = true;
spi_enable_chip(rs, false);
ret = platform_get_irq(pdev, 0);
@@ -936,7 +937,9 @@ static int rockchip_spi_probe(struct platform_device *pdev)
pm_runtime_set_autosuspend_delay(&pdev->dev, ROCKCHIP_AUTOSUSPEND_TIMEOUT);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_active(&pdev->dev);
- pm_runtime_enable(&pdev->dev);
+ ret = devm_pm_runtime_enable(&pdev->dev);
+ if (ret < 0)
+ goto err_pm_disable;
ret = devm_spi_register_controller(&pdev->dev, ctlr);
if (ret < 0) {
@@ -947,8 +950,6 @@ static int rockchip_spi_probe(struct platform_device *pdev)
return 0;
err_pm_disable:
- pm_runtime_dont_use_autosuspend(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
if (ctlr->dma_rx)
dma_release_channel(ctlr->dma_rx);
err_free_dma_tx:
@@ -963,12 +964,6 @@ static void rockchip_spi_remove(struct platform_device *pdev)
struct spi_controller *ctlr = spi_controller_get(platform_get_drvdata(pdev));
struct rockchip_spi *rs = spi_controller_get_devdata(ctlr);
- pm_runtime_get_sync(&pdev->dev);
- //pm_runtime_dont_use_autosuspend(&pdev->dev);
- pm_runtime_put_noidle(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
- pm_runtime_set_suspended(&pdev->dev);
-
if (ctlr->dma_tx)
dma_release_channel(ctlr->dma_tx);
if (ctlr->dma_rx)
--
Armbian