Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1365515pxb; Fri, 21 Jan 2022 16:38:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDqpxawFUZ8owYv/tsPEEZC4sDS/W5+9hsmf1lh27bCk/7D1d3JuoOQCVhWtM6MrbVhUSV X-Received: by 2002:a17:902:7009:b0:14b:ce9:80b0 with SMTP id y9-20020a170902700900b0014b0ce980b0mr5939422plk.97.1642811881079; Fri, 21 Jan 2022 16:38:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642811881; cv=none; d=google.com; s=arc-20160816; b=hGnr7oj4jOjqhuZYEU6nUWcCgtREhiaP+vuzX/c5Fwz9bYk9Kz52+l/vRZzqrgo8Kk xjrFfeIHBIbLeaOxRZdjHIwqha5WupmZLjJiaoUHdB1sC11t/rcrdYydAFbCvy4i9u9t rpV0vxpdillO5u4QZDpXbmOyalGZZSDEQ6IStjONTeCgBa0GBvYEbaR1y/5YIJXeVIBC h7qXkplkbOwHyYmU1Y+ufLxVAMRXAPBJyvJH9b48pRczeAzWL1nnJ0H0k9Nv0C+GGbnI mnzfkTygC3mbdwnGl/1l+R5Kdy7IiTyp1eUZmk1xZsJCbEQRapnt0EWJfCXCkQaYLXhl iE+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id; bh=LCjAAKA9Ljx4JWngREbTIMRrRCFptych9vU10IxNvms=; b=YszpY/eCzxdXu3TXsfb+PNhVfXS4zycFuRFXzxK6K4o5kCUyrV4iSdHYwCBTM8CtKJ s71A3IU7F/+wT2w8uPSsyg7UErovt9eBeCqjfE+UB7ZEdephQR/7ZltbWuuL8kxruOcp FdOKJf7Qhs0F4BI8ayqNYGpj3Yap6sPIWLzSEp01dQGDLKVfusDbs0SBJqRrhPnAVJsI 5M6SplouzJhRi1gdfkiZT1EUPncdEFwtB2Vfj2XyPynvEuCX11AU65BVXDTsDlZdXerQ YjdpLQeAGmpvGvoEeGLq0fknz6L59WxHBUSw+Poo/OmZ2URFa1bgTNUluHAIfVnVxorQ d4uQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z3si6274622pla.559.2022.01.21.16.37.49; Fri, 21 Jan 2022 16:38:01 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378979AbiAUHaX (ORCPT + 99 others); Fri, 21 Jan 2022 02:30:23 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:41764 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378954AbiAUHaV (ORCPT ); Fri, 21 Jan 2022 02:30:21 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 14D3E617A8; Fri, 21 Jan 2022 07:30:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5310C340E1; Fri, 21 Jan 2022 07:30:18 +0000 (UTC) Message-ID: <418fc1b2-ddbe-24e3-82cc-aa8ce74f4507@xs4all.nl> Date: Fri, 21 Jan 2022 08:30:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v2 4/4] media: aspeed: Fix timing polarity incorrect Content-Language: en-US To: Jammy Huang , eajames@linux.ibm.com, mchehab@kernel.org, joel@jms.id.au, andrew@aj.id.au, linux-media@vger.kernel.org, openbmc@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20211222082139.26933-1-jammy_huang@aspeedtech.com> <20211222082139.26933-5-jammy_huang@aspeedtech.com> From: Hans Verkuil In-Reply-To: <20211222082139.26933-5-jammy_huang@aspeedtech.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/22/21 09:21, Jammy Huang wrote: > This is a workaround for sync polarity unstable. > Sync value get by VR09C counts from sync's rising edge, which means > sync's polarity is negative if sync value is bigger than total/2. Do you have an example of such a format, or is this mostly theoretical? Either provide the example or make a note that it is theoretical. Regards, Hans > > Signed-off-by: Jammy Huang > --- > v2: > - Use 'total/2' rather than 'total<<1' > - Update comment > --- > drivers/media/platform/aspeed-video.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c > index 7c50567f5ab0..c3e3343d91e1 100644 > --- a/drivers/media/platform/aspeed-video.c > +++ b/drivers/media/platform/aspeed-video.c > @@ -989,6 +989,16 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) > > video->frame_bottom = FIELD_GET(VE_SRC_TB_EDGE_DET_BOT, src_tb_edge); > video->frame_top = FIELD_GET(VE_SRC_TB_EDGE_DET_TOP, src_tb_edge); > + > + /* > + * This is a workaround for polarity detection when the sync > + * value is larger than half. > + */ > + if (vsync > (vtotal / 2)) > + det->polarities &= ~V4L2_DV_VSYNC_POS_POL; > + else > + det->polarities |= V4L2_DV_VSYNC_POS_POL; > + > if (det->polarities & V4L2_DV_VSYNC_POS_POL) { > det->vbackporch = video->frame_top - vsync; > det->vfrontporch = vtotal - video->frame_bottom; > @@ -1003,6 +1013,16 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) > > video->frame_right = FIELD_GET(VE_SRC_LR_EDGE_DET_RT, src_lr_edge); > video->frame_left = FIELD_GET(VE_SRC_LR_EDGE_DET_LEFT, src_lr_edge); > + > + /* > + * This is a workaround for polarity detection when the sync > + * value is larger than half. > + */ > + if (hsync > (htotal / 2)) > + det->polarities &= ~V4L2_DV_HSYNC_POS_POL; > + else > + det->polarities |= V4L2_DV_HSYNC_POS_POL; > + > if (det->polarities & V4L2_DV_HSYNC_POS_POL) { > det->hbackporch = video->frame_left - hsync; > det->hfrontporch = htotal - video->frame_right;