Merge tag 'staging-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[cascardo/linux.git] / drivers / gpu / drm / imx / imx-drm-core.c
1 /*
2  * Freescale i.MX drm driver
3  *
4  * Copyright (C) 2011 Sascha Hauer, Pengutronix
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  */
16 #include <linux/component.h>
17 #include <linux/device.h>
18 #include <linux/fb.h>
19 #include <linux/module.h>
20 #include <linux/of_graph.h>
21 #include <linux/platform_device.h>
22 #include <drm/drmP.h>
23 #include <drm/drm_fb_helper.h>
24 #include <drm/drm_crtc_helper.h>
25 #include <drm/drm_gem_cma_helper.h>
26 #include <drm/drm_fb_cma_helper.h>
27 #include <drm/drm_plane_helper.h>
28
29 #include "imx-drm.h"
30
31 #define MAX_CRTC        4
32
33 struct imx_drm_component {
34         struct device_node *of_node;
35         struct list_head list;
36 };
37
38 struct imx_drm_device {
39         struct drm_device                       *drm;
40         struct imx_drm_crtc                     *crtc[MAX_CRTC];
41         int                                     pipes;
42         struct drm_fbdev_cma                    *fbhelper;
43 };
44
45 struct imx_drm_crtc {
46         struct drm_crtc                         *crtc;
47         int                                     pipe;
48         struct imx_drm_crtc_helper_funcs        imx_drm_helper_funcs;
49         struct device_node                      *port;
50 };
51
52 static int legacyfb_depth = 16;
53 module_param(legacyfb_depth, int, 0444);
54
55 int imx_drm_crtc_id(struct imx_drm_crtc *crtc)
56 {
57         return crtc->pipe;
58 }
59 EXPORT_SYMBOL_GPL(imx_drm_crtc_id);
60
61 static void imx_drm_driver_lastclose(struct drm_device *drm)
62 {
63 #if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
64         struct imx_drm_device *imxdrm = drm->dev_private;
65
66         if (imxdrm->fbhelper)
67                 drm_fbdev_cma_restore_mode(imxdrm->fbhelper);
68 #endif
69 }
70
71 static int imx_drm_driver_unload(struct drm_device *drm)
72 {
73 #if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
74         struct imx_drm_device *imxdrm = drm->dev_private;
75 #endif
76
77         drm_kms_helper_poll_fini(drm);
78
79 #if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
80         if (imxdrm->fbhelper)
81                 drm_fbdev_cma_fini(imxdrm->fbhelper);
82 #endif
83
84         component_unbind_all(drm->dev, drm);
85
86         drm_vblank_cleanup(drm);
87         drm_mode_config_cleanup(drm);
88
89         platform_set_drvdata(drm->platformdev, NULL);
90
91         return 0;
92 }
93
94 static struct imx_drm_crtc *imx_drm_find_crtc(struct drm_crtc *crtc)
95 {
96         struct imx_drm_device *imxdrm = crtc->dev->dev_private;
97         unsigned i;
98
99         for (i = 0; i < MAX_CRTC; i++)
100                 if (imxdrm->crtc[i] && imxdrm->crtc[i]->crtc == crtc)
101                         return imxdrm->crtc[i];
102
103         return NULL;
104 }
105
106 int imx_drm_panel_format_pins(struct drm_encoder *encoder,
107                 u32 interface_pix_fmt, int hsync_pin, int vsync_pin)
108 {
109         struct imx_drm_crtc_helper_funcs *helper;
110         struct imx_drm_crtc *imx_crtc;
111
112         imx_crtc = imx_drm_find_crtc(encoder->crtc);
113         if (!imx_crtc)
114                 return -EINVAL;
115
116         helper = &imx_crtc->imx_drm_helper_funcs;
117         if (helper->set_interface_pix_fmt)
118                 return helper->set_interface_pix_fmt(encoder->crtc,
119                                 encoder->encoder_type, interface_pix_fmt,
120                                 hsync_pin, vsync_pin);
121         return 0;
122 }
123 EXPORT_SYMBOL_GPL(imx_drm_panel_format_pins);
124
125 int imx_drm_panel_format(struct drm_encoder *encoder, u32 interface_pix_fmt)
126 {
127         return imx_drm_panel_format_pins(encoder, interface_pix_fmt, 2, 3);
128 }
129 EXPORT_SYMBOL_GPL(imx_drm_panel_format);
130
131 int imx_drm_crtc_vblank_get(struct imx_drm_crtc *imx_drm_crtc)
132 {
133         return drm_vblank_get(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe);
134 }
135 EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_get);
136
137 void imx_drm_crtc_vblank_put(struct imx_drm_crtc *imx_drm_crtc)
138 {
139         drm_vblank_put(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe);
140 }
141 EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_put);
142
143 void imx_drm_handle_vblank(struct imx_drm_crtc *imx_drm_crtc)
144 {
145         drm_handle_vblank(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe);
146 }
147 EXPORT_SYMBOL_GPL(imx_drm_handle_vblank);
148
149 static int imx_drm_enable_vblank(struct drm_device *drm, int crtc)
150 {
151         struct imx_drm_device *imxdrm = drm->dev_private;
152         struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[crtc];
153         int ret;
154
155         if (!imx_drm_crtc)
156                 return -EINVAL;
157
158         if (!imx_drm_crtc->imx_drm_helper_funcs.enable_vblank)
159                 return -ENOSYS;
160
161         ret = imx_drm_crtc->imx_drm_helper_funcs.enable_vblank(
162                         imx_drm_crtc->crtc);
163
164         return ret;
165 }
166
167 static void imx_drm_disable_vblank(struct drm_device *drm, int crtc)
168 {
169         struct imx_drm_device *imxdrm = drm->dev_private;
170         struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[crtc];
171
172         if (!imx_drm_crtc)
173                 return;
174
175         if (!imx_drm_crtc->imx_drm_helper_funcs.disable_vblank)
176                 return;
177
178         imx_drm_crtc->imx_drm_helper_funcs.disable_vblank(imx_drm_crtc->crtc);
179 }
180
181 static void imx_drm_driver_preclose(struct drm_device *drm,
182                 struct drm_file *file)
183 {
184         int i;
185
186         if (!file->is_master)
187                 return;
188
189         for (i = 0; i < MAX_CRTC; i++)
190                 imx_drm_disable_vblank(drm, i);
191 }
192
193 static const struct file_operations imx_drm_driver_fops = {
194         .owner = THIS_MODULE,
195         .open = drm_open,
196         .release = drm_release,
197         .unlocked_ioctl = drm_ioctl,
198         .mmap = drm_gem_cma_mmap,
199         .poll = drm_poll,
200         .read = drm_read,
201         .llseek = noop_llseek,
202 };
203
204 void imx_drm_connector_destroy(struct drm_connector *connector)
205 {
206         drm_connector_unregister(connector);
207         drm_connector_cleanup(connector);
208 }
209 EXPORT_SYMBOL_GPL(imx_drm_connector_destroy);
210
211 void imx_drm_encoder_destroy(struct drm_encoder *encoder)
212 {
213         drm_encoder_cleanup(encoder);
214 }
215 EXPORT_SYMBOL_GPL(imx_drm_encoder_destroy);
216
217 static void imx_drm_output_poll_changed(struct drm_device *drm)
218 {
219 #if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
220         struct imx_drm_device *imxdrm = drm->dev_private;
221
222         drm_fbdev_cma_hotplug_event(imxdrm->fbhelper);
223 #endif
224 }
225
226 static struct drm_mode_config_funcs imx_drm_mode_config_funcs = {
227         .fb_create = drm_fb_cma_create,
228         .output_poll_changed = imx_drm_output_poll_changed,
229 };
230
231 /*
232  * Main DRM initialisation. This binds, initialises and registers
233  * with DRM the subcomponents of the driver.
234  */
235 static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
236 {
237         struct imx_drm_device *imxdrm;
238         struct drm_connector *connector;
239         int ret;
240
241         imxdrm = devm_kzalloc(drm->dev, sizeof(*imxdrm), GFP_KERNEL);
242         if (!imxdrm)
243                 return -ENOMEM;
244
245         imxdrm->drm = drm;
246
247         drm->dev_private = imxdrm;
248
249         /*
250          * enable drm irq mode.
251          * - with irq_enabled = true, we can use the vblank feature.
252          *
253          * P.S. note that we wouldn't use drm irq handler but
254          *      just specific driver own one instead because
255          *      drm framework supports only one irq handler and
256          *      drivers can well take care of their interrupts
257          */
258         drm->irq_enabled = true;
259
260         /*
261          * set max width and height as default value(4096x4096).
262          * this value would be used to check framebuffer size limitation
263          * at drm_mode_addfb().
264          */
265         drm->mode_config.min_width = 64;
266         drm->mode_config.min_height = 64;
267         drm->mode_config.max_width = 4096;
268         drm->mode_config.max_height = 4096;
269         drm->mode_config.funcs = &imx_drm_mode_config_funcs;
270
271         drm_mode_config_init(drm);
272
273         ret = drm_vblank_init(drm, MAX_CRTC);
274         if (ret)
275                 goto err_kms;
276
277         /*
278          * with vblank_disable_allowed = true, vblank interrupt will be
279          * disabled by drm timer once a current process gives up ownership
280          * of vblank event. (after drm_vblank_put function is called)
281          */
282         drm->vblank_disable_allowed = true;
283
284         platform_set_drvdata(drm->platformdev, drm);
285
286         /* Now try and bind all our sub-components */
287         ret = component_bind_all(drm->dev, drm);
288         if (ret)
289                 goto err_vblank;
290
291         /*
292          * All components are now added, we can publish the connector sysfs
293          * entries to userspace.  This will generate hotplug events and so
294          * userspace will expect to be able to access DRM at this point.
295          */
296         list_for_each_entry(connector, &drm->mode_config.connector_list, head) {
297                 ret = drm_connector_register(connector);
298                 if (ret) {
299                         dev_err(drm->dev,
300                                 "[CONNECTOR:%d:%s] drm_connector_register failed: %d\n",
301                                 connector->base.id,
302                                 connector->name, ret);
303                         goto err_unbind;
304                 }
305         }
306
307         /*
308          * All components are now initialised, so setup the fb helper.
309          * The fb helper takes copies of key hardware information, so the
310          * crtcs/connectors/encoders must not change after this point.
311          */
312 #if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
313         if (legacyfb_depth != 16 && legacyfb_depth != 32) {
314                 dev_warn(drm->dev, "Invalid legacyfb_depth.  Defaulting to 16bpp\n");
315                 legacyfb_depth = 16;
316         }
317         imxdrm->fbhelper = drm_fbdev_cma_init(drm, legacyfb_depth,
318                                 drm->mode_config.num_crtc, MAX_CRTC);
319         if (IS_ERR(imxdrm->fbhelper)) {
320                 ret = PTR_ERR(imxdrm->fbhelper);
321                 imxdrm->fbhelper = NULL;
322                 goto err_unbind;
323         }
324 #endif
325
326         drm_kms_helper_poll_init(drm);
327
328         return 0;
329
330 err_unbind:
331         component_unbind_all(drm->dev, drm);
332 err_vblank:
333         drm_vblank_cleanup(drm);
334 err_kms:
335         drm_mode_config_cleanup(drm);
336
337         return ret;
338 }
339
340 /*
341  * imx_drm_add_crtc - add a new crtc
342  */
343 int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,
344                 struct imx_drm_crtc **new_crtc,
345                 const struct imx_drm_crtc_helper_funcs *imx_drm_helper_funcs,
346                 struct device_node *port)
347 {
348         struct imx_drm_device *imxdrm = drm->dev_private;
349         struct imx_drm_crtc *imx_drm_crtc;
350         int ret;
351
352         /*
353          * The vblank arrays are dimensioned by MAX_CRTC - we can't
354          * pass IDs greater than this to those functions.
355          */
356         if (imxdrm->pipes >= MAX_CRTC)
357                 return -EINVAL;
358
359         if (imxdrm->drm->open_count)
360                 return -EBUSY;
361
362         imx_drm_crtc = kzalloc(sizeof(*imx_drm_crtc), GFP_KERNEL);
363         if (!imx_drm_crtc)
364                 return -ENOMEM;
365
366         imx_drm_crtc->imx_drm_helper_funcs = *imx_drm_helper_funcs;
367         imx_drm_crtc->pipe = imxdrm->pipes++;
368         imx_drm_crtc->port = port;
369         imx_drm_crtc->crtc = crtc;
370
371         imxdrm->crtc[imx_drm_crtc->pipe] = imx_drm_crtc;
372
373         *new_crtc = imx_drm_crtc;
374
375         ret = drm_mode_crtc_set_gamma_size(imx_drm_crtc->crtc, 256);
376         if (ret)
377                 goto err_register;
378
379         drm_crtc_helper_add(crtc,
380                         imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs);
381
382         drm_crtc_init(drm, crtc,
383                         imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);
384
385         return 0;
386
387 err_register:
388         imxdrm->crtc[imx_drm_crtc->pipe] = NULL;
389         kfree(imx_drm_crtc);
390         return ret;
391 }
392 EXPORT_SYMBOL_GPL(imx_drm_add_crtc);
393
394 /*
395  * imx_drm_remove_crtc - remove a crtc
396  */
397 int imx_drm_remove_crtc(struct imx_drm_crtc *imx_drm_crtc)
398 {
399         struct imx_drm_device *imxdrm = imx_drm_crtc->crtc->dev->dev_private;
400
401         drm_crtc_cleanup(imx_drm_crtc->crtc);
402
403         imxdrm->crtc[imx_drm_crtc->pipe] = NULL;
404
405         kfree(imx_drm_crtc);
406
407         return 0;
408 }
409 EXPORT_SYMBOL_GPL(imx_drm_remove_crtc);
410
411 /*
412  * Find the DRM CRTC possible mask for the connected endpoint.
413  *
414  * The encoder possible masks are defined by their position in the
415  * mode_config crtc_list.  This means that CRTCs must not be added
416  * or removed once the DRM device has been fully initialised.
417  */
418 static uint32_t imx_drm_find_crtc_mask(struct imx_drm_device *imxdrm,
419         struct device_node *endpoint)
420 {
421         struct device_node *port;
422         unsigned i;
423
424         port = of_graph_get_remote_port(endpoint);
425         if (!port)
426                 return 0;
427         of_node_put(port);
428
429         for (i = 0; i < MAX_CRTC; i++) {
430                 struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[i];
431
432                 if (imx_drm_crtc && imx_drm_crtc->port == port)
433                         return drm_crtc_mask(imx_drm_crtc->crtc);
434         }
435
436         return 0;
437 }
438
439 static struct device_node *imx_drm_of_get_next_endpoint(
440                 const struct device_node *parent, struct device_node *prev)
441 {
442         struct device_node *node = of_graph_get_next_endpoint(parent, prev);
443
444         of_node_put(prev);
445         return node;
446 }
447
448 int imx_drm_encoder_parse_of(struct drm_device *drm,
449         struct drm_encoder *encoder, struct device_node *np)
450 {
451         struct imx_drm_device *imxdrm = drm->dev_private;
452         struct device_node *ep = NULL;
453         uint32_t crtc_mask = 0;
454         int i;
455
456         for (i = 0; ; i++) {
457                 u32 mask;
458
459                 ep = imx_drm_of_get_next_endpoint(np, ep);
460                 if (!ep)
461                         break;
462
463                 mask = imx_drm_find_crtc_mask(imxdrm, ep);
464
465                 /*
466                  * If we failed to find the CRTC(s) which this encoder is
467                  * supposed to be connected to, it's because the CRTC has
468                  * not been registered yet.  Defer probing, and hope that
469                  * the required CRTC is added later.
470                  */
471                 if (mask == 0)
472                         return -EPROBE_DEFER;
473
474                 crtc_mask |= mask;
475         }
476
477         of_node_put(ep);
478         if (i == 0)
479                 return -ENOENT;
480
481         encoder->possible_crtcs = crtc_mask;
482
483         /* FIXME: this is the mask of outputs which can clone this output. */
484         encoder->possible_clones = ~0;
485
486         return 0;
487 }
488 EXPORT_SYMBOL_GPL(imx_drm_encoder_parse_of);
489
490 /*
491  * @node: device tree node containing encoder input ports
492  * @encoder: drm_encoder
493  */
494 int imx_drm_encoder_get_mux_id(struct device_node *node,
495                                struct drm_encoder *encoder)
496 {
497         struct imx_drm_crtc *imx_crtc = imx_drm_find_crtc(encoder->crtc);
498         struct device_node *ep = NULL;
499         struct of_endpoint endpoint;
500         struct device_node *port;
501         int ret;
502
503         if (!node || !imx_crtc)
504                 return -EINVAL;
505
506         do {
507                 ep = imx_drm_of_get_next_endpoint(node, ep);
508                 if (!ep)
509                         break;
510
511                 port = of_graph_get_remote_port(ep);
512                 of_node_put(port);
513                 if (port == imx_crtc->port) {
514                         ret = of_graph_parse_endpoint(ep, &endpoint);
515                         return ret ? ret : endpoint.port;
516                 }
517         } while (ep);
518
519         return -EINVAL;
520 }
521 EXPORT_SYMBOL_GPL(imx_drm_encoder_get_mux_id);
522
523 static const struct drm_ioctl_desc imx_drm_ioctls[] = {
524         /* none so far */
525 };
526
527 static struct drm_driver imx_drm_driver = {
528         .driver_features        = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME,
529         .load                   = imx_drm_driver_load,
530         .unload                 = imx_drm_driver_unload,
531         .lastclose              = imx_drm_driver_lastclose,
532         .preclose               = imx_drm_driver_preclose,
533         .set_busid              = drm_platform_set_busid,
534         .gem_free_object        = drm_gem_cma_free_object,
535         .gem_vm_ops             = &drm_gem_cma_vm_ops,
536         .dumb_create            = drm_gem_cma_dumb_create,
537         .dumb_map_offset        = drm_gem_cma_dumb_map_offset,
538         .dumb_destroy           = drm_gem_dumb_destroy,
539
540         .prime_handle_to_fd     = drm_gem_prime_handle_to_fd,
541         .prime_fd_to_handle     = drm_gem_prime_fd_to_handle,
542         .gem_prime_import       = drm_gem_prime_import,
543         .gem_prime_export       = drm_gem_prime_export,
544         .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
545         .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
546         .gem_prime_vmap         = drm_gem_cma_prime_vmap,
547         .gem_prime_vunmap       = drm_gem_cma_prime_vunmap,
548         .gem_prime_mmap         = drm_gem_cma_prime_mmap,
549         .get_vblank_counter     = drm_vblank_count,
550         .enable_vblank          = imx_drm_enable_vblank,
551         .disable_vblank         = imx_drm_disable_vblank,
552         .ioctls                 = imx_drm_ioctls,
553         .num_ioctls             = ARRAY_SIZE(imx_drm_ioctls),
554         .fops                   = &imx_drm_driver_fops,
555         .name                   = "imx-drm",
556         .desc                   = "i.MX DRM graphics",
557         .date                   = "20120507",
558         .major                  = 1,
559         .minor                  = 0,
560         .patchlevel             = 0,
561 };
562
563 static int compare_of(struct device *dev, void *data)
564 {
565         struct device_node *np = data;
566
567         /* Special case for LDB, one device for two channels */
568         if (of_node_cmp(np->name, "lvds-channel") == 0) {
569                 np = of_get_parent(np);
570                 of_node_put(np);
571         }
572
573         return dev->of_node == np;
574 }
575
576 static int imx_drm_bind(struct device *dev)
577 {
578         return drm_platform_init(&imx_drm_driver, to_platform_device(dev));
579 }
580
581 static void imx_drm_unbind(struct device *dev)
582 {
583         drm_put_dev(dev_get_drvdata(dev));
584 }
585
586 static const struct component_master_ops imx_drm_ops = {
587         .bind = imx_drm_bind,
588         .unbind = imx_drm_unbind,
589 };
590
591 static int imx_drm_platform_probe(struct platform_device *pdev)
592 {
593         struct device_node *ep, *port, *remote;
594         struct component_match *match = NULL;
595         int ret;
596         int i;
597
598         /*
599          * Bind the IPU display interface ports first, so that
600          * imx_drm_encoder_parse_of called from encoder .bind callbacks
601          * works as expected.
602          */
603         for (i = 0; ; i++) {
604                 port = of_parse_phandle(pdev->dev.of_node, "ports", i);
605                 if (!port)
606                         break;
607
608                 component_match_add(&pdev->dev, &match, compare_of, port);
609         }
610
611         if (i == 0) {
612                 dev_err(&pdev->dev, "missing 'ports' property\n");
613                 return -ENODEV;
614         }
615
616         /* Then bind all encoders */
617         for (i = 0; ; i++) {
618                 port = of_parse_phandle(pdev->dev.of_node, "ports", i);
619                 if (!port)
620                         break;
621
622                 for_each_child_of_node(port, ep) {
623                         remote = of_graph_get_remote_port_parent(ep);
624                         if (!remote || !of_device_is_available(remote)) {
625                                 of_node_put(remote);
626                                 continue;
627                         } else if (!of_device_is_available(remote->parent)) {
628                                 dev_warn(&pdev->dev, "parent device of %s is not available\n",
629                                          remote->full_name);
630                                 of_node_put(remote);
631                                 continue;
632                         }
633
634                         component_match_add(&pdev->dev, &match, compare_of,
635                                             remote);
636                         of_node_put(remote);
637                 }
638                 of_node_put(port);
639         }
640
641         ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
642         if (ret)
643                 return ret;
644
645         return component_master_add_with_match(&pdev->dev, &imx_drm_ops, match);
646 }
647
648 static int imx_drm_platform_remove(struct platform_device *pdev)
649 {
650         component_master_del(&pdev->dev, &imx_drm_ops);
651         return 0;
652 }
653
654 #ifdef CONFIG_PM_SLEEP
655 static int imx_drm_suspend(struct device *dev)
656 {
657         struct drm_device *drm_dev = dev_get_drvdata(dev);
658
659         /* The drm_dev is NULL before .load hook is called */
660         if (drm_dev == NULL)
661                 return 0;
662
663         drm_kms_helper_poll_disable(drm_dev);
664
665         return 0;
666 }
667
668 static int imx_drm_resume(struct device *dev)
669 {
670         struct drm_device *drm_dev = dev_get_drvdata(dev);
671
672         if (drm_dev == NULL)
673                 return 0;
674
675         drm_helper_resume_force_mode(drm_dev);
676         drm_kms_helper_poll_enable(drm_dev);
677
678         return 0;
679 }
680 #endif
681
682 static SIMPLE_DEV_PM_OPS(imx_drm_pm_ops, imx_drm_suspend, imx_drm_resume);
683
684 static const struct of_device_id imx_drm_dt_ids[] = {
685         { .compatible = "fsl,imx-display-subsystem", },
686         { /* sentinel */ },
687 };
688 MODULE_DEVICE_TABLE(of, imx_drm_dt_ids);
689
690 static struct platform_driver imx_drm_pdrv = {
691         .probe          = imx_drm_platform_probe,
692         .remove         = imx_drm_platform_remove,
693         .driver         = {
694                 .name   = "imx-drm",
695                 .pm     = &imx_drm_pm_ops,
696                 .of_match_table = imx_drm_dt_ids,
697         },
698 };
699 module_platform_driver(imx_drm_pdrv);
700
701 MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
702 MODULE_DESCRIPTION("i.MX drm driver core");
703 MODULE_LICENSE("GPL");