From patchwork Thu May 24 21:03:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10425537 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 53BC2602D8 for ; Thu, 24 May 2018 21:03:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D4BC285A5 for ; Thu, 24 May 2018 21:03:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31F9D294BC; Thu, 24 May 2018 21:03:32 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 D5149285A5 for ; Thu, 24 May 2018 21:03:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967247AbeEXVD3 (ORCPT ); Thu, 24 May 2018 17:03:29 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:49802 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967154AbeEXVD2 (ORCPT ); Thu, 24 May 2018 17:03:28 -0400 Received: from avalon.bb.dnainternet.fi (unknown [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 396EB1AC9; Thu, 24 May 2018 23:03:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1527195807; bh=fbJf28sNNvAs6J3rmpiSHxdYQS0HyEuqLBnLXgkLxBU=; h=From:To:Cc:Subject:Date:From; b=AzFPoTzk1PCi/vepgbVJ9j2LYG0XIG07j9+eosvJx1yDfHJVtBIJQYywQ8JyB/kWf B0PR02WN8roAOC/iwC+aWskUa5ts5nvByJi5MU+3zKF17pawcjRlS48dubS3PwrS66 QPUmzaRhPqBkToFP3SfETyZnlXCa+4700dbp9FXA= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Kieran Bingham , Koji Matsuoka Subject: [PATCH] v4l: vsp1: Update LIF buffer thresholds Date: Fri, 25 May 2018 00:03:22 +0300 Message-Id: <20180524210322.11402-1-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.16.1 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 The LIF module has a data buffer to accommodate clock rate differences between the DU and the VSP. Several programmable threshold values control DU start of frame notification by the VSP and VSP clock stop/resume. The R-Car Gen2 and Gen3 datasheets recommend values for the different SoCs. Update the driver to use the recommended values for optimal operation. Based on a BSP patch from Koji Matsuoka , with Gen2 and V3H/V3M updates. Signed-off-by: Laurent Pinchart --- drivers/media/platform/vsp1/vsp1_lif.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_lif.c b/drivers/media/platform/vsp1/vsp1_lif.c index 0cb63244b21a..d313fa19eecb 100644 --- a/drivers/media/platform/vsp1/vsp1_lif.c +++ b/drivers/media/platform/vsp1/vsp1_lif.c @@ -88,14 +88,35 @@ static void lif_configure_stream(struct vsp1_entity *entity, { const struct v4l2_mbus_framefmt *format; struct vsp1_lif *lif = to_lif(&entity->subdev); - unsigned int hbth = 1300; - unsigned int obth = 400; - unsigned int lbth = 200; + unsigned int hbth; + unsigned int obth; + unsigned int lbth; format = vsp1_entity_get_pad_format(&lif->entity, lif->entity.config, LIF_PAD_SOURCE); - obth = min(obth, (format->width + 1) / 2 * format->height - 4); + switch (entity->vsp1->version & VI6_IP_VERSION_SOC_MASK) { + case VI6_IP_VERSION_MODEL_VSPD_GEN2: + case VI6_IP_VERSION_MODEL_VSPD_V2H: + hbth = 1536; + obth = min(128, (format->width + 1) / 2 * format->height - 4); + lbth = 1520; + break; + + case VI6_IP_VERSION_MODEL_VSPDL_GEN3: + case VI6_IP_VERSION_MODEL_VSPD_V3: + hbth = 0; + obth = 1500; + lbth = 0; + break; + + case VI6_IP_VERSION_MODEL_VSPD_GEN3: + default: + hbth = 0; + obth = 3000; + lbth = 0; + break; + } vsp1_lif_write(lif, dlb, VI6_LIF_CSBTH, (hbth << VI6_LIF_CSBTH_HBTH_SHIFT) |