From ee2f7c9d878905054e3df5126a9bbaec1923e2ff Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Thu, 31 Mar 2022 17:39:23 +0200 Subject: [PATCH] drm/bridge: lt9611: Add atomic_get_input_bus_fmts Implement .atomic_get_input_bus_fmts callback, which sets up the input (scanout-engine-end) formats, so that those formats can then be used in pipeline format negotiation between this bridge and the scanout engine. Signed-off-by: Marek Vasut Cc: Dave Airlie Cc: John Stultz Cc: Maxime Ripard Cc: Sam Ravnborg Cc: Thomas Zimmermann Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220331153923.14314-2-marex@denx.de --- drivers/gpu/drm/bridge/lontium-lt9611.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 9b3ac37..7ef8fe5 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -922,6 +922,32 @@ static void lt9611_bridge_hpd_enable(struct drm_bridge *bridge) lt9611_enable_hpd_interrupts(lt9611); } +#define MAX_INPUT_SEL_FORMATS 1 + +static u32 * +lt9611_atomic_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; + + *num_input_fmts = 0; + + input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), + GFP_KERNEL); + if (!input_fmts) + return NULL; + + /* This is the DSI-end bus format */ + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24; + *num_input_fmts = 1; + + return input_fmts; +} + static const struct drm_bridge_funcs lt9611_bridge_funcs = { .attach = lt9611_bridge_attach, .mode_valid = lt9611_bridge_mode_valid, @@ -936,6 +962,7 @@ static const struct drm_bridge_funcs lt9611_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_get_input_bus_fmts = lt9611_atomic_get_input_bus_fmts, }; static int lt9611_parse_dt(struct device *dev, -- 2.7.4