diff mbox series

[v2,19/21] drm/bridge: panel: Propage bus format/flags

Message ID 20190826152649.13820-20-boris.brezillon@collabora.com (mailing list archive)
State New, archived
Headers show
Series drm: Add support for bus-format negotiation | expand

Commit Message

Boris Brezillon Aug. 26, 2019, 3:26 p.m. UTC
So that the previous bridge element in the chain knows which input
format the panel bridge expects.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
Laurent,

I intentionally left your comments unaddressed in this patch as I'm
more interested in discussing the preparation patches. Once we've
settled on something regarding the bus-format negotiation stuff I'll
rework the binding/driver to support the data-mapping DT prop.

Regards,

Boris

Changes in v2:
* Adjust things to match the new bus-format negotiation approach
---
 drivers/gpu/drm/bridge/panel.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
index 6cffeb4a42f2..3eeb40d37a89 100644
--- a/drivers/gpu/drm/bridge/panel.c
+++ b/drivers/gpu/drm/bridge/panel.c
@@ -120,6 +120,34 @@  static void panel_bridge_post_disable(struct drm_bridge *bridge)
 	drm_panel_unprepare(panel_bridge->panel);
 }
 
+static void
+panel_bridge_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 = 1;
+	if (!input_fmts)
+		return;
+
+	input_fmts[0] = output_fmt;
+}
+
+static int panel_bridge_atomic_check(struct drm_bridge *bridge,
+				     struct drm_bridge_state *bridge_state,
+				     struct drm_crtc_state *crtc_state,
+				     struct drm_connector_state *conn_state)
+{
+	if (bridge_state->input_bus_cfg.fmt != bridge_state->output_bus_cfg.fmt)
+		return -EINVAL;
+
+	bridge_state->input_bus_cfg.flags = bridge_state->output_bus_cfg.flags;
+	return 0;
+}
+
 static const struct drm_bridge_funcs panel_bridge_bridge_funcs = {
 	.attach = panel_bridge_attach,
 	.detach = panel_bridge_detach,
@@ -127,6 +155,8 @@  static const struct drm_bridge_funcs panel_bridge_bridge_funcs = {
 	.enable = panel_bridge_enable,
 	.disable = panel_bridge_disable,
 	.post_disable = panel_bridge_post_disable,
+	.atomic_check = panel_bridge_atomic_check,
+	.atomic_get_input_bus_fmts = panel_bridge_atomic_get_input_bus_fmts,
 };
 
 /**