Skip to contentSkip to conversation

drm/bridge: use bus flags in bridge timings

PATCH Superseded Stefan Agner 2 participants 7 messages Sep 5, 2018 – Oct 4, 2018

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 drm/bridge: use bus flags in bridge timings

The DRM bus flags convey additional information on pixel data on the bus. All current available bus flags might be of interest for a bridge. Remove the sampling_edge field and use bus_flags.

In the case at hand a dumb VGA bridge needs a specific data enable polarity (DRM_BUS_FLAG_DE_LOW).

---
 drivers/gpu/drm/bridge/dumb-vga-dac.c |  6 +++---
 include/drm/drm_bridge.h              | 11 +++++------
 2 files changed, 8 insertions(+), 9 deletions(-)
drivers/gpu/drm/bridge/dumb-vga-dac.c +3 -3
index 9b706789a341..7a5c24967115 100644
@@ -234,7 +234,7 @@ static int dumb_vga_remove(struct platform_device *pdev)
  */
 static const struct drm_bridge_timings default_dac_timings = {
 	/* Timing specifications, datasheet page 7 */
-	.sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE,
+	.bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
 	.setup_time_ps = 500,
 	.hold_time_ps = 1500,
 };
@@ -245,7 +245,7 @@ static const struct drm_bridge_timings default_dac_timings = {
  */
 static const struct drm_bridge_timings ti_ths8134_dac_timings = {
 	/* From timing diagram, datasheet page 9 */
-	.sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE,
+	.bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
 	/* From datasheet, page 12 */
 	.setup_time_ps = 3000,
 	/* I guess this means latched input */
@@ -258,7 +258,7 @@ static const struct drm_bridge_timings ti_ths8134_dac_timings = {
  */
 static const struct drm_bridge_timings ti_ths8135_dac_timings = {
 	/* From timing diagram, datasheet page 14 */
-	.sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE,
+	.bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
 	/* From datasheet, page 16 */
 	.setup_time_ps = 2000,
 	.hold_time_ps = 500,
include/drm/drm_bridge.h +5 -6
index bd850747ce54..85d4b51eae19 100644
@@ -244,14 +244,13 @@ struct drm_bridge_funcs {
  */
 struct drm_bridge_timings {
 	/**
-	 * @sampling_edge:
+	 * @bus_flags:
 	 *
-	 * Tells whether the bridge samples the digital input signal
-	 * from the display engine on the positive or negative edge of the
-	 * clock, this should reuse the DRM_BUS_FLAG_PIXDATA_[POS|NEG]EDGE
-	 * bitwise flags from the DRM connector (bit 2 and 3 valid).
+	 * Tells what additional settings for the pixel data on the bus
+	 * this bridge requires (like pixel signal polarity). See also
+	 * &drm_display_info->bus_flags.
 	 */
-	u32 sampling_edge;
+	u32 bus_flags;
 	/**
 	 * @setup_time_ps:
 	 *
Signature · 6 lines
2.18.0

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

PATCH 1/2 modeprint: use libutil to lookup strings

Use libutil to lookup connector type names and state. This also makes sure that the latest connector type addition "DPI" gets printed correctly.

---
 tests/modeprint/Makefile.am |  1 +
 tests/modeprint/meson.build |  2 +-
 tests/modeprint/modeprint.c | 43 ++++++-------------------------------
 3 files changed, 9 insertions(+), 37 deletions(-)
tests/modeprint/Makefile.am +1 -0
index 601dbc96..c8c5e797 100644
@@ -15,4 +15,5 @@ endif
 modeprint_SOURCES = \
 	modeprint.c
 modeprint_LDADD = \
+	$(top_builddir)/tests/util/libutil.la \
 	$(top_builddir)/libdrm.la
tests/modeprint/meson.build +1 -1
index 5f0eb24b..5e752798 100644
@@ -23,7 +23,7 @@ modeprint = executable(
   files('modeprint.c'),
   c_args : warn_c_args,
   include_directories : [inc_root, inc_tests, inc_drm],
-  link_with : libdrm,
+  link_with : [libdrm, libutil],
   dependencies : dep_threads,
   install : with_install_tests,
 )
tests/modeprint/modeprint.c +7 -36

73 lines not on this page · raw message

Signature · 6 lines
2.18.0

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

Re: [PATCH libdrm 1/2] modeprint: use libutil to lookup strings

Quoted 6 lines · Stefan Agner

Use libutil to lookup connector type names and state. This also makes sure that the latest connector type addition "DPI" gets printed correctly.

For the series:

Will do some sanity check and push in a moment.

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

#3 lore raw

PATCH 2/6 drm/bridge: allow to specify data-enable polarity

In reply to Stefan Agner

Support boards with a passive RGB to VGA bridge which require a low active data-enable polarity.

---
Alternatively a new dt binding could be introduced for dumb VGA bridges requiring low active data enable... However, also other polarities might need a specific polarity, hence this generic approach might be better.

 drivers/gpu/drm/bridge/dumb-vga-dac.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/dumb-vga-dac.c +18 -4
index 7a5c24967115..2b8c3d629f2f 100644
@@ -179,6 +179,7 @@ static struct i2c_adapter *dumb_vga_retrieve_ddc(struct device *dev)
 static int dumb_vga_probe(struct platform_device *pdev)
 {
 	struct dumb_vga *vga;
+	u32 de;
 
 	vga = devm_kzalloc(&pdev->dev, sizeof(*vga), GFP_KERNEL);
 	if (!vga)
@@ -194,6 +195,23 @@ static int dumb_vga_probe(struct platform_device *pdev)
 		dev_dbg(&pdev->dev, "No vdd regulator found: %d\n", ret);
 	}
 
+	vga->bridge.funcs = &dumb_vga_bridge_funcs;
+	vga->bridge.of_node = pdev->dev.of_node;
+	vga->bridge.timings = of_device_get_match_data(&pdev->dev);
+
+	if (!vga->bridge.timings &&
+	    !of_property_read_u32(pdev->dev.of_node, "de-active", &de)) {
+		struct drm_bridge_timings *timings;
+
+		timings = devm_kzalloc(&pdev->dev, sizeof(*timings), GFP_KERNEL);
+		if (!timings)
+			return -ENOMEM;
+
+		timings->bus_flags = de ? DRM_BUS_FLAG_DE_HIGH :
+					DRM_BUS_FLAG_DE_LOW;
+		vga->bridge.timings = timings;
+	}
+
 	vga->ddc = dumb_vga_retrieve_ddc(&pdev->dev);
 	if (IS_ERR(vga->ddc)) {
 		if (PTR_ERR(vga->ddc) == -ENODEV) {
@@ -205,10 +223,6 @@ static int dumb_vga_probe(struct platform_device *pdev)
 		}
 	}
 
-	vga->bridge.funcs = &dumb_vga_bridge_funcs;
-	vga->bridge.of_node = pdev->dev.of_node;
-	vga->bridge.timings = of_device_get_match_data(&pdev->dev);
-
 	drm_bridge_add(&vga->bridge);
 
 	return 0;
Signature · 6 lines
2.18.0

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

PATCH 2/2 modeprint: print encoder type

In reply to Stefan Agner

Print encoder types similar to connector types.

---
 tests/modeprint/modeprint.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
tests/modeprint/modeprint.c +7 -1
index 1d62270f..ad727e12 100644
@@ -186,7 +186,13 @@ static int printConnector(int fd, drmModeResPtr res, drmModeConnectorPtr connect
 
 static int printEncoder(int fd, drmModeResPtr res, drmModeEncoderPtr encoder, uint32_t id)
 {
-	printf("Encoder\n");
+	const char *encoder_name;
+
+	encoder_name = util_lookup_encoder_type_name(encoder->encoder_type);
+	if (encoder_name)
+		printf("Encoder: %s\n", encoder_name);
+	else
+		printf("Encoder\n");
 	printf("\tid     :%i\n", id);
 	printf("\tcrtc_id   :%d\n", encoder->crtc_id);
 	printf("\ttype   :%d\n", encoder->encoder_type);
Signature · 6 lines
2.18.0

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

PATCH 3/6 dt-bindings: display: add data-enable polarity property

In reply to Stefan Agner

Allow to specify the data-enable polarity required by a dumb VGA DAC converting parallel RGB to VGA.

---
 .../devicetree/bindings/display/bridge/dumb-vga-dac.txt          | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/bridge/dumb-vga-dac.txt +1 -0
index 164cbb15f04c..adbd2ca0af2f 100644
@@ -18,6 +18,7 @@ graph bindings specified in Documentation/devicetree/bindings/graph.txt.
 
 Optional properties:
 - vdd-supply: Power supply for DAC
+- de-active: data-enable pulse is active low/high/ignored
 
 Example
 -------
Signature · 6 lines
2.18.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw
In reply to Stefan Agner
Quoted 9 lines · Stefan Agner

The DRM bus flags convey additional information on pixel data on the bus. All current available bus flags might be of interest for a bridge. Remove the sampling_edge field and use bus_flags.

In the case at hand a dumb VGA bridge needs a specific data enable polarity (DRM_BUS_FLAG_DE_LOW).

---

I meant to send out only the two patches with "PATCH libdrm" in subject.

Please disregard the other patches, they have been sent in error.

--
Stefan

Quoted 52 lines
 drivers/gpu/drm/bridge/dumb-vga-dac.c |  6 +++---
 include/drm/drm_bridge.h              | 11 +++++------
 2 files changed, 8 insertions(+), 9 deletions(-)
drivers/gpu/drm/bridge/dumb-vga-dac.c +2 -2
index 9b706789a341..7a5c24967115 100644
@@ -234,7 +234,7 @@ static int dumb_vga_remove(struct platform_device *pdev)
  */
 static const struct drm_bridge_timings default_dac_timings = {
 	/* Timing specifications, datasheet page 7 */
-	.sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE,
+	.bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
 	.setup_time_ps = 500,
 	.hold_time_ps = 1500,
 };
@@ -245,7 +245,7 @@ static const struct drm_bridge_timings
 default_dac_timings = {
  */
 static const struct drm_bridge_timings ti_ths8134_dac_timings = {
 	/* From timing diagram, datasheet page 9 */
-	.sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE,
+	.bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
 	/* From datasheet, page 12 */
 	.setup_time_ps = 3000,
drivers/gpu/drm/bridge/dumb-vga-dac.c +1 -1
 	/* I guess this means latched input */
@@ -258,7 +258,7 @@ static const struct drm_bridge_timings
 ti_ths8134_dac_timings = {
  */
 static const struct drm_bridge_timings ti_ths8135_dac_timings = {
 	/* From timing diagram, datasheet page 14 */
-	.sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE,
+	.bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
 	/* From datasheet, page 16 */
 	.setup_time_ps = 2000,
drivers/gpu/drm/bridge/dumb-vga-dac.c +0 -0
 	.hold_time_ps = 500,
include/drm/drm_bridge.h +1 -4
index bd850747ce54..85d4b51eae19 100644
@@ -244,14 +244,13 @@ struct drm_bridge_funcs {
  */
 struct drm_bridge_timings {
 	/**
-	 * @sampling_edge:
+	 * @bus_flags:
 	 *
-	 * Tells whether the bridge samples the digital input signal
-	 * from the display engine on the positive or negative edge of the
-	 * clock, this should reuse the DRM_BUS_FLAG_PIXDATA_[POS|NEG]EDGE

include/drm/drm_bridge.h struct drm_bridge_funcs { · line 256

Quoted 10 lines
include/drm/drm_bridge.h +4 -2
-	 * bitwise flags from the DRM connector (bit 2 and 3 valid).
+	 * Tells what additional settings for the pixel data on the bus
+	 * this bridge requires (like pixel signal polarity). See also
+	 * &drm_display_info->bus_flags.
 	 */
-	u32 sampling_edge;
+	u32 bus_flags;
 	/**
 	 * @setup_time_ps:
 	 *

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