intel_sdvo_regs.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  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. /**
  27. * @file SDVO command definitions and structures.
  28. */
  29. #define SDVO_OUTPUT_FIRST (0)
  30. #define SDVO_OUTPUT_TMDS0 (1 << 0)
  31. #define SDVO_OUTPUT_RGB0 (1 << 1)
  32. #define SDVO_OUTPUT_CVBS0 (1 << 2)
  33. #define SDVO_OUTPUT_SVID0 (1 << 3)
  34. #define SDVO_OUTPUT_YPRPB0 (1 << 4)
  35. #define SDVO_OUTPUT_SCART0 (1 << 5)
  36. #define SDVO_OUTPUT_LVDS0 (1 << 6)
  37. #define SDVO_OUTPUT_TMDS1 (1 << 8)
  38. #define SDVO_OUTPUT_RGB1 (1 << 9)
  39. #define SDVO_OUTPUT_CVBS1 (1 << 10)
  40. #define SDVO_OUTPUT_SVID1 (1 << 11)
  41. #define SDVO_OUTPUT_YPRPB1 (1 << 12)
  42. #define SDVO_OUTPUT_SCART1 (1 << 13)
  43. #define SDVO_OUTPUT_LVDS1 (1 << 14)
  44. #define SDVO_OUTPUT_LAST (14)
  45. struct intel_sdvo_caps {
  46. u8 vendor_id;
  47. u8 device_id;
  48. u8 device_rev_id;
  49. u8 sdvo_version_major;
  50. u8 sdvo_version_minor;
  51. unsigned int sdvo_inputs_mask:2;
  52. unsigned int smooth_scaling:1;
  53. unsigned int sharp_scaling:1;
  54. unsigned int up_scaling:1;
  55. unsigned int down_scaling:1;
  56. unsigned int stall_support:1;
  57. unsigned int pad:1;
  58. u16 output_flags;
  59. } __packed;
  60. /* Note: SDVO detailed timing flags match EDID misc flags. */
  61. #define DTD_FLAG_HSYNC_POSITIVE (1 << 1)
  62. #define DTD_FLAG_VSYNC_POSITIVE (1 << 2)
  63. #define DTD_FLAG_INTERLACE (1 << 7)
  64. /** This matches the EDID DTD structure, more or less */
  65. struct intel_sdvo_dtd {
  66. struct {
  67. u16 clock; /**< pixel clock, in 10kHz units */
  68. u8 h_active; /**< lower 8 bits (pixels) */
  69. u8 h_blank; /**< lower 8 bits (pixels) */
  70. u8 h_high; /**< upper 4 bits each h_active, h_blank */
  71. u8 v_active; /**< lower 8 bits (lines) */
  72. u8 v_blank; /**< lower 8 bits (lines) */
  73. u8 v_high; /**< upper 4 bits each v_active, v_blank */
  74. } part1;
  75. struct {
  76. u8 h_sync_off; /**< lower 8 bits, from hblank start */
  77. u8 h_sync_width; /**< lower 8 bits (pixels) */
  78. /** lower 4 bits each vsync offset, vsync width */
  79. u8 v_sync_off_width;
  80. /**
  81. * 2 high bits of hsync offset, 2 high bits of hsync width,
  82. * bits 4-5 of vsync offset, and 2 high bits of vsync width.
  83. */
  84. u8 sync_off_width_high;
  85. u8 dtd_flags;
  86. u8 sdvo_flags;
  87. /** bits 6-7 of vsync offset at bits 6-7 */
  88. u8 v_sync_off_high;
  89. u8 reserved;
  90. } part2;
  91. } __packed;
  92. struct intel_sdvo_pixel_clock_range {
  93. u16 min; /**< pixel clock, in 10kHz units */
  94. u16 max; /**< pixel clock, in 10kHz units */
  95. } __packed;
  96. struct intel_sdvo_preferred_input_timing_args {
  97. u16 clock;
  98. u16 width;
  99. u16 height;
  100. u8 interlace:1;
  101. u8 scaled:1;
  102. u8 pad:6;
  103. } __packed;
  104. /* I2C registers for SDVO */
  105. #define SDVO_I2C_ARG_0 0x07
  106. #define SDVO_I2C_ARG_1 0x06
  107. #define SDVO_I2C_ARG_2 0x05
  108. #define SDVO_I2C_ARG_3 0x04
  109. #define SDVO_I2C_ARG_4 0x03
  110. #define SDVO_I2C_ARG_5 0x02
  111. #define SDVO_I2C_ARG_6 0x01
  112. #define SDVO_I2C_ARG_7 0x00
  113. #define SDVO_I2C_OPCODE 0x08
  114. #define SDVO_I2C_CMD_STATUS 0x09
  115. #define SDVO_I2C_RETURN_0 0x0a
  116. #define SDVO_I2C_RETURN_1 0x0b
  117. #define SDVO_I2C_RETURN_2 0x0c
  118. #define SDVO_I2C_RETURN_3 0x0d
  119. #define SDVO_I2C_RETURN_4 0x0e
  120. #define SDVO_I2C_RETURN_5 0x0f
  121. #define SDVO_I2C_RETURN_6 0x10
  122. #define SDVO_I2C_RETURN_7 0x11
  123. #define SDVO_I2C_VENDOR_BEGIN 0x20
  124. /* Status results */
  125. #define SDVO_CMD_STATUS_POWER_ON 0x0
  126. #define SDVO_CMD_STATUS_SUCCESS 0x1
  127. #define SDVO_CMD_STATUS_NOTSUPP 0x2
  128. #define SDVO_CMD_STATUS_INVALID_ARG 0x3
  129. #define SDVO_CMD_STATUS_PENDING 0x4
  130. #define SDVO_CMD_STATUS_TARGET_NOT_SPECIFIED 0x5
  131. #define SDVO_CMD_STATUS_SCALING_NOT_SUPP 0x6
  132. /* SDVO commands, argument/result registers */
  133. #define SDVO_CMD_RESET 0x01
  134. /** Returns a struct intel_sdvo_caps */
  135. #define SDVO_CMD_GET_DEVICE_CAPS 0x02
  136. #define SDVO_CMD_GET_FIRMWARE_REV 0x86
  137. # define SDVO_DEVICE_FIRMWARE_MINOR SDVO_I2C_RETURN_0
  138. # define SDVO_DEVICE_FIRMWARE_MAJOR SDVO_I2C_RETURN_1
  139. # define SDVO_DEVICE_FIRMWARE_PATCH SDVO_I2C_RETURN_2
  140. /**
  141. * Reports which inputs are trained (managed to sync).
  142. *
  143. * Devices must have trained within 2 vsyncs of a mode change.
  144. */
  145. #define SDVO_CMD_GET_TRAINED_INPUTS 0x03
  146. struct intel_sdvo_get_trained_inputs_response {
  147. unsigned int input0_trained:1;
  148. unsigned int input1_trained:1;
  149. unsigned int pad:6;
  150. } __packed;
  151. /** Returns a struct intel_sdvo_output_flags of active outputs. */
  152. #define SDVO_CMD_GET_ACTIVE_OUTPUTS 0x04
  153. /**
  154. * Sets the current set of active outputs.
  155. *
  156. * Takes a struct intel_sdvo_output_flags. Must be preceded by a SET_IN_OUT_MAP
  157. * on multi-output devices.
  158. */
  159. #define SDVO_CMD_SET_ACTIVE_OUTPUTS 0x05
  160. /**
  161. * Returns the current mapping of SDVO inputs to outputs on the device.
  162. *
  163. * Returns two struct intel_sdvo_output_flags structures.
  164. */
  165. #define SDVO_CMD_GET_IN_OUT_MAP 0x06
  166. struct intel_sdvo_in_out_map {
  167. u16 in0, in1;
  168. };
  169. /**
  170. * Sets the current mapping of SDVO inputs to outputs on the device.
  171. *
  172. * Takes two struct i380_sdvo_output_flags structures.
  173. */
  174. #define SDVO_CMD_SET_IN_OUT_MAP 0x07
  175. /**
  176. * Returns a struct intel_sdvo_output_flags of attached displays.
  177. */
  178. #define SDVO_CMD_GET_ATTACHED_DISPLAYS 0x0b
  179. /**
  180. * Returns a struct intel_sdvo_ouptut_flags of displays supporting hot plugging.
  181. */
  182. #define SDVO_CMD_GET_HOT_PLUG_SUPPORT 0x0c
  183. /**
  184. * Takes a struct intel_sdvo_output_flags.
  185. */
  186. #define SDVO_CMD_SET_ACTIVE_HOT_PLUG 0x0d
  187. /**
  188. * Returns a struct intel_sdvo_output_flags of displays with hot plug
  189. * interrupts enabled.
  190. */
  191. #define SDVO_CMD_GET_ACTIVE_HOT_PLUG 0x0e
  192. #define SDVO_CMD_GET_INTERRUPT_EVENT_SOURCE 0x0f
  193. struct intel_sdvo_get_interrupt_event_source_response {
  194. u16 interrupt_status;
  195. unsigned int ambient_light_interrupt:1;
  196. unsigned int hdmi_audio_encrypt_change:1;
  197. unsigned int pad:6;
  198. } __packed;
  199. /**
  200. * Selects which input is affected by future input commands.
  201. *
  202. * Commands affected include SET_INPUT_TIMINGS_PART[12],
  203. * GET_INPUT_TIMINGS_PART[12], GET_PREFERRED_INPUT_TIMINGS_PART[12],
  204. * GET_INPUT_PIXEL_CLOCK_RANGE, and CREATE_PREFERRED_INPUT_TIMINGS.
  205. */
  206. #define SDVO_CMD_SET_TARGET_INPUT 0x10
  207. struct intel_sdvo_set_target_input_args {
  208. unsigned int target_1:1;
  209. unsigned int pad:7;
  210. } __packed;
  211. /**
  212. * Takes a struct intel_sdvo_output_flags of which outputs are targeted by
  213. * future output commands.
  214. *
  215. * Affected commands inclue SET_OUTPUT_TIMINGS_PART[12],
  216. * GET_OUTPUT_TIMINGS_PART[12], and GET_OUTPUT_PIXEL_CLOCK_RANGE.
  217. */
  218. #define SDVO_CMD_SET_TARGET_OUTPUT 0x11
  219. #define SDVO_CMD_GET_INPUT_TIMINGS_PART1 0x12
  220. #define SDVO_CMD_GET_INPUT_TIMINGS_PART2 0x13
  221. #define SDVO_CMD_SET_INPUT_TIMINGS_PART1 0x14
  222. #define SDVO_CMD_SET_INPUT_TIMINGS_PART2 0x15
  223. #define SDVO_CMD_SET_OUTPUT_TIMINGS_PART1 0x16
  224. #define SDVO_CMD_SET_OUTPUT_TIMINGS_PART2 0x17
  225. #define SDVO_CMD_GET_OUTPUT_TIMINGS_PART1 0x18
  226. #define SDVO_CMD_GET_OUTPUT_TIMINGS_PART2 0x19
  227. /* Part 1 */
  228. # define SDVO_DTD_CLOCK_LOW SDVO_I2C_ARG_0
  229. # define SDVO_DTD_CLOCK_HIGH SDVO_I2C_ARG_1
  230. # define SDVO_DTD_H_ACTIVE SDVO_I2C_ARG_2
  231. # define SDVO_DTD_H_BLANK SDVO_I2C_ARG_3
  232. # define SDVO_DTD_H_HIGH SDVO_I2C_ARG_4
  233. # define SDVO_DTD_V_ACTIVE SDVO_I2C_ARG_5
  234. # define SDVO_DTD_V_BLANK SDVO_I2C_ARG_6
  235. # define SDVO_DTD_V_HIGH SDVO_I2C_ARG_7
  236. /* Part 2 */
  237. # define SDVO_DTD_HSYNC_OFF SDVO_I2C_ARG_0
  238. # define SDVO_DTD_HSYNC_WIDTH SDVO_I2C_ARG_1
  239. # define SDVO_DTD_VSYNC_OFF_WIDTH SDVO_I2C_ARG_2
  240. # define SDVO_DTD_SYNC_OFF_WIDTH_HIGH SDVO_I2C_ARG_3
  241. # define SDVO_DTD_DTD_FLAGS SDVO_I2C_ARG_4
  242. # define SDVO_DTD_DTD_FLAG_INTERLACED (1 << 7)
  243. # define SDVO_DTD_DTD_FLAG_STEREO_MASK (3 << 5)
  244. # define SDVO_DTD_DTD_FLAG_INPUT_MASK (3 << 3)
  245. # define SDVO_DTD_DTD_FLAG_SYNC_MASK (3 << 1)
  246. # define SDVO_DTD_SDVO_FLAS SDVO_I2C_ARG_5
  247. # define SDVO_DTD_SDVO_FLAG_STALL (1 << 7)
  248. # define SDVO_DTD_SDVO_FLAG_CENTERED (0 << 6)
  249. # define SDVO_DTD_SDVO_FLAG_UPPER_LEFT (1 << 6)
  250. # define SDVO_DTD_SDVO_FLAG_SCALING_MASK (3 << 4)
  251. # define SDVO_DTD_SDVO_FLAG_SCALING_NONE (0 << 4)
  252. # define SDVO_DTD_SDVO_FLAG_SCALING_SHARP (1 << 4)
  253. # define SDVO_DTD_SDVO_FLAG_SCALING_SMOOTH (2 << 4)
  254. # define SDVO_DTD_VSYNC_OFF_HIGH SDVO_I2C_ARG_6
  255. /**
  256. * Generates a DTD based on the given width, height, and flags.
  257. *
  258. * This will be supported by any device supporting scaling or interlaced
  259. * modes.
  260. */
  261. #define SDVO_CMD_CREATE_PREFERRED_INPUT_TIMING 0x1a
  262. # define SDVO_PREFERRED_INPUT_TIMING_CLOCK_LOW SDVO_I2C_ARG_0
  263. # define SDVO_PREFERRED_INPUT_TIMING_CLOCK_HIGH SDVO_I2C_ARG_1
  264. # define SDVO_PREFERRED_INPUT_TIMING_WIDTH_LOW SDVO_I2C_ARG_2
  265. # define SDVO_PREFERRED_INPUT_TIMING_WIDTH_HIGH SDVO_I2C_ARG_3
  266. # define SDVO_PREFERRED_INPUT_TIMING_HEIGHT_LOW SDVO_I2C_ARG_4
  267. # define SDVO_PREFERRED_INPUT_TIMING_HEIGHT_HIGH SDVO_I2C_ARG_5
  268. # define SDVO_PREFERRED_INPUT_TIMING_FLAGS SDVO_I2C_ARG_6
  269. # define SDVO_PREFERRED_INPUT_TIMING_FLAGS_INTERLACED (1 << 0)
  270. # define SDVO_PREFERRED_INPUT_TIMING_FLAGS_SCALED (1 << 1)
  271. #define SDVO_CMD_GET_PREFERRED_INPUT_TIMING_PART1 0x1b
  272. #define SDVO_CMD_GET_PREFERRED_INPUT_TIMING_PART2 0x1c
  273. /** Returns a struct intel_sdvo_pixel_clock_range */
  274. #define SDVO_CMD_GET_INPUT_PIXEL_CLOCK_RANGE 0x1d
  275. /** Returns a struct intel_sdvo_pixel_clock_range */
  276. #define SDVO_CMD_GET_OUTPUT_PIXEL_CLOCK_RANGE 0x1e
  277. /** Returns a byte bitfield containing SDVO_CLOCK_RATE_MULT_* flags */
  278. #define SDVO_CMD_GET_SUPPORTED_CLOCK_RATE_MULTS 0x1f
  279. /** Returns a byte containing a SDVO_CLOCK_RATE_MULT_* flag */
  280. #define SDVO_CMD_GET_CLOCK_RATE_MULT 0x20
  281. /** Takes a byte containing a SDVO_CLOCK_RATE_MULT_* flag */
  282. #define SDVO_CMD_SET_CLOCK_RATE_MULT 0x21
  283. # define SDVO_CLOCK_RATE_MULT_1X (1 << 0)
  284. # define SDVO_CLOCK_RATE_MULT_2X (1 << 1)
  285. # define SDVO_CLOCK_RATE_MULT_4X (1 << 3)
  286. #define SDVO_CMD_GET_SUPPORTED_TV_FORMATS 0x27
  287. /** 6 bytes of bit flags for TV formats shared by all TV format functions */
  288. struct intel_sdvo_tv_format {
  289. unsigned int ntsc_m:1;
  290. unsigned int ntsc_j:1;
  291. unsigned int ntsc_443:1;
  292. unsigned int pal_b:1;
  293. unsigned int pal_d:1;
  294. unsigned int pal_g:1;
  295. unsigned int pal_h:1;
  296. unsigned int pal_i:1;
  297. unsigned int pal_m:1;
  298. unsigned int pal_n:1;
  299. unsigned int pal_nc:1;
  300. unsigned int pal_60:1;
  301. unsigned int secam_b:1;
  302. unsigned int secam_d:1;
  303. unsigned int secam_g:1;
  304. unsigned int secam_k:1;
  305. unsigned int secam_k1:1;
  306. unsigned int secam_l:1;
  307. unsigned int secam_60:1;
  308. unsigned int hdtv_std_smpte_240m_1080i_59:1;
  309. unsigned int hdtv_std_smpte_240m_1080i_60:1;
  310. unsigned int hdtv_std_smpte_260m_1080i_59:1;
  311. unsigned int hdtv_std_smpte_260m_1080i_60:1;
  312. unsigned int hdtv_std_smpte_274m_1080i_50:1;
  313. unsigned int hdtv_std_smpte_274m_1080i_59:1;
  314. unsigned int hdtv_std_smpte_274m_1080i_60:1;
  315. unsigned int hdtv_std_smpte_274m_1080p_23:1;
  316. unsigned int hdtv_std_smpte_274m_1080p_24:1;
  317. unsigned int hdtv_std_smpte_274m_1080p_25:1;
  318. unsigned int hdtv_std_smpte_274m_1080p_29:1;
  319. unsigned int hdtv_std_smpte_274m_1080p_30:1;
  320. unsigned int hdtv_std_smpte_274m_1080p_50:1;
  321. unsigned int hdtv_std_smpte_274m_1080p_59:1;
  322. unsigned int hdtv_std_smpte_274m_1080p_60:1;
  323. unsigned int hdtv_std_smpte_295m_1080i_50:1;
  324. unsigned int hdtv_std_smpte_295m_1080p_50:1;
  325. unsigned int hdtv_std_smpte_296m_720p_59:1;
  326. unsigned int hdtv_std_smpte_296m_720p_60:1;
  327. unsigned int hdtv_std_smpte_296m_720p_50:1;
  328. unsigned int hdtv_std_smpte_293m_480p_59:1;
  329. unsigned int hdtv_std_smpte_170m_480i_59:1;
  330. unsigned int hdtv_std_iturbt601_576i_50:1;
  331. unsigned int hdtv_std_iturbt601_576p_50:1;
  332. unsigned int hdtv_std_eia_7702a_480i_60:1;
  333. unsigned int hdtv_std_eia_7702a_480p_60:1;
  334. unsigned int pad:3;
  335. } __packed;
  336. #define SDVO_CMD_GET_TV_FORMAT 0x28
  337. #define SDVO_CMD_SET_TV_FORMAT 0x29
  338. /** Returns the resolutiosn that can be used with the given TV format */
  339. #define SDVO_CMD_GET_SDTV_RESOLUTION_SUPPORT 0x83
  340. struct intel_sdvo_sdtv_resolution_request {
  341. unsigned int ntsc_m:1;
  342. unsigned int ntsc_j:1;
  343. unsigned int ntsc_443:1;
  344. unsigned int pal_b:1;
  345. unsigned int pal_d:1;
  346. unsigned int pal_g:1;
  347. unsigned int pal_h:1;
  348. unsigned int pal_i:1;
  349. unsigned int pal_m:1;
  350. unsigned int pal_n:1;
  351. unsigned int pal_nc:1;
  352. unsigned int pal_60:1;
  353. unsigned int secam_b:1;
  354. unsigned int secam_d:1;
  355. unsigned int secam_g:1;
  356. unsigned int secam_k:1;
  357. unsigned int secam_k1:1;
  358. unsigned int secam_l:1;
  359. unsigned int secam_60:1;
  360. unsigned int pad:5;
  361. } __packed;
  362. struct intel_sdvo_sdtv_resolution_reply {
  363. unsigned int res_320x200:1;
  364. unsigned int res_320x240:1;
  365. unsigned int res_400x300:1;
  366. unsigned int res_640x350:1;
  367. unsigned int res_640x400:1;
  368. unsigned int res_640x480:1;
  369. unsigned int res_704x480:1;
  370. unsigned int res_704x576:1;
  371. unsigned int res_720x350:1;
  372. unsigned int res_720x400:1;
  373. unsigned int res_720x480:1;
  374. unsigned int res_720x540:1;
  375. unsigned int res_720x576:1;
  376. unsigned int res_768x576:1;
  377. unsigned int res_800x600:1;
  378. unsigned int res_832x624:1;
  379. unsigned int res_920x766:1;
  380. unsigned int res_1024x768:1;
  381. unsigned int res_1280x1024:1;
  382. unsigned int pad:5;
  383. } __packed;
  384. /* Get supported resolution with squire pixel aspect ratio that can be
  385. scaled for the requested HDTV format */
  386. #define SDVO_CMD_GET_SCALED_HDTV_RESOLUTION_SUPPORT 0x85
  387. struct intel_sdvo_hdtv_resolution_request {
  388. unsigned int hdtv_std_smpte_240m_1080i_59:1;
  389. unsigned int hdtv_std_smpte_240m_1080i_60:1;
  390. unsigned int hdtv_std_smpte_260m_1080i_59:1;
  391. unsigned int hdtv_std_smpte_260m_1080i_60:1;
  392. unsigned int hdtv_std_smpte_274m_1080i_50:1;
  393. unsigned int hdtv_std_smpte_274m_1080i_59:1;
  394. unsigned int hdtv_std_smpte_274m_1080i_60:1;
  395. unsigned int hdtv_std_smpte_274m_1080p_23:1;
  396. unsigned int hdtv_std_smpte_274m_1080p_24:1;
  397. unsigned int hdtv_std_smpte_274m_1080p_25:1;
  398. unsigned int hdtv_std_smpte_274m_1080p_29:1;
  399. unsigned int hdtv_std_smpte_274m_1080p_30:1;
  400. unsigned int hdtv_std_smpte_274m_1080p_50:1;
  401. unsigned int hdtv_std_smpte_274m_1080p_59:1;
  402. unsigned int hdtv_std_smpte_274m_1080p_60:1;
  403. unsigned int hdtv_std_smpte_295m_1080i_50:1;
  404. unsigned int hdtv_std_smpte_295m_1080p_50:1;
  405. unsigned int hdtv_std_smpte_296m_720p_59:1;
  406. unsigned int hdtv_std_smpte_296m_720p_60:1;
  407. unsigned int hdtv_std_smpte_296m_720p_50:1;
  408. unsigned int hdtv_std_smpte_293m_480p_59:1;
  409. unsigned int hdtv_std_smpte_170m_480i_59:1;
  410. unsigned int hdtv_std_iturbt601_576i_50:1;
  411. unsigned int hdtv_std_iturbt601_576p_50:1;
  412. unsigned int hdtv_std_eia_7702a_480i_60:1;
  413. unsigned int hdtv_std_eia_7702a_480p_60:1;
  414. unsigned int pad:6;
  415. } __packed;
  416. struct intel_sdvo_hdtv_resolution_reply {
  417. unsigned int res_640x480:1;
  418. unsigned int res_800x600:1;
  419. unsigned int res_1024x768:1;
  420. unsigned int res_1280x960:1;
  421. unsigned int res_1400x1050:1;
  422. unsigned int res_1600x1200:1;
  423. unsigned int res_1920x1440:1;
  424. unsigned int res_2048x1536:1;
  425. unsigned int res_2560x1920:1;
  426. unsigned int res_3200x2400:1;
  427. unsigned int res_3840x2880:1;
  428. unsigned int pad1:5;
  429. unsigned int res_848x480:1;
  430. unsigned int res_1064x600:1;
  431. unsigned int res_1280x720:1;
  432. unsigned int res_1360x768:1;
  433. unsigned int res_1704x960:1;
  434. unsigned int res_1864x1050:1;
  435. unsigned int res_1920x1080:1;
  436. unsigned int res_2128x1200:1;
  437. unsigned int res_2560x1400:1;
  438. unsigned int res_2728x1536:1;
  439. unsigned int res_3408x1920:1;
  440. unsigned int res_4264x2400:1;
  441. unsigned int res_5120x2880:1;
  442. unsigned int pad2:3;
  443. unsigned int res_768x480:1;
  444. unsigned int res_960x600:1;
  445. unsigned int res_1152x720:1;
  446. unsigned int res_1124x768:1;
  447. unsigned int res_1536x960:1;
  448. unsigned int res_1680x1050:1;
  449. unsigned int res_1728x1080:1;
  450. unsigned int res_1920x1200:1;
  451. unsigned int res_2304x1440:1;
  452. unsigned int res_2456x1536:1;
  453. unsigned int res_3072x1920:1;
  454. unsigned int res_3840x2400:1;
  455. unsigned int res_4608x2880:1;
  456. unsigned int pad3:3;
  457. unsigned int res_1280x1024:1;
  458. unsigned int pad4:7;
  459. unsigned int res_1280x768:1;
  460. unsigned int pad5:7;
  461. } __packed;
  462. /* Get supported power state returns info for encoder and monitor, rely on
  463. last SetTargetInput and SetTargetOutput calls */
  464. #define SDVO_CMD_GET_SUPPORTED_POWER_STATES 0x2a
  465. /* Get power state returns info for encoder and monitor, rely on last
  466. SetTargetInput and SetTargetOutput calls */
  467. #define SDVO_CMD_GET_POWER_STATE 0x2b
  468. #define SDVO_CMD_GET_ENCODER_POWER_STATE 0x2b
  469. #define SDVO_CMD_SET_ENCODER_POWER_STATE 0x2c
  470. # define SDVO_ENCODER_STATE_ON (1 << 0)
  471. # define SDVO_ENCODER_STATE_STANDBY (1 << 1)
  472. # define SDVO_ENCODER_STATE_SUSPEND (1 << 2)
  473. # define SDVO_ENCODER_STATE_OFF (1 << 3)
  474. # define SDVO_MONITOR_STATE_ON (1 << 4)
  475. # define SDVO_MONITOR_STATE_STANDBY (1 << 5)
  476. # define SDVO_MONITOR_STATE_SUSPEND (1 << 6)
  477. # define SDVO_MONITOR_STATE_OFF (1 << 7)
  478. #define SDVO_CMD_GET_MAX_PANEL_POWER_SEQUENCING 0x2d
  479. #define SDVO_CMD_GET_PANEL_POWER_SEQUENCING 0x2e
  480. #define SDVO_CMD_SET_PANEL_POWER_SEQUENCING 0x2f
  481. /**
  482. * The panel power sequencing parameters are in units of milliseconds.
  483. * The high fields are bits 8:9 of the 10-bit values.
  484. */
  485. struct sdvo_panel_power_sequencing {
  486. u8 t0;
  487. u8 t1;
  488. u8 t2;
  489. u8 t3;
  490. u8 t4;
  491. unsigned int t0_high:2;
  492. unsigned int t1_high:2;
  493. unsigned int t2_high:2;
  494. unsigned int t3_high:2;
  495. unsigned int t4_high:2;
  496. unsigned int pad:6;
  497. } __packed;
  498. #define SDVO_CMD_GET_MAX_BACKLIGHT_LEVEL 0x30
  499. struct sdvo_max_backlight_reply {
  500. u8 max_value;
  501. u8 default_value;
  502. } __packed;
  503. #define SDVO_CMD_GET_BACKLIGHT_LEVEL 0x31
  504. #define SDVO_CMD_SET_BACKLIGHT_LEVEL 0x32
  505. #define SDVO_CMD_GET_AMBIENT_LIGHT 0x33
  506. struct sdvo_get_ambient_light_reply {
  507. u16 trip_low;
  508. u16 trip_high;
  509. u16 value;
  510. } __packed;
  511. #define SDVO_CMD_SET_AMBIENT_LIGHT 0x34
  512. struct sdvo_set_ambient_light_reply {
  513. u16 trip_low;
  514. u16 trip_high;
  515. unsigned int enable:1;
  516. unsigned int pad:7;
  517. } __packed;
  518. /* Set display power state */
  519. #define SDVO_CMD_SET_DISPLAY_POWER_STATE 0x7d
  520. # define SDVO_DISPLAY_STATE_ON (1 << 0)
  521. # define SDVO_DISPLAY_STATE_STANDBY (1 << 1)
  522. # define SDVO_DISPLAY_STATE_SUSPEND (1 << 2)
  523. # define SDVO_DISPLAY_STATE_OFF (1 << 3)
  524. #define SDVO_CMD_GET_SUPPORTED_ENHANCEMENTS 0x84
  525. struct intel_sdvo_enhancements_reply {
  526. unsigned int flicker_filter:1;
  527. unsigned int flicker_filter_adaptive:1;
  528. unsigned int flicker_filter_2d:1;
  529. unsigned int saturation:1;
  530. unsigned int hue:1;
  531. unsigned int brightness:1;
  532. unsigned int contrast:1;
  533. unsigned int overscan_h:1;
  534. unsigned int overscan_v:1;
  535. unsigned int hpos:1;
  536. unsigned int vpos:1;
  537. unsigned int sharpness:1;
  538. unsigned int dot_crawl:1;
  539. unsigned int dither:1;
  540. unsigned int tv_chroma_filter:1;
  541. unsigned int tv_luma_filter:1;
  542. } __packed;
  543. /* Picture enhancement limits below are dependent on the current TV format,
  544. * and thus need to be queried and set after it.
  545. */
  546. #define SDVO_CMD_GET_MAX_FLICKER_FILTER 0x4d
  547. #define SDVO_CMD_GET_MAX_FLICKER_FILTER_ADAPTIVE 0x7b
  548. #define SDVO_CMD_GET_MAX_FLICKER_FILTER_2D 0x52
  549. #define SDVO_CMD_GET_MAX_SATURATION 0x55
  550. #define SDVO_CMD_GET_MAX_HUE 0x58
  551. #define SDVO_CMD_GET_MAX_BRIGHTNESS 0x5b
  552. #define SDVO_CMD_GET_MAX_CONTRAST 0x5e
  553. #define SDVO_CMD_GET_MAX_OVERSCAN_H 0x61
  554. #define SDVO_CMD_GET_MAX_OVERSCAN_V 0x64
  555. #define SDVO_CMD_GET_MAX_HPOS 0x67
  556. #define SDVO_CMD_GET_MAX_VPOS 0x6a
  557. #define SDVO_CMD_GET_MAX_SHARPNESS 0x6d
  558. #define SDVO_CMD_GET_MAX_TV_CHROMA_FILTER 0x74
  559. #define SDVO_CMD_GET_MAX_TV_LUMA_FILTER 0x77
  560. struct intel_sdvo_enhancement_limits_reply {
  561. u16 max_value;
  562. u16 default_value;
  563. } __packed;
  564. #define SDVO_CMD_GET_LVDS_PANEL_INFORMATION 0x7f
  565. #define SDVO_CMD_SET_LVDS_PANEL_INFORMATION 0x80
  566. # define SDVO_LVDS_COLOR_DEPTH_18 (0 << 0)
  567. # define SDVO_LVDS_COLOR_DEPTH_24 (1 << 0)
  568. # define SDVO_LVDS_CONNECTOR_SPWG (0 << 2)
  569. # define SDVO_LVDS_CONNECTOR_OPENLDI (1 << 2)
  570. # define SDVO_LVDS_SINGLE_CHANNEL (0 << 4)
  571. # define SDVO_LVDS_DUAL_CHANNEL (1 << 4)
  572. #define SDVO_CMD_GET_FLICKER_FILTER 0x4e
  573. #define SDVO_CMD_SET_FLICKER_FILTER 0x4f
  574. #define SDVO_CMD_GET_FLICKER_FILTER_ADAPTIVE 0x50
  575. #define SDVO_CMD_SET_FLICKER_FILTER_ADAPTIVE 0x51
  576. #define SDVO_CMD_GET_FLICKER_FILTER_2D 0x53
  577. #define SDVO_CMD_SET_FLICKER_FILTER_2D 0x54
  578. #define SDVO_CMD_GET_SATURATION 0x56
  579. #define SDVO_CMD_SET_SATURATION 0x57
  580. #define SDVO_CMD_GET_HUE 0x59
  581. #define SDVO_CMD_SET_HUE 0x5a
  582. #define SDVO_CMD_GET_BRIGHTNESS 0x5c
  583. #define SDVO_CMD_SET_BRIGHTNESS 0x5d
  584. #define SDVO_CMD_GET_CONTRAST 0x5f
  585. #define SDVO_CMD_SET_CONTRAST 0x60
  586. #define SDVO_CMD_GET_OVERSCAN_H 0x62
  587. #define SDVO_CMD_SET_OVERSCAN_H 0x63
  588. #define SDVO_CMD_GET_OVERSCAN_V 0x65
  589. #define SDVO_CMD_SET_OVERSCAN_V 0x66
  590. #define SDVO_CMD_GET_HPOS 0x68
  591. #define SDVO_CMD_SET_HPOS 0x69
  592. #define SDVO_CMD_GET_VPOS 0x6b
  593. #define SDVO_CMD_SET_VPOS 0x6c
  594. #define SDVO_CMD_GET_SHARPNESS 0x6e
  595. #define SDVO_CMD_SET_SHARPNESS 0x6f
  596. #define SDVO_CMD_GET_TV_CHROMA_FILTER 0x75
  597. #define SDVO_CMD_SET_TV_CHROMA_FILTER 0x76
  598. #define SDVO_CMD_GET_TV_LUMA_FILTER 0x78
  599. #define SDVO_CMD_SET_TV_LUMA_FILTER 0x79
  600. struct intel_sdvo_enhancements_arg {
  601. u16 value;
  602. } __packed;
  603. #define SDVO_CMD_GET_DOT_CRAWL 0x70
  604. #define SDVO_CMD_SET_DOT_CRAWL 0x71
  605. # define SDVO_DOT_CRAWL_ON (1 << 0)
  606. # define SDVO_DOT_CRAWL_DEFAULT_ON (1 << 1)
  607. #define SDVO_CMD_GET_DITHER 0x72
  608. #define SDVO_CMD_SET_DITHER 0x73
  609. # define SDVO_DITHER_ON (1 << 0)
  610. # define SDVO_DITHER_DEFAULT_ON (1 << 1)
  611. #define SDVO_CMD_SET_CONTROL_BUS_SWITCH 0x7a
  612. # define SDVO_CONTROL_BUS_PROM (1 << 0)
  613. # define SDVO_CONTROL_BUS_DDC1 (1 << 1)
  614. # define SDVO_CONTROL_BUS_DDC2 (1 << 2)
  615. # define SDVO_CONTROL_BUS_DDC3 (1 << 3)
  616. /* HDMI op codes */
  617. #define SDVO_CMD_GET_SUPP_ENCODE 0x9d
  618. #define SDVO_CMD_GET_ENCODE 0x9e
  619. #define SDVO_CMD_SET_ENCODE 0x9f
  620. #define SDVO_ENCODE_DVI 0x0
  621. #define SDVO_ENCODE_HDMI 0x1
  622. #define SDVO_CMD_SET_PIXEL_REPLI 0x8b
  623. #define SDVO_CMD_GET_PIXEL_REPLI 0x8c
  624. #define SDVO_CMD_GET_COLORIMETRY_CAP 0x8d
  625. #define SDVO_CMD_SET_COLORIMETRY 0x8e
  626. #define SDVO_COLORIMETRY_RGB256 0x0
  627. #define SDVO_COLORIMETRY_RGB220 0x1
  628. #define SDVO_COLORIMETRY_YCrCb422 0x3
  629. #define SDVO_COLORIMETRY_YCrCb444 0x4
  630. #define SDVO_CMD_GET_COLORIMETRY 0x8f
  631. #define SDVO_CMD_GET_AUDIO_ENCRYPT_PREFER 0x90
  632. #define SDVO_CMD_SET_AUDIO_STAT 0x91
  633. #define SDVO_CMD_GET_AUDIO_STAT 0x92
  634. #define SDVO_CMD_SET_HBUF_INDEX 0x93
  635. #define SDVO_HBUF_INDEX_ELD 0
  636. #define SDVO_HBUF_INDEX_AVI_IF 1
  637. #define SDVO_CMD_GET_HBUF_INDEX 0x94
  638. #define SDVO_CMD_GET_HBUF_INFO 0x95
  639. #define SDVO_CMD_SET_HBUF_AV_SPLIT 0x96
  640. #define SDVO_CMD_GET_HBUF_AV_SPLIT 0x97
  641. #define SDVO_CMD_SET_HBUF_DATA 0x98
  642. #define SDVO_CMD_GET_HBUF_DATA 0x99
  643. #define SDVO_CMD_SET_HBUF_TXRATE 0x9a
  644. #define SDVO_CMD_GET_HBUF_TXRATE 0x9b
  645. #define SDVO_HBUF_TX_DISABLED (0 << 6)
  646. #define SDVO_HBUF_TX_ONCE (2 << 6)
  647. #define SDVO_HBUF_TX_VSYNC (3 << 6)
  648. #define SDVO_CMD_GET_AUDIO_TX_INFO 0x9c
  649. #define SDVO_NEED_TO_STALL (1 << 7)
  650. struct intel_sdvo_encode {
  651. u8 dvi_rev;
  652. u8 hdmi_rev;
  653. } __packed;