lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220412135534.2796158-5-aford173@gmail.com>
Date:   Tue, 12 Apr 2022 08:55:33 -0500
From:   Adam Ford <aford173@...il.com>
To:     linux-media@...r.kernel.org
Cc:     prabhakar.mahadev-lad.rj@...renesas.com, tharvey@...eworks.com,
        cstevens@...conembedded.com, aford@...conembedded.com,
        laurent.pinchart@...asonboard.com, Adam Ford <aford173@...il.com>,
        Dave Stevenson <dave.stevenson@...pberrypi.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-kernel@...r.kernel.org
Subject: [PATCH 4/4] media: i2c: imx219: Create DPHY helper function

In the table of modes, each mode sets the DPHY to auto.
Create a helper function which does the same thing while
removing the entry for auto DPHY from ever mode entry.

Signed-off-by: Adam Ford <aford173@...il.com>
---
 drivers/media/i2c/imx219.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
index 08e7d0e72430..bb0bc1b8d91c 100644
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -35,6 +35,10 @@
 #define IMX219_MODE_STANDBY		0x00
 #define IMX219_MODE_STREAMING		0x01
 
+
+#define IMX219_REG_DPHY_CTRL		0x0128
+#define IMX219_DPHY_AUTO		0
+
 /* Chip ID */
 #define IMX219_REG_CHIP_ID		0x0000
 #define IMX219_CHIP_ID			0x0219
@@ -183,7 +187,6 @@ static const struct imx219_reg pll_clk_table[] = {
  * 3280x2464 = mode 2, 1920x1080 = mode 1, 1640x1232 = mode 4, 640x480 = mode 7.
  */
 static const struct imx219_reg mode_3280x2464_regs[] = {
-	{0x0128, 0x00},
 	{0x012b, 0x00},
 	{0x0164, 0x00},
 	{0x0165, 0x00},
@@ -222,7 +225,6 @@ static const struct imx219_reg mode_3280x2464_regs[] = {
 };
 
 static const struct imx219_reg mode_1920_1080_regs[] = {
-	{0x0128, 0x00},
 	{0x012b, 0x00},
 	{0x0162, 0x0d},
 	{0x0163, 0x78},
@@ -261,7 +263,6 @@ static const struct imx219_reg mode_1920_1080_regs[] = {
 };
 
 static const struct imx219_reg mode_1640_1232_regs[] = {
-	{0x0128, 0x00},
 	{0x012b, 0x00},
 	{0x0164, 0x00},
 	{0x0165, 0x00},
@@ -300,7 +301,6 @@ static const struct imx219_reg mode_1640_1232_regs[] = {
 };
 
 static const struct imx219_reg mode_640_480_regs[] = {
-	{0x0128, 0x00},
 	{0x012b, 0x00},
 	{0x0162, 0x0d},
 	{0x0163, 0x78},
@@ -999,6 +999,15 @@ static int imx219_get_selection(struct v4l2_subdev *sd,
 	return -EINVAL;
 }
 
+static int imx219_enable_dphy(struct imx219 *imx219, u8 mode)
+{
+	int ret;
+
+	ret = imx219_write_reg(imx219, IMX219_REG_DPHY_CTRL,
+			       IMX219_REG_VALUE_08BIT, mode);
+	return ret;
+};
+
 static int imx219_configure_lanes(struct imx219 *imx219)
 {
 	int ret;
@@ -1081,6 +1090,13 @@ static int imx219_start_streaming(struct imx219 *imx219)
 		goto err_rpm_put;
 	}
 
+	/* Setup DPHY */
+	ret = imx219_enable_dphy(imx219, IMX219_DPHY_AUTO);
+	if (ret) {
+		dev_err(&client->dev, "%s failed to configure dphy\n", __func__);
+		goto err_rpm_put;
+	}
+
 	/* Configure clock based on reference clock frequency */
 	imx219_set_exck_freq(imx219);
 
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ