On Mon, Aug 25, 2025 at 10:15:59PM +0800, Yongxing Mou wrote:
> From: Abhinav Kumar <quic_abhin...@quicinc.com>
> 
> With MST, each DP controller can handle multiple streams.
> There shall be one dp_panel for each stream but the dp_display
> object shall be shared among them. To represent this abstraction,
> create a stream_id for each DP panel which shall be set by the
> MST stream. For SST, default this to stream 0.
> 
> Use the stream ID to control the pixel clock of that respective
> stream by extending the clock handles and state tracking of the
> DP pixel clock to an array of max supported streams. The maximum
> streams currently is 4.
> 
> Signed-off-by: Abhinav Kumar <quic_abhin...@quicinc.com>
> Signed-off-by: Yongxing Mou <yongxing....@oss.qualcomm.com>
> ---
>  drivers/gpu/drm/msm/dp/dp_ctrl.c    | 58 
> ++++++++++++++++++++++---------------
>  drivers/gpu/drm/msm/dp/dp_ctrl.h    |  3 +-
>  drivers/gpu/drm/msm/dp/dp_display.c | 27 +++++++++++++++--
>  drivers/gpu/drm/msm/dp/dp_display.h |  2 ++
>  drivers/gpu/drm/msm/dp/dp_panel.h   | 11 +++++++
>  5 files changed, 73 insertions(+), 28 deletions(-)

> @@ -2677,10 +2675,11 @@ static const char *ctrl_clks[] = {
>       "ctrl_link_iface",
>  };
>  
> -static int msm_dp_ctrl_clk_init(struct msm_dp_ctrl *msm_dp_ctrl)
> +static int msm_dp_ctrl_clk_init(struct msm_dp_ctrl *msm_dp_ctrl, int 
> max_stream)
>  {
>       struct msm_dp_ctrl_private *ctrl;
>       struct device *dev;
> +     char stream_id_str[15];

A comment would be nice. Or better replace this with the array lookup,
it's much easier than snprintf.

>       int i, rc;
>  
>       ctrl = container_of(msm_dp_ctrl, struct msm_dp_ctrl_private, 
> msm_dp_ctrl);
> @@ -2710,9 +2709,19 @@ static int msm_dp_ctrl_clk_init(struct msm_dp_ctrl 
> *msm_dp_ctrl)
>       if (rc)
>               return rc;
>  
> -     ctrl->pixel_clk = devm_clk_get(dev, "stream_pixel");
> -     if (IS_ERR(ctrl->pixel_clk))
> -             return PTR_ERR(ctrl->pixel_clk);
> +     ctrl->pixel_clk[DP_STREAM_0] = devm_clk_get(dev, "stream_pixel");
> +     if (IS_ERR(ctrl->pixel_clk[DP_STREAM_0]))
> +             return PTR_ERR(ctrl->pixel_clk[DP_STREAM_0]);
> +
> +     for (i = DP_STREAM_1; i < max_stream; i++) {
> +             sprintf(stream_id_str, "stream_%d_pixel", i);
> +             ctrl->pixel_clk[i] = devm_clk_get(dev, stream_id_str);
> +
> +             if (IS_ERR(ctrl->pixel_clk[i])) {
> +                     DRM_DEBUG_DP("failed to get stream %d pixel clock", i);
> +                     break;
> +             }
> +     }
>  
>       return 0;
>  }

-- 
With best wishes
Dmitry

Reply via email to