diff options
author | Dave Airlie <airlied@redhat.com> | 2018-02-28 23:04:30 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2018-02-28 23:04:30 -0500 |
commit | 0feeb106c79532074b370c3cb45f742ef4302cc6 (patch) | |
tree | 3dd62a1b2d1424b7dd7d17bc7fb4a2305d3ca772 | |
parent | 8bb5b22255dac09cd74eae9f86333b474d69fbbe (diff) | |
parent | 7f78c3d69df03674644b724cdf4f01d67962beb4 (diff) |
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
-rw-r--r-- | drivers/gpu/drm/tilcdc/Kconfig | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_drv.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_external.c | 29 | ||||
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_panel.c | 23 | ||||
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_tfp410.c | 8 |
6 files changed, 34 insertions, 36 deletions
diff --git a/drivers/gpu/drm/tilcdc/Kconfig b/drivers/gpu/drm/tilcdc/Kconfig index 81ac82455ce4..52598049c096 100644 --- a/drivers/gpu/drm/tilcdc/Kconfig +++ b/drivers/gpu/drm/tilcdc/Kconfig | |||
@@ -4,6 +4,8 @@ config DRM_TILCDC | |||
4 | select DRM_KMS_HELPER | 4 | select DRM_KMS_HELPER |
5 | select DRM_KMS_CMA_HELPER | 5 | select DRM_KMS_CMA_HELPER |
6 | select DRM_GEM_CMA_HELPER | 6 | select DRM_GEM_CMA_HELPER |
7 | select DRM_BRIDGE | ||
8 | select DRM_PANEL_BRIDGE | ||
7 | select VIDEOMODE_HELPERS | 9 | select VIDEOMODE_HELPERS |
8 | select BACKLIGHT_CLASS_DEVICE | 10 | select BACKLIGHT_CLASS_DEVICE |
9 | select BACKLIGHT_LCD_SUPPORT | 11 | select BACKLIGHT_LCD_SUPPORT |
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c index 8bf6bb93dc79..1b278a22c8b7 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c | |||
@@ -994,10 +994,8 @@ int tilcdc_crtc_create(struct drm_device *dev) | |||
994 | int ret; | 994 | int ret; |
995 | 995 | ||
996 | tilcdc_crtc = devm_kzalloc(dev->dev, sizeof(*tilcdc_crtc), GFP_KERNEL); | 996 | tilcdc_crtc = devm_kzalloc(dev->dev, sizeof(*tilcdc_crtc), GFP_KERNEL); |
997 | if (!tilcdc_crtc) { | 997 | if (!tilcdc_crtc) |
998 | dev_err(dev->dev, "allocation failed\n"); | ||
999 | return -ENOMEM; | 998 | return -ENOMEM; |
1000 | } | ||
1001 | 999 | ||
1002 | init_completion(&tilcdc_crtc->palette_loaded); | 1000 | init_completion(&tilcdc_crtc->palette_loaded); |
1003 | tilcdc_crtc->palette_base = dmam_alloc_coherent(dev->dev, | 1001 | tilcdc_crtc->palette_base = dmam_alloc_coherent(dev->dev, |
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 1afde61f1247..b8a5e4ed22e6 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c | |||
@@ -233,10 +233,8 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev) | |||
233 | int ret; | 233 | int ret; |
234 | 234 | ||
235 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); | 235 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); |
236 | if (!priv) { | 236 | if (!priv) |
237 | dev_err(dev, "failed to allocate private data\n"); | ||
238 | return -ENOMEM; | 237 | return -ENOMEM; |
239 | } | ||
240 | 238 | ||
241 | ddev = drm_dev_alloc(ddrv, dev); | 239 | ddev = drm_dev_alloc(ddrv, dev); |
242 | if (IS_ERR(ddev)) | 240 | if (IS_ERR(ddev)) |
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c b/drivers/gpu/drm/tilcdc/tilcdc_external.c index 711c7b3289d3..d651bdd6597e 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_external.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c | |||
@@ -188,18 +188,16 @@ int tilcdc_attach_bridge(struct drm_device *ddev, struct drm_bridge *bridge) | |||
188 | int tilcdc_attach_external_device(struct drm_device *ddev) | 188 | int tilcdc_attach_external_device(struct drm_device *ddev) |
189 | { | 189 | { |
190 | struct tilcdc_drm_private *priv = ddev->dev_private; | 190 | struct tilcdc_drm_private *priv = ddev->dev_private; |
191 | struct device_node *remote_node; | ||
192 | struct drm_bridge *bridge; | 191 | struct drm_bridge *bridge; |
192 | struct drm_panel *panel; | ||
193 | int ret; | 193 | int ret; |
194 | 194 | ||
195 | remote_node = of_graph_get_remote_node(ddev->dev->of_node, 0, 0); | 195 | ret = drm_of_find_panel_or_bridge(ddev->dev->of_node, 0, 0, |
196 | if (!remote_node) | 196 | &panel, &bridge); |
197 | if (ret == -ENODEV) | ||
197 | return 0; | 198 | return 0; |
198 | 199 | else if (ret) | |
199 | bridge = of_drm_find_bridge(remote_node); | 200 | return ret; |
200 | of_node_put(remote_node); | ||
201 | if (!bridge) | ||
202 | return -EPROBE_DEFER; | ||
203 | 201 | ||
204 | priv->external_encoder = devm_kzalloc(ddev->dev, | 202 | priv->external_encoder = devm_kzalloc(ddev->dev, |
205 | sizeof(*priv->external_encoder), | 203 | sizeof(*priv->external_encoder), |
@@ -215,10 +213,23 @@ int tilcdc_attach_external_device(struct drm_device *ddev) | |||
215 | return ret; | 213 | return ret; |
216 | } | 214 | } |
217 | 215 | ||
216 | if (panel) { | ||
217 | bridge = devm_drm_panel_bridge_add(ddev->dev, panel, | ||
218 | DRM_MODE_CONNECTOR_DPI); | ||
219 | if (IS_ERR(bridge)) { | ||
220 | ret = PTR_ERR(bridge); | ||
221 | goto err_encoder_cleanup; | ||
222 | } | ||
223 | } | ||
224 | |||
218 | ret = tilcdc_attach_bridge(ddev, bridge); | 225 | ret = tilcdc_attach_bridge(ddev, bridge); |
219 | if (ret) | 226 | if (ret) |
220 | drm_encoder_cleanup(priv->external_encoder); | 227 | goto err_encoder_cleanup; |
228 | |||
229 | return 0; | ||
221 | 230 | ||
231 | err_encoder_cleanup: | ||
232 | drm_encoder_cleanup(priv->external_encoder); | ||
222 | return ret; | 233 | return ret; |
223 | } | 234 | } |
224 | 235 | ||
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c index 8eebb5f826a6..d616d64a6725 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c | |||
@@ -101,10 +101,8 @@ static struct drm_encoder *panel_encoder_create(struct drm_device *dev, | |||
101 | 101 | ||
102 | panel_encoder = devm_kzalloc(dev->dev, sizeof(*panel_encoder), | 102 | panel_encoder = devm_kzalloc(dev->dev, sizeof(*panel_encoder), |
103 | GFP_KERNEL); | 103 | GFP_KERNEL); |
104 | if (!panel_encoder) { | 104 | if (!panel_encoder) |
105 | dev_err(dev->dev, "allocation failed\n"); | ||
106 | return NULL; | 105 | return NULL; |
107 | } | ||
108 | 106 | ||
109 | panel_encoder->mod = mod; | 107 | panel_encoder->mod = mod; |
110 | 108 | ||
@@ -210,10 +208,8 @@ static struct drm_connector *panel_connector_create(struct drm_device *dev, | |||
210 | 208 | ||
211 | panel_connector = devm_kzalloc(dev->dev, sizeof(*panel_connector), | 209 | panel_connector = devm_kzalloc(dev->dev, sizeof(*panel_connector), |
212 | GFP_KERNEL); | 210 | GFP_KERNEL); |
213 | if (!panel_connector) { | 211 | if (!panel_connector) |
214 | dev_err(dev->dev, "allocation failed\n"); | ||
215 | return NULL; | 212 | return NULL; |
216 | } | ||
217 | 213 | ||
218 | panel_connector->encoder = encoder; | 214 | panel_connector->encoder = encoder; |
219 | panel_connector->mod = mod; | 215 | panel_connector->mod = mod; |
@@ -293,11 +289,8 @@ static struct tilcdc_panel_info *of_get_panel_info(struct device_node *np) | |||
293 | } | 289 | } |
294 | 290 | ||
295 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 291 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
296 | if (!info) { | 292 | if (!info) |
297 | pr_err("%s: allocation failed\n", __func__); | 293 | goto put_node; |
298 | of_node_put(info_np); | ||
299 | return NULL; | ||
300 | } | ||
301 | 294 | ||
302 | ret |= of_property_read_u32(info_np, "ac-bias", &info->ac_bias); | 295 | ret |= of_property_read_u32(info_np, "ac-bias", &info->ac_bias); |
303 | ret |= of_property_read_u32(info_np, "ac-bias-intrpt", &info->ac_bias_intrpt); | 296 | 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) | |||
316 | if (ret) { | 309 | if (ret) { |
317 | pr_err("%s: error reading panel-info properties\n", __func__); | 310 | pr_err("%s: error reading panel-info properties\n", __func__); |
318 | kfree(info); | 311 | kfree(info); |
319 | of_node_put(info_np); | 312 | info = NULL; |
320 | return NULL; | ||
321 | } | 313 | } |
322 | of_node_put(info_np); | ||
323 | 314 | ||
315 | put_node: | ||
316 | of_node_put(info_np); | ||
324 | return info; | 317 | return info; |
325 | } | 318 | } |
326 | 319 | ||
@@ -428,7 +421,7 @@ struct platform_driver panel_driver = { | |||
428 | .remove = panel_remove, | 421 | .remove = panel_remove, |
429 | .driver = { | 422 | .driver = { |
430 | .owner = THIS_MODULE, | 423 | .owner = THIS_MODULE, |
431 | .name = "panel", | 424 | .name = "tilcdc-panel", |
432 | .of_match_table = panel_of_match, | 425 | .of_match_table = panel_of_match, |
433 | }, | 426 | }, |
434 | }; | 427 | }; |
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c index 7e3643462a08..c45cabb38db0 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c | |||
@@ -111,10 +111,8 @@ static struct drm_encoder *tfp410_encoder_create(struct drm_device *dev, | |||
111 | 111 | ||
112 | tfp410_encoder = devm_kzalloc(dev->dev, sizeof(*tfp410_encoder), | 112 | tfp410_encoder = devm_kzalloc(dev->dev, sizeof(*tfp410_encoder), |
113 | GFP_KERNEL); | 113 | GFP_KERNEL); |
114 | if (!tfp410_encoder) { | 114 | if (!tfp410_encoder) |
115 | dev_err(dev->dev, "allocation failed\n"); | ||
116 | return NULL; | 115 | return NULL; |
117 | } | ||
118 | 116 | ||
119 | tfp410_encoder->dpms = DRM_MODE_DPMS_OFF; | 117 | tfp410_encoder->dpms = DRM_MODE_DPMS_OFF; |
120 | tfp410_encoder->mod = mod; | 118 | tfp410_encoder->mod = mod; |
@@ -224,10 +222,8 @@ static struct drm_connector *tfp410_connector_create(struct drm_device *dev, | |||
224 | 222 | ||
225 | tfp410_connector = devm_kzalloc(dev->dev, sizeof(*tfp410_connector), | 223 | tfp410_connector = devm_kzalloc(dev->dev, sizeof(*tfp410_connector), |
226 | GFP_KERNEL); | 224 | GFP_KERNEL); |
227 | if (!tfp410_connector) { | 225 | if (!tfp410_connector) |
228 | dev_err(dev->dev, "allocation failed\n"); | ||
229 | return NULL; | 226 | return NULL; |
230 | } | ||
231 | 227 | ||
232 | tfp410_connector->encoder = encoder; | 228 | tfp410_connector->encoder = encoder; |
233 | tfp410_connector->mod = mod; | 229 | tfp410_connector->mod = mod; |