summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-cubox-i-3.0.35/0006-Add-support-for-DVI-monitors.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-cubox-i-3.0.35/0006-Add-support-for-DVI-monitors.patch')
-rw-r--r--recipes-kernel/linux/linux-cubox-i-3.0.35/0006-Add-support-for-DVI-monitors.patch227
1 files changed, 227 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-cubox-i-3.0.35/0006-Add-support-for-DVI-monitors.patch b/recipes-kernel/linux/linux-cubox-i-3.0.35/0006-Add-support-for-DVI-monitors.patch
new file mode 100644
index 0000000..00a6b5c
--- /dev/null
+++ b/recipes-kernel/linux/linux-cubox-i-3.0.35/0006-Add-support-for-DVI-monitors.patch
@@ -0,0 +1,227 @@
1From 3e6441d113f72b412081a2c87f39011e4c253a35 Mon Sep 17 00:00:00 2001
2From: Robert Winkler <robert.winkler@boundarydevices.com>
3Date: Fri, 19 Jul 2013 19:00:41 -0700
4Subject: [PATCH] Add support for DVI monitors
5Organization: O.S. Systems Software LTDA.
6
7Upstream-Status: Pending
8
9Signed-off-by: Robert Winkler <robert.winkler@boundarydevices.com>
10---
11 arch/arm/plat-mxc/include/mach/mxc_hdmi.h | 7 +++
12 drivers/video/mxc_hdmi.c | 98 +++++++++++++------------------
13 2 files changed, 49 insertions(+), 56 deletions(-)
14
15diff --git a/arch/arm/plat-mxc/include/mach/mxc_hdmi.h b/arch/arm/plat-mxc/include/mach/mxc_hdmi.h
16index 94f7638..af59c62 100644
17--- a/arch/arm/plat-mxc/include/mach/mxc_hdmi.h
18+++ b/arch/arm/plat-mxc/include/mach/mxc_hdmi.h
19@@ -605,6 +605,10 @@ enum {
20 HDMI_IH_MUTE_PHY_STAT0_TX_PHY_LOCK = 0x2,
21 HDMI_IH_MUTE_PHY_STAT0_HPD = 0x1,
22
23+/* IH and IH_MUTE convenience macro RX_SENSE | HPD*/
24+ HDMI_DVI_IH_STAT = 0x3D,
25+
26+
27 /* IH_AHBDMAAUD_STAT0 field values */
28 HDMI_IH_AHBDMAAUD_STAT0_ERROR = 0x20,
29 HDMI_IH_AHBDMAAUD_STAT0_LOST = 0x10,
30@@ -903,6 +907,9 @@ enum {
31 HDMI_PHY_HPD = 0x02,
32 HDMI_PHY_TX_PHY_LOCK = 0x01,
33
34+/* HDMI STAT convenience RX_SENSE | HPD */
35+ HDMI_DVI_STAT = 0xF2,
36+
37 /* PHY_I2CM_SLAVE_ADDR field values */
38 HDMI_PHY_I2CM_SLAVE_ADDR_PHY_GEN2 = 0x69,
39 HDMI_PHY_I2CM_SLAVE_ADDR_HEAC_PHY = 0x49,
40diff --git a/drivers/video/mxc_hdmi.c b/drivers/video/mxc_hdmi.c
41index c5069aa..544f352 100644
42--- a/drivers/video/mxc_hdmi.c
43+++ b/drivers/video/mxc_hdmi.c
44@@ -180,7 +180,6 @@ struct mxc_hdmi {
45 bool dft_mode_set;
46 char *dft_mode_str;
47 int default_bpp;
48- u8 latest_intr_stat;
49 bool irq_enabled;
50 spinlock_t irq_lock;
51 bool phy_enabled;
52@@ -1996,58 +1995,48 @@ static void hotplug_worker(struct work_struct *work)
53 struct delayed_work *delay_work = to_delayed_work(work);
54 struct mxc_hdmi *hdmi =
55 container_of(delay_work, struct mxc_hdmi, hotplug_work);
56- u32 phy_int_stat, phy_int_pol, phy_int_mask;
57- u8 val;
58+ u32 hdmi_phy_stat0, hdmi_phy_pol0, hdmi_phy_mask0;
59 unsigned long flags;
60 char event_string[32];
61 char *envp[] = { event_string, NULL };
62
63- phy_int_stat = hdmi->latest_intr_stat;
64- phy_int_pol = hdmi_readb(HDMI_PHY_POL0);
65
66- dev_dbg(&hdmi->pdev->dev, "phy_int_stat=0x%x, phy_int_pol=0x%x\n",
67- phy_int_stat, phy_int_pol);
68+ hdmi_phy_stat0 = hdmi_readb(HDMI_PHY_STAT0);
69+ hdmi_phy_pol0 = hdmi_readb(HDMI_PHY_POL0);
70+
71+ dev_dbg(&hdmi->pdev->dev, "hdmi_phy_stat0=0x%x, hdmi_phy_pol0=0x%x\n",
72+ hdmi_phy_stat0, hdmi_phy_pol0);
73+
74+ /* Make HPD intr active low to capture unplug event or
75+ * active high to capture plugin event */
76+ hdmi_writeb((HDMI_DVI_STAT & ~hdmi_phy_stat0), HDMI_PHY_POL0);
77
78 /* check cable status */
79- if (phy_int_stat & HDMI_IH_PHY_STAT0_HPD) {
80- /* cable connection changes */
81- if (phy_int_pol & HDMI_PHY_HPD) {
82- /* Plugin event */
83- dev_dbg(&hdmi->pdev->dev, "EVENT=plugin\n");
84- mxc_hdmi_cable_connected(hdmi);
85-
86- /* Make HPD intr active low to capture unplug event */
87- val = hdmi_readb(HDMI_PHY_POL0);
88- val &= ~HDMI_PHY_HPD;
89- hdmi_writeb(val, HDMI_PHY_POL0);
90-
91- sprintf(event_string, "EVENT=plugin");
92- kobject_uevent_env(&hdmi->pdev->dev.kobj, KOBJ_CHANGE, envp);
93+ if (hdmi_phy_stat0 & HDMI_DVI_STAT) {
94+ /* Plugin event */
95+ dev_dbg(&hdmi->pdev->dev, "EVENT=plugin\n");
96+ mxc_hdmi_cable_connected(hdmi);
97+
98+ sprintf(event_string, "EVENT=plugin");
99+ kobject_uevent_env(&hdmi->pdev->dev.kobj, KOBJ_CHANGE, envp);
100 #ifdef CONFIG_MXC_HDMI_CEC
101- mxc_hdmi_cec_handle(0x80);
102+ mxc_hdmi_cec_handle(0x80);
103 #endif
104- hdmi_set_cable_state(1);
105-
106- } else if (!(phy_int_pol & HDMI_PHY_HPD)) {
107- /* Plugout event */
108- dev_dbg(&hdmi->pdev->dev, "EVENT=plugout\n");
109- hdmi_set_cable_state(0);
110- mxc_hdmi_abort_stream();
111- mxc_hdmi_cable_disconnected(hdmi);
112+ hdmi_set_cable_state(1);
113
114- /* Make HPD intr active high to capture plugin event */
115- val = hdmi_readb(HDMI_PHY_POL0);
116- val |= HDMI_PHY_HPD;
117- hdmi_writeb(val, HDMI_PHY_POL0);
118+ } else {
119+ /* Plugout event */
120+ dev_dbg(&hdmi->pdev->dev, "EVENT=plugout\n");
121+ hdmi_set_cable_state(0);
122+ mxc_hdmi_abort_stream();
123+ mxc_hdmi_cable_disconnected(hdmi);
124
125- sprintf(event_string, "EVENT=plugout");
126- kobject_uevent_env(&hdmi->pdev->dev.kobj, KOBJ_CHANGE, envp);
127+ sprintf(event_string, "EVENT=plugout");
128+ kobject_uevent_env(&hdmi->pdev->dev.kobj, KOBJ_CHANGE, envp);
129 #ifdef CONFIG_MXC_HDMI_CEC
130- mxc_hdmi_cec_handle(0x100);
131+ mxc_hdmi_cec_handle(0x100);
132 #endif
133
134- } else
135- dev_dbg(&hdmi->pdev->dev, "EVENT=none?\n");
136 }
137
138 /* Lock here to ensure full powerdown sequence
139@@ -2055,12 +2044,12 @@ static void hotplug_worker(struct work_struct *work)
140 spin_lock_irqsave(&hdmi->irq_lock, flags);
141
142 /* Re-enable HPD interrupts */
143- phy_int_mask = hdmi_readb(HDMI_PHY_MASK0);
144- phy_int_mask &= ~HDMI_PHY_HPD;
145- hdmi_writeb(phy_int_mask, HDMI_PHY_MASK0);
146+ hdmi_phy_mask0 = hdmi_readb(HDMI_PHY_MASK0);
147+ hdmi_phy_mask0 &= ~HDMI_DVI_STAT;
148+ hdmi_writeb(hdmi_phy_mask0, HDMI_PHY_MASK0);
149
150 /* Unmute interrupts */
151- hdmi_writeb(~HDMI_IH_MUTE_PHY_STAT0_HPD, HDMI_IH_MUTE_PHY_STAT0);
152+ hdmi_writeb(~HDMI_DVI_IH_STAT, HDMI_IH_MUTE_PHY_STAT0);
153
154 if (hdmi_readb(HDMI_IH_FC_STAT2) & HDMI_IH_FC_STAT2_OVERFLOW_MASK)
155 mxc_hdmi_clear_overflow();
156@@ -2086,7 +2075,7 @@ static void hdcp_hdp_worker(struct work_struct *work)
157 static irqreturn_t mxc_hdmi_hotplug(int irq, void *data)
158 {
159 struct mxc_hdmi *hdmi = data;
160- u8 val, intr_stat;
161+ u8 val;
162 unsigned long flags;
163
164 spin_lock_irqsave(&hdmi->irq_lock, flags);
165@@ -2108,25 +2097,22 @@ static irqreturn_t mxc_hdmi_hotplug(int irq, void *data)
166 * HDMI registers.
167 */
168 /* Capture status - used in hotplug_worker ISR */
169- intr_stat = hdmi_readb(HDMI_IH_PHY_STAT0);
170-
171- if (intr_stat & HDMI_IH_PHY_STAT0_HPD) {
172+ if (hdmi_readb(HDMI_IH_PHY_STAT0) & HDMI_DVI_IH_STAT) {
173
174 dev_dbg(&hdmi->pdev->dev, "Hotplug interrupt received\n");
175- hdmi->latest_intr_stat = intr_stat;
176
177 /* Mute interrupts until handled */
178
179 val = hdmi_readb(HDMI_IH_MUTE_PHY_STAT0);
180- val |= HDMI_IH_MUTE_PHY_STAT0_HPD;
181+ val |= HDMI_DVI_IH_STAT;
182 hdmi_writeb(val, HDMI_IH_MUTE_PHY_STAT0);
183
184 val = hdmi_readb(HDMI_PHY_MASK0);
185- val |= HDMI_PHY_HPD;
186+ val |= HDMI_DVI_STAT;
187 hdmi_writeb(val, HDMI_PHY_MASK0);
188
189 /* Clear Hotplug interrupts */
190- hdmi_writeb(HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0);
191+ hdmi_writeb(HDMI_DVI_IH_STAT, HDMI_IH_PHY_STAT0);
192
193 schedule_delayed_work(&(hdmi->hotplug_work), msecs_to_jiffies(20));
194 }
195@@ -2282,13 +2268,13 @@ static void mxc_hdmi_fb_registered(struct mxc_hdmi *hdmi)
196 HDMI_PHY_I2CM_CTLINT_ADDR);
197
198 /* enable cable hot plug irq */
199- hdmi_writeb((u8)~HDMI_PHY_HPD, HDMI_PHY_MASK0);
200+ hdmi_writeb((u8)~HDMI_DVI_STAT, HDMI_PHY_MASK0);
201
202 /* Clear Hotplug interrupts */
203- hdmi_writeb(HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0);
204+ hdmi_writeb(HDMI_DVI_IH_STAT, HDMI_IH_PHY_STAT0);
205
206 /* Unmute interrupts */
207- hdmi_writeb(~HDMI_IH_MUTE_PHY_STAT0_HPD, HDMI_IH_MUTE_PHY_STAT0);
208+ hdmi_writeb(~HDMI_DVI_IH_STAT, HDMI_IH_MUTE_PHY_STAT0);
209
210 hdmi->fb_reg = true;
211
212@@ -2522,10 +2508,10 @@ static int mxc_hdmi_disp_init(struct mxc_dispdrv_handle *disp,
213
214 /* Configure registers related to HDMI interrupt
215 * generation before registering IRQ. */
216- hdmi_writeb(HDMI_PHY_HPD, HDMI_PHY_POL0);
217+ hdmi_writeb(HDMI_DVI_STAT, HDMI_PHY_POL0);
218
219 /* Clear Hotplug interrupts */
220- hdmi_writeb(HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0);
221+ hdmi_writeb(HDMI_DVI_IH_STAT, HDMI_IH_PHY_STAT0);
222
223 hdmi->nb.notifier_call = mxc_hdmi_fb_event;
224 ret = fb_register_client(&hdmi->nb);
225--
2261.8.4.rc3
227