phy: rockchip: mipi dcphy move apb_rst to runtime resume to avoid break dcphy rx

Change-Id: I097eeb7e3fd7decc4f0d1badd335b2d7176ce223
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
Signed-off-by: Guochun Huang <hero.huang@rock-chips.com>
This commit is contained in:
Zefa Chen
2024-06-21 10:33:12 +08:00
parent c348e9697f
commit d5a7bbea0d
2 changed files with 20 additions and 19 deletions

View File

@@ -590,7 +590,7 @@ static int csi2_dphy_enable_clk(struct csi2_dphy *dphy)
if (dphy->csi_info.dphy_vendor[i] == PHY_VENDOR_SAMSUNG) {
samsung_phy = (struct samsung_mipi_dcphy *)dphy->phy_hw[i];
if (samsung_phy)
clk_prepare_enable(samsung_phy->pclk);
pm_runtime_get_sync(samsung_phy->dev);
} else {
hw = (struct csi2_dphy_hw *)dphy->phy_hw[i];
if (hw) {
@@ -615,7 +615,7 @@ static void csi2_dphy_disable_clk(struct csi2_dphy *dphy)
if (dphy->csi_info.dphy_vendor[i] == PHY_VENDOR_SAMSUNG) {
samsung_phy = (struct samsung_mipi_dcphy *)dphy->phy_hw[i];
if (samsung_phy)
clk_disable_unprepare(samsung_phy->pclk);
pm_runtime_put(samsung_phy->dev);
} else {
hw = (struct csi2_dphy_hw *)dphy->phy_hw[i];
if (hw)

View File

@@ -1781,25 +1781,8 @@ static int samsung_mipi_dcphy_power_on(struct phy *phy)
{
struct samsung_mipi_dcphy *samsung = phy_get_drvdata(phy);
enum phy_mode mode = phy_get_mode(phy);
int on = 0;
struct v4l2_subdev *sensor_sd = NULL;
pm_runtime_get_sync(samsung->dev);
reset_control_assert(samsung->apb_rst);
udelay(1);
reset_control_deassert(samsung->apb_rst);
if (atomic_read(&samsung->stream_cnt) && samsung->dphy_dev[0]) {
sensor_sd = get_remote_sensor(&samsung->dphy_dev[0]->sd);
samsung->stream_off(samsung->dphy_dev[0], &samsung->dphy_dev[0]->sd);
if (sensor_sd)
v4l2_subdev_call(sensor_sd, core, ioctl,
RKMODULE_SET_QUICK_STREAM, &on);
samsung->stream_on(samsung->dphy_dev[0], &samsung->dphy_dev[0]->sd);
on = 1;
if (sensor_sd)
v4l2_subdev_call(sensor_sd, core, ioctl,
RKMODULE_SET_QUICK_STREAM, &on);
}
switch (mode) {
case PHY_MODE_MIPI_DPHY:
@@ -2492,6 +2475,22 @@ static int samsung_mipi_dcphy_remove(struct platform_device *pdev)
return 0;
}
static __maybe_unused int samsung_mipi_dcphy_suspend(struct device *dev)
{
return 0;
}
static __maybe_unused int samsung_mipi_dcphy_resume(struct device *dev)
{
struct samsung_mipi_dcphy *samsung = dev_get_drvdata(dev);
reset_control_assert(samsung->apb_rst);
udelay(1);
reset_control_deassert(samsung->apb_rst);
return 0;
}
static __maybe_unused int samsung_mipi_dcphy_runtime_suspend(struct device *dev)
{
struct samsung_mipi_dcphy *samsung = dev_get_drvdata(dev);
@@ -2513,6 +2512,8 @@ static __maybe_unused int samsung_mipi_dcphy_runtime_resume(struct device *dev)
}
static const struct dev_pm_ops samsung_mipi_dcphy_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(samsung_mipi_dcphy_suspend,
samsung_mipi_dcphy_resume)
SET_RUNTIME_PM_OPS(samsung_mipi_dcphy_runtime_suspend,
samsung_mipi_dcphy_runtime_resume, NULL)
};