From patchwork Wed Nov 26 06:19:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takanari Hayama X-Patchwork-Id: 5384231 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 535C29F319 for ; Wed, 26 Nov 2014 06:20:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3332720160 for ; Wed, 26 Nov 2014 06:20:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F519201F5 for ; Wed, 26 Nov 2014 06:20:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752342AbaKZGUD (ORCPT ); Wed, 26 Nov 2014 01:20:03 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:59809 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752336AbaKZGUC (ORCPT ); Wed, 26 Nov 2014 01:20:02 -0500 Received: by mail-pa0-f47.google.com with SMTP id kq14so2207067pab.6 for ; Tue, 25 Nov 2014 22:20:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1cSZSDV74lyUqKSYHUkXDWs0LF/2i7ibzwKdSr6dQr0=; b=AMNliXX97LtxS2p5Mx9crHTaUQLPb0w9e8d3uAG6ug9SqL9XRNq+rGuZBWYbMJJvx4 JD9LWq9sZHMlNiK4rLpEEg67eAmH8VDWCSCssyHVWZx1WYEr4c9sbKSbAhRbVM/W5VYU ES0CO+55ozN847/PcHSpqmXsJoaUiMlkW7qH/PO76l2cXcAjO5E8/bYXD5dniWONCqwY RhH5MWrly0vNgdDI+OFENzP39O04BIYw6hwl4mCtnSFK6MFGuYM4aXb+Ii/opKkT+efX 3hIKuQmur8vUjax+AGXx6a8DNYsJQ4eYBD7SoQwrRwkr9kZm82KAL81WHK0B4HLP30Pe oWjg== X-Gm-Message-State: ALoCoQlw+x60Mbtku55BovnjcOmKdCj5HU4GNpgZ9xNevJcRjgRvlLIfb1DlbII94nkvd1cn3I/3 X-Received: by 10.68.203.195 with SMTP id ks3mr50352022pbc.104.1416982801126; Tue, 25 Nov 2014 22:20:01 -0800 (PST) Received: from tyrell.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id ir2sm3178301pbc.57.2014.11.25.22.19.58 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Nov 2014 22:20:00 -0800 (PST) From: Takanari Hayama To: linux-media@vger.kernel.org Cc: linux-sh@vger.kernel.org Subject: [PATCH 1/2] v4l: vsp1: Reset VSP1 RPF source address Date: Wed, 26 Nov 2014 15:19:51 +0900 Message-Id: <1416982792-11917-2-git-send-email-taki@igel.co.jp> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1416982792-11917-1-git-send-email-taki@igel.co.jp> References: <1416982792-11917-1-git-send-email-taki@igel.co.jp> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Source address of VSP1 RPF needs to be reset whenever crop offsets are recalculated. This correctly reflects a crop setting even VIDIOC_QBUF is called before VIDIOIC_STREAMON is called. Signed-off-by: Takanari Hayama --- drivers/media/platform/vsp1/vsp1_rpf.c | 15 +++++++++++++++ drivers/media/platform/vsp1/vsp1_rwpf.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c index d14d26b..79c0db8 100644 --- a/drivers/media/platform/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/vsp1/vsp1_rpf.c @@ -106,11 +106,22 @@ static int rpf_s_stream(struct v4l2_subdev *subdev, int enable) + crop->left * fmtinfo->bpp[0] / 8; pstride = format->plane_fmt[0].bytesperline << VI6_RPF_SRCM_PSTRIDE_Y_SHIFT; + + vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_Y, + rpf->buf_addr[0] + rpf->offsets[0]); + if (format->num_planes > 1) { rpf->offsets[1] = crop->top * format->plane_fmt[1].bytesperline + crop->left * fmtinfo->bpp[1] / 8; pstride |= format->plane_fmt[1].bytesperline << VI6_RPF_SRCM_PSTRIDE_C_SHIFT; + + vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C0, + rpf->buf_addr[1] + rpf->offsets[1]); + + if (format->num_planes > 2) + vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C1, + rpf->buf_addr[2] + rpf->offsets[1]); } vsp1_rpf_write(rpf, VI6_RPF_SRCM_PSTRIDE, pstride); @@ -179,6 +190,10 @@ static void rpf_vdev_queue(struct vsp1_video *video, struct vsp1_video_buffer *buf) { struct vsp1_rwpf *rpf = container_of(video, struct vsp1_rwpf, video); + int i; + + for (i = 0; i < 3; i++) + rpf->buf_addr[i] = buf->addr[i]; vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_Y, buf->addr[0] + rpf->offsets[0]); diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h b/drivers/media/platform/vsp1/vsp1_rwpf.h index 28dd9e7..1f98fe3 100644 --- a/drivers/media/platform/vsp1/vsp1_rwpf.h +++ b/drivers/media/platform/vsp1/vsp1_rwpf.h @@ -39,6 +39,8 @@ struct vsp1_rwpf { struct v4l2_rect crop; unsigned int offsets[2]; + + unsigned int buf_addr[3]; }; static inline struct vsp1_rwpf *to_rwpf(struct v4l2_subdev *subdev)