1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2012 Texas Instruments Incorporated - https://www.ti.com/
7 #include <linux/kernel.h>
8 #include <linux/module.h>
9 #include <linux/platform_device.h>
10 #include <linux/slab.h>
12 #include <linux/of_graph.h>
14 #include <drm/drm_bridge.h>
15 #include <drm/drm_panel.h>
20 int omapdss_device_init_output(struct omap_dss_device *out,
21 struct drm_bridge *local_bridge)
23 struct device_node *remote_node;
26 remote_node = of_graph_get_remote_node(out->dev->of_node,
29 dev_dbg(out->dev, "failed to find video sink\n");
33 out->bridge = of_drm_find_bridge(remote_node);
34 out->panel = of_drm_find_panel(remote_node);
35 if (IS_ERR(out->panel))
38 of_node_put(remote_node);
41 struct drm_bridge *bridge;
43 bridge = drm_panel_bridge_add(out->panel);
46 "unable to create panel bridge (%ld)\n",
48 ret = PTR_ERR(bridge);
61 out->next_bridge = out->bridge;
62 out->bridge = local_bridge;
73 omapdss_device_cleanup_output(out);
77 void omapdss_device_cleanup_output(struct omap_dss_device *out)
79 if (out->bridge && out->panel)
80 drm_panel_bridge_remove(out->next_bridge ?
81 out->next_bridge : out->bridge);
84 void dss_mgr_set_timings(struct omap_dss_device *dssdev,
85 const struct videomode *vm)
87 omap_crtc_dss_set_timings(dssdev->dss->mgr_ops_priv,
88 dssdev->dispc_channel, vm);
91 void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
92 const struct dss_lcd_mgr_config *config)
94 omap_crtc_dss_set_lcd_config(dssdev->dss->mgr_ops_priv,
95 dssdev->dispc_channel, config);
98 int dss_mgr_enable(struct omap_dss_device *dssdev)
100 return omap_crtc_dss_enable(dssdev->dss->mgr_ops_priv,
101 dssdev->dispc_channel);
104 void dss_mgr_disable(struct omap_dss_device *dssdev)
106 omap_crtc_dss_disable(dssdev->dss->mgr_ops_priv,
107 dssdev->dispc_channel);
110 void dss_mgr_start_update(struct omap_dss_device *dssdev)
112 omap_crtc_dss_start_update(dssdev->dss->mgr_ops_priv,
113 dssdev->dispc_channel);
116 int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
117 void (*handler)(void *), void *data)
119 struct dss_device *dss = dssdev->dss;
121 return omap_crtc_dss_register_framedone(dss->mgr_ops_priv,
122 dssdev->dispc_channel,
126 void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
127 void (*handler)(void *), void *data)
129 struct dss_device *dss = dssdev->dss;
131 omap_crtc_dss_unregister_framedone(dss->mgr_ops_priv,
132 dssdev->dispc_channel,