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: ebc9446135
("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
This commit is contained in:
parent
52499a6ad2
commit
6bee9b78a7
@ -152,8 +152,7 @@ static const struct drm_connector_funcs atmel_hlcdc_panel_connector_funcs = {
|
|||||||
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
|
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int atmel_hlcdc_attach_endpoint(struct drm_device *dev,
|
static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint)
|
||||||
const struct device_node *np)
|
|
||||||
{
|
{
|
||||||
struct atmel_hlcdc_dc *dc = dev->dev_private;
|
struct atmel_hlcdc_dc *dc = dev->dev_private;
|
||||||
struct atmel_hlcdc_rgb_output *output;
|
struct atmel_hlcdc_rgb_output *output;
|
||||||
@ -161,6 +160,11 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev,
|
|||||||
struct drm_bridge *bridge;
|
struct drm_bridge *bridge;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
ret = drm_of_find_panel_or_bridge(dev->dev->of_node, 0, endpoint,
|
||||||
|
&panel, &bridge);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
output = devm_kzalloc(dev->dev, sizeof(*output), GFP_KERNEL);
|
output = devm_kzalloc(dev->dev, sizeof(*output), GFP_KERNEL);
|
||||||
if (!output)
|
if (!output)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -177,10 +181,6 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev,
|
|||||||
|
|
||||||
output->encoder.possible_crtcs = 0x1;
|
output->encoder.possible_crtcs = 0x1;
|
||||||
|
|
||||||
ret = drm_of_find_panel_or_bridge(np, 0, 0, &panel, &bridge);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (panel) {
|
if (panel) {
|
||||||
output->connector.dpms = DRM_MODE_DPMS_OFF;
|
output->connector.dpms = DRM_MODE_DPMS_OFF;
|
||||||
output->connector.polled = DRM_CONNECTOR_POLL_CONNECT;
|
output->connector.polled = DRM_CONNECTOR_POLL_CONNECT;
|
||||||
@ -220,22 +220,14 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev,
|
|||||||
|
|
||||||
int atmel_hlcdc_create_outputs(struct drm_device *dev)
|
int atmel_hlcdc_create_outputs(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
struct device_node *remote;
|
int endpoint, ret = 0;
|
||||||
int ret = -ENODEV;
|
|
||||||
int endpoint = 0;
|
|
||||||
|
|
||||||
while (true) {
|
for (endpoint = 0; !ret; endpoint++)
|
||||||
/* Loop thru possible multiple connections to the output */
|
ret = atmel_hlcdc_attach_endpoint(dev, endpoint);
|
||||||
remote = of_graph_get_remote_node(dev->dev->of_node, 0,
|
|
||||||
endpoint++);
|
|
||||||
if (!remote)
|
|
||||||
break;
|
|
||||||
|
|
||||||
ret = atmel_hlcdc_attach_endpoint(dev, remote);
|
/* At least one device was successfully attached.*/
|
||||||
of_node_put(remote);
|
if (ret == -ENODEV && endpoint)
|
||||||
if (ret)
|
return 0;
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user