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: <20250207112958.2571600-6-laurentiu.palcu@oss.nxp.com>
Date: Fri,  7 Feb 2025 13:29:57 +0200
From: Laurentiu Palcu <laurentiu.palcu@....nxp.com>
To: Julien Massot <julien.massot@...labora.com>,
	Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: Laurentiu Palcu <laurentiu.palcu@....nxp.com>,
	linux-kernel@...r.kernel.org,
	linux-media@...r.kernel.org
Subject: [PATCH 5/5] media/i2c: max96717: allow user to override operation mode from DT

There are situations when the CFG pins set the chip up for a certain
mode of operation (ie: pixel mode or tunneling mode), because the HW
designers decided this way, and we, the users, want to change that. For
that, add an optional DT property that would allow toggling the
operation mode from the configured one to the other one.

The driver still only supports tunneling mode, that didn't change.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@....nxp.com>
---
 drivers/media/i2c/max96717.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/media/i2c/max96717.c b/drivers/media/i2c/max96717.c
index 47a3be195a971..a591ca5d5f44f 100644
--- a/drivers/media/i2c/max96717.c
+++ b/drivers/media/i2c/max96717.c
@@ -161,6 +161,7 @@ struct max96717_priv {
 	struct clk_hw                     clk_hw;
 	struct gpio_chip                  gpio_chip;
 	enum max96717_vpg_mode            pattern;
+	bool				  mode_override;
 	struct max96717_fsync_desc	  fsync;
 };
 
@@ -1066,6 +1067,14 @@ static int max96717_hw_init(struct max96717_priv *priv)
 		return dev_err_probe(dev, ret,
 				     "Fail to read mipi rx extension");
 
+	if (priv->mode_override) {
+		val ^= MAX96717_TUN_MODE;
+
+		ret = cci_write(priv->regmap, MAX96717_MIPI_RX_EXT11, val, NULL);
+		if (ret)
+			return dev_err_probe(dev, ret, "Unable to update operation mode\n");
+	}
+
 	if (!(val & MAX96717_TUN_MODE))
 		return dev_err_probe(dev, -EOPNOTSUPP,
 				     "Only supporting tunnel mode");
@@ -1101,6 +1110,9 @@ static int max96717_parse_dt(struct max96717_priv *priv)
 
 	priv->mipi_csi2 = vep.bus.mipi_csi2;
 
+	if (fwnode_property_present(dev_fwnode(dev), "maxim,cfg-mode-override"))
+		priv->mode_override = true;
+
 	priv->fsync.pin = -1;
 	count = fwnode_property_present(dev_fwnode(dev), "maxim,fsync-config");
 	if (count > 0) {
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ