blob: f17a72a4023e2e0546cb70f582e8c63d1c79f2a4 [file] [log] [blame]
Thomas Gleixnercaab2772019-06-03 07:44:50 +02001// SPDX-License-Identifier: GPL-2.0-only
Rob Clarkcd5351f2011-11-12 12:09:40 -06002/*
Alexander A. Klimov1b409fd2020-07-13 14:28:59 +02003 * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
Rob Clarkcd5351f2011-11-12 12:09:40 -06004 * Author: Rob Clark <rob@ti.com>
Rob Clarkcd5351f2011-11-12 12:09:40 -06005 */
6
Sam Ravnborg81f61562019-07-16 08:42:10 +02007#include <linux/dma-mapping.h>
8#include <linux/platform_device.h>
Peter Ujfalusieb5bc1f2018-02-12 11:44:39 +02009#include <linux/sort.h>
Laurent Pinchart6e471fa2017-05-06 02:57:12 +030010#include <linux/sys_soc.h>
11
Laurent Pinchart748471a52015-03-05 23:42:39 +020012#include <drm/drm_atomic.h>
Laurent Pinchartcef77d42015-03-05 21:50:00 +020013#include <drm/drm_atomic_helper.h>
Boris Brezillonee68c742019-08-26 17:26:29 +020014#include <drm/drm_bridge.h>
Laurent Pinchartf40f4e42020-02-26 13:24:58 +020015#include <drm/drm_bridge_connector.h>
Sam Ravnborg81f61562019-07-16 08:42:10 +020016#include <drm/drm_drv.h>
Laurent Pinchart2d278f52015-03-05 21:31:37 +020017#include <drm/drm_fb_helper.h>
Sam Ravnborg81f61562019-07-16 08:42:10 +020018#include <drm/drm_file.h>
19#include <drm/drm_ioctl.h>
Laurent Pinchartf40f4e42020-02-26 13:24:58 +020020#include <drm/drm_panel.h>
Sam Ravnborg81f61562019-07-16 08:42:10 +020021#include <drm/drm_prime.h>
22#include <drm/drm_probe_helper.h>
23#include <drm/drm_vblank.h>
Rob Clarkcd5351f2011-11-12 12:09:40 -060024
Andy Gross5c137792012-03-05 10:48:39 -060025#include "omap_dmm_tiler.h"
Laurent Pinchart2d278f52015-03-05 21:31:37 +020026#include "omap_drv.h"
Rob Clarkcd5351f2011-11-12 12:09:40 -060027
28#define DRIVER_NAME MODULE_NAME
29#define DRIVER_DESC "OMAP DRM"
30#define DRIVER_DATE "20110917"
31#define DRIVER_MAJOR 1
32#define DRIVER_MINOR 0
33#define DRIVER_PATCHLEVEL 0
34
Rob Clarkcd5351f2011-11-12 12:09:40 -060035/*
36 * mode config funcs
37 */
38
39/* Notes about mapping DSS and DRM entities:
40 * CRTC: overlay
41 * encoder: manager.. with some extension to allow one primary CRTC
42 * and zero or more video CRTC's to be mapped to one encoder?
43 * connector: dssdev.. manager can be attached/detached from different
44 * devices
45 */
46
Tomi Valkeinen5f741b32015-05-29 16:01:18 +030047static void omap_atomic_wait_for_completion(struct drm_device *dev,
48 struct drm_atomic_state *old_state)
49{
Maarten Lankhorst34d88232017-07-19 16:39:17 +020050 struct drm_crtc_state *new_crtc_state;
Tomi Valkeinen5f741b32015-05-29 16:01:18 +030051 struct drm_crtc *crtc;
52 unsigned int i;
53 int ret;
54
Maarten Lankhorst34d88232017-07-19 16:39:17 +020055 for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) {
56 if (!new_crtc_state->active)
Tomi Valkeinen5f741b32015-05-29 16:01:18 +030057 continue;
58
59 ret = omap_crtc_wait_pending(crtc);
60
61 if (!ret)
62 dev_warn(dev->dev,
63 "atomic complete timeout (pipe %u)!\n", i);
64 }
65}
66
Laurent Pincharta9e6f9f2017-05-09 01:27:10 +030067static void omap_atomic_commit_tail(struct drm_atomic_state *old_state)
Laurent Pinchart748471a52015-03-05 23:42:39 +020068{
Laurent Pincharta9e6f9f2017-05-09 01:27:10 +030069 struct drm_device *dev = old_state->dev;
Laurent Pinchart748471a52015-03-05 23:42:39 +020070 struct omap_drm_private *priv = dev->dev_private;
Daniel Vetter250aa222021-01-21 16:29:56 +010071 bool fence_cookie = dma_fence_begin_signalling();
Laurent Pinchart748471a52015-03-05 23:42:39 +020072
Tomi Valkeinendac62bc2020-12-15 12:46:26 +020073 dispc_runtime_get(priv->dispc);
Laurent Pinchart69fb7c82015-05-28 02:09:56 +030074
Laurent Pincharta9e6f9f2017-05-09 01:27:10 +030075 /* Apply the atomic update. */
Laurent Pinchart748471a52015-03-05 23:42:39 +020076 drm_atomic_helper_commit_modeset_disables(dev, old_state);
Jyri Sarha897145d2017-01-27 12:04:55 +020077
Tomi Valkeinenfc5cc9672017-08-23 12:19:02 +030078 if (priv->omaprev != 0x3430) {
79 /* With the current dss dispc implementation we have to enable
80 * the new modeset before we can commit planes. The dispc ovl
81 * configuration relies on the video mode configuration been
82 * written into the HW when the ovl configuration is
83 * calculated.
84 *
85 * This approach is not ideal because after a mode change the
86 * plane update is executed only after the first vblank
87 * interrupt. The dispc implementation should be fixed so that
88 * it is able use uncommitted drm state information.
89 */
90 drm_atomic_helper_commit_modeset_enables(dev, old_state);
91 omap_atomic_wait_for_completion(dev, old_state);
Jyri Sarha897145d2017-01-27 12:04:55 +020092
Tomi Valkeinenfc5cc9672017-08-23 12:19:02 +030093 drm_atomic_helper_commit_planes(dev, old_state, 0);
Tomi Valkeinenfc5cc9672017-08-23 12:19:02 +030094 } else {
95 /*
96 * OMAP3 DSS seems to have issues with the work-around above,
97 * resulting in endless sync losts if a crtc is enabled without
98 * a plane. For now, skip the WA for OMAP3.
99 */
100 drm_atomic_helper_commit_planes(dev, old_state, 0);
101
102 drm_atomic_helper_commit_modeset_enables(dev, old_state);
Tomi Valkeinenfc5cc9672017-08-23 12:19:02 +0300103 }
Laurent Pincharta9e6f9f2017-05-09 01:27:10 +0300104
Daniel Vetter250aa222021-01-21 16:29:56 +0100105 drm_atomic_helper_commit_hw_done(old_state);
106
107 dma_fence_end_signalling(fence_cookie);
108
Laurent Pincharta9e6f9f2017-05-09 01:27:10 +0300109 /*
110 * Wait for completion of the page flips to ensure that old buffers
111 * can't be touched by the hardware anymore before cleaning up planes.
112 */
Tomi Valkeinen5f741b32015-05-29 16:01:18 +0300113 omap_atomic_wait_for_completion(dev, old_state);
Laurent Pinchart748471a52015-03-05 23:42:39 +0200114
115 drm_atomic_helper_cleanup_planes(dev, old_state);
116
Tomi Valkeinendac62bc2020-12-15 12:46:26 +0200117 dispc_runtime_put(priv->dispc);
Laurent Pinchart748471a52015-03-05 23:42:39 +0200118}
119
Laurent Pincharta9e6f9f2017-05-09 01:27:10 +0300120static const struct drm_mode_config_helper_funcs omap_mode_config_helper_funcs = {
121 .atomic_commit_tail = omap_atomic_commit_tail,
122};
Laurent Pinchart748471a52015-03-05 23:42:39 +0200123
Laurent Pincharte6ecefa2012-05-17 13:27:23 +0200124static const struct drm_mode_config_funcs omap_mode_config_funcs = {
Rob Clarkcd5351f2011-11-12 12:09:40 -0600125 .fb_create = omap_framebuffer_create,
Noralf Trønnesef62d302017-12-05 19:25:01 +0100126 .output_poll_changed = drm_fb_helper_output_poll_changed,
Laurent Pinchartcef77d42015-03-05 21:50:00 +0200127 .atomic_check = drm_atomic_helper_check,
Laurent Pincharta9e6f9f2017-05-09 01:27:10 +0300128 .atomic_commit = drm_atomic_helper_commit,
Rob Clarkcd5351f2011-11-12 12:09:40 -0600129};
130
Laurent Pinchart2ee76792018-03-05 15:02:22 +0200131static void omap_disconnect_pipelines(struct drm_device *ddev)
Archit Tanejacc823bd2014-01-02 14:49:52 +0530132{
Peter Ujfalusi52b9ef22018-02-12 11:44:37 +0200133 struct omap_drm_private *priv = ddev->dev_private;
134 unsigned int i;
Archit Tanejacc823bd2014-01-02 14:49:52 +0530135
Laurent Pinchart2ee76792018-03-05 15:02:22 +0200136 for (i = 0; i < priv->num_pipes; i++) {
Laurent Pinchart511afb42018-03-04 23:42:36 +0200137 struct omap_drm_pipeline *pipe = &priv->pipes[i];
Peter Ujfalusi52b9ef22018-02-12 11:44:37 +0200138
Laurent Pinchart511afb42018-03-04 23:42:36 +0200139 omapdss_device_disconnect(NULL, pipe->output);
140
141 omapdss_device_put(pipe->output);
Laurent Pinchart511afb42018-03-04 23:42:36 +0200142 pipe->output = NULL;
Peter Ujfalusi52b9ef22018-02-12 11:44:37 +0200143 }
144
Laurent Pincharte48f9f12018-03-07 00:01:33 +0200145 memset(&priv->channels, 0, sizeof(priv->channels));
146
Laurent Pinchart2ee76792018-03-05 15:02:22 +0200147 priv->num_pipes = 0;
Archit Tanejacc823bd2014-01-02 14:49:52 +0530148}
Archit Taneja0d8f3712013-03-26 19:15:19 +0530149
Laurent Pinchart2ee76792018-03-05 15:02:22 +0200150static int omap_connect_pipelines(struct drm_device *ddev)
Archit Taneja3a01ab22014-01-02 14:49:51 +0530151{
Peter Ujfalusi52b9ef22018-02-12 11:44:37 +0200152 struct omap_drm_private *priv = ddev->dev_private;
Laurent Pinchart511afb42018-03-04 23:42:36 +0200153 struct omap_dss_device *output = NULL;
Peter Ujfalusi52b9ef22018-02-12 11:44:37 +0200154 int r;
Peter Ujfalusia09d2bc2016-05-03 22:08:01 +0300155
Laurent Pinchart511afb42018-03-04 23:42:36 +0200156 for_each_dss_output(output) {
157 r = omapdss_device_connect(priv->dss, NULL, output);
Archit Taneja3a01ab22014-01-02 14:49:51 +0530158 if (r == -EPROBE_DEFER) {
Laurent Pinchart511afb42018-03-04 23:42:36 +0200159 omapdss_device_put(output);
Laurent Pincharta4e26522018-09-23 14:13:15 +0300160 return r;
Archit Taneja3a01ab22014-01-02 14:49:51 +0530161 } else if (r) {
Laurent Pinchart511afb42018-03-04 23:42:36 +0200162 dev_warn(output->dev, "could not connect output %s\n",
163 output->name);
Peter Ujfalusi52b9ef22018-02-12 11:44:37 +0200164 } else {
Laurent Pinchart511afb42018-03-04 23:42:36 +0200165 struct omap_drm_pipeline *pipe;
166
167 pipe = &priv->pipes[priv->num_pipes++];
168 pipe->output = omapdss_device_get(output);
Laurent Pinchart511afb42018-03-04 23:42:36 +0200169
Laurent Pinchart2ee76792018-03-05 15:02:22 +0200170 if (priv->num_pipes == ARRAY_SIZE(priv->pipes)) {
Laurent Pinchart511afb42018-03-04 23:42:36 +0200171 /* To balance the 'for_each_dss_output' loop */
172 omapdss_device_put(output);
Peter Ujfalusi52b9ef22018-02-12 11:44:37 +0200173 break;
174 }
Archit Taneja3a01ab22014-01-02 14:49:51 +0530175 }
176 }
177
Archit Taneja3a01ab22014-01-02 14:49:51 +0530178 return 0;
Laurent Pincharta4e26522018-09-23 14:13:15 +0300179}
Archit Taneja3a01ab22014-01-02 14:49:51 +0530180
Laurent Pincharta4e26522018-09-23 14:13:15 +0300181static int omap_compare_pipelines(const void *a, const void *b)
182{
183 const struct omap_drm_pipeline *pipe1 = a;
184 const struct omap_drm_pipeline *pipe2 = b;
Archit Taneja3a01ab22014-01-02 14:49:51 +0530185
Laurent Pincharta4e26522018-09-23 14:13:15 +0300186 if (pipe1->alias_id > pipe2->alias_id)
187 return 1;
188 else if (pipe1->alias_id < pipe2->alias_id)
189 return -1;
190 return 0;
Archit Taneja3a01ab22014-01-02 14:49:51 +0530191}
Rob Clarkcd5351f2011-11-12 12:09:40 -0600192
Laurent Pincharte2cd09b2015-03-06 17:16:43 +0200193static int omap_modeset_init_properties(struct drm_device *dev)
194{
195 struct omap_drm_private *priv = dev->dev_private;
Tomi Valkeinendac62bc2020-12-15 12:46:26 +0200196 unsigned int num_planes = dispc_get_num_ovls(priv->dispc);
Laurent Pincharte2cd09b2015-03-06 17:16:43 +0200197
Laurent Pinchartdff6c242017-05-09 01:27:14 +0300198 priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0,
199 num_planes - 1);
Laurent Pincharte2cd09b2015-03-06 17:16:43 +0200200 if (!priv->zorder_prop)
201 return -ENOMEM;
202
203 return 0;
204}
205
Laurent Pinchart79107f22018-09-23 12:58:15 +0300206static int omap_display_id(struct omap_dss_device *output)
207{
208 struct device_node *node = NULL;
209
Sebastian Reichel4a555512020-12-15 12:46:16 +0200210 if (output->bridge) {
Laurent Pinchart79107f22018-09-23 12:58:15 +0300211 struct drm_bridge *bridge = output->bridge;
212
Boris Brezillonfadf8722019-12-03 15:15:06 +0100213 while (drm_bridge_get_next_bridge(bridge))
214 bridge = drm_bridge_get_next_bridge(bridge);
Laurent Pinchart79107f22018-09-23 12:58:15 +0300215
216 node = bridge->of_node;
217 }
218
219 return node ? of_alias_get_id(node, "display") : -ENODEV;
220}
221
Rob Clarkcd5351f2011-11-12 12:09:40 -0600222static int omap_modeset_init(struct drm_device *dev)
223{
Rob Clarkcd5351f2011-11-12 12:09:40 -0600224 struct omap_drm_private *priv = dev->dev_private;
Tomi Valkeinendac62bc2020-12-15 12:46:26 +0200225 int num_ovls = dispc_get_num_ovls(priv->dispc);
226 int num_mgrs = dispc_get_num_mgrs(priv->dispc);
Peter Ujfalusi52b9ef22018-02-12 11:44:37 +0200227 unsigned int i;
Laurent Pinchartfb9a35f2015-01-11 16:30:44 +0200228 int ret;
Jyri Sarhae8e13b12017-03-24 16:47:55 +0200229 u32 plane_crtc_mask;
Tomi Valkeinen04b1fc02013-05-14 10:55:19 +0300230
Laurent Pincharta4e26522018-09-23 14:13:15 +0300231 if (!omapdss_stack_is_ready())
232 return -EPROBE_DEFER;
233
Rob Clarkcd5351f2011-11-12 12:09:40 -0600234 drm_mode_config_init(dev);
235
Laurent Pincharte2cd09b2015-03-06 17:16:43 +0200236 ret = omap_modeset_init_properties(dev);
237 if (ret < 0)
238 return ret;
239
Rob Clarkf5f94542012-12-04 13:59:12 -0600240 /*
Jyri Sarhae8e13b12017-03-24 16:47:55 +0200241 * This function creates exactly one connector, encoder, crtc,
242 * and primary plane per each connected dss-device. Each
243 * connector->encoder->crtc chain is expected to be separate
244 * and each crtc is connect to a single dss-channel. If the
245 * configuration does not match the expectations or exceeds
246 * the available resources, the configuration is rejected.
Rob Clarkf5f94542012-12-04 13:59:12 -0600247 */
Laurent Pincharta4e26522018-09-23 14:13:15 +0300248 ret = omap_connect_pipelines(dev);
249 if (ret < 0)
250 return ret;
251
Laurent Pinchart2ee76792018-03-05 15:02:22 +0200252 if (priv->num_pipes > num_mgrs || priv->num_pipes > num_ovls) {
Jyri Sarhae8e13b12017-03-24 16:47:55 +0200253 dev_err(dev->dev, "%s(): Too many connected displays\n",
254 __func__);
255 return -EINVAL;
256 }
257
Laurent Pinchartac3b1312018-03-05 19:11:30 +0200258 /* Create all planes first. They can all be put to any CRTC. */
Laurent Pinchart2ee76792018-03-05 15:02:22 +0200259 plane_crtc_mask = (1 << priv->num_pipes) - 1;
Rob Clarkcd5351f2011-11-12 12:09:40 -0600260
Laurent Pinchartac3b1312018-03-05 19:11:30 +0200261 for (i = 0; i < num_ovls; i++) {
Laurent Pinchart2ee76792018-03-05 15:02:22 +0200262 enum drm_plane_type type = i < priv->num_pipes
Laurent Pinchartac3b1312018-03-05 19:11:30 +0200263 ? DRM_PLANE_TYPE_PRIMARY
264 : DRM_PLANE_TYPE_OVERLAY;
265 struct drm_plane *plane;
266
267 if (WARN_ON(priv->num_planes >= ARRAY_SIZE(priv->planes)))
268 return -EINVAL;
269
270 plane = omap_plane_init(dev, i, type, plane_crtc_mask);
271 if (IS_ERR(plane))
272 return PTR_ERR(plane);
273
274 priv->planes[priv->num_planes++] = plane;
275 }
276
Laurent Pinchart79107f22018-09-23 12:58:15 +0300277 /*
278 * Create the encoders, attach the bridges and get the pipeline alias
279 * IDs.
280 */
Laurent Pinchart2ee76792018-03-05 15:02:22 +0200281 for (i = 0; i < priv->num_pipes; i++) {
282 struct omap_drm_pipeline *pipe = &priv->pipes[i];
Laurent Pincharta4e26522018-09-23 14:13:15 +0300283 int id;
284
285 pipe->encoder = omap_encoder_init(dev, pipe->output);
286 if (!pipe->encoder)
287 return -ENOMEM;
288
Laurent Pinchart79107f22018-09-23 12:58:15 +0300289 if (pipe->output->bridge) {
290 ret = drm_bridge_attach(pipe->encoder,
Laurent Pinchartf40f4e42020-02-26 13:24:58 +0200291 pipe->output->bridge, NULL,
292 DRM_BRIDGE_ATTACH_NO_CONNECTOR);
Laurent Pinchartfb8d6172021-03-23 23:50:08 +0200293 if (ret < 0)
Laurent Pinchart79107f22018-09-23 12:58:15 +0300294 return ret;
295 }
296
297 id = omap_display_id(pipe->output);
Laurent Pincharta4e26522018-09-23 14:13:15 +0300298 pipe->alias_id = id >= 0 ? id : i;
299 }
300
301 /* Sort the pipelines by DT aliases. */
302 sort(priv->pipes, priv->num_pipes, sizeof(priv->pipes[0]),
303 omap_compare_pipelines, NULL);
304
305 /*
306 * Populate the pipeline lookup table by DISPC channel. Only one display
307 * is allowed per channel.
308 */
309 for (i = 0; i < priv->num_pipes; ++i) {
310 struct omap_drm_pipeline *pipe = &priv->pipes[i];
311 enum omap_channel channel = pipe->output->dispc_channel;
312
313 if (WARN_ON(priv->channels[channel] != NULL))
314 return -EINVAL;
315
316 priv->channels[channel] = pipe;
317 }
318
319 /* Create the connectors and CRTCs. */
320 for (i = 0; i < priv->num_pipes; i++) {
321 struct omap_drm_pipeline *pipe = &priv->pipes[i];
322 struct drm_encoder *encoder = pipe->encoder;
Jyri Sarhae8e13b12017-03-24 16:47:55 +0200323 struct drm_crtc *crtc;
Rob Clarkf5f94542012-12-04 13:59:12 -0600324
Sebastian Reichelfe5f6e52020-12-15 12:46:15 +0200325 pipe->connector = drm_bridge_connector_init(dev, encoder);
326 if (IS_ERR(pipe->connector)) {
327 dev_err(priv->dev,
328 "unable to create bridge connector for %s\n",
329 pipe->output->name);
330 return PTR_ERR(pipe->connector);
Laurent Pinchartf40f4e42020-02-26 13:24:58 +0200331 }
Rob Clarkf5f94542012-12-04 13:59:12 -0600332
Laurent Pinchartf40f4e42020-02-26 13:24:58 +0200333 drm_connector_attach_encoder(pipe->connector, encoder);
334
Laurent Pinchart00b30e72018-03-06 23:37:25 +0200335 crtc = omap_crtc_init(dev, pipe, priv->planes[i]);
Jyri Sarhae8e13b12017-03-24 16:47:55 +0200336 if (IS_ERR(crtc))
337 return PTR_ERR(crtc);
338
Laurent Pinchartf9699362018-03-05 14:47:47 +0200339 encoder->possible_crtcs = 1 << i;
Laurent Pinchart2ee76792018-03-05 15:02:22 +0200340 pipe->crtc = crtc;
Archit Taneja0d8f3712013-03-26 19:15:19 +0530341 }
342
Laurent Pinchart2ee76792018-03-05 15:02:22 +0200343 DBG("registered %u planes, %u crtcs/encoders/connectors\n",
344 priv->num_planes, priv->num_pipes);
Archit Taneja0d8f3712013-03-26 19:15:19 +0530345
Tomi Valkeinen1e907112016-08-23 12:35:39 +0300346 dev->mode_config.min_width = 8;
347 dev->mode_config.min_height = 2;
Rob Clarkcd5351f2011-11-12 12:09:40 -0600348
Tomi Valkeinen1915d7f2018-01-10 11:31:18 +0200349 /*
350 * Note: these values are used for multiple independent things:
351 * connector mode filtering, buffer sizes, crtc sizes...
352 * Use big enough values here to cover all use cases, and do more
353 * specific checking in the respective code paths.
Rob Clarkcd5351f2011-11-12 12:09:40 -0600354 */
Tomi Valkeinen1915d7f2018-01-10 11:31:18 +0200355 dev->mode_config.max_width = 8192;
356 dev->mode_config.max_height = 8192;
Rob Clarkcd5351f2011-11-12 12:09:40 -0600357
Peter Ujfalusi23936ba2018-03-21 12:20:29 +0200358 /* We want the zpos to be normalized */
359 dev->mode_config.normalize_zpos = true;
360
Rob Clarkcd5351f2011-11-12 12:09:40 -0600361 dev->mode_config.funcs = &omap_mode_config_funcs;
Laurent Pincharta9e6f9f2017-05-09 01:27:10 +0300362 dev->mode_config.helper_private = &omap_mode_config_helper_funcs;
Rob Clarkcd5351f2011-11-12 12:09:40 -0600363
Laurent Pinchart69a12262015-03-05 21:38:16 +0200364 drm_mode_config_reset(dev);
365
Laurent Pinchart728ae8d2015-05-28 00:21:29 +0300366 omap_drm_irq_install(dev);
367
Rob Clarkcd5351f2011-11-12 12:09:40 -0600368 return 0;
369}
370
Laurent Pinchartf40f4e42020-02-26 13:24:58 +0200371static void omap_modeset_fini(struct drm_device *ddev)
372{
Laurent Pinchartf40f4e42020-02-26 13:24:58 +0200373 omap_drm_irq_uninstall(ddev);
374
Laurent Pinchartf40f4e42020-02-26 13:24:58 +0200375 drm_mode_config_cleanup(ddev);
376}
377
Rob Clarkcd5351f2011-11-12 12:09:40 -0600378/*
Peter Ujfalusi3c596802017-06-02 15:26:35 +0300379 * Enable the HPD in external components if supported
380 */
Peter Ujfalusi52b9ef22018-02-12 11:44:37 +0200381static void omap_modeset_enable_external_hpd(struct drm_device *ddev)
Peter Ujfalusi3c596802017-06-02 15:26:35 +0300382{
Peter Ujfalusi52b9ef22018-02-12 11:44:37 +0200383 struct omap_drm_private *priv = ddev->dev_private;
Laurent Pinchart79107f22018-09-23 12:58:15 +0300384 unsigned int i;
Peter Ujfalusi3c596802017-06-02 15:26:35 +0300385
Laurent Pinchart79107f22018-09-23 12:58:15 +0300386 for (i = 0; i < priv->num_pipes; i++) {
Laurent Pinchartf40f4e42020-02-26 13:24:58 +0200387 struct drm_connector *connector = priv->pipes[i].connector;
388
389 if (!connector)
390 continue;
391
Laurent Pinchart75fb9682020-02-26 13:25:00 +0200392 if (priv->pipes[i].output->bridge)
Laurent Pinchartf40f4e42020-02-26 13:24:58 +0200393 drm_bridge_connector_enable_hpd(connector);
Laurent Pinchart79107f22018-09-23 12:58:15 +0300394 }
Peter Ujfalusi3c596802017-06-02 15:26:35 +0300395}
396
397/*
398 * Disable the HPD in external components if supported
399 */
Peter Ujfalusi52b9ef22018-02-12 11:44:37 +0200400static void omap_modeset_disable_external_hpd(struct drm_device *ddev)
Peter Ujfalusi3c596802017-06-02 15:26:35 +0300401{
Peter Ujfalusi52b9ef22018-02-12 11:44:37 +0200402 struct omap_drm_private *priv = ddev->dev_private;
Laurent Pinchart79107f22018-09-23 12:58:15 +0300403 unsigned int i;
Peter Ujfalusi3c596802017-06-02 15:26:35 +0300404
Laurent Pinchart79107f22018-09-23 12:58:15 +0300405 for (i = 0; i < priv->num_pipes; i++) {
Laurent Pinchartf40f4e42020-02-26 13:24:58 +0200406 struct drm_connector *connector = priv->pipes[i].connector;
407
408 if (!connector)
409 continue;
410
Laurent Pinchart75fb9682020-02-26 13:25:00 +0200411 if (priv->pipes[i].output->bridge)
Laurent Pinchartf40f4e42020-02-26 13:24:58 +0200412 drm_bridge_connector_disable_hpd(connector);
Laurent Pinchart79107f22018-09-23 12:58:15 +0300413 }
Peter Ujfalusi3c596802017-06-02 15:26:35 +0300414}
415
416/*
Rob Clarkcd5351f2011-11-12 12:09:40 -0600417 * drm ioctl funcs
418 */
419
420
421static int ioctl_get_param(struct drm_device *dev, void *data,
422 struct drm_file *file_priv)
423{
Rob Clark5e3b0872012-10-29 09:31:12 +0100424 struct omap_drm_private *priv = dev->dev_private;
Rob Clarkcd5351f2011-11-12 12:09:40 -0600425 struct drm_omap_param *args = data;
426
427 DBG("%p: param=%llu", dev, args->param);
428
429 switch (args->param) {
430 case OMAP_PARAM_CHIPSET_ID:
Rob Clark5e3b0872012-10-29 09:31:12 +0100431 args->value = priv->omaprev;
Rob Clarkcd5351f2011-11-12 12:09:40 -0600432 break;
433 default:
434 DBG("unknown parameter %lld", args->param);
435 return -EINVAL;
436 }
437
438 return 0;
439}
440
Laurent Pinchartef3f4e92015-12-14 22:39:36 +0200441#define OMAP_BO_USER_MASK 0x00ffffff /* flags settable by userspace */
442
Rob Clarkcd5351f2011-11-12 12:09:40 -0600443static int ioctl_gem_new(struct drm_device *dev, void *data,
444 struct drm_file *file_priv)
445{
446 struct drm_omap_gem_new *args = data;
Laurent Pinchartef3f4e92015-12-14 22:39:36 +0200447 u32 flags = args->flags & OMAP_BO_USER_MASK;
448
Rob Clarkf5f94542012-12-04 13:59:12 -0600449 VERB("%p:%p: size=0x%08x, flags=%08x", dev, file_priv,
Laurent Pinchartef3f4e92015-12-14 22:39:36 +0200450 args->size.bytes, flags);
451
452 return omap_gem_new_handle(dev, file_priv, args->size, flags,
453 &args->handle);
Rob Clarkcd5351f2011-11-12 12:09:40 -0600454}
455
Rob Clarkcd5351f2011-11-12 12:09:40 -0600456static int ioctl_gem_info(struct drm_device *dev, void *data,
457 struct drm_file *file_priv)
458{
459 struct drm_omap_gem_info *args = data;
460 struct drm_gem_object *obj;
461 int ret = 0;
462
Rob Clarkf5f94542012-12-04 13:59:12 -0600463 VERB("%p:%p: handle=%d", dev, file_priv, args->handle);
Rob Clarkcd5351f2011-11-12 12:09:40 -0600464
Chris Wilsona8ad0bd2016-05-09 11:04:54 +0100465 obj = drm_gem_object_lookup(file_priv, args->handle);
YAMANE Toshiakic7f904b2012-11-14 19:30:38 +0900466 if (!obj)
Rob Clarkcd5351f2011-11-12 12:09:40 -0600467 return -ENOENT;
Rob Clarkcd5351f2011-11-12 12:09:40 -0600468
Rob Clarkf7f9f452011-12-05 19:19:22 -0600469 args->size = omap_gem_mmap_size(obj);
Rob Clarkcd5351f2011-11-12 12:09:40 -0600470 args->offset = omap_gem_mmap_offset(obj);
471
Emil Velikovd742cdd2020-05-15 10:51:06 +0100472 drm_gem_object_put(obj);
Rob Clarkcd5351f2011-11-12 12:09:40 -0600473
474 return ret;
475}
476
Rob Clarkbaa70942013-08-02 13:27:49 -0400477static const struct drm_ioctl_desc ioctls[DRM_COMMAND_END - DRM_COMMAND_BASE] = {
Hemant Hariyani5f6ab8c2016-06-07 13:23:19 -0500478 DRM_IOCTL_DEF_DRV(OMAP_GET_PARAM, ioctl_get_param,
Emil Velikov7042a332019-05-27 09:17:37 +0100479 DRM_RENDER_ALLOW),
Emil Velikov9a671c22019-05-22 16:02:18 +0100480 DRM_IOCTL_DEF_DRV(OMAP_SET_PARAM, drm_invalid_op,
Hemant Hariyani5f6ab8c2016-06-07 13:23:19 -0500481 DRM_AUTH | DRM_MASTER | DRM_ROOT_ONLY),
482 DRM_IOCTL_DEF_DRV(OMAP_GEM_NEW, ioctl_gem_new,
Emil Velikov7042a332019-05-27 09:17:37 +0100483 DRM_RENDER_ALLOW),
Laurent Pinchartd6f544f2017-05-09 01:27:11 +0300484 /* Deprecated, to be removed. */
485 DRM_IOCTL_DEF_DRV(OMAP_GEM_CPU_PREP, drm_noop,
Emil Velikov7042a332019-05-27 09:17:37 +0100486 DRM_RENDER_ALLOW),
Laurent Pinchartd6f544f2017-05-09 01:27:11 +0300487 /* Deprecated, to be removed. */
488 DRM_IOCTL_DEF_DRV(OMAP_GEM_CPU_FINI, drm_noop,
Emil Velikov7042a332019-05-27 09:17:37 +0100489 DRM_RENDER_ALLOW),
Hemant Hariyani5f6ab8c2016-06-07 13:23:19 -0500490 DRM_IOCTL_DEF_DRV(OMAP_GEM_INFO, ioctl_gem_info,
Emil Velikov7042a332019-05-27 09:17:37 +0100491 DRM_RENDER_ALLOW),
Rob Clarkcd5351f2011-11-12 12:09:40 -0600492};
493
494/*
495 * drm driver funcs
496 */
497
Rob Clarkcd5351f2011-11-12 12:09:40 -0600498static int dev_open(struct drm_device *dev, struct drm_file *file)
499{
500 file->driver_priv = NULL;
501
502 DBG("open: dev=%p, file=%p", dev, file);
503
504 return 0;
505}
506
Rob Clarkff4f3872012-01-16 12:51:14 -0600507static const struct file_operations omapdriver_fops = {
Laurent Pinchart222025e2015-01-11 00:02:07 +0200508 .owner = THIS_MODULE,
509 .open = drm_open,
510 .unlocked_ioctl = drm_ioctl,
Tomi Valkeinen9d24159a2017-02-24 13:24:50 +0200511 .compat_ioctl = drm_compat_ioctl,
Laurent Pinchart222025e2015-01-11 00:02:07 +0200512 .release = drm_release,
513 .mmap = omap_gem_mmap,
514 .poll = drm_poll,
515 .read = drm_read,
516 .llseek = noop_llseek,
Rob Clarkff4f3872012-01-16 12:51:14 -0600517};
518
Daniel Vetter70a59dd2020-11-04 11:04:24 +0100519static const struct drm_driver omap_drm_driver = {
Daniel Vetter0424fda2019-06-17 17:39:24 +0200520 .driver_features = DRIVER_MODESET | DRIVER_GEM |
Hemant Hariyani5f6ab8c2016-06-07 13:23:19 -0500521 DRIVER_ATOMIC | DRIVER_RENDER,
Laurent Pinchart222025e2015-01-11 00:02:07 +0200522 .open = dev_open,
Noralf Trønnesef62d302017-12-05 19:25:01 +0100523 .lastclose = drm_fb_helper_lastclose,
Andy Gross6169a1482011-12-15 21:05:17 -0600524#ifdef CONFIG_DEBUG_FS
Laurent Pinchart222025e2015-01-11 00:02:07 +0200525 .debugfs_init = omap_debugfs_init,
Andy Gross6169a1482011-12-15 21:05:17 -0600526#endif
Laurent Pinchart222025e2015-01-11 00:02:07 +0200527 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
528 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
Laurent Pinchart222025e2015-01-11 00:02:07 +0200529 .gem_prime_import = omap_gem_prime_import,
Laurent Pinchart222025e2015-01-11 00:02:07 +0200530 .dumb_create = omap_gem_dumb_create,
531 .dumb_map_offset = omap_gem_dumb_map_offset,
Laurent Pinchart222025e2015-01-11 00:02:07 +0200532 .ioctls = ioctls,
533 .num_ioctls = DRM_OMAP_NUM_IOCTLS,
534 .fops = &omapdriver_fops,
535 .name = DRIVER_NAME,
536 .desc = DRIVER_DESC,
537 .date = DRIVER_DATE,
538 .major = DRIVER_MAJOR,
539 .minor = DRIVER_MINOR,
540 .patchlevel = DRIVER_PATCHLEVEL,
Rob Clarkcd5351f2011-11-12 12:09:40 -0600541};
542
Laurent Pinchart6e471fa2017-05-06 02:57:12 +0300543static const struct soc_device_attribute omapdrm_soc_devices[] = {
544 { .family = "OMAP3", .data = (void *)0x3430 },
545 { .family = "OMAP4", .data = (void *)0x4430 },
546 { .family = "OMAP5", .data = (void *)0x5430 },
547 { .family = "DRA7", .data = (void *)0x0752 },
548 { /* sentinel */ }
549};
550
Laurent Pincharta82f03472018-02-13 14:00:19 +0200551static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
Rob Clarkcd5351f2011-11-12 12:09:40 -0600552{
Laurent Pinchart6e471fa2017-05-06 02:57:12 +0300553 const struct soc_device_attribute *soc;
Sebastian Reichel85101482020-12-15 12:46:11 +0200554 struct dss_pdata *pdata = dev->platform_data;
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200555 struct drm_device *ddev;
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200556 int ret;
557
Laurent Pincharta82f03472018-02-13 14:00:19 +0200558 DBG("%s", dev_name(dev));
Archit Taneja3a01ab22014-01-02 14:49:51 +0530559
Peter Ujfalusifb96b672018-02-12 11:44:36 +0200560 /* Allocate and initialize the DRM device. */
561 ddev = drm_dev_alloc(&omap_drm_driver, dev);
562 if (IS_ERR(ddev))
563 return PTR_ERR(ddev);
564
565 priv->ddev = ddev;
566 ddev->dev_private = priv;
567
Laurent Pincharta82f03472018-02-13 14:00:19 +0200568 priv->dev = dev;
Sebastian Reichel85101482020-12-15 12:46:11 +0200569 priv->dss = pdata->dss;
Laurent Pinchart50638ae2018-02-13 14:00:42 +0200570 priv->dispc = dispc_get_dispc(priv->dss);
Laurent Pinchart510c74c2017-08-11 16:49:08 +0300571
Tomi Valkeinen05ec6122020-12-15 12:46:27 +0200572 priv->dss->mgr_ops_priv = priv;
Archit Taneja3a01ab22014-01-02 14:49:51 +0530573
Laurent Pinchart6e471fa2017-05-06 02:57:12 +0300574 soc = soc_device_match(omapdrm_soc_devices);
Laurent Pinchart95f227832021-07-28 18:19:34 +0300575 priv->omaprev = soc ? (uintptr_t)soc->data : 0;
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200576 priv->wq = alloc_ordered_workqueue("omapdrm", 0);
577
Daniel Vetter5117bd82018-05-25 19:39:24 +0300578 mutex_init(&priv->list_lock);
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200579 INIT_LIST_HEAD(&priv->obj_list);
580
Peter Ujfalusia7631c42017-11-30 14:12:37 +0200581 /* Get memory bandwidth limits */
Tomi Valkeinendac62bc2020-12-15 12:46:26 +0200582 priv->max_bandwidth = dispc_get_memory_bandwidth_limit(priv->dispc);
Peter Ujfalusia7631c42017-11-30 14:12:37 +0200583
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200584 omap_gem_init(ddev);
585
Benoit Parrotc8fa1e72021-11-17 15:19:23 +0100586 ret = omap_hwoverlays_init(priv);
587 if (ret)
588 goto err_gem_deinit;
589
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200590 ret = omap_modeset_init(ddev);
591 if (ret) {
Laurent Pincharta82f03472018-02-13 14:00:19 +0200592 dev_err(priv->dev, "omap_modeset_init failed: ret=%d\n", ret);
Benoit Parrotc8fa1e72021-11-17 15:19:23 +0100593 goto err_free_overlays;
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200594 }
595
596 /* Initialize vblank handling, start with all CRTCs disabled. */
Laurent Pinchart2ee76792018-03-05 15:02:22 +0200597 ret = drm_vblank_init(ddev, priv->num_pipes);
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200598 if (ret) {
Laurent Pincharta82f03472018-02-13 14:00:19 +0200599 dev_err(priv->dev, "could not init vblank\n");
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200600 goto err_cleanup_modeset;
601 }
602
Tomi Valkeinenefd1f062018-02-09 09:36:23 +0200603 omap_fbdev_init(ddev);
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200604
605 drm_kms_helper_poll_init(ddev);
Peter Ujfalusi52b9ef22018-02-12 11:44:37 +0200606 omap_modeset_enable_external_hpd(ddev);
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200607
608 /*
609 * Register the DRM device with the core and the connectors with
610 * sysfs.
611 */
612 ret = drm_dev_register(ddev, 0);
613 if (ret)
614 goto err_cleanup_helpers;
615
616 return 0;
617
618err_cleanup_helpers:
Peter Ujfalusi52b9ef22018-02-12 11:44:37 +0200619 omap_modeset_disable_external_hpd(ddev);
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200620 drm_kms_helper_poll_fini(ddev);
Tomi Valkeinenefd1f062018-02-09 09:36:23 +0200621
622 omap_fbdev_fini(ddev);
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200623err_cleanup_modeset:
Laurent Pinchartf40f4e42020-02-26 13:24:58 +0200624 omap_modeset_fini(ddev);
Benoit Parrotc8fa1e72021-11-17 15:19:23 +0100625err_free_overlays:
626 omap_hwoverlays_destroy(priv);
Peter Ujfalusifb96b672018-02-12 11:44:36 +0200627err_gem_deinit:
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200628 omap_gem_deinit(ddev);
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200629 destroy_workqueue(priv->wq);
Laurent Pinchart2ee76792018-03-05 15:02:22 +0200630 omap_disconnect_pipelines(ddev);
Thomas Zimmermann08bafff2018-06-18 15:07:27 +0200631 drm_dev_put(ddev);
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200632 return ret;
Rob Clarkcd5351f2011-11-12 12:09:40 -0600633}
634
Laurent Pincharta82f03472018-02-13 14:00:19 +0200635static void omapdrm_cleanup(struct omap_drm_private *priv)
Rob Clarkcd5351f2011-11-12 12:09:40 -0600636{
Laurent Pincharta82f03472018-02-13 14:00:19 +0200637 struct drm_device *ddev = priv->ddev;
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200638
Rob Clarkcd5351f2011-11-12 12:09:40 -0600639 DBG("");
Andy Gross5c137792012-03-05 10:48:39 -0600640
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200641 drm_dev_unregister(ddev);
642
Peter Ujfalusi52b9ef22018-02-12 11:44:37 +0200643 omap_modeset_disable_external_hpd(ddev);
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200644 drm_kms_helper_poll_fini(ddev);
645
Tomi Valkeinenefd1f062018-02-09 09:36:23 +0200646 omap_fbdev_fini(ddev);
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200647
Tomi Valkeinen8a54aa92017-03-27 10:02:22 +0300648 drm_atomic_helper_shutdown(ddev);
649
Laurent Pinchartf40f4e42020-02-26 13:24:58 +0200650 omap_modeset_fini(ddev);
Benoit Parrotc8fa1e72021-11-17 15:19:23 +0100651 omap_hwoverlays_destroy(priv);
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200652 omap_gem_deinit(ddev);
653
Laurent Pinchart2f95bc62016-12-12 11:28:47 +0200654 destroy_workqueue(priv->wq);
Tomi Valkeinen707cf582014-04-02 13:47:43 +0300655
Laurent Pinchart2ee76792018-03-05 15:02:22 +0200656 omap_disconnect_pipelines(ddev);
Peter Ujfalusifb96b672018-02-12 11:44:36 +0200657
Thomas Zimmermann08bafff2018-06-18 15:07:27 +0200658 drm_dev_put(ddev);
Laurent Pincharta82f03472018-02-13 14:00:19 +0200659}
660
661static int pdev_probe(struct platform_device *pdev)
662{
663 struct omap_drm_private *priv;
664 int ret;
665
Tomi Valkeinen63daf4e2019-08-09 13:00:38 +0300666 ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
Laurent Pincharta82f03472018-02-13 14:00:19 +0200667 if (ret) {
668 dev_err(&pdev->dev, "Failed to set the DMA mask\n");
669 return ret;
670 }
671
672 /* Allocate and initialize the driver private structure. */
673 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
674 if (!priv)
675 return -ENOMEM;
676
677 platform_set_drvdata(pdev, priv);
678
679 ret = omapdrm_init(priv, &pdev->dev);
680 if (ret < 0)
681 kfree(priv);
682
683 return ret;
684}
685
686static int pdev_remove(struct platform_device *pdev)
687{
688 struct omap_drm_private *priv = platform_get_drvdata(pdev);
689
690 omapdrm_cleanup(priv);
691 kfree(priv);
Daniel Vetterfd3c0252013-12-11 11:34:26 +0100692
Rob Clarkcd5351f2011-11-12 12:09:40 -0600693 return 0;
694}
695
Grygorii Strashko8450c8d2015-02-26 15:57:17 +0200696#ifdef CONFIG_PM_SLEEP
Tomi Valkeinenccd7b5e2014-11-14 15:18:28 +0200697static int omap_drm_suspend(struct device *dev)
698{
Laurent Pincharta82f03472018-02-13 14:00:19 +0200699 struct omap_drm_private *priv = dev_get_drvdata(dev);
700 struct drm_device *drm_dev = priv->ddev;
Tomi Valkeinenccd7b5e2014-11-14 15:18:28 +0200701
Laurent Pinchartd2c53162018-09-04 17:08:33 +0300702 return drm_mode_config_helper_suspend(drm_dev);
Tomi Valkeinenccd7b5e2014-11-14 15:18:28 +0200703}
704
705static int omap_drm_resume(struct device *dev)
706{
Laurent Pincharta82f03472018-02-13 14:00:19 +0200707 struct omap_drm_private *priv = dev_get_drvdata(dev);
708 struct drm_device *drm_dev = priv->ddev;
Tomi Valkeinenccd7b5e2014-11-14 15:18:28 +0200709
Laurent Pinchartd2c53162018-09-04 17:08:33 +0300710 drm_mode_config_helper_resume(drm_dev);
Tomi Valkeinenccd7b5e2014-11-14 15:18:28 +0200711
Laurent Pinchart7fb15c42017-10-13 17:58:58 +0300712 return omap_gem_resume(drm_dev);
Tomi Valkeinenccd7b5e2014-11-14 15:18:28 +0200713}
Andy Grosse78edba2012-12-19 14:53:37 -0600714#endif
715
Grygorii Strashko8450c8d2015-02-26 15:57:17 +0200716static SIMPLE_DEV_PM_OPS(omapdrm_pm_ops, omap_drm_suspend, omap_drm_resume);
717
Tomi Valkeinen6717cd22013-04-10 10:44:00 +0300718static struct platform_driver pdev = {
Laurent Pinchart222025e2015-01-11 00:02:07 +0200719 .driver = {
Tomi Valkeinenf64eafa2017-08-16 12:43:55 +0300720 .name = "omapdrm",
Laurent Pinchart222025e2015-01-11 00:02:07 +0200721 .pm = &omapdrm_pm_ops,
Laurent Pinchart222025e2015-01-11 00:02:07 +0200722 },
723 .probe = pdev_probe,
724 .remove = pdev_remove,
Rob Clarkcd5351f2011-11-12 12:09:40 -0600725};
726
Thierry Redinge1c49bd2015-12-02 17:23:31 +0100727static struct platform_driver * const drivers[] = {
728 &omap_dmm_driver,
729 &pdev,
730};
731
Rob Clarkcd5351f2011-11-12 12:09:40 -0600732static int __init omap_drm_init(void)
733{
Tomi Valkeinen55b68fb2020-12-15 12:46:23 +0200734 int r;
735
Rob Clarkcd5351f2011-11-12 12:09:40 -0600736 DBG("init");
Tomi Valkeinenea7e3a62014-04-02 14:31:50 +0300737
Tomi Valkeinen55b68fb2020-12-15 12:46:23 +0200738 r = omap_dss_init();
739 if (r)
740 return r;
741
742 r = platform_register_drivers(drivers, ARRAY_SIZE(drivers));
743 if (r) {
744 omap_dss_exit();
745 return r;
746 }
747
748 return 0;
Rob Clarkcd5351f2011-11-12 12:09:40 -0600749}
750
751static void __exit omap_drm_fini(void)
752{
753 DBG("fini");
Tomi Valkeinenea7e3a62014-04-02 14:31:50 +0300754
Thierry Redinge1c49bd2015-12-02 17:23:31 +0100755 platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
Tomi Valkeinen55b68fb2020-12-15 12:46:23 +0200756
757 omap_dss_exit();
Rob Clarkcd5351f2011-11-12 12:09:40 -0600758}
759
Tomi Valkeinen55b68fb2020-12-15 12:46:23 +0200760module_init(omap_drm_init);
Rob Clarkcd5351f2011-11-12 12:09:40 -0600761module_exit(omap_drm_fini);
762
763MODULE_AUTHOR("Rob Clark <rob@ti.com>");
Tomi Valkeinen55b68fb2020-12-15 12:46:23 +0200764MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
Rob Clarkcd5351f2011-11-12 12:09:40 -0600765MODULE_DESCRIPTION("OMAP DRM Display Driver");
766MODULE_ALIAS("platform:" DRIVER_NAME);
767MODULE_LICENSE("GPL v2");