diff mbox series

[RESEND] media: platform: Add hardware sync wait to fimc_is_hw_change_mode()

Message ID 20250422021345.1940-1-vulab@iscas.ac.cn
State New
Headers show
Series [RESEND] media: platform: Add hardware sync wait to fimc_is_hw_change_mode() | expand

Commit Message

Wentao Liang April 22, 2025, 2:13 a.m. UTC
In fimc_is_hw_change_mode(), the function changes camera modes without
waiting for hardware completion, risking corrupted data or system hangs
if subsequent operations proceed before the hardware is ready.

Add fimc_is_hw_wait_intmsr0_intmsd0() after mode configuration, ensuring
hardware state synchronization and stable interrupt handling.

Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/media/platform/samsung/exynos4-is/fimc-is-regs.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Hans Verkuil April 25, 2025, 8:57 a.m. UTC | #1
On 22/04/2025 04:13, Wentao Liang wrote:
> In fimc_is_hw_change_mode(), the function changes camera modes without
> waiting for hardware completion, risking corrupted data or system hangs
> if subsequent operations proceed before the hardware is ready.
> 
> Add fimc_is_hw_wait_intmsr0_intmsd0() after mode configuration, ensuring
> hardware state synchronization and stable interrupt handling.

Just for future reference: please don't resend. If it is in
https://patchwork.linuxtv.org/ then it will be picked up eventually.

Also, always add the driver name in the subject line, that makes it much easier
to identify who should pick up the patch.

Regards,

	Hans

> 
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  drivers/media/platform/samsung/exynos4-is/fimc-is-regs.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-is-regs.c b/drivers/media/platform/samsung/exynos4-is/fimc-is-regs.c
> index 366e6393817d..5f9c44e825a5 100644
> --- a/drivers/media/platform/samsung/exynos4-is/fimc-is-regs.c
> +++ b/drivers/media/platform/samsung/exynos4-is/fimc-is-regs.c
> @@ -164,6 +164,7 @@ int fimc_is_hw_change_mode(struct fimc_is *is)
>  	if (WARN_ON(is->config_index >= ARRAY_SIZE(cmd)))
>  		return -EINVAL;
>  
> +	fimc_is_hw_wait_intmsr0_intmsd0(is);
>  	mcuctl_write(cmd[is->config_index], is, MCUCTL_REG_ISSR(0));
>  	mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(1));
>  	mcuctl_write(is->setfile.sub_index, is, MCUCTL_REG_ISSR(2));
diff mbox series

Patch

diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-is-regs.c b/drivers/media/platform/samsung/exynos4-is/fimc-is-regs.c
index 366e6393817d..5f9c44e825a5 100644
--- a/drivers/media/platform/samsung/exynos4-is/fimc-is-regs.c
+++ b/drivers/media/platform/samsung/exynos4-is/fimc-is-regs.c
@@ -164,6 +164,7 @@  int fimc_is_hw_change_mode(struct fimc_is *is)
 	if (WARN_ON(is->config_index >= ARRAY_SIZE(cmd)))
 		return -EINVAL;
 
+	fimc_is_hw_wait_intmsr0_intmsd0(is);
 	mcuctl_write(cmd[is->config_index], is, MCUCTL_REG_ISSR(0));
 	mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(1));
 	mcuctl_write(is->setfile.sub_index, is, MCUCTL_REG_ISSR(2));