1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#ifndef _TI_HDMI_H
22#define _TI_HDMI_H
23
24struct hdmi_ip_data;
25
26enum hdmi_pll_pwr {
27 HDMI_PLLPWRCMD_ALLOFF = 0,
28 HDMI_PLLPWRCMD_PLLONLY = 1,
29 HDMI_PLLPWRCMD_BOTHON_ALLCLKS = 2,
30 HDMI_PLLPWRCMD_BOTHON_NOPHYCLK = 3
31};
32
33enum hdmi_core_hdmi_dvi {
34 HDMI_DVI = 0,
35 HDMI_HDMI = 1
36};
37
38enum hdmi_clk_refsel {
39 HDMI_REFSEL_PCLK = 0,
40 HDMI_REFSEL_REF1 = 1,
41 HDMI_REFSEL_REF2 = 2,
42 HDMI_REFSEL_SYSCLK = 3
43};
44
45struct hdmi_cm {
46 int code;
47 int mode;
48};
49
50struct hdmi_config {
51 struct omap_video_timings timings;
52 struct hdmi_cm cm;
53};
54
55
56struct hdmi_pll_info {
57 u16 regn;
58 u16 regm;
59 u32 regmf;
60 u16 regm2;
61 u16 regsd;
62 u16 dcofreq;
63 enum hdmi_clk_refsel refsel;
64};
65
66struct ti_hdmi_ip_ops {
67
68 void (*video_configure)(struct hdmi_ip_data *ip_data);
69
70 int (*phy_enable)(struct hdmi_ip_data *ip_data);
71
72 void (*phy_disable)(struct hdmi_ip_data *ip_data);
73
74 int (*read_edid)(struct hdmi_ip_data *ip_data, u8 *edid, int len);
75
76 bool (*detect)(struct hdmi_ip_data *ip_data);
77
78 int (*pll_enable)(struct hdmi_ip_data *ip_data);
79
80 void (*pll_disable)(struct hdmi_ip_data *ip_data);
81
82 int (*video_enable)(struct hdmi_ip_data *ip_data);
83
84 void (*video_disable)(struct hdmi_ip_data *ip_data);
85
86 void (*dump_wrapper)(struct hdmi_ip_data *ip_data, struct seq_file *s);
87
88 void (*dump_core)(struct hdmi_ip_data *ip_data, struct seq_file *s);
89
90 void (*dump_pll)(struct hdmi_ip_data *ip_data, struct seq_file *s);
91
92 void (*dump_phy)(struct hdmi_ip_data *ip_data, struct seq_file *s);
93
94#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
95 int (*audio_enable)(struct hdmi_ip_data *ip_data);
96
97 void (*audio_disable)(struct hdmi_ip_data *ip_data);
98
99 int (*audio_start)(struct hdmi_ip_data *ip_data);
100
101 void (*audio_stop)(struct hdmi_ip_data *ip_data);
102
103 int (*audio_config)(struct hdmi_ip_data *ip_data,
104 struct omap_dss_audio *audio);
105
106 int (*audio_get_dma_port)(u32 *offset, u32 *size);
107#endif
108
109};
110
111
112
113
114
115struct hdmi_core_infoframe_avi {
116
117 u8 db1_format;
118
119 u8 db1_active_info;
120
121 u8 db1_bar_info_dv;
122
123 u8 db1_scan_info;
124
125 u8 db2_colorimetry;
126
127 u8 db2_aspect_ratio;
128
129 u8 db2_active_fmt_ar;
130
131 u8 db3_itc;
132
133 u8 db3_ec;
134
135 u8 db3_q_range;
136
137 u8 db3_nup_scaling;
138
139 u8 db4_videocode;
140
141 u8 db5_pixel_repeat;
142
143 u16 db6_7_line_eoftop;
144
145 u16 db8_9_line_sofbottom;
146
147 u16 db10_11_pixel_eofleft;
148
149 u16 db12_13_pixel_sofright;
150};
151
152struct hdmi_ip_data {
153 void __iomem *base_wp;
154 unsigned long core_sys_offset;
155 unsigned long core_av_offset;
156 unsigned long pll_offset;
157 unsigned long phy_offset;
158 const struct ti_hdmi_ip_ops *ops;
159 struct hdmi_config cfg;
160 struct hdmi_pll_info pll_data;
161 struct hdmi_core_infoframe_avi avi_cfg;
162
163
164 int hpd_gpio;
165 struct mutex lock;
166};
167int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
168void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
169int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data, u8 *edid, int len);
170bool ti_hdmi_4xxx_detect(struct hdmi_ip_data *ip_data);
171int ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data);
172void ti_hdmi_4xxx_wp_video_stop(struct hdmi_ip_data *ip_data);
173int ti_hdmi_4xxx_pll_enable(struct hdmi_ip_data *ip_data);
174void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data);
175void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data);
176void ti_hdmi_4xxx_wp_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
177void ti_hdmi_4xxx_pll_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
178void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
179void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
180#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
181int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts);
182int ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data);
183void ti_hdmi_4xxx_wp_audio_disable(struct hdmi_ip_data *ip_data);
184int ti_hdmi_4xxx_audio_start(struct hdmi_ip_data *ip_data);
185void ti_hdmi_4xxx_audio_stop(struct hdmi_ip_data *ip_data);
186int ti_hdmi_4xxx_audio_config(struct hdmi_ip_data *ip_data,
187 struct omap_dss_audio *audio);
188int ti_hdmi_4xxx_audio_get_dma_port(u32 *offset, u32 *size);
189#endif
190#endif
191