From patchwork Tue Jun 14 22:49:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 9177149 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 5203B60868 for ; Tue, 14 Jun 2016 22:53:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 425D628307 for ; Tue, 14 Jun 2016 22:53:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C01528340; Tue, 14 Jun 2016 22:53:27 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham 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 B6EB528338 for ; Tue, 14 Jun 2016 22:53:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752738AbcFNWxW (ORCPT ); Tue, 14 Jun 2016 18:53:22 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36650 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752963AbcFNWvM (ORCPT ); Tue, 14 Jun 2016 18:51:12 -0400 Received: by mail-pf0-f196.google.com with SMTP id 62so298593pfd.3 for ; Tue, 14 Jun 2016 15:51:12 -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=P3DdxDCDsDs3pbb9ytZvD5oQLiJTr19lAZTiSyNWz7k=; b=u9WvtNCEkySdwg3Ar7XJna2LxSM3EcrWs6hiXCrgJ6kzQrtNpuz7tTomHHG4M7uFRb YjGBYT1Ay4n6ZAZh2h2q4wmVx/PlfuUt9C46nR1sYrWhqDuX2uX+zQW+TtxkvFlmvE+z Da5H3yjwdLY9rFcPzJV8EzwHBlxc6Elx4X1Ra6f0v9yRj4+5WoQK0eXTzhrXeznJZc3n U0js5FdICsbnSSYB1hr8MlErm/0JvwojZSg0/srzB3shyNgrLJW45Lc7pGJPlWHc23Uw fKYgVpAhQbeKvdh3Bp55b4l9GVHuB3lAxXvPGGjphDoiZiGOXnZ7J2eOskYJ+Q8Qmer+ xGpg== 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=P3DdxDCDsDs3pbb9ytZvD5oQLiJTr19lAZTiSyNWz7k=; b=hGct2CC3JHh8PXUSZsb9Sv9u3d2CaXbTTNx0hCKA/Auqh4McmOZcpTO5XuwyUc8cmC K5OnIIAqkaMubb058Smw/FtgkursW/DaisClHGMV3Jvtt+353lXPUwiumIhvPMR3MnWO yOs0LQUC7R5F01rl8iqIMm562CIsZk6AIINS2zOYkhpClK6D82K9vkn/oLrv/vuqd8xk tjDAgsvuokyy7I2HU0mQPmwHIYrjYUOQ2yPyWg7IAlGC3jiFZGKNMB+P8HiOe+WUbweb z+ph1SBySpSo13oMAi8iA4t9nYRD244ORMust54rcXkbJUPg5Npj58d8tBmhioS1Im/5 5XCg== X-Gm-Message-State: ALyK8tJr1QPOOIJlko7WYwHAtGXRVQCXJBMUZjJi+W1TuxAY9EW9vl8+bshv3QPh8NZFEA== X-Received: by 10.98.16.156 with SMTP id 28mr84996pfq.82.1465944671630; Tue, 14 Jun 2016 15:51:11 -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 v184sm47829999pfb.24.2016.06.14.15.51.10 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 14 Jun 2016 15:51:11 -0700 (PDT) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Steve Longerbeam Subject: [PATCH 10/38] gpu: ipu-v3: set correct full sensor frame for PAL/NTSC Date: Tue, 14 Jun 2016 15:49:06 -0700 Message-Id: <1465944574-15745-11-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465944574-15745-1-git-send-email-steve_longerbeam@mentor.com> References: <1465944574-15745-1-git-send-email-steve_longerbeam@mentor.com> 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 Set the sensor full frame based on whether the passed in mbus_fmt is 720x480 (NTSC) or 720x576 (PAL). Signed-off-by: Steve Longerbeam --- 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 336dc06..07c7091 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",