Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1026754ybe; Wed, 4 Sep 2019 11:21:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfGWiIChBdNJGzmRJVRRKLQnFxlhTDcaHyla3RDp7v2tU/n8Yclb0+vyK+3bd0vjOOeY0s X-Received: by 2002:a65:690f:: with SMTP id s15mr35213090pgq.432.1567621271055; Wed, 04 Sep 2019 11:21:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567621271; cv=none; d=google.com; s=arc-20160816; b=OKkHUHM3The/DQMzLjPqnBlLUN6TRoCiPswcz0p0qYj9cXxNf2INL/ot8E1dKjhLT+ 3n3D6xpUMDjaiWB5ULpyitqUYx7qoRdqkDt0iwsGvEyWLpMKWzbGEuKzXIBpC+QOVXhy JMjjWbTKle4OXTSsJrlEhObCWiRtbgNHun5JF4/+aIhNlRRATMCqiyi6xtq2RfXr0j83 YFHFEPnE2ExtEXKbwnPimdQwsyMbP1QPAEX36FGrpYLbcaHkQYWBn+CKi4VZDTZJ1Hnh cFijBgBWqtpYeWJkDkY7Q1N5KHbXoLVZHbDcaM4v67GGUp22esN+BICCzdk8vMBcZ2P0 809g== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XJnwq6jGL7a4waB/HKUNxx/yiml9FQuxkZHHghs0EP0=; b=0B/BHpFj9o7IoPQ8YW8mu543a7MzhOIyZBm04/XPwlssadhNFjK8wAQhAn5isjLlli xvMpRQNlYk/wlVlcX8NOXXQ0cLHLotkd4gCrcODyIJTRfQaXydSrnkKyX0/qbGxjYtRE erSRvsdh/YgsWGtk4oHFhfEpNrkrpPVSMa9UgUkOgOu9srmfsluz78nJ6ysrNmJF0SI/ j1k/uwpl9P3jX96eblpvDDdrxCs9NvKjQNVRomcVqBjZkLS+Hwp0IN6DkVjwdpAd9rzI t3Cr/T382j1vypfFhkXtQ/yu6T+M1BPQIi1w7E7gGDO4WxdEMSC03oHnPTPYhQrNFL4d tIhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dc6UZbn0; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f12si6806098plt.227.2019.09.04.11.20.55; Wed, 04 Sep 2019 11:21:11 -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=@kernel.org header.s=default header.b=dc6UZbn0; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390009AbfIDSJ4 (ORCPT + 99 others); Wed, 4 Sep 2019 14:09:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:53262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732902AbfIDSJy (ORCPT ); Wed, 4 Sep 2019 14:09:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D39D22087E; Wed, 4 Sep 2019 18:09:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620593; bh=IcmDj8bh2bqAG2pVzViEbXko5VjVwooNZNzM1X2hjgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dc6UZbn0AQ6NHL9TIRmEQ9hY+kyF9nUxlHo83ph5gTOlzcexV+CgT3WIKxiLGojyE Jra+K90L7Pi9Gb2oi/ozDyw/Zx8eAD4GsgUctFLlVsGvHgmVVU5C/hDyemdqe6wx3X +vcF40uEt7VrNlNWWhMqA+Faa4oJs2PK3M8FNiYI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Laurent Pinchart , Peter Ujfalusi , Mauro Carvalho Chehab , Vinod Koul , Sasha Levin Subject: [PATCH 5.2 023/143] omap-dma/omap_vout_vrfb: fix off-by-one fi value Date: Wed, 4 Sep 2019 19:52:46 +0200 Message-Id: <20190904175314.976821188@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175314.206239922@linuxfoundation.org> References: <20190904175314.206239922@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit d555c34338cae844b207564c482e5a3fb089d25e ] The OMAP 4 TRM specifies that when using double-index addressing the address increases by the ES plus the EI value minus 1 within a frame. When a full frame is transferred, the address increases by the ES plus the frame index (FI) value minus 1. The omap-dma code didn't account for the 'minus 1' in the FI register. To get correct addressing, add 1 to the src_icg value. This was found when testing a hacked version of the media m2m-deinterlace.c driver on a Pandaboard. The only other source that uses this feature is omap_vout_vrfb.c, and that adds a + 1 when setting the dst_icg. This is a workaround for the broken omap-dma.c behavior. So remove the workaround at the same time that we fix omap-dma.c. I tested the omap_vout driver with a Beagle XM board to check that the '+ 1' in omap_vout_vrfb.c was indeed a workaround for the omap-dma bug. Signed-off-by: Hans Verkuil Reviewed-by: Laurent Pinchart Acked-by: Peter Ujfalusi Acked-by: Mauro Carvalho Chehab Link: https://lore.kernel.org/r/952e7f51-f208-9333-6f58-b7ed20d2ea0b@xs4all.nl Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/ti/omap-dma.c | 4 ++-- drivers/media/platform/omap/omap_vout_vrfb.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c index ba2489d4ea246..ba27802efcd0a 100644 --- a/drivers/dma/ti/omap-dma.c +++ b/drivers/dma/ti/omap-dma.c @@ -1234,7 +1234,7 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_interleaved( if (src_icg) { d->ccr |= CCR_SRC_AMODE_DBLIDX; d->ei = 1; - d->fi = src_icg; + d->fi = src_icg + 1; } else if (xt->src_inc) { d->ccr |= CCR_SRC_AMODE_POSTINC; d->fi = 0; @@ -1249,7 +1249,7 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_interleaved( if (dst_icg) { d->ccr |= CCR_DST_AMODE_DBLIDX; sg->ei = 1; - sg->fi = dst_icg; + sg->fi = dst_icg + 1; } else if (xt->dst_inc) { d->ccr |= CCR_DST_AMODE_POSTINC; sg->fi = 0; diff --git a/drivers/media/platform/omap/omap_vout_vrfb.c b/drivers/media/platform/omap/omap_vout_vrfb.c index 29e3f5da59c1f..11ec048929e80 100644 --- a/drivers/media/platform/omap/omap_vout_vrfb.c +++ b/drivers/media/platform/omap/omap_vout_vrfb.c @@ -253,8 +253,7 @@ int omap_vout_prepare_vrfb(struct omap_vout_device *vout, */ pixsize = vout->bpp * vout->vrfb_bpp; - dst_icg = ((MAX_PIXELS_PER_LINE * pixsize) - - (vout->pix.width * vout->bpp)) + 1; + dst_icg = MAX_PIXELS_PER_LINE * pixsize - vout->pix.width * vout->bpp; xt->src_start = vout->buf_phy_addr[vb->i]; xt->dst_start = vout->vrfb_context[vb->i].paddr[0]; -- 2.20.1