From patchwork Sun Jul 31 19:42:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 9253599 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 719DF60865 for ; Mon, 1 Aug 2016 01:29:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6397028405 for ; Mon, 1 Aug 2016 01:29:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 584982840E; Mon, 1 Aug 2016 01:29:35 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBB5128405 for ; Mon, 1 Aug 2016 01:29:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4BAD46E194; Mon, 1 Aug 2016 01:29:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 575DE6E181 for ; Sun, 31 Jul 2016 19:42:47 +0000 (UTC) Received: by mail-pf0-x244.google.com with SMTP id g202so8922342pfb.1 for ; Sun, 31 Jul 2016 12:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qsauFS2PVOssG2Mf9Hond9iUT5PCMtUzDqso+aO8cIU=; b=TZRoVwnaK2RXkPAWqVeHwzWLnEk27N2+GIdqvNxny0hZeKOWcdZma1RMoDL5ir1Sbt Sh8wvGznX27jxXCjfClrRrSVYcNeEqT5fsW6JfWDdKkjqdEjf9yxRKaFa5AX2t5avKGv uzAyA5YGcg1LwS2+DWAuCaSLV9SncCb2X636WwKk53Nk0l5BNglZ7wbrMHgg0Nh9veqd +N5lXs7KlQuLqcFrwScNoJCARaakEYbN1yMwAVAi1fHj4Ro4hYjMpRcNZuEC+tM4kcf0 JRDAI5piSzMEbCMDGFiIq6mYOmDx/JQGCbjX4z2y2kenhcUo1PP+lanbLN1fkXp7wgFa OTsg== 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=qsauFS2PVOssG2Mf9Hond9iUT5PCMtUzDqso+aO8cIU=; b=d9qB1d3b2cAo28cL9DxX+EB8bjaxK0ZB1rLXDPL5nC/+zUxzz5gN9l5qRvubj3cB50 AcOF5E5mabKQtyeZu3fXak2GKP4/xjTZLXH/pAkBJcl4dLpBNxJTqWS9NbhUWF2ghQZE AqyXyGFqo6DOimZDtRVSC4XGZ/N6gVxcIYZinoCrn2EGQOXAtUlhJPjXKfStsd+UK4fW 78zwkoWwby1NjamSglGZc/9QLmcBbAH96sCA/2glRb1YDZno4chwgHZHf3PH0xacuCBd SN9X+uIR6DgcOkSGh8KbCSO7YPx46W3oasAO8EJaOVejmq3FvJi4Ks10QL39e1/nEkSr 5M0g== X-Gm-Message-State: AEkooutdNbLYCXzmu6Hwkgx3IRV+2bZ4zRQgg3lTJ3hUSGJRsHdh+FJC+gFOv5E64NZRWw== X-Received: by 10.98.50.2 with SMTP id y2mr88893781pfy.138.1469994165534; Sun, 31 Jul 2016 12:42:45 -0700 (PDT) Received: from mothership.sklembedded.com (c-73-241-2-21.hsd1.ca.comcast.net. [73.241.2.21]) by smtp.googlemail.com with ESMTPSA id wp4sm39906381pab.15.2016.07.31.12.42.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 31 Jul 2016 12:42:44 -0700 (PDT) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: p.zabel@pengutronix.de, plagnioj@jcrosoft.com, tomi.valkeinen@ti.com Subject: [PATCH v3 05/12] gpu: ipu-v3: set correct full sensor frame for PAL/NTSC Date: Sun, 31 Jul 2016 12:42:20 -0700 Message-Id: <1469994147-17549-6-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469994147-17549-1-git-send-email-steve_longerbeam@mentor.com> References: <1469994147-17549-1-git-send-email-steve_longerbeam@mentor.com> X-Mailman-Approved-At: Mon, 01 Aug 2016 01:28:21 +0000 Cc: linux-fbdev@vger.kernel.org, Steve Longerbeam , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Set the sensor full frame based on whether the passed in mbus_fmt is 720x480 (NTSC) or 720x576 (PAL). Signed-off-by: Steve Longerbeam --- v3: no changes v2: no changes --- drivers/gpu/ipu-v3/ipu-csi.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c index 06631ac..641ed76 100644 --- a/drivers/gpu/ipu-v3/ipu-csi.c +++ b/drivers/gpu/ipu-v3/ipu-csi.c @@ -365,10 +365,14 @@ int ipu_csi_init_interface(struct ipu_csi *csi, { struct ipu_csi_bus_config cfg; unsigned long flags; - u32 data = 0; + u32 width, height, data = 0; fill_csi_bus_cfg(&cfg, mbus_cfg, mbus_fmt); + /* set default sensor frame width and height */ + width = mbus_fmt->width; + height = mbus_fmt->height; + /* Set the CSI_SENS_CONF register remaining fields */ data |= cfg.data_width << CSI_SENS_CONF_DATA_WIDTH_SHIFT | cfg.data_fmt << CSI_SENS_CONF_DATA_FMT_SHIFT | @@ -386,11 +390,6 @@ int ipu_csi_init_interface(struct ipu_csi *csi, ipu_csi_write(csi, data, CSI_SENS_CONF); - /* Setup sensor frame size */ - ipu_csi_write(csi, - (mbus_fmt->width - 1) | ((mbus_fmt->height - 1) << 16), - CSI_SENS_FRM_SIZE); - /* Set CCIR registers */ switch (cfg.clk_mode) { @@ -408,11 +407,12 @@ int ipu_csi_init_interface(struct ipu_csi *csi, * Field1BlankEnd = 0x7, Field1BlankStart = 0x3, * Field1ActiveEnd = 0x5, Field1ActiveStart = 0x1 */ + height = 625; /* framelines for PAL */ + ipu_csi_write(csi, 0x40596 | CSI_CCIR_ERR_DET_EN, CSI_CCIR_CODE_1); ipu_csi_write(csi, 0xD07DF, CSI_CCIR_CODE_2); ipu_csi_write(csi, 0xFF0000, CSI_CCIR_CODE_3); - } else if (mbus_fmt->width == 720 && mbus_fmt->height == 480) { /* * NTSC case @@ -422,6 +422,8 @@ int ipu_csi_init_interface(struct ipu_csi *csi, * Field1BlankEnd = 0x6, Field1BlankStart = 0x2, * Field1ActiveEnd = 0x4, Field1ActiveStart = 0 */ + height = 525; /* framelines for NTSC */ + ipu_csi_write(csi, 0xD07DF | CSI_CCIR_ERR_DET_EN, CSI_CCIR_CODE_1); ipu_csi_write(csi, 0x40596, CSI_CCIR_CODE_2); @@ -447,6 +449,10 @@ int ipu_csi_init_interface(struct ipu_csi *csi, break; } + /* Setup sensor frame size */ + ipu_csi_write(csi, (width - 1) | ((height - 1) << 16), + CSI_SENS_FRM_SIZE); + dev_dbg(csi->ipu->dev, "CSI_SENS_CONF = 0x%08X\n", ipu_csi_read(csi, CSI_SENS_CONF)); dev_dbg(csi->ipu->dev, "CSI_ACT_FRM_SIZE = 0x%08X\n",