* [PATCH v2 0/2] Introduce bus-width property for input bus format
@ 2024-10-07 8:52 Wadim Egorov
2024-10-07 8:52 ` [PATCH v2 1/2] dt-bindings: display: bridge: sil,sii9022: Add bus-width Wadim Egorov
2024-10-07 8:52 ` [PATCH v2 2/2] drm/bridge: sii902x: Set input bus format based on bus-width Wadim Egorov
0 siblings, 2 replies; 5+ messages in thread
From: Wadim Egorov @ 2024-10-07 8:52 UTC (permalink / raw)
To: andrzej.hajda, neil.armstrong, rfoss
Cc: Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, dri-devel, linux-kernel,
devicetree, bbrezillon, conor+dt, krzk+dt, robh, upstream
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.
v2:
- Reorder patches to have dt-bindings go first
- Use bus-width instead of data-lines as suggested by Krzysztof
- Handle default case separately as an error case
v1: https://lore.kernel.org/lkml/20241003082006.2728617-1-w.egorov@phytec.de/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 | 28 ++++++++++++++++++-
2 files changed, 41 insertions(+), 2 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] dt-bindings: display: bridge: sil,sii9022: Add bus-width
2024-10-07 8:52 [PATCH v2 0/2] Introduce bus-width property for input bus format Wadim Egorov
@ 2024-10-07 8:52 ` Wadim Egorov
2024-10-07 11:21 ` Krzysztof Kozlowski
2024-10-07 8:52 ` [PATCH v2 2/2] drm/bridge: sii902x: Set input bus format based on bus-width Wadim Egorov
1 sibling, 1 reply; 5+ messages in thread
From: Wadim Egorov @ 2024-10-07 8:52 UTC (permalink / raw)
To: andrzej.hajda, neil.armstrong, rfoss
Cc: Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, dri-devel, linux-kernel,
devicetree, bbrezillon, conor+dt, krzk+dt, robh, upstream
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.
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
---
v2:
- Use bus-width instead of data-lines as suggested by Krzysztof
- Provide a default
---
.../bindings/display/bridge/sil,sii9022.yaml | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/display/bridge/sil,sii9022.yaml b/Documentation/devicetree/bindings/display/bridge/sil,sii9022.yaml
index 5a69547ad3d7..1509c4535e53 100644
--- a/Documentation/devicetree/bindings/display/bridge/sil,sii9022.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/sil,sii9022.yaml
@@ -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
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] drm/bridge: sii902x: Set input bus format based on bus-width
2024-10-07 8:52 [PATCH v2 0/2] Introduce bus-width property for input bus format Wadim Egorov
2024-10-07 8:52 ` [PATCH v2 1/2] dt-bindings: display: bridge: sil,sii9022: Add bus-width Wadim Egorov
@ 2024-10-07 8:52 ` Wadim Egorov
2024-10-14 7:44 ` Dmitry Baryshkov
1 sibling, 1 reply; 5+ messages in thread
From: Wadim Egorov @ 2024-10-07 8:52 UTC (permalink / raw)
To: andrzej.hajda, neil.armstrong, rfoss
Cc: Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, dri-devel, linux-kernel,
devicetree, bbrezillon, conor+dt, krzk+dt, robh, upstream
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.
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
---
v2:
- Use bus-width instead of data-lines as suggested by Krzysztof
- Handle default case separately as an error case
---
drivers/gpu/drm/bridge/sii902x.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
index 7f91b0db161e..3b9e4e1dec45 100644
--- a/drivers/gpu/drm/bridge/sii902x.c
+++ b/drivers/gpu/drm/bridge/sii902x.c
@@ -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,15 @@ static int sii902x_probe(struct i2c_client *client)
return PTR_ERR(sii902x->reset_gpio);
}
+ endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
+ if (endpoint) {
+ ret = of_property_read_u32(endpoint, "bus-width", &sii902x->bus_width);
+ if (ret) {
+ dev_dbg(dev, "Could not get bus-width, defaulting to 24-bit bus-width\n");
+ sii902x->bus_width = 24;
+ }
+ }
+
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);
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: display: bridge: sil,sii9022: Add bus-width
2024-10-07 8:52 ` [PATCH v2 1/2] dt-bindings: display: bridge: sil,sii9022: Add bus-width Wadim Egorov
@ 2024-10-07 11:21 ` Krzysztof Kozlowski
0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-07 11:21 UTC (permalink / raw)
To: Wadim Egorov, andrzej.hajda, neil.armstrong, rfoss
Cc: Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, dri-devel, linux-kernel,
devicetree, bbrezillon, conor+dt, krzk+dt, robh, upstream
On 07/10/2024 10:52, Wadim Egorov wrote:
> 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.
>
> Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
> ---
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] drm/bridge: sii902x: Set input bus format based on bus-width
2024-10-07 8:52 ` [PATCH v2 2/2] drm/bridge: sii902x: Set input bus format based on bus-width Wadim Egorov
@ 2024-10-14 7:44 ` Dmitry Baryshkov
0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Baryshkov @ 2024-10-14 7:44 UTC (permalink / raw)
To: Wadim Egorov
Cc: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, dri-devel, linux-kernel, devicetree, bbrezillon, conor+dt,
krzk+dt, robh, upstream
On Mon, Oct 07, 2024 at 10:52:13AM +0200, Wadim Egorov wrote:
> 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.
>
> Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
> ---
> v2:
> - Use bus-width instead of data-lines as suggested by Krzysztof
> - Handle default case separately as an error case
> ---
> drivers/gpu/drm/bridge/sii902x.c | 28 +++++++++++++++++++++++++++-
> 1 file changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
> index 7f91b0db161e..3b9e4e1dec45 100644
> --- a/drivers/gpu/drm/bridge/sii902x.c
> +++ b/drivers/gpu/drm/bridge/sii902x.c
> @@ -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,15 @@ static int sii902x_probe(struct i2c_client *client)
> return PTR_ERR(sii902x->reset_gpio);
> }
>
> + endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
More common pattern would be:
sii902x->bus_width = 24;
/* ignore the error */
if (endpoint)
of_property_read_u32(endpoint, "bus-width", &sii902x->bus_width);
> + if (endpoint) {
> + ret = of_property_read_u32(endpoint, "bus-width", &sii902x->bus_width);
> + if (ret) {
> + dev_dbg(dev, "Could not get bus-width, defaulting to 24-bit bus-width\n");
> + sii902x->bus_width = 24;
If endpoint isn't defined in DT (for whatever reasons), bus_width is also not set in the code.
> + }
> + }
> +
> 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);
> --
> 2.34.1
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-10-14 7:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07 8:52 [PATCH v2 0/2] Introduce bus-width property for input bus format Wadim Egorov
2024-10-07 8:52 ` [PATCH v2 1/2] dt-bindings: display: bridge: sil,sii9022: Add bus-width Wadim Egorov
2024-10-07 11:21 ` Krzysztof Kozlowski
2024-10-07 8:52 ` [PATCH v2 2/2] drm/bridge: sii902x: Set input bus format based on bus-width Wadim Egorov
2024-10-14 7:44 ` Dmitry Baryshkov
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).