Skip to contentSkip to conversation

drm/tidss: Use new connector model for tidss

PATCH Superseded Nikhil Devshatwar 3 participants 21 messages Nov 9, 2020 – Nov 12, 2020

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover drm/tidss: Use new connector model for tidss

This series moves the tidss to using new connectoe model, where the SoC driver (tidss) creates the connector and all the bridges are attached with the flag DRM_BRIDGE_ATTACH_NO_CONNECTOR

Since the bridges do not create the connector, the bus format and bus_flag is set after the format negotiation.
Support format negotiations in the tfp410 and mhdp bridge drivers as a first step before moving the connector model.

Nikhil Devshatwar (6):
drm: bridge: Propagate the bus flags from bridge->timings drm/bridge: tfp410: Support format negotiation hooks drm/bridge: mhdp8546: Add minimal format negotiation drm/tidss: Set bus_format correctly from bridge/connector drm/tidss: Move to newer connector model drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable

 .../drm/bridge/cadence/cdns-mhdp8546-core.c   | 32 ++++++++++++++++--
 drivers/gpu/drm/bridge/ti-tfp410.c            | 33 +++++++++++++++++++
 drivers/gpu/drm/drm_bridge.c                  |  8 +++++
 drivers/gpu/drm/tidss/tidss_drv.h             |  3 ++
 drivers/gpu/drm/tidss/tidss_encoder.c         | 22 ++++++++-----
 drivers/gpu/drm/tidss/tidss_kms.c             | 19 ++++++++++-
 6 files changed, 106 insertions(+), 11 deletions(-)
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH v2 1/6 drm: bridge: Propagate the bus flags from bridge->timings

bus_flags can be specified by a bridge in the timings. If the bridge provides it, Override the bus_flags when propagating from next bridge.

---
 drivers/gpu/drm/drm_bridge.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_bridge.c +8 -0
index 64f0effb52ac..2bbd6ffe82ce 100644
@@ -975,6 +975,14 @@ drm_atomic_bridge_propagate_bus_flags(struct drm_bridge *bridge,
 	 * duplicate the "dummy propagation" logic.
 	 */
 	bridge_state->input_bus_cfg.flags = output_flags;
+
+	/*
+	 * If the bus flags are provided in timing, use those even if the next
+	 * bridge specifies something
+	 */
+	if (bridge->timings && bridge->timings->input_bus_flags)
+		bridge_state->input_bus_cfg.flags =
+			bridge->timings->input_bus_flags;
 }
 
 /**
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v2 1/6
#2 lore raw

Re: [PATCH v2 1/6] drm: bridge: Propagate the bus flags from bridge->timings

Quoted 16 lines · Nikhil Devshatwar

bus_flags can be specified by a bridge in the timings. If the bridge provides it, Override the bus_flags when propagating from next bridge.

---
 drivers/gpu/drm/drm_bridge.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_bridge.c +0 -0
index 64f0effb52ac..2bbd6ffe82ce 100644
@@ -975,6 +975,14 @@ drm_atomic_bridge_propagate_bus_flags(struct drm_bridge *bridge,
 	 * duplicate the "dummy propagation" logic.
 	 */

drivers/gpu/drm/drm_bridge.c drm_atomic_bridge_propagate_bus_flags(struct drm_bridge *bridge, · line 986

Quoted 10 lines
drivers/gpu/drm/drm_bridge.c +8 -0
 	bridge_state->input_bus_cfg.flags = output_flags;
+
+	/*
+	 * If the bus flags are provided in timing, use those even if the next
+	 * bridge specifies something
+	 */
+	if (bridge->timings && bridge->timings->input_bus_flags)
+		bridge_state->input_bus_cfg.flags =
+			bridge->timings->input_bus_flags;
 }

I think the comment could be more clear. Maybe something like:

If legacy bus flags are provided in bridge->timings, use those as input flags instead of propagating the output flags.

Other than that:

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH v2 2/6 drm/bridge: tfp410: Support format negotiation hooks

In reply to Nikhil Devshatwar

With new connector model, tfp410 will not create the connector and SoC driver will rely on format negotiation to setup the encoder format.

Support format negotiations hooks in the drm_bridge_funcs. Use helper functions for state management.

Output format is expected to be MEDIA_BUS_FMT_FIXED Input format is the one selected by the bridge from DT properties.

---
 drivers/gpu/drm/bridge/ti-tfp410.c | 33 ++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
drivers/gpu/drm/bridge/ti-tfp410.c +33 -0
index ba3fa2a9b8a4..f56dbe246e57 100644
@@ -204,12 +204,45 @@ static enum drm_mode_status tfp410_mode_valid(struct drm_bridge *bridge,
 	return MODE_OK;
 }
 
+static u32 *tfp410_get_input_bus_fmts(struct drm_bridge *bridge,
+				      struct drm_bridge_state *bridge_state,
+				      struct drm_crtc_state *crtc_state,
+				      struct drm_connector_state *conn_state,
+				      u32 output_fmt,
+				      unsigned int *num_input_fmts)
+{
+	struct tfp410 *dvi = drm_bridge_to_tfp410(bridge);
+	u32 *input_fmts;
+
+	*num_input_fmts = 0;
+
+	/*
+	 * Output of tfp410 is DVI, which is TMDS.
+	 * There is no media format defined for this
+	 * Using MEDIA_BUS_FMT_FIXED for now
+	 */
+	if (output_fmt != MEDIA_BUS_FMT_FIXED)
+		return NULL;
+
+	input_fmts = kzalloc(sizeof(*input_fmts), GFP_KERNEL);
+	if (!input_fmts)
+		return NULL;
+
+	*num_input_fmts = 1;
+	input_fmts[0] = dvi->bus_format;
+	return input_fmts;
+}
+
 static const struct drm_bridge_funcs tfp410_bridge_funcs = {
 	.attach		= tfp410_attach,
 	.detach		= tfp410_detach,
 	.enable		= tfp410_enable,
 	.disable	= tfp410_disable,
 	.mode_valid	= tfp410_mode_valid,
+	.atomic_reset = drm_atomic_helper_bridge_reset,
+	.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
+	.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
+	.atomic_get_input_bus_fmts = tfp410_get_input_bus_fmts,
 };
 
 static const struct drm_bridge_timings tfp410_default_timings = {
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v2 2/6
#4 lore raw

Re: [PATCH v2 2/6] drm/bridge: tfp410: Support format negotiation hooks

Quoted 29 lines · Nikhil Devshatwar

With new connector model, tfp410 will not create the connector and SoC driver will rely on format negotiation to setup the encoder format.

Support format negotiations hooks in the drm_bridge_funcs. Use helper functions for state management.

Output format is expected to be MEDIA_BUS_FMT_FIXED Input format is the one selected by the bridge from DT properties.

---
 drivers/gpu/drm/bridge/ti-tfp410.c | 33 ++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
drivers/gpu/drm/bridge/ti-tfp410.c +7 -0
index ba3fa2a9b8a4..f56dbe246e57 100644
@@ -204,12 +204,45 @@ static enum drm_mode_status tfp410_mode_valid(struct drm_bridge *bridge,
 	return MODE_OK;
 }
 
+static u32 *tfp410_get_input_bus_fmts(struct drm_bridge *bridge,
+				      struct drm_bridge_state *bridge_state,
+				      struct drm_crtc_state *crtc_state,
+				      struct drm_connector_state *conn_state,
+				      u32 output_fmt,
+				      unsigned int *num_input_fmts)
+{

drivers/gpu/drm/bridge/ti-tfp410.c static enum drm_mode_status tfp410_mode_valid(struct drm_bridge *bridge, · line 223

Quoted 10 lines
drivers/gpu/drm/bridge/ti-tfp410.c +10 -0
+	struct tfp410 *dvi = drm_bridge_to_tfp410(bridge);
+	u32 *input_fmts;
+
+	*num_input_fmts = 0;
+
+	/*
+	 * Output of tfp410 is DVI, which is TMDS.
+	 * There is no media format defined for this
+	 * Using MEDIA_BUS_FMT_FIXED for now
+	 */

Please fix the missing punctiation marks.

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

PATCH v2 3/6 drm/bridge: mhdp8546: Add minimal format negotiation

In reply to Nikhil Devshatwar

With new connector model, mhdp bridge will not create the connector and SoC driver will rely on format negotiation to setup the encoder format.

Support minimal format negotiations hooks in the drm_bridge_funcs. Complete format negotiation can be added based on EDID data. This patch adds the minimal required support to avoid failure after moving to new connector model.

---
 .../drm/bridge/cadence/cdns-mhdp8546-core.c   | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +25 -0
index d0c65610ebb5..2cd809eed827 100644
@@ -2078,6 +2078,30 @@ cdns_mhdp_bridge_atomic_reset(struct drm_bridge *bridge)
 	return &cdns_mhdp_state->base;
 }
 
+static u32 *cdns_mhdp_get_input_bus_fmts(struct drm_bridge *bridge,
+				      struct drm_bridge_state *bridge_state,
+				      struct drm_crtc_state *crtc_state,
+				      struct drm_connector_state *conn_state,
+				      u32 output_fmt,
+				      unsigned int *num_input_fmts)
+{
+	u32 *input_fmts;
+	u32 default_bus_format = MEDIA_BUS_FMT_RGB121212_1X36;
+
+	*num_input_fmts = 0;
+
+	if (output_fmt != MEDIA_BUS_FMT_FIXED)
+		return NULL;
+
+	input_fmts = kzalloc(sizeof(*input_fmts), GFP_KERNEL);
+	if (!input_fmts)
+		return NULL;
+
+	*num_input_fmts = 1;
+	input_fmts[0] = default_bus_format;
+	return input_fmts;
+}
+
 static int cdns_mhdp_atomic_check(struct drm_bridge *bridge,
 				  struct drm_bridge_state *bridge_state,
 				  struct drm_crtc_state *crtc_state,
@@ -2142,6 +2166,7 @@ static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = {
 	.atomic_duplicate_state = cdns_mhdp_bridge_atomic_duplicate_state,
 	.atomic_destroy_state = cdns_mhdp_bridge_atomic_destroy_state,
 	.atomic_reset = cdns_mhdp_bridge_atomic_reset,
+	.atomic_get_input_bus_fmts = cdns_mhdp_get_input_bus_fmts,
 	.detect = cdns_mhdp_bridge_detect,
 	.get_edid = cdns_mhdp_bridge_get_edid,
 	.hpd_enable = cdns_mhdp_bridge_hpd_enable,
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v2 3/6
#6 lore raw

Re: [PATCH v2 3/6] drm/bridge: mhdp8546: Add minimal format negotiation

Quoted 50 lines · Nikhil Devshatwar

With new connector model, mhdp bridge will not create the connector and SoC driver will rely on format negotiation to setup the encoder format.

Support minimal format negotiations hooks in the drm_bridge_funcs. Complete format negotiation can be added based on EDID data. This patch adds the minimal required support to avoid failure after moving to new connector model.

---
 .../drm/bridge/cadence/cdns-mhdp8546-core.c   | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +24 -0
index d0c65610ebb5..2cd809eed827 100644
@@ -2078,6 +2078,30 @@ cdns_mhdp_bridge_atomic_reset(struct drm_bridge *bridge)
 	return &cdns_mhdp_state->base;
 }
 
+static u32 *cdns_mhdp_get_input_bus_fmts(struct drm_bridge *bridge,
+				      struct drm_bridge_state *bridge_state,
+				      struct drm_crtc_state *crtc_state,
+				      struct drm_connector_state *conn_state,
+				      u32 output_fmt,
+				      unsigned int *num_input_fmts)
+{
+	u32 *input_fmts;
+	u32 default_bus_format = MEDIA_BUS_FMT_RGB121212_1X36;
+
+	*num_input_fmts = 0;
+
+	if (output_fmt != MEDIA_BUS_FMT_FIXED)
+		return NULL;
+
+	input_fmts = kzalloc(sizeof(*input_fmts), GFP_KERNEL);
+	if (!input_fmts)
+		return NULL;
+
+	*num_input_fmts = 1;
+	input_fmts[0] = default_bus_format;
+	return input_fmts;
+}
+
 static int cdns_mhdp_atomic_check(struct drm_bridge *bridge,
 				  struct drm_bridge_state *bridge_state,
 				  struct drm_crtc_state *crtc_state,

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = { · line 2172

Quoted 7 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +1 -0
@@ -2142,6 +2166,7 @@ static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = {
 	.atomic_duplicate_state = cdns_mhdp_bridge_atomic_duplicate_state,
 	.atomic_destroy_state = cdns_mhdp_bridge_atomic_destroy_state,
 	.atomic_reset = cdns_mhdp_bridge_atomic_reset,
+	.atomic_get_input_bus_fmts = cdns_mhdp_get_input_bus_fmts,
 	.detect = cdns_mhdp_bridge_detect,
 	.get_edid = cdns_mhdp_bridge_get_edid,
 	.hpd_enable = cdns_mhdp_bridge_hpd_enable,

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw

PATCH v2 4/6 drm/tidss: Set bus_format correctly from bridge/connector

In reply to Nikhil Devshatwar

When there is a chain of bridges attached to the encoder, the bus_format should be ideally set from the input format of the first bridge in the chain.

Use the bridge state to get the negotiated bus_format. If the bridge does not support format negotiation, error out and fail.

---
 drivers/gpu/drm/tidss/tidss_encoder.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/gpu/drm/tidss/tidss_encoder.c +14 -8
index e278a9c89476..ba5b6fccabe7 100644
@@ -22,6 +22,7 @@ static int tidss_encoder_atomic_check(struct drm_encoder *encoder,
 	struct drm_device *ddev = encoder->dev;
 	struct tidss_crtc_state *tcrtc_state = to_tidss_crtc_state(crtc_state);
 	struct drm_display_info *di = &conn_state->connector->display_info;
+	struct drm_bridge_state *bstate;
 	struct drm_bridge *bridge;
 	bool bus_flags_set = false;
 
@@ -41,17 +42,22 @@ static int tidss_encoder_atomic_check(struct drm_encoder *encoder,
 		break;
 	}
 
-	if (!di->bus_formats || di->num_bus_formats == 0)  {
-		dev_err(ddev->dev, "%s: No bus_formats in connected display\n",
-			__func__);
-		return -EINVAL;
-	}
-
-	// XXX any cleaner way to set bus format and flags?
-	tcrtc_state->bus_format = di->bus_formats[0];
 	if (!bus_flags_set)
 		tcrtc_state->bus_flags = di->bus_flags;
 
+	/* Copy the bus_format from the input_bus_format of first bridge */
+	bridge = drm_bridge_chain_get_first_bridge(encoder);
+	bstate = drm_atomic_get_new_bridge_state(crtc_state->state, bridge);
+	if (bstate)
+		tcrtc_state->bus_format = bstate->input_bus_cfg.format;
+
+	if (tcrtc_state->bus_format == 0 ||
+	    tcrtc_state->bus_format == MEDIA_BUS_FMT_FIXED) {
+
+		dev_err(ddev->dev, "Bridge connected to the encoder did not specify media bus format\n");
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw

Re: [PATCH v2 4/6] drm/tidss: Set bus_format correctly from bridge/connector

Quoted 44 lines · Nikhil Devshatwar

When there is a chain of bridges attached to the encoder, the bus_format should be ideally set from the input format of the first bridge in the chain.

Use the bridge state to get the negotiated bus_format. If the bridge does not support format negotiation, error out and fail.

---
 drivers/gpu/drm/tidss/tidss_encoder.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/gpu/drm/tidss/tidss_encoder.c +5 -8
index e278a9c89476..ba5b6fccabe7 100644
@@ -22,6 +22,7 @@ static int tidss_encoder_atomic_check(struct drm_encoder *encoder,
 	struct drm_device *ddev = encoder->dev;
 	struct tidss_crtc_state *tcrtc_state = to_tidss_crtc_state(crtc_state);
 	struct drm_display_info *di = &conn_state->connector->display_info;
+	struct drm_bridge_state *bstate;
 	struct drm_bridge *bridge;
 	bool bus_flags_set = false;
 
@@ -41,17 +42,22 @@ static int tidss_encoder_atomic_check(struct drm_encoder *encoder,
 		break;
 	}
 
-	if (!di->bus_formats || di->num_bus_formats == 0)  {
-		dev_err(ddev->dev, "%s: No bus_formats in connected display\n",
-			__func__);
-		return -EINVAL;
-	}
-
-	// XXX any cleaner way to set bus format and flags?
-	tcrtc_state->bus_format = di->bus_formats[0];
 	if (!bus_flags_set)
 		tcrtc_state->bus_flags = di->bus_flags;
 
+	/* Copy the bus_format from the input_bus_format of first bridge */
+	bridge = drm_bridge_chain_get_first_bridge(encoder);
+	bstate = drm_atomic_get_new_bridge_state(crtc_state->state, bridge);
+	if (bstate)

drivers/gpu/drm/tidss/tidss_encoder.c static int tidss_encoder_atomic_check(struct drm_encoder *encoder, · line 61

Quoted 10 lines
drivers/gpu/drm/tidss/tidss_encoder.c +9 -0
+		tcrtc_state->bus_format = bstate->input_bus_cfg.format;
+
+	if (tcrtc_state->bus_format == 0 ||
+	    tcrtc_state->bus_format == MEDIA_BUS_FMT_FIXED) {
+
+		dev_err(ddev->dev, "Bridge connected to the encoder did not specify media bus format\n");
+		return -EINVAL;
+	}
+
 	return 0;

We should also take the bus flags from the bridge state (next bridge's input_bus_cfg.flags).

And... If I read this right, we always fail if there's no bstate. So we could just do "if (!bstate) fail;"

And if we always expect to have bstate, and get bus flags and formats from there, we don't need the current drm_for_each_bridge_in_chain() loop or taking bus_flags from display info.

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw

PATCH v2 5/6 drm/tidss: Move to newer connector model

In reply to Nikhil Devshatwar

To be able to support connector operations across multiple bridges, it is recommended that the connector should be created by the SoC driver instead of the bridges.

Modify the tidss modesetting initialization sequence to create the connector and attach bridges with flag DRM_BRIDGE_ATTACH_NO_CONNECTOR

---
 drivers/gpu/drm/tidss/tidss_drv.h |  3 +++
 drivers/gpu/drm/tidss/tidss_kms.c | 19 ++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
drivers/gpu/drm/tidss/tidss_drv.h +3 -0
index 7de4bba52e6f..cfbf85a4d92b 100644
@@ -27,6 +27,9 @@ struct tidss_device {
 	unsigned int num_planes;
 	struct drm_plane *planes[TIDSS_MAX_PLANES];
 
+	unsigned int num_connectors;
+	struct drm_connector *connectors[TIDSS_MAX_PORTS];
+
 	spinlock_t wait_lock;	/* protects the irq masks */
 	dispc_irq_t irq_mask;	/* enabled irqs in addition to wait_list */
 };
drivers/gpu/drm/tidss/tidss_kms.c +18 -1
index 09485c7f0d6f..1f5ae153b114 100644
@@ -7,6 +7,7 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_bridge.h>
+#include <drm/drm_bridge_connector.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_fb_helper.h>
@@ -192,6 +193,7 @@ static int tidss_dispc_modeset_init(struct tidss_device *tidss)
 	for (i = 0; i < num_pipes; ++i) {
 		struct tidss_plane *tplane;
 		struct tidss_crtc *tcrtc;
+		struct drm_connector *connector;
 		struct drm_encoder *enc;
 		u32 hw_plane_id = feat->vid_order[tidss->num_planes];
 		int ret;
@@ -222,11 +224,26 @@ static int tidss_dispc_modeset_init(struct tidss_device *tidss)
 			return PTR_ERR(enc);
 		}
 
-		ret = drm_bridge_attach(enc, pipes[i].bridge, NULL, 0);
+		ret = drm_bridge_attach(enc, pipes[i].bridge, NULL,
+					DRM_BRIDGE_ATTACH_NO_CONNECTOR);
 		if (ret) {
 			dev_err(tidss->dev, "bridge attach failed: %d\n", ret);
 			return ret;
 		}
+
+		connector = drm_bridge_connector_init(&tidss->ddev, enc);
+		if (IS_ERR(connector)) {
+			dev_err(tidss->dev, "bridge_connector create failed\n");
+			return PTR_ERR(connector);
+		}
+
+		tidss->connectors[tidss->num_connectors++] = connector;
+
+		ret = drm_connector_attach_encoder(connector, enc);
+		if (ret) {
+			dev_err(tidss->dev, "attaching encoder to connector failed\n");
+			return ret;
+		}
 	}
 
 	/* create overlay planes of the leftover planes */
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v2 5/6
#10 lore raw

Re: [PATCH v2 5/6] drm/tidss: Move to newer connector model

Quoted 8 lines · Nikhil Devshatwar

To be able to support connector operations across multiple bridges, it is recommended that the connector should be created by the SoC driver instead of the bridges.

Modify the tidss modesetting initialization sequence to create the connector and attach bridges with flag DRM_BRIDGE_ATTACH_NO_CONNECTOR

Quoted 6 lines
---
 drivers/gpu/drm/tidss/tidss_drv.h |  3 +++
 drivers/gpu/drm/tidss/tidss_kms.c | 19 ++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

You're missing Laurent's r-by, which he gave earlier.

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#11 lore raw

PATCH v2 6/6 drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable

In reply to Nikhil Devshatwar

When removing the tidss driver, there is a warning reported by kernel about an unhandled interrupt for mhdp driver.

[   43.238895] irq 31: nobody cared (try booting with the "irqpoll" option)
... [snipped backtrace]
[   43.330735] handlers:
[   43.333020] [<000000005367c4f9>] irq_default_primary_handler threaded [<000000007e02b601>]
cdns_mhdp_irq_handler [cdns_mhdp8546]
[   43.344607] Disabling IRQ #31

This happens because as part of cdns_mhdp_bridge_hpd_disable, driver tries to disable the interrupts. While disabling the SW_EVENT interrupts, it accidentally enables the MBOX interrupts, which are not handled by the driver.

Fix this with a read-modify-write to update only required bits. Do the same for enabling interrupts as well.

---
 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +5 -2
index 2cd809eed827..6beccd2a408e 100644
@@ -2146,7 +2146,8 @@ static void cdns_mhdp_bridge_hpd_enable(struct drm_bridge *bridge)
 
 	/* Enable SW event interrupts */
 	if (mhdp->bridge_attached)
-		writel(~(u32)CDNS_APB_INT_MASK_SW_EVENT_INT,
+		writel(readl(mhdp->regs + CDNS_APB_INT_MASK) &
+		       ~CDNS_APB_INT_MASK_SW_EVENT_INT,
 		       mhdp->regs + CDNS_APB_INT_MASK);
 }
 
@@ -2154,7 +2155,9 @@ static void cdns_mhdp_bridge_hpd_disable(struct drm_bridge *bridge)
 {
 	struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge);
 
-	writel(CDNS_APB_INT_MASK_SW_EVENT_INT, mhdp->regs + CDNS_APB_INT_MASK);
+	writel(readl(mhdp->regs + CDNS_APB_INT_MASK) |
+	       CDNS_APB_INT_MASK_SW_EVENT_INT,
+	       mhdp->regs + CDNS_APB_INT_MASK);
 }
 
 static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = {
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#12 lore raw

Re: [PATCH v2 6/6] drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable

Quoted 38 lines · Nikhil Devshatwar

When removing the tidss driver, there is a warning reported by kernel about an unhandled interrupt for mhdp driver.

[   43.238895] irq 31: nobody cared (try booting with the "irqpoll" option)
... [snipped backtrace]
[   43.330735] handlers:
[   43.333020] [<000000005367c4f9>] irq_default_primary_handler threaded [<000000007e02b601>]
cdns_mhdp_irq_handler [cdns_mhdp8546]
[   43.344607] Disabling IRQ #31

This happens because as part of cdns_mhdp_bridge_hpd_disable, driver tries to disable the interrupts. While disabling the SW_EVENT interrupts, it accidentally enables the MBOX interrupts, which are not handled by the driver.

Fix this with a read-modify-write to update only required bits. Do the same for enabling interrupts as well.

---
 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +2 -1
index 2cd809eed827..6beccd2a408e 100644
@@ -2146,7 +2146,8 @@ static void cdns_mhdp_bridge_hpd_enable(struct drm_bridge *bridge)
 
 	/* Enable SW event interrupts */
 	if (mhdp->bridge_attached)
-		writel(~(u32)CDNS_APB_INT_MASK_SW_EVENT_INT,
+		writel(readl(mhdp->regs + CDNS_APB_INT_MASK) &
+		       ~CDNS_APB_INT_MASK_SW_EVENT_INT,
 		       mhdp->regs + CDNS_APB_INT_MASK);
 }
 

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static void cdns_mhdp_bridge_hpd_disable(struct drm_bridge *bridge) · line 2163

Quoted 10 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +3 -1
@@ -2154,7 +2155,9 @@ static void cdns_mhdp_bridge_hpd_disable(struct drm_bridge *bridge)
 {
 	struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge);
 
-	writel(CDNS_APB_INT_MASK_SW_EVENT_INT, mhdp->regs + CDNS_APB_INT_MASK);
+	writel(readl(mhdp->regs + CDNS_APB_INT_MASK) |
+	       CDNS_APB_INT_MASK_SW_EVENT_INT,
+	       mhdp->regs + CDNS_APB_INT_MASK);
 }
 
 static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = {

Good catch. I wonder why we need the above functions... We already enable and disable the interrupts when attaching/detaching the driver. And I think we want to get the interrupt even if we won't report HPD (but I think we always do report it), as we need the interrupts to track the link status.

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#13 lore raw

Re: [PATCH v2 6/6] drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable

Quoted 48 lines · Tomi Valkeinen
Quoted 47 lines · Nikhil Devshatwar

When removing the tidss driver, there is a warning reported by kernel about an unhandled interrupt for mhdp driver.

[   43.238895] irq 31: nobody cared (try booting with the "irqpoll" option)
... [snipped backtrace]
[   43.330735] handlers:
[   43.333020] [<000000005367c4f9>] irq_default_primary_handler threaded [<000000007e02b601>]
cdns_mhdp_irq_handler [cdns_mhdp8546]
[   43.344607] Disabling IRQ #31

This happens because as part of cdns_mhdp_bridge_hpd_disable, driver tries to disable the interrupts. While disabling the SW_EVENT interrupts, it accidentally enables the MBOX interrupts, which are not handled by the driver.

Fix this with a read-modify-write to update only required bits. Do the same for enabling interrupts as well.

---
 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +5 -2
index 2cd809eed827..6beccd2a408e 100644
@@ -2146,7 +2146,8 @@ static void cdns_mhdp_bridge_hpd_enable(struct drm_bridge *bridge)
 
 	/* Enable SW event interrupts */
 	if (mhdp->bridge_attached)
-		writel(~(u32)CDNS_APB_INT_MASK_SW_EVENT_INT,
+		writel(readl(mhdp->regs + CDNS_APB_INT_MASK) &
+		       ~CDNS_APB_INT_MASK_SW_EVENT_INT,
 		       mhdp->regs + CDNS_APB_INT_MASK);
 }
 
@@ -2154,7 +2155,9 @@ static void cdns_mhdp_bridge_hpd_disable(struct drm_bridge *bridge)
 {
 	struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge);
 
-	writel(CDNS_APB_INT_MASK_SW_EVENT_INT, mhdp->regs + CDNS_APB_INT_MASK);
+	writel(readl(mhdp->regs + CDNS_APB_INT_MASK) |
+	       CDNS_APB_INT_MASK_SW_EVENT_INT,
+	       mhdp->regs + CDNS_APB_INT_MASK);
 }
 
Quoted 6 lines

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static void cdns_mhdp_bridge_hpd_disable(struct drm_bridge *bridge) · line 2163

Quoted 1 line
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +0 -0
 static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = {

Good catch. I wonder why we need the above functions... We already enable and disable the interrupts when attaching/detaching the driver. And I think we want to get the interrupt even if we won't report HPD (but I think we always do report it), as we need the interrupts to track the link status.

I read from the code that there is TODO for handling the mailbox interrupts in the driver. Once that is supported, you will be able to explictily enable/disable interrupts for SW_EVENTS (like hotplug) as well as mailbox events. This enabling specific bits in the interrupt status.

Nikhil D

Quoted 5 lines

Tomi

Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#14 lore raw

Re: [PATCH v2 6/6] drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable

Quoted 56 lines · Nikhil Devshatwar
Quoted 48 lines · Tomi Valkeinen
Quoted 47 lines · Nikhil Devshatwar

When removing the tidss driver, there is a warning reported by kernel about an unhandled interrupt for mhdp driver.

[   43.238895] irq 31: nobody cared (try booting with the "irqpoll" option)
... [snipped backtrace]
[   43.330735] handlers:
[   43.333020] [<000000005367c4f9>] irq_default_primary_handler threaded [<000000007e02b601>]
cdns_mhdp_irq_handler [cdns_mhdp8546]
[   43.344607] Disabling IRQ #31

This happens because as part of cdns_mhdp_bridge_hpd_disable, driver tries to disable the interrupts. While disabling the SW_EVENT interrupts, it accidentally enables the MBOX interrupts, which are not handled by the driver.

Fix this with a read-modify-write to update only required bits. Do the same for enabling interrupts as well.

---
 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +5 -2
index 2cd809eed827..6beccd2a408e 100644
@@ -2146,7 +2146,8 @@ static void cdns_mhdp_bridge_hpd_enable(struct drm_bridge *bridge)
 
 	/* Enable SW event interrupts */
 	if (mhdp->bridge_attached)
-		writel(~(u32)CDNS_APB_INT_MASK_SW_EVENT_INT,
+		writel(readl(mhdp->regs + CDNS_APB_INT_MASK) &
+		       ~CDNS_APB_INT_MASK_SW_EVENT_INT,
 		       mhdp->regs + CDNS_APB_INT_MASK);
 }
 
@@ -2154,7 +2155,9 @@ static void cdns_mhdp_bridge_hpd_disable(struct drm_bridge *bridge)
 {
 	struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge);
 
-	writel(CDNS_APB_INT_MASK_SW_EVENT_INT, mhdp->regs + CDNS_APB_INT_MASK);
+	writel(readl(mhdp->regs + CDNS_APB_INT_MASK) |
+	       CDNS_APB_INT_MASK_SW_EVENT_INT,
+	       mhdp->regs + CDNS_APB_INT_MASK);
 }
 
Quoted 6 lines

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static void cdns_mhdp_bridge_hpd_disable(struct drm_bridge *bridge) · line 2163

Quoted 1 line
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +0 -0
 static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = {

Good catch. I wonder why we need the above functions... We already enable and disable the interrupts when attaching/detaching the driver. And I think we want to get the interrupt even if we won't report HPD (but I think we always do report it), as we need the interrupts to track the link status.

Quoted 5 lines

I read from the code that there is TODO for handling the mailbox interrupts in the driver. Once that is supported, you will be able to explictily enable/disable interrupts for SW_EVENTS (like hotplug) as well as mailbox events. This enabling specific bits in the interrupt status.

But SW_EVENTS is not the same as HPD, at least in theory. If we disable SW_EVENT_INT in hpd_disable(), we lose all SW_EVENT interrupts.

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#15 lore raw

Re: [PATCH v2 6/6] drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable

Quoted 57 lines · Tomi Valkeinen
Quoted 56 lines · Nikhil Devshatwar
Quoted 54 lines · Tomi Valkeinen
Quoted 38 lines · Nikhil Devshatwar

When removing the tidss driver, there is a warning reported by kernel about an unhandled interrupt for mhdp driver.

[   43.238895] irq 31: nobody cared (try booting with the "irqpoll" option)
... [snipped backtrace]
[   43.330735] handlers:
[   43.333020] [<000000005367c4f9>] irq_default_primary_handler threaded [<000000007e02b601>]
cdns_mhdp_irq_handler [cdns_mhdp8546]
[   43.344607] Disabling IRQ #31

This happens because as part of cdns_mhdp_bridge_hpd_disable, driver tries to disable the interrupts. While disabling the SW_EVENT interrupts, it accidentally enables the MBOX interrupts, which are not handled by the driver.

Fix this with a read-modify-write to update only required bits. Do the same for enabling interrupts as well.

---
 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +2 -1
index 2cd809eed827..6beccd2a408e 100644
@@ -2146,7 +2146,8 @@ static void cdns_mhdp_bridge_hpd_enable(struct drm_bridge *bridge)
 
 	/* Enable SW event interrupts */
 	if (mhdp->bridge_attached)
-		writel(~(u32)CDNS_APB_INT_MASK_SW_EVENT_INT,
+		writel(readl(mhdp->regs + CDNS_APB_INT_MASK) &
+		       ~CDNS_APB_INT_MASK_SW_EVENT_INT,
 		       mhdp->regs + CDNS_APB_INT_MASK);
 }
 

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static void cdns_mhdp_bridge_hpd_disable(struct drm_bridge *bridge) · line 2163

Quoted 10 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +3 -1
@@ -2154,7 +2155,9 @@ static void cdns_mhdp_bridge_hpd_disable(struct drm_bridge *bridge)
 {
 	struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge);
 
-	writel(CDNS_APB_INT_MASK_SW_EVENT_INT, mhdp->regs + CDNS_APB_INT_MASK);
+	writel(readl(mhdp->regs + CDNS_APB_INT_MASK) |
+	       CDNS_APB_INT_MASK_SW_EVENT_INT,
+	       mhdp->regs + CDNS_APB_INT_MASK);
 }
 
 static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = {

Good catch. I wonder why we need the above functions... We already enable and disable the interrupts when attaching/detaching the driver. And I think we want to get the interrupt even if we won't report HPD (but I think we always do report it), as we need the interrupts to track the link status.

Quoted 8 lines
Quoted 5 lines

I read from the code that there is TODO for handling the mailbox interrupts in the driver. Once that is supported, you will be able to explictily enable/disable interrupts for SW_EVENTS (like hotplug) as well as mailbox events. This enabling specific bits in the interrupt status.

But SW_EVENTS is not the same as HPD, at least in theory. If we disable SW_EVENT_INT in hpd_disable(), we lose all SW_EVENT interrupts.

I am not sure, what exactly is covered in the SW events apart from the hotplug.

Swapnil, Yuti, Please fill in..

Nikhil D

Quoted 6 lines

Tomi

Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#16 lore raw

RE: [PATCH v2 6/6] drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable

Quoted 87 lines

-----Original Message-----
From: Nikhil Devshatwar <[email protected]>
Sent: Tuesday, November 10, 2020 7:23 PM
To: Tomi Valkeinen <[email protected]>; Swapnil Kashinath Jakhade <[email protected]>; Yuti Suresh Amonkar <[email protected]>
Cc: [email protected]; Swapnil Kashinath Jakhade <[email protected]>; Sekhar Nori <[email protected]>; Laurent Pinchart <[email protected]>; Yuti Suresh Amonkar <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable

EXTERNAL MAIL

Quoted 7 lines · Tomi Valkeinen
Quoted 6 lines · Nikhil Devshatwar
Quoted 5 lines · Tomi Valkeinen
Quoted 4 lines · Nikhil Devshatwar

When removing the tidss driver, there is a warning reported by kernel about an unhandled interrupt for mhdp driver.

[   43.238895] irq 31: nobody cared (try booting with the "irqpoll"

option)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

... [snipped backtrace]

[   43.330735] handlers:
[   43.333020] [<000000005367c4f9>] irq_default_primary_handler

threaded [<000000007e02b601>]

Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines

cdns_mhdp_irq_handler [cdns_mhdp8546]

[   43.344607] Disabling IRQ #31

This happens because as part of cdns_mhdp_bridge_hpd_disable, driver tries to disable the interrupts. While disabling the SW_EVENT interrupts, it accidentally enables the MBOX interrupts, which are not handled by the driver.

Fix this with a read-modify-write to update only required bits. Do the same for enabling interrupts as well.

---
 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +2 -1
index 2cd809eed827..6beccd2a408e 100644
@@ -2146,7 +2146,8 @@ static void
 cdns_mhdp_bridge_hpd_enable(struct drm_bridge *bridge)
 
 	/* Enable SW event interrupts */
 	if (mhdp->bridge_attached)
-		writel(~(u32)CDNS_APB_INT_MASK_SW_EVENT_INT,
+		writel(readl(mhdp->regs + CDNS_APB_INT_MASK) &
+		       ~CDNS_APB_INT_MASK_SW_EVENT_INT,
 		       mhdp->regs + CDNS_APB_INT_MASK);  }
 
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static void · line 2157

Quoted 5 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +0 -1
@@ -2154,7 +2155,9 @@ static void
 cdns_mhdp_bridge_hpd_disable(struct drm_bridge *bridge)  {
 	struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge);
 
-	writel(CDNS_APB_INT_MASK_SW_EVENT_INT, mhdp->regs +

CDNS_APB_INT_MASK);

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static void cdns_mhdp_bridge_hpd_disable(struct drm_bridge *bridge) · line 2163

Quoted 6 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +3 -0
+	writel(readl(mhdp->regs + CDNS_APB_INT_MASK) |
+	       CDNS_APB_INT_MASK_SW_EVENT_INT,
+	       mhdp->regs + CDNS_APB_INT_MASK);
 }
 
 static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = {

Good catch. I wonder why we need the above functions... We already enable and disable the interrupts when attaching/detaching the driver. And I think we want to get the interrupt even if we won't report

HPD (but I think we always do report it), as we need the interrupts to track the link status.

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

I read from the code that there is TODO for handling the mailbox interrupts in the driver. Once that is supported, you will be able to explictily enable/disable interrupts for SW_EVENTS (like hotplug) as well as mailbox events. This enabling specific bits in the interrupt status.

Quoted 7 lines
Quoted 2 lines

But SW_EVENTS is not the same as HPD, at least in theory. If we disable SW_EVENT_INT in hpd_disable(), we lose all SW_EVENT interrupts.

I am not sure, what exactly is covered in the SW events apart from the hotplug.

Swapnil, Yuti, Please fill in..

hpd_enable/hpd_disable callbacks were implemented as a part of supporting DRM_BRIDGE_OP_HPD bridge operation. The existing implementation could work with current features set supported by MHDP driver. But Tomi's point is valid, as there are some HDCP interrupts which are part of SW_EVENT interrupts and this might not be the control to just enable/disable HPD.

Swapnil

Quoted 8 lines

Nikhil D

Quoted 6 lines

Tomi

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#17 lore raw

Re: [PATCH v2 6/6] drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable

Quoted 93 lines · Swapnil Jakhade
Quoted 93 lines

-----Original Message-----
From: Nikhil Devshatwar <[email protected]>
Sent: Tuesday, November 10, 2020 7:23 PM
To: Tomi Valkeinen <[email protected]>; Swapnil Kashinath Jakhade <[email protected]>; Yuti Suresh Amonkar <[email protected]>
Cc: [email protected]; Swapnil Kashinath Jakhade <[email protected]>; Sekhar Nori <[email protected]>; Laurent Pinchart <[email protected]>; Yuti Suresh Amonkar <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable

EXTERNAL MAIL

Quoted 7 lines · Tomi Valkeinen
Quoted 6 lines · Nikhil Devshatwar
Quoted 5 lines · Tomi Valkeinen
Quoted 4 lines · Nikhil Devshatwar

When removing the tidss driver, there is a warning reported by kernel about an unhandled interrupt for mhdp driver.

[   43.238895] irq 31: nobody cared (try booting with the "irqpoll"

option)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

... [snipped backtrace]

[   43.330735] handlers:
[   43.333020] [<000000005367c4f9>] irq_default_primary_handler

threaded [<000000007e02b601>]

Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines

cdns_mhdp_irq_handler [cdns_mhdp8546]

[   43.344607] Disabling IRQ #31

This happens because as part of cdns_mhdp_bridge_hpd_disable, driver tries to disable the interrupts. While disabling the SW_EVENT interrupts, it accidentally enables the MBOX interrupts, which are not handled by the driver.

Fix this with a read-modify-write to update only required bits. Do the same for enabling interrupts as well.

---
 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +2 -1
index 2cd809eed827..6beccd2a408e 100644
@@ -2146,7 +2146,8 @@ static void
 cdns_mhdp_bridge_hpd_enable(struct drm_bridge *bridge)
 
 	/* Enable SW event interrupts */
 	if (mhdp->bridge_attached)
-		writel(~(u32)CDNS_APB_INT_MASK_SW_EVENT_INT,
+		writel(readl(mhdp->regs + CDNS_APB_INT_MASK) &
+		       ~CDNS_APB_INT_MASK_SW_EVENT_INT,
 		       mhdp->regs + CDNS_APB_INT_MASK);  }
 
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static void · line 2157

Quoted 5 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +0 -1
@@ -2154,7 +2155,9 @@ static void
 cdns_mhdp_bridge_hpd_disable(struct drm_bridge *bridge)  {
 	struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge);
 
-	writel(CDNS_APB_INT_MASK_SW_EVENT_INT, mhdp->regs +

CDNS_APB_INT_MASK);

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static void cdns_mhdp_bridge_hpd_disable(struct drm_bridge *bridge) · line 2163

Quoted 6 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +3 -0
+	writel(readl(mhdp->regs + CDNS_APB_INT_MASK) |
+	       CDNS_APB_INT_MASK_SW_EVENT_INT,
+	       mhdp->regs + CDNS_APB_INT_MASK);
 }
 
 static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = {

Good catch. I wonder why we need the above functions... We already enable and disable the interrupts when attaching/detaching the driver. And I think we want to get the interrupt even if we won't report

HPD (but I think we always do report it), as we need the interrupts to track the link status.

Quoted 10 lines
Quoted 7 lines
Quoted 1 line

I read from the code that there is TODO for handling the mailbox interrupts in the driver. Once that is supported, you will be able to explictily enable/disable interrupts for SW_EVENTS (like hotplug) as well as mailbox events. This enabling specific bits in the interrupt status.

But SW_EVENTS is not the same as HPD, at least in theory. If we disable SW_EVENT_INT in hpd_disable(), we lose all SW_EVENT interrupts.

I am not sure, what exactly is covered in the SW events apart from the hotplug.

Quoted 7 lines
Quoted 1 line

Swapnil, Yuti, Please fill in..

hpd_enable/hpd_disable callbacks were implemented as a part of supporting DRM_BRIDGE_OP_HPD bridge operation. The existing implementation could work with current features set supported by MHDP driver. But Tomi's point is valid, as there are some HDCP interrupts which are part of SW_EVENT interrupts and this might not be the control to just enable/disable HPD.

So do you think something should change now?
I assume that you will modify this part when supporting HDCP. Also, please provide your ack if this patch is the right fix.

Nikhil D

Quoted 11 lines

Swapnil

Quoted 8 lines

Nikhil D

Quoted 6 lines

Tomi

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v2 6/6
#18 lore raw

RE: [PATCH v2 6/6] drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable

In reply to Nikhil Devshatwar

Hi Nikhil,

Quoted 54 lines

-----Original Message-----
From: Nikhil Devshatwar <[email protected]>
Sent: Monday, November 9, 2020 10:36 PM
To: [email protected]; Tomi Valkeinen <[email protected]>
Cc: Sekhar Nori <[email protected]>; Laurent Pinchart <[email protected]>; Swapnil Kashinath Jakhade <[email protected]>; Yuti Suresh Amonkar <[email protected]>
Subject: [PATCH v2 6/6] drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable

EXTERNAL MAIL

When removing the tidss driver, there is a warning reported by kernel about an unhandled interrupt for mhdp driver.

[   43.238895] irq 31: nobody cared (try booting with the "irqpoll" option)
... [snipped backtrace]
[   43.330735] handlers:
[   43.333020] [<000000005367c4f9>] irq_default_primary_handler threaded
[<000000007e02b601>]
cdns_mhdp_irq_handler [cdns_mhdp8546]
[   43.344607] Disabling IRQ #31

This happens because as part of cdns_mhdp_bridge_hpd_disable, driver tries to disable the interrupts. While disabling the SW_EVENT interrupts, it accidentally enables the MBOX interrupts, which are not handled by the driver.

Fix this with a read-modify-write to update only required bits. Do the same for enabling interrupts as well.

---
 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +2 -1
index 2cd809eed827..6beccd2a408e 100644
@@ -2146,7 +2146,8 @@ static void cdns_mhdp_bridge_hpd_enable(struct
 drm_bridge *bridge)
 
 	/* Enable SW event interrupts */
 	if (mhdp->bridge_attached)
-		writel(~(u32)CDNS_APB_INT_MASK_SW_EVENT_INT,
+		writel(readl(mhdp->regs + CDNS_APB_INT_MASK) &
+		       ~CDNS_APB_INT_MASK_SW_EVENT_INT,
 		       mhdp->regs + CDNS_APB_INT_MASK);  }
 

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static void cdns_mhdp_bridge_hpd_disable(struct · line 2163

Quoted 10 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +3 -1
@@ -2154,7 +2155,9 @@ static void cdns_mhdp_bridge_hpd_disable(struct
 drm_bridge *bridge)  {
 	struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge);
 
-	writel(CDNS_APB_INT_MASK_SW_EVENT_INT, mhdp->regs +
 CDNS_APB_INT_MASK);
+	writel(readl(mhdp->regs + CDNS_APB_INT_MASK) |
+	       CDNS_APB_INT_MASK_SW_EVENT_INT,
+	       mhdp->regs + CDNS_APB_INT_MASK);
 }
 

Can we do similar change at other places in driver too? Other than that:

Thanks & regards,
Swapnil

Quoted 3 lines

static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = {
--
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#19 lore raw
In reply to Nikhil Devshatwar

Hi Nikhil,

Quoted 17 lines · Nikhil Devshatwar

This series moves the tidss to using new connectoe model, where the SoC driver (tidss) creates the connector and all the bridges are attached with the flag DRM_BRIDGE_ATTACH_NO_CONNECTOR

Since the bridges do not create the connector, the bus format and bus_flag is set after the format negotiation.
Support format negotiations in the tfp410 and mhdp bridge drivers as a first step before moving the connector model.

Nikhil Devshatwar (6):
drm: bridge: Propagate the bus flags from bridge->timings drm/bridge: tfp410: Support format negotiation hooks drm/bridge: mhdp8546: Add minimal format negotiation drm/tidss: Set bus_format correctly from bridge/connector drm/tidss: Move to newer connector model drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable

Quoted 8 lines
 .../drm/bridge/cadence/cdns-mhdp8546-core.c   | 32 ++++++++++++++++--
 drivers/gpu/drm/bridge/ti-tfp410.c            | 33 +++++++++++++++++++
 drivers/gpu/drm/drm_bridge.c                  |  8 +++++
 drivers/gpu/drm/tidss/tidss_drv.h             |  3 ++
 drivers/gpu/drm/tidss/tidss_encoder.c         | 22 ++++++++-----
 drivers/gpu/drm/tidss/tidss_kms.c             | 19 ++++++++++-
 6 files changed, 106 insertions(+), 11 deletions(-)

Please add a change log when sending new versions of a series.

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#20 lore raw
Quoted 14 lines · Tomi Valkeinen

Hi Nikhil,

Quoted 11 lines · Nikhil Devshatwar

This series moves the tidss to using new connectoe model, where the SoC driver (tidss) creates the connector and all the bridges are attached with the flag DRM_BRIDGE_ATTACH_NO_CONNECTOR

Since the bridges do not create the connector, the bus format and bus_flag is set after the format negotiation.
Support format negotiations in the tfp410 and mhdp bridge drivers as a first step before moving the connector model.

Nikhil Devshatwar (6):
drm: bridge: Propagate the bus flags from bridge->timings

changes from v1:
* Check for timings
* Prioritize timings flags over next bridge's flags

Quoted 1 line
Quoted 1 line

drm/bridge: tfp410: Support format negotiation hooks

Changes from v1:
* Use only MEDIA_BUS_FMT_FIXED for output

Quoted 1 line
Quoted 1 line

drm/bridge: mhdp8546: Add minimal format negotiation

Changes from v1:
* cosmetic fixes, commit message update

Quoted 2 lines
Quoted 2 lines

drm/tidss: Set bus_format correctly from bridge/connector drm/tidss: Move to newer connector model

Changes from v1:
* Add error handling

Quoted 12 lines
Quoted 11 lines

drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable

 .../drm/bridge/cadence/cdns-mhdp8546-core.c   | 32 ++++++++++++++++--
 drivers/gpu/drm/bridge/ti-tfp410.c            | 33 +++++++++++++++++++
 drivers/gpu/drm/drm_bridge.c                  |  8 +++++
 drivers/gpu/drm/tidss/tidss_drv.h             |  3 ++
 drivers/gpu/drm/tidss/tidss_encoder.c         | 22 ++++++++-----
 drivers/gpu/drm/tidss/tidss_kms.c             | 19 ++++++++++-
 6 files changed, 106 insertions(+), 11 deletions(-)
Quoted 2 lines

Please add a change log when sending new versions of a series.

Actually, I had added the git notes, but missed to add --notes while sending the patches using git send-email.

I am updating the change log here manually.

Nikhil D

Quoted 5 lines

Tomi

Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel