diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2018-03-04 15:28:25 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2018-09-03 09:13:27 -0400 |
commit | f7e376aece4636afb0c4da5ce54d5e805ce47a76 (patch) | |
tree | acd5140259b66edaaef296be10ea53f76a318d17 /drivers/gpu/drm/omapdrm/dss | |
parent | 27d624527d99265c2df999af3615ff71c29d06f4 (diff) |
drm/omap: dss: Add for_each_dss_output() macro
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>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/dss')
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/base.c | 19 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/omapdss.h | 13 |
2 files changed, 23 insertions, 9 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c index 67086cbb3e24..1dbd08e6e029 100644 --- a/drivers/gpu/drm/omapdrm/dss/base.c +++ b/drivers/gpu/drm/omapdrm/dss/base.c | |||
@@ -126,12 +126,13 @@ struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src, | |||
126 | } | 126 | } |
127 | 127 | ||
128 | /* | 128 | /* |
129 | * Search for the next device starting at @from. If display_only is true, skip | 129 | * Search for the next device starting at @from. The type argument specfies |
130 | * non-display devices. Release the reference to the @from device, and acquire | 130 | * which device types to consider when searching. Searching for multiple types |
131 | * a reference to the returned device if found. | 131 | * is supported by and'ing their type flags. Release the reference to the @from |
132 | * device, and acquire a reference to the returned device if found. | ||
132 | */ | 133 | */ |
133 | struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from, | 134 | struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from, |
134 | bool display_only) | 135 | enum omap_dss_device_type type) |
135 | { | 136 | { |
136 | struct omap_dss_device *dssdev; | 137 | struct omap_dss_device *dssdev; |
137 | struct list_head *list; | 138 | struct list_head *list; |
@@ -159,8 +160,14 @@ struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from, | |||
159 | goto done; | 160 | goto done; |
160 | } | 161 | } |
161 | 162 | ||
162 | /* Filter out non-display entries if display_only is set. */ | 163 | /* |
163 | if (!display_only || dssdev->driver) | 164 | * Accept display entities if the display type is requested, |
165 | * and output entities if the output type is requested. | ||
166 | */ | ||
167 | if ((type & OMAP_DSS_DEVICE_TYPE_DISPLAY) && dssdev->driver) | ||
168 | goto done; | ||
169 | if ((type & OMAP_DSS_DEVICE_TYPE_OUTPUT) && dssdev->id && | ||
170 | dssdev->next) | ||
164 | goto done; | 171 | goto done; |
165 | } | 172 | } |
166 | 173 | ||
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 5d3e4ced73d1..5cbbfb16369b 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h | |||
@@ -385,6 +385,11 @@ struct omap_dss_device_ops { | |||
385 | }; | 385 | }; |
386 | }; | 386 | }; |
387 | 387 | ||
388 | enum omap_dss_device_type { | ||
389 | OMAP_DSS_DEVICE_TYPE_OUTPUT = (1 << 0), | ||
390 | OMAP_DSS_DEVICE_TYPE_DISPLAY = (1 << 1), | ||
391 | }; | ||
392 | |||
388 | struct omap_dss_device { | 393 | struct omap_dss_device { |
389 | struct kobject kobj; | 394 | struct kobject kobj; |
390 | struct device *dev; | 395 | struct device *dev; |
@@ -488,9 +493,9 @@ static inline bool omapdss_is_initialized(void) | |||
488 | return !!omapdss_get_dss(); | 493 | return !!omapdss_get_dss(); |
489 | } | 494 | } |
490 | 495 | ||
491 | void omapdss_display_init(struct omap_dss_device *dssdev); | ||
492 | #define for_each_dss_display(d) \ | 496 | #define for_each_dss_display(d) \ |
493 | while ((d = omapdss_device_get_next(d, true)) != NULL) | 497 | while ((d = omapdss_device_get_next(d, OMAP_DSS_DEVICE_TYPE_DISPLAY)) != NULL) |
498 | void omapdss_display_init(struct omap_dss_device *dssdev); | ||
494 | 499 | ||
495 | void omapdss_device_register(struct omap_dss_device *dssdev); | 500 | void omapdss_device_register(struct omap_dss_device *dssdev); |
496 | void omapdss_device_unregister(struct omap_dss_device *dssdev); | 501 | void omapdss_device_unregister(struct omap_dss_device *dssdev); |
@@ -499,7 +504,7 @@ void omapdss_device_put(struct omap_dss_device *dssdev); | |||
499 | struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src, | 504 | struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src, |
500 | unsigned int port); | 505 | unsigned int port); |
501 | struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from, | 506 | struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from, |
502 | bool display_only); | 507 | enum omap_dss_device_type type); |
503 | int omapdss_device_connect(struct dss_device *dss, | 508 | int omapdss_device_connect(struct dss_device *dss, |
504 | struct omap_dss_device *src, | 509 | struct omap_dss_device *src, |
505 | struct omap_dss_device *dst); | 510 | struct omap_dss_device *dst); |
@@ -511,6 +516,8 @@ int omap_dss_get_num_overlay_managers(void); | |||
511 | 516 | ||
512 | int omap_dss_get_num_overlays(void); | 517 | int omap_dss_get_num_overlays(void); |
513 | 518 | ||
519 | #define for_each_dss_output(d) \ | ||
520 | while ((d = omapdss_device_get_next(d, OMAP_DSS_DEVICE_TYPE_OUTPUT)) != NULL) | ||
514 | int omapdss_output_set_device(struct omap_dss_device *out, | 521 | int omapdss_output_set_device(struct omap_dss_device *out, |
515 | struct omap_dss_device *dssdev); | 522 | struct omap_dss_device *dssdev); |
516 | int omapdss_output_unset_device(struct omap_dss_device *out); | 523 | int omapdss_output_unset_device(struct omap_dss_device *out); |