Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp6093784pxb; Mon, 8 Nov 2021 03:06:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdqrG4ixSx4+hXdvNNJ2xx5o4RdemUaCj/LKS+nPnw+a3X/nJ9bJbGIe0XsvEBHUt0ooBJ X-Received: by 2002:a17:907:7242:: with SMTP id ds2mr27712729ejc.269.1636369599586; Mon, 08 Nov 2021 03:06:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636369599; cv=none; d=google.com; s=arc-20160816; b=yC4KvbULcAdR/ne0KKl4+dSVMdphRc0md/oFVtrhmLoGFBME4CZrJsNzchUR77SDKC DjlMVMd75kSxHEteGk8WElBurrkw0Vco2UJq2wLz/6E2Wm5W8cuM21Rr4OoGg/wSwnc+ /3zmXfQIbSiO+qseH7e1cbdiV1Ppi43ymsEmM8ptD9EJMmHkCm/AebiakP++hcTieXZe OMOfP2cI1jAY/hlePPO4KKSq8OiWM3PcDWUYWKdVlzjdtvVg7pGVdvrffN2FGNzbMCv3 82HeNVxV9Z/52cBFcQY+yp3GfUmln2L84jIs+dvkq27VTqw/4m6ezWHNwIBkayvWj/mK 83ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=WhBIjDMSv1cOmY/6J5Qv6zaPEH7VSyCPH/EfkrLNXgA=; b=aXLoxebPNc4tla6qYlZ1sTMLWqTidxvLHN6JQQxPEG6NIPDQX3hYIHeL1qfASyXBb/ 1e7oSbLKDO2FZRDj4Wy5jaYmWKKRTQEJlZarDwZIjGqgIoaMGQEdp9C+1jo0sVR4BO// HUCFSfPKkW4YDK8pb2n+cPii2iDCGHPspnGUYghJS+t+lE/U3WtPWjCkHj+W82eij+FT ZJpfS2ZwhWH7XYeXAiKTSl0UjDKymoTa/tYtiX6vqxTmrnIU6Dkp2JlMIFm1Rnt3Qxcy V9WRehT4JHA+zqiW2sjxqHlu7HAjaYwOSMqL2Y/K2tmid4o4kb3B1Wn0/alT6U2b9FXK 8D0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c8si26947530ede.377.2021.11.08.03.05.49; Mon, 08 Nov 2021 03:06:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236784AbhKHGOs (ORCPT + 99 others); Mon, 8 Nov 2021 01:14:48 -0500 Received: from twspam01.aspeedtech.com ([211.20.114.71]:7475 "EHLO twspam01.aspeedtech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231370AbhKHGOr (ORCPT ); Mon, 8 Nov 2021 01:14:47 -0500 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 1A85mlcc044876; Mon, 8 Nov 2021 13:48:47 +0800 (GMT-8) (envelope-from jammy_huang@aspeedtech.com) Received: from JammyHuang-PC.aspeed.com (192.168.2.115) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 8 Nov 2021 14:11:58 +0800 From: Jammy Huang To: , , , , , , , , Subject: [PATCH] media: aspeed: Fix signal status not updated immediately Date: Mon, 8 Nov 2021 14:11:55 +0800 Message-ID: <20211108061155.14479-1-jammy_huang@aspeedtech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [192.168.2.115] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 1A85mlcc044876 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If res-chg, VE_INTERRUPT_MODE_DETECT_WD irq will be raised. But v4l2_input_status wont't be updated to no-signal immediately until aspeed_video_get_resolution() in aspeed_video_resolution_work(). During the period of time, aspeed_video_start_frame() could be called because it doesn't know signal is unstable now. If it goes with aspeed_video_init_regs() of aspeed_video_irq_res_change() simultaneously , it will mess up hw state. To fix this problem, v4l2_input_status will be updated to no-signal immediately for VE_INTERRUPT_MODE_DETECT_WD irq. Fixes: d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver") Signed-off-by: Jammy Huang --- drivers/media/platform/aspeed-video.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c index 1ade264a8b69..3facd7ecc1a1 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -762,6 +762,8 @@ static void aspeed_video_irq_res_change(struct aspeed_video *video, ulong delay) set_bit(VIDEO_RES_CHANGE, &video->flags); clear_bit(VIDEO_FRAME_INPRG, &video->flags); + video->v4l2_input_status = V4L2_IN_ST_NO_SIGNAL; + aspeed_video_off(video); aspeed_video_on(video); aspeed_video_bufs_done(video, VB2_BUF_STATE_ERROR); @@ -1889,7 +1891,6 @@ static void aspeed_video_resolution_work(struct work_struct *work) struct delayed_work *dwork = to_delayed_work(work); struct aspeed_video *video = container_of(dwork, struct aspeed_video, res_work); - u32 input_status = video->v4l2_input_status; /* Exit early in case no clients remain */ if (test_bit(VIDEO_STOPPED, &video->flags)) @@ -1902,8 +1903,7 @@ static void aspeed_video_resolution_work(struct work_struct *work) aspeed_video_get_resolution(video); if (video->detected_timings.width != video->active_timings.width || - video->detected_timings.height != video->active_timings.height || - input_status != video->v4l2_input_status) { + video->detected_timings.height != video->active_timings.height) { static const struct v4l2_event ev = { .type = V4L2_EVENT_SOURCE_CHANGE, .u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION, -- 2.25.1