drm/tilcdc changes to v4.17

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJaloN0AAoJEJA2s1DX1hlBg3QQAOL93kxj97HMKdrQz1bO4Ogt
 Vlcr6ybZj/2AGh37/BXpSKtdQ45UIowsWUETp9mK+p+zZvkS10U00QO+aL5npZ3J
 bW2VIgsC+u56eg5BjwB51O31SQEGYCZNL+DOKTYwH04cUTty8DDjaBbZczIMRJZm
 631ah5NNK/sDI8VT3ct67HbI9cMuE+aGv7qYh9CUSlLZTU5sKIddOILv+pjv59CP
 heJPT+u1NZO5FVR1O/aJuJ3x5zAiDv4goX+6BRkWetjHFFb3xSeoZ+zYoK4dOpgn
 NdYFtjkXBBo83bf6Og6TdpvDC/HDHCUiIKnq2pEgjKQlEwBPyRXLWSV8HdkbRnfV
 x+QpOdufnvCgXuSy+GyNc2Z1Qce3OSPz6ZgJOJKB+EWEv1matAH4+bMxM0fmHtnj
 mZQ5toZC5WTj4zKBVWOTMLfM+pxAp8+5NLWD0mkl2095ZLzqRG9ZvbK2uinFBR9h
 tvw9xewt36JEib+CNpbb4WKx3WPdGg9iHp5tUfNaH0HususwJtJF1knbxa8AYVYs
 fZBA/+rwxSNJh/+3peXzAAXADxsS5cxljk/5cnAm2tqrXnskTPOj7kejgoPu3kgL
 3+Tp8ydnUoFZ2TXrCmYtRCVqwmPYaVdmx7JiMtJ+H5cy6+HTNg/O8POOu82PULyO
 Q9JbruPa92SJvFlJu9rs
 =tkXF
 -----END PGP SIGNATURE-----

Merge tag 'tilcdc-4.17' of https://github.com/jsarha/linux into drm-next

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
This commit is contained in:
Dave Airlie 2018-03-01 14:04:30 +10:00
commit 0feeb106c7
6 changed files with 34 additions and 36 deletions

View file

@ -4,6 +4,8 @@ config DRM_TILCDC
select DRM_KMS_HELPER select DRM_KMS_HELPER
select DRM_KMS_CMA_HELPER select DRM_KMS_CMA_HELPER
select DRM_GEM_CMA_HELPER select DRM_GEM_CMA_HELPER
select DRM_BRIDGE
select DRM_PANEL_BRIDGE
select VIDEOMODE_HELPERS select VIDEOMODE_HELPERS
select BACKLIGHT_CLASS_DEVICE select BACKLIGHT_CLASS_DEVICE
select BACKLIGHT_LCD_SUPPORT select BACKLIGHT_LCD_SUPPORT

View file

@ -994,10 +994,8 @@ int tilcdc_crtc_create(struct drm_device *dev)
int ret; int ret;
tilcdc_crtc = devm_kzalloc(dev->dev, sizeof(*tilcdc_crtc), GFP_KERNEL); tilcdc_crtc = devm_kzalloc(dev->dev, sizeof(*tilcdc_crtc), GFP_KERNEL);
if (!tilcdc_crtc) { if (!tilcdc_crtc)
dev_err(dev->dev, "allocation failed\n");
return -ENOMEM; return -ENOMEM;
}
init_completion(&tilcdc_crtc->palette_loaded); init_completion(&tilcdc_crtc->palette_loaded);
tilcdc_crtc->palette_base = dmam_alloc_coherent(dev->dev, tilcdc_crtc->palette_base = dmam_alloc_coherent(dev->dev,

View file

@ -233,10 +233,8 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
int ret; int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv) { if (!priv)
dev_err(dev, "failed to allocate private data\n");
return -ENOMEM; return -ENOMEM;
}
ddev = drm_dev_alloc(ddrv, dev); ddev = drm_dev_alloc(ddrv, dev);
if (IS_ERR(ddev)) if (IS_ERR(ddev))

View file

@ -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) int tilcdc_attach_external_device(struct drm_device *ddev)
{ {
struct tilcdc_drm_private *priv = ddev->dev_private; struct tilcdc_drm_private *priv = ddev->dev_private;
struct device_node *remote_node;
struct drm_bridge *bridge; struct drm_bridge *bridge;
struct drm_panel *panel;
int ret; int ret;
remote_node = of_graph_get_remote_node(ddev->dev->of_node, 0, 0); ret = drm_of_find_panel_or_bridge(ddev->dev->of_node, 0, 0,
if (!remote_node) &panel, &bridge);
if (ret == -ENODEV)
return 0; return 0;
else if (ret)
bridge = of_drm_find_bridge(remote_node); return ret;
of_node_put(remote_node);
if (!bridge)
return -EPROBE_DEFER;
priv->external_encoder = devm_kzalloc(ddev->dev, priv->external_encoder = devm_kzalloc(ddev->dev,
sizeof(*priv->external_encoder), sizeof(*priv->external_encoder),
@ -215,10 +213,23 @@ int tilcdc_attach_external_device(struct drm_device *ddev)
return ret; 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); ret = tilcdc_attach_bridge(ddev, bridge);
if (ret) 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; return ret;
} }

View file

@ -101,10 +101,8 @@ static struct drm_encoder *panel_encoder_create(struct drm_device *dev,
panel_encoder = devm_kzalloc(dev->dev, sizeof(*panel_encoder), panel_encoder = devm_kzalloc(dev->dev, sizeof(*panel_encoder),
GFP_KERNEL); GFP_KERNEL);
if (!panel_encoder) { if (!panel_encoder)
dev_err(dev->dev, "allocation failed\n");
return NULL; return NULL;
}
panel_encoder->mod = mod; panel_encoder->mod = mod;
@ -210,10 +208,8 @@ static struct drm_connector *panel_connector_create(struct drm_device *dev,
panel_connector = devm_kzalloc(dev->dev, sizeof(*panel_connector), panel_connector = devm_kzalloc(dev->dev, sizeof(*panel_connector),
GFP_KERNEL); GFP_KERNEL);
if (!panel_connector) { if (!panel_connector)
dev_err(dev->dev, "allocation failed\n");
return NULL; return NULL;
}
panel_connector->encoder = encoder; panel_connector->encoder = encoder;
panel_connector->mod = mod; panel_connector->mod = mod;
@ -293,11 +289,8 @@ static struct tilcdc_panel_info *of_get_panel_info(struct device_node *np)
} }
info = kzalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) { if (!info)
pr_err("%s: allocation failed\n", __func__); goto put_node;
of_node_put(info_np);
return NULL;
}
ret |= of_property_read_u32(info_np, "ac-bias", &info->ac_bias); 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); ret |= of_property_read_u32(info_np, "ac-bias-intrpt", &info->ac_bias_intrpt);
@ -316,11 +309,11 @@ static struct tilcdc_panel_info *of_get_panel_info(struct device_node *np)
if (ret) { if (ret) {
pr_err("%s: error reading panel-info properties\n", __func__); pr_err("%s: error reading panel-info properties\n", __func__);
kfree(info); kfree(info);
of_node_put(info_np); info = NULL;
return NULL;
} }
of_node_put(info_np);
put_node:
of_node_put(info_np);
return info; return info;
} }
@ -428,7 +421,7 @@ struct platform_driver panel_driver = {
.remove = panel_remove, .remove = panel_remove,
.driver = { .driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "panel", .name = "tilcdc-panel",
.of_match_table = panel_of_match, .of_match_table = panel_of_match,
}, },
}; };

View file

@ -111,10 +111,8 @@ static struct drm_encoder *tfp410_encoder_create(struct drm_device *dev,
tfp410_encoder = devm_kzalloc(dev->dev, sizeof(*tfp410_encoder), tfp410_encoder = devm_kzalloc(dev->dev, sizeof(*tfp410_encoder),
GFP_KERNEL); GFP_KERNEL);
if (!tfp410_encoder) { if (!tfp410_encoder)
dev_err(dev->dev, "allocation failed\n");
return NULL; return NULL;
}
tfp410_encoder->dpms = DRM_MODE_DPMS_OFF; tfp410_encoder->dpms = DRM_MODE_DPMS_OFF;
tfp410_encoder->mod = mod; tfp410_encoder->mod = mod;
@ -224,10 +222,8 @@ static struct drm_connector *tfp410_connector_create(struct drm_device *dev,
tfp410_connector = devm_kzalloc(dev->dev, sizeof(*tfp410_connector), tfp410_connector = devm_kzalloc(dev->dev, sizeof(*tfp410_connector),
GFP_KERNEL); GFP_KERNEL);
if (!tfp410_connector) { if (!tfp410_connector)
dev_err(dev->dev, "allocation failed\n");
return NULL; return NULL;
}
tfp410_connector->encoder = encoder; tfp410_connector->encoder = encoder;
tfp410_connector->mod = mod; tfp410_connector->mod = mod;