mdp4_kms.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. /*
  2. * Copyright (C) 2013 Red Hat
  3. * Author: Rob Clark <robdclark@gmail.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License version 2 as published by
  7. * the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #include "msm_drv.h"
  18. #include "msm_mmu.h"
  19. #include "mdp4_kms.h"
  20. static struct mdp4_platform_config *mdp4_get_config(struct platform_device *dev);
  21. static int mdp4_hw_init(struct msm_kms *kms)
  22. {
  23. struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
  24. struct drm_device *dev = mdp4_kms->dev;
  25. uint32_t version, major, minor, dmap_cfg, vg_cfg;
  26. unsigned long clk;
  27. int ret = 0;
  28. pm_runtime_get_sync(dev->dev);
  29. mdp4_enable(mdp4_kms);
  30. version = mdp4_read(mdp4_kms, REG_MDP4_VERSION);
  31. mdp4_disable(mdp4_kms);
  32. major = FIELD(version, MDP4_VERSION_MAJOR);
  33. minor = FIELD(version, MDP4_VERSION_MINOR);
  34. DBG("found MDP4 version v%d.%d", major, minor);
  35. if (major != 4) {
  36. dev_err(dev->dev, "unexpected MDP version: v%d.%d\n",
  37. major, minor);
  38. ret = -ENXIO;
  39. goto out;
  40. }
  41. mdp4_kms->rev = minor;
  42. if (mdp4_kms->rev > 1) {
  43. mdp4_write(mdp4_kms, REG_MDP4_CS_CONTROLLER0, 0x0707ffff);
  44. mdp4_write(mdp4_kms, REG_MDP4_CS_CONTROLLER1, 0x03073f3f);
  45. }
  46. mdp4_write(mdp4_kms, REG_MDP4_PORTMAP_MODE, 0x3);
  47. /* max read pending cmd config, 3 pending requests: */
  48. mdp4_write(mdp4_kms, REG_MDP4_READ_CNFG, 0x02222);
  49. clk = clk_get_rate(mdp4_kms->clk);
  50. if ((mdp4_kms->rev >= 1) || (clk >= 90000000)) {
  51. dmap_cfg = 0x47; /* 16 bytes-burst x 8 req */
  52. vg_cfg = 0x47; /* 16 bytes-burs x 8 req */
  53. } else {
  54. dmap_cfg = 0x27; /* 8 bytes-burst x 8 req */
  55. vg_cfg = 0x43; /* 16 bytes-burst x 4 req */
  56. }
  57. DBG("fetch config: dmap=%02x, vg=%02x", dmap_cfg, vg_cfg);
  58. mdp4_write(mdp4_kms, REG_MDP4_DMA_FETCH_CONFIG(DMA_P), dmap_cfg);
  59. mdp4_write(mdp4_kms, REG_MDP4_DMA_FETCH_CONFIG(DMA_E), dmap_cfg);
  60. mdp4_write(mdp4_kms, REG_MDP4_PIPE_FETCH_CONFIG(VG1), vg_cfg);
  61. mdp4_write(mdp4_kms, REG_MDP4_PIPE_FETCH_CONFIG(VG2), vg_cfg);
  62. mdp4_write(mdp4_kms, REG_MDP4_PIPE_FETCH_CONFIG(RGB1), vg_cfg);
  63. mdp4_write(mdp4_kms, REG_MDP4_PIPE_FETCH_CONFIG(RGB2), vg_cfg);
  64. if (mdp4_kms->rev >= 2)
  65. mdp4_write(mdp4_kms, REG_MDP4_LAYERMIXER_IN_CFG_UPDATE_METHOD, 1);
  66. mdp4_write(mdp4_kms, REG_MDP4_LAYERMIXER_IN_CFG, 0);
  67. /* disable CSC matrix / YUV by default: */
  68. mdp4_write(mdp4_kms, REG_MDP4_PIPE_OP_MODE(VG1), 0);
  69. mdp4_write(mdp4_kms, REG_MDP4_PIPE_OP_MODE(VG2), 0);
  70. mdp4_write(mdp4_kms, REG_MDP4_DMA_P_OP_MODE, 0);
  71. mdp4_write(mdp4_kms, REG_MDP4_DMA_S_OP_MODE, 0);
  72. mdp4_write(mdp4_kms, REG_MDP4_OVLP_CSC_CONFIG(1), 0);
  73. mdp4_write(mdp4_kms, REG_MDP4_OVLP_CSC_CONFIG(2), 0);
  74. if (mdp4_kms->rev > 1)
  75. mdp4_write(mdp4_kms, REG_MDP4_RESET_STATUS, 1);
  76. dev->mode_config.allow_fb_modifiers = true;
  77. out:
  78. pm_runtime_put_sync(dev->dev);
  79. return ret;
  80. }
  81. static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *state)
  82. {
  83. struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
  84. int i;
  85. struct drm_crtc *crtc;
  86. struct drm_crtc_state *crtc_state;
  87. mdp4_enable(mdp4_kms);
  88. /* see 119ecb7fd */
  89. for_each_crtc_in_state(state, crtc, crtc_state, i)
  90. drm_crtc_vblank_get(crtc);
  91. }
  92. static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *state)
  93. {
  94. struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
  95. int i;
  96. struct drm_crtc *crtc;
  97. struct drm_crtc_state *crtc_state;
  98. /* see 119ecb7fd */
  99. for_each_crtc_in_state(state, crtc, crtc_state, i)
  100. drm_crtc_vblank_put(crtc);
  101. mdp4_disable(mdp4_kms);
  102. }
  103. static void mdp4_wait_for_crtc_commit_done(struct msm_kms *kms,
  104. struct drm_crtc *crtc)
  105. {
  106. mdp4_crtc_wait_for_commit_done(crtc);
  107. }
  108. static long mdp4_round_pixclk(struct msm_kms *kms, unsigned long rate,
  109. struct drm_encoder *encoder)
  110. {
  111. /* if we had >1 encoder, we'd need something more clever: */
  112. switch (encoder->encoder_type) {
  113. case DRM_MODE_ENCODER_TMDS:
  114. return mdp4_dtv_round_pixclk(encoder, rate);
  115. case DRM_MODE_ENCODER_LVDS:
  116. case DRM_MODE_ENCODER_DSI:
  117. default:
  118. return rate;
  119. }
  120. }
  121. static const char * const iommu_ports[] = {
  122. "mdp_port0_cb0", "mdp_port1_cb0",
  123. };
  124. static void mdp4_destroy(struct msm_kms *kms)
  125. {
  126. struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
  127. struct msm_mmu *mmu = mdp4_kms->mmu;
  128. if (mmu) {
  129. mmu->funcs->detach(mmu, iommu_ports, ARRAY_SIZE(iommu_ports));
  130. mmu->funcs->destroy(mmu);
  131. }
  132. if (mdp4_kms->blank_cursor_iova)
  133. msm_gem_put_iova(mdp4_kms->blank_cursor_bo, mdp4_kms->id);
  134. if (mdp4_kms->blank_cursor_bo)
  135. drm_gem_object_unreference_unlocked(mdp4_kms->blank_cursor_bo);
  136. kfree(mdp4_kms);
  137. }
  138. static const struct mdp_kms_funcs kms_funcs = {
  139. .base = {
  140. .hw_init = mdp4_hw_init,
  141. .irq_preinstall = mdp4_irq_preinstall,
  142. .irq_postinstall = mdp4_irq_postinstall,
  143. .irq_uninstall = mdp4_irq_uninstall,
  144. .irq = mdp4_irq,
  145. .enable_vblank = mdp4_enable_vblank,
  146. .disable_vblank = mdp4_disable_vblank,
  147. .prepare_commit = mdp4_prepare_commit,
  148. .complete_commit = mdp4_complete_commit,
  149. .wait_for_crtc_commit_done = mdp4_wait_for_crtc_commit_done,
  150. .get_format = mdp_get_format,
  151. .round_pixclk = mdp4_round_pixclk,
  152. .destroy = mdp4_destroy,
  153. },
  154. .set_irqmask = mdp4_set_irqmask,
  155. };
  156. int mdp4_disable(struct mdp4_kms *mdp4_kms)
  157. {
  158. DBG("");
  159. clk_disable_unprepare(mdp4_kms->clk);
  160. if (mdp4_kms->pclk)
  161. clk_disable_unprepare(mdp4_kms->pclk);
  162. clk_disable_unprepare(mdp4_kms->lut_clk);
  163. if (mdp4_kms->axi_clk)
  164. clk_disable_unprepare(mdp4_kms->axi_clk);
  165. return 0;
  166. }
  167. int mdp4_enable(struct mdp4_kms *mdp4_kms)
  168. {
  169. DBG("");
  170. clk_prepare_enable(mdp4_kms->clk);
  171. if (mdp4_kms->pclk)
  172. clk_prepare_enable(mdp4_kms->pclk);
  173. clk_prepare_enable(mdp4_kms->lut_clk);
  174. if (mdp4_kms->axi_clk)
  175. clk_prepare_enable(mdp4_kms->axi_clk);
  176. return 0;
  177. }
  178. static struct device_node *mdp4_detect_lcdc_panel(struct drm_device *dev)
  179. {
  180. struct device_node *endpoint, *panel_node;
  181. struct device_node *np = dev->dev->of_node;
  182. endpoint = of_graph_get_next_endpoint(np, NULL);
  183. if (!endpoint) {
  184. DBG("no endpoint in MDP4 to fetch LVDS panel\n");
  185. return NULL;
  186. }
  187. /* don't proceed if we have an endpoint but no panel_node tied to it */
  188. panel_node = of_graph_get_remote_port_parent(endpoint);
  189. if (!panel_node) {
  190. dev_err(dev->dev, "no valid panel node\n");
  191. of_node_put(endpoint);
  192. return ERR_PTR(-ENODEV);
  193. }
  194. of_node_put(endpoint);
  195. return panel_node;
  196. }
  197. static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms,
  198. int intf_type)
  199. {
  200. struct drm_device *dev = mdp4_kms->dev;
  201. struct msm_drm_private *priv = dev->dev_private;
  202. struct drm_encoder *encoder;
  203. struct drm_connector *connector;
  204. struct device_node *panel_node;
  205. struct drm_encoder *dsi_encs[MSM_DSI_ENCODER_NUM];
  206. int i, dsi_id;
  207. int ret;
  208. switch (intf_type) {
  209. case DRM_MODE_ENCODER_LVDS:
  210. /*
  211. * bail out early if:
  212. * - there is no panel node (no need to initialize lcdc
  213. * encoder and lvds connector), or
  214. * - panel node is a bad pointer
  215. */
  216. panel_node = mdp4_detect_lcdc_panel(dev);
  217. if (IS_ERR_OR_NULL(panel_node))
  218. return PTR_ERR(panel_node);
  219. encoder = mdp4_lcdc_encoder_init(dev, panel_node);
  220. if (IS_ERR(encoder)) {
  221. dev_err(dev->dev, "failed to construct LCDC encoder\n");
  222. return PTR_ERR(encoder);
  223. }
  224. /* LCDC can be hooked to DMA_P (TODO: Add DMA_S later?) */
  225. encoder->possible_crtcs = 1 << DMA_P;
  226. connector = mdp4_lvds_connector_init(dev, panel_node, encoder);
  227. if (IS_ERR(connector)) {
  228. dev_err(dev->dev, "failed to initialize LVDS connector\n");
  229. return PTR_ERR(connector);
  230. }
  231. priv->encoders[priv->num_encoders++] = encoder;
  232. priv->connectors[priv->num_connectors++] = connector;
  233. break;
  234. case DRM_MODE_ENCODER_TMDS:
  235. encoder = mdp4_dtv_encoder_init(dev);
  236. if (IS_ERR(encoder)) {
  237. dev_err(dev->dev, "failed to construct DTV encoder\n");
  238. return PTR_ERR(encoder);
  239. }
  240. /* DTV can be hooked to DMA_E: */
  241. encoder->possible_crtcs = 1 << 1;
  242. if (priv->hdmi) {
  243. /* Construct bridge/connector for HDMI: */
  244. ret = msm_hdmi_modeset_init(priv->hdmi, dev, encoder);
  245. if (ret) {
  246. dev_err(dev->dev, "failed to initialize HDMI: %d\n", ret);
  247. return ret;
  248. }
  249. }
  250. priv->encoders[priv->num_encoders++] = encoder;
  251. break;
  252. case DRM_MODE_ENCODER_DSI:
  253. /* only DSI1 supported for now */
  254. dsi_id = 0;
  255. if (!priv->dsi[dsi_id])
  256. break;
  257. for (i = 0; i < MSM_DSI_ENCODER_NUM; i++) {
  258. dsi_encs[i] = mdp4_dsi_encoder_init(dev);
  259. if (IS_ERR(dsi_encs[i])) {
  260. ret = PTR_ERR(dsi_encs[i]);
  261. dev_err(dev->dev,
  262. "failed to construct DSI encoder: %d\n",
  263. ret);
  264. return ret;
  265. }
  266. /* TODO: Add DMA_S later? */
  267. dsi_encs[i]->possible_crtcs = 1 << DMA_P;
  268. priv->encoders[priv->num_encoders++] = dsi_encs[i];
  269. }
  270. ret = msm_dsi_modeset_init(priv->dsi[dsi_id], dev, dsi_encs);
  271. if (ret) {
  272. dev_err(dev->dev, "failed to initialize DSI: %d\n",
  273. ret);
  274. return ret;
  275. }
  276. break;
  277. default:
  278. dev_err(dev->dev, "Invalid or unsupported interface\n");
  279. return -EINVAL;
  280. }
  281. return 0;
  282. }
  283. static int modeset_init(struct mdp4_kms *mdp4_kms)
  284. {
  285. struct drm_device *dev = mdp4_kms->dev;
  286. struct msm_drm_private *priv = dev->dev_private;
  287. struct drm_plane *plane;
  288. struct drm_crtc *crtc;
  289. int i, ret;
  290. static const enum mdp4_pipe rgb_planes[] = {
  291. RGB1, RGB2,
  292. };
  293. static const enum mdp4_pipe vg_planes[] = {
  294. VG1, VG2,
  295. };
  296. static const enum mdp4_dma mdp4_crtcs[] = {
  297. DMA_P, DMA_E,
  298. };
  299. static const char * const mdp4_crtc_names[] = {
  300. "DMA_P", "DMA_E",
  301. };
  302. static const int mdp4_intfs[] = {
  303. DRM_MODE_ENCODER_LVDS,
  304. DRM_MODE_ENCODER_DSI,
  305. DRM_MODE_ENCODER_TMDS,
  306. };
  307. /* construct non-private planes: */
  308. for (i = 0; i < ARRAY_SIZE(vg_planes); i++) {
  309. plane = mdp4_plane_init(dev, vg_planes[i], false);
  310. if (IS_ERR(plane)) {
  311. dev_err(dev->dev,
  312. "failed to construct plane for VG%d\n", i + 1);
  313. ret = PTR_ERR(plane);
  314. goto fail;
  315. }
  316. priv->planes[priv->num_planes++] = plane;
  317. }
  318. for (i = 0; i < ARRAY_SIZE(mdp4_crtcs); i++) {
  319. plane = mdp4_plane_init(dev, rgb_planes[i], true);
  320. if (IS_ERR(plane)) {
  321. dev_err(dev->dev,
  322. "failed to construct plane for RGB%d\n", i + 1);
  323. ret = PTR_ERR(plane);
  324. goto fail;
  325. }
  326. crtc = mdp4_crtc_init(dev, plane, priv->num_crtcs, i,
  327. mdp4_crtcs[i]);
  328. if (IS_ERR(crtc)) {
  329. dev_err(dev->dev, "failed to construct crtc for %s\n",
  330. mdp4_crtc_names[i]);
  331. ret = PTR_ERR(crtc);
  332. goto fail;
  333. }
  334. priv->crtcs[priv->num_crtcs++] = crtc;
  335. }
  336. /*
  337. * we currently set up two relatively fixed paths:
  338. *
  339. * LCDC/LVDS path: RGB1 -> DMA_P -> LCDC -> LVDS
  340. * or
  341. * DSI path: RGB1 -> DMA_P -> DSI1 -> DSI Panel
  342. *
  343. * DTV/HDMI path: RGB2 -> DMA_E -> DTV -> HDMI
  344. */
  345. for (i = 0; i < ARRAY_SIZE(mdp4_intfs); i++) {
  346. ret = mdp4_modeset_init_intf(mdp4_kms, mdp4_intfs[i]);
  347. if (ret) {
  348. dev_err(dev->dev, "failed to initialize intf: %d, %d\n",
  349. i, ret);
  350. goto fail;
  351. }
  352. }
  353. return 0;
  354. fail:
  355. return ret;
  356. }
  357. struct msm_kms *mdp4_kms_init(struct drm_device *dev)
  358. {
  359. struct platform_device *pdev = dev->platformdev;
  360. struct mdp4_platform_config *config = mdp4_get_config(pdev);
  361. struct mdp4_kms *mdp4_kms;
  362. struct msm_kms *kms = NULL;
  363. struct msm_mmu *mmu;
  364. int ret;
  365. mdp4_kms = kzalloc(sizeof(*mdp4_kms), GFP_KERNEL);
  366. if (!mdp4_kms) {
  367. dev_err(dev->dev, "failed to allocate kms\n");
  368. ret = -ENOMEM;
  369. goto fail;
  370. }
  371. mdp_kms_init(&mdp4_kms->base, &kms_funcs);
  372. kms = &mdp4_kms->base.base;
  373. mdp4_kms->dev = dev;
  374. mdp4_kms->mmio = msm_ioremap(pdev, NULL, "MDP4");
  375. if (IS_ERR(mdp4_kms->mmio)) {
  376. ret = PTR_ERR(mdp4_kms->mmio);
  377. goto fail;
  378. }
  379. /* NOTE: driver for this regulator still missing upstream.. use
  380. * _get_exclusive() and ignore the error if it does not exist
  381. * (and hope that the bootloader left it on for us)
  382. */
  383. mdp4_kms->vdd = devm_regulator_get_exclusive(&pdev->dev, "vdd");
  384. if (IS_ERR(mdp4_kms->vdd))
  385. mdp4_kms->vdd = NULL;
  386. if (mdp4_kms->vdd) {
  387. ret = regulator_enable(mdp4_kms->vdd);
  388. if (ret) {
  389. dev_err(dev->dev, "failed to enable regulator vdd: %d\n", ret);
  390. goto fail;
  391. }
  392. }
  393. mdp4_kms->clk = devm_clk_get(&pdev->dev, "core_clk");
  394. if (IS_ERR(mdp4_kms->clk)) {
  395. dev_err(dev->dev, "failed to get core_clk\n");
  396. ret = PTR_ERR(mdp4_kms->clk);
  397. goto fail;
  398. }
  399. mdp4_kms->pclk = devm_clk_get(&pdev->dev, "iface_clk");
  400. if (IS_ERR(mdp4_kms->pclk))
  401. mdp4_kms->pclk = NULL;
  402. // XXX if (rev >= MDP_REV_42) { ???
  403. mdp4_kms->lut_clk = devm_clk_get(&pdev->dev, "lut_clk");
  404. if (IS_ERR(mdp4_kms->lut_clk)) {
  405. dev_err(dev->dev, "failed to get lut_clk\n");
  406. ret = PTR_ERR(mdp4_kms->lut_clk);
  407. goto fail;
  408. }
  409. mdp4_kms->axi_clk = devm_clk_get(&pdev->dev, "mdp_axi_clk");
  410. if (IS_ERR(mdp4_kms->axi_clk)) {
  411. dev_err(dev->dev, "failed to get axi_clk\n");
  412. ret = PTR_ERR(mdp4_kms->axi_clk);
  413. goto fail;
  414. }
  415. clk_set_rate(mdp4_kms->clk, config->max_clk);
  416. clk_set_rate(mdp4_kms->lut_clk, config->max_clk);
  417. /* make sure things are off before attaching iommu (bootloader could
  418. * have left things on, in which case we'll start getting faults if
  419. * we don't disable):
  420. */
  421. mdp4_enable(mdp4_kms);
  422. mdp4_write(mdp4_kms, REG_MDP4_DTV_ENABLE, 0);
  423. mdp4_write(mdp4_kms, REG_MDP4_LCDC_ENABLE, 0);
  424. mdp4_write(mdp4_kms, REG_MDP4_DSI_ENABLE, 0);
  425. mdp4_disable(mdp4_kms);
  426. mdelay(16);
  427. if (config->iommu) {
  428. mmu = msm_iommu_new(&pdev->dev, config->iommu);
  429. if (IS_ERR(mmu)) {
  430. ret = PTR_ERR(mmu);
  431. goto fail;
  432. }
  433. ret = mmu->funcs->attach(mmu, iommu_ports,
  434. ARRAY_SIZE(iommu_ports));
  435. if (ret)
  436. goto fail;
  437. mdp4_kms->mmu = mmu;
  438. } else {
  439. dev_info(dev->dev, "no iommu, fallback to phys "
  440. "contig buffers for scanout\n");
  441. mmu = NULL;
  442. }
  443. mdp4_kms->id = msm_register_mmu(dev, mmu);
  444. if (mdp4_kms->id < 0) {
  445. ret = mdp4_kms->id;
  446. dev_err(dev->dev, "failed to register mdp4 iommu: %d\n", ret);
  447. goto fail;
  448. }
  449. ret = modeset_init(mdp4_kms);
  450. if (ret) {
  451. dev_err(dev->dev, "modeset_init failed: %d\n", ret);
  452. goto fail;
  453. }
  454. mutex_lock(&dev->struct_mutex);
  455. mdp4_kms->blank_cursor_bo = msm_gem_new(dev, SZ_16K, MSM_BO_WC);
  456. mutex_unlock(&dev->struct_mutex);
  457. if (IS_ERR(mdp4_kms->blank_cursor_bo)) {
  458. ret = PTR_ERR(mdp4_kms->blank_cursor_bo);
  459. dev_err(dev->dev, "could not allocate blank-cursor bo: %d\n", ret);
  460. mdp4_kms->blank_cursor_bo = NULL;
  461. goto fail;
  462. }
  463. ret = msm_gem_get_iova(mdp4_kms->blank_cursor_bo, mdp4_kms->id,
  464. &mdp4_kms->blank_cursor_iova);
  465. if (ret) {
  466. dev_err(dev->dev, "could not pin blank-cursor bo: %d\n", ret);
  467. goto fail;
  468. }
  469. dev->mode_config.min_width = 0;
  470. dev->mode_config.min_height = 0;
  471. dev->mode_config.max_width = 2048;
  472. dev->mode_config.max_height = 2048;
  473. return kms;
  474. fail:
  475. if (kms)
  476. mdp4_destroy(kms);
  477. return ERR_PTR(ret);
  478. }
  479. static struct mdp4_platform_config *mdp4_get_config(struct platform_device *dev)
  480. {
  481. static struct mdp4_platform_config config = {};
  482. /* TODO: Chips that aren't apq8064 have a 200 Mhz max_clk */
  483. config.max_clk = 266667000;
  484. config.iommu = iommu_domain_alloc(&platform_bus_type);
  485. return &config;
  486. }