diff options
Diffstat (limited to 'drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c')
-rw-r--r-- | drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c index 65a3bd7a0c00..423dda2785d4 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | |||
@@ -152,8 +152,7 @@ static const struct drm_connector_funcs atmel_hlcdc_panel_connector_funcs = { | |||
152 | .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, | 152 | .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, |
153 | }; | 153 | }; |
154 | 154 | ||
155 | static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, | 155 | static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint) |
156 | const struct device_node *np) | ||
157 | { | 156 | { |
158 | struct atmel_hlcdc_dc *dc = dev->dev_private; | 157 | struct atmel_hlcdc_dc *dc = dev->dev_private; |
159 | struct atmel_hlcdc_rgb_output *output; | 158 | struct atmel_hlcdc_rgb_output *output; |
@@ -161,6 +160,11 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, | |||
161 | struct drm_bridge *bridge; | 160 | struct drm_bridge *bridge; |
162 | int ret; | 161 | int ret; |
163 | 162 | ||
163 | ret = drm_of_find_panel_or_bridge(dev->dev->of_node, 0, endpoint, | ||
164 | &panel, &bridge); | ||
165 | if (ret) | ||
166 | return ret; | ||
167 | |||
164 | output = devm_kzalloc(dev->dev, sizeof(*output), GFP_KERNEL); | 168 | output = devm_kzalloc(dev->dev, sizeof(*output), GFP_KERNEL); |
165 | if (!output) | 169 | if (!output) |
166 | return -EINVAL; | 170 | return -EINVAL; |
@@ -177,10 +181,6 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, | |||
177 | 181 | ||
178 | output->encoder.possible_crtcs = 0x1; | 182 | output->encoder.possible_crtcs = 0x1; |
179 | 183 | ||
180 | ret = drm_of_find_panel_or_bridge(np, 0, 0, &panel, &bridge); | ||
181 | if (ret) | ||
182 | return ret; | ||
183 | |||
184 | if (panel) { | 184 | if (panel) { |
185 | output->connector.dpms = DRM_MODE_DPMS_OFF; | 185 | output->connector.dpms = DRM_MODE_DPMS_OFF; |
186 | output->connector.polled = DRM_CONNECTOR_POLL_CONNECT; | 186 | output->connector.polled = DRM_CONNECTOR_POLL_CONNECT; |
@@ -220,22 +220,14 @@ err_encoder_cleanup: | |||
220 | 220 | ||
221 | int atmel_hlcdc_create_outputs(struct drm_device *dev) | 221 | int atmel_hlcdc_create_outputs(struct drm_device *dev) |
222 | { | 222 | { |
223 | struct device_node *remote; | 223 | int endpoint, ret = 0; |
224 | int ret = -ENODEV; | 224 | |
225 | int endpoint = 0; | 225 | for (endpoint = 0; !ret; endpoint++) |
226 | 226 | ret = atmel_hlcdc_attach_endpoint(dev, endpoint); | |
227 | while (true) { | 227 | |
228 | /* Loop thru possible multiple connections to the output */ | 228 | /* At least one device was successfully attached.*/ |
229 | remote = of_graph_get_remote_node(dev->dev->of_node, 0, | 229 | if (ret == -ENODEV && endpoint) |
230 | endpoint++); | 230 | return 0; |
231 | if (!remote) | ||
232 | break; | ||
233 | |||
234 | ret = atmel_hlcdc_attach_endpoint(dev, remote); | ||
235 | of_node_put(remote); | ||
236 | if (ret) | ||
237 | return ret; | ||
238 | } | ||
239 | 231 | ||
240 | return ret; | 232 | return ret; |
241 | } | 233 | } |