[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56b66841-e60b-4dd7-8b96-cf67628fc0e6@linaro.org>
Date: Mon, 21 Oct 2024 14:28:34 +0200
From: neil.armstrong@...aro.org
To: Wadim Egorov <w.egorov@...tec.de>, andrzej.hajda@...el.com,
rfoss@...nel.org
Cc: Laurent.pinchart@...asonboard.com, jonas@...boo.se,
jernej.skrabec@...il.com, maarten.lankhorst@...ux.intel.com,
mripard@...nel.org, tzimmermann@...e.de, airlied@...il.com, simona@...ll.ch,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, bbrezillon@...nel.org, conor+dt@...nel.org,
krzk+dt@...nel.org, robh@...nel.org, upstream@...ts.phytec.de
Subject: Re: [PATCH v3 2/2] drm/bridge: sii902x: Set input bus format based on
bus-width
On 17/10/2024 10:55, 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@...tec.de>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
> index 7f91b0db161e..9be9cc5b9025 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,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);
Reviewed-by: Neil Armstrong <neil.armstrong@...aro.org>
Powered by blists - more mailing lists