aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c5
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c5
-rw-r--r--drivers/video/omap2/dss/hdmi.c3
-rw-r--r--drivers/video/omap2/dss/ti_hdmi.h4
-rw-r--r--drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c68
-rw-r--r--include/video/omapdss.h5
6 files changed, 86 insertions, 4 deletions
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index cd6ec517a929..0ce758edaad2 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -732,6 +732,10 @@ static void sdp4430_lcd_init(void)
732 pr_err("%s: Could not get lcd2_reset_gpio\n", __func__); 732 pr_err("%s: Could not get lcd2_reset_gpio\n", __func__);
733} 733}
734 734
735static struct omap_dss_hdmi_data sdp4430_hdmi_data = {
736 .hpd_gpio = HDMI_GPIO_HPD,
737};
738
735static struct omap_dss_device sdp4430_hdmi_device = { 739static struct omap_dss_device sdp4430_hdmi_device = {
736 .name = "hdmi", 740 .name = "hdmi",
737 .driver_name = "hdmi_panel", 741 .driver_name = "hdmi_panel",
@@ -739,6 +743,7 @@ static struct omap_dss_device sdp4430_hdmi_device = {
739 .platform_enable = sdp4430_panel_enable_hdmi, 743 .platform_enable = sdp4430_panel_enable_hdmi,
740 .platform_disable = sdp4430_panel_disable_hdmi, 744 .platform_disable = sdp4430_panel_disable_hdmi,
741 .channel = OMAP_DSS_CHANNEL_DIGIT, 745 .channel = OMAP_DSS_CHANNEL_DIGIT,
746 .data = &sdp4430_hdmi_data,
742}; 747};
743 748
744static struct picodlp_panel_data sdp4430_picodlp_pdata = { 749static struct picodlp_panel_data sdp4430_picodlp_pdata = {
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index e1b196361f95..370c4b428888 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -502,6 +502,10 @@ static void omap4_panda_panel_disable_hdmi(struct omap_dss_device *dssdev)
502 gpio_free_array(panda_hdmi_gpios, ARRAY_SIZE(panda_hdmi_gpios)); 502 gpio_free_array(panda_hdmi_gpios, ARRAY_SIZE(panda_hdmi_gpios));
503} 503}
504 504
505static struct omap_dss_hdmi_data omap4_panda_hdmi_data = {
506 .hpd_gpio = HDMI_GPIO_HPD,
507};
508
505static struct omap_dss_device omap4_panda_hdmi_device = { 509static struct omap_dss_device omap4_panda_hdmi_device = {
506 .name = "hdmi", 510 .name = "hdmi",
507 .driver_name = "hdmi_panel", 511 .driver_name = "hdmi_panel",
@@ -509,6 +513,7 @@ static struct omap_dss_device omap4_panda_hdmi_device = {
509 .platform_enable = omap4_panda_panel_enable_hdmi, 513 .platform_enable = omap4_panda_panel_enable_hdmi,
510 .platform_disable = omap4_panda_panel_disable_hdmi, 514 .platform_disable = omap4_panda_panel_disable_hdmi,
511 .channel = OMAP_DSS_CHANNEL_DIGIT, 515 .channel = OMAP_DSS_CHANNEL_DIGIT,
516 .data = &omap4_panda_hdmi_data,
512}; 517};
513 518
514static struct omap_dss_device *omap4_panda_dss_devices[] = { 519static struct omap_dss_device *omap4_panda_dss_devices[] = {
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index c39f9c3a92cf..d7aa3b056529 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -497,6 +497,7 @@ bool omapdss_hdmi_detect(void)
497 497
498int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) 498int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev)
499{ 499{
500 struct omap_dss_hdmi_data *priv = dssdev->data;
500 int r = 0; 501 int r = 0;
501 502
502 DSSDBG("ENTER hdmi_display_enable\n"); 503 DSSDBG("ENTER hdmi_display_enable\n");
@@ -509,6 +510,8 @@ int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev)
509 goto err0; 510 goto err0;
510 } 511 }
511 512
513 hdmi.ip_data.hpd_gpio = priv->hpd_gpio;
514
512 r = omap_dss_start_device(dssdev); 515 r = omap_dss_start_device(dssdev);
513 if (r) { 516 if (r) {
514 DSSERR("failed to start device\n"); 517 DSSERR("failed to start device\n");
diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h
index 7503f7f619a7..50dadba5070a 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -126,6 +126,10 @@ struct hdmi_ip_data {
126 const struct ti_hdmi_ip_ops *ops; 126 const struct ti_hdmi_ip_ops *ops;
127 struct hdmi_config cfg; 127 struct hdmi_config cfg;
128 struct hdmi_pll_info pll_data; 128 struct hdmi_pll_info pll_data;
129
130 /* ti_hdmi_4xxx_ip private data. These should be in a separate struct */
131 int hpd_gpio;
132 bool phy_tx_enabled;
129}; 133};
130int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data); 134int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
131void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data); 135void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 9af81f18f163..2d72334ca3da 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -28,6 +28,7 @@
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/string.h> 29#include <linux/string.h>
30#include <linux/seq_file.h> 30#include <linux/seq_file.h>
31#include <linux/gpio.h>
31 32
32#include "ti_hdmi_4xxx_ip.h" 33#include "ti_hdmi_4xxx_ip.h"
33#include "dss.h" 34#include "dss.h"
@@ -223,6 +224,49 @@ void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data)
223 hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_ALLOFF); 224 hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_ALLOFF);
224} 225}
225 226
227static int hdmi_check_hpd_state(struct hdmi_ip_data *ip_data)
228{
229 unsigned long flags;
230 bool hpd;
231 int r;
232 /* this should be in ti_hdmi_4xxx_ip private data */
233 static DEFINE_SPINLOCK(phy_tx_lock);
234
235 spin_lock_irqsave(&phy_tx_lock, flags);
236
237 hpd = gpio_get_value(ip_data->hpd_gpio);
238
239 if (hpd == ip_data->phy_tx_enabled) {
240 spin_unlock_irqrestore(&phy_tx_lock, flags);
241 return 0;
242 }
243
244 if (hpd)
245 r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON);
246 else
247 r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_LDOON);
248
249 if (r) {
250 DSSERR("Failed to %s PHY TX power\n",
251 hpd ? "enable" : "disable");
252 goto err;
253 }
254
255 ip_data->phy_tx_enabled = hpd;
256err:
257 spin_unlock_irqrestore(&phy_tx_lock, flags);
258 return r;
259}
260
261static irqreturn_t hpd_irq_handler(int irq, void *data)
262{
263 struct hdmi_ip_data *ip_data = data;
264
265 hdmi_check_hpd_state(ip_data);
266
267 return IRQ_HANDLED;
268}
269
226int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data) 270int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data)
227{ 271{
228 u16 r = 0; 272 u16 r = 0;
@@ -232,10 +276,6 @@ int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data)
232 if (r) 276 if (r)
233 return r; 277 return r;
234 278
235 r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON);
236 if (r)
237 return r;
238
239 /* 279 /*
240 * Read address 0 in order to get the SCP reset done completed 280 * Read address 0 in order to get the SCP reset done completed
241 * Dummy access performed to make sure reset is done 281 * Dummy access performed to make sure reset is done
@@ -257,12 +297,32 @@ int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data)
257 /* Write to phy address 3 to change the polarity control */ 297 /* Write to phy address 3 to change the polarity control */
258 REG_FLD_MOD(phy_base, HDMI_TXPHY_PAD_CFG_CTRL, 0x1, 27, 27); 298 REG_FLD_MOD(phy_base, HDMI_TXPHY_PAD_CFG_CTRL, 0x1, 27, 27);
259 299
300 r = request_threaded_irq(gpio_to_irq(ip_data->hpd_gpio),
301 NULL, hpd_irq_handler,
302 IRQF_DISABLED | IRQF_TRIGGER_RISING |
303 IRQF_TRIGGER_FALLING, "hpd", ip_data);
304 if (r) {
305 DSSERR("HPD IRQ request failed\n");
306 hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF);
307 return r;
308 }
309
310 r = hdmi_check_hpd_state(ip_data);
311 if (r) {
312 free_irq(gpio_to_irq(ip_data->hpd_gpio), ip_data);
313 hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF);
314 return r;
315 }
316
260 return 0; 317 return 0;
261} 318}
262 319
263void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data) 320void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data)
264{ 321{
322 free_irq(gpio_to_irq(ip_data->hpd_gpio), ip_data);
323
265 hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF); 324 hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF);
325 ip_data->phy_tx_enabled = false;
266} 326}
267 327
268static int hdmi_core_ddc_init(struct hdmi_ip_data *ip_data) 328static int hdmi_core_ddc_init(struct hdmi_ip_data *ip_data)
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 062b3b24ff10..483f67caa7ad 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -590,6 +590,11 @@ struct omap_dss_device {
590 int (*get_backlight)(struct omap_dss_device *dssdev); 590 int (*get_backlight)(struct omap_dss_device *dssdev);
591}; 591};
592 592
593struct omap_dss_hdmi_data
594{
595 int hpd_gpio;
596};
597
593struct omap_dss_driver { 598struct omap_dss_driver {
594 struct device_driver driver; 599 struct device_driver driver;
595 600