@@ -473,17 +473,40 @@ int of_drm_get_panel_orientation(const struct device_node *np,
473
473
EXPORT_SYMBOL (of_drm_get_panel_orientation );
474
474
#endif
475
475
476
- static struct drm_panel * of_find_panel (struct device * follower_dev )
476
+ /* Find panel by fwnode. This should be identical to of_drm_find_panel(). */
477
+ static struct drm_panel * find_panel_by_fwnode (const struct fwnode_handle * fwnode )
477
478
{
478
- struct device_node * panel_np ;
479
479
struct drm_panel * panel ;
480
480
481
- panel_np = of_parse_phandle (follower_dev -> of_node , "panel" , 0 );
482
- if (!panel_np )
481
+ if (!fwnode_device_is_available (fwnode ))
483
482
return ERR_PTR (- ENODEV );
484
483
485
- panel = of_drm_find_panel (panel_np );
486
- of_node_put (panel_np );
484
+ mutex_lock (& panel_lock );
485
+
486
+ list_for_each_entry (panel , & panel_list , list ) {
487
+ if (dev_fwnode (panel -> dev ) == fwnode ) {
488
+ mutex_unlock (& panel_lock );
489
+ return panel ;
490
+ }
491
+ }
492
+
493
+ mutex_unlock (& panel_lock );
494
+
495
+ return ERR_PTR (- EPROBE_DEFER );
496
+ }
497
+
498
+ /* Find panel by follower device */
499
+ static struct drm_panel * find_panel_by_dev (struct device * follower_dev )
500
+ {
501
+ struct fwnode_handle * fwnode ;
502
+ struct drm_panel * panel ;
503
+
504
+ fwnode = fwnode_find_reference (dev_fwnode (follower_dev ), "panel" , 0 );
505
+ if (IS_ERR (fwnode ))
506
+ return ERR_PTR (- ENODEV );
507
+
508
+ panel = find_panel_by_fwnode (fwnode );
509
+ fwnode_handle_put (fwnode );
487
510
488
511
return panel ;
489
512
}
@@ -494,7 +517,7 @@ static struct drm_panel *of_find_panel(struct device *follower_dev)
494
517
*
495
518
* This checks to see if a device needs to be power sequenced together with
496
519
* a panel using the panel follower API.
497
- * At the moment panels can only be followed on device tree enabled systems.
520
+ *
498
521
* The "panel" property of the follower points to the panel to be followed.
499
522
*
500
523
* Return: true if we should be power sequenced with a panel; false otherwise.
@@ -506,7 +529,7 @@ bool drm_is_panel_follower(struct device *dev)
506
529
* don't bother trying to parse it here. We just need to know if the
507
530
* property is there.
508
531
*/
509
- return of_property_present (dev -> of_node , "panel" );
532
+ return device_property_present (dev , "panel" );
510
533
}
511
534
EXPORT_SYMBOL (drm_is_panel_follower );
512
535
@@ -523,7 +546,6 @@ EXPORT_SYMBOL(drm_is_panel_follower);
523
546
* If a follower is added to a panel that's already been turned on, the
524
547
* follower's prepare callback is called right away.
525
548
*
526
- * At the moment panels can only be followed on device tree enabled systems.
527
549
* The "panel" property of the follower points to the panel to be followed.
528
550
*
529
551
* Return: 0 or an error code. Note that -ENODEV means that we detected that
@@ -536,7 +558,7 @@ int drm_panel_add_follower(struct device *follower_dev,
536
558
struct drm_panel * panel ;
537
559
int ret ;
538
560
539
- panel = of_find_panel (follower_dev );
561
+ panel = find_panel_by_dev (follower_dev );
540
562
if (IS_ERR (panel ))
541
563
return PTR_ERR (panel );
542
564
0 commit comments