aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_of.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_of.c')
-rw-r--r--drivers/gpu/drm/drm_of.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index 1fe122461298..2763a5ec845b 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -9,21 +9,28 @@
9#include <drm/drm_panel.h> 9#include <drm/drm_panel.h>
10#include <drm/drm_of.h> 10#include <drm/drm_of.h>
11 11
12/**
13 * DOC: overview
14 *
15 * A set of helper functions to aid DRM drivers in parsing standard DT
16 * properties.
17 */
18
12static void drm_release_of(struct device *dev, void *data) 19static void drm_release_of(struct device *dev, void *data)
13{ 20{
14 of_node_put(data); 21 of_node_put(data);
15} 22}
16 23
17/** 24/**
18 * drm_crtc_port_mask - find the mask of a registered CRTC by port OF node 25 * drm_of_crtc_port_mask - find the mask of a registered CRTC by port OF node
19 * @dev: DRM device 26 * @dev: DRM device
20 * @port: port OF node 27 * @port: port OF node
21 * 28 *
22 * Given a port OF node, return the possible mask of the corresponding 29 * Given a port OF node, return the possible mask of the corresponding
23 * CRTC within a device's list of CRTCs. Returns zero if not found. 30 * CRTC within a device's list of CRTCs. Returns zero if not found.
24 */ 31 */
25static uint32_t drm_crtc_port_mask(struct drm_device *dev, 32uint32_t drm_of_crtc_port_mask(struct drm_device *dev,
26 struct device_node *port) 33 struct device_node *port)
27{ 34{
28 unsigned int index = 0; 35 unsigned int index = 0;
29 struct drm_crtc *tmp; 36 struct drm_crtc *tmp;
@@ -37,6 +44,7 @@ static uint32_t drm_crtc_port_mask(struct drm_device *dev,
37 44
38 return 0; 45 return 0;
39} 46}
47EXPORT_SYMBOL(drm_of_crtc_port_mask);
40 48
41/** 49/**
42 * drm_of_find_possible_crtcs - find the possible CRTCs for an encoder port 50 * drm_of_find_possible_crtcs - find the possible CRTCs for an encoder port
@@ -62,7 +70,7 @@ uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
62 return 0; 70 return 0;
63 } 71 }
64 72
65 possible_crtcs |= drm_crtc_port_mask(dev, remote_port); 73 possible_crtcs |= drm_of_crtc_port_mask(dev, remote_port);
66 74
67 of_node_put(remote_port); 75 of_node_put(remote_port);
68 } 76 }
@@ -93,7 +101,7 @@ EXPORT_SYMBOL_GPL(drm_of_component_match_add);
93 * drm_of_component_probe - Generic probe function for a component based master 101 * drm_of_component_probe - Generic probe function for a component based master
94 * @dev: master device containing the OF node 102 * @dev: master device containing the OF node
95 * @compare_of: compare function used for matching components 103 * @compare_of: compare function used for matching components
96 * @master_ops: component master ops to be used 104 * @m_ops: component master ops to be used
97 * 105 *
98 * Parse the platform device OF node and bind all the components associated 106 * Parse the platform device OF node and bind all the components associated
99 * with the master. Interface ports are added before the encoders in order to 107 * with the master. Interface ports are added before the encoders in order to
@@ -238,10 +246,17 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
238 if (!remote) 246 if (!remote)
239 return -ENODEV; 247 return -ENODEV;
240 248
249 if (!of_device_is_available(remote)) {
250 of_node_put(remote);
251 return -ENODEV;
252 }
253
241 if (panel) { 254 if (panel) {
242 *panel = of_drm_find_panel(remote); 255 *panel = of_drm_find_panel(remote);
243 if (*panel) 256 if (!IS_ERR(*panel))
244 ret = 0; 257 ret = 0;
258 else
259 *panel = NULL;
245 } 260 }
246 261
247 /* No panel found yet, check for a bridge next. */ 262 /* No panel found yet, check for a bridge next. */