diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2017-05-18 08:35:21 -0400 |
---|---|---|
committer | Sean Paul <seanpaul@chromium.org> | 2017-05-18 10:56:43 -0400 |
commit | 6bee9b78a7a5ea257b24d93974538938c82b1169 (patch) | |
tree | d6e0d44355ce04957d594497f26c1c32ac653a97 | |
parent | 52499a6ad2aef20f7baf5872e97988c385170f1b (diff) |
drm/atmel-hlcdc: Fix output initialization
drm_of_find_panel_or_bridge() is expecting np to point to the encoder
node, not the bridge or panel this encoder is feeding.
Moreover, the endpoint parameter passed to drm_of_find_panel_or_bridge()
is always set to zero, which prevents us from probing all outputs.
We also move the atmel_hlcdc_rgb_output allocation after the
panel/bridge detection to avoid useless allocations.
Reported-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Fixes: ebc944613567 ("drm: convert drivers to use drm_of_find_panel_or_bridge")
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1495110921-4032-1-git-send-email-boris.brezillon@free-electrons.com
-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 | } |