From: Kuogee Hsieh <quic_khsieh@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Rob Clark <robdclark@gmail.com>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
"David Airlie" <airlied@gmail.com>,
Daniel Vetter <daniel@ffwll.ch>,
Stephen Boyd <swboyd@chromium.org>
Cc: <linux-arm-msm@vger.kernel.org>,
<dri-devel@lists.freedesktop.org>,
<freedreno@lists.freedesktop.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>
Subject: Re: [PATCH RESEND v3 09/15] drm/msm/dp: move phy_configure_opts to dp_ctrl
Date: Fri, 26 Jan 2024 14:23:04 -0800 [thread overview]
Message-ID: <83caa905-3cf7-ea12-79bf-5ebbc0ab25e3@quicinc.com> (raw)
In-Reply-To: <20240126-dp-power-parser-cleanup-v3-9-098d5f581dd3@linaro.org>
On 1/26/2024 10:26 AM, Dmitry Baryshkov wrote:
> There is little point in sharing phy configuration structure between
> several modules. Move it to dp_ctrl, which becomes the only submodule
> re-configuring the PHY.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---
> drivers/gpu/drm/msm/dp/dp_catalog.c | 19 -----------------
> drivers/gpu/drm/msm/dp/dp_catalog.h | 2 --
> drivers/gpu/drm/msm/dp/dp_ctrl.c | 41 ++++++++++++++++++++++++-------------
> drivers/gpu/drm/msm/dp/dp_parser.h | 3 ---
> 4 files changed, 27 insertions(+), 38 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c
> index 5142aeb705a4..e07651768805 100644
> --- a/drivers/gpu/drm/msm/dp/dp_catalog.c
> +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c
> @@ -765,25 +765,6 @@ void dp_catalog_ctrl_phy_reset(struct dp_catalog *dp_catalog)
> dp_write_ahb(catalog, REG_DP_PHY_CTRL, 0x0);
> }
>
> -int dp_catalog_ctrl_update_vx_px(struct dp_catalog *dp_catalog,
> - u8 v_level, u8 p_level)
> -{
> - struct dp_catalog_private *catalog = container_of(dp_catalog,
> - struct dp_catalog_private, dp_catalog);
> - struct dp_io *dp_io = catalog->io;
> - struct phy *phy = dp_io->phy;
> - struct phy_configure_opts_dp *opts_dp = &dp_io->phy_opts.dp;
> -
> - /* TODO: Update for all lanes instead of just first one */
> - opts_dp->voltage[0] = v_level;
> - opts_dp->pre[0] = p_level;
> - opts_dp->set_voltages = 1;
> - phy_configure(phy, &dp_io->phy_opts);
> - opts_dp->set_voltages = 0;
> -
> - return 0;
> -}
> -
> void dp_catalog_ctrl_send_phy_pattern(struct dp_catalog *dp_catalog,
> u32 pattern)
> {
> diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h b/drivers/gpu/drm/msm/dp/dp_catalog.h
> index 38786e855b51..ba7c62ba7ca3 100644
> --- a/drivers/gpu/drm/msm/dp/dp_catalog.h
> +++ b/drivers/gpu/drm/msm/dp/dp_catalog.h
> @@ -111,8 +111,6 @@ void dp_catalog_ctrl_set_psr(struct dp_catalog *dp_catalog, bool enter);
> u32 dp_catalog_link_is_connected(struct dp_catalog *dp_catalog);
> u32 dp_catalog_hpd_get_intr_status(struct dp_catalog *dp_catalog);
> void dp_catalog_ctrl_phy_reset(struct dp_catalog *dp_catalog);
> -int dp_catalog_ctrl_update_vx_px(struct dp_catalog *dp_catalog, u8 v_level,
> - u8 p_level);
> int dp_catalog_ctrl_get_interrupt(struct dp_catalog *dp_catalog);
> u32 dp_catalog_ctrl_read_psr_interrupt_status(struct dp_catalog *dp_catalog);
> void dp_catalog_ctrl_update_transfer_unit(struct dp_catalog *dp_catalog,
> diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c
> index e367eb8e5bea..4aea72a2b8e8 100644
> --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c
> +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c
> @@ -87,6 +87,8 @@ struct dp_ctrl_private {
>
> struct clk *pixel_clk;
>
> + union phy_configure_opts phy_opts;
> +
> struct completion idle_comp;
> struct completion psr_op_comp;
> struct completion video_comp;
> @@ -1017,6 +1019,21 @@ static int dp_ctrl_wait4video_ready(struct dp_ctrl_private *ctrl)
> return ret;
> }
>
> +static int dp_ctrl_set_vx_px(struct dp_ctrl_private *ctrl,
> + u8 v_level, u8 p_level)
> +{
> + union phy_configure_opts *phy_opts = &ctrl->phy_opts;
> +
> + /* TODO: Update for all lanes instead of just first one */
> + 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_opts->dp.set_voltages = 0;
> +
> + return 0;
> +}
> +
> static int dp_ctrl_update_vx_px(struct dp_ctrl_private *ctrl)
> {
> struct dp_link *link = ctrl->link;
> @@ -1029,7 +1046,7 @@ static int dp_ctrl_update_vx_px(struct dp_ctrl_private *ctrl)
> drm_dbg_dp(ctrl->drm_dev,
> "voltage level: %d emphasis level: %d\n",
> voltage_swing_level, pre_emphasis_level);
> - ret = dp_catalog_ctrl_update_vx_px(ctrl->catalog,
> + ret = dp_ctrl_set_vx_px(ctrl,
> voltage_swing_level, pre_emphasis_level);
>
> if (ret)
> @@ -1425,16 +1442,14 @@ 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 dp_io *dp_io = &ctrl->parser->io;
> - struct phy *phy = dp_io->phy;
> - struct phy_configure_opts_dp *opts_dp = &dp_io->phy_opts.dp;
> + struct phy *phy = ctrl->parser->io.phy;
> const u8 *dpcd = ctrl->panel->dpcd;
>
> - opts_dp->lanes = ctrl->link->link_params.num_lanes;
> - opts_dp->link_rate = ctrl->link->link_params.rate / 100;
> - opts_dp->ssc = drm_dp_max_downspread(dpcd);
> + ctrl->phy_opts.dp.lanes = ctrl->link->link_params.num_lanes;
> + ctrl->phy_opts.dp.link_rate = ctrl->link->link_params.rate / 100;
> + ctrl->phy_opts.dp.ssc = drm_dp_max_downspread(dpcd);
>
> - phy_configure(phy, &dp_io->phy_opts);
> + phy_configure(phy, &ctrl->phy_opts);
> phy_power_on(phy);
>
> dev_pm_opp_set_rate(ctrl->dev, ctrl->link->link_params.rate * 1000);
> @@ -1572,14 +1587,12 @@ 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;
> int ret = 0;
> - struct dp_io *dp_io = &ctrl->parser->io;
> - struct phy *phy = dp_io->phy;
> - struct phy_configure_opts_dp *opts_dp = &dp_io->phy_opts.dp;
>
> dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, false);
> - opts_dp->lanes = ctrl->link->link_params.num_lanes;
> - phy_configure(phy, &dp_io->phy_opts);
> + ctrl->phy_opts.dp.lanes = ctrl->link->link_params.num_lanes;
> + phy_configure(phy, &ctrl->phy_opts);
> /*
> * Disable and re-enable the mainlink clock since the
> * link clock might have been adjusted as part of the
> @@ -1659,7 +1672,7 @@ static bool dp_ctrl_send_phy_test_pattern(struct dp_ctrl_private *ctrl)
>
> drm_dbg_dp(ctrl->drm_dev, "request: 0x%x\n", pattern_requested);
>
> - if (dp_catalog_ctrl_update_vx_px(ctrl->catalog,
> + if (dp_ctrl_set_vx_px(ctrl,
> ctrl->link->phy_params.v_level,
> ctrl->link->phy_params.p_level)) {
> DRM_ERROR("Failed to set v/p levels\n");
> diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h
> index cad82c4d07da..b28052e87101 100644
> --- a/drivers/gpu/drm/msm/dp/dp_parser.h
> +++ b/drivers/gpu/drm/msm/dp/dp_parser.h
> @@ -7,8 +7,6 @@
> #define _DP_PARSER_H_
>
> #include <linux/platform_device.h>
> -#include <linux/phy/phy.h>
> -#include <linux/phy/phy-dp.h>
>
> #include "msm_drv.h"
>
> @@ -37,7 +35,6 @@ struct dss_io_data {
> struct dp_io {
> struct dss_io_data dp_controller;
> struct phy *phy;
> - union phy_configure_opts phy_opts;
> };
>
> /**
>
next prev parent reply other threads:[~2024-01-26 22:23 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-26 18:26 [PATCH RESEND v3 00/15] drm/msm/dp: clear power and parser submodules away Dmitry Baryshkov
2024-01-26 18:26 ` [PATCH RESEND v3 01/15] drm/msm/dp: drop unused parser definitions Dmitry Baryshkov
2024-01-26 22:18 ` Kuogee Hsieh
2024-01-26 18:26 ` [PATCH RESEND v3 02/15] drm/msm/dp: drop unused fields from dp_power_private Dmitry Baryshkov
2024-01-26 22:19 ` Kuogee Hsieh
2024-01-26 18:26 ` [PATCH RESEND v3 03/15] drm/msm/dp: parse DT from dp_parser_get Dmitry Baryshkov
2024-01-26 22:19 ` Kuogee Hsieh
2024-01-26 18:26 ` [PATCH RESEND v3 04/15] drm/msm/dp: inline dp_power_(de)init Dmitry Baryshkov
2024-01-26 22:20 ` Kuogee Hsieh
2024-01-26 18:26 ` [PATCH RESEND v3 05/15] drm/msm/dp: fold dp_power into dp_ctrl module Dmitry Baryshkov
2024-01-26 22:20 ` Kuogee Hsieh
2024-01-26 18:26 ` [PATCH RESEND v3 06/15] drm/msm/dp: simplify stream clocks handling Dmitry Baryshkov
2024-01-26 22:21 ` Kuogee Hsieh
2024-01-26 18:26 ` [PATCH RESEND v3 07/15] drm/msm/dp: stop parsing clock names from DT Dmitry Baryshkov
2024-01-26 22:21 ` Kuogee Hsieh
2024-01-26 18:26 ` [PATCH RESEND v3 08/15] drm/msm/dp: split dp_ctrl_clk_enable into four functuions Dmitry Baryshkov
2024-01-26 22:22 ` Kuogee Hsieh
2024-01-26 18:26 ` [PATCH RESEND v3 09/15] drm/msm/dp: move phy_configure_opts to dp_ctrl Dmitry Baryshkov
2024-01-26 22:23 ` Kuogee Hsieh [this message]
2024-01-26 18:26 ` [PATCH RESEND v3 10/15] drm/msm/dp: remove PHY handling from dp_catalog.c Dmitry Baryshkov
2024-01-26 22:23 ` Kuogee Hsieh
2024-01-26 18:26 ` [PATCH RESEND v3 11/15] drm/msm/dp: handle PHY directly in dp_ctrl Dmitry Baryshkov
2024-01-26 22:23 ` Kuogee Hsieh
2024-01-26 18:26 ` [PATCH RESEND v3 12/15] drm/msm/dp: move all IO handling to dp_catalog Dmitry Baryshkov
2024-01-26 22:24 ` Kuogee Hsieh
2024-01-26 18:26 ` [PATCH RESEND v3 13/15] drm/msm/dp: move link property handling to dp_panel Dmitry Baryshkov
2024-01-26 22:24 ` Kuogee Hsieh
2024-01-26 18:26 ` [PATCH RESEND v3 14/15] drm/msm/dp: move next_bridge handling to dp_display Dmitry Baryshkov
2024-01-26 22:25 ` Kuogee Hsieh
2024-01-26 18:26 ` [PATCH RESEND v3 15/15] drm/msm/dp: drop dp_parser Dmitry Baryshkov
2024-01-26 22:25 ` Kuogee Hsieh
2024-01-26 20:23 ` [PATCH RESEND v3 00/15] drm/msm/dp: clear power and parser submodules away Dmitry Baryshkov
2024-02-19 12:30 ` Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83caa905-3cf7-ea12-79bf-5ebbc0ab25e3@quicinc.com \
--to=quic_khsieh@quicinc.com \
--cc=airlied@gmail.com \
--cc=andersson@kernel.org \
--cc=daniel@ffwll.ch \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=quic_abhinavk@quicinc.com \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=swboyd@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox