drm/msm/dp: handle PHY directly in dp_ctrl
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fri, 26 Jan 2024 18:26:30 +0000 (20:26 +0200)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Sun, 11 Feb 2024 20:38:07 +0000 (22:38 +0200)
There is little point in going trough dp_parser->io indirection each
time the driver needs to access the PHY. Store the pointer directly in
dp_ctrl_private.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/576119/
Link: https://lore.kernel.org/r/20240126-dp-power-parser-cleanup-v3-11-098d5f581dd3@linaro.org
drivers/gpu/drm/msm/dp/dp_ctrl.c
drivers/gpu/drm/msm/dp/dp_ctrl.h
drivers/gpu/drm/msm/dp/dp_display.c

index 0a9a3ba80adb527798b3dda5fe2dc87652b22b67..03bbdf865d263f9c871be8ade8bb52e3df9e0fc4 100644 (file)
@@ -76,9 +76,10 @@ struct dp_ctrl_private {
        struct drm_dp_aux *aux;
        struct dp_panel *panel;
        struct dp_link *link;
-       struct dp_parser *parser;
        struct dp_catalog *catalog;
 
+       struct phy *phy;
+
        unsigned int num_core_clks;
        struct clk_bulk_data *core_clks;
 
@@ -1023,7 +1024,7 @@ static int dp_ctrl_set_vx_px(struct dp_ctrl_private *ctrl,
        phy_opts->dp.voltage[0] = v_level;
        phy_opts->dp.pre[0] = p_level;
        phy_opts->dp.set_voltages = 1;
-       phy_configure(ctrl->parser->io.phy, phy_opts);
+       phy_configure(ctrl->phy, phy_opts);
        phy_opts->dp.set_voltages = 0;
 
        return 0;
@@ -1437,7 +1438,7 @@ static void dp_ctrl_link_clk_disable(struct dp_ctrl *dp_ctrl)
 static int dp_ctrl_enable_mainlink_clocks(struct dp_ctrl_private *ctrl)
 {
        int ret = 0;
-       struct phy *phy = ctrl->parser->io.phy;
+       struct phy *phy = ctrl->phy;
        const u8 *dpcd = ctrl->panel->dpcd;
 
        ctrl->phy_opts.dp.lanes = ctrl->link->link_params.num_lanes;
@@ -1535,12 +1536,10 @@ void dp_ctrl_set_psr(struct dp_ctrl *dp_ctrl, bool enter)
 void dp_ctrl_phy_init(struct dp_ctrl *dp_ctrl)
 {
        struct dp_ctrl_private *ctrl;
-       struct dp_io *dp_io;
        struct phy *phy;
 
        ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl);
-       dp_io = &ctrl->parser->io;
-       phy = dp_io->phy;
+       phy = ctrl->phy;
 
        dp_catalog_ctrl_phy_reset(ctrl->catalog);
        phy_init(phy);
@@ -1552,12 +1551,10 @@ void dp_ctrl_phy_init(struct dp_ctrl *dp_ctrl)
 void dp_ctrl_phy_exit(struct dp_ctrl *dp_ctrl)
 {
        struct dp_ctrl_private *ctrl;
-       struct dp_io *dp_io;
        struct phy *phy;
 
        ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl);
-       dp_io = &ctrl->parser->io;
-       phy = dp_io->phy;
+       phy = ctrl->phy;
 
        dp_catalog_ctrl_phy_reset(ctrl->catalog);
        phy_exit(phy);
@@ -1582,7 +1579,7 @@ static bool dp_ctrl_use_fixed_nvid(struct dp_ctrl_private *ctrl)
 
 static int dp_ctrl_reinitialize_mainlink(struct dp_ctrl_private *ctrl)
 {
-       struct phy *phy = ctrl->parser->io.phy;
+       struct phy *phy = ctrl->phy;
        int ret = 0;
 
        dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, false);
@@ -1612,11 +1609,9 @@ static int dp_ctrl_reinitialize_mainlink(struct dp_ctrl_private *ctrl)
 
 static int dp_ctrl_deinitialize_mainlink(struct dp_ctrl_private *ctrl)
 {
-       struct dp_io *dp_io;
        struct phy *phy;
 
-       dp_io = &ctrl->parser->io;
-       phy = dp_io->phy;
+       phy = ctrl->phy;
 
        dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, false);
 
@@ -2042,12 +2037,10 @@ end:
 void dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl)
 {
        struct dp_ctrl_private *ctrl;
-       struct dp_io *dp_io;
        struct phy *phy;
 
        ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl);
-       dp_io = &ctrl->parser->io;
-       phy = dp_io->phy;
+       phy = ctrl->phy;
 
        /* set dongle to D3 (power off) mode */
        dp_link_psm_config(ctrl->link, &ctrl->panel->link_info, true);
@@ -2075,12 +2068,10 @@ void dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl)
 void dp_ctrl_off_link(struct dp_ctrl *dp_ctrl)
 {
        struct dp_ctrl_private *ctrl;
-       struct dp_io *dp_io;
        struct phy *phy;
 
        ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl);
-       dp_io = &ctrl->parser->io;
-       phy = dp_io->phy;
+       phy = ctrl->phy;
 
        dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, false);
 
@@ -2098,12 +2089,10 @@ void dp_ctrl_off_link(struct dp_ctrl *dp_ctrl)
 void dp_ctrl_off(struct dp_ctrl *dp_ctrl)
 {
        struct dp_ctrl_private *ctrl;
-       struct dp_io *dp_io;
        struct phy *phy;
 
        ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl);
-       dp_io = &ctrl->parser->io;
-       phy = dp_io->phy;
+       phy = ctrl->phy;
 
        dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, false);
 
@@ -2220,7 +2209,7 @@ static int dp_ctrl_clk_init(struct dp_ctrl *dp_ctrl)
 struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link,
                        struct dp_panel *panel, struct drm_dp_aux *aux,
                        struct dp_catalog *catalog,
-                       struct dp_parser *parser)
+                       struct phy *phy)
 {
        struct dp_ctrl_private *ctrl;
        int ret;
@@ -2254,12 +2243,12 @@ struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link,
        init_completion(&ctrl->video_comp);
 
        /* in parameters */
-       ctrl->parser   = parser;
        ctrl->panel    = panel;
        ctrl->aux      = aux;
        ctrl->link     = link;
        ctrl->catalog  = catalog;
        ctrl->dev      = dev;
+       ctrl->phy      = phy;
 
        ret = dp_ctrl_clk_init(&ctrl->dp_ctrl);
        if (ret) {
index 023f14d0b021e8c95f87b5cdfaa6bab96ec67ed1..6e9f375b856a9794c34288494db114fc7eb699ef 100644 (file)
@@ -28,7 +28,7 @@ void dp_ctrl_handle_sink_request(struct dp_ctrl *dp_ctrl);
 struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link,
                        struct dp_panel *panel, struct drm_dp_aux *aux,
                        struct dp_catalog *catalog,
-                       struct dp_parser *parser);
+                       struct phy *phy);
 
 void dp_ctrl_reset_irq_ctrl(struct dp_ctrl *dp_ctrl, bool enable);
 void dp_ctrl_phy_init(struct dp_ctrl *dp_ctrl);
index 37d23b48d36ecce00e05061075531dca64a5c02e..2f1eb67338a510b88bcec0a60f471f66b8674cd4 100644 (file)
@@ -761,7 +761,8 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
        }
 
        dp->ctrl = dp_ctrl_get(dev, dp->link, dp->panel, dp->aux,
-                              dp->catalog, dp->parser);
+                              dp->catalog,
+                              dp->parser->io.phy);
        if (IS_ERR(dp->ctrl)) {
                rc = PTR_ERR(dp->ctrl);
                DRM_ERROR("failed to initialize ctrl, rc = %d\n", rc);