* [PATCH v2] drm: bridge: dw_hdmi: only trigger hotplug event on link change
@ 2022-08-26 18:57 Lucas Stach
2022-08-29 15:43 ` Robert Foss
0 siblings, 1 reply; 2+ messages in thread
From: Lucas Stach @ 2022-08-26 18:57 UTC (permalink / raw)
To: Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Neil Armstrong, Andrzej Hajda
Cc: kernel, dri-devel, patchwork-lst
There are two events that signal a real change of the link state: HPD going
high means the sink is newly connected or wants the source to re-read the
EDID, RX sense going low is a indication that the link has been disconnected.
Ignore the other two events that also trigger interrupts, but don't need
immediate attention: HPD going low does not necessarily mean the link has
been lost and should not trigger a immediate read of the status. RX sense
going high also does not require a detect cycle, as HPD going high is the
right point in time to read the EDID.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> (v1)
---
v2: Take HDMI_PHY_RX_SENSE into account when reporting disconnect
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 25a60eb4d67c..40d8ca37f5bc 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -3096,6 +3096,7 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
{
struct dw_hdmi *hdmi = dev_id;
u8 intr_stat, phy_int_pol, phy_pol_mask, phy_stat;
+ enum drm_connector_status status = connector_status_unknown;
intr_stat = hdmi_readb(hdmi, HDMI_IH_PHY_STAT0);
phy_int_pol = hdmi_readb(hdmi, HDMI_PHY_POL0);
@@ -3134,13 +3135,15 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
cec_notifier_phys_addr_invalidate(hdmi->cec_notifier);
mutex_unlock(&hdmi->cec_notifier_mutex);
}
- }
- if (intr_stat & HDMI_IH_PHY_STAT0_HPD) {
- enum drm_connector_status status = phy_int_pol & HDMI_PHY_HPD
- ? connector_status_connected
- : connector_status_disconnected;
+ if (phy_stat & HDMI_PHY_HPD)
+ status = connector_status_connected;
+
+ if (!(phy_stat & (HDMI_PHY_HPD | HDMI_PHY_RX_SENSE)))
+ status = connector_status_disconnected;
+ }
+ if (status != connector_status_unknown) {
dev_dbg(hdmi->dev, "EVENT=%s\n",
status == connector_status_connected ?
"plugin" : "plugout");
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] drm: bridge: dw_hdmi: only trigger hotplug event on link change
2022-08-26 18:57 [PATCH v2] drm: bridge: dw_hdmi: only trigger hotplug event on link change Lucas Stach
@ 2022-08-29 15:43 ` Robert Foss
0 siblings, 0 replies; 2+ messages in thread
From: Robert Foss @ 2022-08-29 15:43 UTC (permalink / raw)
To: Lucas Stach
Cc: Jernej Skrabec, kernel, Neil Armstrong, Jonas Karlman, dri-devel,
patchwork-lst, Laurent Pinchart, Andrzej Hajda
On Fri, 26 Aug 2022 at 20:57, Lucas Stach <l.stach@pengutronix.de> wrote:
>
> There are two events that signal a real change of the link state: HPD going
> high means the sink is newly connected or wants the source to re-read the
> EDID, RX sense going low is a indication that the link has been disconnected.
>
> Ignore the other two events that also trigger interrupts, but don't need
> immediate attention: HPD going low does not necessarily mean the link has
> been lost and should not trigger a immediate read of the status. RX sense
> going high also does not require a detect cycle, as HPD going high is the
> right point in time to read the EDID.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> (v1)
> ---
> v2: Take HDMI_PHY_RX_SENSE into account when reporting disconnect
> ---
> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index 25a60eb4d67c..40d8ca37f5bc 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -3096,6 +3096,7 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
> {
> struct dw_hdmi *hdmi = dev_id;
> u8 intr_stat, phy_int_pol, phy_pol_mask, phy_stat;
> + enum drm_connector_status status = connector_status_unknown;
>
> intr_stat = hdmi_readb(hdmi, HDMI_IH_PHY_STAT0);
> phy_int_pol = hdmi_readb(hdmi, HDMI_PHY_POL0);
> @@ -3134,13 +3135,15 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
> cec_notifier_phys_addr_invalidate(hdmi->cec_notifier);
> mutex_unlock(&hdmi->cec_notifier_mutex);
> }
> - }
>
> - if (intr_stat & HDMI_IH_PHY_STAT0_HPD) {
> - enum drm_connector_status status = phy_int_pol & HDMI_PHY_HPD
> - ? connector_status_connected
> - : connector_status_disconnected;
> + if (phy_stat & HDMI_PHY_HPD)
> + status = connector_status_connected;
> +
> + if (!(phy_stat & (HDMI_PHY_HPD | HDMI_PHY_RX_SENSE)))
> + status = connector_status_disconnected;
> + }
>
> + if (status != connector_status_unknown) {
> dev_dbg(hdmi->dev, "EVENT=%s\n",
> status == connector_status_connected ?
> "plugin" : "plugout");
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Applied to drm-misc-next.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-29 15:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26 18:57 [PATCH v2] drm: bridge: dw_hdmi: only trigger hotplug event on link change Lucas Stach
2022-08-29 15:43 ` Robert Foss
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).