spi: rockchip: Enable pm_runtime autosuspend_delay

This can balance performance and power consumption.

Change-Id: Ib59047632c57b6897098d16f43ba44e38e075c00
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
This commit is contained in:
Jon Lin
2024-08-14 11:30:25 +08:00
parent c7b9a0eda0
commit 5df6dc1dd9

View File

@@ -173,6 +173,8 @@
#define ROCKCHIP_SPI_REGISTER_SIZE 0x1000
#define ROCKCHIP_AUTOSUSPEND_TIMEOUT 500
enum rockchip_spi_xfer_mode {
ROCKCHIP_SPI_DMA,
ROCKCHIP_SPI_IRQ,
@@ -1112,13 +1114,11 @@ static int rockchip_spi_probe(struct platform_device *pdev)
if (quirks_cfg)
rs->max_baud_div_in_cpha = quirks_cfg->max_baud_div_in_cpha;
if (!device_property_read_u32(&pdev->dev, "rockchip,autosuspend-delay-ms", &val)) {
if (val > 0) {
pm_runtime_set_autosuspend_delay(&pdev->dev, val);
pm_runtime_use_autosuspend(&pdev->dev);
}
}
device_property_read_u32(&pdev->dev, "rockchip,autosuspend-delay-ms", &val);
if (val <= 0)
val = ROCKCHIP_AUTOSUSPEND_TIMEOUT;
pm_runtime_set_autosuspend_delay(&pdev->dev, val);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);