ti_hdmi.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /*
  2. * ti_hdmi.h
  3. *
  4. * HDMI driver definition for TI OMAP4, DM81xx, DM38xx Processor.
  5. *
  6. * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License version 2 as published by
  10. * the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  15. * more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along with
  18. * this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef _TI_HDMI_H
  21. #define _TI_HDMI_H
  22. struct hdmi_ip_data;
  23. enum hdmi_pll_pwr {
  24. HDMI_PLLPWRCMD_ALLOFF = 0,
  25. HDMI_PLLPWRCMD_PLLONLY = 1,
  26. HDMI_PLLPWRCMD_BOTHON_ALLCLKS = 2,
  27. HDMI_PLLPWRCMD_BOTHON_NOPHYCLK = 3
  28. };
  29. enum hdmi_core_hdmi_dvi {
  30. HDMI_DVI = 0,
  31. HDMI_HDMI = 1
  32. };
  33. enum hdmi_clk_refsel {
  34. HDMI_REFSEL_PCLK = 0,
  35. HDMI_REFSEL_REF1 = 1,
  36. HDMI_REFSEL_REF2 = 2,
  37. HDMI_REFSEL_SYSCLK = 3
  38. };
  39. struct hdmi_cm {
  40. int code;
  41. int mode;
  42. };
  43. struct hdmi_config {
  44. struct omap_video_timings timings;
  45. struct hdmi_cm cm;
  46. };
  47. /* HDMI PLL structure */
  48. struct hdmi_pll_info {
  49. u16 regn;
  50. u16 regm;
  51. u32 regmf;
  52. u16 regm2;
  53. u16 regsd;
  54. u16 dcofreq;
  55. enum hdmi_clk_refsel refsel;
  56. };
  57. struct ti_hdmi_ip_ops {
  58. void (*video_configure)(struct hdmi_ip_data *ip_data);
  59. int (*phy_enable)(struct hdmi_ip_data *ip_data);
  60. void (*phy_disable)(struct hdmi_ip_data *ip_data);
  61. int (*read_edid)(struct hdmi_ip_data *ip_data, u8 *edid, int len);
  62. bool (*detect)(struct hdmi_ip_data *ip_data);
  63. int (*pll_enable)(struct hdmi_ip_data *ip_data);
  64. void (*pll_disable)(struct hdmi_ip_data *ip_data);
  65. int (*video_enable)(struct hdmi_ip_data *ip_data);
  66. void (*video_disable)(struct hdmi_ip_data *ip_data);
  67. void (*dump_wrapper)(struct hdmi_ip_data *ip_data, struct seq_file *s);
  68. void (*dump_core)(struct hdmi_ip_data *ip_data, struct seq_file *s);
  69. void (*dump_pll)(struct hdmi_ip_data *ip_data, struct seq_file *s);
  70. void (*dump_phy)(struct hdmi_ip_data *ip_data, struct seq_file *s);
  71. #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
  72. int (*audio_enable)(struct hdmi_ip_data *ip_data);
  73. void (*audio_disable)(struct hdmi_ip_data *ip_data);
  74. int (*audio_start)(struct hdmi_ip_data *ip_data);
  75. void (*audio_stop)(struct hdmi_ip_data *ip_data);
  76. int (*audio_config)(struct hdmi_ip_data *ip_data,
  77. struct omap_dss_audio *audio);
  78. int (*audio_get_dma_port)(u32 *offset, u32 *size);
  79. #endif
  80. };
  81. /*
  82. * Refer to section 8.2 in HDMI 1.3 specification for
  83. * details about infoframe databytes
  84. */
  85. struct hdmi_core_infoframe_avi {
  86. /* Y0, Y1 rgb,yCbCr */
  87. u8 db1_format;
  88. /* A0 Active information Present */
  89. u8 db1_active_info;
  90. /* B0, B1 Bar info data valid */
  91. u8 db1_bar_info_dv;
  92. /* S0, S1 scan information */
  93. u8 db1_scan_info;
  94. /* C0, C1 colorimetry */
  95. u8 db2_colorimetry;
  96. /* M0, M1 Aspect ratio (4:3, 16:9) */
  97. u8 db2_aspect_ratio;
  98. /* R0...R3 Active format aspect ratio */
  99. u8 db2_active_fmt_ar;
  100. /* ITC IT content. */
  101. u8 db3_itc;
  102. /* EC0, EC1, EC2 Extended colorimetry */
  103. u8 db3_ec;
  104. /* Q1, Q0 Quantization range */
  105. u8 db3_q_range;
  106. /* SC1, SC0 Non-uniform picture scaling */
  107. u8 db3_nup_scaling;
  108. /* VIC0..6 Video format identification */
  109. u8 db4_videocode;
  110. /* PR0..PR3 Pixel repetition factor */
  111. u8 db5_pixel_repeat;
  112. /* Line number end of top bar */
  113. u16 db6_7_line_eoftop;
  114. /* Line number start of bottom bar */
  115. u16 db8_9_line_sofbottom;
  116. /* Pixel number end of left bar */
  117. u16 db10_11_pixel_eofleft;
  118. /* Pixel number start of right bar */
  119. u16 db12_13_pixel_sofright;
  120. };
  121. struct hdmi_ip_data {
  122. void __iomem *base_wp; /* HDMI wrapper */
  123. unsigned long core_sys_offset;
  124. unsigned long core_av_offset;
  125. unsigned long pll_offset;
  126. unsigned long phy_offset;
  127. const struct ti_hdmi_ip_ops *ops;
  128. struct hdmi_config cfg;
  129. struct hdmi_pll_info pll_data;
  130. struct hdmi_core_infoframe_avi avi_cfg;
  131. /* ti_hdmi_4xxx_ip private data. These should be in a separate struct */
  132. int hpd_gpio;
  133. struct mutex lock;
  134. };
  135. int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
  136. void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
  137. int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data, u8 *edid, int len);
  138. bool ti_hdmi_4xxx_detect(struct hdmi_ip_data *ip_data);
  139. int ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data);
  140. void ti_hdmi_4xxx_wp_video_stop(struct hdmi_ip_data *ip_data);
  141. int ti_hdmi_4xxx_pll_enable(struct hdmi_ip_data *ip_data);
  142. void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data);
  143. void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data);
  144. void ti_hdmi_4xxx_wp_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
  145. void ti_hdmi_4xxx_pll_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
  146. void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
  147. void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
  148. #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
  149. int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts);
  150. int ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data);
  151. void ti_hdmi_4xxx_wp_audio_disable(struct hdmi_ip_data *ip_data);
  152. int ti_hdmi_4xxx_audio_start(struct hdmi_ip_data *ip_data);
  153. void ti_hdmi_4xxx_audio_stop(struct hdmi_ip_data *ip_data);
  154. int ti_hdmi_4xxx_audio_config(struct hdmi_ip_data *ip_data,
  155. struct omap_dss_audio *audio);
  156. int ti_hdmi_4xxx_audio_get_dma_port(u32 *offset, u32 *size);
  157. #endif
  158. #endif