Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3651587ybb; Mon, 6 Apr 2020 12:48:57 -0700 (PDT) X-Google-Smtp-Source: APiQypKNGIQ8gnLUsJlyZVNKdjZgGuz0wYzZohF83VZDbuP7Lb8c+mVKBWWyVaD065pFwDY85uqO X-Received: by 2002:a9d:3e4b:: with SMTP id h11mr13955747otg.252.1586202537460; Mon, 06 Apr 2020 12:48:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586202537; cv=none; d=google.com; s=arc-20160816; b=jjnxM3bblaR2MD3bDCOKmio6YVcSZ9Ay75LcuM3LArm51QD5i8vg51F8TAcHuVDipn DY9X7zR5ADibGKzc655+DQbukwktW/hJ1kHKxB25mc378nswV17CpSuFa1JfnFFr3ZjN Qlosmlnp0gX/FuEZWqMsi9HH1lT0rCggUpaCfjnWTgZnVinsRmxQkGiyZ7nEKjBJMIOe up+8TT4gkgw3T1UfcIy5xW/8qNKRe6JlHDlU0IN772oQ5y+X636KPOJq3dtc+JwBcEL5 M21q+tEp9itKE8NxYsNFhiD3wxmJ9JMifFGrHH5Y/UZi3LdVZkF3vX+FJOdeXMcGzSF4 mYgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=/big40mQJPZUYL0hhY2GKn9zAZBw853eJB7EhVN3kls=; b=0m+paTcUCSsH1VU5RnRu4Lhfsn+YbDh48BDnLzzEJxLH658NP/WD7io/HY1eWvP7Gb eb+ai4T2+Bt3XzYuO9IcQaYKp6iRvJ0qMXG5OPyD8MutDGRsvd/IcEVYW1scgT+Ios9v m/6qLUt1yDjJ1vzLC5XlF0yfZEuiCpmbb6ptRHLuvYuEgbYYELw0dsgeqBctNEn1vvqT l8pV9sm8GKxKZ08C5RBl8p/6vNj56SvxDy8Q8Riwavh3HU+KiK6hsYMr1Ji4Fq/D+76y W68hxm8mulgtmwyDwxUbETD3IsgOvmcy3d4mWgrnXKi3fiDzrAPJubn058u6O9/Jg1sn 11tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lTHkPi9p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l9si272756otf.51.2020.04.06.12.48.44; Mon, 06 Apr 2020 12:48:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lTHkPi9p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726331AbgDFTsG (ORCPT + 99 others); Mon, 6 Apr 2020 15:48:06 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:36810 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725895AbgDFTsF (ORCPT ); Mon, 6 Apr 2020 15:48:05 -0400 Received: by mail-lf1-f65.google.com with SMTP id w145so490950lff.3; Mon, 06 Apr 2020 12:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=/big40mQJPZUYL0hhY2GKn9zAZBw853eJB7EhVN3kls=; b=lTHkPi9pxKic893EROuyYqPWfUKg2oKaYoWvm3Hrp7vu339wkQ90dFBQYtVP666+MW tM2E1296dcsOlp/MpS2ve1zYtQiBXr4oV9yMVIy6tWglZgt9GI1+28wt6tVxzI2amihT +CoHVCkSqmGy9yME32O5E/2Hp3ES7aiZYk1NGXGiRZ8Bxc0M7giaNod7wTIKXWa/wPbd hHLpcsagFF6EDCQOpb40zIkCJncbSZdlIMpxboFG4pE1LCpxK7xHkArfug6Y5QhVWFZ6 CgoBCarhUdfyIHN9Lq5rtQeOgz8Dn1ToLhjPA3ubT2LLpVs/xE23QRbC/Wyz475ZhAcV gjrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/big40mQJPZUYL0hhY2GKn9zAZBw853eJB7EhVN3kls=; b=BeZ9L4nNjyH+E/tfp0L9S0yKciqAnv9GoD9lJdQABRUxw2w953F95LiGihOzBPR8By Dt3TWuriCCDCZ0Ux2qxkGdcfILyzIu84zNSm5zPfLNblUgza/09da0UMRYGMUTam8riB fxGE4KjODOVPM1lPEQxkl6EPa35vXeED0zvR8/0hSRQKVQ3NWKLOTnI9YrBzjNOBhMuM SZYDhsHdJ/TvOOiEtLogZDR6KlSjlEBhBYBF85gBgLXDd5tHs6K0l42vF5Yy5gju1TR5 5c1oPZBpGbztgv/Iv7dr6g8jx1IPy0/nfQt9Ele7WrlBUKoXXlDp7jsF0b+UbBbQ/aMx AxAw== X-Gm-Message-State: AGi0PuZpMGSUuLIkT3KC3Rj1iogJHtpPPl6WOJMa/gjGuDZB3UDvqQ2W XDN55qqSrKpfZv7kmL1jNhN7ScG8 X-Received: by 2002:ac2:4466:: with SMTP id y6mr2394099lfl.125.1586202483170; Mon, 06 Apr 2020 12:48:03 -0700 (PDT) Received: from [192.168.2.145] (ppp91-78-208-152.pppoe.mtu-net.ru. [91.78.208.152]) by smtp.googlemail.com with ESMTPSA id h23sm8817640ljg.13.2020.04.06.12.48.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Apr 2020 12:48:02 -0700 (PDT) Subject: Re: [RFC PATCH v6 6/9] media: tegra: Add Tegra210 Video input driver To: Sowjanya Komatineni , thierry.reding@gmail.com, jonathanh@nvidia.com, frankc@nvidia.com, hverkuil@xs4all.nl, sakari.ailus@iki.fi, helen.koike@collabora.com Cc: sboyd@kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <1585963507-12610-1-git-send-email-skomatineni@nvidia.com> <1585963507-12610-7-git-send-email-skomatineni@nvidia.com> From: Dmitry Osipenko Message-ID: <0809c1ae-57c9-508e-2959-724acc4ae068@gmail.com> Date: Mon, 6 Apr 2020 22:48:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <1585963507-12610-7-git-send-email-skomatineni@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 04.04.2020 04:25, Sowjanya Komatineni пишет: ... > +static int tegra_channel_capture_frame(struct tegra_vi_channel *chan, > + struct tegra_channel_buffer *buf) > +{ > + int err = 0; > + u32 thresh, value, frame_start, mw_ack_done; > + int bytes_per_line = chan->format.bytesperline; > + > + /* program buffer address by using surface 0 */ > + vi_csi_write(chan, TEGRA_VI_CSI_SURFACE0_OFFSET_MSB, > + (u64)buf->addr >> 32); > + vi_csi_write(chan, TEGRA_VI_CSI_SURFACE0_OFFSET_LSB, buf->addr); > + vi_csi_write(chan, TEGRA_VI_CSI_SURFACE0_STRIDE, bytes_per_line); > + > + /* > + * Tegra VI block interacts with host1x syncpt for synchronizing > + * programmed condition of capture state and hardware operation. > + * Frame start and Memory write acknowledge syncpts has their own > + * FIFO of depth 2. > + * > + * Syncpoint trigger conditions set through VI_INCR_SYNCPT register > + * are added to HW syncpt FIFO and when the HW triggers, syncpt > + * condition is removed from the FIFO and counter at syncpoint index > + * will be incremented by the hardware and software can wait for > + * counter to reach threshold to synchronize capturing frame with the > + * hardware capture events. > + */ > + > + /* increase channel syncpoint threshold for FRAME_START */ > + thresh = host1x_syncpt_incr_max(chan->frame_start_sp, 1); > + > + /* Program FRAME_START trigger condition syncpt request */ > + frame_start = VI_CSI_PP_FRAME_START(chan->portno); > + value = VI_CFG_VI_INCR_SYNCPT_COND(frame_start) | > + host1x_syncpt_id(chan->frame_start_sp); > + tegra_vi_write(chan, TEGRA_VI_CFG_VI_INCR_SYNCPT, value); > + > + /* increase channel syncpoint threshold for MW_ACK_DONE */ > + buf->mw_ack_sp_thresh = host1x_syncpt_incr_max(chan->mw_ack_sp, 1); > + > + /* Program MW_ACK_DONE trigger condition syncpt request */ > + mw_ack_done = VI_CSI_MW_ACK_DONE(chan->portno); > + value = VI_CFG_VI_INCR_SYNCPT_COND(mw_ack_done) | > + host1x_syncpt_id(chan->mw_ack_sp); > + tegra_vi_write(chan, TEGRA_VI_CFG_VI_INCR_SYNCPT, value); > + > + /* enable single shot capture */ > + vi_csi_write(chan, TEGRA_VI_CSI_SINGLE_SHOT, SINGLE_SHOT_CAPTURE); > + chan->capture_reqs++; > + > + /* wait for syncpt counter to reach frame start event threshold */ > + err = host1x_syncpt_wait(chan->frame_start_sp, thresh, > + TEGRA_VI_SYNCPT_WAIT_TIMEOUT, &value); What is the point of waiting for the frame-start? Why just not to wait for the frame-end?