cdi: Add fsync_ctrl_port variable

Parse fsync_ctrl_port property in DT to overwrite
FSYNC control GPIO port of IO expander

JIRA CAMERASW-29219

Change-Id: I2311739d0460ad0601e1e40990201a4c0fd01ded
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233562
Tested-by: Justin Kim (SW-TEGRA) <juskim@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Chinmay Mahajan <cmahajan@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
This commit is contained in:
Junghyun Kim
2024-10-20 17:42:09 +00:00
committed by Jon Hunter
parent 1dcd39e05b
commit ea5440f147
3 changed files with 32 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ struct tca9539_priv {
u32 dat_len; u32 dat_len;
u8 init_val[12]; u8 init_val[12];
u32 power_port; u32 power_port;
u32 fsync_ctrl_port;
bool enable; bool enable;
}; };

View File

@@ -431,6 +431,7 @@ static int cdi_dev_set_fsync_mux(
void __user *arg) void __user *arg)
{ {
u8 val, shift; u8 val, shift;
u8 cam_grp;
struct cdi_dev_fsync_mux fsync_mux; struct cdi_dev_fsync_mux fsync_mux;
if (copy_from_user(&fsync_mux, arg, sizeof(fsync_mux))) { if (copy_from_user(&fsync_mux, arg, sizeof(fsync_mux))) {
@@ -445,9 +446,14 @@ static int cdi_dev_set_fsync_mux(
* P05:P04 for the camera group D. cam_grp 3. * P05:P04 for the camera group D. cam_grp 3.
*/ */
if ((fsync_mux.cam_grp > 0U) && (fsync_mux.cam_grp < 4U)) { if ((fsync_mux.cam_grp > 0U) && (fsync_mux.cam_grp < 4U)) {
if (info->tca9539.fsync_ctrl_port != -1)
cam_grp = info->tca9539.fsync_ctrl_port;
else
cam_grp = fsync_mux.cam_grp;
if (tca9539_rd(info, 0x02, &val) != 0) if (tca9539_rd(info, 0x02, &val) != 0)
return -EFAULT; return -EFAULT;
switch (fsync_mux.cam_grp) { switch (cam_grp) {
case 1U: case 1U:
shift = 0U; shift = 0U;
break; break;
@@ -581,6 +587,7 @@ static int cdi_dev_probe(struct i2c_client *client,
int err; int err;
int numLinks = 0; int numLinks = 0;
int i; int i;
u32 fsync_ctrl_port;
dev_dbg(&client->dev, "%s: initializing link @%x-%04x\n", dev_dbg(&client->dev, "%s: initializing link @%x-%04x\n",
__func__, client->adapter->nr, client->addr); __func__, client->adapter->nr, client->addr);
@@ -727,7 +734,17 @@ static int cdi_dev_probe(struct i2c_client *client,
info->tca9539.power_port); info->tca9539.power_port);
return -ENODEV; return -ENODEV;
} }
info->tca9539.fsync_ctrl_port = -1;
err = of_property_read_u32(child_tca9539,
"fsync_ctrl_port",
&fsync_ctrl_port);
if (err == 0) {
if ((fsync_ctrl_port >= 0) &&
(fsync_ctrl_port <= 3)) {
info->tca9539.fsync_ctrl_port =
fsync_ctrl_port;
}
}
info->tca9539.reg_len /= 8; info->tca9539.reg_len /= 8;
info->tca9539.dat_len /= 8; info->tca9539.dat_len /= 8;
info->tca9539.enable = 1; info->tca9539.enable = 1;

View File

@@ -1721,6 +1721,7 @@ static int cdi_mgr_probe(struct platform_device *pdev)
struct device_node *child_tca9539 = NULL; struct device_node *child_tca9539 = NULL;
struct device_node *root_node = NULL; struct device_node *root_node = NULL;
const char *model; const char *model;
u32 fsync_ctrl_port;
dev_info(&pdev->dev, "%sing...\n", __func__); dev_info(&pdev->dev, "%sing...\n", __func__);
@@ -1939,6 +1940,17 @@ static int cdi_mgr_probe(struct platform_device *pdev)
cdi_mgr->tca9539.power_port); cdi_mgr->tca9539.power_port);
goto err_probe; goto err_probe;
} }
cdi_mgr->tca9539.fsync_ctrl_port = -1;
err = of_property_read_u32(child_tca9539,
"fsync_ctrl_port",
&fsync_ctrl_port);
if (err == 0) {
if ((fsync_ctrl_port >= 0) &&
(fsync_ctrl_port <= 3)) {
cdi_mgr->tca9539.fsync_ctrl_port =
fsync_ctrl_port;
}
}
cdi_mgr->tca9539.reg_len /= 8; cdi_mgr->tca9539.reg_len /= 8;
cdi_mgr->tca9539.dat_len /= 8; cdi_mgr->tca9539.dat_len /= 8;