dvo_ns2501.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  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. * For reasons unclear to me, the ns2501 at least on the Fujitsu/Siemens
  70. * laptops does not react on the i2c bus unless
  71. * both the PLL is running and the display is configured in its native
  72. * resolution.
  73. * This function forces the DVO on, and stores the registers it touches.
  74. * Afterwards, registers are restored to regular values.
  75. *
  76. * This is pretty much a hack, though it works.
  77. * Without that, ns2501_readb and ns2501_writeb fail
  78. * when switching the resolution.
  79. */
  80. static void enable_dvo(struct intel_dvo_device *dvo)
  81. {
  82. struct ns2501_priv *ns = (struct ns2501_priv *)(dvo->dev_priv);
  83. struct i2c_adapter *adapter = dvo->i2c_bus;
  84. struct intel_gmbus *bus = container_of(adapter,
  85. struct intel_gmbus,
  86. adapter);
  87. struct drm_i915_private *dev_priv = bus->dev_priv;
  88. DRM_DEBUG_KMS("%s: Trying to re-enable the DVO\n", __FUNCTION__);
  89. ns->dvoc = I915_READ(DVO_C);
  90. ns->pll_a = I915_READ(_DPLL_A);
  91. ns->srcdim = I915_READ(DVOC_SRCDIM);
  92. ns->fw_blc = I915_READ(FW_BLC);
  93. I915_WRITE(DVOC, 0x10004084);
  94. I915_WRITE(_DPLL_A, 0xd0820000);
  95. I915_WRITE(DVOC_SRCDIM, 0x400300); // 1024x768
  96. I915_WRITE(FW_BLC, 0x1080304);
  97. I915_WRITE(DVOC, 0x90004084);
  98. }
  99. /*
  100. * Restore the I915 registers modified by the above
  101. * trigger function.
  102. */
  103. static void restore_dvo(struct intel_dvo_device *dvo)
  104. {
  105. struct i2c_adapter *adapter = dvo->i2c_bus;
  106. struct intel_gmbus *bus = container_of(adapter,
  107. struct intel_gmbus,
  108. adapter);
  109. struct drm_i915_private *dev_priv = bus->dev_priv;
  110. struct ns2501_priv *ns = (struct ns2501_priv *)(dvo->dev_priv);
  111. I915_WRITE(DVOC, ns->dvoc);
  112. I915_WRITE(_DPLL_A, ns->pll_a);
  113. I915_WRITE(DVOC_SRCDIM, ns->srcdim);
  114. I915_WRITE(FW_BLC, ns->fw_blc);
  115. }
  116. /*
  117. ** Read a register from the ns2501.
  118. ** Returns true if successful, false otherwise.
  119. ** If it returns false, it might be wise to enable the
  120. ** DVO with the above function.
  121. */
  122. static bool ns2501_readb(struct intel_dvo_device *dvo, int addr, uint8_t * ch)
  123. {
  124. struct ns2501_priv *ns = dvo->dev_priv;
  125. struct i2c_adapter *adapter = dvo->i2c_bus;
  126. u8 out_buf[2];
  127. u8 in_buf[2];
  128. struct i2c_msg msgs[] = {
  129. {
  130. .addr = dvo->slave_addr,
  131. .flags = 0,
  132. .len = 1,
  133. .buf = out_buf,
  134. },
  135. {
  136. .addr = dvo->slave_addr,
  137. .flags = I2C_M_RD,
  138. .len = 1,
  139. .buf = in_buf,
  140. }
  141. };
  142. out_buf[0] = addr;
  143. out_buf[1] = 0;
  144. if (i2c_transfer(adapter, msgs, 2) == 2) {
  145. *ch = in_buf[0];
  146. return true;
  147. };
  148. if (!ns->quiet) {
  149. DRM_DEBUG_KMS
  150. ("Unable to read register 0x%02x from %s:0x%02x.\n", addr,
  151. adapter->name, dvo->slave_addr);
  152. }
  153. return false;
  154. }
  155. /*
  156. ** Write a register to the ns2501.
  157. ** Returns true if successful, false otherwise.
  158. ** If it returns false, it might be wise to enable the
  159. ** DVO with the above function.
  160. */
  161. static bool ns2501_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch)
  162. {
  163. struct ns2501_priv *ns = dvo->dev_priv;
  164. struct i2c_adapter *adapter = dvo->i2c_bus;
  165. uint8_t out_buf[2];
  166. struct i2c_msg msg = {
  167. .addr = dvo->slave_addr,
  168. .flags = 0,
  169. .len = 2,
  170. .buf = out_buf,
  171. };
  172. out_buf[0] = addr;
  173. out_buf[1] = ch;
  174. if (i2c_transfer(adapter, &msg, 1) == 1) {
  175. return true;
  176. }
  177. if (!ns->quiet) {
  178. DRM_DEBUG_KMS("Unable to write register 0x%02x to %s:%d\n",
  179. addr, adapter->name, dvo->slave_addr);
  180. }
  181. return false;
  182. }
  183. /* National Semiconductor 2501 driver for chip on i2c bus
  184. * scan for the chip on the bus.
  185. * Hope the VBIOS initialized the PLL correctly so we can
  186. * talk to it. If not, it will not be seen and not detected.
  187. * Bummer!
  188. */
  189. static bool ns2501_init(struct intel_dvo_device *dvo,
  190. struct i2c_adapter *adapter)
  191. {
  192. /* this will detect the NS2501 chip on the specified i2c bus */
  193. struct ns2501_priv *ns;
  194. unsigned char ch;
  195. ns = kzalloc(sizeof(struct ns2501_priv), GFP_KERNEL);
  196. if (ns == NULL)
  197. return false;
  198. dvo->i2c_bus = adapter;
  199. dvo->dev_priv = ns;
  200. ns->quiet = true;
  201. if (!ns2501_readb(dvo, NS2501_VID_LO, &ch))
  202. goto out;
  203. if (ch != (NS2501_VID & 0xff)) {
  204. DRM_DEBUG_KMS("ns2501 not detected got %d: from %s Slave %d.\n",
  205. ch, adapter->name, dvo->slave_addr);
  206. goto out;
  207. }
  208. if (!ns2501_readb(dvo, NS2501_DID_LO, &ch))
  209. goto out;
  210. if (ch != (NS2501_DID & 0xff)) {
  211. DRM_DEBUG_KMS("ns2501 not detected got %d: from %s Slave %d.\n",
  212. ch, adapter->name, dvo->slave_addr);
  213. goto out;
  214. }
  215. ns->quiet = false;
  216. ns->reg_8_set = 0;
  217. ns->reg_8_shadow =
  218. NS2501_8_PD | NS2501_8_BPAS | NS2501_8_VEN | NS2501_8_HEN;
  219. DRM_DEBUG_KMS("init ns2501 dvo controller successfully!\n");
  220. return true;
  221. out:
  222. kfree(ns);
  223. return false;
  224. }
  225. static enum drm_connector_status ns2501_detect(struct intel_dvo_device *dvo)
  226. {
  227. /*
  228. * This is a Laptop display, it doesn't have hotplugging.
  229. * Even if not, the detection bit of the 2501 is unreliable as
  230. * it only works for some display types.
  231. * It is even more unreliable as the PLL must be active for
  232. * allowing reading from the chiop.
  233. */
  234. return connector_status_connected;
  235. }
  236. static enum drm_mode_status ns2501_mode_valid(struct intel_dvo_device *dvo,
  237. struct drm_display_mode *mode)
  238. {
  239. DRM_DEBUG_KMS
  240. ("%s: is mode valid (hdisplay=%d,htotal=%d,vdisplay=%d,vtotal=%d)\n",
  241. __FUNCTION__, mode->hdisplay, mode->htotal, mode->vdisplay,
  242. mode->vtotal);
  243. /*
  244. * Currently, these are all the modes I have data from.
  245. * More might exist. Unclear how to find the native resolution
  246. * of the panel in here so we could always accept it
  247. * by disabling the scaler.
  248. */
  249. if ((mode->hdisplay == 800 && mode->vdisplay == 600) ||
  250. (mode->hdisplay == 640 && mode->vdisplay == 480) ||
  251. (mode->hdisplay == 1024 && mode->vdisplay == 768)) {
  252. return MODE_OK;
  253. } else {
  254. return MODE_ONE_SIZE; /* Is this a reasonable error? */
  255. }
  256. }
  257. static void ns2501_mode_set(struct intel_dvo_device *dvo,
  258. struct drm_display_mode *mode,
  259. struct drm_display_mode *adjusted_mode)
  260. {
  261. bool ok;
  262. bool restore = false;
  263. struct ns2501_priv *ns = (struct ns2501_priv *)(dvo->dev_priv);
  264. DRM_DEBUG_KMS
  265. ("%s: set mode (hdisplay=%d,htotal=%d,vdisplay=%d,vtotal=%d).\n",
  266. __FUNCTION__, mode->hdisplay, mode->htotal, mode->vdisplay,
  267. mode->vtotal);
  268. /*
  269. * Where do I find the native resolution for which scaling is not required???
  270. *
  271. * First trigger the DVO on as otherwise the chip does not appear on the i2c
  272. * bus.
  273. */
  274. do {
  275. ok = true;
  276. if (mode->hdisplay == 800 && mode->vdisplay == 600) {
  277. /* mode 277 */
  278. ns->reg_8_shadow &= ~NS2501_8_BPAS;
  279. DRM_DEBUG_KMS("%s: switching to 800x600\n",
  280. __FUNCTION__);
  281. /*
  282. * No, I do not know where this data comes from.
  283. * It is just what the video bios left in the DVO, so
  284. * I'm just copying it here over.
  285. * This also means that I cannot support any other modes
  286. * except the ones supported by the bios.
  287. */
  288. ok &= ns2501_writeb(dvo, 0x11, 0xc8); // 0xc7 also works.
  289. ok &= ns2501_writeb(dvo, 0x1b, 0x19);
  290. ok &= ns2501_writeb(dvo, 0x1c, 0x62); // VBIOS left 0x64 here, but 0x62 works nicer
  291. ok &= ns2501_writeb(dvo, 0x1d, 0x02);
  292. ok &= ns2501_writeb(dvo, 0x34, 0x03);
  293. ok &= ns2501_writeb(dvo, 0x35, 0xff);
  294. ok &= ns2501_writeb(dvo, 0x80, 0x27);
  295. ok &= ns2501_writeb(dvo, 0x81, 0x03);
  296. ok &= ns2501_writeb(dvo, 0x82, 0x41);
  297. ok &= ns2501_writeb(dvo, 0x83, 0x05);
  298. ok &= ns2501_writeb(dvo, 0x8d, 0x02);
  299. ok &= ns2501_writeb(dvo, 0x8e, 0x04);
  300. ok &= ns2501_writeb(dvo, 0x8f, 0x00);
  301. ok &= ns2501_writeb(dvo, 0x90, 0xfe); /* vertical. VBIOS left 0xff here, but 0xfe works better */
  302. ok &= ns2501_writeb(dvo, 0x91, 0x07);
  303. ok &= ns2501_writeb(dvo, 0x94, 0x00);
  304. ok &= ns2501_writeb(dvo, 0x95, 0x00);
  305. ok &= ns2501_writeb(dvo, 0x96, 0x00);
  306. ok &= ns2501_writeb(dvo, 0x99, 0x00);
  307. ok &= ns2501_writeb(dvo, 0x9a, 0x88);
  308. ok &= ns2501_writeb(dvo, 0x9c, 0x23); /* Looks like first and last line of the image. */
  309. ok &= ns2501_writeb(dvo, 0x9d, 0x00);
  310. ok &= ns2501_writeb(dvo, 0x9e, 0x25);
  311. ok &= ns2501_writeb(dvo, 0x9f, 0x03);
  312. ok &= ns2501_writeb(dvo, 0xa4, 0x80);
  313. ok &= ns2501_writeb(dvo, 0xb6, 0x00);
  314. ok &= ns2501_writeb(dvo, 0xb9, 0xc8); /* horizontal? */
  315. ok &= ns2501_writeb(dvo, 0xba, 0x00); /* horizontal? */
  316. ok &= ns2501_writeb(dvo, 0xc0, 0x05); /* horizontal? */
  317. ok &= ns2501_writeb(dvo, 0xc1, 0xd7);
  318. ok &= ns2501_writeb(dvo, 0xc2, 0x00);
  319. ok &= ns2501_writeb(dvo, 0xc3, 0xf8);
  320. ok &= ns2501_writeb(dvo, 0xc4, 0x03);
  321. ok &= ns2501_writeb(dvo, 0xc5, 0x1a);
  322. ok &= ns2501_writeb(dvo, 0xc6, 0x00);
  323. ok &= ns2501_writeb(dvo, 0xc7, 0x73);
  324. ok &= ns2501_writeb(dvo, 0xc8, 0x02);
  325. } else if (mode->hdisplay == 640 && mode->vdisplay == 480) {
  326. /* mode 274 */
  327. DRM_DEBUG_KMS("%s: switching to 640x480\n",
  328. __FUNCTION__);
  329. /*
  330. * No, I do not know where this data comes from.
  331. * It is just what the video bios left in the DVO, so
  332. * I'm just copying it here over.
  333. * This also means that I cannot support any other modes
  334. * except the ones supported by the bios.
  335. */
  336. ns->reg_8_shadow &= ~NS2501_8_BPAS;
  337. ok &= ns2501_writeb(dvo, 0x11, 0xa0);
  338. ok &= ns2501_writeb(dvo, 0x1b, 0x11);
  339. ok &= ns2501_writeb(dvo, 0x1c, 0x54);
  340. ok &= ns2501_writeb(dvo, 0x1d, 0x03);
  341. ok &= ns2501_writeb(dvo, 0x34, 0x03);
  342. ok &= ns2501_writeb(dvo, 0x35, 0xff);
  343. ok &= ns2501_writeb(dvo, 0x80, 0xff);
  344. ok &= ns2501_writeb(dvo, 0x81, 0x07);
  345. ok &= ns2501_writeb(dvo, 0x82, 0x3d);
  346. ok &= ns2501_writeb(dvo, 0x83, 0x05);
  347. ok &= ns2501_writeb(dvo, 0x8d, 0x02);
  348. ok &= ns2501_writeb(dvo, 0x8e, 0x10);
  349. ok &= ns2501_writeb(dvo, 0x8f, 0x00);
  350. ok &= ns2501_writeb(dvo, 0x90, 0xff); /* vertical */
  351. ok &= ns2501_writeb(dvo, 0x91, 0x07);
  352. ok &= ns2501_writeb(dvo, 0x94, 0x00);
  353. ok &= ns2501_writeb(dvo, 0x95, 0x00);
  354. ok &= ns2501_writeb(dvo, 0x96, 0x05);
  355. ok &= ns2501_writeb(dvo, 0x99, 0x00);
  356. ok &= ns2501_writeb(dvo, 0x9a, 0x88);
  357. ok &= ns2501_writeb(dvo, 0x9c, 0x24);
  358. ok &= ns2501_writeb(dvo, 0x9d, 0x00);
  359. ok &= ns2501_writeb(dvo, 0x9e, 0x25);
  360. ok &= ns2501_writeb(dvo, 0x9f, 0x03);
  361. ok &= ns2501_writeb(dvo, 0xa4, 0x84);
  362. ok &= ns2501_writeb(dvo, 0xb6, 0x09);
  363. ok &= ns2501_writeb(dvo, 0xb9, 0xa0); /* horizontal? */
  364. ok &= ns2501_writeb(dvo, 0xba, 0x00); /* horizontal? */
  365. ok &= ns2501_writeb(dvo, 0xc0, 0x05); /* horizontal? */
  366. ok &= ns2501_writeb(dvo, 0xc1, 0x90);
  367. ok &= ns2501_writeb(dvo, 0xc2, 0x00);
  368. ok &= ns2501_writeb(dvo, 0xc3, 0x0f);
  369. ok &= ns2501_writeb(dvo, 0xc4, 0x03);
  370. ok &= ns2501_writeb(dvo, 0xc5, 0x16);
  371. ok &= ns2501_writeb(dvo, 0xc6, 0x00);
  372. ok &= ns2501_writeb(dvo, 0xc7, 0x02);
  373. ok &= ns2501_writeb(dvo, 0xc8, 0x02);
  374. } else if (mode->hdisplay == 1024 && mode->vdisplay == 768) {
  375. /* mode 280 */
  376. DRM_DEBUG_KMS("%s: switching to 1024x768\n",
  377. __FUNCTION__);
  378. /*
  379. * This might or might not work, actually. I'm silently
  380. * assuming here that the native panel resolution is
  381. * 1024x768. If not, then this leaves the scaler disabled
  382. * generating a picture that is likely not the expected.
  383. *
  384. * Problem is that I do not know where to take the panel
  385. * dimensions from.
  386. *
  387. * Enable the bypass, scaling not required.
  388. *
  389. * The scaler registers are irrelevant here....
  390. *
  391. */
  392. ns->reg_8_shadow |= NS2501_8_BPAS;
  393. ok &= ns2501_writeb(dvo, 0x37, 0x44);
  394. } else {
  395. /*
  396. * Data not known. Bummer!
  397. * Hopefully, the code should not go here
  398. * as mode_OK delivered no other modes.
  399. */
  400. ns->reg_8_shadow |= NS2501_8_BPAS;
  401. }
  402. ok &= ns2501_writeb(dvo, NS2501_REG8, ns->reg_8_shadow);
  403. if (!ok) {
  404. if (restore)
  405. restore_dvo(dvo);
  406. enable_dvo(dvo);
  407. restore = true;
  408. }
  409. } while (!ok);
  410. /*
  411. * Restore the old i915 registers before
  412. * forcing the ns2501 on.
  413. */
  414. if (restore)
  415. restore_dvo(dvo);
  416. }
  417. /* set the NS2501 power state */
  418. static bool ns2501_get_hw_state(struct intel_dvo_device *dvo)
  419. {
  420. unsigned char ch;
  421. if (!ns2501_readb(dvo, NS2501_REG8, &ch))
  422. return false;
  423. if (ch & NS2501_8_PD)
  424. return true;
  425. else
  426. return false;
  427. }
  428. /* set the NS2501 power state */
  429. static void ns2501_dpms(struct intel_dvo_device *dvo, bool enable)
  430. {
  431. bool ok;
  432. bool restore = false;
  433. struct ns2501_priv *ns = (struct ns2501_priv *)(dvo->dev_priv);
  434. unsigned char ch;
  435. DRM_DEBUG_KMS("%s: Trying set the dpms of the DVO to %i\n",
  436. __FUNCTION__, enable);
  437. ch = ns->reg_8_shadow;
  438. if (enable)
  439. ch |= NS2501_8_PD;
  440. else
  441. ch &= ~NS2501_8_PD;
  442. if (ns->reg_8_set == 0 || ns->reg_8_shadow != ch) {
  443. ns->reg_8_set = 1;
  444. ns->reg_8_shadow = ch;
  445. do {
  446. ok = true;
  447. ok &= ns2501_writeb(dvo, NS2501_REG8, ch);
  448. ok &=
  449. ns2501_writeb(dvo, 0x34,
  450. enable ? 0x03 : 0x00);
  451. ok &=
  452. ns2501_writeb(dvo, 0x35,
  453. enable ? 0xff : 0x00);
  454. if (!ok) {
  455. if (restore)
  456. restore_dvo(dvo);
  457. enable_dvo(dvo);
  458. restore = true;
  459. }
  460. } while (!ok);
  461. if (restore)
  462. restore_dvo(dvo);
  463. }
  464. }
  465. static void ns2501_dump_regs(struct intel_dvo_device *dvo)
  466. {
  467. uint8_t val;
  468. ns2501_readb(dvo, NS2501_FREQ_LO, &val);
  469. DRM_LOG_KMS("NS2501_FREQ_LO: 0x%02x\n", val);
  470. ns2501_readb(dvo, NS2501_FREQ_HI, &val);
  471. DRM_LOG_KMS("NS2501_FREQ_HI: 0x%02x\n", val);
  472. ns2501_readb(dvo, NS2501_REG8, &val);
  473. DRM_LOG_KMS("NS2501_REG8: 0x%02x\n", val);
  474. ns2501_readb(dvo, NS2501_REG9, &val);
  475. DRM_LOG_KMS("NS2501_REG9: 0x%02x\n", val);
  476. ns2501_readb(dvo, NS2501_REGC, &val);
  477. DRM_LOG_KMS("NS2501_REGC: 0x%02x\n", val);
  478. }
  479. static void ns2501_destroy(struct intel_dvo_device *dvo)
  480. {
  481. struct ns2501_priv *ns = dvo->dev_priv;
  482. if (ns) {
  483. kfree(ns);
  484. dvo->dev_priv = NULL;
  485. }
  486. }
  487. struct intel_dvo_dev_ops ns2501_ops = {
  488. .init = ns2501_init,
  489. .detect = ns2501_detect,
  490. .mode_valid = ns2501_mode_valid,
  491. .mode_set = ns2501_mode_set,
  492. .dpms = ns2501_dpms,
  493. .get_hw_state = ns2501_get_hw_state,
  494. .dump_regs = ns2501_dump_regs,
  495. .destroy = ns2501_destroy,
  496. };