2021-01-31 11:37:00

by Mykyta Poturai

[permalink] [raw]
Subject: [PATCH 1/2] drm/bridge: dw-hdmi: Add DT binding to disable hotplug detect

Add "disable-hpd" boolean binding for the device tree. When this option
is turned on HPD-related IRQ is disabled and it is assumed that the HDMI
connector is connected all the time. This may be useful in systems where
it is impossible or undesirable to connect the HPD pin, or the
connection is broken.

Signed-off-by: Mykyta Poturai <[email protected]>
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 0c79a9ba48bb..4ca0ac130beb 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -194,6 +194,7 @@ struct dw_hdmi {
unsigned int audio_cts;
unsigned int audio_n;
bool audio_enable;
+ bool disable_hpd;

unsigned int reg_shift;
struct regmap *regm;
@@ -1559,7 +1560,7 @@ static void dw_hdmi_phy_disable(struct dw_hdmi *hdmi, void *data)
enum drm_connector_status dw_hdmi_phy_read_hpd(struct dw_hdmi *hdmi,
void *data)
{
- return hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_HPD ?
+ return hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_HPD || hdmi->disable_hpd ?
connector_status_connected : connector_status_disconnected;
}
EXPORT_SYMBOL_GPL(dw_hdmi_phy_read_hpd);
@@ -1585,6 +1586,10 @@ void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data)
* Configure the PHY RX SENSE and HPD interrupts polarities and clear
* any pending interrupt.
*/
+
+ if (hdmi->disable_hpd)
+ return;
+
hdmi_writeb(hdmi, HDMI_PHY_HPD | HDMI_PHY_RX_SENSE, HDMI_PHY_POL0);
hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE,
HDMI_IH_PHY_STAT0);
@@ -3212,6 +3217,10 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
mutex_init(&hdmi->cec_notifier_mutex);
spin_lock_init(&hdmi->audio_lock);

+ if (of_property_read_bool(np, "disable-hpd")) {
+ dev_info(hdmi->dev, "Disabling HPD\n");
+ hdmi->disable_hpd = true;
+ }
ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
if (ddc_node) {
hdmi->ddc = of_get_i2c_adapter_by_node(ddc_node);
--
2.30.0


2021-02-08 09:40:34

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH 1/2] drm/bridge: dw-hdmi: Add DT binding to disable hotplug detect

On 31/01/2021 10:55, Mykyta Poturai wrote:
> Add "disable-hpd" boolean binding for the device tree. When this option
> is turned on HPD-related IRQ is disabled and it is assumed that the HDMI
> connector is connected all the time. This may be useful in systems where
> it is impossible or undesirable to connect the HPD pin, or the
> connection is broken.

DRM mode forcing exists for this reason.

You can even force an EDID to have a fixed mode.

Neil

>
> Signed-off-by: Mykyta Poturai <[email protected]>
> ---
> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index 0c79a9ba48bb..4ca0ac130beb 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -194,6 +194,7 @@ struct dw_hdmi {
> unsigned int audio_cts;
> unsigned int audio_n;
> bool audio_enable;
> + bool disable_hpd;
>
> unsigned int reg_shift;
> struct regmap *regm;
> @@ -1559,7 +1560,7 @@ static void dw_hdmi_phy_disable(struct dw_hdmi *hdmi, void *data)
> enum drm_connector_status dw_hdmi_phy_read_hpd(struct dw_hdmi *hdmi,
> void *data)
> {
> - return hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_HPD ?
> + return hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_HPD || hdmi->disable_hpd ?
> connector_status_connected : connector_status_disconnected;
> }
> EXPORT_SYMBOL_GPL(dw_hdmi_phy_read_hpd);
> @@ -1585,6 +1586,10 @@ void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data)
> * Configure the PHY RX SENSE and HPD interrupts polarities and clear
> * any pending interrupt.
> */
> +
> + if (hdmi->disable_hpd)
> + return;
> +
> hdmi_writeb(hdmi, HDMI_PHY_HPD | HDMI_PHY_RX_SENSE, HDMI_PHY_POL0);
> hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE,
> HDMI_IH_PHY_STAT0);
> @@ -3212,6 +3217,10 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
> mutex_init(&hdmi->cec_notifier_mutex);
> spin_lock_init(&hdmi->audio_lock);
>
> + if (of_property_read_bool(np, "disable-hpd")) {
> + dev_info(hdmi->dev, "Disabling HPD\n");
> + hdmi->disable_hpd = true;
> + }
> ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
> if (ddc_node) {
> hdmi->ddc = of_get_i2c_adapter_by_node(ddc_node);
>