1 From 43265ca8cc62395e1750686daa8b7007b617e53b Mon Sep 17 00:00:00 2001
2 From: Liu Ying <victor.liu@nxp.com>
3 Date: Tue, 29 Aug 2017 16:58:58 +0800
4 Subject: [PATCH] MLK-16290 drm: Add drm_of_component_probe_with_match() helper
6 A component master may have both OF based and non-OF based components to be
7 bound with. This patch adds a helper drm_of_component_probe_with_match()
8 similar to drm_of_component_probe() so that the new helper may get an
9 additional provided match pointer(contains match entries for non-OF based
10 components) to support this case.
12 Tested-by: Meng Mingming <mingming.meng@nxp.com>
13 Signed-off-by: Liu Ying <victor.liu@nxp.com>
14 (cherry picked from commit c3cad7223488638ab56c20b2c29345487857bc5f)
16 drivers/gpu/drm/drm_of.c | 31 ++++++++++++++++++++++++++++---
17 include/drm/drm_of.h | 13 +++++++++++++
18 2 files changed, 41 insertions(+), 3 deletions(-)
20 --- a/drivers/gpu/drm/drm_of.c
21 +++ b/drivers/gpu/drm/drm_of.c
22 @@ -100,8 +100,10 @@ void drm_of_component_match_add(struct d
23 EXPORT_SYMBOL_GPL(drm_of_component_match_add);
26 - * drm_of_component_probe - Generic probe function for a component based master
27 + * drm_of_component_probe_with_match - Generic probe function with match
28 + * entries for a component based master
29 * @dev: master device containing the OF node
30 + * @match: component match pointer provided to store matches
31 * @compare_of: compare function used for matching components
32 * @m_ops: component master ops to be used
34 @@ -112,12 +114,12 @@ EXPORT_SYMBOL_GPL(drm_of_component_match
36 * Returns zero if successful, or one of the standard error codes if it fails.
38 -int drm_of_component_probe(struct device *dev,
39 +int drm_of_component_probe_with_match(struct device *dev,
40 + struct component_match *match,
41 int (*compare_of)(struct device *, void *),
42 const struct component_master_ops *m_ops)
44 struct device_node *ep, *port, *remote;
45 - struct component_match *match = NULL;
49 @@ -183,6 +185,29 @@ int drm_of_component_probe(struct device
51 return component_master_add_with_match(dev, m_ops, match);
53 +EXPORT_SYMBOL(drm_of_component_probe_with_match);
56 + * drm_of_component_probe - Generic probe function for a component based master
57 + * @dev: master device containing the OF node
58 + * @compare_of: compare function used for matching components
59 + * @master_ops: component master ops to be used
61 + * Parse the platform device OF node and bind all the components associated
62 + * with the master. Interface ports are added before the encoders in order to
63 + * satisfy their .bind requirements
64 + * See Documentation/devicetree/bindings/graph.txt for the bindings.
66 + * Returns zero if successful, or one of the standard error codes if it fails.
68 +int drm_of_component_probe(struct device *dev,
69 + int (*compare_of)(struct device *, void *),
70 + const struct component_master_ops *m_ops)
72 + struct component_match *match = NULL;
74 + return drm_of_component_probe_with_match(dev, match, compare_of, m_ops);
76 EXPORT_SYMBOL(drm_of_component_probe);
79 --- a/include/drm/drm_of.h
80 +++ b/include/drm/drm_of.h
82 #include <drm/drm_bridge.h>
85 +struct component_match;
86 struct component_master_ops;
87 struct component_match;
89 @@ -25,6 +26,10 @@ void drm_of_component_match_add(struct d
90 struct component_match **matchptr,
91 int (*compare)(struct device *, void *),
92 struct device_node *node);
93 +extern int drm_of_component_probe_with_match(struct device *dev,
94 + struct component_match *match,
95 + int (*compare_of)(struct device *, void *),
96 + const struct component_master_ops *m_ops);
97 int drm_of_component_probe(struct device *dev,
98 int (*compare_of)(struct device *, void *),
99 const struct component_master_ops *m_ops);
100 @@ -56,6 +61,14 @@ drm_of_component_match_add(struct device
104 +static int drm_of_component_probe_with_match(struct device *dev,
105 + struct component_match *match,
106 + int (*compare_of)(struct device *, void *),
107 + const struct component_master_ops *m_ops)
113 drm_of_component_probe(struct device *dev,
114 int (*compare_of)(struct device *, void *),