diff --git a/drivers/media/platform/tegra/cdi/cdi-mgr-priv.h b/drivers/media/platform/tegra/cdi/cdi-mgr-priv.h index 39b722ba..c5ef8e43 100644 --- a/drivers/media/platform/tegra/cdi/cdi-mgr-priv.h +++ b/drivers/media/platform/tegra/cdi/cdi-mgr-priv.h @@ -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); diff --git a/drivers/media/platform/tegra/cdi/cdi_mgr.c b/drivers/media/platform/tegra/cdi/cdi_mgr.c index 95227d3c..290dd326 100644 --- a/drivers/media/platform/tegra/cdi/cdi_mgr.c +++ b/drivers/media/platform/tegra/cdi/cdi_mgr.c @@ -1,6 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2015-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. - #include #include #include @@ -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)) {