rcar_du_kms.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. /*
  2. * rcar_du_kms.c -- R-Car Display Unit Mode Setting
  3. *
  4. * Copyright (C) 2013-2015 Renesas Electronics Corporation
  5. *
  6. * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. */
  13. #include <drm/drmP.h>
  14. #include <drm/drm_atomic.h>
  15. #include <drm/drm_atomic_helper.h>
  16. #include <drm/drm_crtc.h>
  17. #include <drm/drm_crtc_helper.h>
  18. #include <drm/drm_fb_cma_helper.h>
  19. #include <drm/drm_gem_cma_helper.h>
  20. #include <linux/of_graph.h>
  21. #include <linux/wait.h>
  22. #include "rcar_du_crtc.h"
  23. #include "rcar_du_drv.h"
  24. #include "rcar_du_encoder.h"
  25. #include "rcar_du_kms.h"
  26. #include "rcar_du_lvdsenc.h"
  27. #include "rcar_du_regs.h"
  28. #include "rcar_du_vsp.h"
  29. /* -----------------------------------------------------------------------------
  30. * Format helpers
  31. */
  32. static const struct rcar_du_format_info rcar_du_format_infos[] = {
  33. {
  34. .fourcc = DRM_FORMAT_RGB565,
  35. .bpp = 16,
  36. .planes = 1,
  37. .pnmr = PnMR_SPIM_TP | PnMR_DDDF_16BPP,
  38. .edf = PnDDCR4_EDF_NONE,
  39. }, {
  40. .fourcc = DRM_FORMAT_ARGB1555,
  41. .bpp = 16,
  42. .planes = 1,
  43. .pnmr = PnMR_SPIM_ALP | PnMR_DDDF_ARGB,
  44. .edf = PnDDCR4_EDF_NONE,
  45. }, {
  46. .fourcc = DRM_FORMAT_XRGB1555,
  47. .bpp = 16,
  48. .planes = 1,
  49. .pnmr = PnMR_SPIM_ALP | PnMR_DDDF_ARGB,
  50. .edf = PnDDCR4_EDF_NONE,
  51. }, {
  52. .fourcc = DRM_FORMAT_XRGB8888,
  53. .bpp = 32,
  54. .planes = 1,
  55. .pnmr = PnMR_SPIM_TP | PnMR_DDDF_16BPP,
  56. .edf = PnDDCR4_EDF_RGB888,
  57. }, {
  58. .fourcc = DRM_FORMAT_ARGB8888,
  59. .bpp = 32,
  60. .planes = 1,
  61. .pnmr = PnMR_SPIM_ALP | PnMR_DDDF_16BPP,
  62. .edf = PnDDCR4_EDF_ARGB8888,
  63. }, {
  64. .fourcc = DRM_FORMAT_UYVY,
  65. .bpp = 16,
  66. .planes = 1,
  67. .pnmr = PnMR_SPIM_TP_OFF | PnMR_DDDF_YC,
  68. .edf = PnDDCR4_EDF_NONE,
  69. }, {
  70. .fourcc = DRM_FORMAT_YUYV,
  71. .bpp = 16,
  72. .planes = 1,
  73. .pnmr = PnMR_SPIM_TP_OFF | PnMR_DDDF_YC,
  74. .edf = PnDDCR4_EDF_NONE,
  75. }, {
  76. .fourcc = DRM_FORMAT_NV12,
  77. .bpp = 12,
  78. .planes = 2,
  79. .pnmr = PnMR_SPIM_TP_OFF | PnMR_DDDF_YC,
  80. .edf = PnDDCR4_EDF_NONE,
  81. }, {
  82. .fourcc = DRM_FORMAT_NV21,
  83. .bpp = 12,
  84. .planes = 2,
  85. .pnmr = PnMR_SPIM_TP_OFF | PnMR_DDDF_YC,
  86. .edf = PnDDCR4_EDF_NONE,
  87. }, {
  88. .fourcc = DRM_FORMAT_NV16,
  89. .bpp = 16,
  90. .planes = 2,
  91. .pnmr = PnMR_SPIM_TP_OFF | PnMR_DDDF_YC,
  92. .edf = PnDDCR4_EDF_NONE,
  93. },
  94. /* The following formats are not supported on Gen2 and thus have no
  95. * associated .pnmr or .edf settings.
  96. */
  97. {
  98. .fourcc = DRM_FORMAT_NV61,
  99. .bpp = 16,
  100. .planes = 2,
  101. }, {
  102. .fourcc = DRM_FORMAT_YUV420,
  103. .bpp = 12,
  104. .planes = 3,
  105. }, {
  106. .fourcc = DRM_FORMAT_YVU420,
  107. .bpp = 12,
  108. .planes = 3,
  109. }, {
  110. .fourcc = DRM_FORMAT_YUV422,
  111. .bpp = 16,
  112. .planes = 3,
  113. }, {
  114. .fourcc = DRM_FORMAT_YVU422,
  115. .bpp = 16,
  116. .planes = 3,
  117. }, {
  118. .fourcc = DRM_FORMAT_YUV444,
  119. .bpp = 24,
  120. .planes = 3,
  121. }, {
  122. .fourcc = DRM_FORMAT_YVU444,
  123. .bpp = 24,
  124. .planes = 3,
  125. },
  126. };
  127. const struct rcar_du_format_info *rcar_du_format_info(u32 fourcc)
  128. {
  129. unsigned int i;
  130. for (i = 0; i < ARRAY_SIZE(rcar_du_format_infos); ++i) {
  131. if (rcar_du_format_infos[i].fourcc == fourcc)
  132. return &rcar_du_format_infos[i];
  133. }
  134. return NULL;
  135. }
  136. /* -----------------------------------------------------------------------------
  137. * Frame buffer
  138. */
  139. int rcar_du_dumb_create(struct drm_file *file, struct drm_device *dev,
  140. struct drm_mode_create_dumb *args)
  141. {
  142. struct rcar_du_device *rcdu = dev->dev_private;
  143. unsigned int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
  144. unsigned int align;
  145. /* The R8A7779 DU requires a 16 pixels pitch alignment as documented,
  146. * but the R8A7790 DU seems to require a 128 bytes pitch alignment.
  147. */
  148. if (rcar_du_needs(rcdu, RCAR_DU_QUIRK_ALIGN_128B))
  149. align = 128;
  150. else
  151. align = 16 * args->bpp / 8;
  152. args->pitch = roundup(min_pitch, align);
  153. return drm_gem_cma_dumb_create_internal(file, dev, args);
  154. }
  155. static struct drm_framebuffer *
  156. rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
  157. const struct drm_mode_fb_cmd2 *mode_cmd)
  158. {
  159. struct rcar_du_device *rcdu = dev->dev_private;
  160. const struct rcar_du_format_info *format;
  161. unsigned int max_pitch;
  162. unsigned int align;
  163. unsigned int bpp;
  164. unsigned int i;
  165. format = rcar_du_format_info(mode_cmd->pixel_format);
  166. if (format == NULL) {
  167. dev_dbg(dev->dev, "unsupported pixel format %08x\n",
  168. mode_cmd->pixel_format);
  169. return ERR_PTR(-EINVAL);
  170. }
  171. /*
  172. * The pitch and alignment constraints are expressed in pixels on the
  173. * hardware side and in bytes in the DRM API.
  174. */
  175. bpp = format->planes == 1 ? format->bpp / 8 : 1;
  176. max_pitch = 4096 * bpp;
  177. if (rcar_du_needs(rcdu, RCAR_DU_QUIRK_ALIGN_128B))
  178. align = 128;
  179. else
  180. align = 16 * bpp;
  181. if (mode_cmd->pitches[0] & (align - 1) ||
  182. mode_cmd->pitches[0] >= max_pitch) {
  183. dev_dbg(dev->dev, "invalid pitch value %u\n",
  184. mode_cmd->pitches[0]);
  185. return ERR_PTR(-EINVAL);
  186. }
  187. for (i = 1; i < format->planes; ++i) {
  188. if (mode_cmd->pitches[i] != mode_cmd->pitches[0]) {
  189. dev_dbg(dev->dev,
  190. "luma and chroma pitches do not match\n");
  191. return ERR_PTR(-EINVAL);
  192. }
  193. }
  194. return drm_fb_cma_create(dev, file_priv, mode_cmd);
  195. }
  196. static void rcar_du_output_poll_changed(struct drm_device *dev)
  197. {
  198. struct rcar_du_device *rcdu = dev->dev_private;
  199. drm_fbdev_cma_hotplug_event(rcdu->fbdev);
  200. }
  201. /* -----------------------------------------------------------------------------
  202. * Atomic Check and Update
  203. */
  204. static int rcar_du_atomic_check(struct drm_device *dev,
  205. struct drm_atomic_state *state)
  206. {
  207. struct rcar_du_device *rcdu = dev->dev_private;
  208. int ret;
  209. ret = drm_atomic_helper_check(dev, state);
  210. if (ret < 0)
  211. return ret;
  212. if (rcar_du_has(rcdu, RCAR_DU_FEATURE_VSP1_SOURCE))
  213. return 0;
  214. return rcar_du_atomic_check_planes(dev, state);
  215. }
  216. struct rcar_du_commit {
  217. struct work_struct work;
  218. struct drm_device *dev;
  219. struct drm_atomic_state *state;
  220. u32 crtcs;
  221. };
  222. static void rcar_du_atomic_complete(struct rcar_du_commit *commit)
  223. {
  224. struct drm_device *dev = commit->dev;
  225. struct rcar_du_device *rcdu = dev->dev_private;
  226. struct drm_atomic_state *old_state = commit->state;
  227. /* Apply the atomic update. */
  228. drm_atomic_helper_commit_modeset_disables(dev, old_state);
  229. drm_atomic_helper_commit_modeset_enables(dev, old_state);
  230. drm_atomic_helper_commit_planes(dev, old_state, true);
  231. drm_atomic_helper_wait_for_vblanks(dev, old_state);
  232. drm_atomic_helper_cleanup_planes(dev, old_state);
  233. drm_atomic_state_free(old_state);
  234. /* Complete the commit, wake up any waiter. */
  235. spin_lock(&rcdu->commit.wait.lock);
  236. rcdu->commit.pending &= ~commit->crtcs;
  237. wake_up_all_locked(&rcdu->commit.wait);
  238. spin_unlock(&rcdu->commit.wait.lock);
  239. kfree(commit);
  240. }
  241. static void rcar_du_atomic_work(struct work_struct *work)
  242. {
  243. struct rcar_du_commit *commit =
  244. container_of(work, struct rcar_du_commit, work);
  245. rcar_du_atomic_complete(commit);
  246. }
  247. static int rcar_du_atomic_commit(struct drm_device *dev,
  248. struct drm_atomic_state *state, bool async)
  249. {
  250. struct rcar_du_device *rcdu = dev->dev_private;
  251. struct rcar_du_commit *commit;
  252. unsigned int i;
  253. int ret;
  254. ret = drm_atomic_helper_prepare_planes(dev, state);
  255. if (ret)
  256. return ret;
  257. /* Allocate the commit object. */
  258. commit = kzalloc(sizeof(*commit), GFP_KERNEL);
  259. if (commit == NULL) {
  260. ret = -ENOMEM;
  261. goto error;
  262. }
  263. INIT_WORK(&commit->work, rcar_du_atomic_work);
  264. commit->dev = dev;
  265. commit->state = state;
  266. /* Wait until all affected CRTCs have completed previous commits and
  267. * mark them as pending.
  268. */
  269. for (i = 0; i < dev->mode_config.num_crtc; ++i) {
  270. if (state->crtcs[i])
  271. commit->crtcs |= 1 << drm_crtc_index(state->crtcs[i]);
  272. }
  273. spin_lock(&rcdu->commit.wait.lock);
  274. ret = wait_event_interruptible_locked(rcdu->commit.wait,
  275. !(rcdu->commit.pending & commit->crtcs));
  276. if (ret == 0)
  277. rcdu->commit.pending |= commit->crtcs;
  278. spin_unlock(&rcdu->commit.wait.lock);
  279. if (ret) {
  280. kfree(commit);
  281. goto error;
  282. }
  283. /* Swap the state, this is the point of no return. */
  284. drm_atomic_helper_swap_state(dev, state);
  285. if (async)
  286. schedule_work(&commit->work);
  287. else
  288. rcar_du_atomic_complete(commit);
  289. return 0;
  290. error:
  291. drm_atomic_helper_cleanup_planes(dev, state);
  292. return ret;
  293. }
  294. /* -----------------------------------------------------------------------------
  295. * Initialization
  296. */
  297. static const struct drm_mode_config_funcs rcar_du_mode_config_funcs = {
  298. .fb_create = rcar_du_fb_create,
  299. .output_poll_changed = rcar_du_output_poll_changed,
  300. .atomic_check = rcar_du_atomic_check,
  301. .atomic_commit = rcar_du_atomic_commit,
  302. };
  303. static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
  304. enum rcar_du_output output,
  305. struct of_endpoint *ep)
  306. {
  307. static const struct {
  308. const char *compatible;
  309. enum rcar_du_encoder_type type;
  310. } encoders[] = {
  311. { "adi,adv7123", RCAR_DU_ENCODER_VGA },
  312. { "adi,adv7511w", RCAR_DU_ENCODER_HDMI },
  313. { "thine,thc63lvdm83d", RCAR_DU_ENCODER_LVDS },
  314. };
  315. enum rcar_du_encoder_type enc_type = RCAR_DU_ENCODER_NONE;
  316. struct device_node *connector = NULL;
  317. struct device_node *encoder = NULL;
  318. struct device_node *ep_node = NULL;
  319. struct device_node *entity_ep_node;
  320. struct device_node *entity;
  321. int ret;
  322. /*
  323. * Locate the connected entity and infer its type from the number of
  324. * endpoints.
  325. */
  326. entity = of_graph_get_remote_port_parent(ep->local_node);
  327. if (!entity) {
  328. dev_dbg(rcdu->dev, "unconnected endpoint %s, skipping\n",
  329. ep->local_node->full_name);
  330. return -ENODEV;
  331. }
  332. entity_ep_node = of_parse_phandle(ep->local_node, "remote-endpoint", 0);
  333. for_each_endpoint_of_node(entity, ep_node) {
  334. if (ep_node == entity_ep_node)
  335. continue;
  336. /*
  337. * We've found one endpoint other than the input, this must
  338. * be an encoder. Locate the connector.
  339. */
  340. encoder = entity;
  341. connector = of_graph_get_remote_port_parent(ep_node);
  342. of_node_put(ep_node);
  343. if (!connector) {
  344. dev_warn(rcdu->dev,
  345. "no connector for encoder %s, skipping\n",
  346. encoder->full_name);
  347. of_node_put(entity_ep_node);
  348. of_node_put(encoder);
  349. return -ENODEV;
  350. }
  351. break;
  352. }
  353. of_node_put(entity_ep_node);
  354. if (encoder) {
  355. /*
  356. * If an encoder has been found, get its type based on its
  357. * compatible string.
  358. */
  359. unsigned int i;
  360. for (i = 0; i < ARRAY_SIZE(encoders); ++i) {
  361. if (of_device_is_compatible(encoder,
  362. encoders[i].compatible)) {
  363. enc_type = encoders[i].type;
  364. break;
  365. }
  366. }
  367. if (i == ARRAY_SIZE(encoders)) {
  368. dev_warn(rcdu->dev,
  369. "unknown encoder type for %s, skipping\n",
  370. encoder->full_name);
  371. of_node_put(encoder);
  372. of_node_put(connector);
  373. return -EINVAL;
  374. }
  375. } else {
  376. /*
  377. * If no encoder has been found the entity must be the
  378. * connector.
  379. */
  380. connector = entity;
  381. }
  382. ret = rcar_du_encoder_init(rcdu, enc_type, output, encoder, connector);
  383. of_node_put(encoder);
  384. of_node_put(connector);
  385. if (ret && ret != -EPROBE_DEFER)
  386. dev_warn(rcdu->dev,
  387. "failed to initialize encoder %s (%d), skipping\n",
  388. encoder->full_name, ret);
  389. return ret;
  390. }
  391. static int rcar_du_encoders_init(struct rcar_du_device *rcdu)
  392. {
  393. struct device_node *np = rcdu->dev->of_node;
  394. struct device_node *ep_node;
  395. unsigned int num_encoders = 0;
  396. /*
  397. * Iterate over the endpoints and create one encoder for each output
  398. * pipeline.
  399. */
  400. for_each_endpoint_of_node(np, ep_node) {
  401. enum rcar_du_output output;
  402. struct of_endpoint ep;
  403. unsigned int i;
  404. int ret;
  405. ret = of_graph_parse_endpoint(ep_node, &ep);
  406. if (ret < 0) {
  407. of_node_put(ep_node);
  408. return ret;
  409. }
  410. /* Find the output route corresponding to the port number. */
  411. for (i = 0; i < RCAR_DU_OUTPUT_MAX; ++i) {
  412. if (rcdu->info->routes[i].possible_crtcs &&
  413. rcdu->info->routes[i].port == ep.port) {
  414. output = i;
  415. break;
  416. }
  417. }
  418. if (i == RCAR_DU_OUTPUT_MAX) {
  419. dev_warn(rcdu->dev,
  420. "port %u references unexisting output, skipping\n",
  421. ep.port);
  422. continue;
  423. }
  424. /* Process the output pipeline. */
  425. ret = rcar_du_encoders_init_one(rcdu, output, &ep);
  426. if (ret < 0) {
  427. if (ret == -EPROBE_DEFER) {
  428. of_node_put(ep_node);
  429. return ret;
  430. }
  431. continue;
  432. }
  433. num_encoders++;
  434. }
  435. return num_encoders;
  436. }
  437. static int rcar_du_properties_init(struct rcar_du_device *rcdu)
  438. {
  439. rcdu->props.alpha =
  440. drm_property_create_range(rcdu->ddev, 0, "alpha", 0, 255);
  441. if (rcdu->props.alpha == NULL)
  442. return -ENOMEM;
  443. /* The color key is expressed as an RGB888 triplet stored in a 32-bit
  444. * integer in XRGB8888 format. Bit 24 is used as a flag to disable (0)
  445. * or enable source color keying (1).
  446. */
  447. rcdu->props.colorkey =
  448. drm_property_create_range(rcdu->ddev, 0, "colorkey",
  449. 0, 0x01ffffff);
  450. if (rcdu->props.colorkey == NULL)
  451. return -ENOMEM;
  452. rcdu->props.zpos =
  453. drm_property_create_range(rcdu->ddev, 0, "zpos", 1, 7);
  454. if (rcdu->props.zpos == NULL)
  455. return -ENOMEM;
  456. return 0;
  457. }
  458. int rcar_du_modeset_init(struct rcar_du_device *rcdu)
  459. {
  460. static const unsigned int mmio_offsets[] = {
  461. DU0_REG_OFFSET, DU2_REG_OFFSET
  462. };
  463. struct drm_device *dev = rcdu->ddev;
  464. struct drm_encoder *encoder;
  465. struct drm_fbdev_cma *fbdev;
  466. unsigned int num_encoders;
  467. unsigned int num_groups;
  468. unsigned int i;
  469. int ret;
  470. drm_mode_config_init(dev);
  471. dev->mode_config.min_width = 0;
  472. dev->mode_config.min_height = 0;
  473. dev->mode_config.max_width = 4095;
  474. dev->mode_config.max_height = 2047;
  475. dev->mode_config.funcs = &rcar_du_mode_config_funcs;
  476. rcdu->num_crtcs = rcdu->info->num_crtcs;
  477. ret = rcar_du_properties_init(rcdu);
  478. if (ret < 0)
  479. return ret;
  480. /* Initialize the groups. */
  481. num_groups = DIV_ROUND_UP(rcdu->num_crtcs, 2);
  482. for (i = 0; i < num_groups; ++i) {
  483. struct rcar_du_group *rgrp = &rcdu->groups[i];
  484. mutex_init(&rgrp->lock);
  485. rgrp->dev = rcdu;
  486. rgrp->mmio_offset = mmio_offsets[i];
  487. rgrp->index = i;
  488. rgrp->num_crtcs = min(rcdu->num_crtcs - 2 * i, 2U);
  489. /* If we have more than one CRTCs in this group pre-associate
  490. * the low-order planes with CRTC 0 and the high-order planes
  491. * with CRTC 1 to minimize flicker occurring when the
  492. * association is changed.
  493. */
  494. rgrp->dptsr_planes = rgrp->num_crtcs > 1
  495. ? (rcdu->info->gen >= 3 ? 0x04 : 0xf0)
  496. : 0;
  497. if (!rcar_du_has(rcdu, RCAR_DU_FEATURE_VSP1_SOURCE)) {
  498. ret = rcar_du_planes_init(rgrp);
  499. if (ret < 0)
  500. return ret;
  501. }
  502. }
  503. /* Initialize the compositors. */
  504. if (rcar_du_has(rcdu, RCAR_DU_FEATURE_VSP1_SOURCE)) {
  505. for (i = 0; i < rcdu->num_crtcs; ++i) {
  506. struct rcar_du_vsp *vsp = &rcdu->vsps[i];
  507. vsp->index = i;
  508. vsp->dev = rcdu;
  509. rcdu->crtcs[i].vsp = vsp;
  510. ret = rcar_du_vsp_init(vsp);
  511. if (ret < 0)
  512. return ret;
  513. }
  514. }
  515. /* Create the CRTCs. */
  516. for (i = 0; i < rcdu->num_crtcs; ++i) {
  517. struct rcar_du_group *rgrp = &rcdu->groups[i / 2];
  518. ret = rcar_du_crtc_create(rgrp, i);
  519. if (ret < 0)
  520. return ret;
  521. }
  522. /* Initialize the encoders. */
  523. ret = rcar_du_lvdsenc_init(rcdu);
  524. if (ret < 0)
  525. return ret;
  526. ret = rcar_du_encoders_init(rcdu);
  527. if (ret < 0)
  528. return ret;
  529. if (ret == 0) {
  530. dev_err(rcdu->dev, "error: no encoder could be initialized\n");
  531. return -EINVAL;
  532. }
  533. num_encoders = ret;
  534. /* Set the possible CRTCs and possible clones. There's always at least
  535. * one way for all encoders to clone each other, set all bits in the
  536. * possible clones field.
  537. */
  538. list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
  539. struct rcar_du_encoder *renc = to_rcar_encoder(encoder);
  540. const struct rcar_du_output_routing *route =
  541. &rcdu->info->routes[renc->output];
  542. encoder->possible_crtcs = route->possible_crtcs;
  543. encoder->possible_clones = (1 << num_encoders) - 1;
  544. }
  545. drm_mode_config_reset(dev);
  546. drm_kms_helper_poll_init(dev);
  547. if (dev->mode_config.num_connector) {
  548. fbdev = drm_fbdev_cma_init(dev, 32, dev->mode_config.num_crtc,
  549. dev->mode_config.num_connector);
  550. if (IS_ERR(fbdev))
  551. return PTR_ERR(fbdev);
  552. rcdu->fbdev = fbdev;
  553. } else {
  554. dev_info(rcdu->dev,
  555. "no connector found, disabling fbdev emulation\n");
  556. }
  557. return 0;
  558. }