dvo_ns2501.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. /*
  2. *
  3. * Copyright (c) 2012 Gilles Dartiguelongue, Thomas Richter
  4. *
  5. * All Rights Reserved.
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a
  8. * copy of this software and associated documentation files (the
  9. * "Software"), to deal in the Software without restriction, including
  10. * without limitation the rights to use, copy, modify, merge, publish,
  11. * distribute, sub license, and/or sell copies of the Software, and to
  12. * permit persons to whom the Software is furnished to do so, subject to
  13. * the following conditions:
  14. *
  15. * The above copyright notice and this permission notice (including the
  16. * next paragraph) shall be included in all copies or substantial portions
  17. * of the Software.
  18. *
  19. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  20. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  22. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  23. * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  24. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  25. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26. *
  27. */
  28. #include "dvo.h"
  29. #include "i915_reg.h"
  30. #include "i915_drv.h"
  31. #define NS2501_VID 0x1305
  32. #define NS2501_DID 0x6726
  33. #define NS2501_VID_LO 0x00
  34. #define NS2501_VID_HI 0x01
  35. #define NS2501_DID_LO 0x02
  36. #define NS2501_DID_HI 0x03
  37. #define NS2501_REV 0x04
  38. #define NS2501_RSVD 0x05
  39. #define NS2501_FREQ_LO 0x06
  40. #define NS2501_FREQ_HI 0x07
  41. #define NS2501_REG8 0x08
  42. #define NS2501_8_VEN (1<<5)
  43. #define NS2501_8_HEN (1<<4)
  44. #define NS2501_8_DSEL (1<<3)
  45. #define NS2501_8_BPAS (1<<2)
  46. #define NS2501_8_RSVD (1<<1)
  47. #define NS2501_8_PD (1<<0)
  48. #define NS2501_REG9 0x09
  49. #define NS2501_9_VLOW (1<<7)
  50. #define NS2501_9_MSEL_MASK (0x7<<4)
  51. #define NS2501_9_TSEL (1<<3)
  52. #define NS2501_9_RSEN (1<<2)
  53. #define NS2501_9_RSVD (1<<1)
  54. #define NS2501_9_MDI (1<<0)
  55. #define NS2501_REGC 0x0c
  56. struct ns2501_priv {
  57. //I2CDevRec d;
  58. bool quiet;
  59. int reg_8_shadow;
  60. int reg_8_set;
  61. // Shadow registers for i915
  62. int dvoc;
  63. int pll_a;
  64. int srcdim;
  65. int fw_blc;
  66. };
  67. #define NSPTR(d) ((NS2501Ptr)(d->DriverPrivate.ptr))
  68. /*
  69. * Include the PLL launcher prototype
  70. */
  71. extern void intel_enable_pll(struct drm_i915_private *dev_priv, enum pipe pipe);
  72. /*
  73. * For reasons unclear to me, the ns2501 at least on the Fujitsu/Siemens
  74. * laptops does not react on the i2c bus unless
  75. * both the PLL is running and the display is configured in its native
  76. * resolution.
  77. * This function forces the DVO on, and stores the registers it touches.
  78. * Afterwards, registers are restored to regular values.
  79. *
  80. * This is pretty much a hack, though it works.
  81. * Without that, ns2501_readb and ns2501_writeb fail
  82. * when switching the resolution.
  83. */
  84. static void enable_dvo(struct intel_dvo_device *dvo)
  85. {
  86. struct ns2501_priv *ns = (struct ns2501_priv *)(dvo->dev_priv);
  87. struct i2c_adapter *adapter = dvo->i2c_bus;
  88. struct intel_gmbus *bus = container_of(adapter,
  89. struct intel_gmbus,
  90. adapter);
  91. struct drm_i915_private *dev_priv = bus->dev_priv;
  92. DRM_DEBUG_KMS("%s: Trying to re-enable the DVO\n", __FUNCTION__);
  93. ns->dvoc = I915_READ(DVO_C);
  94. ns->pll_a = I915_READ(_DPLL_A);
  95. ns->srcdim = I915_READ(DVOC_SRCDIM);
  96. ns->fw_blc = I915_READ(FW_BLC);
  97. I915_WRITE(DVOC, 0x10004084);
  98. I915_WRITE(_DPLL_A, 0xd0820000);
  99. I915_WRITE(DVOC_SRCDIM, 0x400300); // 1024x768
  100. I915_WRITE(FW_BLC, 0x1080304);
  101. intel_enable_pll(dev_priv, 0);
  102. I915_WRITE(DVOC, 0x90004084);
  103. }
  104. /*
  105. * Restore the I915 registers modified by the above
  106. * trigger function.
  107. */
  108. static void restore_dvo(struct intel_dvo_device *dvo)
  109. {
  110. struct i2c_adapter *adapter = dvo->i2c_bus;
  111. struct intel_gmbus *bus = container_of(adapter,
  112. struct intel_gmbus,
  113. adapter);
  114. struct drm_i915_private *dev_priv = bus->dev_priv;
  115. struct ns2501_priv *ns = (struct ns2501_priv *)(dvo->dev_priv);
  116. I915_WRITE(DVOC, ns->dvoc);
  117. I915_WRITE(_DPLL_A, ns->pll_a);
  118. I915_WRITE(DVOC_SRCDIM, ns->srcdim);
  119. I915_WRITE(FW_BLC, ns->fw_blc);
  120. }
  121. /*
  122. ** Read a register from the ns2501.
  123. ** Returns true if successful, false otherwise.
  124. ** If it returns false, it might be wise to enable the
  125. ** DVO with the above function.
  126. */
  127. static bool ns2501_readb(struct intel_dvo_device *dvo, int addr, uint8_t * ch)
  128. {
  129. struct ns2501_priv *ns = dvo->dev_priv;
  130. struct i2c_adapter *adapter = dvo->i2c_bus;
  131. u8 out_buf[2];
  132. u8 in_buf[2];
  133. struct i2c_msg msgs[] = {
  134. {
  135. .addr = dvo->slave_addr,
  136. .flags = 0,
  137. .len = 1,
  138. .buf = out_buf,
  139. },
  140. {
  141. .addr = dvo->slave_addr,
  142. .flags = I2C_M_RD,
  143. .len = 1,
  144. .buf = in_buf,
  145. }
  146. };
  147. out_buf[0] = addr;
  148. out_buf[1] = 0;
  149. if (i2c_transfer(adapter, msgs, 2) == 2) {
  150. *ch = in_buf[0];
  151. return true;
  152. };
  153. if (!ns->quiet) {
  154. DRM_DEBUG_KMS
  155. ("Unable to read register 0x%02x from %s:0x%02x.\n", addr,
  156. adapter->name, dvo->slave_addr);
  157. }
  158. return false;
  159. }
  160. /*
  161. ** Write a register to the ns2501.
  162. ** Returns true if successful, false otherwise.
  163. ** If it returns false, it might be wise to enable the
  164. ** DVO with the above function.
  165. */
  166. static bool ns2501_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch)
  167. {
  168. struct ns2501_priv *ns = dvo->dev_priv;
  169. struct i2c_adapter *adapter = dvo->i2c_bus;
  170. uint8_t out_buf[2];
  171. struct i2c_msg msg = {
  172. .addr = dvo->slave_addr,
  173. .flags = 0,
  174. .len = 2,
  175. .buf = out_buf,
  176. };
  177. out_buf[0] = addr;
  178. out_buf[1] = ch;
  179. if (i2c_transfer(adapter, &msg, 1) == 1) {
  180. return true;
  181. }
  182. if (!ns->quiet) {
  183. DRM_DEBUG_KMS("Unable to write register 0x%02x to %s:%d\n",
  184. addr, adapter->name, dvo->slave_addr);
  185. }
  186. return false;
  187. }
  188. /* National Semiconductor 2501 driver for chip on i2c bus
  189. * scan for the chip on the bus.
  190. * Hope the VBIOS initialized the PLL correctly so we can
  191. * talk to it. If not, it will not be seen and not detected.
  192. * Bummer!
  193. */
  194. static bool ns2501_init(struct intel_dvo_device *dvo,
  195. struct i2c_adapter *adapter)
  196. {
  197. /* this will detect the NS2501 chip on the specified i2c bus */
  198. struct ns2501_priv *ns;
  199. unsigned char ch;
  200. ns = kzalloc(sizeof(struct ns2501_priv), GFP_KERNEL);
  201. if (ns == NULL)
  202. return false;
  203. dvo->i2c_bus = adapter;
  204. dvo->dev_priv = ns;
  205. ns->quiet = true;
  206. if (!ns2501_readb(dvo, NS2501_VID_LO, &ch))
  207. goto out;
  208. if (ch != (NS2501_VID & 0xff)) {
  209. DRM_DEBUG_KMS("ns2501 not detected got %d: from %s Slave %d.\n",
  210. ch, adapter->name, dvo->slave_addr);
  211. goto out;
  212. }
  213. if (!ns2501_readb(dvo, NS2501_DID_LO, &ch))
  214. goto out;
  215. if (ch != (NS2501_DID & 0xff)) {
  216. DRM_DEBUG_KMS("ns2501 not detected got %d: from %s Slave %d.\n",
  217. ch, adapter->name, dvo->slave_addr);
  218. goto out;
  219. }
  220. ns->quiet = false;
  221. ns->reg_8_set = 0;
  222. ns->reg_8_shadow =
  223. NS2501_8_PD | NS2501_8_BPAS | NS2501_8_VEN | NS2501_8_HEN;
  224. DRM_DEBUG_KMS("init ns2501 dvo controller successfully!\n");
  225. return true;
  226. out:
  227. kfree(ns);
  228. return false;
  229. }
  230. static enum drm_connector_status ns2501_detect(struct intel_dvo_device *dvo)
  231. {
  232. /*
  233. * This is a Laptop display, it doesn't have hotplugging.
  234. * Even if not, the detection bit of the 2501 is unreliable as
  235. * it only works for some display types.
  236. * It is even more unreliable as the PLL must be active for
  237. * allowing reading from the chiop.
  238. */
  239. return connector_status_connected;
  240. }
  241. static enum drm_mode_status ns2501_mode_valid(struct intel_dvo_device *dvo,
  242. struct drm_display_mode *mode)
  243. {
  244. DRM_DEBUG_KMS
  245. ("%s: is mode valid (hdisplay=%d,htotal=%d,vdisplay=%d,vtotal=%d)\n",
  246. __FUNCTION__, mode->hdisplay, mode->htotal, mode->vdisplay,
  247. mode->vtotal);
  248. /*
  249. * Currently, these are all the modes I have data from.
  250. * More might exist. Unclear how to find the native resolution
  251. * of the panel in here so we could always accept it
  252. * by disabling the scaler.
  253. */
  254. if ((mode->hdisplay == 800 && mode->vdisplay == 600) ||
  255. (mode->hdisplay == 640 && mode->vdisplay == 480) ||
  256. (mode->hdisplay == 1024 && mode->vdisplay == 768)) {
  257. return MODE_OK;
  258. } else {
  259. return MODE_ONE_SIZE; /* Is this a reasonable error? */
  260. }
  261. }
  262. static void ns2501_mode_set(struct intel_dvo_device *dvo,
  263. struct drm_display_mode *mode,
  264. struct drm_display_mode *adjusted_mode)
  265. {
  266. bool ok;
  267. bool restore = false;
  268. struct ns2501_priv *ns = (struct ns2501_priv *)(dvo->dev_priv);
  269. DRM_DEBUG_KMS
  270. ("%s: set mode (hdisplay=%d,htotal=%d,vdisplay=%d,vtotal=%d).\n",
  271. __FUNCTION__, mode->hdisplay, mode->htotal, mode->vdisplay,
  272. mode->vtotal);
  273. /*
  274. * Where do I find the native resolution for which scaling is not required???
  275. *
  276. * First trigger the DVO on as otherwise the chip does not appear on the i2c
  277. * bus.
  278. */
  279. do {
  280. ok = true;
  281. if (mode->hdisplay == 800 && mode->vdisplay == 600) {
  282. /* mode 277 */
  283. ns->reg_8_shadow &= ~NS2501_8_BPAS;
  284. DRM_DEBUG_KMS("%s: switching to 800x600\n",
  285. __FUNCTION__);
  286. /*
  287. * No, I do not know where this data comes from.
  288. * It is just what the video bios left in the DVO, so
  289. * I'm just copying it here over.
  290. * This also means that I cannot support any other modes
  291. * except the ones supported by the bios.
  292. */
  293. ok &= ns2501_writeb(dvo, 0x11, 0xc8); // 0xc7 also works.
  294. ok &= ns2501_writeb(dvo, 0x1b, 0x19);
  295. ok &= ns2501_writeb(dvo, 0x1c, 0x62); // VBIOS left 0x64 here, but 0x62 works nicer
  296. ok &= ns2501_writeb(dvo, 0x1d, 0x02);
  297. ok &= ns2501_writeb(dvo, 0x34, 0x03);
  298. ok &= ns2501_writeb(dvo, 0x35, 0xff);
  299. ok &= ns2501_writeb(dvo, 0x80, 0x27);
  300. ok &= ns2501_writeb(dvo, 0x81, 0x03);
  301. ok &= ns2501_writeb(dvo, 0x82, 0x41);
  302. ok &= ns2501_writeb(dvo, 0x83, 0x05);
  303. ok &= ns2501_writeb(dvo, 0x8d, 0x02);
  304. ok &= ns2501_writeb(dvo, 0x8e, 0x04);
  305. ok &= ns2501_writeb(dvo, 0x8f, 0x00);
  306. ok &= ns2501_writeb(dvo, 0x90, 0xfe); /* vertical. VBIOS left 0xff here, but 0xfe works better */
  307. ok &= ns2501_writeb(dvo, 0x91, 0x07);
  308. ok &= ns2501_writeb(dvo, 0x94, 0x00);
  309. ok &= ns2501_writeb(dvo, 0x95, 0x00);
  310. ok &= ns2501_writeb(dvo, 0x96, 0x00);
  311. ok &= ns2501_writeb(dvo, 0x99, 0x00);
  312. ok &= ns2501_writeb(dvo, 0x9a, 0x88);
  313. ok &= ns2501_writeb(dvo, 0x9c, 0x23); /* Looks like first and last line of the image. */
  314. ok &= ns2501_writeb(dvo, 0x9d, 0x00);
  315. ok &= ns2501_writeb(dvo, 0x9e, 0x25);
  316. ok &= ns2501_writeb(dvo, 0x9f, 0x03);
  317. ok &= ns2501_writeb(dvo, 0xa4, 0x80);
  318. ok &= ns2501_writeb(dvo, 0xb6, 0x00);
  319. ok &= ns2501_writeb(dvo, 0xb9, 0xc8); /* horizontal? */
  320. ok &= ns2501_writeb(dvo, 0xba, 0x00); /* horizontal? */
  321. ok &= ns2501_writeb(dvo, 0xc0, 0x05); /* horizontal? */
  322. ok &= ns2501_writeb(dvo, 0xc1, 0xd7);
  323. ok &= ns2501_writeb(dvo, 0xc2, 0x00);
  324. ok &= ns2501_writeb(dvo, 0xc3, 0xf8);
  325. ok &= ns2501_writeb(dvo, 0xc4, 0x03);
  326. ok &= ns2501_writeb(dvo, 0xc5, 0x1a);
  327. ok &= ns2501_writeb(dvo, 0xc6, 0x00);
  328. ok &= ns2501_writeb(dvo, 0xc7, 0x73);
  329. ok &= ns2501_writeb(dvo, 0xc8, 0x02);
  330. } else if (mode->hdisplay == 640 && mode->vdisplay == 480) {
  331. /* mode 274 */
  332. DRM_DEBUG_KMS("%s: switching to 640x480\n",
  333. __FUNCTION__);
  334. /*
  335. * No, I do not know where this data comes from.
  336. * It is just what the video bios left in the DVO, so
  337. * I'm just copying it here over.
  338. * This also means that I cannot support any other modes
  339. * except the ones supported by the bios.
  340. */
  341. ns->reg_8_shadow &= ~NS2501_8_BPAS;
  342. ok &= ns2501_writeb(dvo, 0x11, 0xa0);
  343. ok &= ns2501_writeb(dvo, 0x1b, 0x11);
  344. ok &= ns2501_writeb(dvo, 0x1c, 0x54);
  345. ok &= ns2501_writeb(dvo, 0x1d, 0x03);
  346. ok &= ns2501_writeb(dvo, 0x34, 0x03);
  347. ok &= ns2501_writeb(dvo, 0x35, 0xff);
  348. ok &= ns2501_writeb(dvo, 0x80, 0xff);
  349. ok &= ns2501_writeb(dvo, 0x81, 0x07);
  350. ok &= ns2501_writeb(dvo, 0x82, 0x3d);
  351. ok &= ns2501_writeb(dvo, 0x83, 0x05);
  352. ok &= ns2501_writeb(dvo, 0x8d, 0x02);
  353. ok &= ns2501_writeb(dvo, 0x8e, 0x10);
  354. ok &= ns2501_writeb(dvo, 0x8f, 0x00);
  355. ok &= ns2501_writeb(dvo, 0x90, 0xff); /* vertical */
  356. ok &= ns2501_writeb(dvo, 0x91, 0x07);
  357. ok &= ns2501_writeb(dvo, 0x94, 0x00);
  358. ok &= ns2501_writeb(dvo, 0x95, 0x00);
  359. ok &= ns2501_writeb(dvo, 0x96, 0x05);
  360. ok &= ns2501_writeb(dvo, 0x99, 0x00);
  361. ok &= ns2501_writeb(dvo, 0x9a, 0x88);
  362. ok &= ns2501_writeb(dvo, 0x9c, 0x24);
  363. ok &= ns2501_writeb(dvo, 0x9d, 0x00);
  364. ok &= ns2501_writeb(dvo, 0x9e, 0x25);
  365. ok &= ns2501_writeb(dvo, 0x9f, 0x03);
  366. ok &= ns2501_writeb(dvo, 0xa4, 0x84);
  367. ok &= ns2501_writeb(dvo, 0xb6, 0x09);
  368. ok &= ns2501_writeb(dvo, 0xb9, 0xa0); /* horizontal? */
  369. ok &= ns2501_writeb(dvo, 0xba, 0x00); /* horizontal? */
  370. ok &= ns2501_writeb(dvo, 0xc0, 0x05); /* horizontal? */
  371. ok &= ns2501_writeb(dvo, 0xc1, 0x90);
  372. ok &= ns2501_writeb(dvo, 0xc2, 0x00);
  373. ok &= ns2501_writeb(dvo, 0xc3, 0x0f);
  374. ok &= ns2501_writeb(dvo, 0xc4, 0x03);
  375. ok &= ns2501_writeb(dvo, 0xc5, 0x16);
  376. ok &= ns2501_writeb(dvo, 0xc6, 0x00);
  377. ok &= ns2501_writeb(dvo, 0xc7, 0x02);
  378. ok &= ns2501_writeb(dvo, 0xc8, 0x02);
  379. } else if (mode->hdisplay == 1024 && mode->vdisplay == 768) {
  380. /* mode 280 */
  381. DRM_DEBUG_KMS("%s: switching to 1024x768\n",
  382. __FUNCTION__);
  383. /*
  384. * This might or might not work, actually. I'm silently
  385. * assuming here that the native panel resolution is
  386. * 1024x768. If not, then this leaves the scaler disabled
  387. * generating a picture that is likely not the expected.
  388. *
  389. * Problem is that I do not know where to take the panel
  390. * dimensions from.
  391. *
  392. * Enable the bypass, scaling not required.
  393. *
  394. * The scaler registers are irrelevant here....
  395. *
  396. */
  397. ns->reg_8_shadow |= NS2501_8_BPAS;
  398. ok &= ns2501_writeb(dvo, 0x37, 0x44);
  399. } else {
  400. /*
  401. * Data not known. Bummer!
  402. * Hopefully, the code should not go here
  403. * as mode_OK delivered no other modes.
  404. */
  405. ns->reg_8_shadow |= NS2501_8_BPAS;
  406. }
  407. ok &= ns2501_writeb(dvo, NS2501_REG8, ns->reg_8_shadow);
  408. if (!ok) {
  409. if (restore)
  410. restore_dvo(dvo);
  411. enable_dvo(dvo);
  412. restore = true;
  413. }
  414. } while (!ok);
  415. /*
  416. * Restore the old i915 registers before
  417. * forcing the ns2501 on.
  418. */
  419. if (restore)
  420. restore_dvo(dvo);
  421. }
  422. /* set the NS2501 power state */
  423. static void ns2501_dpms(struct intel_dvo_device *dvo, int mode)
  424. {
  425. bool ok;
  426. bool restore = false;
  427. struct ns2501_priv *ns = (struct ns2501_priv *)(dvo->dev_priv);
  428. unsigned char ch;
  429. DRM_DEBUG_KMS("%s: Trying set the dpms of the DVO to %d\n",
  430. __FUNCTION__, mode);
  431. ch = ns->reg_8_shadow;
  432. if (mode == DRM_MODE_DPMS_ON)
  433. ch |= NS2501_8_PD;
  434. else
  435. ch &= ~NS2501_8_PD;
  436. if (ns->reg_8_set == 0 || ns->reg_8_shadow != ch) {
  437. ns->reg_8_set = 1;
  438. ns->reg_8_shadow = ch;
  439. do {
  440. ok = true;
  441. ok &= ns2501_writeb(dvo, NS2501_REG8, ch);
  442. ok &=
  443. ns2501_writeb(dvo, 0x34,
  444. (mode ==
  445. DRM_MODE_DPMS_ON) ? (0x03) : (0x00));
  446. ok &=
  447. ns2501_writeb(dvo, 0x35,
  448. (mode ==
  449. DRM_MODE_DPMS_ON) ? (0xff) : (0x00));
  450. if (!ok) {
  451. if (restore)
  452. restore_dvo(dvo);
  453. enable_dvo(dvo);
  454. restore = true;
  455. }
  456. } while (!ok);
  457. if (restore)
  458. restore_dvo(dvo);
  459. }
  460. }
  461. static void ns2501_dump_regs(struct intel_dvo_device *dvo)
  462. {
  463. uint8_t val;
  464. ns2501_readb(dvo, NS2501_FREQ_LO, &val);
  465. DRM_LOG_KMS("NS2501_FREQ_LO: 0x%02x\n", val);
  466. ns2501_readb(dvo, NS2501_FREQ_HI, &val);
  467. DRM_LOG_KMS("NS2501_FREQ_HI: 0x%02x\n", val);
  468. ns2501_readb(dvo, NS2501_REG8, &val);
  469. DRM_LOG_KMS("NS2501_REG8: 0x%02x\n", val);
  470. ns2501_readb(dvo, NS2501_REG9, &val);
  471. DRM_LOG_KMS("NS2501_REG9: 0x%02x\n", val);
  472. ns2501_readb(dvo, NS2501_REGC, &val);
  473. DRM_LOG_KMS("NS2501_REGC: 0x%02x\n", val);
  474. }
  475. static void ns2501_destroy(struct intel_dvo_device *dvo)
  476. {
  477. struct ns2501_priv *ns = dvo->dev_priv;
  478. if (ns) {
  479. kfree(ns);
  480. dvo->dev_priv = NULL;
  481. }
  482. }
  483. struct intel_dvo_dev_ops ns2501_ops = {
  484. .init = ns2501_init,
  485. .detect = ns2501_detect,
  486. .mode_valid = ns2501_mode_valid,
  487. .mode_set = ns2501_mode_set,
  488. .dpms = ns2501_dpms,
  489. .dump_regs = ns2501_dump_regs,
  490. .destroy = ns2501_destroy,
  491. };