From patchwork Fri Mar 6 10:32:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 210734 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEEC9C10F25 for ; Fri, 6 Mar 2020 10:32:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 91D4D2084E for ; Fri, 6 Mar 2020 10:32:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Gy4P4bU4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726397AbgCFKc6 (ORCPT ); Fri, 6 Mar 2020 05:32:58 -0500 Received: from mail-wr1-f50.google.com ([209.85.221.50]:44715 "EHLO mail-wr1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726010AbgCFKc6 (ORCPT ); Fri, 6 Mar 2020 05:32:58 -0500 Received: by mail-wr1-f50.google.com with SMTP id n7so1699049wrt.11; Fri, 06 Mar 2020 02:32:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bHB1Xy6VOidIGsnleJqs9EIJkLYHbOLvhPuZrlcbUu8=; b=Gy4P4bU4rbiuS43UuostQiXF/kYw56KYYnF+O7TrPNf32Kagjibmp341v+XaR498za X7ePpvqr+iXEwX+wkPK1OMwgsGjaZ4YWACCduGH4eKPvUxaECu5nMkTxVkAzaO3Fwny/ N72T1NI6mt+9VhUr9y0mIGnMltoJh5pSLcleJYC6wmFFsGjz25o0uBqKoiZeogf3VZbK WF9vEEOQIbRHlWIF/gqROVj/SLP37GzV2SJnAnZ2loYKk71pDlSCyOm8mUnr++Yu+M6Q F2sGIFODpJBRAlsVZNO/lf0T7US7CTveoMtH8powyKzVQbLFTxmGwhvW+4Xhp5KIHRwv IVAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bHB1Xy6VOidIGsnleJqs9EIJkLYHbOLvhPuZrlcbUu8=; b=Tr7/eTEDEgGkAxkMz0ZM1JFU6myJQfjfyxzWv3ScEdZQUUPkSV2fikVbJ1ZGd35Qrc qnRaw52htV8FNid6ITdhRaFiU0phT8VDorgRjWnAnA/pYrS+VeeYqKlfo71ug8MuEafV QrqNBBiQCYPE47VqVcofztzQf8lUFtkbRS4DBnSD0j8O9FLuhUFfR8UXQcxfpULOetch xqVOUIlVG1haBjdKX/jbkUaGUDBiGxIzUfbQUTnduW2orFJkKWnaT1UAzbDT8fgDC5gB ixjYZnW4UsChFs6W5n7JoR35P1RNF0fg+JW5PuE01EY2mHdkHTkOwltjIWLGs+S48XQf P8Ng== X-Gm-Message-State: ANhLgQ3cGtlgG44nXBXqDC0QDXLFRP0UutNlXPUgFA7Ef64Pnb0QqJ/6 8l1Qz8X7Tjl7V4JWXXbc9/o= X-Google-Smtp-Source: ADFU+vsJam9jl66mjSXv2NlXjJ93lPRsHpgAcMdzpBH5dmAdY0Z4Op3KPBYrM0hTg5jSU2JX7v6SBw== X-Received: by 2002:adf:f84d:: with SMTP id d13mr3457858wrq.92.1583490775590; Fri, 06 Mar 2020 02:32:55 -0800 (PST) Received: from prasmi.home ([2a00:23c8:2510:d000:7009:9d38:36e8:7030]) by smtp.gmail.com with ESMTPSA id t1sm1251111wrq.36.2020.03.06.02.32.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2020 02:32:55 -0800 (PST) From: Lad Prabhakar X-Google-Original-From: Lad Prabhakar To: Dave Stevenson , Mauro Carvalho Chehab , Sakari Ailus Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Lad Prabhakar Subject: [PATCH v2 1/3] media: i2c: imx219: Fix power sequence Date: Fri, 6 Mar 2020 10:32:44 +0000 Message-Id: <20200306103246.22213-2-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200306103246.22213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20200306103246.22213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org When supporting Rpi Camera v2 Module on the RZ/G2E, found the driver had some issues with rcar mipi-csi driver. The sensor never entered into LP-11 state. The powerup sequence in the datasheet[1] shows the sensor entering into LP-11 in streaming mode, so to fix this issue transitions are performed from "streaming -> standby" in the probe() after power up. With this commit the sensor is able to enter LP-11 mode during power up, as expected by some CSI-2 controllers. [1] https://publiclab.org/system/images/photos/000/023/294/original/ RASPBERRY_PI_CAMERA_V2_DATASHEET_IMX219PQH5_7.0.0_Datasheet_XXX.PDF Signed-off-by: Lad Prabhakar --- drivers/media/i2c/imx219.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index f1effb5a5f66..16010ca1781a 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -1224,6 +1224,23 @@ static int imx219_probe(struct i2c_client *client) /* Set default mode to max resolution */ imx219->mode = &supported_modes[0]; + /* sensor doesn't enter LP-11 state upon power up until and unless + * streaming is started, so upon power up switch the modes to: + * streaming -> standby + */ + ret = imx219_write_reg(imx219, IMX219_REG_MODE_SELECT, + IMX219_REG_VALUE_08BIT, IMX219_MODE_STREAMING); + if (ret < 0) + goto error_power_off; + usleep_range(100, 110); + + /* put sensor back to standby mode */ + ret = imx219_write_reg(imx219, IMX219_REG_MODE_SELECT, + IMX219_REG_VALUE_08BIT, IMX219_MODE_STANDBY); + if (ret < 0) + goto error_power_off; + usleep_range(100, 110); + ret = imx219_init_controls(imx219); if (ret) goto error_power_off; From patchwork Fri Mar 6 10:32:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 210733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43308C10F27 for ; Fri, 6 Mar 2020 10:33:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D29820866 for ; Fri, 6 Mar 2020 10:33:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ujLkorQc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726932AbgCFKdE (ORCPT ); Fri, 6 Mar 2020 05:33:04 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36395 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726010AbgCFKdD (ORCPT ); Fri, 6 Mar 2020 05:33:03 -0500 Received: by mail-wr1-f67.google.com with SMTP id s17so814565wrs.3; Fri, 06 Mar 2020 02:33:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IdLE2j64bFa4rh3+Jd1RdnEDeNlfCI8zWa3p+SeV29c=; b=ujLkorQcBX8hcrG98taZedJFwKvskdRzpsQ1RV+PJzTmPN5+fSaWz6lmQmRfRnfrHj 4Nf3fxcAHvuyvOIrLKPnabmT9RavWcclt5jSxQA5Chllnfc6poIq87YG5Dy8zwueyogB y5szaR0sehXRTcQsZ5wax8sSLjKYcu/2ddtxWMKku8XUsPBg7Uhq+QM5Zr+Jb6zzgrAc rK44nQv+tT/bK4gsb/QAORfZI+pYFen0U8BOA47fyWpcgYROUBAWpgGa/hPgUvcpx0sn 1mZt7FrUO4ES1KwFJVMrwJhSQa9VhQRVstUdAoArWydDjrlwMRebItfudS8CXBdb+7bp Vy4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IdLE2j64bFa4rh3+Jd1RdnEDeNlfCI8zWa3p+SeV29c=; b=szStdn+zslE5ZaY1PgoV1OrYn6z2GlRWH9AU+ie/UkwnD13NuaNG/ourtH/zhw5Heo YAuycuzgkV8NowT0MSCi3q10gXjVuyAjC6ZTrN3uG4m01zZfJf3KWUyN0Y1DwIN5iCJF hpgtlsJW0tB5hqJmdytfq0vXmHnQElVoyzc6EpQCCEIb8eEfNv9LFfqPdQt0Z7t1uARZ aKcae0WtNkNnvtI9ZkkeltDBTuHlvprEeeEh3D4y4VEd++5q9n5mMfMsOeR8hsRSJXpx 44cxr77tX//oet1caB/DQGent+KPWV3AiETOdN7mRJUBuUgZpFzo7FKPHYi9Fw7C21Dj izXw== X-Gm-Message-State: ANhLgQ3sjttJI3Wf8+ZKJV017ikJnzdRKzrl3XTc+cX5m7lPwWXQFCam qKQ0WB2qn9LjTI736Anp8rU= X-Google-Smtp-Source: ADFU+vuXq8Ij6x/72q7Xw0DmoVNy8vOnfQg8Q9o/HXVPBscO1O7mCKJ0qHN5UStB1ASG9+EN0Oormg== X-Received: by 2002:adf:fa07:: with SMTP id m7mr3360708wrr.384.1583490782202; Fri, 06 Mar 2020 02:33:02 -0800 (PST) Received: from prasmi.home ([2a00:23c8:2510:d000:7009:9d38:36e8:7030]) by smtp.gmail.com with ESMTPSA id t1sm1251111wrq.36.2020.03.06.02.33.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2020 02:33:01 -0800 (PST) From: Lad Prabhakar X-Google-Original-From: Lad Prabhakar To: Dave Stevenson , Mauro Carvalho Chehab , Sakari Ailus Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Lad Prabhakar Subject: [PATCH v2 3/3] media: i2c: imx219: Add support for cropped 640x480 resolution Date: Fri, 6 Mar 2020 10:32:46 +0000 Message-Id: <20200306103246.22213-4-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200306103246.22213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20200306103246.22213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This patch adds mode table entry for capturing cropped 640x480 resolution Signed-off-by: Lad Prabhakar --- drivers/media/i2c/imx219.c | 72 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index f96f3ce9fd85..6a86f500ec48 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -54,6 +54,7 @@ #define IMX219_VTS_15FPS 0x0dc6 #define IMX219_VTS_30FPS_1080P 0x06e3 #define IMX219_VTS_30FPS_BINNED 0x06e3 +#define IMX219_VTS_30FPS_640x480 0x06e3 #define IMX219_VTS_MAX 0xffff #define IMX219_VBLANK_MIN 4 @@ -142,8 +143,8 @@ struct imx219_mode { /* * Register sets lifted off the i2C interface from the Raspberry Pi firmware - * driver. - * 3280x2464 = mode 2, 1920x1080 = mode 1, and 1640x1232 = mode 4. + * driver for resolutions 3280x2464, 1920x1080 and 1640x1232. + * 3280x2464 = mode 2, 1920x1080 = mode 1, 1640x1232 = mode 4, 640x480 = mode 1. */ static const struct imx219_reg mode_3280x2464_regs[] = { {0x0100, 0x00}, @@ -318,6 +319,63 @@ static const struct imx219_reg mode_1640_1232_regs[] = { {0x0163, 0x78}, }; +static const struct imx219_reg mode_640_480_regs[] = { + {0x0100, 0x00}, + {0x30eb, 0x05}, + {0x30eb, 0x0c}, + {0x300a, 0xff}, + {0x300b, 0xff}, + {0x30eb, 0x05}, + {0x30eb, 0x09}, + {0x0114, 0x01}, + {0x0128, 0x00}, + {0x012a, 0x18}, + {0x012b, 0x00}, + {0x0162, 0x0d}, + {0x0163, 0x78}, + {0x0164, 0x03}, + {0x0165, 0xe8}, + {0x0166, 0x08}, + {0x0167, 0xe7}, + {0x0168, 0x02}, + {0x0169, 0xf0}, + {0x016a, 0x06}, + {0x016b, 0xaf}, + {0x016c, 0x02}, + {0x016d, 0x80}, + {0x016e, 0x01}, + {0x016f, 0xe0}, + {0x0170, 0x01}, + {0x0171, 0x01}, + {0x0174, 0x03}, + {0x0175, 0x03}, + {0x0301, 0x05}, + {0x0303, 0x01}, + {0x0304, 0x03}, + {0x0305, 0x03}, + {0x0306, 0x00}, + {0x0307, 0x39}, + {0x030b, 0x01}, + {0x030c, 0x00}, + {0x030d, 0x72}, + {0x0624, 0x06}, + {0x0625, 0x68}, + {0x0626, 0x04}, + {0x0627, 0xd0}, + {0x455e, 0x00}, + {0x471e, 0x4b}, + {0x4767, 0x0f}, + {0x4750, 0x14}, + {0x4540, 0x00}, + {0x47b4, 0x14}, + {0x4713, 0x30}, + {0x478b, 0x10}, + {0x478f, 0x10}, + {0x4793, 0x10}, + {0x4797, 0x0e}, + {0x479b, 0x0e}, +}; + static const char * const imx219_test_pattern_menu[] = { "Disabled", "Color Bars", @@ -424,6 +482,16 @@ static const struct imx219_mode supported_modes[] = { .regs = mode_1640_1232_regs, }, }, + { + /* 640x480 30fps mode */ + .width = 640, + .height = 480, + .vts_def = IMX219_VTS_30FPS_640x480, + .reg_list = { + .num_of_regs = ARRAY_SIZE(mode_640_480_regs), + .regs = mode_640_480_regs, + }, + }, }; struct imx219 {