clear-pkgs-linux-iot-lts2018/0976-media-intel-ipu4-ti960...

102 lines
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Meng Wei <wei.meng@intel.com>
Date: Wed, 2 Jan 2019 11:16:23 +0800
Subject: [PATCH] media: intel-ipu4: ti960: fix map conflict
After register all sensor at ti960,
then add map valid sensor again.
Change-Id: I3bc54f321d07bc33da801a95f3a4359e6e31536f
Tracked-On: PKT-1691
Signed-off-by: lizhao7x <zhaox.li@intel.com>
Signed-off-by: Meng Wei <wei.meng@intel.com>
---
drivers/media/i2c/ti960.c | 57 ++++++++++++++++++++-------------------
1 file changed, 30 insertions(+), 27 deletions(-)
diff --git a/drivers/media/i2c/ti960.c b/drivers/media/i2c/ti960.c
index 12cacab..531611b 100644
--- a/drivers/media/i2c/ti960.c
+++ b/drivers/media/i2c/ti960.c
@@ -495,6 +495,33 @@ static int ti960_open(struct v4l2_subdev *subdev,
return 0;
}
+static int ti960_map_subdevs_addr(struct ti960 *va)
+{
+ unsigned short rx_port, phy_i2c_addr, alias_i2c_addr;
+ int i, rval;
+
+ for (i = 0; i < NR_OF_TI960_SINK_PADS; i++) {
+ rx_port = va->sub_devs[i].rx_port;
+ phy_i2c_addr = va->sub_devs[i].phy_i2c_addr;
+ alias_i2c_addr = va->sub_devs[i].alias_i2c_addr;
+
+ if (!phy_i2c_addr || !alias_i2c_addr)
+ continue;
+
+ rval = ti960_map_phy_i2c_addr(va, rx_port, phy_i2c_addr);
+ if (rval)
+ return rval;
+
+ /* set 7bit alias i2c addr */
+ rval = ti960_map_alias_i2c_addr(va, rx_port,
+ alias_i2c_addr << 1);
+ if (rval)
+ return rval;
+ }
+
+ return 0;
+}
+
static int ti960_registered(struct v4l2_subdev *subdev)
{
struct ti960 *va = to_ti960(subdev);
@@ -602,6 +629,9 @@ static int ti960_registered(struct v4l2_subdev *subdev)
}
k++;
}
+ rval = ti960_map_subdevs_addr(va);
+ if (rval)
+ return rval;
return 0;
}
@@ -708,33 +738,6 @@ static int ti960_rx_port_config(struct ti960 *va, int sink, int rx_port)
return 0;
}
-static int ti960_map_subdevs_addr(struct ti960 *va)
-{
- unsigned short rx_port, phy_i2c_addr, alias_i2c_addr;
- int i, rval;
-
- for (i = 0; i < NR_OF_TI960_SINK_PADS; i++) {
- rx_port = va->sub_devs[i].rx_port;
- phy_i2c_addr = va->sub_devs[i].phy_i2c_addr;
- alias_i2c_addr = va->sub_devs[i].alias_i2c_addr;
-
- if (!phy_i2c_addr || !alias_i2c_addr)
- continue;
-
- rval = ti960_map_phy_i2c_addr(va, rx_port, phy_i2c_addr);
- if (rval)
- return rval;
-
- /* set 7bit alias i2c addr */
- rval = ti960_map_alias_i2c_addr(va, rx_port,
- alias_i2c_addr << 1);
- if (rval)
- return rval;
- }
-
- return 0;
-}
-
static int ti960_find_subdev_index(struct ti960 *va, struct v4l2_subdev *sd)
{
int i;
--
2.21.0