Re: [PATCH] drm/msm/dp: handle irq_hpd with sink_count = 0 correctly

From: khsieh
Date: Wed May 12 2021 - 15:36:49 EST


On 2021-05-11 22:27, Vinod Koul wrote:
On 10-05-21, 11:15, Stephen Boyd wrote:
Quoting Kuogee Hsieh (2021-05-05 14:52:01)
> @@ -1414,6 +1416,10 @@ void dp_ctrl_host_deinit(struct dp_ctrl *dp_ctrl)
> phy = dp_io->phy;
>
> dp_catalog_ctrl_enable_irq(ctrl->catalog, false);
> +
> + if (phy->power_count)
> + phy_power_off(phy);
> +
> phy_exit(phy);
>
> DRM_DEBUG_DP("Host deinitialized successfully\n");
> @@ -1445,7 +1451,6 @@ static int dp_ctrl_reinitialize_mainlink(struct dp_ctrl_private *ctrl)
>
> dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, false);
> opts_dp->lanes = ctrl->link->link_params.num_lanes;
> - phy_configure(phy, &dp_io->phy_opts);
> /*
> * Disable and re-enable the mainlink clock since the
> * link clock might have been adjusted as part of the
> @@ -1456,9 +1461,13 @@ static int dp_ctrl_reinitialize_mainlink(struct dp_ctrl_private *ctrl)
> DRM_ERROR("Failed to disable clocks. ret=%d\n", ret);
> return ret;
> }
> - phy_power_off(phy);
> - /* hw recommended delay before re-enabling clocks */
> - msleep(20);
> +
> + if (phy->power_count) {

I don't believe members of 'phy' are supposed to be looked at by various
phy consumer drivers. Vinod, is that right?

That is correct, we should not be doing that. And IMO this code is
redundant, the phy core will check power_count and invoke drivers
.power_off accordingly, so should be removed...

Thanks

ok, v2 patch uploaded to address this issue.