oaktrail_hdmi.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. /*
  2. * Copyright © 2010 Intel Corporation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  21. * DEALINGS IN THE SOFTWARE.
  22. *
  23. * Authors:
  24. * Li Peng <peng.li@intel.com>
  25. */
  26. #include <drm/drmP.h>
  27. #include <drm/drm.h>
  28. #include "psb_intel_drv.h"
  29. #include "psb_intel_reg.h"
  30. #include "psb_drv.h"
  31. #define HDMI_READ(reg) readl(hdmi_dev->regs + (reg))
  32. #define HDMI_WRITE(reg, val) writel(val, hdmi_dev->regs + (reg))
  33. #define HDMI_HCR 0x1000
  34. #define HCR_ENABLE_HDCP (1 << 5)
  35. #define HCR_ENABLE_AUDIO (1 << 2)
  36. #define HCR_ENABLE_PIXEL (1 << 1)
  37. #define HCR_ENABLE_TMDS (1 << 0)
  38. #define HDMI_HICR 0x1004
  39. #define HDMI_HSR 0x1008
  40. #define HDMI_HISR 0x100C
  41. #define HDMI_DETECT_HDP (1 << 0)
  42. #define HDMI_VIDEO_REG 0x3000
  43. #define HDMI_UNIT_EN (1 << 7)
  44. #define HDMI_MODE_OUTPUT (1 << 0)
  45. #define HDMI_HBLANK_A 0x3100
  46. #define HDMI_AUDIO_CTRL 0x4000
  47. #define HDMI_ENABLE_AUDIO (1 << 0)
  48. #define PCH_HTOTAL_B 0x3100
  49. #define PCH_HBLANK_B 0x3104
  50. #define PCH_HSYNC_B 0x3108
  51. #define PCH_VTOTAL_B 0x310C
  52. #define PCH_VBLANK_B 0x3110
  53. #define PCH_VSYNC_B 0x3114
  54. #define PCH_PIPEBSRC 0x311C
  55. #define PCH_PIPEB_DSL 0x3800
  56. #define PCH_PIPEB_SLC 0x3804
  57. #define PCH_PIPEBCONF 0x3808
  58. #define PCH_PIPEBSTAT 0x3824
  59. #define CDVO_DFT 0x5000
  60. #define CDVO_SLEWRATE 0x5004
  61. #define CDVO_STRENGTH 0x5008
  62. #define CDVO_RCOMP 0x500C
  63. #define DPLL_CTRL 0x6000
  64. #define DPLL_PDIV_SHIFT 16
  65. #define DPLL_PDIV_MASK (0xf << 16)
  66. #define DPLL_PWRDN (1 << 4)
  67. #define DPLL_RESET (1 << 3)
  68. #define DPLL_FASTEN (1 << 2)
  69. #define DPLL_ENSTAT (1 << 1)
  70. #define DPLL_DITHEN (1 << 0)
  71. #define DPLL_DIV_CTRL 0x6004
  72. #define DPLL_CLKF_MASK 0xffffffc0
  73. #define DPLL_CLKR_MASK (0x3f)
  74. #define DPLL_CLK_ENABLE 0x6008
  75. #define DPLL_EN_DISP (1 << 31)
  76. #define DPLL_SEL_HDMI (1 << 8)
  77. #define DPLL_EN_HDMI (1 << 1)
  78. #define DPLL_EN_VGA (1 << 0)
  79. #define DPLL_ADJUST 0x600C
  80. #define DPLL_STATUS 0x6010
  81. #define DPLL_UPDATE 0x6014
  82. #define DPLL_DFT 0x6020
  83. struct intel_range {
  84. int min, max;
  85. };
  86. struct oaktrail_hdmi_limit {
  87. struct intel_range vco, np, nr, nf;
  88. };
  89. struct oaktrail_hdmi_clock {
  90. int np;
  91. int nr;
  92. int nf;
  93. int dot;
  94. };
  95. #define VCO_MIN 320000
  96. #define VCO_MAX 1650000
  97. #define NP_MIN 1
  98. #define NP_MAX 15
  99. #define NR_MIN 1
  100. #define NR_MAX 64
  101. #define NF_MIN 2
  102. #define NF_MAX 4095
  103. static const struct oaktrail_hdmi_limit oaktrail_hdmi_limit = {
  104. .vco = { .min = VCO_MIN, .max = VCO_MAX },
  105. .np = { .min = NP_MIN, .max = NP_MAX },
  106. .nr = { .min = NR_MIN, .max = NR_MAX },
  107. .nf = { .min = NF_MIN, .max = NF_MAX },
  108. };
  109. static void oaktrail_hdmi_audio_enable(struct drm_device *dev)
  110. {
  111. struct drm_psb_private *dev_priv = dev->dev_private;
  112. struct oaktrail_hdmi_dev *hdmi_dev = dev_priv->hdmi_priv;
  113. HDMI_WRITE(HDMI_HCR, 0x67);
  114. HDMI_READ(HDMI_HCR);
  115. HDMI_WRITE(0x51a8, 0x10);
  116. HDMI_READ(0x51a8);
  117. HDMI_WRITE(HDMI_AUDIO_CTRL, 0x1);
  118. HDMI_READ(HDMI_AUDIO_CTRL);
  119. }
  120. static void oaktrail_hdmi_audio_disable(struct drm_device *dev)
  121. {
  122. struct drm_psb_private *dev_priv = dev->dev_private;
  123. struct oaktrail_hdmi_dev *hdmi_dev = dev_priv->hdmi_priv;
  124. HDMI_WRITE(0x51a8, 0x0);
  125. HDMI_READ(0x51a8);
  126. HDMI_WRITE(HDMI_AUDIO_CTRL, 0x0);
  127. HDMI_READ(HDMI_AUDIO_CTRL);
  128. HDMI_WRITE(HDMI_HCR, 0x47);
  129. HDMI_READ(HDMI_HCR);
  130. }
  131. static void oaktrail_hdmi_dpms(struct drm_encoder *encoder, int mode)
  132. {
  133. static int dpms_mode = -1;
  134. struct drm_device *dev = encoder->dev;
  135. struct drm_psb_private *dev_priv = dev->dev_private;
  136. struct oaktrail_hdmi_dev *hdmi_dev = dev_priv->hdmi_priv;
  137. u32 temp;
  138. if (dpms_mode == mode)
  139. return;
  140. if (mode != DRM_MODE_DPMS_ON)
  141. temp = 0x0;
  142. else
  143. temp = 0x99;
  144. dpms_mode = mode;
  145. HDMI_WRITE(HDMI_VIDEO_REG, temp);
  146. }
  147. static int oaktrail_hdmi_mode_valid(struct drm_connector *connector,
  148. struct drm_display_mode *mode)
  149. {
  150. struct drm_psb_private *dev_priv = connector->dev->dev_private;
  151. if (mode->clock > 165000)
  152. return MODE_CLOCK_HIGH;
  153. if (mode->clock < 20000)
  154. return MODE_CLOCK_LOW;
  155. if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
  156. return MODE_NO_DBLESCAN;
  157. /* We assume worst case scenario of 32 bpp here, since we don't know */
  158. if ((ALIGN(mode->hdisplay * 4, 64) * mode->vdisplay) >
  159. dev_priv->vram_stolen_size)
  160. return MODE_MEM;
  161. return MODE_OK;
  162. }
  163. static bool oaktrail_hdmi_mode_fixup(struct drm_encoder *encoder,
  164. struct drm_display_mode *mode,
  165. struct drm_display_mode *adjusted_mode)
  166. {
  167. return true;
  168. }
  169. static enum drm_connector_status
  170. oaktrail_hdmi_detect(struct drm_connector *connector, bool force)
  171. {
  172. enum drm_connector_status status;
  173. struct drm_device *dev = connector->dev;
  174. struct drm_psb_private *dev_priv = dev->dev_private;
  175. struct oaktrail_hdmi_dev *hdmi_dev = dev_priv->hdmi_priv;
  176. u32 temp;
  177. temp = HDMI_READ(HDMI_HSR);
  178. DRM_DEBUG_KMS("HDMI_HSR %x\n", temp);
  179. if ((temp & HDMI_DETECT_HDP) != 0)
  180. status = connector_status_connected;
  181. else
  182. status = connector_status_disconnected;
  183. return status;
  184. }
  185. static const unsigned char raw_edid[] = {
  186. 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x10, 0xac, 0x2f, 0xa0,
  187. 0x53, 0x55, 0x33, 0x30, 0x16, 0x13, 0x01, 0x03, 0x0e, 0x3a, 0x24, 0x78,
  188. 0xea, 0xe9, 0xf5, 0xac, 0x51, 0x30, 0xb4, 0x25, 0x11, 0x50, 0x54, 0xa5,
  189. 0x4b, 0x00, 0x81, 0x80, 0xa9, 0x40, 0x71, 0x4f, 0xb3, 0x00, 0x01, 0x01,
  190. 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x28, 0x3c, 0x80, 0xa0, 0x70, 0xb0,
  191. 0x23, 0x40, 0x30, 0x20, 0x36, 0x00, 0x46, 0x6c, 0x21, 0x00, 0x00, 0x1a,
  192. 0x00, 0x00, 0x00, 0xff, 0x00, 0x47, 0x4e, 0x37, 0x32, 0x31, 0x39, 0x35,
  193. 0x52, 0x30, 0x33, 0x55, 0x53, 0x0a, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x44,
  194. 0x45, 0x4c, 0x4c, 0x20, 0x32, 0x37, 0x30, 0x39, 0x57, 0x0a, 0x20, 0x20,
  195. 0x00, 0x00, 0x00, 0xfd, 0x00, 0x38, 0x4c, 0x1e, 0x53, 0x11, 0x00, 0x0a,
  196. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x8d
  197. };
  198. static int oaktrail_hdmi_get_modes(struct drm_connector *connector)
  199. {
  200. struct drm_device *dev = connector->dev;
  201. struct drm_psb_private *dev_priv = dev->dev_private;
  202. struct i2c_adapter *i2c_adap;
  203. struct edid *edid;
  204. struct drm_display_mode *mode, *t;
  205. int i = 0, ret = 0;
  206. i2c_adap = i2c_get_adapter(3);
  207. if (i2c_adap == NULL) {
  208. DRM_ERROR("No ddc adapter available!\n");
  209. edid = (struct edid *)raw_edid;
  210. } else {
  211. edid = (struct edid *)raw_edid;
  212. /* FIXME ? edid = drm_get_edid(connector, i2c_adap); */
  213. }
  214. if (edid) {
  215. drm_mode_connector_update_edid_property(connector, edid);
  216. ret = drm_add_edid_modes(connector, edid);
  217. connector->display_info.raw_edid = NULL;
  218. }
  219. /*
  220. * prune modes that require frame buffer bigger than stolen mem
  221. */
  222. list_for_each_entry_safe(mode, t, &connector->probed_modes, head) {
  223. if ((mode->hdisplay * mode->vdisplay * 4) >= dev_priv->vram_stolen_size) {
  224. i++;
  225. drm_mode_remove(connector, mode);
  226. }
  227. }
  228. return ret - i;
  229. }
  230. static void oaktrail_hdmi_mode_set(struct drm_encoder *encoder,
  231. struct drm_display_mode *mode,
  232. struct drm_display_mode *adjusted_mode)
  233. {
  234. struct drm_device *dev = encoder->dev;
  235. oaktrail_hdmi_audio_enable(dev);
  236. return;
  237. }
  238. static void oaktrail_hdmi_destroy(struct drm_connector *connector)
  239. {
  240. return;
  241. }
  242. static const struct drm_encoder_helper_funcs oaktrail_hdmi_helper_funcs = {
  243. .dpms = oaktrail_hdmi_dpms,
  244. .mode_fixup = oaktrail_hdmi_mode_fixup,
  245. .prepare = psb_intel_encoder_prepare,
  246. .mode_set = oaktrail_hdmi_mode_set,
  247. .commit = psb_intel_encoder_commit,
  248. };
  249. static const struct drm_connector_helper_funcs
  250. oaktrail_hdmi_connector_helper_funcs = {
  251. .get_modes = oaktrail_hdmi_get_modes,
  252. .mode_valid = oaktrail_hdmi_mode_valid,
  253. .best_encoder = psb_intel_best_encoder,
  254. };
  255. static const struct drm_connector_funcs oaktrail_hdmi_connector_funcs = {
  256. .dpms = drm_helper_connector_dpms,
  257. .detect = oaktrail_hdmi_detect,
  258. .fill_modes = drm_helper_probe_single_connector_modes,
  259. .destroy = oaktrail_hdmi_destroy,
  260. };
  261. static void oaktrail_hdmi_enc_destroy(struct drm_encoder *encoder)
  262. {
  263. drm_encoder_cleanup(encoder);
  264. }
  265. static const struct drm_encoder_funcs oaktrail_hdmi_enc_funcs = {
  266. .destroy = oaktrail_hdmi_enc_destroy,
  267. };
  268. void oaktrail_hdmi_init(struct drm_device *dev,
  269. struct psb_intel_mode_device *mode_dev)
  270. {
  271. struct psb_intel_encoder *psb_intel_encoder;
  272. struct psb_intel_connector *psb_intel_connector;
  273. struct drm_connector *connector;
  274. struct drm_encoder *encoder;
  275. psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder), GFP_KERNEL);
  276. if (!psb_intel_encoder)
  277. return;
  278. psb_intel_connector = kzalloc(sizeof(struct psb_intel_connector), GFP_KERNEL);
  279. if (!psb_intel_connector)
  280. goto failed_connector;
  281. connector = &psb_intel_connector->base;
  282. encoder = &psb_intel_encoder->base;
  283. drm_connector_init(dev, connector,
  284. &oaktrail_hdmi_connector_funcs,
  285. DRM_MODE_CONNECTOR_DVID);
  286. drm_encoder_init(dev, encoder,
  287. &oaktrail_hdmi_enc_funcs,
  288. DRM_MODE_ENCODER_TMDS);
  289. psb_intel_connector_attach_encoder(psb_intel_connector,
  290. psb_intel_encoder);
  291. psb_intel_encoder->type = INTEL_OUTPUT_HDMI;
  292. drm_encoder_helper_add(encoder, &oaktrail_hdmi_helper_funcs);
  293. drm_connector_helper_add(connector, &oaktrail_hdmi_connector_helper_funcs);
  294. connector->display_info.subpixel_order = SubPixelHorizontalRGB;
  295. connector->interlace_allowed = false;
  296. connector->doublescan_allowed = false;
  297. drm_sysfs_connector_add(connector);
  298. return;
  299. failed_connector:
  300. kfree(psb_intel_encoder);
  301. }
  302. static DEFINE_PCI_DEVICE_TABLE(hdmi_ids) = {
  303. { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080d) },
  304. { 0 }
  305. };
  306. void oaktrail_hdmi_setup(struct drm_device *dev)
  307. {
  308. struct drm_psb_private *dev_priv = dev->dev_private;
  309. struct pci_dev *pdev;
  310. struct oaktrail_hdmi_dev *hdmi_dev;
  311. int ret;
  312. pdev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x080d, NULL);
  313. if (!pdev)
  314. return;
  315. hdmi_dev = kzalloc(sizeof(struct oaktrail_hdmi_dev), GFP_KERNEL);
  316. if (!hdmi_dev) {
  317. dev_err(dev->dev, "failed to allocate memory\n");
  318. goto out;
  319. }
  320. ret = pci_enable_device(pdev);
  321. if (ret) {
  322. dev_err(dev->dev, "failed to enable hdmi controller\n");
  323. goto free;
  324. }
  325. hdmi_dev->mmio = pci_resource_start(pdev, 0);
  326. hdmi_dev->mmio_len = pci_resource_len(pdev, 0);
  327. hdmi_dev->regs = ioremap(hdmi_dev->mmio, hdmi_dev->mmio_len);
  328. if (!hdmi_dev->regs) {
  329. dev_err(dev->dev, "failed to map hdmi mmio\n");
  330. goto free;
  331. }
  332. hdmi_dev->dev = pdev;
  333. pci_set_drvdata(pdev, hdmi_dev);
  334. /* Initialize i2c controller */
  335. ret = oaktrail_hdmi_i2c_init(hdmi_dev->dev);
  336. if (ret)
  337. dev_err(dev->dev, "HDMI I2C initialization failed\n");
  338. dev_priv->hdmi_priv = hdmi_dev;
  339. oaktrail_hdmi_audio_disable(dev);
  340. return;
  341. free:
  342. kfree(hdmi_dev);
  343. out:
  344. return;
  345. }
  346. void oaktrail_hdmi_teardown(struct drm_device *dev)
  347. {
  348. struct drm_psb_private *dev_priv = dev->dev_private;
  349. struct oaktrail_hdmi_dev *hdmi_dev = dev_priv->hdmi_priv;
  350. struct pci_dev *pdev;
  351. if (hdmi_dev) {
  352. pdev = hdmi_dev->dev;
  353. pci_set_drvdata(pdev, NULL);
  354. oaktrail_hdmi_i2c_exit(pdev);
  355. iounmap(hdmi_dev->regs);
  356. kfree(hdmi_dev);
  357. pci_dev_put(pdev);
  358. }
  359. }
  360. /* save HDMI register state */
  361. void oaktrail_hdmi_save(struct drm_device *dev)
  362. {
  363. struct drm_psb_private *dev_priv = dev->dev_private;
  364. struct oaktrail_hdmi_dev *hdmi_dev = dev_priv->hdmi_priv;
  365. struct psb_state *regs = &dev_priv->regs.psb;
  366. int i;
  367. /* dpll */
  368. hdmi_dev->saveDPLL_CTRL = PSB_RVDC32(DPLL_CTRL);
  369. hdmi_dev->saveDPLL_DIV_CTRL = PSB_RVDC32(DPLL_DIV_CTRL);
  370. hdmi_dev->saveDPLL_ADJUST = PSB_RVDC32(DPLL_ADJUST);
  371. hdmi_dev->saveDPLL_UPDATE = PSB_RVDC32(DPLL_UPDATE);
  372. hdmi_dev->saveDPLL_CLK_ENABLE = PSB_RVDC32(DPLL_CLK_ENABLE);
  373. /* pipe B */
  374. regs->savePIPEBCONF = PSB_RVDC32(PIPEBCONF);
  375. regs->savePIPEBSRC = PSB_RVDC32(PIPEBSRC);
  376. regs->saveHTOTAL_B = PSB_RVDC32(HTOTAL_B);
  377. regs->saveHBLANK_B = PSB_RVDC32(HBLANK_B);
  378. regs->saveHSYNC_B = PSB_RVDC32(HSYNC_B);
  379. regs->saveVTOTAL_B = PSB_RVDC32(VTOTAL_B);
  380. regs->saveVBLANK_B = PSB_RVDC32(VBLANK_B);
  381. regs->saveVSYNC_B = PSB_RVDC32(VSYNC_B);
  382. hdmi_dev->savePCH_PIPEBCONF = PSB_RVDC32(PCH_PIPEBCONF);
  383. hdmi_dev->savePCH_PIPEBSRC = PSB_RVDC32(PCH_PIPEBSRC);
  384. hdmi_dev->savePCH_HTOTAL_B = PSB_RVDC32(PCH_HTOTAL_B);
  385. hdmi_dev->savePCH_HBLANK_B = PSB_RVDC32(PCH_HBLANK_B);
  386. hdmi_dev->savePCH_HSYNC_B = PSB_RVDC32(PCH_HSYNC_B);
  387. hdmi_dev->savePCH_VTOTAL_B = PSB_RVDC32(PCH_VTOTAL_B);
  388. hdmi_dev->savePCH_VBLANK_B = PSB_RVDC32(PCH_VBLANK_B);
  389. hdmi_dev->savePCH_VSYNC_B = PSB_RVDC32(PCH_VSYNC_B);
  390. /* plane */
  391. regs->saveDSPBCNTR = PSB_RVDC32(DSPBCNTR);
  392. regs->saveDSPBSTRIDE = PSB_RVDC32(DSPBSTRIDE);
  393. regs->saveDSPBADDR = PSB_RVDC32(DSPBBASE);
  394. regs->saveDSPBSURF = PSB_RVDC32(DSPBSURF);
  395. regs->saveDSPBLINOFF = PSB_RVDC32(DSPBLINOFF);
  396. regs->saveDSPBTILEOFF = PSB_RVDC32(DSPBTILEOFF);
  397. /* cursor B */
  398. regs->saveDSPBCURSOR_CTRL = PSB_RVDC32(CURBCNTR);
  399. regs->saveDSPBCURSOR_BASE = PSB_RVDC32(CURBBASE);
  400. regs->saveDSPBCURSOR_POS = PSB_RVDC32(CURBPOS);
  401. /* save palette */
  402. for (i = 0; i < 256; i++)
  403. regs->save_palette_b[i] = PSB_RVDC32(PALETTE_B + (i << 2));
  404. }
  405. /* restore HDMI register state */
  406. void oaktrail_hdmi_restore(struct drm_device *dev)
  407. {
  408. struct drm_psb_private *dev_priv = dev->dev_private;
  409. struct oaktrail_hdmi_dev *hdmi_dev = dev_priv->hdmi_priv;
  410. struct psb_state *regs = &dev_priv->regs.psb;
  411. int i;
  412. /* dpll */
  413. PSB_WVDC32(hdmi_dev->saveDPLL_CTRL, DPLL_CTRL);
  414. PSB_WVDC32(hdmi_dev->saveDPLL_DIV_CTRL, DPLL_DIV_CTRL);
  415. PSB_WVDC32(hdmi_dev->saveDPLL_ADJUST, DPLL_ADJUST);
  416. PSB_WVDC32(hdmi_dev->saveDPLL_UPDATE, DPLL_UPDATE);
  417. PSB_WVDC32(hdmi_dev->saveDPLL_CLK_ENABLE, DPLL_CLK_ENABLE);
  418. DRM_UDELAY(150);
  419. /* pipe */
  420. PSB_WVDC32(regs->savePIPEBSRC, PIPEBSRC);
  421. PSB_WVDC32(regs->saveHTOTAL_B, HTOTAL_B);
  422. PSB_WVDC32(regs->saveHBLANK_B, HBLANK_B);
  423. PSB_WVDC32(regs->saveHSYNC_B, HSYNC_B);
  424. PSB_WVDC32(regs->saveVTOTAL_B, VTOTAL_B);
  425. PSB_WVDC32(regs->saveVBLANK_B, VBLANK_B);
  426. PSB_WVDC32(regs->saveVSYNC_B, VSYNC_B);
  427. PSB_WVDC32(hdmi_dev->savePCH_PIPEBSRC, PCH_PIPEBSRC);
  428. PSB_WVDC32(hdmi_dev->savePCH_HTOTAL_B, PCH_HTOTAL_B);
  429. PSB_WVDC32(hdmi_dev->savePCH_HBLANK_B, PCH_HBLANK_B);
  430. PSB_WVDC32(hdmi_dev->savePCH_HSYNC_B, PCH_HSYNC_B);
  431. PSB_WVDC32(hdmi_dev->savePCH_VTOTAL_B, PCH_VTOTAL_B);
  432. PSB_WVDC32(hdmi_dev->savePCH_VBLANK_B, PCH_VBLANK_B);
  433. PSB_WVDC32(hdmi_dev->savePCH_VSYNC_B, PCH_VSYNC_B);
  434. PSB_WVDC32(regs->savePIPEBCONF, PIPEBCONF);
  435. PSB_WVDC32(hdmi_dev->savePCH_PIPEBCONF, PCH_PIPEBCONF);
  436. /* plane */
  437. PSB_WVDC32(regs->saveDSPBLINOFF, DSPBLINOFF);
  438. PSB_WVDC32(regs->saveDSPBSTRIDE, DSPBSTRIDE);
  439. PSB_WVDC32(regs->saveDSPBTILEOFF, DSPBTILEOFF);
  440. PSB_WVDC32(regs->saveDSPBCNTR, DSPBCNTR);
  441. PSB_WVDC32(regs->saveDSPBSURF, DSPBSURF);
  442. /* cursor B */
  443. PSB_WVDC32(regs->saveDSPBCURSOR_CTRL, CURBCNTR);
  444. PSB_WVDC32(regs->saveDSPBCURSOR_POS, CURBPOS);
  445. PSB_WVDC32(regs->saveDSPBCURSOR_BASE, CURBBASE);
  446. /* restore palette */
  447. for (i = 0; i < 256; i++)
  448. PSB_WVDC32(regs->save_palette_b[i], PALETTE_B + (i << 2));
  449. }