hdmi_msm.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef __HDMI_MSM_H__
  13. #define __HDMI_MSM_H__
  14. #include <mach/msm_iomap.h>
  15. #include "external_common.h"
  16. /* #define PORT_DEBUG */
  17. #ifdef PORT_DEBUG
  18. const char *hdmi_msm_name(uint32 offset);
  19. void hdmi_outp(uint32 offset, uint32 value);
  20. uint32 hdmi_inp(uint32 offset);
  21. #define HDMI_OUTP_ND(offset, value) outpdw(MSM_HDMI_BASE+(offset), (value))
  22. #define HDMI_OUTP(offset, value) hdmi_outp((offset), (value))
  23. #define HDMI_INP_ND(offset) inpdw(MSM_HDMI_BASE+(offset))
  24. #define HDMI_INP(offset) hdmi_inp((offset))
  25. #else
  26. #define HDMI_OUTP_ND(offset, value) outpdw(MSM_HDMI_BASE+(offset), (value))
  27. #define HDMI_OUTP(offset, value) outpdw(MSM_HDMI_BASE+(offset), (value))
  28. #define HDMI_INP_ND(offset) inpdw(MSM_HDMI_BASE+(offset))
  29. #define HDMI_INP(offset) inpdw(MSM_HDMI_BASE+(offset))
  30. #endif
  31. /*
  32. * Ref. HDMI 1.4a
  33. * Supplement-1 CEC Section 6, 7
  34. */
  35. struct hdmi_msm_cec_msg {
  36. uint8 sender_id;
  37. uint8 recvr_id;
  38. uint8 opcode;
  39. uint8 operand[15];
  40. uint8 frame_size;
  41. uint8 retransmit;
  42. };
  43. #define QFPROM_BASE ((uint32)hdmi_msm_state->qfprom_io)
  44. #define HDMI_BASE ((uint32)hdmi_msm_state->hdmi_io)
  45. struct hdmi_msm_state_type {
  46. boolean panel_power_on;
  47. boolean hpd_initialized;
  48. #ifdef CONFIG_SUSPEND
  49. boolean pm_suspended;
  50. #endif
  51. boolean full_auth_done;
  52. boolean hpd_during_auth;
  53. struct work_struct hpd_state_work;
  54. struct completion ddc_sw_done;
  55. bool hdcp_enable;
  56. boolean hdcp_activating;
  57. boolean reauth ;
  58. struct work_struct hdcp_reauth_work, hdcp_work;
  59. struct completion hdcp_success_done;
  60. struct timer_list hdcp_timer;
  61. #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL_CEC_SUPPORT
  62. boolean cec_enabled;
  63. unsigned int first_monitor;
  64. int cec_logical_addr;
  65. struct completion cec_frame_wr_done;
  66. struct timer_list cec_read_timer;
  67. #define CEC_STATUS_WR_ERROR 0x0001
  68. #define CEC_STATUS_WR_DONE 0x0002
  69. #define CEC_STATUS_WR_TMOUT 0x0004
  70. uint32 cec_frame_wr_status;
  71. struct hdmi_msm_cec_msg *cec_queue_start;
  72. struct hdmi_msm_cec_msg *cec_queue_wr;
  73. struct hdmi_msm_cec_msg *cec_queue_rd;
  74. boolean cec_queue_full;
  75. boolean fsm_reset_done;
  76. /*
  77. * CECT 9-5-1
  78. */
  79. struct completion cec_line_latch_wait;
  80. struct work_struct cec_latch_detect_work;
  81. #define CEC_QUEUE_SIZE 16
  82. #define CEC_QUEUE_END (hdmi_msm_state->cec_queue_start + CEC_QUEUE_SIZE)
  83. #define RETRANSMIT_MAX_NUM 5
  84. #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL_CEC_SUPPORT */
  85. int irq;
  86. struct msm_hdmi_platform_data *pd;
  87. struct clk *hdmi_app_clk;
  88. struct clk *hdmi_m_pclk;
  89. struct clk *hdmi_s_pclk;
  90. void __iomem *qfprom_io;
  91. void __iomem *hdmi_io;
  92. struct external_common_state_type common;
  93. boolean is_mhl_enabled;
  94. struct completion hpd_event_processed;
  95. };
  96. extern struct hdmi_msm_state_type *hdmi_msm_state;
  97. uint32 hdmi_msm_get_io_base(void);
  98. #ifdef CONFIG_FB_MSM_HDMI_COMMON
  99. void hdmi_msm_set_mode(boolean power_on);
  100. int hdmi_msm_clk(int on);
  101. void hdmi_phy_reset(void);
  102. void hdmi_msm_reset_core(void);
  103. void hdmi_msm_init_phy(int video_format);
  104. void hdmi_msm_powerdown_phy(void);
  105. void hdmi_frame_ctrl_cfg(const struct hdmi_disp_mode_timing_type *timing);
  106. void hdmi_msm_phy_status_poll(void);
  107. #endif
  108. #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL_CEC_SUPPORT
  109. void hdmi_msm_cec_init(void);
  110. void hdmi_msm_cec_write_logical_addr(int addr);
  111. void hdmi_msm_cec_msg_recv(void);
  112. void hdmi_msm_cec_one_touch_play(void);
  113. void hdmi_msm_cec_msg_send(struct hdmi_msm_cec_msg *msg);
  114. #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL_CEC_SUPPORT */
  115. void mhl_connect_api(boolean on);
  116. #endif /* __HDMI_MSM_H__ */