Skip to content

Commit

Permalink
Merge tag 'tilcdc-4.17' of https://github.com/jsarha/linux into drm-next
Browse files Browse the repository at this point in the history
drm/tilcdc changes to v4.17

* tag 'tilcdc-4.17' of https://github.com/jsarha/linux:
  drm/tilcdc: tilcdc_panel: Rename device from "panel" to "tilcdc-panel"
  drm/tilcdc: Add support for drm panels
  drm/tilcdc: panel: Use common error handling code in of_get_panel_info()
  drm/tilcdc: Delete an error message for a failed memory allocation in seven functions
  • Loading branch information
Dave Airlie committed Mar 1, 2018
2 parents 8bb5b22 + 7f78c3d commit 0feeb10
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 36 deletions.
2 changes: 2 additions & 0 deletions drivers/gpu/drm/tilcdc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ config DRM_TILCDC
select DRM_KMS_HELPER
select DRM_KMS_CMA_HELPER
select DRM_GEM_CMA_HELPER
select DRM_BRIDGE
select DRM_PANEL_BRIDGE
select VIDEOMODE_HELPERS
select BACKLIGHT_CLASS_DEVICE
select BACKLIGHT_LCD_SUPPORT
Expand Down
4 changes: 1 addition & 3 deletions drivers/gpu/drm/tilcdc/tilcdc_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -994,10 +994,8 @@ int tilcdc_crtc_create(struct drm_device *dev)
int ret;

tilcdc_crtc = devm_kzalloc(dev->dev, sizeof(*tilcdc_crtc), GFP_KERNEL);
if (!tilcdc_crtc) {
dev_err(dev->dev, "allocation failed\n");
if (!tilcdc_crtc)
return -ENOMEM;
}

init_completion(&tilcdc_crtc->palette_loaded);
tilcdc_crtc->palette_base = dmam_alloc_coherent(dev->dev,
Expand Down
4 changes: 1 addition & 3 deletions drivers/gpu/drm/tilcdc/tilcdc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,8 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
int ret;

priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv) {
dev_err(dev, "failed to allocate private data\n");
if (!priv)
return -ENOMEM;
}

ddev = drm_dev_alloc(ddrv, dev);
if (IS_ERR(ddev))
Expand Down
29 changes: 20 additions & 9 deletions drivers/gpu/drm/tilcdc/tilcdc_external.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,16 @@ int tilcdc_attach_bridge(struct drm_device *ddev, struct drm_bridge *bridge)
int tilcdc_attach_external_device(struct drm_device *ddev)
{
struct tilcdc_drm_private *priv = ddev->dev_private;
struct device_node *remote_node;
struct drm_bridge *bridge;
struct drm_panel *panel;
int ret;

remote_node = of_graph_get_remote_node(ddev->dev->of_node, 0, 0);
if (!remote_node)
ret = drm_of_find_panel_or_bridge(ddev->dev->of_node, 0, 0,
&panel, &bridge);
if (ret == -ENODEV)
return 0;

bridge = of_drm_find_bridge(remote_node);
of_node_put(remote_node);
if (!bridge)
return -EPROBE_DEFER;
else if (ret)
return ret;

priv->external_encoder = devm_kzalloc(ddev->dev,
sizeof(*priv->external_encoder),
Expand All @@ -215,10 +213,23 @@ int tilcdc_attach_external_device(struct drm_device *ddev)
return ret;
}

if (panel) {
bridge = devm_drm_panel_bridge_add(ddev->dev, panel,
DRM_MODE_CONNECTOR_DPI);
if (IS_ERR(bridge)) {
ret = PTR_ERR(bridge);
goto err_encoder_cleanup;
}
}

ret = tilcdc_attach_bridge(ddev, bridge);
if (ret)
drm_encoder_cleanup(priv->external_encoder);
goto err_encoder_cleanup;

return 0;

err_encoder_cleanup:
drm_encoder_cleanup(priv->external_encoder);
return ret;
}

Expand Down
23 changes: 8 additions & 15 deletions drivers/gpu/drm/tilcdc/tilcdc_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ static struct drm_encoder *panel_encoder_create(struct drm_device *dev,

panel_encoder = devm_kzalloc(dev->dev, sizeof(*panel_encoder),
GFP_KERNEL);
if (!panel_encoder) {
dev_err(dev->dev, "allocation failed\n");
if (!panel_encoder)
return NULL;
}

panel_encoder->mod = mod;

Expand Down Expand Up @@ -210,10 +208,8 @@ static struct drm_connector *panel_connector_create(struct drm_device *dev,

panel_connector = devm_kzalloc(dev->dev, sizeof(*panel_connector),
GFP_KERNEL);
if (!panel_connector) {
dev_err(dev->dev, "allocation failed\n");
if (!panel_connector)
return NULL;
}

panel_connector->encoder = encoder;
panel_connector->mod = mod;
Expand Down Expand Up @@ -293,11 +289,8 @@ static struct tilcdc_panel_info *of_get_panel_info(struct device_node *np)
}

info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) {
pr_err("%s: allocation failed\n", __func__);
of_node_put(info_np);
return NULL;
}
if (!info)
goto put_node;

ret |= of_property_read_u32(info_np, "ac-bias", &info->ac_bias);
ret |= of_property_read_u32(info_np, "ac-bias-intrpt", &info->ac_bias_intrpt);
Expand All @@ -316,11 +309,11 @@ static struct tilcdc_panel_info *of_get_panel_info(struct device_node *np)
if (ret) {
pr_err("%s: error reading panel-info properties\n", __func__);
kfree(info);
of_node_put(info_np);
return NULL;
info = NULL;
}
of_node_put(info_np);

put_node:
of_node_put(info_np);
return info;
}

Expand Down Expand Up @@ -428,7 +421,7 @@ struct platform_driver panel_driver = {
.remove = panel_remove,
.driver = {
.owner = THIS_MODULE,
.name = "panel",
.name = "tilcdc-panel",
.of_match_table = panel_of_match,
},
};
Expand Down
8 changes: 2 additions & 6 deletions drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,8 @@ static struct drm_encoder *tfp410_encoder_create(struct drm_device *dev,

tfp410_encoder = devm_kzalloc(dev->dev, sizeof(*tfp410_encoder),
GFP_KERNEL);
if (!tfp410_encoder) {
dev_err(dev->dev, "allocation failed\n");
if (!tfp410_encoder)
return NULL;
}

tfp410_encoder->dpms = DRM_MODE_DPMS_OFF;
tfp410_encoder->mod = mod;
Expand Down Expand Up @@ -224,10 +222,8 @@ static struct drm_connector *tfp410_connector_create(struct drm_device *dev,

tfp410_connector = devm_kzalloc(dev->dev, sizeof(*tfp410_connector),
GFP_KERNEL);
if (!tfp410_connector) {
dev_err(dev->dev, "allocation failed\n");
if (!tfp410_connector)
return NULL;
}

tfp410_connector->encoder = encoder;
tfp410_connector->mod = mod;
Expand Down

0 comments on commit 0feeb10

Please sign in to comment.