aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/tegra/dc.c25
-rw-r--r--drivers/gpu/drm/tegra/drm.c4
-rw-r--r--drivers/gpu/drm/tegra/output.c12
3 files changed, 36 insertions, 5 deletions
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 588d4ba0d8cf..93ab5395c838 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -93,8 +93,11 @@ static int tegra_plane_disable(struct drm_plane *plane)
93 93
94static void tegra_plane_destroy(struct drm_plane *plane) 94static void tegra_plane_destroy(struct drm_plane *plane)
95{ 95{
96 struct tegra_plane *p = to_tegra_plane(plane);
97
96 tegra_plane_disable(plane); 98 tegra_plane_disable(plane);
97 drm_plane_cleanup(plane); 99 drm_plane_cleanup(plane);
100 kfree(p);
98} 101}
99 102
100static const struct drm_plane_funcs tegra_plane_funcs = { 103static const struct drm_plane_funcs tegra_plane_funcs = {
@@ -120,7 +123,7 @@ static int tegra_dc_add_planes(struct drm_device *drm, struct tegra_dc *dc)
120 for (i = 0; i < 2; i++) { 123 for (i = 0; i < 2; i++) {
121 struct tegra_plane *plane; 124 struct tegra_plane *plane;
122 125
123 plane = devm_kzalloc(drm->dev, sizeof(*plane), GFP_KERNEL); 126 plane = kzalloc(sizeof(*plane), GFP_KERNEL);
124 if (!plane) 127 if (!plane)
125 return -ENOMEM; 128 return -ENOMEM;
126 129
@@ -129,8 +132,10 @@ static int tegra_dc_add_planes(struct drm_device *drm, struct tegra_dc *dc)
129 err = drm_plane_init(drm, &plane->base, 1 << dc->pipe, 132 err = drm_plane_init(drm, &plane->base, 1 << dc->pipe,
130 &tegra_plane_funcs, plane_formats, 133 &tegra_plane_funcs, plane_formats,
131 ARRAY_SIZE(plane_formats), false); 134 ARRAY_SIZE(plane_formats), false);
132 if (err < 0) 135 if (err < 0) {
136 kfree(plane);
133 return err; 137 return err;
138 }
134 } 139 }
135 140
136 return 0; 141 return 0;
@@ -251,14 +256,26 @@ static int tegra_dc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
251 return 0; 256 return 0;
252} 257}
253 258
259static void drm_crtc_clear(struct drm_crtc *crtc)
260{
261 memset(crtc, 0, sizeof(*crtc));
262}
263
264static void tegra_dc_destroy(struct drm_crtc *crtc)
265{
266 drm_crtc_cleanup(crtc);
267 drm_crtc_clear(crtc);
268}
269
254static const struct drm_crtc_funcs tegra_crtc_funcs = { 270static const struct drm_crtc_funcs tegra_crtc_funcs = {
255 .page_flip = tegra_dc_page_flip, 271 .page_flip = tegra_dc_page_flip,
256 .set_config = drm_crtc_helper_set_config, 272 .set_config = drm_crtc_helper_set_config,
257 .destroy = drm_crtc_cleanup, 273 .destroy = tegra_dc_destroy,
258}; 274};
259 275
260static void tegra_crtc_disable(struct drm_crtc *crtc) 276static void tegra_crtc_disable(struct drm_crtc *crtc)
261{ 277{
278 struct tegra_dc *dc = to_tegra_dc(crtc);
262 struct drm_device *drm = crtc->dev; 279 struct drm_device *drm = crtc->dev;
263 struct drm_plane *plane; 280 struct drm_plane *plane;
264 281
@@ -273,6 +290,8 @@ static void tegra_crtc_disable(struct drm_crtc *crtc)
273 } 290 }
274 } 291 }
275 } 292 }
293
294 drm_vblank_off(drm, dc->pipe);
276} 295}
277 296
278static bool tegra_crtc_mode_fixup(struct drm_crtc *crtc, 297static bool tegra_crtc_mode_fixup(struct drm_crtc *crtc,
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index c2db409bbd63..96dea0a83139 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -72,13 +72,13 @@ static int tegra_drm_unload(struct drm_device *drm)
72 72
73 drm_kms_helper_poll_fini(drm); 73 drm_kms_helper_poll_fini(drm);
74 tegra_drm_fb_exit(drm); 74 tegra_drm_fb_exit(drm);
75 drm_vblank_cleanup(drm);
76 drm_mode_config_cleanup(drm);
75 77
76 err = host1x_device_exit(device); 78 err = host1x_device_exit(device);
77 if (err < 0) 79 if (err < 0)
78 return err; 80 return err;
79 81
80 drm_mode_config_cleanup(drm);
81
82 return 0; 82 return 0;
83} 83}
84 84
diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
index 8f40fa646cec..591d3b0186d8 100644
--- a/drivers/gpu/drm/tegra/output.c
+++ b/drivers/gpu/drm/tegra/output.c
@@ -79,10 +79,16 @@ tegra_connector_detect(struct drm_connector *connector, bool force)
79 return status; 79 return status;
80} 80}
81 81
82static void drm_connector_clear(struct drm_connector *connector)
83{
84 memset(connector, 0, sizeof(*connector));
85}
86
82static void tegra_connector_destroy(struct drm_connector *connector) 87static void tegra_connector_destroy(struct drm_connector *connector)
83{ 88{
84 drm_sysfs_connector_remove(connector); 89 drm_sysfs_connector_remove(connector);
85 drm_connector_cleanup(connector); 90 drm_connector_cleanup(connector);
91 drm_connector_clear(connector);
86} 92}
87 93
88static const struct drm_connector_funcs connector_funcs = { 94static const struct drm_connector_funcs connector_funcs = {
@@ -92,9 +98,15 @@ static const struct drm_connector_funcs connector_funcs = {
92 .destroy = tegra_connector_destroy, 98 .destroy = tegra_connector_destroy,
93}; 99};
94 100
101static void drm_encoder_clear(struct drm_encoder *encoder)
102{
103 memset(encoder, 0, sizeof(*encoder));
104}
105
95static void tegra_encoder_destroy(struct drm_encoder *encoder) 106static void tegra_encoder_destroy(struct drm_encoder *encoder)
96{ 107{
97 drm_encoder_cleanup(encoder); 108 drm_encoder_cleanup(encoder);
109 drm_encoder_clear(encoder);
98} 110}
99 111
100static const struct drm_encoder_funcs encoder_funcs = { 112static const struct drm_encoder_funcs encoder_funcs = {