From 9e64835577ab9b302000df99649d80956eafccc8 Mon Sep 17 00:00:00 2001 From: XiaoDong Huang Date: Tue, 28 Nov 2023 11:34:32 +0800 Subject: [PATCH 1/4] ARM: rockchip: rv1106: support PMIC_SLEEP over gpio0_a4 Change-Id: I14678dfe44ed893f4a2e42168eb2b869c622aa89 Signed-off-by: XiaoDong Huang --- arch/arm/mach-rockchip/rv1106_pm.c | 45 ++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/arch/arm/mach-rockchip/rv1106_pm.c b/arch/arm/mach-rockchip/rv1106_pm.c index 7d149985f910..13a01bb8f0bd 100644 --- a/arch/arm/mach-rockchip/rv1106_pm.c +++ b/arch/arm/mach-rockchip/rv1106_pm.c @@ -281,6 +281,8 @@ static struct reg_region vd_log_reg_rgns[] = { { REG_REGION(0x30, 0x30, 4, &stimer_base, 0)}, }; +static int is_rv1103, is_rv1106; + #define PLL_LOCKED_TIMEOUT 600000U static void pm_pll_wait_lock(u32 pll_id) @@ -777,14 +779,6 @@ static void pmu_sleep_config(void) BIT(RV1106_PMU_GPLL_PD_ENA) | 0; - /* pmic_sleep */ - /* gpio0_a3 activelow, gpio0_a4 active high */ - writel_relaxed(BITS_WITH_WMASK(0x4, 0x7, 0), pmugrf_base + RV1106_PMUGRF_SOC_CON(1)); - /* select sleep func */ - writel_relaxed(BITS_WITH_WMASK(0x1, 0x1, 0), pmugrf_base + RV1106_PMUGRF_SOC_CON(1)); - /* gpio0_a3 iomux */ - writel_relaxed(BITS_WITH_WMASK(0x1, 0xf, 12), ioc_base[0] + 0); - /* pmu_debug */ writel_relaxed(0xffffff01, pmu_base + RV1106_PMU_INFO_TX_CON); writel_relaxed(BITS_WITH_WMASK(0x1, 0xf, 4), ioc_base[1] + 0); @@ -945,13 +939,27 @@ static void gpio_config(void) gpio0_set_pull(2, RV1106_GPIO_PULL_DOWN); gpio0_set_direct(2, 0); - /* gpio0_a3, pullnone */ - gpio0_set_pull(3, RV1106_GPIO_PULL_NONE); + if (is_rv1106) { + /* gpio0_a3, pullnone */ + gpio0_set_iomux(3, 1); + gpio0_set_pull(3, RV1106_GPIO_PULL_NONE); + } else { + /* gpio0_a3, input, pullup */ + gpio0_set_iomux(3, 0); + gpio0_set_pull(3, RV1106_GPIO_PULL_UP); + gpio0_set_direct(3, 0); + } - /* gpio0_a4, input, pullup */ - gpio0_set_iomux(4, 0); - gpio0_set_pull(4, RV1106_GPIO_PULL_UP); - gpio0_set_direct(4, 0); + if (is_rv1103) { + /* gpio0_a4, pullnone */ + gpio0_set_iomux(4, 1); + gpio0_set_pull(4, RV1106_GPIO_PULL_NONE); + } else { + /* gpio0_a4, input, pullup */ + gpio0_set_iomux(4, 0); + gpio0_set_pull(4, RV1106_GPIO_PULL_UP); + gpio0_set_direct(4, 0); + } /* gpio0_a5, input, pullnone */ gpio0_set_iomux(5, 0); @@ -1128,6 +1136,11 @@ static int __init rv1106_suspend_init(struct device_node *np) { void __iomem *dev_reg_base; + if (of_machine_is_compatible("rockchip,rv1103")) + is_rv1103 = 1; + else if (of_machine_is_compatible("rockchip,rv1106")) + is_rv1106 = 1; + dev_reg_base = ioremap(RV1106_DEV_REG_BASE, RV1106_DEV_REG_SIZE); if (dev_reg_base) pr_info("%s map dev_reg 0x%x -> 0x%x\n", @@ -1207,6 +1220,10 @@ static int __init rv1106_suspend_init(struct device_node *np) /* biu auto con */ writel_relaxed(0x07ff07ff, pmu_base + RV1106_PMU_BIU_AUTO_CON); + /* gpio0_a3 activelow, gpio0_a4 active high, select sleep func */ + writel_relaxed(BITS_WITH_WMASK(0x5, 0x7, 0), + pmugrf_base + RV1106_PMUGRF_SOC_CON(1)); + rkpm_region_mem_init(RV1106_PM_REG_REGION_MEM_SIZE); rkpm_reg_rgns_init(); From 164aa84b565b56247cfc1467d988080192d01393 Mon Sep 17 00:00:00 2001 From: Mingwei Yan Date: Sat, 2 Dec 2023 15:23:53 +0800 Subject: [PATCH 2/4] media: rockchip: isp: fix is_on false cause pm isp die rv1106 dual_sensor will call rkisp_hw_enum_isp_size, if memset isp_size to 0 will cause is_on be false, when isp pm,isp reg_save/reg_store can't be called Signed-off-by: Mingwei Yan Change-Id: If91e3feaf113fe8ca3d22fca92c2800c99f5b55d --- drivers/media/platform/rockchip/isp/hw.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/platform/rockchip/isp/hw.c b/drivers/media/platform/rockchip/isp/hw.c index f105afa33356..5b0f291aaac1 100644 --- a/drivers/media/platform/rockchip/isp/hw.c +++ b/drivers/media/platform/rockchip/isp/hw.c @@ -1257,7 +1257,6 @@ void rkisp_hw_enum_isp_size(struct rkisp_hw_dev *hw_dev) struct rkisp_device *isp; u32 w, h, i; - memset(hw_dev->isp_size, 0, sizeof(hw_dev->isp_size)); if (!hw_dev->max_in.is_fix) { hw_dev->max_in.w = 0; hw_dev->max_in.h = 0; From ad7b71f2e237beef9c4c29eb8a70d07319b27ea4 Mon Sep 17 00:00:00 2001 From: XiaoDong Huang Date: Mon, 4 Dec 2023 15:53:31 +0800 Subject: [PATCH 3/4] ARM: rockchip: rv1106: support CONFIG_RV1106_PMU_WAKEUP_TIMEOUT Signed-off-by: XiaoDong Huang Change-Id: I66859ef75a39e71de20a1efab5fc840bfa296346 --- arch/arm/mach-rockchip/Kconfig | 6 ++++++ arch/arm/mach-rockchip/rv1106_pm.c | 4 ++-- arch/arm/mach-rockchip/rv1106_pm.h | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig index 922b2e71d2d7..6313fec3ddb9 100644 --- a/arch/arm/mach-rockchip/Kconfig +++ b/arch/arm/mach-rockchip/Kconfig @@ -28,3 +28,9 @@ config RV1106_HPMCU_FAST_WAKEUP depends on PM_SLEEP && CPU_RV1106 help This config aims to support HPMCU fast wakeup. + +config RV1106_PMU_WAKEUP_TIMEOUT + bool "Rockchip RV1106 pmu timeout wakeup support" + depends on PM_SLEEP && CPU_RV1106 + help + This config aims to support pmu timeout wakeup. diff --git a/arch/arm/mach-rockchip/rv1106_pm.c b/arch/arm/mach-rockchip/rv1106_pm.c index 13a01bb8f0bd..205c78d88507 100644 --- a/arch/arm/mach-rockchip/rv1106_pm.c +++ b/arch/arm/mach-rockchip/rv1106_pm.c @@ -712,8 +712,8 @@ static void pmu_sleep_config(void) /* BIT(RV1106_PMU_WAKEUP_CPU_INT_EN) | */ BIT(RV1106_PMU_WAKEUP_GPIO_INT_EN) | 0; - if (IS_ENABLED(CONFIG_RV1106_HPMCU_FAST_WAKEUP)) - pmu_wkup_con |= BIT(RV1106_PMU_WAKEUP_TIMEROUT_EN); + if (IS_ENABLED(CONFIG_RV1106_PMU_WAKEUP_TIMEOUT)) + pmu_wkup_con |= BIT(RV1106_PMU_WAKEUP_TIMEOUT_EN); pmu_pwr_con = BIT(RV1106_PMU_PWRMODE_EN) | diff --git a/arch/arm/mach-rockchip/rv1106_pm.h b/arch/arm/mach-rockchip/rv1106_pm.h index 6e822386ef23..a3db55d09abc 100644 --- a/arch/arm/mach-rockchip/rv1106_pm.h +++ b/arch/arm/mach-rockchip/rv1106_pm.h @@ -238,7 +238,7 @@ enum rv1106_wakeup_init_con { RV1106_PMU_WAKEUP_USBDEV_EN, RV1106_PMU_WAKEUP_TIMER_EN, - RV1106_PMU_WAKEUP_TIMEROUT_EN, + RV1106_PMU_WAKEUP_TIMEOUT_EN, RV1106_PMU_WAKEUP_SFT_WAKEUP_CFG, }; From 80af59f8b8783610afdf59ff4cd7a0b4fcdf095d Mon Sep 17 00:00:00 2001 From: Jacob Chen Date: Fri, 1 Dec 2023 15:55:01 +0800 Subject: [PATCH 4/4] video: rockchip: rve: update to 1.0.5 fix unexpected exit during execution of llp tasks, The 0th bit of the work status register indicates whether the current task in linked-list mode has successfully completed execution. The 4th bit indicates all tasks has been processed done. Change-Id: I099c55e2f00cc63e9f4ee0d3e2696ccec9a5ae9a Signed-off-by: Jacob Chen --- drivers/video/rockchip/rve/include/rve_drv.h | 2 +- drivers/video/rockchip/rve/include/rve_reg.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/rockchip/rve/include/rve_drv.h b/drivers/video/rockchip/rve/include/rve_drv.h index 4fff93ff19eb..8d9f188c93e2 100644 --- a/drivers/video/rockchip/rve/include/rve_drv.h +++ b/drivers/video/rockchip/rve/include/rve_drv.h @@ -72,7 +72,7 @@ #define DRIVER_MAJOR_VERSION 1 #define DRIVER_MINOR_VERSION 0 -#define DRIVER_REVISION_VERSION 4 +#define DRIVER_REVISION_VERSION 5 #define DRIVER_VERSION (STR(DRIVER_MAJOR_VERSION) "." STR(DRIVER_MINOR_VERSION) \ "." STR(DRIVER_REVISION_VERSION)) diff --git a/drivers/video/rockchip/rve/include/rve_reg.h b/drivers/video/rockchip/rve/include/rve_reg.h index 5969aa9d881e..05df28037a83 100644 --- a/drivers/video/rockchip/rve/include/rve_reg.h +++ b/drivers/video/rockchip/rve/include/rve_reg.h @@ -73,7 +73,7 @@ /* mode value */ #define RVE_LLP_MODE 0x8000 -#define RVE_LLP_DONE 0x11 +#define RVE_LLP_DONE 0x10 #define RVE_CLEAR_UP_REG6_WROK_STA 0xff0000 void rve_soft_reset(struct rve_scheduler_t *scheduler);