Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3505192pxb; Mon, 24 Jan 2022 10:58:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8plo4r4vxGzvRsdmNQ7VKydvzBPNb/s/ppxlGO2OnEEMXf/BaC8W898hF5BJYn7X1Be/Q X-Received: by 2002:a63:1562:: with SMTP id 34mr12625120pgv.15.1643050720110; Mon, 24 Jan 2022 10:58:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643050720; cv=none; d=google.com; s=arc-20160816; b=xOnBzALXSoMg5tO+hDZygz/rSzlPRMohHfuZ40nGHeonYJA85trcUpNlaGYNGvBuu4 u7KOpUhRM3RNRUyTXVMg4GlWbLRTP5RnXtskRam4yoJZrzuUzWAuPRTzX/vB5Iiee+zI Dp//AqN+Y0rsUL8r3qTNvZoplISkkcoAEvgs4M9V4z9eIXP8WBjEVz7l63JJGJs3ln3g rOUzUqTQ+e9nH5ltIVTEEb38EfkB5QAyW7Nk+jHwN7KjGjWDBKntQTyDLAABCslMEIdl KLtbFDIkV1mvtaXMiPPmKQiOPBzr/c0QWOO4pVrFYRfytE6SaFetk/JQV3LUp/tjeO/0 XCaA== 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 :references:in-reply-to:message-id:date:subject:to:from; bh=oOhRmNnYlYqBsgt2zbyIZrE5knc1SoDoWvKFTu67Idg=; b=uc9WltoVGCqvUdeTBaU6oW8Y5vI7tglDbxXJZSXrp2lYPtZLFPfkGsXHSaXaerFVCD yJ+5JjNKMg8uOSCqrzAPDBXj9Npc+/tbgKYzBGf82ABOeYclhFUGHVuRrrYk5jHwVqnL lqQsfy5QuvQzhGXjrZigT4GEEMPCZ28VMPDRve7VcEhcIWqEYOFgMi/h/3Erf3hSD0vT hngG4pMSnLbfEv2x/CBlnEjlWGeP3637dMDdcZU3P1W49zgigcvGdHoS2XRo1ikTM5pO QBqTECGXR7HUe5U0fu/GKURxpcrmu4Onquhw0VyepxHI3WyjACy3cQ9paXHgV6/M2XY6 zKeQ== 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 z3si11563522pla.559.2022.01.24.10.58.27; Mon, 24 Jan 2022 10:58:40 -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 S234343AbiAXJeP (ORCPT + 99 others); Mon, 24 Jan 2022 04:34:15 -0500 Received: from twspam01.aspeedtech.com ([211.20.114.71]:24077 "EHLO twspam01.aspeedtech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234332AbiAXJeL (ORCPT ); Mon, 24 Jan 2022 04:34:11 -0500 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 20O9QVHs054146; Mon, 24 Jan 2022 17:26:31 +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, 24 Jan 2022 17:33:48 +0800 From: Jammy Huang To: , , , , , , , , Subject: [PATCH v3 1/4] media: aspeed: Correct value for h-total-pixels Date: Mon, 24 Jan 2022 17:33:42 +0800 Message-ID: <20220124093345.3935-2-jammy_huang@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220124093345.3935-1-jammy_huang@aspeedtech.com> References: <20220124093345.3935-1-jammy_huang@aspeedtech.com> 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 20O9QVHs054146 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Previous reg-field, 0x98[11:0], stands for the period of the detected hsync signal. Use the correct reg, 0xa0, to get h-total in pixels. Fixes: d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver") Signed-off-by: Jammy Huang Reviewed-by: Joel Stanley --- v3: - no update v2: - no update --- drivers/media/platform/aspeed-video.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c index b388bc56ce81..d5f77b205175 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -166,7 +166,7 @@ #define VE_SRC_TB_EDGE_DET_BOT GENMASK(28, VE_SRC_TB_EDGE_DET_BOT_SHF) #define VE_MODE_DETECT_STATUS 0x098 -#define VE_MODE_DETECT_H_PIXELS GENMASK(11, 0) +#define VE_MODE_DETECT_H_PERIOD GENMASK(11, 0) #define VE_MODE_DETECT_V_LINES_SHF 16 #define VE_MODE_DETECT_V_LINES GENMASK(27, VE_MODE_DETECT_V_LINES_SHF) #define VE_MODE_DETECT_STATUS_VSYNC BIT(28) @@ -177,6 +177,8 @@ #define VE_SYNC_STATUS_VSYNC_SHF 16 #define VE_SYNC_STATUS_VSYNC GENMASK(27, VE_SYNC_STATUS_VSYNC_SHF) +#define VE_H_TOTAL_PIXELS 0x0A0 + #define VE_INTERRUPT_CTRL 0x304 #define VE_INTERRUPT_STATUS 0x308 #define VE_INTERRUPT_MODE_DETECT_WD BIT(0) @@ -938,6 +940,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) u32 src_lr_edge; u32 src_tb_edge; u32 sync; + u32 htotal; struct v4l2_bt_timings *det = &video->detected_timings; det->width = MIN_WIDTH; @@ -983,6 +986,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) src_tb_edge = aspeed_video_read(video, VE_SRC_TB_EDGE_DET); mds = aspeed_video_read(video, VE_MODE_DETECT_STATUS); sync = aspeed_video_read(video, VE_SYNC_STATUS); + htotal = aspeed_video_read(video, VE_H_TOTAL_PIXELS); video->frame_bottom = (src_tb_edge & VE_SRC_TB_EDGE_DET_BOT) >> VE_SRC_TB_EDGE_DET_BOT_SHF; @@ -999,8 +1003,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) VE_SRC_LR_EDGE_DET_RT_SHF; video->frame_left = src_lr_edge & VE_SRC_LR_EDGE_DET_LEFT; det->hfrontporch = video->frame_left; - det->hbackporch = (mds & VE_MODE_DETECT_H_PIXELS) - - video->frame_right; + det->hbackporch = htotal - video->frame_right; det->hsync = sync & VE_SYNC_STATUS_HSYNC; if (video->frame_left > video->frame_right) continue; -- 2.25.1