23
23
#include <drm/drm_of.h>
24
24
25
25
#include "sun4i_drv.h"
26
+ #include "sun4i_frontend.h"
26
27
#include "sun4i_framebuffer.h"
27
28
#include "sun4i_tcon.h"
28
29
@@ -91,6 +92,7 @@ static int sun4i_drv_bind(struct device *dev)
91
92
goto free_drm ;
92
93
}
93
94
drm -> dev_private = drv ;
95
+ INIT_LIST_HEAD (& drv -> frontend_list );
94
96
INIT_LIST_HEAD (& drv -> engine_list );
95
97
INIT_LIST_HEAD (& drv -> tcon_list );
96
98
@@ -177,6 +179,14 @@ static bool sun4i_drv_node_is_frontend(struct device_node *node)
177
179
of_device_is_compatible (node , "allwinner,sun8i-a33-display-frontend" );
178
180
}
179
181
182
+ static bool sun4i_drv_node_is_supported_frontend (struct device_node * node )
183
+ {
184
+ if (IS_ENABLED (CONFIG_DRM_SUN4I_BACKEND ))
185
+ return !!of_match_node (sun4i_frontend_of_table , node );
186
+
187
+ return false;
188
+ }
189
+
180
190
static bool sun4i_drv_node_is_tcon (struct device_node * node )
181
191
{
182
192
return !!of_match_node (sun4i_tcon_of_table , node );
@@ -225,9 +235,11 @@ static int sun4i_drv_add_endpoints(struct device *dev,
225
235
int count = 0 ;
226
236
227
237
/*
228
- * We don't support the frontend for now, so we will never
229
- * have a device bound. Just skip over it, but we still want
230
- * the rest our pipeline to be added.
238
+ * The frontend has been disabled in some of our old device
239
+ * trees. If we find a node that is the frontend and is
240
+ * disabled, we should just follow through and parse its
241
+ * child, but without adding it to the component list.
242
+ * Otherwise, we obviously want to add it to the list.
231
243
*/
232
244
if (!sun4i_drv_node_is_frontend (node ) &&
233
245
!of_device_is_available (node ))
@@ -240,7 +252,14 @@ static int sun4i_drv_add_endpoints(struct device *dev,
240
252
if (sun4i_drv_node_is_connector (node ))
241
253
return 0 ;
242
254
243
- if (!sun4i_drv_node_is_frontend (node )) {
255
+ /*
256
+ * If the device is either just a regular device, or an
257
+ * enabled frontend supported by the driver, we add it to our
258
+ * component list.
259
+ */
260
+ if (!sun4i_drv_node_is_frontend (node ) ||
261
+ (sun4i_drv_node_is_supported_frontend (node ) &&
262
+ of_device_is_available (node ))) {
244
263
/* Add current component */
245
264
DRM_DEBUG_DRIVER ("Adding component %pOF\n" , node );
246
265
drm_of_component_match_add (dev , match , compare_of , node );
0 commit comments