]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: nuvoton: npcm-video: Fix stuck due to no video signal error
authorMichael Chang <zhang971090220@gmail.com>
Tue, 8 Apr 2025 05:48:39 +0000 (13:48 +0800)
committerHans Verkuil <hverkuil@xs4all.nl>
Fri, 25 Apr 2025 13:14:32 +0000 (15:14 +0200)
Fix the issue when start_frame and detect_resolution
functions are executed at the same time, which may cause driver
stops capturing due to status of no video signal error.

Signed-off-by: Michael Chang <zhang971090220@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/platform/nuvoton/npcm-video.c

index 7a9d8928ae4019ab50467f8a1ec23f977de38230..3022fdcf66ec7ae9281da73617eb7b3ba027defe 100644 (file)
@@ -863,7 +863,6 @@ static void npcm_video_detect_resolution(struct npcm_video *video)
        struct regmap *gfxi = video->gfx_regmap;
        unsigned int dispst;
 
-       video->v4l2_input_status = V4L2_IN_ST_NO_SIGNAL;
        det->width = npcm_video_hres(video);
        det->height = npcm_video_vres(video);
 
@@ -892,12 +891,16 @@ static void npcm_video_detect_resolution(struct npcm_video *video)
                clear_bit(VIDEO_RES_CHANGING, &video->flags);
        }
 
-       if (det->width && det->height)
+       if (det->width && det->height) {
                video->v4l2_input_status = 0;
-
-       dev_dbg(video->dev, "Got resolution[%dx%d] -> [%dx%d], status %d\n",
-               act->width, act->height, det->width, det->height,
-               video->v4l2_input_status);
+               dev_dbg(video->dev, "Got resolution[%dx%d] -> [%dx%d], status %d\n",
+                       act->width, act->height, det->width, det->height,
+                       video->v4l2_input_status);
+       } else {
+               video->v4l2_input_status = V4L2_IN_ST_NO_SIGNAL;
+               dev_err(video->dev, "Got invalid resolution[%dx%d]\n", det->width,
+                       det->height);
+       }
 }
 
 static int npcm_video_set_resolution(struct npcm_video *video,