From: Youngmin Nam Date: Fri, 24 Apr 2015 08:24:51 +0000 (+0900) Subject: spi: s3c64xx: Add LPD powermode and update idle status register X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cae0bf8fa08f09a40b66bc623e6aafcc17be26c7;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git spi: s3c64xx: Add LPD powermode and update idle status register This patch adds LPD powermode and updates idle status register when clock/power of IP is en/disabled to check LPD condition. Change-Id: I6aeb2ede54181bddbfd92bfac1f6d493a95ee54d Signed-off-by: Youngmin Nam --- diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index b6e7be0e3cdb..9e33f09cf2bb 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -1598,6 +1599,9 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) sdd->sfr_start = mem_res->start; sdd->is_probed = 0; sdd->ops = NULL; + + sdd->idle_ip_index = exynos_get_idle_ip_index(dev_name(&pdev->dev)); + if (pdev->dev.of_node) { ret = of_alias_get_id(pdev->dev.of_node, "spi"); if (ret < 0) { @@ -1701,6 +1705,8 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) } } #else + exynos_update_ip_idle_status(sdd->idle_ip_index, 0); + if (clk_prepare_enable(sdd->clk)) { dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n"); ret = -EBUSY; @@ -1808,6 +1814,8 @@ static int s3c64xx_spi_remove(struct platform_device *pdev) clk_disable_unprepare(sdd->clk); + exynos_update_ip_idle_status(sdd->idle_ip_index, 1); + platform_set_drvdata(pdev, NULL); spi_master_put(master); @@ -1834,6 +1842,7 @@ static int s3c64xx_spi_suspend_operation(struct device *dev) /* Disable the clock */ clk_disable_unprepare(sdd->src_clk); clk_disable_unprepare(sdd->clk); + exynos_update_ip_idle_status(sdd->idle_ip_index, 1); } #endif sdd->cur_speed = 0; /* Output Clock is stopped */ @@ -1850,6 +1859,7 @@ static int s3c64xx_spi_resume_operation(struct device *dev) if (sci->domain == DOMAIN_TOP) { /* Enable the clock */ + exynos_update_ip_idle_status(sdd->idle_ip_index, 0); clk_prepare_enable(sdd->src_clk); clk_prepare_enable(sdd->clk); @@ -1865,6 +1875,7 @@ static int s3c64xx_spi_resume_operation(struct device *dev) /* Disable the clock */ clk_disable_unprepare(sdd->src_clk); clk_disable_unprepare(sdd->clk); + exynos_update_ip_idle_status(sdd->idle_ip_index, 1); #endif } @@ -1976,6 +1987,8 @@ static int s3c64xx_spi_runtime_suspend(struct device *dev) if (__clk_get_enable_count(sdd->src_clk)) clk_disable_unprepare(sdd->src_clk); + exynos_update_ip_idle_status(sdd->idle_ip_index, 1); + /* Free DMA channels */ if (sci->dma_mode == DMA_MODE && sdd->is_probed && sdd->ops != NULL) { #ifdef CONFIG_ARM64 @@ -2013,12 +2026,14 @@ static int s3c64xx_spi_runtime_resume(struct device *dev) } if (sci->domain == DOMAIN_TOP) { + exynos_update_ip_idle_status(sdd->idle_ip_index, 0); clk_prepare_enable(sdd->src_clk); clk_prepare_enable(sdd->clk); } #if defined(CONFIG_VIDEO_EXYNOS_FIMC_IS) || defined(CONFIG_VIDEO_EXYNOS_FIMC_IS2) else if (sci->domain == DOMAIN_CAM1 || sci->domain == DOMAIN_ISP) { + exynos_update_ip_idle_status(sdd->idle_ip_index, 0); clk_prepare_enable(sdd->src_clk); clk_prepare_enable(sdd->clk); diff --git a/include/linux/platform_data/spi-s3c64xx.h b/include/linux/platform_data/spi-s3c64xx.h index 40a8c15c0ed0..b21aaee63188 100644 --- a/include/linux/platform_data/spi-s3c64xx.h +++ b/include/linux/platform_data/spi-s3c64xx.h @@ -144,6 +144,7 @@ struct s3c64xx_spi_driver_data { int is_probed; int spi_clkoff_time; + int idle_ip_index; }; /**