xref: /openbmc/linux/drivers/gpu/drm/omapdrm/dss/base.c (revision 19b4200d8f4b90b5a41592f9021b52153ac2b6b5)
1bb5cdf8dSAndrew F. Davis /*
2bb5cdf8dSAndrew F. Davis  * OMAP Display Subsystem Base
3bb5cdf8dSAndrew F. Davis  *
4bb5cdf8dSAndrew F. Davis  * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/
5bb5cdf8dSAndrew F. Davis  *
6bb5cdf8dSAndrew F. Davis  * This program is free software; you can redistribute it and/or modify
7bb5cdf8dSAndrew F. Davis  * it under the terms of the GNU General Public License version 2 as
8bb5cdf8dSAndrew F. Davis  * published by the Free Software Foundation.
9bb5cdf8dSAndrew F. Davis  *
10bb5cdf8dSAndrew F. Davis  * This program is distributed in the hope that it will be useful, but
11bb5cdf8dSAndrew F. Davis  * WITHOUT ANY WARRANTY; without even the implied warranty of
12bb5cdf8dSAndrew F. Davis  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13bb5cdf8dSAndrew F. Davis  * General Public License for more details.
14bb5cdf8dSAndrew F. Davis  */
15bb5cdf8dSAndrew F. Davis 
16a99ac0d9STomi Valkeinen #include <linux/kernel.h>
176a7c5a22SLaurent Pinchart #include <linux/list.h>
18a99ac0d9STomi Valkeinen #include <linux/module.h>
196a7c5a22SLaurent Pinchart #include <linux/mutex.h>
201e08c822SPeter Ujfalusi #include <linux/of.h>
211e08c822SPeter Ujfalusi #include <linux/of_graph.h>
22d3541ca8SLaurent Pinchart 
23d3541ca8SLaurent Pinchart #include "dss.h"
241e08c822SPeter Ujfalusi #include "omapdss.h"
25a99ac0d9STomi Valkeinen 
2672877cf3SLaurent Pinchart static struct dss_device *dss_device;
277c299716STomi Valkeinen 
2872877cf3SLaurent Pinchart struct dss_device *omapdss_get_dss(void)
297c299716STomi Valkeinen {
3072877cf3SLaurent Pinchart 	return dss_device;
317c299716STomi Valkeinen }
3272877cf3SLaurent Pinchart EXPORT_SYMBOL(omapdss_get_dss);
337c299716STomi Valkeinen 
3472877cf3SLaurent Pinchart void omapdss_set_dss(struct dss_device *dss)
357c299716STomi Valkeinen {
3672877cf3SLaurent Pinchart 	dss_device = dss;
377c299716STomi Valkeinen }
3872877cf3SLaurent Pinchart EXPORT_SYMBOL(omapdss_set_dss);
397c299716STomi Valkeinen 
4050638ae5SLaurent Pinchart struct dispc_device *dispc_get_dispc(struct dss_device *dss)
4150638ae5SLaurent Pinchart {
4250638ae5SLaurent Pinchart 	return dss->dispc;
4350638ae5SLaurent Pinchart }
4450638ae5SLaurent Pinchart EXPORT_SYMBOL(dispc_get_dispc);
4550638ae5SLaurent Pinchart 
46d3541ca8SLaurent Pinchart const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
478a13398cSTomi Valkeinen {
48d3541ca8SLaurent Pinchart 	return dss->dispc_ops;
498a13398cSTomi Valkeinen }
508a13398cSTomi Valkeinen EXPORT_SYMBOL(dispc_get_ops);
518a13398cSTomi Valkeinen 
526a7c5a22SLaurent Pinchart 
536a7c5a22SLaurent Pinchart /* -----------------------------------------------------------------------------
546a7c5a22SLaurent Pinchart  * OMAP DSS Devices Handling
556a7c5a22SLaurent Pinchart  */
566a7c5a22SLaurent Pinchart 
576a7c5a22SLaurent Pinchart static LIST_HEAD(omapdss_devices_list);
586a7c5a22SLaurent Pinchart static DEFINE_MUTEX(omapdss_devices_lock);
596a7c5a22SLaurent Pinchart 
606a7c5a22SLaurent Pinchart void omapdss_device_register(struct omap_dss_device *dssdev)
616a7c5a22SLaurent Pinchart {
626a7c5a22SLaurent Pinchart 	mutex_lock(&omapdss_devices_lock);
636a7c5a22SLaurent Pinchart 	list_add_tail(&dssdev->list, &omapdss_devices_list);
646a7c5a22SLaurent Pinchart 	mutex_unlock(&omapdss_devices_lock);
656a7c5a22SLaurent Pinchart }
66de57e9dbSLaurent Pinchart EXPORT_SYMBOL_GPL(omapdss_device_register);
676a7c5a22SLaurent Pinchart 
686a7c5a22SLaurent Pinchart void omapdss_device_unregister(struct omap_dss_device *dssdev)
696a7c5a22SLaurent Pinchart {
706a7c5a22SLaurent Pinchart 	mutex_lock(&omapdss_devices_lock);
716a7c5a22SLaurent Pinchart 	list_del(&dssdev->list);
726a7c5a22SLaurent Pinchart 	mutex_unlock(&omapdss_devices_lock);
736a7c5a22SLaurent Pinchart }
74de57e9dbSLaurent Pinchart EXPORT_SYMBOL_GPL(omapdss_device_unregister);
756a7c5a22SLaurent Pinchart 
769184f8d9SLaurent Pinchart static bool omapdss_device_is_registered(struct device_node *node)
779184f8d9SLaurent Pinchart {
789184f8d9SLaurent Pinchart 	struct omap_dss_device *dssdev;
799184f8d9SLaurent Pinchart 	bool found = false;
809184f8d9SLaurent Pinchart 
819184f8d9SLaurent Pinchart 	mutex_lock(&omapdss_devices_lock);
829184f8d9SLaurent Pinchart 
839184f8d9SLaurent Pinchart 	list_for_each_entry(dssdev, &omapdss_devices_list, list) {
849184f8d9SLaurent Pinchart 		if (dssdev->dev->of_node == node) {
859184f8d9SLaurent Pinchart 			found = true;
869184f8d9SLaurent Pinchart 			break;
879184f8d9SLaurent Pinchart 		}
889184f8d9SLaurent Pinchart 	}
899184f8d9SLaurent Pinchart 
909184f8d9SLaurent Pinchart 	mutex_unlock(&omapdss_devices_lock);
919184f8d9SLaurent Pinchart 	return found;
929184f8d9SLaurent Pinchart }
939184f8d9SLaurent Pinchart 
94c1dfe721SLaurent Pinchart struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev)
95c1dfe721SLaurent Pinchart {
96c1dfe721SLaurent Pinchart 	if (!try_module_get(dssdev->owner))
97c1dfe721SLaurent Pinchart 		return NULL;
98c1dfe721SLaurent Pinchart 
99c1dfe721SLaurent Pinchart 	if (get_device(dssdev->dev) == NULL) {
100c1dfe721SLaurent Pinchart 		module_put(dssdev->owner);
101c1dfe721SLaurent Pinchart 		return NULL;
102c1dfe721SLaurent Pinchart 	}
103c1dfe721SLaurent Pinchart 
104c1dfe721SLaurent Pinchart 	return dssdev;
105c1dfe721SLaurent Pinchart }
106c1dfe721SLaurent Pinchart EXPORT_SYMBOL(omapdss_device_get);
107c1dfe721SLaurent Pinchart 
108c1dfe721SLaurent Pinchart void omapdss_device_put(struct omap_dss_device *dssdev)
109c1dfe721SLaurent Pinchart {
110c1dfe721SLaurent Pinchart 	put_device(dssdev->dev);
111c1dfe721SLaurent Pinchart 	module_put(dssdev->owner);
112c1dfe721SLaurent Pinchart }
113c1dfe721SLaurent Pinchart EXPORT_SYMBOL(omapdss_device_put);
114c1dfe721SLaurent Pinchart 
115e10bd354SLaurent Pinchart struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
116e10bd354SLaurent Pinchart 						    unsigned int port)
117e10bd354SLaurent Pinchart {
118e10bd354SLaurent Pinchart 	struct omap_dss_device *dssdev;
119e10bd354SLaurent Pinchart 
120e10bd354SLaurent Pinchart 	list_for_each_entry(dssdev, &omapdss_devices_list, list) {
1214e20bda6SLaurent Pinchart 		if (dssdev->dev->of_node == src && dssdev->of_ports & BIT(port))
122c1dfe721SLaurent Pinchart 			return omapdss_device_get(dssdev);
123e10bd354SLaurent Pinchart 	}
124e10bd354SLaurent Pinchart 
125e10bd354SLaurent Pinchart 	return NULL;
126e10bd354SLaurent Pinchart }
127e10bd354SLaurent Pinchart 
128b9f4d2ebSLaurent Pinchart /*
129*19b4200dSLaurent Pinchart  * Search for the next output device starting at @from. Release the reference to
130*19b4200dSLaurent Pinchart  * the @from device, and acquire a reference to the returned device if found.
131b9f4d2ebSLaurent Pinchart  */
132*19b4200dSLaurent Pinchart struct omap_dss_device *omapdss_device_next_output(struct omap_dss_device *from)
133b9f4d2ebSLaurent Pinchart {
134b9f4d2ebSLaurent Pinchart 	struct omap_dss_device *dssdev;
135b9f4d2ebSLaurent Pinchart 	struct list_head *list;
136b9f4d2ebSLaurent Pinchart 
137b9f4d2ebSLaurent Pinchart 	mutex_lock(&omapdss_devices_lock);
138b9f4d2ebSLaurent Pinchart 
139b9f4d2ebSLaurent Pinchart 	if (list_empty(&omapdss_devices_list)) {
140b9f4d2ebSLaurent Pinchart 		dssdev = NULL;
141b9f4d2ebSLaurent Pinchart 		goto done;
142b9f4d2ebSLaurent Pinchart 	}
143b9f4d2ebSLaurent Pinchart 
144b9f4d2ebSLaurent Pinchart 	/*
145b9f4d2ebSLaurent Pinchart 	 * Start from the from entry if given or from omapdss_devices_list
146b9f4d2ebSLaurent Pinchart 	 * otherwise.
147b9f4d2ebSLaurent Pinchart 	 */
148b9f4d2ebSLaurent Pinchart 	list = from ? &from->list : &omapdss_devices_list;
149b9f4d2ebSLaurent Pinchart 
150b9f4d2ebSLaurent Pinchart 	list_for_each_entry(dssdev, list, list) {
151b9f4d2ebSLaurent Pinchart 		/*
152b9f4d2ebSLaurent Pinchart 		 * Stop if we reach the omapdss_devices_list, that's the end of
153b9f4d2ebSLaurent Pinchart 		 * the list.
154b9f4d2ebSLaurent Pinchart 		 */
155b9f4d2ebSLaurent Pinchart 		if (&dssdev->list == &omapdss_devices_list) {
156b9f4d2ebSLaurent Pinchart 			dssdev = NULL;
157b9f4d2ebSLaurent Pinchart 			goto done;
158b9f4d2ebSLaurent Pinchart 		}
159b9f4d2ebSLaurent Pinchart 
160*19b4200dSLaurent Pinchart 		if (dssdev->id && dssdev->next)
161b9f4d2ebSLaurent Pinchart 			goto done;
162b9f4d2ebSLaurent Pinchart 	}
163b9f4d2ebSLaurent Pinchart 
164b9f4d2ebSLaurent Pinchart 	dssdev = NULL;
165b9f4d2ebSLaurent Pinchart 
166b9f4d2ebSLaurent Pinchart done:
167b9f4d2ebSLaurent Pinchart 	if (from)
168c1dfe721SLaurent Pinchart 		omapdss_device_put(from);
169b9f4d2ebSLaurent Pinchart 	if (dssdev)
170c1dfe721SLaurent Pinchart 		omapdss_device_get(dssdev);
171b9f4d2ebSLaurent Pinchart 
172b9f4d2ebSLaurent Pinchart 	mutex_unlock(&omapdss_devices_lock);
173b9f4d2ebSLaurent Pinchart 	return dssdev;
174b9f4d2ebSLaurent Pinchart }
175*19b4200dSLaurent Pinchart EXPORT_SYMBOL(omapdss_device_next_output);
176b9f4d2ebSLaurent Pinchart 
177b49a2139SLaurent Pinchart static bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
178b49a2139SLaurent Pinchart {
179b49a2139SLaurent Pinchart 	return dssdev->src;
180b49a2139SLaurent Pinchart }
181b49a2139SLaurent Pinchart 
182f324b279SLaurent Pinchart int omapdss_device_connect(struct dss_device *dss,
183f324b279SLaurent Pinchart 			   struct omap_dss_device *src,
184ec727e3fSLaurent Pinchart 			   struct omap_dss_device *dst)
185ec727e3fSLaurent Pinchart {
186fb557171SLaurent Pinchart 	int ret;
187fb557171SLaurent Pinchart 
188511afb44SLaurent Pinchart 	dev_dbg(dst->dev, "connect\n");
1891f507968SLaurent Pinchart 
190511afb44SLaurent Pinchart 	if (omapdss_device_is_connected(dst))
1911f507968SLaurent Pinchart 		return -EBUSY;
1921f507968SLaurent Pinchart 
193511afb44SLaurent Pinchart 	dst->dss = dss;
194f324b279SLaurent Pinchart 
195511afb44SLaurent Pinchart 	ret = dst->ops->connect(src, dst);
196f324b279SLaurent Pinchart 	if (ret < 0) {
197511afb44SLaurent Pinchart 		dst->dss = NULL;
198fb557171SLaurent Pinchart 		return ret;
199f324b279SLaurent Pinchart 	}
200fb557171SLaurent Pinchart 
201511afb44SLaurent Pinchart 	if (src) {
20279ddb2f0SLaurent Pinchart 		WARN_ON(src->dst);
203fb557171SLaurent Pinchart 		dst->src = src;
204fb557171SLaurent Pinchart 		src->dst = dst;
205fb557171SLaurent Pinchart 	}
206fb557171SLaurent Pinchart 
207fb557171SLaurent Pinchart 	return 0;
208ec727e3fSLaurent Pinchart }
209ec727e3fSLaurent Pinchart EXPORT_SYMBOL_GPL(omapdss_device_connect);
210ec727e3fSLaurent Pinchart 
211ec727e3fSLaurent Pinchart void omapdss_device_disconnect(struct omap_dss_device *src,
212ec727e3fSLaurent Pinchart 			       struct omap_dss_device *dst)
213ec727e3fSLaurent Pinchart {
214511afb44SLaurent Pinchart 	dev_dbg(dst->dev, "disconnect\n");
2151f507968SLaurent Pinchart 
216511afb44SLaurent Pinchart 	if (!dst->id && !omapdss_device_is_connected(dst)) {
2171298977fSLaurent Pinchart 		WARN_ON(dst->output_type);
2181f507968SLaurent Pinchart 		return;
2191f507968SLaurent Pinchart 	}
2201f507968SLaurent Pinchart 
221511afb44SLaurent Pinchart 	if (src) {
222fb557171SLaurent Pinchart 		if (WARN_ON(dst != src->dst))
223fb557171SLaurent Pinchart 			return;
224fb557171SLaurent Pinchart 
225fb557171SLaurent Pinchart 		dst->src = NULL;
226fb557171SLaurent Pinchart 		src->dst = NULL;
227fb557171SLaurent Pinchart 	}
228fb557171SLaurent Pinchart 
2293be0f15bSLaurent Pinchart 	WARN_ON(dst->state != OMAP_DSS_DISPLAY_DISABLED);
2303be0f15bSLaurent Pinchart 
231511afb44SLaurent Pinchart 	dst->ops->disconnect(src, dst);
232511afb44SLaurent Pinchart 	dst->dss = NULL;
233ec727e3fSLaurent Pinchart }
234ec727e3fSLaurent Pinchart EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
235ec727e3fSLaurent Pinchart 
236*19b4200dSLaurent Pinchart void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
237*19b4200dSLaurent Pinchart {
238*19b4200dSLaurent Pinchart 	if (!dssdev)
239*19b4200dSLaurent Pinchart 		return;
240*19b4200dSLaurent Pinchart 
241*19b4200dSLaurent Pinchart 	omapdss_device_pre_enable(dssdev->next);
242*19b4200dSLaurent Pinchart 
243*19b4200dSLaurent Pinchart 	if (dssdev->ops->pre_enable)
244*19b4200dSLaurent Pinchart 		dssdev->ops->pre_enable(dssdev);
245*19b4200dSLaurent Pinchart }
246*19b4200dSLaurent Pinchart EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
247*19b4200dSLaurent Pinchart 
248*19b4200dSLaurent Pinchart void omapdss_device_enable(struct omap_dss_device *dssdev)
249*19b4200dSLaurent Pinchart {
250*19b4200dSLaurent Pinchart 	if (!dssdev)
251*19b4200dSLaurent Pinchart 		return;
252*19b4200dSLaurent Pinchart 
253*19b4200dSLaurent Pinchart 	if (dssdev->ops->enable)
254*19b4200dSLaurent Pinchart 		dssdev->ops->enable(dssdev);
255*19b4200dSLaurent Pinchart 
256*19b4200dSLaurent Pinchart 	omapdss_device_enable(dssdev->next);
257*19b4200dSLaurent Pinchart 
258*19b4200dSLaurent Pinchart 	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
259*19b4200dSLaurent Pinchart }
260*19b4200dSLaurent Pinchart EXPORT_SYMBOL_GPL(omapdss_device_enable);
261*19b4200dSLaurent Pinchart 
262*19b4200dSLaurent Pinchart void omapdss_device_disable(struct omap_dss_device *dssdev)
263*19b4200dSLaurent Pinchart {
264*19b4200dSLaurent Pinchart 	if (!dssdev)
265*19b4200dSLaurent Pinchart 		return;
266*19b4200dSLaurent Pinchart 
267*19b4200dSLaurent Pinchart 	omapdss_device_disable(dssdev->next);
268*19b4200dSLaurent Pinchart 
269*19b4200dSLaurent Pinchart 	if (dssdev->ops->disable)
270*19b4200dSLaurent Pinchart 		dssdev->ops->disable(dssdev);
271*19b4200dSLaurent Pinchart }
272*19b4200dSLaurent Pinchart EXPORT_SYMBOL_GPL(omapdss_device_disable);
273*19b4200dSLaurent Pinchart 
274*19b4200dSLaurent Pinchart void omapdss_device_post_disable(struct omap_dss_device *dssdev)
275*19b4200dSLaurent Pinchart {
276*19b4200dSLaurent Pinchart 	if (!dssdev)
277*19b4200dSLaurent Pinchart 		return;
278*19b4200dSLaurent Pinchart 
279*19b4200dSLaurent Pinchart 	if (dssdev->ops->post_disable)
280*19b4200dSLaurent Pinchart 		dssdev->ops->post_disable(dssdev);
281*19b4200dSLaurent Pinchart 
282*19b4200dSLaurent Pinchart 	omapdss_device_post_disable(dssdev->next);
283*19b4200dSLaurent Pinchart 
284*19b4200dSLaurent Pinchart 	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
285*19b4200dSLaurent Pinchart }
286*19b4200dSLaurent Pinchart EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
287*19b4200dSLaurent Pinchart 
2886a7c5a22SLaurent Pinchart /* -----------------------------------------------------------------------------
2896a7c5a22SLaurent Pinchart  * Components Handling
2906a7c5a22SLaurent Pinchart  */
2916a7c5a22SLaurent Pinchart 
2926a7c5a22SLaurent Pinchart static struct list_head omapdss_comp_list;
2936a7c5a22SLaurent Pinchart 
2946a7c5a22SLaurent Pinchart struct omapdss_comp_node {
2956a7c5a22SLaurent Pinchart 	struct list_head list;
2966a7c5a22SLaurent Pinchart 	struct device_node *node;
2976a7c5a22SLaurent Pinchart 	bool dss_core_component;
2986a7c5a22SLaurent Pinchart };
2996a7c5a22SLaurent Pinchart 
3001e08c822SPeter Ujfalusi static bool omapdss_list_contains(const struct device_node *node)
3011e08c822SPeter Ujfalusi {
3021e08c822SPeter Ujfalusi 	struct omapdss_comp_node *comp;
3031e08c822SPeter Ujfalusi 
3041e08c822SPeter Ujfalusi 	list_for_each_entry(comp, &omapdss_comp_list, list) {
3051e08c822SPeter Ujfalusi 		if (comp->node == node)
3061e08c822SPeter Ujfalusi 			return true;
3071e08c822SPeter Ujfalusi 	}
3081e08c822SPeter Ujfalusi 
3091e08c822SPeter Ujfalusi 	return false;
3101e08c822SPeter Ujfalusi }
3111e08c822SPeter Ujfalusi 
3121e08c822SPeter Ujfalusi static void omapdss_walk_device(struct device *dev, struct device_node *node,
3131e08c822SPeter Ujfalusi 				bool dss_core)
3141e08c822SPeter Ujfalusi {
3151e08c822SPeter Ujfalusi 	struct device_node *n;
3161e08c822SPeter Ujfalusi 	struct omapdss_comp_node *comp = devm_kzalloc(dev, sizeof(*comp),
3171e08c822SPeter Ujfalusi 						      GFP_KERNEL);
3181e08c822SPeter Ujfalusi 
3191e08c822SPeter Ujfalusi 	if (comp) {
3201e08c822SPeter Ujfalusi 		comp->node = node;
3211e08c822SPeter Ujfalusi 		comp->dss_core_component = dss_core;
3221e08c822SPeter Ujfalusi 		list_add(&comp->list, &omapdss_comp_list);
3231e08c822SPeter Ujfalusi 	}
3241e08c822SPeter Ujfalusi 
3251e08c822SPeter Ujfalusi 	/*
3261e08c822SPeter Ujfalusi 	 * of_graph_get_remote_port_parent() prints an error if there is no
3271e08c822SPeter Ujfalusi 	 * port/ports node. To avoid that, check first that there's the node.
3281e08c822SPeter Ujfalusi 	 */
3291e08c822SPeter Ujfalusi 	n = of_get_child_by_name(node, "ports");
3301e08c822SPeter Ujfalusi 	if (!n)
3311e08c822SPeter Ujfalusi 		n = of_get_child_by_name(node, "port");
3321e08c822SPeter Ujfalusi 	if (!n)
3331e08c822SPeter Ujfalusi 		return;
3341e08c822SPeter Ujfalusi 
3351e08c822SPeter Ujfalusi 	of_node_put(n);
3361e08c822SPeter Ujfalusi 
3371e08c822SPeter Ujfalusi 	n = NULL;
3381e08c822SPeter Ujfalusi 	while ((n = of_graph_get_next_endpoint(node, n)) != NULL) {
3391e08c822SPeter Ujfalusi 		struct device_node *pn = of_graph_get_remote_port_parent(n);
3401e08c822SPeter Ujfalusi 
3411e08c822SPeter Ujfalusi 		if (!pn)
3421e08c822SPeter Ujfalusi 			continue;
3431e08c822SPeter Ujfalusi 
3441e08c822SPeter Ujfalusi 		if (!of_device_is_available(pn) || omapdss_list_contains(pn)) {
3451e08c822SPeter Ujfalusi 			of_node_put(pn);
3461e08c822SPeter Ujfalusi 			continue;
3471e08c822SPeter Ujfalusi 		}
3481e08c822SPeter Ujfalusi 
3491e08c822SPeter Ujfalusi 		omapdss_walk_device(dev, pn, false);
3501e08c822SPeter Ujfalusi 	}
3511e08c822SPeter Ujfalusi }
3521e08c822SPeter Ujfalusi 
3531e08c822SPeter Ujfalusi void omapdss_gather_components(struct device *dev)
3541e08c822SPeter Ujfalusi {
3551e08c822SPeter Ujfalusi 	struct device_node *child;
3561e08c822SPeter Ujfalusi 
3571e08c822SPeter Ujfalusi 	INIT_LIST_HEAD(&omapdss_comp_list);
3581e08c822SPeter Ujfalusi 
3591e08c822SPeter Ujfalusi 	omapdss_walk_device(dev, dev->of_node, true);
3601e08c822SPeter Ujfalusi 
3611e08c822SPeter Ujfalusi 	for_each_available_child_of_node(dev->of_node, child) {
3621e08c822SPeter Ujfalusi 		if (!of_find_property(child, "compatible", NULL))
3631e08c822SPeter Ujfalusi 			continue;
3641e08c822SPeter Ujfalusi 
3651e08c822SPeter Ujfalusi 		omapdss_walk_device(dev, child, true);
3661e08c822SPeter Ujfalusi 	}
3671e08c822SPeter Ujfalusi }
3681e08c822SPeter Ujfalusi EXPORT_SYMBOL(omapdss_gather_components);
3691e08c822SPeter Ujfalusi 
3701e08c822SPeter Ujfalusi static bool omapdss_component_is_loaded(struct omapdss_comp_node *comp)
3711e08c822SPeter Ujfalusi {
3721e08c822SPeter Ujfalusi 	if (comp->dss_core_component)
3731e08c822SPeter Ujfalusi 		return true;
3749184f8d9SLaurent Pinchart 	if (omapdss_device_is_registered(comp->node))
3751e08c822SPeter Ujfalusi 		return true;
3761e08c822SPeter Ujfalusi 
3771e08c822SPeter Ujfalusi 	return false;
3781e08c822SPeter Ujfalusi }
3791e08c822SPeter Ujfalusi 
3801e08c822SPeter Ujfalusi bool omapdss_stack_is_ready(void)
3811e08c822SPeter Ujfalusi {
3821e08c822SPeter Ujfalusi 	struct omapdss_comp_node *comp;
3831e08c822SPeter Ujfalusi 
3841e08c822SPeter Ujfalusi 	list_for_each_entry(comp, &omapdss_comp_list, list) {
3851e08c822SPeter Ujfalusi 		if (!omapdss_component_is_loaded(comp))
3861e08c822SPeter Ujfalusi 			return false;
3871e08c822SPeter Ujfalusi 	}
3881e08c822SPeter Ujfalusi 
3891e08c822SPeter Ujfalusi 	return true;
3901e08c822SPeter Ujfalusi }
3911e08c822SPeter Ujfalusi EXPORT_SYMBOL(omapdss_stack_is_ready);
3921e08c822SPeter Ujfalusi 
393a99ac0d9STomi Valkeinen MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
394a99ac0d9STomi Valkeinen MODULE_DESCRIPTION("OMAP Display Subsystem Base");
395a99ac0d9STomi Valkeinen MODULE_LICENSE("GPL v2");
396