imx-drm-core.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  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. #include <drm/drm_of.h>
  29. #include "imx-drm.h"
  30. #define MAX_CRTC 4
  31. struct imx_drm_component {
  32. struct device_node *of_node;
  33. struct list_head list;
  34. };
  35. struct imx_drm_device {
  36. struct drm_device *drm;
  37. struct imx_drm_crtc *crtc[MAX_CRTC];
  38. int pipes;
  39. struct drm_fbdev_cma *fbhelper;
  40. };
  41. struct imx_drm_crtc {
  42. struct drm_crtc *crtc;
  43. int pipe;
  44. struct imx_drm_crtc_helper_funcs imx_drm_helper_funcs;
  45. };
  46. static int legacyfb_depth = 16;
  47. module_param(legacyfb_depth, int, 0444);
  48. int imx_drm_crtc_id(struct imx_drm_crtc *crtc)
  49. {
  50. return crtc->pipe;
  51. }
  52. EXPORT_SYMBOL_GPL(imx_drm_crtc_id);
  53. static void imx_drm_driver_lastclose(struct drm_device *drm)
  54. {
  55. #if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
  56. struct imx_drm_device *imxdrm = drm->dev_private;
  57. if (imxdrm->fbhelper)
  58. drm_fbdev_cma_restore_mode(imxdrm->fbhelper);
  59. #endif
  60. }
  61. static int imx_drm_driver_unload(struct drm_device *drm)
  62. {
  63. #if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
  64. struct imx_drm_device *imxdrm = drm->dev_private;
  65. #endif
  66. drm_kms_helper_poll_fini(drm);
  67. #if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
  68. if (imxdrm->fbhelper)
  69. drm_fbdev_cma_fini(imxdrm->fbhelper);
  70. #endif
  71. component_unbind_all(drm->dev, drm);
  72. drm_vblank_cleanup(drm);
  73. drm_mode_config_cleanup(drm);
  74. platform_set_drvdata(drm->platformdev, NULL);
  75. return 0;
  76. }
  77. static struct imx_drm_crtc *imx_drm_find_crtc(struct drm_crtc *crtc)
  78. {
  79. struct imx_drm_device *imxdrm = crtc->dev->dev_private;
  80. unsigned i;
  81. for (i = 0; i < MAX_CRTC; i++)
  82. if (imxdrm->crtc[i] && imxdrm->crtc[i]->crtc == crtc)
  83. return imxdrm->crtc[i];
  84. return NULL;
  85. }
  86. int imx_drm_panel_format_pins(struct drm_encoder *encoder,
  87. u32 interface_pix_fmt, int hsync_pin, int vsync_pin)
  88. {
  89. struct imx_drm_crtc_helper_funcs *helper;
  90. struct imx_drm_crtc *imx_crtc;
  91. imx_crtc = imx_drm_find_crtc(encoder->crtc);
  92. if (!imx_crtc)
  93. return -EINVAL;
  94. helper = &imx_crtc->imx_drm_helper_funcs;
  95. if (helper->set_interface_pix_fmt)
  96. return helper->set_interface_pix_fmt(encoder->crtc,
  97. encoder->encoder_type, interface_pix_fmt,
  98. hsync_pin, vsync_pin);
  99. return 0;
  100. }
  101. EXPORT_SYMBOL_GPL(imx_drm_panel_format_pins);
  102. int imx_drm_panel_format(struct drm_encoder *encoder, u32 interface_pix_fmt)
  103. {
  104. return imx_drm_panel_format_pins(encoder, interface_pix_fmt, 2, 3);
  105. }
  106. EXPORT_SYMBOL_GPL(imx_drm_panel_format);
  107. int imx_drm_crtc_vblank_get(struct imx_drm_crtc *imx_drm_crtc)
  108. {
  109. return drm_vblank_get(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe);
  110. }
  111. EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_get);
  112. void imx_drm_crtc_vblank_put(struct imx_drm_crtc *imx_drm_crtc)
  113. {
  114. drm_vblank_put(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe);
  115. }
  116. EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_put);
  117. void imx_drm_handle_vblank(struct imx_drm_crtc *imx_drm_crtc)
  118. {
  119. drm_handle_vblank(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe);
  120. }
  121. EXPORT_SYMBOL_GPL(imx_drm_handle_vblank);
  122. static int imx_drm_enable_vblank(struct drm_device *drm, int crtc)
  123. {
  124. struct imx_drm_device *imxdrm = drm->dev_private;
  125. struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[crtc];
  126. int ret;
  127. if (!imx_drm_crtc)
  128. return -EINVAL;
  129. if (!imx_drm_crtc->imx_drm_helper_funcs.enable_vblank)
  130. return -ENOSYS;
  131. ret = imx_drm_crtc->imx_drm_helper_funcs.enable_vblank(
  132. imx_drm_crtc->crtc);
  133. return ret;
  134. }
  135. static void imx_drm_disable_vblank(struct drm_device *drm, int crtc)
  136. {
  137. struct imx_drm_device *imxdrm = drm->dev_private;
  138. struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[crtc];
  139. if (!imx_drm_crtc)
  140. return;
  141. if (!imx_drm_crtc->imx_drm_helper_funcs.disable_vblank)
  142. return;
  143. imx_drm_crtc->imx_drm_helper_funcs.disable_vblank(imx_drm_crtc->crtc);
  144. }
  145. static void imx_drm_driver_preclose(struct drm_device *drm,
  146. struct drm_file *file)
  147. {
  148. int i;
  149. if (!file->is_master)
  150. return;
  151. for (i = 0; i < MAX_CRTC; i++)
  152. imx_drm_disable_vblank(drm, i);
  153. }
  154. static const struct file_operations imx_drm_driver_fops = {
  155. .owner = THIS_MODULE,
  156. .open = drm_open,
  157. .release = drm_release,
  158. .unlocked_ioctl = drm_ioctl,
  159. .mmap = drm_gem_cma_mmap,
  160. .poll = drm_poll,
  161. .read = drm_read,
  162. .llseek = noop_llseek,
  163. };
  164. void imx_drm_connector_destroy(struct drm_connector *connector)
  165. {
  166. drm_connector_unregister(connector);
  167. drm_connector_cleanup(connector);
  168. }
  169. EXPORT_SYMBOL_GPL(imx_drm_connector_destroy);
  170. void imx_drm_encoder_destroy(struct drm_encoder *encoder)
  171. {
  172. drm_encoder_cleanup(encoder);
  173. }
  174. EXPORT_SYMBOL_GPL(imx_drm_encoder_destroy);
  175. static void imx_drm_output_poll_changed(struct drm_device *drm)
  176. {
  177. #if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
  178. struct imx_drm_device *imxdrm = drm->dev_private;
  179. drm_fbdev_cma_hotplug_event(imxdrm->fbhelper);
  180. #endif
  181. }
  182. static struct drm_mode_config_funcs imx_drm_mode_config_funcs = {
  183. .fb_create = drm_fb_cma_create,
  184. .output_poll_changed = imx_drm_output_poll_changed,
  185. };
  186. /*
  187. * Main DRM initialisation. This binds, initialises and registers
  188. * with DRM the subcomponents of the driver.
  189. */
  190. static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
  191. {
  192. struct imx_drm_device *imxdrm;
  193. struct drm_connector *connector;
  194. int ret;
  195. imxdrm = devm_kzalloc(drm->dev, sizeof(*imxdrm), GFP_KERNEL);
  196. if (!imxdrm)
  197. return -ENOMEM;
  198. imxdrm->drm = drm;
  199. drm->dev_private = imxdrm;
  200. /*
  201. * enable drm irq mode.
  202. * - with irq_enabled = true, we can use the vblank feature.
  203. *
  204. * P.S. note that we wouldn't use drm irq handler but
  205. * just specific driver own one instead because
  206. * drm framework supports only one irq handler and
  207. * drivers can well take care of their interrupts
  208. */
  209. drm->irq_enabled = true;
  210. /*
  211. * set max width and height as default value(4096x4096).
  212. * this value would be used to check framebuffer size limitation
  213. * at drm_mode_addfb().
  214. */
  215. drm->mode_config.min_width = 64;
  216. drm->mode_config.min_height = 64;
  217. drm->mode_config.max_width = 4096;
  218. drm->mode_config.max_height = 4096;
  219. drm->mode_config.funcs = &imx_drm_mode_config_funcs;
  220. drm_mode_config_init(drm);
  221. ret = drm_vblank_init(drm, MAX_CRTC);
  222. if (ret)
  223. goto err_kms;
  224. /*
  225. * with vblank_disable_allowed = true, vblank interrupt will be
  226. * disabled by drm timer once a current process gives up ownership
  227. * of vblank event. (after drm_vblank_put function is called)
  228. */
  229. drm->vblank_disable_allowed = true;
  230. platform_set_drvdata(drm->platformdev, drm);
  231. /* Now try and bind all our sub-components */
  232. ret = component_bind_all(drm->dev, drm);
  233. if (ret)
  234. goto err_vblank;
  235. /*
  236. * All components are now added, we can publish the connector sysfs
  237. * entries to userspace. This will generate hotplug events and so
  238. * userspace will expect to be able to access DRM at this point.
  239. */
  240. list_for_each_entry(connector, &drm->mode_config.connector_list, head) {
  241. ret = drm_connector_register(connector);
  242. if (ret) {
  243. dev_err(drm->dev,
  244. "[CONNECTOR:%d:%s] drm_connector_register failed: %d\n",
  245. connector->base.id,
  246. connector->name, ret);
  247. goto err_unbind;
  248. }
  249. }
  250. /*
  251. * All components are now initialised, so setup the fb helper.
  252. * The fb helper takes copies of key hardware information, so the
  253. * crtcs/connectors/encoders must not change after this point.
  254. */
  255. #if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
  256. if (legacyfb_depth != 16 && legacyfb_depth != 32) {
  257. dev_warn(drm->dev, "Invalid legacyfb_depth. Defaulting to 16bpp\n");
  258. legacyfb_depth = 16;
  259. }
  260. imxdrm->fbhelper = drm_fbdev_cma_init(drm, legacyfb_depth,
  261. drm->mode_config.num_crtc, MAX_CRTC);
  262. if (IS_ERR(imxdrm->fbhelper)) {
  263. ret = PTR_ERR(imxdrm->fbhelper);
  264. imxdrm->fbhelper = NULL;
  265. goto err_unbind;
  266. }
  267. #endif
  268. drm_kms_helper_poll_init(drm);
  269. return 0;
  270. err_unbind:
  271. component_unbind_all(drm->dev, drm);
  272. err_vblank:
  273. drm_vblank_cleanup(drm);
  274. err_kms:
  275. drm_mode_config_cleanup(drm);
  276. return ret;
  277. }
  278. /*
  279. * imx_drm_add_crtc - add a new crtc
  280. */
  281. int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,
  282. struct imx_drm_crtc **new_crtc,
  283. const struct imx_drm_crtc_helper_funcs *imx_drm_helper_funcs,
  284. struct device_node *port)
  285. {
  286. struct imx_drm_device *imxdrm = drm->dev_private;
  287. struct imx_drm_crtc *imx_drm_crtc;
  288. int ret;
  289. /*
  290. * The vblank arrays are dimensioned by MAX_CRTC - we can't
  291. * pass IDs greater than this to those functions.
  292. */
  293. if (imxdrm->pipes >= MAX_CRTC)
  294. return -EINVAL;
  295. if (imxdrm->drm->open_count)
  296. return -EBUSY;
  297. imx_drm_crtc = kzalloc(sizeof(*imx_drm_crtc), GFP_KERNEL);
  298. if (!imx_drm_crtc)
  299. return -ENOMEM;
  300. imx_drm_crtc->imx_drm_helper_funcs = *imx_drm_helper_funcs;
  301. imx_drm_crtc->pipe = imxdrm->pipes++;
  302. imx_drm_crtc->crtc = crtc;
  303. crtc->port = port;
  304. imxdrm->crtc[imx_drm_crtc->pipe] = imx_drm_crtc;
  305. *new_crtc = imx_drm_crtc;
  306. ret = drm_mode_crtc_set_gamma_size(imx_drm_crtc->crtc, 256);
  307. if (ret)
  308. goto err_register;
  309. drm_crtc_helper_add(crtc,
  310. imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs);
  311. drm_crtc_init(drm, crtc,
  312. imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);
  313. return 0;
  314. err_register:
  315. imxdrm->crtc[imx_drm_crtc->pipe] = NULL;
  316. kfree(imx_drm_crtc);
  317. return ret;
  318. }
  319. EXPORT_SYMBOL_GPL(imx_drm_add_crtc);
  320. /*
  321. * imx_drm_remove_crtc - remove a crtc
  322. */
  323. int imx_drm_remove_crtc(struct imx_drm_crtc *imx_drm_crtc)
  324. {
  325. struct imx_drm_device *imxdrm = imx_drm_crtc->crtc->dev->dev_private;
  326. drm_crtc_cleanup(imx_drm_crtc->crtc);
  327. imxdrm->crtc[imx_drm_crtc->pipe] = NULL;
  328. kfree(imx_drm_crtc);
  329. return 0;
  330. }
  331. EXPORT_SYMBOL_GPL(imx_drm_remove_crtc);
  332. int imx_drm_encoder_parse_of(struct drm_device *drm,
  333. struct drm_encoder *encoder, struct device_node *np)
  334. {
  335. uint32_t crtc_mask = drm_of_find_possible_crtcs(drm, np);
  336. /*
  337. * If we failed to find the CRTC(s) which this encoder is
  338. * supposed to be connected to, it's because the CRTC has
  339. * not been registered yet. Defer probing, and hope that
  340. * the required CRTC is added later.
  341. */
  342. if (crtc_mask == 0)
  343. return -EPROBE_DEFER;
  344. encoder->possible_crtcs = crtc_mask;
  345. /* FIXME: this is the mask of outputs which can clone this output. */
  346. encoder->possible_clones = ~0;
  347. return 0;
  348. }
  349. EXPORT_SYMBOL_GPL(imx_drm_encoder_parse_of);
  350. static struct device_node *imx_drm_of_get_next_endpoint(
  351. const struct device_node *parent, struct device_node *prev)
  352. {
  353. struct device_node *node = of_graph_get_next_endpoint(parent, prev);
  354. of_node_put(prev);
  355. return node;
  356. }
  357. /*
  358. * @node: device tree node containing encoder input ports
  359. * @encoder: drm_encoder
  360. */
  361. int imx_drm_encoder_get_mux_id(struct device_node *node,
  362. struct drm_encoder *encoder)
  363. {
  364. struct imx_drm_crtc *imx_crtc = imx_drm_find_crtc(encoder->crtc);
  365. struct device_node *ep = NULL;
  366. struct of_endpoint endpoint;
  367. struct device_node *port;
  368. int ret;
  369. if (!node || !imx_crtc)
  370. return -EINVAL;
  371. do {
  372. ep = imx_drm_of_get_next_endpoint(node, ep);
  373. if (!ep)
  374. break;
  375. port = of_graph_get_remote_port(ep);
  376. of_node_put(port);
  377. if (port == imx_crtc->crtc->port) {
  378. ret = of_graph_parse_endpoint(ep, &endpoint);
  379. return ret ? ret : endpoint.port;
  380. }
  381. } while (ep);
  382. return -EINVAL;
  383. }
  384. EXPORT_SYMBOL_GPL(imx_drm_encoder_get_mux_id);
  385. static const struct drm_ioctl_desc imx_drm_ioctls[] = {
  386. /* none so far */
  387. };
  388. static struct drm_driver imx_drm_driver = {
  389. .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME,
  390. .load = imx_drm_driver_load,
  391. .unload = imx_drm_driver_unload,
  392. .lastclose = imx_drm_driver_lastclose,
  393. .preclose = imx_drm_driver_preclose,
  394. .set_busid = drm_platform_set_busid,
  395. .gem_free_object = drm_gem_cma_free_object,
  396. .gem_vm_ops = &drm_gem_cma_vm_ops,
  397. .dumb_create = drm_gem_cma_dumb_create,
  398. .dumb_map_offset = drm_gem_cma_dumb_map_offset,
  399. .dumb_destroy = drm_gem_dumb_destroy,
  400. .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
  401. .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
  402. .gem_prime_import = drm_gem_prime_import,
  403. .gem_prime_export = drm_gem_prime_export,
  404. .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
  405. .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
  406. .gem_prime_vmap = drm_gem_cma_prime_vmap,
  407. .gem_prime_vunmap = drm_gem_cma_prime_vunmap,
  408. .gem_prime_mmap = drm_gem_cma_prime_mmap,
  409. .get_vblank_counter = drm_vblank_count,
  410. .enable_vblank = imx_drm_enable_vblank,
  411. .disable_vblank = imx_drm_disable_vblank,
  412. .ioctls = imx_drm_ioctls,
  413. .num_ioctls = ARRAY_SIZE(imx_drm_ioctls),
  414. .fops = &imx_drm_driver_fops,
  415. .name = "imx-drm",
  416. .desc = "i.MX DRM graphics",
  417. .date = "20120507",
  418. .major = 1,
  419. .minor = 0,
  420. .patchlevel = 0,
  421. };
  422. static int compare_of(struct device *dev, void *data)
  423. {
  424. struct device_node *np = data;
  425. /* Special case for LDB, one device for two channels */
  426. if (of_node_cmp(np->name, "lvds-channel") == 0) {
  427. np = of_get_parent(np);
  428. of_node_put(np);
  429. }
  430. return dev->of_node == np;
  431. }
  432. static int imx_drm_bind(struct device *dev)
  433. {
  434. return drm_platform_init(&imx_drm_driver, to_platform_device(dev));
  435. }
  436. static void imx_drm_unbind(struct device *dev)
  437. {
  438. drm_put_dev(dev_get_drvdata(dev));
  439. }
  440. static const struct component_master_ops imx_drm_ops = {
  441. .bind = imx_drm_bind,
  442. .unbind = imx_drm_unbind,
  443. };
  444. static int imx_drm_platform_probe(struct platform_device *pdev)
  445. {
  446. struct device_node *ep, *port, *remote;
  447. struct component_match *match = NULL;
  448. int ret;
  449. int i;
  450. /*
  451. * Bind the IPU display interface ports first, so that
  452. * imx_drm_encoder_parse_of called from encoder .bind callbacks
  453. * works as expected.
  454. */
  455. for (i = 0; ; i++) {
  456. port = of_parse_phandle(pdev->dev.of_node, "ports", i);
  457. if (!port)
  458. break;
  459. component_match_add(&pdev->dev, &match, compare_of, port);
  460. }
  461. if (i == 0) {
  462. dev_err(&pdev->dev, "missing 'ports' property\n");
  463. return -ENODEV;
  464. }
  465. /* Then bind all encoders */
  466. for (i = 0; ; i++) {
  467. port = of_parse_phandle(pdev->dev.of_node, "ports", i);
  468. if (!port)
  469. break;
  470. for_each_child_of_node(port, ep) {
  471. remote = of_graph_get_remote_port_parent(ep);
  472. if (!remote || !of_device_is_available(remote)) {
  473. of_node_put(remote);
  474. continue;
  475. } else if (!of_device_is_available(remote->parent)) {
  476. dev_warn(&pdev->dev, "parent device of %s is not available\n",
  477. remote->full_name);
  478. of_node_put(remote);
  479. continue;
  480. }
  481. component_match_add(&pdev->dev, &match, compare_of,
  482. remote);
  483. of_node_put(remote);
  484. }
  485. of_node_put(port);
  486. }
  487. ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
  488. if (ret)
  489. return ret;
  490. return component_master_add_with_match(&pdev->dev, &imx_drm_ops, match);
  491. }
  492. static int imx_drm_platform_remove(struct platform_device *pdev)
  493. {
  494. component_master_del(&pdev->dev, &imx_drm_ops);
  495. return 0;
  496. }
  497. #ifdef CONFIG_PM_SLEEP
  498. static int imx_drm_suspend(struct device *dev)
  499. {
  500. struct drm_device *drm_dev = dev_get_drvdata(dev);
  501. /* The drm_dev is NULL before .load hook is called */
  502. if (drm_dev == NULL)
  503. return 0;
  504. drm_kms_helper_poll_disable(drm_dev);
  505. return 0;
  506. }
  507. static int imx_drm_resume(struct device *dev)
  508. {
  509. struct drm_device *drm_dev = dev_get_drvdata(dev);
  510. if (drm_dev == NULL)
  511. return 0;
  512. drm_helper_resume_force_mode(drm_dev);
  513. drm_kms_helper_poll_enable(drm_dev);
  514. return 0;
  515. }
  516. #endif
  517. static SIMPLE_DEV_PM_OPS(imx_drm_pm_ops, imx_drm_suspend, imx_drm_resume);
  518. static const struct of_device_id imx_drm_dt_ids[] = {
  519. { .compatible = "fsl,imx-display-subsystem", },
  520. { /* sentinel */ },
  521. };
  522. MODULE_DEVICE_TABLE(of, imx_drm_dt_ids);
  523. static struct platform_driver imx_drm_pdrv = {
  524. .probe = imx_drm_platform_probe,
  525. .remove = imx_drm_platform_remove,
  526. .driver = {
  527. .name = "imx-drm",
  528. .pm = &imx_drm_pm_ops,
  529. .of_match_table = imx_drm_dt_ids,
  530. },
  531. };
  532. module_platform_driver(imx_drm_pdrv);
  533. MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
  534. MODULE_DESCRIPTION("i.MX drm driver core");
  535. MODULE_LICENSE("GPL");