From patchwork Thu Jan 18 14:05:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 10173309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D3C41603B5 for ; Thu, 18 Jan 2018 14:06:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE5A31FFB2 for ; Thu, 18 Jan 2018 14:06:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0E4126E76; Thu, 18 Jan 2018 14:06:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A3121FFB2 for ; Thu, 18 Jan 2018 14:06:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932502AbeAROGI (ORCPT ); Thu, 18 Jan 2018 09:06:08 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:46946 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932497AbeAROGF (ORCPT ); Thu, 18 Jan 2018 09:06:05 -0500 Received: by mail-lf0-f66.google.com with SMTP id q194so15337258lfe.13 for ; Thu, 18 Jan 2018 06:06:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:user-agent:date:to:cc:subject:mime-version :content-disposition; bh=Ujbu1I01bdOHzvQX9ezf9Y5EQaMlXX5U/tIxjBpFT0w=; b=Ih0UOZYmetEg3wD/v1g4kR1e3rNgr1BAtAEIMWKByrZvN4LYi6kc8Y6xLynPXldyp0 nrMQ+15bT6n2BmBFLhGzbvlErTt96G32ziTbW+571T+sJWM3vfyxWwGKK3ngR42yaBfO pvS0JKfAwWOl6wTetHPihITdHBzMtXYhrUoQANXs7ZhfL5qVtWeAxfAP4Lkj/4Y3P4rc kCVc2KeutF/L5xO15OgM2hJ6uXrx9Z2pBRt7cMxG7shQ8FhDybA35x112eFacadqKE2l gNZrmYeXeV7g+Zyz+o4pj6VLJ3f9LagQvl7BnLrrdaP1g3XUUX8Q+dawFwJd28oIV2oI OAnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:user-agent:date:to:cc:subject :mime-version:content-disposition; bh=Ujbu1I01bdOHzvQX9ezf9Y5EQaMlXX5U/tIxjBpFT0w=; b=ELHEU8w/jru6zR8Z7yYdVXKMe1YSQFCPeTN4yPWntP/f0OqAn+pM6ze0pxbzMaLWbD 2jhE2Mlwqz88IKqNgTKxXrG8l+zEDDg8LkKZGBImeIb9OF4LQClKeP8QFmGBT+/UE6CY rEA/D7fXp9R0NVnr5KtJMsijJitK0M1+EfaqZIFBc22ehqPf0OZYjiOA7TVgJS/8mXSs FhWI92a65Gjdv1EkPuua5EgoA4fg1Jj4OrSTcjkWuBDZpgBV+TIfVQI9EHcSnZXkHLlH eUX0EORUSxI2xCpNNa4D8viIFl03nHDQRY88Gt9ohLmkgUgnwkVe1i73E1nF5I66SGIY ISBA== X-Gm-Message-State: AKwxytcWpQBA+RsczQ/u8q22BtxWQTYQJkaiprFzqPrAwrUIXeBKyH17 g1QDHDhU75PZrsVssvRf2EnyZA== X-Google-Smtp-Source: ACJfBosAmeZCe2P+kIAXZbdvUqo0k4KAlqdpzrYgEJjtJB2Dv7hktnJclYHCpLeXii2es3E62W6eqQ== X-Received: by 10.25.45.81 with SMTP id t17mr9973436lft.126.1516284364211; Thu, 18 Jan 2018 06:06:04 -0800 (PST) Received: from wasted.cogentembedded.com ([31.173.85.244]) by smtp.gmail.com with ESMTPSA id d89sm1319625ljf.85.2018.01.18.06.06.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jan 2018 06:06:02 -0800 (PST) From: Sergei Shtylyov X-Google-Original-From: "Sergei Shtylyov" Received: by wasted.cogentembedded.com (sSMTP sendmail emulation); Thu, 18 Jan 2018 17:06:00 +0300 Message-Id: <20180118140600.363149670@cogentembedded.com> User-Agent: quilt/0.64 Date: Thu, 18 Jan 2018 17:05:51 +0300 To: Laurent Pinchart , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org Cc: Sergei Shtylyov Subject: [PATCH v3] vsp1: fix video output on R8A77970 MIME-Version: 1.0 Content-Disposition: inline; filename=vsp1-fix-video-output-on-R8A77970-v3.patch Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit d455b45f8393 ("v4l: vsp1: Add support for new VSP2-BS, VSP2-DL, and VSP2-D instances") added support for the VSP2-D found in the R-Car V3M (R8A77970) but the video output that VSP2-D sends to DU has a greenish garbage-like line repeated every 8 screen rows. It turns out that R-Car V3M has the LIF0 buffer attribute register that you need to set to a non- default value in order to get rid of the output artifacts... Based on the original (and large) patch by Daisuke Matsushita . Fixes: d455b45f8393 ("v4l: vsp1: Add support for new VSP2-BS, VSP2-DL and VSP2-D instances") Signed-off-by: Sergei Shtylyov Reviewed-by: Laurent Pinchart --- This patch is against the 'media_tree.git' repo's 'fixes' branch. Changes in version 3: - reworded the comment in lif_configure(); - reworded the patch description. Changes in version 2: - added a comment before the V3M SoC check; - fixed indetation in that check; - reformatted the patch description. drivers/media/platform/vsp1/vsp1_lif.c | 15 +++++++++++++++ drivers/media/platform/vsp1/vsp1_regs.h | 5 +++++ 2 files changed, 20 insertions(+) Index: media_tree/drivers/media/platform/vsp1/vsp1_lif.c =================================================================== --- media_tree.orig/drivers/media/platform/vsp1/vsp1_lif.c +++ media_tree/drivers/media/platform/vsp1/vsp1_lif.c @@ -155,6 +155,21 @@ static void lif_configure(struct vsp1_en (obth << VI6_LIF_CTRL_OBTH_SHIFT) | (format->code == 0 ? VI6_LIF_CTRL_CFMT : 0) | VI6_LIF_CTRL_REQSEL | VI6_LIF_CTRL_LIF_EN); + + /* + * On R-Car V3M the LIF0 buffer attribute register has to be set + * to a non-default value to guarantee proper operation (otherwise + * artifacts may appear on the output). The value required by + * the manual is not explained but is likely a buffer size or + * threshold... + */ + if ((entity->vsp1->version & + (VI6_IP_VERSION_MODEL_MASK | VI6_IP_VERSION_SOC_MASK)) == + (VI6_IP_VERSION_MODEL_VSPD_V3 | VI6_IP_VERSION_SOC_V3M)) { + vsp1_lif_write(lif, dl, VI6_LIF_LBA, + VI6_LIF_LBA_LBA0 | + (1536 << VI6_LIF_LBA_LBA1_SHIFT)); + } } static const struct vsp1_entity_operations lif_entity_ops = { Index: media_tree/drivers/media/platform/vsp1/vsp1_regs.h =================================================================== --- media_tree.orig/drivers/media/platform/vsp1/vsp1_regs.h +++ media_tree/drivers/media/platform/vsp1/vsp1_regs.h @@ -693,6 +693,11 @@ #define VI6_LIF_CSBTH_LBTH_MASK (0x7ff << 0) #define VI6_LIF_CSBTH_LBTH_SHIFT 0 +#define VI6_LIF_LBA 0x3b0c +#define VI6_LIF_LBA_LBA0 (1 << 31) +#define VI6_LIF_LBA_LBA1_MASK (0xfff << 16) +#define VI6_LIF_LBA_LBA1_SHIFT 16 + /* ----------------------------------------------------------------------------- * Security Control Registers */