ti_hdmi.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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_video_timings {
  40. u16 x_res;
  41. u16 y_res;
  42. /* Unit: KHz */
  43. u32 pixel_clock;
  44. u16 hsw;
  45. u16 hfp;
  46. u16 hbp;
  47. u16 vsw;
  48. u16 vfp;
  49. u16 vbp;
  50. };
  51. /* HDMI timing structure */
  52. struct hdmi_timings {
  53. struct hdmi_video_timings timings;
  54. int vsync_pol;
  55. int hsync_pol;
  56. };
  57. struct hdmi_cm {
  58. int code;
  59. int mode;
  60. };
  61. struct hdmi_config {
  62. struct hdmi_timings timings;
  63. u16 interlace;
  64. struct hdmi_cm cm;
  65. };
  66. /* HDMI PLL structure */
  67. struct hdmi_pll_info {
  68. u16 regn;
  69. u16 regm;
  70. u32 regmf;
  71. u16 regm2;
  72. u16 regsd;
  73. u16 dcofreq;
  74. enum hdmi_clk_refsel refsel;
  75. };
  76. struct ti_hdmi_ip_ops {
  77. void (*video_configure)(struct hdmi_ip_data *ip_data);
  78. int (*phy_enable)(struct hdmi_ip_data *ip_data);
  79. void (*phy_disable)(struct hdmi_ip_data *ip_data);
  80. int (*read_edid)(struct hdmi_ip_data *ip_data, u8 *edid, int len);
  81. bool (*detect)(struct hdmi_ip_data *ip_data);
  82. int (*pll_enable)(struct hdmi_ip_data *ip_data);
  83. void (*pll_disable)(struct hdmi_ip_data *ip_data);
  84. void (*video_enable)(struct hdmi_ip_data *ip_data, bool start);
  85. void (*dump_wrapper)(struct hdmi_ip_data *ip_data, struct seq_file *s);
  86. void (*dump_core)(struct hdmi_ip_data *ip_data, struct seq_file *s);
  87. void (*dump_pll)(struct hdmi_ip_data *ip_data, struct seq_file *s);
  88. void (*dump_phy)(struct hdmi_ip_data *ip_data, struct seq_file *s);
  89. };
  90. struct hdmi_ip_data {
  91. void __iomem *base_wp; /* HDMI wrapper */
  92. unsigned long core_sys_offset;
  93. unsigned long core_av_offset;
  94. unsigned long pll_offset;
  95. unsigned long phy_offset;
  96. const struct ti_hdmi_ip_ops *ops;
  97. struct hdmi_config cfg;
  98. struct hdmi_pll_info pll_data;
  99. };
  100. int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
  101. void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
  102. int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data, u8 *edid, int len);
  103. bool ti_hdmi_4xxx_detect(struct hdmi_ip_data *ip_data);
  104. void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data, bool start);
  105. int ti_hdmi_4xxx_pll_enable(struct hdmi_ip_data *ip_data);
  106. void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data);
  107. void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data);
  108. void ti_hdmi_4xxx_wp_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
  109. void ti_hdmi_4xxx_pll_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
  110. void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
  111. void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
  112. #endif