Skip to contentSkip to conversation

Introduce bus-width property for input bus format

PATCH Applied Wadim Egorov 2 participants 5 messages Oct 17, 2024 – Oct 21, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 cover Introduce bus-width property for input bus format

This patch series introduces a bus-width property for the SI9022 HDMI transmitter, allowing the input bus format to be configured based on the number of RGB input pins. The default is set to 24-bit if unspecified.

v3:
- Add Reviewed-by tag from Krzysztof
- Ensure bus_width is set/defaults to 24 even if an endpoint is not defined

v2: https://lore.kernel.org/lkml/[email protected]/
v1: https://lore.kernel.org/lkml/[email protected]/T/

Wadim Egorov (2):
dt-bindings: display: bridge: sil,sii9022: Add bus-width drm/bridge: sii902x: Set input bus format based on bus-width

 .../bindings/display/bridge/sil,sii9022.yaml  | 15 +++++++++++-
 drivers/gpu/drm/bridge/sii902x.c              | 24 ++++++++++++++++++-
 2 files changed, 37 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/2 dt-bindings: display: bridge: sil,sii9022: Add bus-width

The SI9022 HDMI transmitter can be configured with a bus-width of 16, 18, or 24 bits. Introduce a bus-width property to the input endpoint, specifying the number of parallel RGB input bits connected to the transmitter.

---
v3: Add Reviewed-by tag from Krzysztof

---
 .../bindings/display/bridge/sil,sii9022.yaml      | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/bridge/sil,sii9022.yaml +14 -1
index 5a69547ad3d7..1509c4535e53 100644
@@ -81,9 +81,22 @@ properties:
 
     properties:
       port@0:
-        $ref: /schemas/graph.yaml#/properties/port
+        unevaluatedProperties: false
+        $ref: /schemas/graph.yaml#/$defs/port-base
         description: Parallel RGB input port
 
+        properties:
+          endpoint:
+            $ref: /schemas/graph.yaml#/$defs/endpoint-base
+            unevaluatedProperties: false
+
+            properties:
+              bus-width:
+                description:
+                  Endpoint bus width.
+                enum: [ 16, 18, 24 ]
+                default: 24
+
       port@1:
         $ref: /schemas/graph.yaml#/properties/port
         description: HDMI output port
Signature · 1 line
2.34.1
#2 lore raw

PATCH v3 2/2 drm/bridge: sii902x: Set input bus format based on bus-width

In reply to Wadim Egorov

Introduce a bus-width property to define the number of parallel RGB input pins connected to the transmitter. The input bus formats are updated accordingly. If the property is not specified, default to 24-bit bus-width.

---
v3: Ensure bus_width is set/defaults to 24 even if an endpoint is not defined

---
 drivers/gpu/drm/bridge/sii902x.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/sii902x.c +23 -1
index 7f91b0db161e..9be9cc5b9025 100644
@@ -180,6 +180,8 @@ struct sii902x {
 	struct gpio_desc *reset_gpio;
 	struct i2c_mux_core *i2cmux;
 	bool sink_is_hdmi;
+	u32 bus_width;
+
 	/*
 	 * Mutex protects audio and video functions from interfering
 	 * each other, by keeping their i2c command sequences atomic.
@@ -477,6 +479,8 @@ static u32 *sii902x_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
 						     u32 output_fmt,
 						     unsigned int *num_input_fmts)
 {
+
+	struct sii902x *sii902x = bridge_to_sii902x(bridge);
 	u32 *input_fmts;
 
 	*num_input_fmts = 0;
@@ -485,7 +489,20 @@ static u32 *sii902x_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
 	if (!input_fmts)
 		return NULL;
 
-	input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
+	switch (sii902x->bus_width) {
+	case 16:
+		input_fmts[0] = MEDIA_BUS_FMT_RGB565_1X16;
+		break;
+	case 18:
+		input_fmts[0] = MEDIA_BUS_FMT_RGB666_1X18;
+		break;
+	case 24:
+		input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
+		break;
+	default:
+		return NULL;
+	}
+
 	*num_input_fmts = 1;
 
 	return input_fmts;
@@ -1167,6 +1184,11 @@ static int sii902x_probe(struct i2c_client *client)
 		return PTR_ERR(sii902x->reset_gpio);
 	}
 
+	sii902x->bus_width = 24;
+	endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
+	if (endpoint)
+		of_property_read_u32(endpoint, "bus-width", &sii902x->bus_width);
+
 	endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 1, -1);
 	if (endpoint) {
 		struct device_node *remote = of_graph_get_remote_port_parent(endpoint);
Signature · 1 line
2.34.1
maintainer Reviewed-by on v3 2/2
#3 lore raw

Re: [PATCH v3 2/2] drm/bridge: sii902x: Set input bus format based on bus-width

Quoted 57 lines · Wadim Egorov

Introduce a bus-width property to define the number of parallel RGB input pins connected to the transmitter. The input bus formats are updated accordingly. If the property is not specified, default to 24-bit bus-width.

---
v3: Ensure bus_width is set/defaults to 24 even if an endpoint is not defined

---
  drivers/gpu/drm/bridge/sii902x.c | 24 +++++++++++++++++++++++-
  1 file changed, 23 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/sii902x.c +18 -1
index 7f91b0db161e..9be9cc5b9025 100644
@@ -180,6 +180,8 @@ struct sii902x {
  	struct gpio_desc *reset_gpio;
  	struct i2c_mux_core *i2cmux;
  	bool sink_is_hdmi;
+	u32 bus_width;
+
  	/*
  	 * Mutex protects audio and video functions from interfering
  	 * each other, by keeping their i2c command sequences atomic.
@@ -477,6 +479,8 @@ static u32 *sii902x_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
  						     u32 output_fmt,
  						     unsigned int *num_input_fmts)
  {
+
+	struct sii902x *sii902x = bridge_to_sii902x(bridge);
  	u32 *input_fmts;
 
  	*num_input_fmts = 0;
@@ -485,7 +489,20 @@ static u32 *sii902x_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
  	if (!input_fmts)
  		return NULL;
 
-	input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
+	switch (sii902x->bus_width) {
+	case 16:
+		input_fmts[0] = MEDIA_BUS_FMT_RGB565_1X16;
+		break;
+	case 18:
+		input_fmts[0] = MEDIA_BUS_FMT_RGB666_1X18;
+		break;
+	case 24:
+		input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
+		break;
+	default:
+		return NULL;
+	}
+
  	*num_input_fmts = 1;
 
  	return input_fmts;
@@ -1167,6 +1184,11 @@ static int sii902x_probe(struct i2c_client *client)
  		return PTR_ERR(sii902x->reset_gpio);

drivers/gpu/drm/bridge/sii902x.c static int sii902x_probe(struct i2c_client *client) · line 1194

Quoted 10 lines
drivers/gpu/drm/bridge/sii902x.c +5 -0
  	}
 
+	sii902x->bus_width = 24;
+	endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
+	if (endpoint)
+		of_property_read_u32(endpoint, "bus-width", &sii902x->bus_width);
+
  	endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 1, -1);
  	if (endpoint) {
  		struct device_node *remote = of_graph_get_remote_port_parent(endpoint);
maintainer Applied
#4 lore raw
In reply to Wadim Egorov

Hi,

Quoted 9 lines · Wadim Egorov

This patch series introduces a bus-width property for the SI9022 HDMI transmitter, allowing the input bus format to be configured based on the number of RGB input pins. The default is set to 24-bit if unspecified.

v3:
- Add Reviewed-by tag from Krzysztof
- Ensure bus_width is set/defaults to 24 even if an endpoint is not defined

[...]

Thanks, Applied to https://gitlab.freedesktop.org/drm/misc/kernel.git (drm-misc-next)

[1/2] dt-bindings: display: bridge: sil,sii9022: Add bus-width

      https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/096d518c43341c5d8b80948f6fbc90e916ffc7f2
[2/2] drm/bridge: sii902x: Set input bus format based on bus-width
      https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/d284ccd8588c9b87222ec666a1da57f197023e5f
Signature · 1 line
Neil