From ec363617669effd4e49f0b27ab12015a60455930 Mon Sep 17 00:00:00 2001
From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Date: Tue, 14 May 2019 16:33:15 +0300
Subject: [PATCH 118/122] lvds: OVT: add dvp_order parameter for ov10635

Fix dvp_order for both ov490 and ov10635

Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
---
 drivers/media/i2c/soc_camera/ov10635.c       | 9 +++++++++
 drivers/media/i2c/soc_camera/ov490_ov10640.c | 6 +-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/ov10635.c b/drivers/media/i2c/soc_camera/ov10635.c
index 916173c..1bbde91 100644
--- a/drivers/media/i2c/soc_camera/ov10635.c
+++ b/drivers/media/i2c/soc_camera/ov10635.c
@@ -50,6 +50,11 @@ struct ov10635_priv {
 	int				gpio_fsin;
 };
 
+
+static int dvp_order = -1;
+module_param(dvp_order, int, 0644);
+MODULE_PARM_DESC(dvp_order, " DVP bus bits order");
+
 static inline struct ov10635_priv *to_ov10635(const struct i2c_client *client)
 {
 	return container_of(i2c_get_clientdata(client), struct ov10635_priv, sd);
@@ -601,6 +606,10 @@ static int ov10635_parse_dt(struct device_node *np, struct ov10635_priv *priv)
 
 	udelay(100);
 
+	/* module params override dts */
+	if (dvp_order != -1)
+		priv->dvp_order = dvp_order;
+
 	return 0;
 }
 
diff --git a/drivers/media/i2c/soc_camera/ov490_ov10640.c b/drivers/media/i2c/soc_camera/ov490_ov10640.c
index 1c8aac8..0ea9a54 100644
--- a/drivers/media/i2c/soc_camera/ov490_ov10640.c
+++ b/drivers/media/i2c/soc_camera/ov490_ov10640.c
@@ -69,10 +69,6 @@ static int conf_link;
 module_param(conf_link, int, 0644);
 MODULE_PARM_DESC(conf_link, " Force configuration link. Used only if robust firmware flashing required (f.e. recovery)");
 
-static int dvp_order;
-module_param(dvp_order, int, 0644);
-MODULE_PARM_DESC(dvp_order, " DVP bus bits order");
-
 static int max_width;
 module_param(max_width, int, 0644);
 MODULE_PARM_DESC(max_width, " Fixed sensor width");
@@ -972,7 +968,7 @@ static int ov490_parse_dt(struct device_node *np, struct ov490_priv *priv)
 	}
 
 	/* module params override dts */
-	if (dvp_order)
+	if (dvp_order != -1)
 		priv->dvp_order = dvp_order;
 	if (max_width && max_height) {
 		priv->max_width = max_width;
-- 
2.7.4

