2 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
3 * Author: Archit Taneja <archit@ti.com>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program. If not, see <http://www.gnu.org/licenses/>.
18 #include <linux/kernel.h>
19 #include <linux/module.h>
20 #include <linux/platform_device.h>
21 #include <linux/slab.h>
23 #include <linux/of_graph.h>
25 #include <drm/drm_panel.h>
30 int omapdss_device_init_output(struct omap_dss_device *out)
32 struct device_node *remote_node;
34 remote_node = of_graph_get_remote_node(out->dev->of_node, 0, 0);
36 dev_dbg(out->dev, "failed to find video sink\n");
40 out->next = omapdss_find_device_by_node(remote_node);
41 out->bridge = of_drm_find_bridge(remote_node);
42 out->panel = of_drm_find_panel(remote_node);
43 if (IS_ERR(out->panel))
46 of_node_put(remote_node);
48 if (out->next && out->type != out->next->type) {
49 dev_err(out->dev, "output type and display type don't match\n");
50 omapdss_device_put(out->next);
55 return out->next || out->bridge || out->panel ? 0 : -EPROBE_DEFER;
57 EXPORT_SYMBOL(omapdss_device_init_output);
59 void omapdss_device_cleanup_output(struct omap_dss_device *out)
62 omapdss_device_put(out->next);
64 EXPORT_SYMBOL(omapdss_device_cleanup_output);
66 int dss_install_mgr_ops(struct dss_device *dss,
67 const struct dss_mgr_ops *mgr_ops,
68 struct omap_drm_private *priv)
73 dss->mgr_ops = mgr_ops;
74 dss->mgr_ops_priv = priv;
78 EXPORT_SYMBOL(dss_install_mgr_ops);
80 void dss_uninstall_mgr_ops(struct dss_device *dss)
83 dss->mgr_ops_priv = NULL;
85 EXPORT_SYMBOL(dss_uninstall_mgr_ops);
87 void dss_mgr_set_timings(struct omap_dss_device *dssdev,
88 const struct videomode *vm)
90 dssdev->dss->mgr_ops->set_timings(dssdev->dss->mgr_ops_priv,
91 dssdev->dispc_channel, vm);
93 EXPORT_SYMBOL(dss_mgr_set_timings);
95 void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
96 const struct dss_lcd_mgr_config *config)
98 dssdev->dss->mgr_ops->set_lcd_config(dssdev->dss->mgr_ops_priv,
99 dssdev->dispc_channel, config);
101 EXPORT_SYMBOL(dss_mgr_set_lcd_config);
103 int dss_mgr_enable(struct omap_dss_device *dssdev)
105 return dssdev->dss->mgr_ops->enable(dssdev->dss->mgr_ops_priv,
106 dssdev->dispc_channel);
108 EXPORT_SYMBOL(dss_mgr_enable);
110 void dss_mgr_disable(struct omap_dss_device *dssdev)
112 dssdev->dss->mgr_ops->disable(dssdev->dss->mgr_ops_priv,
113 dssdev->dispc_channel);
115 EXPORT_SYMBOL(dss_mgr_disable);
117 void dss_mgr_start_update(struct omap_dss_device *dssdev)
119 dssdev->dss->mgr_ops->start_update(dssdev->dss->mgr_ops_priv,
120 dssdev->dispc_channel);
122 EXPORT_SYMBOL(dss_mgr_start_update);
124 int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
125 void (*handler)(void *), void *data)
127 struct dss_device *dss = dssdev->dss;
129 return dss->mgr_ops->register_framedone_handler(dss->mgr_ops_priv,
130 dssdev->dispc_channel,
133 EXPORT_SYMBOL(dss_mgr_register_framedone_handler);
135 void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
136 void (*handler)(void *), void *data)
138 struct dss_device *dss = dssdev->dss;
140 dss->mgr_ops->unregister_framedone_handler(dss->mgr_ops_priv,
141 dssdev->dispc_channel,
144 EXPORT_SYMBOL(dss_mgr_unregister_framedone_handler);