]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/omap: dss: Add for_each_dss_output() macro
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 4 Mar 2018 20:28:25 +0000 (22:28 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 3 Sep 2018 13:13:27 +0000 (16:13 +0300)
Similarly to for_each_dss_display(), the for_each_dss_output() macro
iterates over all the DSS connected outputs.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/gpu/drm/omapdrm/dss/base.c
drivers/gpu/drm/omapdrm/dss/omapdss.h

index 67086cbb3e24f12ef207be4762bcdd325a4f6a60..1dbd08e6e029759dc249c0644edcac933736d054 100644 (file)
@@ -126,12 +126,13 @@ struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
 }
 
 /*
- * Search for the next device starting at @from. If display_only is true, skip
- * non-display devices. Release the reference to the @from device, and acquire
- * a reference to the returned device if found.
+ * Search for the next device starting at @from. The type argument specfies
+ * which device types to consider when searching. Searching for multiple types
+ * is supported by and'ing their type flags. Release the reference to the @from
+ * device, and acquire a reference to the returned device if found.
  */
 struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from,
-                                               bool display_only)
+                                               enum omap_dss_device_type type)
 {
        struct omap_dss_device *dssdev;
        struct list_head *list;
@@ -159,8 +160,14 @@ struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from,
                        goto done;
                }
 
-               /* Filter out non-display entries if display_only is set. */
-               if (!display_only || dssdev->driver)
+               /*
+                * Accept display entities if the display type is requested,
+                * and output entities if the output type is requested.
+                */
+               if ((type & OMAP_DSS_DEVICE_TYPE_DISPLAY) && dssdev->driver)
+                       goto done;
+               if ((type & OMAP_DSS_DEVICE_TYPE_OUTPUT) && dssdev->id &&
+                   dssdev->next)
                        goto done;
        }
 
index 5d3e4ced73d1ad71d527ee08cd51ddc34a760198..5cbbfb16369be9a1ec8392182daa9e4b99b160a6 100644 (file)
@@ -385,6 +385,11 @@ struct omap_dss_device_ops {
        };
 };
 
+enum omap_dss_device_type {
+       OMAP_DSS_DEVICE_TYPE_OUTPUT = (1 << 0),
+       OMAP_DSS_DEVICE_TYPE_DISPLAY = (1 << 1),
+};
+
 struct omap_dss_device {
        struct kobject kobj;
        struct device *dev;
@@ -488,9 +493,9 @@ static inline bool omapdss_is_initialized(void)
        return !!omapdss_get_dss();
 }
 
-void omapdss_display_init(struct omap_dss_device *dssdev);
 #define for_each_dss_display(d) \
-       while ((d = omapdss_device_get_next(d, true)) != NULL)
+       while ((d = omapdss_device_get_next(d, OMAP_DSS_DEVICE_TYPE_DISPLAY)) != NULL)
+void omapdss_display_init(struct omap_dss_device *dssdev);
 
 void omapdss_device_register(struct omap_dss_device *dssdev);
 void omapdss_device_unregister(struct omap_dss_device *dssdev);
@@ -499,7 +504,7 @@ void omapdss_device_put(struct omap_dss_device *dssdev);
 struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
                                                    unsigned int port);
 struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from,
-                                               bool display_only);
+                                               enum omap_dss_device_type type);
 int omapdss_device_connect(struct dss_device *dss,
                           struct omap_dss_device *src,
                           struct omap_dss_device *dst);
@@ -511,6 +516,8 @@ int omap_dss_get_num_overlay_managers(void);
 
 int omap_dss_get_num_overlays(void);
 
+#define for_each_dss_output(d) \
+       while ((d = omapdss_device_get_next(d, OMAP_DSS_DEVICE_TYPE_OUTPUT)) != NULL)
 int omapdss_output_set_device(struct omap_dss_device *out,
                struct omap_dss_device *dssdev);
 int omapdss_output_unset_device(struct omap_dss_device *out);