intel_crt.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. /*
  2. * Copyright © 2006-2007 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. * Eric Anholt <eric@anholt.net>
  25. */
  26. #include <linux/i2c.h>
  27. #include <linux/slab.h>
  28. #include "drmP.h"
  29. #include "drm.h"
  30. #include "drm_crtc.h"
  31. #include "drm_crtc_helper.h"
  32. #include "intel_drv.h"
  33. #include "i915_drm.h"
  34. #include "i915_drv.h"
  35. /* Here's the desired hotplug mode */
  36. #define ADPA_HOTPLUG_BITS (ADPA_CRT_HOTPLUG_PERIOD_128 | \
  37. ADPA_CRT_HOTPLUG_WARMUP_10MS | \
  38. ADPA_CRT_HOTPLUG_SAMPLE_4S | \
  39. ADPA_CRT_HOTPLUG_VOLTAGE_50 | \
  40. ADPA_CRT_HOTPLUG_VOLREF_325MV | \
  41. ADPA_CRT_HOTPLUG_ENABLE)
  42. struct intel_crt {
  43. struct intel_encoder base;
  44. bool force_hotplug_required;
  45. };
  46. static struct intel_crt *intel_attached_crt(struct drm_connector *connector)
  47. {
  48. return container_of(intel_attached_encoder(connector),
  49. struct intel_crt, base);
  50. }
  51. static void intel_crt_dpms(struct drm_encoder *encoder, int mode)
  52. {
  53. struct drm_device *dev = encoder->dev;
  54. struct drm_i915_private *dev_priv = dev->dev_private;
  55. u32 temp, reg;
  56. if (HAS_PCH_SPLIT(dev))
  57. reg = PCH_ADPA;
  58. else
  59. reg = ADPA;
  60. temp = I915_READ(reg);
  61. temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE);
  62. temp &= ~ADPA_DAC_ENABLE;
  63. switch(mode) {
  64. case DRM_MODE_DPMS_ON:
  65. temp |= ADPA_DAC_ENABLE;
  66. break;
  67. case DRM_MODE_DPMS_STANDBY:
  68. temp |= ADPA_DAC_ENABLE | ADPA_HSYNC_CNTL_DISABLE;
  69. break;
  70. case DRM_MODE_DPMS_SUSPEND:
  71. temp |= ADPA_DAC_ENABLE | ADPA_VSYNC_CNTL_DISABLE;
  72. break;
  73. case DRM_MODE_DPMS_OFF:
  74. temp |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE;
  75. break;
  76. }
  77. I915_WRITE(reg, temp);
  78. }
  79. static int intel_crt_mode_valid(struct drm_connector *connector,
  80. struct drm_display_mode *mode)
  81. {
  82. struct drm_device *dev = connector->dev;
  83. int max_clock = 0;
  84. if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
  85. return MODE_NO_DBLESCAN;
  86. if (mode->clock < 25000)
  87. return MODE_CLOCK_LOW;
  88. if (IS_GEN2(dev))
  89. max_clock = 350000;
  90. else
  91. max_clock = 400000;
  92. if (mode->clock > max_clock)
  93. return MODE_CLOCK_HIGH;
  94. return MODE_OK;
  95. }
  96. static bool intel_crt_mode_fixup(struct drm_encoder *encoder,
  97. struct drm_display_mode *mode,
  98. struct drm_display_mode *adjusted_mode)
  99. {
  100. return true;
  101. }
  102. static void intel_crt_mode_set(struct drm_encoder *encoder,
  103. struct drm_display_mode *mode,
  104. struct drm_display_mode *adjusted_mode)
  105. {
  106. struct drm_device *dev = encoder->dev;
  107. struct drm_crtc *crtc = encoder->crtc;
  108. struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
  109. struct drm_i915_private *dev_priv = dev->dev_private;
  110. int dpll_md_reg;
  111. u32 adpa, dpll_md;
  112. u32 adpa_reg;
  113. if (intel_crtc->pipe == 0)
  114. dpll_md_reg = DPLL_A_MD;
  115. else
  116. dpll_md_reg = DPLL_B_MD;
  117. if (HAS_PCH_SPLIT(dev))
  118. adpa_reg = PCH_ADPA;
  119. else
  120. adpa_reg = ADPA;
  121. /*
  122. * Disable separate mode multiplier used when cloning SDVO to CRT
  123. * XXX this needs to be adjusted when we really are cloning
  124. */
  125. if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) {
  126. dpll_md = I915_READ(dpll_md_reg);
  127. I915_WRITE(dpll_md_reg,
  128. dpll_md & ~DPLL_MD_UDI_MULTIPLIER_MASK);
  129. }
  130. adpa = ADPA_HOTPLUG_BITS;
  131. if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
  132. adpa |= ADPA_HSYNC_ACTIVE_HIGH;
  133. if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
  134. adpa |= ADPA_VSYNC_ACTIVE_HIGH;
  135. if (intel_crtc->pipe == 0) {
  136. if (HAS_PCH_CPT(dev))
  137. adpa |= PORT_TRANS_A_SEL_CPT;
  138. else
  139. adpa |= ADPA_PIPE_A_SELECT;
  140. if (!HAS_PCH_SPLIT(dev))
  141. I915_WRITE(BCLRPAT_A, 0);
  142. } else {
  143. if (HAS_PCH_CPT(dev))
  144. adpa |= PORT_TRANS_B_SEL_CPT;
  145. else
  146. adpa |= ADPA_PIPE_B_SELECT;
  147. if (!HAS_PCH_SPLIT(dev))
  148. I915_WRITE(BCLRPAT_B, 0);
  149. }
  150. I915_WRITE(adpa_reg, adpa);
  151. }
  152. static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
  153. {
  154. struct drm_device *dev = connector->dev;
  155. struct intel_crt *crt = intel_attached_crt(connector);
  156. struct drm_i915_private *dev_priv = dev->dev_private;
  157. u32 adpa;
  158. bool ret;
  159. /* The first time through, trigger an explicit detection cycle */
  160. if (crt->force_hotplug_required) {
  161. bool turn_off_dac = HAS_PCH_SPLIT(dev);
  162. u32 save_adpa;
  163. crt->force_hotplug_required = 0;
  164. save_adpa = adpa = I915_READ(PCH_ADPA);
  165. DRM_DEBUG_KMS("trigger hotplug detect cycle: adpa=0x%x\n", adpa);
  166. adpa |= ADPA_CRT_HOTPLUG_FORCE_TRIGGER;
  167. if (turn_off_dac)
  168. adpa &= ~ADPA_DAC_ENABLE;
  169. I915_WRITE(PCH_ADPA, adpa);
  170. if (wait_for((I915_READ(PCH_ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0,
  171. 1000))
  172. DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER");
  173. if (turn_off_dac) {
  174. I915_WRITE(PCH_ADPA, save_adpa);
  175. POSTING_READ(PCH_ADPA);
  176. }
  177. }
  178. /* Check the status to see if both blue and green are on now */
  179. adpa = I915_READ(PCH_ADPA);
  180. if ((adpa & ADPA_CRT_HOTPLUG_MONITOR_MASK) != 0)
  181. ret = true;
  182. else
  183. ret = false;
  184. DRM_DEBUG_KMS("ironlake hotplug adpa=0x%x, result %d\n", adpa, ret);
  185. return ret;
  186. }
  187. /**
  188. * Uses CRT_HOTPLUG_EN and CRT_HOTPLUG_STAT to detect CRT presence.
  189. *
  190. * Not for i915G/i915GM
  191. *
  192. * \return true if CRT is connected.
  193. * \return false if CRT is disconnected.
  194. */
  195. static bool intel_crt_detect_hotplug(struct drm_connector *connector)
  196. {
  197. struct drm_device *dev = connector->dev;
  198. struct drm_i915_private *dev_priv = dev->dev_private;
  199. u32 hotplug_en, orig, stat;
  200. bool ret = false;
  201. int i, tries = 0;
  202. if (HAS_PCH_SPLIT(dev))
  203. return intel_ironlake_crt_detect_hotplug(connector);
  204. /*
  205. * On 4 series desktop, CRT detect sequence need to be done twice
  206. * to get a reliable result.
  207. */
  208. if (IS_G4X(dev) && !IS_GM45(dev))
  209. tries = 2;
  210. else
  211. tries = 1;
  212. hotplug_en = orig = I915_READ(PORT_HOTPLUG_EN);
  213. hotplug_en |= CRT_HOTPLUG_FORCE_DETECT;
  214. for (i = 0; i < tries ; i++) {
  215. /* turn on the FORCE_DETECT */
  216. I915_WRITE(PORT_HOTPLUG_EN, hotplug_en);
  217. /* wait for FORCE_DETECT to go off */
  218. if (wait_for((I915_READ(PORT_HOTPLUG_EN) &
  219. CRT_HOTPLUG_FORCE_DETECT) == 0,
  220. 1000))
  221. DRM_DEBUG_KMS("timed out waiting for FORCE_DETECT to go off");
  222. }
  223. stat = I915_READ(PORT_HOTPLUG_STAT);
  224. if ((stat & CRT_HOTPLUG_MONITOR_MASK) != CRT_HOTPLUG_MONITOR_NONE)
  225. ret = true;
  226. /* clear the interrupt we just generated, if any */
  227. I915_WRITE(PORT_HOTPLUG_STAT, CRT_HOTPLUG_INT_STATUS);
  228. /* and put the bits back */
  229. I915_WRITE(PORT_HOTPLUG_EN, orig);
  230. return ret;
  231. }
  232. static bool intel_crt_ddc_probe(struct drm_i915_private *dev_priv, int ddc_bus)
  233. {
  234. u8 buf;
  235. struct i2c_msg msgs[] = {
  236. {
  237. .addr = 0xA0,
  238. .flags = 0,
  239. .len = 1,
  240. .buf = &buf,
  241. },
  242. };
  243. /* DDC monitor detect: Does it ACK a write to 0xA0? */
  244. return i2c_transfer(&dev_priv->gmbus[ddc_bus].adapter, msgs, 1) == 1;
  245. }
  246. static bool intel_crt_detect_ddc(struct intel_crt *crt)
  247. {
  248. struct drm_i915_private *dev_priv = crt->base.base.dev->dev_private;
  249. /* CRT should always be at 0, but check anyway */
  250. if (crt->base.type != INTEL_OUTPUT_ANALOG)
  251. return false;
  252. if (intel_crt_ddc_probe(dev_priv, dev_priv->crt_ddc_pin)) {
  253. DRM_DEBUG_KMS("CRT detected via DDC:0xa0\n");
  254. return true;
  255. }
  256. if (intel_ddc_probe(&crt->base, dev_priv->crt_ddc_pin)) {
  257. DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n");
  258. return true;
  259. }
  260. return false;
  261. }
  262. static enum drm_connector_status
  263. intel_crt_load_detect(struct drm_crtc *crtc, struct intel_crt *crt)
  264. {
  265. struct drm_encoder *encoder = &crt->base.base;
  266. struct drm_device *dev = encoder->dev;
  267. struct drm_i915_private *dev_priv = dev->dev_private;
  268. struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
  269. uint32_t pipe = intel_crtc->pipe;
  270. uint32_t save_bclrpat;
  271. uint32_t save_vtotal;
  272. uint32_t vtotal, vactive;
  273. uint32_t vsample;
  274. uint32_t vblank, vblank_start, vblank_end;
  275. uint32_t dsl;
  276. uint32_t bclrpat_reg;
  277. uint32_t vtotal_reg;
  278. uint32_t vblank_reg;
  279. uint32_t vsync_reg;
  280. uint32_t pipeconf_reg;
  281. uint32_t pipe_dsl_reg;
  282. uint8_t st00;
  283. enum drm_connector_status status;
  284. DRM_DEBUG_KMS("starting load-detect on CRT\n");
  285. if (pipe == 0) {
  286. bclrpat_reg = BCLRPAT_A;
  287. vtotal_reg = VTOTAL_A;
  288. vblank_reg = VBLANK_A;
  289. vsync_reg = VSYNC_A;
  290. pipeconf_reg = PIPEACONF;
  291. pipe_dsl_reg = PIPEADSL;
  292. } else {
  293. bclrpat_reg = BCLRPAT_B;
  294. vtotal_reg = VTOTAL_B;
  295. vblank_reg = VBLANK_B;
  296. vsync_reg = VSYNC_B;
  297. pipeconf_reg = PIPEBCONF;
  298. pipe_dsl_reg = PIPEBDSL;
  299. }
  300. save_bclrpat = I915_READ(bclrpat_reg);
  301. save_vtotal = I915_READ(vtotal_reg);
  302. vblank = I915_READ(vblank_reg);
  303. vtotal = ((save_vtotal >> 16) & 0xfff) + 1;
  304. vactive = (save_vtotal & 0x7ff) + 1;
  305. vblank_start = (vblank & 0xfff) + 1;
  306. vblank_end = ((vblank >> 16) & 0xfff) + 1;
  307. /* Set the border color to purple. */
  308. I915_WRITE(bclrpat_reg, 0x500050);
  309. if (!IS_GEN2(dev)) {
  310. uint32_t pipeconf = I915_READ(pipeconf_reg);
  311. I915_WRITE(pipeconf_reg, pipeconf | PIPECONF_FORCE_BORDER);
  312. POSTING_READ(pipeconf_reg);
  313. /* Wait for next Vblank to substitue
  314. * border color for Color info */
  315. intel_wait_for_vblank(dev, pipe);
  316. st00 = I915_READ8(VGA_MSR_WRITE);
  317. status = ((st00 & (1 << 4)) != 0) ?
  318. connector_status_connected :
  319. connector_status_disconnected;
  320. I915_WRITE(pipeconf_reg, pipeconf);
  321. } else {
  322. bool restore_vblank = false;
  323. int count, detect;
  324. /*
  325. * If there isn't any border, add some.
  326. * Yes, this will flicker
  327. */
  328. if (vblank_start <= vactive && vblank_end >= vtotal) {
  329. uint32_t vsync = I915_READ(vsync_reg);
  330. uint32_t vsync_start = (vsync & 0xffff) + 1;
  331. vblank_start = vsync_start;
  332. I915_WRITE(vblank_reg,
  333. (vblank_start - 1) |
  334. ((vblank_end - 1) << 16));
  335. restore_vblank = true;
  336. }
  337. /* sample in the vertical border, selecting the larger one */
  338. if (vblank_start - vactive >= vtotal - vblank_end)
  339. vsample = (vblank_start + vactive) >> 1;
  340. else
  341. vsample = (vtotal + vblank_end) >> 1;
  342. /*
  343. * Wait for the border to be displayed
  344. */
  345. while (I915_READ(pipe_dsl_reg) >= vactive)
  346. ;
  347. while ((dsl = I915_READ(pipe_dsl_reg)) <= vsample)
  348. ;
  349. /*
  350. * Watch ST00 for an entire scanline
  351. */
  352. detect = 0;
  353. count = 0;
  354. do {
  355. count++;
  356. /* Read the ST00 VGA status register */
  357. st00 = I915_READ8(VGA_MSR_WRITE);
  358. if (st00 & (1 << 4))
  359. detect++;
  360. } while ((I915_READ(pipe_dsl_reg) == dsl));
  361. /* restore vblank if necessary */
  362. if (restore_vblank)
  363. I915_WRITE(vblank_reg, vblank);
  364. /*
  365. * If more than 3/4 of the scanline detected a monitor,
  366. * then it is assumed to be present. This works even on i830,
  367. * where there isn't any way to force the border color across
  368. * the screen
  369. */
  370. status = detect * 4 > count * 3 ?
  371. connector_status_connected :
  372. connector_status_disconnected;
  373. }
  374. /* Restore previous settings */
  375. I915_WRITE(bclrpat_reg, save_bclrpat);
  376. return status;
  377. }
  378. static enum drm_connector_status
  379. intel_crt_detect(struct drm_connector *connector, bool force)
  380. {
  381. struct drm_device *dev = connector->dev;
  382. struct intel_crt *crt = intel_attached_crt(connector);
  383. struct drm_crtc *crtc;
  384. int dpms_mode;
  385. enum drm_connector_status status;
  386. if (I915_HAS_HOTPLUG(dev)) {
  387. if (intel_crt_detect_hotplug(connector)) {
  388. DRM_DEBUG_KMS("CRT detected via hotplug\n");
  389. return connector_status_connected;
  390. } else {
  391. DRM_DEBUG_KMS("CRT not detected via hotplug\n");
  392. return connector_status_disconnected;
  393. }
  394. }
  395. if (intel_crt_detect_ddc(crt))
  396. return connector_status_connected;
  397. if (!force)
  398. return connector->status;
  399. /* for pre-945g platforms use load detect */
  400. crtc = crt->base.base.crtc;
  401. if (crtc && crtc->enabled) {
  402. status = intel_crt_load_detect(crtc, crt);
  403. } else {
  404. crtc = intel_get_load_detect_pipe(&crt->base, connector,
  405. NULL, &dpms_mode);
  406. if (crtc) {
  407. if (intel_crt_detect_ddc(crt))
  408. status = connector_status_connected;
  409. else
  410. status = intel_crt_load_detect(crtc, crt);
  411. intel_release_load_detect_pipe(&crt->base,
  412. connector, dpms_mode);
  413. } else
  414. status = connector_status_unknown;
  415. }
  416. return status;
  417. }
  418. static void intel_crt_destroy(struct drm_connector *connector)
  419. {
  420. drm_sysfs_connector_remove(connector);
  421. drm_connector_cleanup(connector);
  422. kfree(connector);
  423. }
  424. static int intel_crt_get_modes(struct drm_connector *connector)
  425. {
  426. struct drm_device *dev = connector->dev;
  427. struct drm_i915_private *dev_priv = dev->dev_private;
  428. int ret;
  429. ret = intel_ddc_get_modes(connector,
  430. &dev_priv->gmbus[dev_priv->crt_ddc_pin].adapter);
  431. if (ret || !IS_G4X(dev))
  432. return ret;
  433. /* Try to probe digital port for output in DVI-I -> VGA mode. */
  434. return intel_ddc_get_modes(connector,
  435. &dev_priv->gmbus[GMBUS_PORT_DPB].adapter);
  436. }
  437. static int intel_crt_set_property(struct drm_connector *connector,
  438. struct drm_property *property,
  439. uint64_t value)
  440. {
  441. return 0;
  442. }
  443. /*
  444. * Routines for controlling stuff on the analog port
  445. */
  446. static const struct drm_encoder_helper_funcs intel_crt_helper_funcs = {
  447. .dpms = intel_crt_dpms,
  448. .mode_fixup = intel_crt_mode_fixup,
  449. .prepare = intel_encoder_prepare,
  450. .commit = intel_encoder_commit,
  451. .mode_set = intel_crt_mode_set,
  452. };
  453. static const struct drm_connector_funcs intel_crt_connector_funcs = {
  454. .dpms = drm_helper_connector_dpms,
  455. .detect = intel_crt_detect,
  456. .fill_modes = drm_helper_probe_single_connector_modes,
  457. .destroy = intel_crt_destroy,
  458. .set_property = intel_crt_set_property,
  459. };
  460. static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs = {
  461. .mode_valid = intel_crt_mode_valid,
  462. .get_modes = intel_crt_get_modes,
  463. .best_encoder = intel_best_encoder,
  464. };
  465. static const struct drm_encoder_funcs intel_crt_enc_funcs = {
  466. .destroy = intel_encoder_destroy,
  467. };
  468. void intel_crt_init(struct drm_device *dev)
  469. {
  470. struct drm_connector *connector;
  471. struct intel_crt *crt;
  472. struct intel_connector *intel_connector;
  473. struct drm_i915_private *dev_priv = dev->dev_private;
  474. crt = kzalloc(sizeof(struct intel_crt), GFP_KERNEL);
  475. if (!crt)
  476. return;
  477. intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL);
  478. if (!intel_connector) {
  479. kfree(crt);
  480. return;
  481. }
  482. connector = &intel_connector->base;
  483. drm_connector_init(dev, &intel_connector->base,
  484. &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
  485. drm_encoder_init(dev, &crt->base.base, &intel_crt_enc_funcs,
  486. DRM_MODE_ENCODER_DAC);
  487. intel_connector_attach_encoder(intel_connector, &crt->base);
  488. crt->base.type = INTEL_OUTPUT_ANALOG;
  489. crt->base.clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT |
  490. 1 << INTEL_ANALOG_CLONE_BIT |
  491. 1 << INTEL_SDVO_LVDS_CLONE_BIT);
  492. crt->base.crtc_mask = (1 << 0) | (1 << 1);
  493. connector->interlace_allowed = 1;
  494. connector->doublescan_allowed = 0;
  495. drm_encoder_helper_add(&crt->base.base, &intel_crt_helper_funcs);
  496. drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);
  497. drm_sysfs_connector_add(connector);
  498. if (I915_HAS_HOTPLUG(dev))
  499. connector->polled = DRM_CONNECTOR_POLL_HPD;
  500. else
  501. connector->polled = DRM_CONNECTOR_POLL_CONNECT;
  502. /*
  503. * Configure the automatic hotplug detection stuff
  504. */
  505. crt->force_hotplug_required = 0;
  506. if (HAS_PCH_SPLIT(dev)) {
  507. u32 adpa;
  508. adpa = I915_READ(PCH_ADPA);
  509. adpa &= ~ADPA_CRT_HOTPLUG_MASK;
  510. adpa |= ADPA_HOTPLUG_BITS;
  511. I915_WRITE(PCH_ADPA, adpa);
  512. POSTING_READ(PCH_ADPA);
  513. DRM_DEBUG_KMS("pch crt adpa set to 0x%x\n", adpa);
  514. crt->force_hotplug_required = 1;
  515. }
  516. dev_priv->hotplug_supported_mask |= CRT_HOTPLUG_INT_STATUS;
  517. }