si_mhl_tx.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. SiI8348 Linux Driver
  3. Copyright (C) 2013 Silicon Image, Inc.
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License as
  6. published by the Free Software Foundation version 2.
  7. This program is distributed AS-IS WITHOUT ANY WARRANTY of any
  8. kind, whether express or implied; INCLUDING without the implied warranty
  9. of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE or NON-INFRINGEMENT. See
  10. the GNU General Public License for more details at http://www.gnu.org/licenses/gpl-2.0.html.
  11. */
  12. /*
  13. @file si_mhl_tx.h
  14. */
  15. #include "sii_hal.h"
  16. #define SCRATCHPAD_SIZE 16
  17. typedef union
  18. {
  19. Mhl2VideoFormatData_t videoFormatData;
  20. uint8_t asBytes[SCRATCHPAD_SIZE];
  21. #ifdef MEDIA_DATA_TUNNEL_SUPPORT //(
  22. mdt_burst_01_t mdtPackets;
  23. #endif //)
  24. }ScratchPad_u,*PScratchPad_u;
  25. typedef enum
  26. {
  27. qs_auto_select_by_color_space = 0
  28. ,qs_full_range = 1
  29. ,qs_limited_range = 2
  30. ,qs_reserved = 3
  31. }quantization_settings_e;
  32. typedef struct
  33. {
  34. unsigned FLAGS_SCRATCHPAD_BUSY :1;
  35. unsigned FLAGS_REQ_WRT_PENDING :1;
  36. unsigned FLAGS_WRITE_BURST_PENDING :1;
  37. unsigned FLAGS_RCP_READY :1;
  38. unsigned FLAGS_HAVE_DEV_CATEGORY :1;
  39. unsigned FLAGS_HAVE_DEV_FEATURE_FLAGS :1;
  40. unsigned FLAGS_HAVE_COMPLETE_DEVCAP :1;
  41. unsigned FLAGS_SENT_DCAP_RDY :1;
  42. unsigned FLAGS_SENT_PATH_EN :1;
  43. unsigned FLAGS_SENT_3D_REQ :1;
  44. unsigned FLAGS_BURST_3D_VIC_DONE :1;
  45. unsigned FLAGS_BURST_3D_DTD_DONE :1;
  46. unsigned FLAGS_BURST_3D_DTD_VESA_DONE :1;
  47. unsigned FLAGS_BURST_3D_DONE :1;
  48. unsigned FLAGS_EDID_READ_DONE :1;
  49. unsigned RAP_CONTENT_ON :1;
  50. unsigned RAP_STATUS :1;
  51. unsigned MHL_HPD :1;
  52. unsigned MHL_RSEN :1;
  53. unsigned reserved :13;
  54. }MiscFlags_t;
  55. //
  56. // structure to hold operating information of MhlTx component
  57. //
  58. typedef struct
  59. {
  60. void *device_context;
  61. uint8_t status_0; // Received status from peer is stored here
  62. uint8_t status_1; // Received status from peer is stored here
  63. uint8_t connected_ready; // local MHL CONNECTED_RDY register value
  64. uint8_t link_mode; // local MHL LINK_MODE register value
  65. bool_t mhl_connection_event;
  66. uint8_t mhl_connected;
  67. // msc_msg_arrived == true when a MSC MSG arrives, false when it has been picked up
  68. bool_t msc_msg_arrived;
  69. uint8_t msc_msg_sub_command;
  70. uint8_t msc_msg_data;
  71. uint8_t cbus_reference_count; // keep track of CBUS requests
  72. // Remember last command, offset that was sent.
  73. // Mostly for READ_DEVCAP command and other non-MSC_MSG commands
  74. uint8_t msc_last_command;
  75. uint8_t msc_last_offset;
  76. uint8_t msc_last_data;
  77. // Remember last MSC_MSG command (RCPE particularly)
  78. uint8_t msc_msg_last_command;
  79. uint8_t msc_msg_last_data;
  80. uint8_t msc_save_rcp_key_code;
  81. // support WRITE_BURST
  82. ScratchPad_u incoming_scratch_pad;
  83. ScratchPad_u outgoing_scratch_pad;
  84. uint8_t burst_entry_count_3d_vic;
  85. uint8_t vic_2d_index;
  86. uint8_t vic_3d_index;
  87. uint8_t burst_entry_count_3d_dtd;
  88. uint8_t vesa_dtd_index;
  89. uint8_t cea_861_dtd_index;
  90. union
  91. {
  92. MiscFlags_t as_flags; // such as SCRATCHPAD_BUSY
  93. uint32_t as_integer;
  94. }misc_flags_u;
  95. uint8_t preferred_clk_mode;
  96. } mhlTx_config_t;
  97. typedef enum
  98. {
  99. gebSuccess =0
  100. ,gebAcquisitionFailed
  101. ,gebReleaseFailed
  102. ,gebTimedOut
  103. }si_mhl_tx_drv_get_edid_block_result_e;
  104. uint16_t si_mhl_tx_drv_get_incoming_horizontal_total(void);
  105. uint16_t si_mhl_tx_drv_get_incoming_vertical_total(void);
  106. extern mhlTx_config_t mhlTxConfig;
  107. #ifdef ENABLE_COLOR_SPACE_DEBUG_PRINT //(
  108. void print_color_settings_impl(char *pszId,int iLine);
  109. #define print_color_settings(id,line) print_color_settings_impl(id,line);
  110. #else //)(
  111. #define print_color_settings(id,line)
  112. #endif //)
  113. void si_mhl_tx_drv_set_output_color_space_impl(uint8_t outputClrSpc);
  114. void si_mhl_tx_drv_set_input_color_space_impl(uint8_t inputClrSpc);
  115. #define PackedPixelAvailable ((MHL_DEV_VID_LINK_SUPP_PPIXEL & mhlTxConfig.devcap_cache[DEVCAP_OFFSET_VID_LINK_MODE]) && (MHL_DEV_VID_LINK_SUPP_PPIXEL & DEVCAP_VAL_VID_LINK_MODE) )
  116. #define si_mhl_tx_drv_set_output_color_space(outputClrSpc) {si_mhl_tx_drv_set_output_color_space_impl(outputClrSpc);print_color_settings(__FILE__" si_mhl_tx_drv_set_output_color_space",__LINE__)}
  117. #define si_mhl_tx_drv_set_input_color_space(inputClrSpc) {si_mhl_tx_drv_set_input_color_space_impl(inputClrSpc); print_color_settings(__FILE__" si_mhl_tx_drv_set_input_color_space",__LINE__)}
  118. #define SetMiscFlag(func,x) { mhlTxConfig.misc_flags_u.as_flags.x=1; TX_DEBUG_PRINT(("mhl_tx:%s set %s\n",#func,#x)); }
  119. #define ClrMiscFlag(func,x) { mhlTxConfig.misc_flags_u.as_flags.x=0; TX_DEBUG_PRINT(("mhl_tx:%s clr %s\n",#func,#x)); }
  120. #define TestMiscFlag(x) (mhlTxConfig.misc_flags_u.as_flags.x)
  121. void si_mhl_tx_drv_set_upstream_edid(uint8_t *pEDID,uint16_t length);
  122. void si_mhl_tx_tmds_enable(void);
  123. si_mhl_tx_drv_get_edid_block_result_e si_mhl_tx_drv_get_edid_block(uint8_t *p_buf_edid,uint8_t blockNumber,uint8_t blockSize);
  124. bool_t si_mhl_tx_set_int( uint8_t regToWrite,uint8_t mask, uint8_t priorityLevel );