Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: neil.armstrong@linaro.org
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Rob Clark <robdclark@gmail.com>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Dmitry Baryshkov <lumag@kernel.org>, Sean Paul <sean@poorly.run>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Vinod Koul <vkoul@kernel.org>,
	Kishon Vijay Abraham I <kishon@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
	linux-phy@lists.infradead.org,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Subject: Re: [PATCH v4 1/5] drm/msm/hdmi: switch to generic PHY subsystem
Date: Thu, 22 May 2025 09:38:34 +0200	[thread overview]
Message-ID: <a42b9cbb-2f85-40c4-8b40-6f84970aba86@linaro.org> (raw)
In-Reply-To: <20250520-fd-hdmi-phy-v4-1-fcbaa652ad75@oss.qualcomm.com>

On 20/05/2025 22:44, Dmitry Baryshkov wrote:
> From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> 
> Change the MSM HDMI driver to use generic PHY subsystem. Moving PHY
> drivers allows better code sharing with the rest of the PHY system.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
>   drivers/gpu/drm/msm/Makefile                     |   7 -
>   drivers/gpu/drm/msm/hdmi/hdmi.c                  |  58 +-
>   drivers/gpu/drm/msm/hdmi/hdmi.h                  |  80 +--
>   drivers/gpu/drm/msm/hdmi/hdmi_bridge.c           |  32 +-
>   drivers/gpu/drm/msm/hdmi/hdmi_phy.c              | 225 -------
>   drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c         |  51 --
>   drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c         | 765 ----------------------
>   drivers/gpu/drm/msm/hdmi/hdmi_phy_8998.c         | 769 -----------------------
>   drivers/gpu/drm/msm/hdmi/hdmi_phy_8x60.c         | 141 -----
>   drivers/gpu/drm/msm/hdmi/hdmi_phy_8x74.c         |  44 --
>   drivers/gpu/drm/msm/hdmi/hdmi_pll_8960.c         | 458 --------------
>   drivers/phy/qualcomm/Kconfig                     |  21 +
>   drivers/phy/qualcomm/Makefile                    |  14 +
>   drivers/phy/qualcomm/phy-qcom-hdmi-28hpm.c       |  71 +++
>   drivers/phy/qualcomm/phy-qcom-hdmi-28lpm.c       | 441 +++++++++++++
>   drivers/phy/qualcomm/phy-qcom-hdmi-45nm.c        | 186 ++++++
>   drivers/phy/qualcomm/phy-qcom-hdmi-preqmp.c      | 212 +++++++
>   drivers/phy/qualcomm/phy-qcom-hdmi-preqmp.h      |  81 +++
>   drivers/phy/qualcomm/phy-qcom-qmp-hdmi-base.c    | 185 ++++++
>   drivers/phy/qualcomm/phy-qcom-qmp-hdmi-msm8996.c | 442 +++++++++++++
>   drivers/phy/qualcomm/phy-qcom-qmp-hdmi-msm8998.c | 495 +++++++++++++++
>   drivers/phy/qualcomm/phy-qcom-qmp-hdmi.h         |  77 +++
>   22 files changed, 2259 insertions(+), 2596 deletions(-)
> 

<snip>

> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
> index 53a7ce8cc7bc7b6278eae2cbc42c3fda8d697f6d..1a00c26c1b40fc81623c9fb22ba25f448c27bffb 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
> @@ -5,6 +5,7 @@
>    */
>   
>   #include <linux/delay.h>
> +#include <linux/phy/phy.h>
>   #include <drm/drm_bridge_connector.h>
>   #include <drm/drm_edid.h>
>   #include <drm/display/drm_hdmi_helper.h>
> @@ -286,11 +287,12 @@ static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
>   {
>   	struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
>   	struct hdmi *hdmi = hdmi_bridge->hdmi;
> -	struct hdmi_phy *phy = hdmi->phy;
>   	struct drm_encoder *encoder = bridge->encoder;
>   	struct drm_connector *connector;
>   	struct drm_connector_state *conn_state;
>   	struct drm_crtc_state *crtc_state;
> +	union phy_configure_opts phy_opts;
> +	int ret;
>   
>   	DBG("power up");
>   
> @@ -304,7 +306,7 @@ static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
>   
>   	mutex_lock(&hdmi->state_mutex);
>   	if (!hdmi->power_on) {
> -		msm_hdmi_phy_resource_enable(phy);
> +		phy_init(hdmi->phy);
>   		msm_hdmi_power_on(bridge);
>   		hdmi->power_on = true;
>   	}
> @@ -315,7 +317,23 @@ static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
>   
>   	drm_atomic_helper_connector_hdmi_update_infoframes(connector, state);
>   
> -	msm_hdmi_phy_powerup(phy, hdmi->pixclock);
> +	phy_opts.hdmi.tmds_char_rate = conn_state->hdmi.tmds_char_rate;
> +	phy_opts.hdmi.bpc = 8;
> +	phy_configure(hdmi->phy, &phy_opts);
> +
> +	ret = phy_power_on(hdmi->phy);
> +	if (WARN_ON(ret))
> +		return;
> +
> +	if (hdmi->extp_clk) {
> +		ret = clk_set_rate(hdmi->extp_clk, hdmi->pixclock);
> +		if (ret)
> +			DRM_DEV_ERROR(bridge->dev->dev, "failed to set extp clk rate: %d\n", ret);
> +
> +		ret = clk_prepare_enable(hdmi->extp_clk);
> +		if (ret)
> +			DRM_DEV_ERROR(bridge->dev->dev, "failed to enable extp clk: %d\n", ret);
> +	}

Why do you again set the extp_clk since it's already set & enabled in msm_hdmi_power_on() ?

Perhaps I missed a change but it's like that on next-20250521

>   
>   	msm_hdmi_set_mode(hdmi, true);
>   
> @@ -328,7 +346,6 @@ static void msm_hdmi_bridge_atomic_post_disable(struct drm_bridge *bridge,
>   {
>   	struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
>   	struct hdmi *hdmi = hdmi_bridge->hdmi;
> -	struct hdmi_phy *phy = hdmi->phy;
>   
>   	if (hdmi->hdcp_ctrl)
>   		msm_hdmi_hdcp_off(hdmi->hdcp_ctrl);
> @@ -339,14 +356,17 @@ static void msm_hdmi_bridge_atomic_post_disable(struct drm_bridge *bridge,
>   	mutex_lock(&hdmi->state_mutex);
>   	msm_hdmi_set_mode(hdmi, hdmi->hpd_enabled);
>   
> -	msm_hdmi_phy_powerdown(phy);
> +	if (hdmi->extp_clk)
> +		clk_disable_unprepare(hdmi->extp_clk);
> +
> +	phy_power_off(hdmi->phy);
>   
>   	if (hdmi->power_on) {
>   		power_off(bridge);
>   		hdmi->power_on = false;
>   		if (hdmi->connector->display_info.is_hdmi)
>   			msm_hdmi_audio_update(hdmi);
> -		msm_hdmi_phy_resource_disable(phy);
> +		phy_exit(hdmi->phy);
>   	}
>   	mutex_unlock(&hdmi->state_mutex);
>   }
<snip>

Otherwise it looks fine even there's a lot to digest and hard to figure out
the exact changes done to the PHY drivers.

Neil

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2025-05-22  7:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-20 20:44 [PATCH v4 0/5] drm/msm/hdmi & phy: use generic PHY framework Dmitry Baryshkov
2025-05-20 20:44 ` [PATCH v4 1/5] drm/msm/hdmi: switch to generic PHY subsystem Dmitry Baryshkov
2025-05-22  7:38   ` neil.armstrong [this message]
2025-05-22 12:39     ` Dmitry Baryshkov
2025-05-20 20:44 ` [PATCH v4 2/5] phy: qcom: apq8064-sata: extract UNI PLL register defines Dmitry Baryshkov
2025-05-22  7:23   ` neil.armstrong
2025-05-20 20:44 ` [PATCH v4 3/5] phy: qcom-uniphy: add more registers from display PHYs Dmitry Baryshkov
2025-05-22  7:23   ` neil.armstrong
2025-05-20 20:44 ` [PATCH v4 4/5] phy: qualcomm: add MSM8974 HDMI PHY support Dmitry Baryshkov
2025-05-20 20:44 ` [PATCH v4 5/5] drm/msm/registers: drop HDMI PHY register definitions 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=a42b9cbb-2f85-40c4-8b40-6f84970aba86@linaro.org \
    --to=neil.armstrong@linaro.org \
    --cc=airlied@gmail.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=kishon@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=lumag@kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=simona@ffwll.ch \
    --cc=vkoul@kernel.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