diff options
author | Liu Ying <victor.liu@nxp.com> | 2017-08-29 16:58:58 +0800 |
---|---|---|
committer | Dong Aisheng <aisheng.dong@nxp.com> | 2019-11-25 15:57:41 +0800 |
commit | 36b8a992d5edfe911dff5c38a7535be141122853 (patch) | |
tree | 0358a0c72877928458b9091f2cf90a2bd6052010 | |
parent | 9b995437fee9d9cc2500108f1c6640b57bd6ae21 (diff) |
MLK-16290 drm: Add drm_of_component_probe_with_match() helper
A component master may have both OF based and non-OF based components to be
bound with. This patch adds a helper drm_of_component_probe_with_match()
similar to drm_of_component_probe() so that the new helper may get an
additional provided match pointer(contains match entries for non-OF based
components) to support this case.
Tested-by: Meng Mingming <mingming.meng@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit c3cad7223488638ab56c20b2c29345487857bc5f)
-rw-r--r-- | drivers/gpu/drm/drm_of.c | 31 | ||||
-rw-r--r-- | include/drm/drm_of.h | 13 |
2 files changed, 41 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 43d89dd59c6b..f9f2a54a1ad1 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -100,8 +100,10 @@ void drm_of_component_match_add(struct device *master, EXPORT_SYMBOL_GPL(drm_of_component_match_add); /** - * drm_of_component_probe - Generic probe function for a component based master + * drm_of_component_probe_with_match - Generic probe function with match + * entries for a component based master * @dev: master device containing the OF node + * @match: component match pointer provided to store matches * @compare_of: compare function used for matching components * @m_ops: component master ops to be used * @@ -112,12 +114,12 @@ EXPORT_SYMBOL_GPL(drm_of_component_match_add); * * Returns zero if successful, or one of the standard error codes if it fails. */ -int drm_of_component_probe(struct device *dev, +int drm_of_component_probe_with_match(struct device *dev, + struct component_match *match, int (*compare_of)(struct device *, void *), const struct component_master_ops *m_ops) { struct device_node *ep, *port, *remote; - struct component_match *match = NULL; int i; if (!dev->of_node) @@ -183,6 +185,29 @@ int drm_of_component_probe(struct device *dev, return component_master_add_with_match(dev, m_ops, match); } +EXPORT_SYMBOL(drm_of_component_probe_with_match); + +/** + * drm_of_component_probe - Generic probe function for a component based master + * @dev: master device containing the OF node + * @compare_of: compare function used for matching components + * @master_ops: component master ops to be used + * + * Parse the platform device OF node and bind all the components associated + * with the master. Interface ports are added before the encoders in order to + * satisfy their .bind requirements + * See Documentation/devicetree/bindings/graph.txt for the bindings. + * + * Returns zero if successful, or one of the standard error codes if it fails. + */ +int drm_of_component_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + const struct component_master_ops *m_ops) +{ + struct component_match *match = NULL; + + return drm_of_component_probe_with_match(dev, match, compare_of, m_ops); +} EXPORT_SYMBOL(drm_of_component_probe); /* diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index ead34ab5ca4e..9dcbbf6f6c51 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -7,6 +7,7 @@ #include <drm/drm_bridge.h> #endif +struct component_match; struct component_master_ops; struct component_match; struct device; @@ -25,6 +26,10 @@ void drm_of_component_match_add(struct device *master, struct component_match **matchptr, int (*compare)(struct device *, void *), struct device_node *node); +extern int drm_of_component_probe_with_match(struct device *dev, + struct component_match *match, + int (*compare_of)(struct device *, void *), + const struct component_master_ops *m_ops); int drm_of_component_probe(struct device *dev, int (*compare_of)(struct device *, void *), const struct component_master_ops *m_ops); @@ -56,6 +61,14 @@ drm_of_component_match_add(struct device *master, { } +static int drm_of_component_probe_with_match(struct device *dev, + struct component_match *match, + int (*compare_of)(struct device *, void *), + const struct component_master_ops *m_ops) +{ + return -EINVAL; +} + static inline int drm_of_component_probe(struct device *dev, int (*compare_of)(struct device *, void *), |