Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp678028ybh; Tue, 10 Mar 2020 06:19:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuNSDEIRnKGSthOqGCaStThBkjfcTMJu2BQ2rxGe5UYII43hILX4I5I0AYG/J/gKMtJtwpz X-Received: by 2002:a9d:d0f:: with SMTP id 15mr10386714oti.161.1583846387356; Tue, 10 Mar 2020 06:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583846387; cv=none; d=google.com; s=arc-20160816; b=Km4Wo+VVSg6Mp2xH65tCGUkz1pG6e7Vu4ni9OhMMGYUieSjt/sMI4lId7HJ6DxzDPR afTgSSntT+lW6+ZLd6EF7iBxgiXwDuYHv9cJ4JpvogrlONrlmvnRZInR2AMtAHwrK8fU rVLemiSE7QXLC3e7u9kfenTWkRa9JckGgXvHHwHBeRdwuZM789A0i3H3m13ZwfAZTL4O TvSqgGmN2NBcFaJ5IBF6Bk/z2kI+eOfxoYAQOedHQ3CtD+cQRGNN/C8ONgVAab0H7uL/ vSd2Kq33o1I+IzXcfaSZfIK8e57L2vKUSpmHFLEvhbSuagZBPJOaPjLS+BiM+Dj3kjwK 83NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=J7FEk3PbwjGI3wapk5n/dWiEHCzEn7yCKdv5kGVUv7g=; b=FLeSz0FZzSVAHDvjUh9s4TrMvEhrC45O3hWy6IvB1qR97NyaJHdodMofMjpHoW6cH9 dXv75FPMKoE26Di1B15Je9OLFpsjIE3zMZqeUCb1PRSnf92k1WYGYvi6n5ETKNt9HjJH yzHCRxG3pWFZ0SKwTK5Bkz4MtMYyAn92Meh+kgr1eufS69zHN2G9JffwA7w8wHO78erR IjsqFNHxOu9y+woxBVFU8cyDFtj8XcJJCg//0KY3aStKM+R+W703rQu1VPQEOLo0QK6U 0OZMUHTVyyt2n7QcwRYsNXLtmQ3rDskLxry58GDT3nuEPM7fxi99y3VfBuwJmlKcQqaZ is1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l14si7585840otn.157.2020.03.10.06.19.34; Tue, 10 Mar 2020 06:19:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729644AbgCJNRu (ORCPT + 99 others); Tue, 10 Mar 2020 09:17:50 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:48830 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731440AbgCJNRl (ORCPT ); Tue, 10 Mar 2020 09:17:41 -0400 X-IronPort-AV: E=Sophos;i="5.70,537,1574089200"; d="scan'208";a="41284254" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 10 Mar 2020 22:17:40 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 542CB4290414; Tue, 10 Mar 2020 22:17:38 +0900 (JST) From: Lad Prabhakar To: Dave Stevenson , Sakari Ailus , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Lad Prabhakar , Lad Prabhakar Subject: [PATCH v4 2/3] media: i2c: imx219: Add support for RAW8 bit bayer format Date: Tue, 10 Mar 2020 13:17:08 +0000 Message-Id: <1583846229-6799-3-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1583846229-6799-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <1583846229-6799-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org IMX219 sensor is capable for RAW8/RAW10 modes. This commit adds support for RAW8 bayer format. Signed-off-by: Lad Prabhakar Signed-off-by: Dave Stevenson --- drivers/media/i2c/imx219.c | 148 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 116 insertions(+), 32 deletions(-) diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index 16010ca..3207487 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -168,15 +168,12 @@ static const struct imx219_reg mode_3280x2464_regs[] = { {0x0171, 0x01}, {0x0174, 0x00}, {0x0175, 0x00}, - {0x018c, 0x0a}, - {0x018d, 0x0a}, {0x0301, 0x05}, {0x0303, 0x01}, {0x0304, 0x03}, {0x0305, 0x03}, {0x0306, 0x00}, {0x0307, 0x39}, - {0x0309, 0x0a}, {0x030b, 0x01}, {0x030c, 0x00}, {0x030d, 0x72}, @@ -230,15 +227,12 @@ static const struct imx219_reg mode_1920_1080_regs[] = { {0x0171, 0x01}, {0x0174, 0x00}, {0x0175, 0x00}, - {0x018c, 0x0a}, - {0x018d, 0x0a}, {0x0301, 0x05}, {0x0303, 0x01}, {0x0304, 0x03}, {0x0305, 0x03}, {0x0306, 0x00}, {0x0307, 0x39}, - {0x0309, 0x0a}, {0x030b, 0x01}, {0x030c, 0x00}, {0x030d, 0x72}, @@ -290,15 +284,12 @@ static const struct imx219_reg mode_1640_1232_regs[] = { {0x0171, 0x01}, {0x0174, 0x01}, {0x0175, 0x01}, - {0x018c, 0x0a}, - {0x018d, 0x0a}, {0x0301, 0x05}, {0x0303, 0x01}, {0x0304, 0x03}, {0x0305, 0x03}, {0x0306, 0x00}, {0x0307, 0x39}, - {0x0309, 0x0a}, {0x030b, 0x01}, {0x030c, 0x00}, {0x030d, 0x72}, @@ -322,6 +313,18 @@ static const struct imx219_reg mode_1640_1232_regs[] = { {0x0163, 0x78}, }; +static const struct imx219_reg raw8_framefmt_regs[] = { + {0x018c, 0x08}, + {0x018d, 0x08}, + {0x0309, 0x08}, +}; + +static const struct imx219_reg raw10_framefmt_regs[] = { + {0x018c, 0x0a}, + {0x018d, 0x0a}, + {0x0309, 0x0a}, +}; + static const char * const imx219_test_pattern_menu[] = { "Disabled", "Color Bars", @@ -349,6 +352,27 @@ static const char * const imx219_supply_name[] = { #define IMX219_NUM_SUPPLIES ARRAY_SIZE(imx219_supply_name) /* + * The supported formats. + * This table MUST contain 4 entries per format, to cover the various flip + * combinations in the order + * - no flip + * - h flip + * - v flip + * - h&v flips + */ +static const u32 codes[] = { + MEDIA_BUS_FMT_SRGGB10_1X10, + MEDIA_BUS_FMT_SGRBG10_1X10, + MEDIA_BUS_FMT_SGBRG10_1X10, + MEDIA_BUS_FMT_SBGGR10_1X10, + + MEDIA_BUS_FMT_SRGGB8_1X8, + MEDIA_BUS_FMT_SGRBG8_1X8, + MEDIA_BUS_FMT_SGBRG8_1X8, + MEDIA_BUS_FMT_SBGGR8_1X8, +}; + +/* * Initialisation delay between XCLR low->high and the moment when the sensor * can start capture (i.e. can leave software stanby) must be not less than: * t4 + max(t5, t6 +