tegra: cdi: Add delay while setting gpio

On p3898 platform, VCC_CAM can't handle high
inrush current when gpios are set in parallel.
Hence, a SW WAR is required to add a delay of 5ms
after a gpio is set.

Bug 4125801

Change-Id: Ib235cb00b5ef42c7255be5d212dd9e190630d7bc
Signed-off-by: Aniket Bahadarpurkar <aniketb@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2943541
(cherry picked from commit 6e44996aae022c9e46fb431b75d60c8499bcd874)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2953356
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
This commit is contained in:
Aniket Bahadarpurkar
2023-07-27 08:21:18 +00:00
committed by mobile promotions
parent a65561e6b4
commit 3e51976226
2 changed files with 17 additions and 1 deletions

View File

@@ -78,6 +78,7 @@ struct cdi_mgr_priv {
u8 cim_ver; /* 1 - P3714 A01, 2 - P3714 A02/A03 */
u32 cim_frsync[3]; /* FRSYNC source selection for each muxer */
u8 pre_suspend_tca9539_regvals[CDI_MGR_TCA9539_REGISTER_COUNT];
bool isP3898;
};
int cdi_mgr_power_up(struct cdi_mgr_priv *cdi_mgr, unsigned long arg);

View File

@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2015-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/module.h>
@@ -709,6 +708,11 @@ int cdi_mgr_power_up(struct cdi_mgr_priv *cdi_mgr, unsigned long arg)
dev_dbg(cdi_mgr->pdev, " - %d, %d\n",
pd->pwr_gpios[i], PW_ON(pd->pwr_flags[i]));
gpio_set_value(pd->pwr_gpios[i], PW_ON(pd->pwr_flags[i]));
/* SW WAR for platform issue */
/* Add 5ms delay between two gpio toggles */
/* Bug 4125801*/
if (cdi_mgr->isP3898)
mdelay(5);
cdi_mgr->pwr_state |= BIT(i);
}
@@ -1739,6 +1743,8 @@ static int cdi_mgr_probe(struct platform_device *pdev)
struct cam_gpio_config *pin = NULL;
struct device_node *child = NULL;
struct device_node *child_tca9539 = NULL;
struct device_node *root_node = NULL;
const char *model;
dev_info(&pdev->dev, "%sing...\n", __func__);
@@ -1778,6 +1784,15 @@ static int cdi_mgr_probe(struct platform_device *pdev)
return -EFAULT;
}
cdi_mgr->isP3898 = false;
root_node = of_root;
if (root_node) {
model = of_get_property(root_node, "model", NULL);
dev_info(&pdev->dev, "platform name: %s\n", model);
if (!strcmp(model, "p3898-0010"))
cdi_mgr->isP3898 = true;
}
if (of_property_read_bool(pdev->dev.of_node, "pwms")) {
cdi_mgr->pwm = devm_pwm_get(&pdev->dev, NULL);
if (!IS_ERR(cdi_mgr->pwm)) {