mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jessica Zhang <quic_jesszhan@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>
Cc: <linux-arm-msm@vger.kernel.org>,
	<dri-devel@lists.freedesktop.org>,
	<freedreno@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 12/14] drm/msm/hdmi: drop hpd-gpios support
Date: Wed, 19 Jun 2024 11:47:05 -0700	[thread overview]
Message-ID: <92b6cc8e-4e16-4b5c-a0b7-b14fd6a8627c@quicinc.com> (raw)
In-Reply-To: <20240522-fd-hdmi-hpd-v2-12-c30bdb7c5c7e@linaro.org>



On 5/22/2024 3:51 AM, Dmitry Baryshkov wrote:
> Supporting simultaneous check of native HPD and the external GPIO proved
> to be less stable than just native HPD. Drop the hpd-gpios support,
> leaving just the native HPD support. In case the native HPD doesn't work
> the user is urged to switch to specifying the HPD property to the
> hdmi-connector device.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Reviewed-by: Jessica Zhang <quic_jesszhan@quicinc.com>

> ---
>   drivers/gpu/drm/msm/hdmi/hdmi.c     | 14 +++-------
>   drivers/gpu/drm/msm/hdmi/hdmi.h     |  2 --
>   drivers/gpu/drm/msm/hdmi/hdmi_hpd.c | 53 +++----------------------------------
>   3 files changed, 7 insertions(+), 62 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
> index e160a23e962e..a9437054c015 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
> @@ -468,17 +468,9 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
>   		return dev_err_probe(dev, PTR_ERR(hdmi->extp_clk),
>   				     "failed to get extp clock\n");
>   
> -	hdmi->hpd_gpiod = devm_gpiod_get_optional(&pdev->dev, "hpd", GPIOD_IN);
> -	/* This will catch e.g. -EPROBE_DEFER */
> -	if (IS_ERR(hdmi->hpd_gpiod))
> -		return dev_err_probe(dev, PTR_ERR(hdmi->hpd_gpiod),
> -				     "failed to get hpd gpio\n");
> -
> -	if (!hdmi->hpd_gpiod)
> -		DBG("failed to get HPD gpio");
> -
> -	if (hdmi->hpd_gpiod)
> -		gpiod_set_consumer_name(hdmi->hpd_gpiod, "HDMI_HPD");
> +	if (of_find_property(dev->of_node, "hpd-gpios", NULL) ||
> +	    of_find_property(dev->of_node, "hpd-gpio", NULL))
> +		dev_warn(dev, "hpd-gpios is not supported anymore, please migrate to the hdmi-connector\n");
>   
>   	ret = msm_hdmi_get_phy(hdmi);
>   	if (ret) {
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h
> index 2a98efa8b6bd..268ff8604423 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi.h
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h
> @@ -52,8 +52,6 @@ struct hdmi {
>   	struct clk_bulk_data *pwr_clks;
>   	struct clk *extp_clk;
>   
> -	struct gpio_desc *hpd_gpiod;
> -
>   	struct hdmi_phy *phy;
>   	struct device *phy_dev;
>   
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c b/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c
> index 32e447267e3b..d3353c6148ed 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c
> @@ -69,9 +69,6 @@ int msm_hdmi_hpd_enable(struct drm_bridge *bridge)
>   	int ret;
>   	unsigned long flags;
>   
> -	if (hdmi->hpd_gpiod)
> -		gpiod_set_value_cansleep(hdmi->hpd_gpiod, 1);
> -
>   	ret = pm_runtime_resume_and_get(dev);
>   	if (ret)
>   		return ret;
> @@ -144,8 +141,11 @@ void msm_hdmi_hpd_irq(struct drm_bridge *bridge)
>   	}
>   }
>   
> -static enum drm_connector_status detect_reg(struct hdmi *hdmi)
> +enum drm_connector_status msm_hdmi_bridge_detect(
> +		struct drm_bridge *bridge)
>   {
> +	struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
> +	struct hdmi *hdmi = hdmi_bridge->hdmi;
>   	uint32_t hpd_int_status = 0;
>   	int ret;
>   
> @@ -161,48 +161,3 @@ static enum drm_connector_status detect_reg(struct hdmi *hdmi)
>   	return (hpd_int_status & HDMI_HPD_INT_STATUS_CABLE_DETECTED) ?
>   			connector_status_connected : connector_status_disconnected;
>   }
> -
> -#define HPD_GPIO_INDEX	2
> -static enum drm_connector_status detect_gpio(struct hdmi *hdmi)
> -{
> -	return gpiod_get_value(hdmi->hpd_gpiod) ?
> -			connector_status_connected :
> -			connector_status_disconnected;
> -}
> -
> -enum drm_connector_status msm_hdmi_bridge_detect(
> -		struct drm_bridge *bridge)
> -{
> -	struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
> -	struct hdmi *hdmi = hdmi_bridge->hdmi;
> -	enum drm_connector_status stat_gpio, stat_reg;
> -	int retry = 20;
> -
> -	/*
> -	 * some platforms may not have hpd gpio. Rely only on the status
> -	 * provided by REG_HDMI_HPD_INT_STATUS in this case.
> -	 */
> -	if (!hdmi->hpd_gpiod)
> -		return detect_reg(hdmi);
> -
> -	do {
> -		stat_gpio = detect_gpio(hdmi);
> -		stat_reg  = detect_reg(hdmi);
> -
> -		if (stat_gpio == stat_reg)
> -			break;
> -
> -		mdelay(10);
> -	} while (--retry);
> -
> -	/* the status we get from reading gpio seems to be more reliable,
> -	 * so trust that one the most if we didn't manage to get hdmi and
> -	 * gpio status to agree:
> -	 */
> -	if (stat_gpio != stat_reg) {
> -		DBG("HDMI_HPD_INT_STATUS tells us: %d", stat_reg);
> -		DBG("hpd gpio tells us: %d", stat_gpio);
> -	}
> -
> -	return stat_gpio;
> -}
> 
> -- 
> 2.39.2
> 

  reply	other threads:[~2024-06-19 18:47 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 10:50 [PATCH v2 00/14] drm/msm/hdmi: rework and fix the HPD even generation Dmitry Baryshkov
2024-05-22 10:50 ` [PATCH v2 01/14] drm/msm/hdmi: move the alt_iface clock to the hpd list Dmitry Baryshkov
2024-06-11 18:15   ` Jessica Zhang
2024-05-22 10:50 ` [PATCH v2 02/14] drm/msm/hdmi: simplify extp clock handling Dmitry Baryshkov
2024-06-11 18:16   ` Jessica Zhang
2024-05-22 10:50 ` [PATCH v2 03/14] drm/msm/hdmi: switch to atomic_pre_enable/post_disable Dmitry Baryshkov
2024-06-11 18:17   ` Jessica Zhang
2024-05-22 10:50 ` [PATCH v2 04/14] drm/msm/hdmi: set infoframes on all pre_enable calls Dmitry Baryshkov
2024-06-12  0:04   ` Jessica Zhang
2024-06-12  8:31     ` Dmitry Baryshkov
2024-05-22 10:50 ` [PATCH v2 05/14] drm/msm/hdmi: drop clock frequency assignment Dmitry Baryshkov
2024-06-18 23:02   ` Jessica Zhang
2024-05-22 10:50 ` [PATCH v2 06/14] drm/msm/hdmi: switch to clk_bulk API Dmitry Baryshkov
2024-06-18 23:51   ` Jessica Zhang
2024-05-22 10:50 ` [PATCH v2 07/14] drm/msm/hdmi: switch to pm_runtime_resume_and_get() Dmitry Baryshkov
2024-06-19  0:00   ` Jessica Zhang
2024-05-22 10:51 ` [PATCH v2 08/14] drm/msm/hdmi: add runtime PM calls to DDC transfer function Dmitry Baryshkov
2024-06-19  0:05   ` Jessica Zhang
2024-05-22 10:51 ` [PATCH v2 09/14] drm/msm/hdmi: implement proper runtime PM handling Dmitry Baryshkov
2024-06-19 17:36   ` Jessica Zhang
2024-05-22 10:51 ` [PATCH v2 10/14] drm/msm/hdmi: rename hpd_clks to pwr_clks Dmitry Baryshkov
2024-06-19 17:55   ` Jessica Zhang
2024-05-22 10:51 ` [PATCH v2 11/14] drm/msm/hdmi: expand the HDMI_CFG macro Dmitry Baryshkov
2024-06-19 18:11   ` Jessica Zhang
2024-05-22 10:51 ` [PATCH v2 12/14] drm/msm/hdmi: drop hpd-gpios support Dmitry Baryshkov
2024-06-19 18:47   ` Jessica Zhang [this message]
2024-05-22 10:51 ` [PATCH v2 13/14] drm/msm/hdmi: ensure that HDMI is one if HPD is requested Dmitry Baryshkov
2024-06-12 13:01   ` Markus Elfring
2024-06-12 13:22     ` Dmitry Baryshkov
2024-06-12 14:32       ` [v2 " Markus Elfring
2024-06-12 16:15         ` Dmitry Baryshkov
2024-06-19 22:13   ` [PATCH v2 " Jessica Zhang
2024-05-22 10:51 ` [PATCH v2 14/14] drm/msm/hdmi: wire in hpd_enable/hpd_disable bridge ops Dmitry Baryshkov
2024-06-19 22:14   ` Jessica Zhang
2024-06-12 12:28 ` [v2 00/14] drm/msm/hdmi: rework and fix the HPD even generation Markus Elfring

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=92b6cc8e-4e16-4b5c-a0b7-b14fd6a8627c@quicinc.com \
    --to=quic_jesszhan@quicinc.com \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    /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

all inboxes | Powered by JetHome®