[PATCH 0/3] OMAPDSS: HDMI: Interrupt and PHY state handling support

2012-03-20 Thread mythripk
From: Mythri P K mythr...@ti.com

Add support for handling the DSS_HDMI interrupt in HDMI, A line that serves to
notify HDMI of status change in PHY, PLL and CORE based on the registration.
Also logic to support enabling of the PHY in TX_ON state only when a PHY_CONNECT
which would make sure that TMDS lines are high before putting it in TX_ON state.

Mythri P K (3):
  OMAPDSS: HDMI: support for interrupt enabling
  OMAPDSS: HDMI: Add support for DSS_HDMI Interrupt
  OMAPDSS: HDMI: wait for TMDS to be high before putting phy in TX_ON

 drivers/video/omap2/dss/dss_features.c|1 +
 drivers/video/omap2/dss/hdmi.c|   21 +
 drivers/video/omap2/dss/ti_hdmi.h |   20 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |  117 +++-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |3 +
 5 files changed, 157 insertions(+), 5 deletions(-)

-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] OMAPDSS: HDMI: wait for TMDS to be high before putting

2012-03-20 Thread mythripk
From: Mythri P K mythr...@ti.com

Currently TX_PHY is put to TX_ON(transmission state) on receiving HPD.
It just ensures that the TV is connected but does not guarantee
that TMDS data lines and clock lines are up and ready for transmission.
Which although is very rare scenario has a potential to  damage the HDMI
port.
Thus this patch adds the support based on PHY interrupts.
On getting a HPD it registers for PHY connect/disconnect interrupt,
On recieving those it is made sure TMDS lines are UP before changing
the PHY state from LDO_ON to TX_ON.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |1 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   61 ++---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |2 +
 3 files changed, 58 insertions(+), 6 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 5e7e0da..5051df6 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -186,6 +186,7 @@ struct hdmi_ip_data {
/* ti_hdmi_4xxx_ip private data. These should be in a separate struct */
int hpd_gpio;
bool phy_tx_enabled;
+   bool phy_enabled;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void 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 31d9927..a54c811 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -273,7 +273,8 @@ static int hdmi_check_hpd_state(struct hdmi_ip_data 
*ip_data)
 {
unsigned long flags;
bool hpd;
-   int r;
+   int r = 0;
+   struct hdmi_irq_vector irq_enable;
/* this should be in ti_hdmi_4xxx_ip private data */
static DEFINE_SPINLOCK(phy_tx_lock);
 
@@ -286,11 +287,21 @@ static int hdmi_check_hpd_state(struct hdmi_ip_data 
*ip_data)
return 0;
}
 
-   if (hpd)
-   r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON);
-   else
+   hdmi_wp_clr_irq(ip_data);
+   hdmi_wp_irq_init(irq_enable);
+   if (hpd) {
+   if (ip_data-phy_enabled) {
+   r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON);
+   } else {
+   irq_enable.phy_connect = 1;
+   irq_enable.phy_disconnect = 0;
+   }
+   } else {
r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_LDOON);
-
+   irq_enable.phy_connect = 0;
+   irq_enable.phy_disconnect = 0;
+   ip_data-phy_enabled = false;
+   }
if (r) {
DSSERR(Failed to %s PHY TX power\n,
hpd ? enable : disable);
@@ -300,6 +311,7 @@ static int hdmi_check_hpd_state(struct hdmi_ip_data 
*ip_data)
ip_data-phy_tx_enabled = hpd;
 err:
spin_unlock_irqrestore(phy_tx_lock, flags);
+   hdmi_wp_irq_enable(ip_data, irq_enable);
return r;
 }
 
@@ -312,17 +324,54 @@ static irqreturn_t hpd_irq_handler(int irq, void *data)
return IRQ_HANDLED;
 }
 
+int hdmi_ti_4xxx_rxdet(struct hdmi_ip_data *ip_data)
+{
+   int tmds_lines =0;
+
+   tmds_lines = hdmi_read_reg(hdmi_phy_base(ip_data),
+   HDMI_TXPHY_PAD_CFG_CTRL);
+
+   return (tmds_lines  0x7F80);
+}
 /* Interrupt handler */
 void ti_hdmi_4xxx_intr_handler(struct hdmi_ip_data *ip_data)
 {
-   u32 val;
+   u32 val, r = 0;
+   struct hdmi_irq_vector irq_enable;
 
val = hdmi_read_reg(hdmi_wp_base(ip_data), HDMI_WP_IRQSTATUS);
+
+   hdmi_wp_clr_irq(ip_data);
+   hdmi_wp_irq_init(irq_enable);
+
+   if (val  HDMI_WP_IRQSTATUS_PHYCONNECT) {
+   if (ip_data-phy_tx_enabled  hdmi_ti_4xxx_rxdet(ip_data)) {
+   r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON);
+   irq_enable.phy_connect = 0;
+   irq_enable.phy_disconnect = 1;
+   ip_data-phy_enabled = true;
+   }
+   }
+
+   /* We can get connect / disconnect simultaneously due to glitch */
+   if (val  HDMI_WP_IRQSTATUS_PHYDISCONNECT) {
+   if (ip_data-phy_tx_enabled  !hdmi_ti_4xxx_rxdet(ip_data)) {
+   r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_LDOON);
+   irq_enable.phy_connect = 1;
+   irq_enable.phy_disconnect = 0;
+   ip_data-phy_enabled = false;
+   }
+   }
+
+   if (r)
+   DSSERR(Failed to set PHY TX power\n);
+
/* Ack other interrupts if any */
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_IRQSTATUS, val);
/* flush posted write */
hdmi_read_reg(hdmi_wp_base(ip_data), HDMI_WP_IRQSTATUS);
 
+   hdmi_wp_irq_enable(ip_data, irq_enable);
 }
 
 int 

[PATCH 1/3] OMAPDSS: HDMI: support for interrupt enabling

2012-03-20 Thread mythripk
From: Mythri P K mythr...@ti.com

Add function to enable or clear interrupts in the HDMI wrapper.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |   16 ++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   45 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |1 +
 3 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 1f58b84..6d65b3b 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -80,6 +80,22 @@ struct hdmi_pll_info {
enum hdmi_clk_refsel refsel;
 };
 
+struct hdmi_irq_vector {
+   u8  pll_recal;
+   u8  pll_unlock;
+   u8  pll_lock;
+   u8  phy_disconnect;
+   u8  phy_connect;
+   u8  phy_short_5v;
+   u8  video_end_fr;
+   u8  video_vsync;
+   u8  fifo_sample_req;
+   u8  fifo_overflow;
+   u8  fifo_underflow;
+   u8  ocp_timeout;
+   u8  core;
+};
+
 struct ti_hdmi_ip_ops {
 
void (*video_configure)(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 bfe6fe6..5272f49 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -224,6 +224,51 @@ void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data)
hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_ALLOFF);
 }
 
+static void hdmi_wp_irq_init(struct hdmi_irq_vector *irq_enable)
+{
+   irq_enable-pll_recal = 0;
+   irq_enable-pll_unlock = 0;
+   irq_enable-pll_lock = 0;
+   irq_enable-phy_disconnect = 0;
+   irq_enable-phy_connect = 0;
+   irq_enable-phy_short_5v = 0;
+   irq_enable-video_end_fr = 0;
+   irq_enable-video_vsync = 0;
+   irq_enable-fifo_sample_req = 0;
+   irq_enable-fifo_overflow = 0;
+   irq_enable-fifo_underflow = 0;
+   irq_enable-ocp_timeout = 0;
+   irq_enable-core = 0;
+}
+
+static void hdmi_wp_clr_irq(struct hdmi_ip_data *ip_data)
+{
+   hdmi_write_reg(hdmi_wp_base(ip_data),
+   HDMI_WP_IRQENABLE_CLR, 0X);
+}
+
+static void hdmi_wp_irq_enable(struct hdmi_ip_data *ip_data,
+   struct hdmi_irq_vector *irq_enable)
+{
+   u32 r = 0;
+
+   r = ((irq_enable-pll_recal  31) |
+   (irq_enable-pll_unlock  30) |
+   (irq_enable-pll_lock  29) |
+   (irq_enable-phy_disconnect  26) |
+   (irq_enable-phy_connect  25) |
+   (irq_enable-phy_short_5v  24) |
+   (irq_enable-video_end_fr  17) |
+   (irq_enable-video_vsync  16) |
+   (irq_enable-fifo_sample_req  10) |
+   (irq_enable-fifo_overflow  9) |
+   (irq_enable-fifo_underflow  8) |
+   (irq_enable-ocp_timeout  4) |
+   (irq_enable-core  0));
+
+   hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_IRQENABLE_SET, r);
+}
+
 static int hdmi_check_hpd_state(struct hdmi_ip_data *ip_data)
 {
unsigned long flags;
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index a14d1a0..3090e81 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -38,6 +38,7 @@
 #define HDMI_WP_IRQSTATUS  0x28
 #define HDMI_WP_PWR_CTRL   0x40
 #define HDMI_WP_IRQENABLE_SET  0x2C
+#define HDMI_WP_IRQENABLE_CLR  0x30
 #define HDMI_WP_VIDEO_CFG  0x50
 #define HDMI_WP_VIDEO_SIZE 0x60
 #define HDMI_WP_VIDEO_TIMING_H 0x68
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] OMAPDSS: HDMI: Add support for DSS_HDMI Interrupt

2012-03-20 Thread mythripk
From: Mythri P K mythr...@ti.com

Add support for DSS_HDMI interrupt handling in HDMI driver
by registering for the same. This is the path for many necessary HDMI
interrupts such as PLL lock/unlock, PHY connect/disconnet, video frame
done etc.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss_features.c|1 +
 drivers/video/omap2/dss/hdmi.c|   21 +
 drivers/video/omap2/dss/ti_hdmi.h |3 +++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   13 +
 4 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/dss_features.c 
b/drivers/video/omap2/dss/dss_features.c
index ce14aa6..29c5548 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -566,6 +566,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
.dump_core  =   ti_hdmi_4xxx_core_dump,
.dump_pll   =   ti_hdmi_4xxx_pll_dump,
.dump_phy   =   ti_hdmi_4xxx_phy_dump,
+   .irq_handle =   ti_hdmi_4xxx_intr_handler,
 #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
.audio_enable   =   ti_hdmi_4xxx_wp_audio_enable,
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index c4b4f69..14e90b5 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -67,6 +67,8 @@ static struct {
struct platform_device *pdev;
struct hdmi_ip_data ip_data;
 
+   int irq;
+   spinlock_t irq_lock;
struct clk *sys_clk;
 } hdmi;
 
@@ -790,6 +792,19 @@ static void hdmi_put_clocks(void)
clk_put(hdmi.sys_clk);
 }
 
+static irqreturn_t hdmi_irq_handler(int irq, void *arg)
+{
+   unsigned long flags;
+
+   spin_lock_irqsave(hdmi.irq_lock, flags);
+
+   hdmi.ip_data.ops-irq_handle(hdmi.ip_data);
+
+   spin_unlock_irqrestore(hdmi.irq_lock, flags);
+
+   return IRQ_HANDLED;
+}
+
 /* HDMI HW IP initialisation */
 static int omapdss_hdmihw_probe(struct platform_device *pdev)
 {
@@ -823,6 +838,10 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
 
pm_runtime_enable(pdev-dev);
 
+   hdmi.irq = platform_get_irq(pdev, 0);
+   r = request_threaded_irq(hdmi.irq, NULL, hdmi_irq_handler, 0,
+   OMAP HDMI, (void *)0);
+
hdmi.ip_data.core_sys_offset = HDMI_CORE_SYS;
hdmi.ip_data.core_av_offset = HDMI_CORE_AV;
hdmi.ip_data.pll_offset = HDMI_PLLCTRL;
@@ -853,6 +872,8 @@ static int omapdss_hdmihw_remove(struct platform_device 
*pdev)
snd_soc_unregister_codec(pdev-dev);
 #endif
 
+   free_irq(hdmi.irq, NULL);
+
pm_runtime_disable(pdev-dev);
 
hdmi_put_clocks();
diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 6d65b3b..5e7e0da 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -122,6 +122,8 @@ struct ti_hdmi_ip_ops {
 
void (*dump_phy)(struct hdmi_ip_data *ip_data, struct seq_file *s);
 
+   void (*irq_handle)(struct hdmi_ip_data *ip_data);
+
 #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
void (*audio_enable)(struct hdmi_ip_data *ip_data, bool start);
@@ -197,6 +199,7 @@ void ti_hdmi_4xxx_wp_dump(struct hdmi_ip_data *ip_data, 
struct seq_file *s);
 void ti_hdmi_4xxx_pll_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
 void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
 void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+void ti_hdmi_4xxx_intr_handler(struct hdmi_ip_data *ip_data);
 #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
 void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable);
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 5272f49..31d9927 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -312,6 +312,19 @@ static irqreturn_t hpd_irq_handler(int irq, void *data)
return IRQ_HANDLED;
 }
 
+/* Interrupt handler */
+void ti_hdmi_4xxx_intr_handler(struct hdmi_ip_data *ip_data)
+{
+   u32 val;
+
+   val = hdmi_read_reg(hdmi_wp_base(ip_data), HDMI_WP_IRQSTATUS);
+   /* Ack other interrupts if any */
+   hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_IRQSTATUS, val);
+   /* flush posted write */
+   hdmi_read_reg(hdmi_wp_base(ip_data), HDMI_WP_IRQSTATUS);
+
+}
+
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data)
 {
u16 r = 0;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  

[PATCH 0/2] OMAPDSS: HDMI: Add support for OMAP5 HDMI core IP driver

2012-03-09 Thread mythripk
From: Mythri P K mythr...@ti.com

Add basic functionality support for HDMI OMAP5 core driver.
Across OMAP4 and OMAP5 HDMI core IP block differs where as the PHY, PLL and
the wrapper blocks are reused, using the existing framework and extention to
support OMAP5 core driver is added.


Mythri P K (2):
  OMAPDSS: HDMI: Make Wrapper function non-static
  OMAPDSS: HDMI: Add support for OMAP5 HDMI core library in DSS

 drivers/video/omap2/dss/ti_hdmi.h |2 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   10 +-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |9 +
 drivers/video/omap2/dss/ti_hdmi_5xxx_ip.c |  341 +
 drivers/video/omap2/dss/ti_hdmi_5xxx_ip.h |  254 +
 5 files changed, 611 insertions(+), 5 deletions(-)
 create mode 100644 drivers/video/omap2/dss/ti_hdmi_5xxx_ip.c
 create mode 100644 drivers/video/omap2/dss/ti_hdmi_5xxx_ip.h

-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] OMAPDSS: HDMI: Make Wrapper function non-static

2012-03-09 Thread mythripk
From: Mythri P K mythr...@ti.com

HDMI wrapper is same across OMAP4 and OMAP5, so the wrapper
functions can be re-used. Thus making wrapper functions as non-static.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   10 +-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |9 +
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index bc55528..7ccac68 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -721,7 +721,7 @@ static void hdmi_core_av_packet_config(struct hdmi_ip_data 
*ip_data,
(repeat_cfg.generic_pkt_repeat));
 }
 
-static void hdmi_wp_init(struct omap_video_timings *timings,
+void hdmi_wp_init(struct omap_video_timings *timings,
struct hdmi_video_format *video_fmt)
 {
pr_debug(Enter hdmi_wp_init\n);
@@ -744,7 +744,7 @@ void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data 
*ip_data, bool start)
REG_FLD_MOD(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG, start, 31, 31);
 }
 
-static void hdmi_wp_video_init_format(struct hdmi_video_format *video_fmt,
+void hdmi_wp_video_init_format(struct hdmi_video_format *video_fmt,
struct omap_video_timings *timings, struct hdmi_config *param)
 {
pr_debug(Enter hdmi_wp_video_init_format\n);
@@ -760,7 +760,7 @@ static void hdmi_wp_video_init_format(struct 
hdmi_video_format *video_fmt,
timings-vsw = param-timings.vsw;
 }
 
-static void hdmi_wp_video_config_format(struct hdmi_ip_data *ip_data,
+void hdmi_wp_video_config_format(struct hdmi_ip_data *ip_data,
struct hdmi_video_format *video_fmt)
 {
u32 l = 0;
@@ -773,7 +773,7 @@ static void hdmi_wp_video_config_format(struct hdmi_ip_data 
*ip_data,
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_SIZE, l);
 }
 
-static void hdmi_wp_video_config_interface(struct hdmi_ip_data *ip_data)
+void hdmi_wp_video_config_interface(struct hdmi_ip_data *ip_data)
 {
u32 r;
pr_debug(Enter hdmi_wp_video_config_interface\n);
@@ -786,7 +786,7 @@ static void hdmi_wp_video_config_interface(struct 
hdmi_ip_data *ip_data)
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG, r);
 }
 
-static void hdmi_wp_video_config_timing(struct hdmi_ip_data *ip_data,
+void hdmi_wp_video_config_timing(struct hdmi_ip_data *ip_data,
struct omap_video_timings *timings)
 {
u32 timing_h = 0;
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index efa6f29..c18f415 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -542,4 +542,13 @@ void hdmi_wp_audio_config_dma(struct hdmi_ip_data *ip_data,
 void hdmi_wp_audio_config_format(struct hdmi_ip_data *ip_data,
struct hdmi_audio_format *aud_fmt);
 #endif
+void hdmi_wp_video_config_timing(struct hdmi_ip_data *ip_data,
+   struct omap_video_timings *timings);
+void hdmi_wp_video_config_interface(struct hdmi_ip_data *ip_data);
+void hdmi_wp_video_config_format(struct hdmi_ip_data *ip_data,
+   struct hdmi_video_format *video_fmt);
+void hdmi_wp_video_init_format(struct hdmi_video_format *video_fmt,
+   struct omap_video_timings *timings, struct hdmi_config *param);
+void hdmi_wp_init(struct omap_video_timings *timings,
+   struct hdmi_video_format *video_fmt);
 #endif
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] OMAPDSS: HDMI: Add support for OMAP5 HDMI core library

2012-03-09 Thread mythripk
From: Mythri P K mythr...@ti.com

Add support for configuration of the basic HDMI OMAP5 core IP
driver.HDMI shares the wrapper, PHY and PLL code with OMAP4.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |2 +
 drivers/video/omap2/dss/ti_hdmi_5xxx_ip.c |  341 +
 drivers/video/omap2/dss/ti_hdmi_5xxx_ip.h |  254 +
 3 files changed, 597 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/omap2/dss/ti_hdmi_5xxx_ip.c
 create mode 100644 drivers/video/omap2/dss/ti_hdmi_5xxx_ip.h

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 1f58b84..aafecc2 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -185,4 +185,6 @@ void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, 
struct seq_file *s);
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
 void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable);
 #endif
+void ti_hdmi_5xxx_basic_configure(struct hdmi_ip_data *ip_data);
+void ti_hdmi_5xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_5xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_5xxx_ip.c
new file mode 100644
index 000..a8a5ad3
--- /dev/null
+++ b/drivers/video/omap2/dss/ti_hdmi_5xxx_ip.c
@@ -0,0 +1,341 @@
+
+/*
+ * ti_hdmi_5xxx_ip.c
+ *
+ * HDMI TI OMAP5 IP driver Library
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Author: Mythri pk mythr...@ti.com
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see http://www.gnu.org/licenses/.
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/err.h
+#include linux/io.h
+#include linux/interrupt.h
+#include linux/mutex.h
+#include linux/delay.h
+#include linux/string.h
+#include linux/seq_file.h
+
+#include ti_hdmi_5xxx_ip.h
+#include dss.h
+
+static inline void hdmi_write_reg(void __iomem *base_addr,
+   const unsigned long idx, u32 val)
+{
+   __raw_writel(val, base_addr + idx);
+}
+
+static inline u32 hdmi_read_reg(void __iomem *base_addr,
+   const unsigned long idx)
+{
+   return __raw_readl(base_addr + idx);
+}
+
+static inline void __iomem *hdmi_core_sys_base(struct hdmi_ip_data *ip_data)
+{
+   return ip_data-base_wp + ip_data-core_sys_offset;
+}
+
+static inline int hdmi_wait_for_bit_change(void __iomem *base_addr,
+   const unsigned long idx,
+   int b2, int b1, u32 val)
+{
+   u32 t = 0;
+   while (val != REG_GET(base_addr, idx, b2, b1)) {
+   udelay(1);
+   if (t++  1)
+   return !val;
+   }
+   return val;
+}
+
+void ti_hdmi_5xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s)
+{
+
+#define DUMPCORE(r) seq_printf(s, %-35s %08x\n, #r,\
+   hdmi_read_reg(hdmi_core_sys_base(ip_data), r))
+
+   DUMPCORE(HDMI_CORE_FC_INVIDCONF);
+   DUMPCORE(HDMI_CORE_FC_INHACTIV0);
+   DUMPCORE(HDMI_CORE_FC_INHACTIV1);
+   DUMPCORE(HDMI_CORE_FC_INHBLANK0);
+   DUMPCORE(HDMI_CORE_FC_INHBLANK1);
+   DUMPCORE(HDMI_CORE_FC_INVACTIV0);
+   DUMPCORE(HDMI_CORE_FC_INVACTIV1);
+   DUMPCORE(HDMI_CORE_FC_INVBLANK);
+   DUMPCORE(HDMI_CORE_FC_HSYNCINDELAY0);
+   DUMPCORE(HDMI_CORE_FC_HSYNCINDELAY1);
+   DUMPCORE(HDMI_CORE_FC_HSYNCINWIDTH0);
+   DUMPCORE(HDMI_CORE_FC_HSYNCINWIDTH1);
+   DUMPCORE(HDMI_CORE_FC_VSYNCINDELAY);
+   DUMPCORE(HDMI_CORE_FC_VSYNCINWIDTH);
+   DUMPCORE(HDMI_CORE_FC_CTRLDUR);
+   DUMPCORE(HDMI_CORE_FC_EXCTRLDUR);
+   DUMPCORE(HDMI_CORE_FC_EXCTRLSPAC);
+   DUMPCORE(HDMI_CORE_FC_CH0PREAM);
+   DUMPCORE(HDMI_CORE_FC_CH1PREAM);
+   DUMPCORE(HDMI_CORE_FC_CH2PREAM);
+   DUMPCORE(HDMI_CORE_FC_AVICONF0);
+   DUMPCORE(HDMI_CORE_FC_AVICONF1);
+   DUMPCORE(HDMI_CORE_FC_AVICONF2);
+   DUMPCORE(HDMI_CORE_FC_AVIVID);
+   DUMPCORE(HDMI_CORE_FC_PRCONF);
+
+   DUMPCORE(HDMI_CORE_MC_CLKDIS);
+   DUMPCORE(HDMI_CORE_MC_SWRSTZREQ);
+   DUMPCORE(HDMI_CORE_MC_FLOWCTRL);
+   DUMPCORE(HDMI_CORE_MC_PHYRSTZ);
+   DUMPCORE(HDMI_CORE_MC_LOCKONCLOCK);
+
+   DUMPCORE(HDMI_CORE_I2CM_SLAVE);
+   DUMPCORE(HDMI_CORE_I2CM_ADDRESS);
+   DUMPCORE(HDMI_CORE_I2CM_DATAO);
+   DUMPCORE(HDMI_CORE_I2CM_DATAI);
+   DUMPCORE(HDMI_CORE_I2CM_OPERATION);
+   

[PATCH] OMAPDSS: HDMI: wait for RXDET before putting phy in TX_ON

2012-03-01 Thread mythripk
From: Mythri P K mythr...@ti.com

Currently TX_PHY is put to TX_ON(transmission state) on receiving HPD.
It just ensures that the TV is connected but does not guarantee
that TMDS data lines and clock lines are up and ready for transmission.
Which although is very rare scenario has a potential to  damage the HDMI
port.(A use case where TV is connected to board but it is in different
channel would still trigger a HPD but TMDS lines will be down).

Thus this patch adds a rxdet check on getting a HPD which ensures that
TMDS lines are UP before changing the PHY state from LDO_ON to TX_ON.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   37 +++-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |2 +
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index bb784d2..bc55528 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -224,6 +224,30 @@ void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data)
hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_ALLOFF);
 }
 
+int hdmi_ti_4xxx_rxdet(struct hdmi_ip_data *ip_data)
+{
+   int loop = 0, tmds_data0, tmds_data1, tmds_data2, tmds_clk;
+
+   hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_WP_DEBUG_CFG, 4);
+
+   do {
+   tmds_data0 = hdmi_read_reg(hdmi_wp_base(ip_data),
+   HDMI_WP_WP_DEBUG_DATA);
+   tmds_data1 = hdmi_read_reg(hdmi_wp_base(ip_data),
+   HDMI_WP_WP_DEBUG_DATA);
+   tmds_data2 = hdmi_read_reg(hdmi_wp_base(ip_data),
+   HDMI_WP_WP_DEBUG_DATA);
+   tmds_clk = hdmi_read_reg(hdmi_wp_base(ip_data),
+   HDMI_WP_WP_DEBUG_DATA);
+   udelay(15);
+   } while ((tmds_data0 != tmds_data1 || tmds_data1 != tmds_data2
+   || tmds_data1 != tmds_clk)  (loop  500));
+
+   hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_WP_DEBUG_CFG, 0);
+
+   return ((loop == 500) ? -1 : (tmds_data0  1)) ;
+}
+
 static int hdmi_check_hpd_state(struct hdmi_ip_data *ip_data)
 {
unsigned long flags;
@@ -241,10 +265,19 @@ static int hdmi_check_hpd_state(struct hdmi_ip_data 
*ip_data)
return 0;
}
 
-   if (hpd)
+   if (hpd) {
+   /* before putting the phy in TX_ON,ensure that TMDS lanes
+* are pulled up .
+*/
+   r = hdmi_ti_4xxx_rxdet(ip_data);
+   if (r = 0) {
+   DSSERR(rxdet not set\n);
+   return r;
+   }
r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON);
-   else
+   } else {
r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_LDOON);
+   }
 
if (r) {
DSSERR(Failed to %s PHY TX power\n,
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index a14d1a0..efa6f29 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -47,6 +47,8 @@
 #define HDMI_WP_AUDIO_CFG2 0x84
 #define HDMI_WP_AUDIO_CTRL 0x88
 #define HDMI_WP_AUDIO_DATA 0x8C
+#define HDMI_WP_WP_DEBUG_CFG   0x90
+#define HDMI_WP_WP_DEBUG_DATA  0x94
 
 /* HDMI IP Core System */
 
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] OMAPDSS: HDMI: Move Avi-infoframe struct to hdmi_ip_data

2012-02-21 Thread mythripk
From: Mythri P K mythr...@ti.com

With AVI infoframe various parameters of video stream such as
aspect ratio, quantization range, videocode etc will be indicated
from source to sink.Thus AVI information needs to be set/accessed
by the middle ware based on the video content.
Thus this parameter is now moved to the ip_data structure.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |   42 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |8 +++---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |   40 ---
 3 files changed, 46 insertions(+), 44 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 26ec6d1..46e776c 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -113,6 +113,47 @@ struct ti_hdmi_ip_ops {
 
 };
 
+/*
+ * Refer to section 8.2 in HDMI 1.3 specification for
+ * details about infoframe databytes
+ */
+struct hdmi_core_infoframe_avi {
+   /* Y0, Y1 rgb,yCbCr */
+   u8  db1_format;
+   /* A0  Active information Present */
+   u8  db1_active_info;
+   /* B0, B1 Bar info data valid */
+   u8  db1_bar_info_dv;
+   /* S0, S1 scan information */
+   u8  db1_scan_info;
+   /* C0, C1 colorimetry */
+   u8  db2_colorimetry;
+   /* M0, M1 Aspect ratio (4:3, 16:9) */
+   u8  db2_aspect_ratio;
+   /* R0...R3 Active format aspect ratio */
+   u8  db2_active_fmt_ar;
+   /* ITC IT content. */
+   u8  db3_itc;
+   /* EC0, EC1, EC2 Extended colorimetry */
+   u8  db3_ec;
+   /* Q1, Q0 Quantization range */
+   u8  db3_q_range;
+   /* SC1, SC0 Non-uniform picture scaling */
+   u8  db3_nup_scaling;
+   /* VIC0..6 Video format identification */
+   u8  db4_videocode;
+   /* PR0..PR3 Pixel repetition factor */
+   u8  db5_pixel_repeat;
+   /* Line number end of top bar */
+   u16 db6_7_line_eoftop;
+   /* Line number start of bottom bar */
+   u16 db8_9_line_sofbottom;
+   /* Pixel number end of left bar */
+   u16 db10_11_pixel_eofleft;
+   /* Pixel number start of right bar */
+   u16 db12_13_pixel_sofright;
+};
+
 struct hdmi_ip_data {
void __iomem*base_wp;   /* HDMI wrapper */
unsigned long   core_sys_offset;
@@ -122,6 +163,7 @@ struct hdmi_ip_data {
const struct ti_hdmi_ip_ops *ops;
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
+   struct hdmi_core_infoframe_avi avi_cfg;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void 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 9bbf961..6f93271 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -534,12 +534,12 @@ static void hdmi_core_video_config(struct hdmi_ip_data 
*ip_data,
HDMI_CORE_SYS_TMDS_CTRL, cfg-tclk_sel_clkmult, 6, 5);
 }
 
-static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data,
-   struct hdmi_core_infoframe_avi info_avi)
+static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data)
 {
u32 val;
char sum = 0, checksum = 0;
void __iomem *av_base = hdmi_av_base(ip_data);
+   struct hdmi_core_infoframe_avi info_avi = ip_data-avi_cfg;
 
sum += 0x82 + 0x002 + 0x00D;
hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082);
@@ -718,7 +718,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
struct omap_video_timings video_timing;
struct hdmi_video_format video_format;
/* HDMI core */
-   struct hdmi_core_infoframe_avi avi_cfg;
+   struct hdmi_core_infoframe_avi avi_cfg = ip_data-avi_cfg;
struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg;
struct hdmi_config *cfg = ip_data-cfg;
@@ -780,7 +780,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
avi_cfg.db10_11_pixel_eofleft = 0;
avi_cfg.db12_13_pixel_sofright = 0;
 
-   hdmi_core_aux_infoframe_avi_config(ip_data, avi_cfg);
+   hdmi_core_aux_infoframe_avi_config(ip_data);
 
/* enable/repeat the infoframe */
repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 004b418..a14d1a0 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -450,46 +450,6 @@ struct hdmi_core_video_config {
  * Refer to section 8.2 in HDMI 1.3 specification for
  * details about infoframe databytes
  */
-struct hdmi_core_infoframe_avi {
-   /* Y0, Y1 rgb,yCbCr */
-   u8  db1_format;
-   

[PATCH v3] OMAPDSS: HDMI: Add M2 divider while calculating clkout

2012-02-20 Thread mythripk
From: Mythri P K mythr...@ti.com

While calculating regm and regmf value add using M2 divider in
the equation.
Formula for calculating:
Output clock on digital core domain:
CLKOUT = (M / (N+1))*CLKINP*(1/M2)
Internal oscillator output clock on internal LDO domain:
CLKDCOLDO = (M / (N+1))*CLKINP
The current code when allows variable M2 values as input
ignores using M2 divider values in calculation of regm and regmf.
so fix it by using M2 in calculation although the default value for
M2 is 1.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 92a6679..59a493f 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -256,24 +256,24 @@ static void hdmi_compute_pll(struct omap_dss_device 
*dssdev, int phy,
 
refclk = clkin / pi-regn;
 
-   /*
-* multiplier is pixel_clk/ref_clk
-* Multiplying by 100 to avoid fractional part removal
-*/
-   pi-regm = (phy * 100 / (refclk)) / 100;
-
if (dssdev-clocks.hdmi.regm2 == 0)
pi-regm2 = HDMI_DEFAULT_REGM2;
else
pi-regm2 = dssdev-clocks.hdmi.regm2;
 
/*
+* multiplier is pixel_clk/ref_clk
+* Multiplying by 100 to avoid fractional part removal
+*/
+   pi-regm = phy * pi-regm2 / refclk;
+
+   /*
 * fractional multiplier is remainder of the difference between
 * multiplier and actual phy(required pixel clock thus should be
 * multiplied by 2^18(262144) divided by the reference clock
 */
-   mf = (phy - pi-regm * refclk) * 262144;
-   pi-regmf = mf / (refclk);
+   mf = (phy - pi-regm / pi-regm2 * refclk) * 262144;
+   pi-regmf = pi-regm2 * mf / refclk;
 
/*
 * Dcofreq should be set to 1 if required pixel clock
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] OMAPDSS: HDMI: Add M2 divider while calculating clkout

2012-02-14 Thread mythripk
From: Mythri P K mythr...@ti.com

Add M2 divider in the equation to calculate regm and regmf.
Formula for calculating:
Output clock on digital core domain:
CLKOUT = (M / (N+1))*CLKINP*(1/M2)
Internal oscillator output clock on internal LDO domain:
CLKDCOLDO = (M / (N+1))*CLKINP
The current code when allows variable M2 values as input
ignores using M2 divider values in calculation of regm and regmf.
so fix it by using M2 in calculation although the default value for
M2 is 1.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 92a6679..9185630 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -256,24 +256,24 @@ static void hdmi_compute_pll(struct omap_dss_device 
*dssdev, int phy,
 
refclk = clkin / pi-regn;
 
-   /*
-* multiplier is pixel_clk/ref_clk
-* Multiplying by 100 to avoid fractional part removal
-*/
-   pi-regm = (phy * 100 / (refclk)) / 100;
-
if (dssdev-clocks.hdmi.regm2 == 0)
pi-regm2 = HDMI_DEFAULT_REGM2;
else
pi-regm2 = dssdev-clocks.hdmi.regm2;
 
/*
+* multiplier is pixel_clk/ref_clk
+* Multiplying by 100 to avoid fractional part removal
+*/
+   pi-regm = (phy * 100 * pi-regm2 / (refclk)) / 100;
+
+   /*
 * fractional multiplier is remainder of the difference between
 * multiplier and actual phy(required pixel clock thus should be
 * multiplied by 2^18(262144) divided by the reference clock
 */
-   mf = (phy - pi-regm * refclk) * 262144;
-   pi-regmf = mf / (refclk);
+   mf = (phy - pi-regm / pi-regm2 * refclk) * 262144;
+   pi-regmf = pi-regm2 * mf / refclk;
 
/*
 * Dcofreq should be set to 1 if required pixel clock
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] OMAPDSS: HDMI: Add M2 divider while calculating pll

2012-02-08 Thread mythripk
From: Mythri P K mythr...@ti.com

While calculating regm and regmf value add M2 divider in the equation.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 92a6679..9185630 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -256,24 +256,24 @@ static void hdmi_compute_pll(struct omap_dss_device 
*dssdev, int phy,
 
refclk = clkin / pi-regn;
 
-   /*
-* multiplier is pixel_clk/ref_clk
-* Multiplying by 100 to avoid fractional part removal
-*/
-   pi-regm = (phy * 100 / (refclk)) / 100;
-
if (dssdev-clocks.hdmi.regm2 == 0)
pi-regm2 = HDMI_DEFAULT_REGM2;
else
pi-regm2 = dssdev-clocks.hdmi.regm2;
 
/*
+* multiplier is pixel_clk/ref_clk
+* Multiplying by 100 to avoid fractional part removal
+*/
+   pi-regm = (phy * 100 * pi-regm2 / (refclk)) / 100;
+
+   /*
 * fractional multiplier is remainder of the difference between
 * multiplier and actual phy(required pixel clock thus should be
 * multiplied by 2^18(262144) divided by the reference clock
 */
-   mf = (phy - pi-regm * refclk) * 262144;
-   pi-regmf = mf / (refclk);
+   mf = (phy - pi-regm / pi-regm2 * refclk) * 262144;
+   pi-regmf = pi-regm2 * mf / refclk;
 
/*
 * Dcofreq should be set to 1 if required pixel clock
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 2/3] OMAPDSS: HDMI: Add quantization range support in IP lib

2012-02-07 Thread mythripk
From: Mythri P K mythr...@ti.com

Configure the IP to support the limited range and full range quantization
mode. If the full range is configured HDMI transmitter will expand the range
of pixel data from 16-235 to full 8 bit 0-235.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |2 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   41 +
 include/video/omapdss.h   |5 +++
 3 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 46e776c..ab0f2c2 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -164,6 +164,7 @@ struct hdmi_ip_data {
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
struct hdmi_core_infoframe_avi avi_cfg;
+   enum hdmi_range range;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
@@ -181,4 +182,5 @@ void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, 
struct seq_file *s);
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
 void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable);
 #endif
+int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data);
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 6f93271..b0a9573 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -610,6 +610,47 @@ static void hdmi_core_aux_infoframe_avi_config(struct 
hdmi_ip_data *ip_data)
hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_CHSUM, checksum);
 }
 
+int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data)
+{
+   int var;
+
+   switch (ip_data-range) {
+   /*
+* Setting the AVI infroframe to respective limited range
+* 0 if limited range 1 if full range
+*/
+   case HDMI_LIMITED_RANGE:
+   ip_data-avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_LR;
+   hdmi_core_aux_infoframe_avi_config(ip_data);
+   var = hdmi_read_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_ACEN);
+   var = FLD_MOD(var, 1, 1, 1);
+   hdmi_write_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_ACEN, var);
+   break;
+   case HDMI_FULL_RANGE:
+   /* HDMI 1.3 section 6.6 YCBCR components shall
+* always be Limited Range
+*/
+   if (ip_data-avi_cfg.db1_format ==
+   HDMI_INFOFRAME_AVI_DB1Y_YUV422) {
+   pr_err(Only limited range is supported for YUV);
+   return -EINVAL;
+   }
+   ip_data-avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_FR;
+   hdmi_core_aux_infoframe_avi_config(ip_data);
+   var = hdmi_read_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_MODE);
+   var = FLD_MOD(var, 1, 4, 4);
+   hdmi_write_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_MODE, var);
+   break;
+   default:
+   return -EINVAL;
+   }
+   return 0;
+}
+
 static void hdmi_core_av_packet_config(struct hdmi_ip_data *ip_data,
struct hdmi_core_packet_enable_repeat repeat_cfg)
 {
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 062b3b2..29f4e78 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -204,6 +204,11 @@ enum omap_hdmi_flags {
OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1  0,
 };
 
+enum hdmi_range {
+   HDMI_LIMITED_RANGE = 0,
+   HDMI_FULL_RANGE = 1,
+};
+
 /* RFBI */
 
 struct rfbi_timings {
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 3/3] OMAPDSS: HDMI: Sysfs support to configure quantization

2012-02-07 Thread mythripk
From: Mythri P K mythr...@ti.com

Add sysfs support for the user space to configure limited range or full range
quantization for HDMI.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss.h |2 +
 drivers/video/omap2/dss/dss_features.c|1 +
 drivers/video/omap2/dss/hdmi.c|   24 +
 drivers/video/omap2/dss/hdmi_panel.c  |   39 -
 drivers/video/omap2/dss/ti_hdmi.h |6 +++-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |5 ++-
 6 files changed, 73 insertions(+), 4 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index d4b3dff..c5f2ee4 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -512,6 +512,8 @@ int omapdss_hdmi_display_check_timing(struct 
omap_dss_device *dssdev,
struct omap_video_timings *timings);
 int omapdss_hdmi_read_edid(u8 *buf, int len);
 bool omapdss_hdmi_detect(void);
+enum hdmi_range omapdss_hdmi_get_range(void);
+int omapdss_hdmi_set_range(enum hdmi_range range);
 int hdmi_panel_init(void);
 void hdmi_panel_exit(void);
 
diff --git a/drivers/video/omap2/dss/dss_features.c 
b/drivers/video/omap2/dss/dss_features.c
index 419419a..75add3d 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -479,6 +479,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
.audio_enable   =   ti_hdmi_4xxx_wp_audio_enable,
 #endif
+   .configure_range=   ti_hdmi_4xxx_configure_range,
 
 };
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 92a6679..37a0416 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -384,6 +384,30 @@ static void hdmi_power_off(struct omap_dss_device *dssdev)
hdmi_runtime_put();
 }
 
+int omapdss_hdmi_set_range(enum hdmi_range range)
+{
+   int r = 0;
+
+   /* HDMI 1.3 section 6.6 VGA (640x480) format requires Full Range */
+   if ((range == HDMI_LIMITED_RANGE) 
+   ((hdmi.ip_data.cfg.cm.code == 4 
+   hdmi.ip_data.cfg.cm.mode == HDMI_DVI) ||
+   (hdmi.ip_data.cfg.cm.code == 1 
+   hdmi.ip_data.cfg.cm.mode == HDMI_HDMI)))
+   return -EINVAL;
+
+   r = hdmi.ip_data.ops-configure_range(hdmi.ip_data, range);
+   if (!r)
+   hdmi.ip_data.range = range;
+
+   return r;
+}
+
+enum hdmi_range omapdss_hdmi_get_range(void)
+{
+   return hdmi.ip_data.range;
+}
+
 int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
struct omap_video_timings *timings)
 {
diff --git a/drivers/video/omap2/dss/hdmi_panel.c 
b/drivers/video/omap2/dss/hdmi_panel.c
index 533d5dc..81b15de 100644
--- a/drivers/video/omap2/dss/hdmi_panel.c
+++ b/drivers/video/omap2/dss/hdmi_panel.c
@@ -33,6 +33,37 @@ static struct {
struct mutex hdmi_lock;
 } hdmi;
 
+static ssize_t hdmi_range_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   enum hdmi_range range;
+
+   range = omapdss_hdmi_get_range();
+   return snprintf(buf, PAGE_SIZE, %d\n, range);
+}
+
+static ssize_t hdmi_range_store(struct device *dev,
+   struct device_attribute *attr,
+   const char *buf, size_t size)
+{
+   enum hdmi_range range;
+   int r ;
+
+   if (strncmp(limited, buf, 7) == 0)
+   range = HDMI_LIMITED_RANGE;
+   else if (strncmp(full, buf, 4) == 0)
+   range = HDMI_FULL_RANGE;
+   else
+   return -EINVAL;
+
+   r = omapdss_hdmi_set_range(range);
+   if (r)
+   return r;
+
+   return size;
+}
+
+static DEVICE_ATTR(range, S_IRUGO | S_IWUSR, hdmi_range_show, 
hdmi_range_store);
 
 static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 {
@@ -41,6 +72,12 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
dssdev-panel.config = OMAP_DSS_LCD_TFT |
OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS;
 
+   /* sysfs entry to provide user space control to set
+* quantization range
+*/
+   if (device_create_file(dssdev-dev, dev_attr_range))
+   DSSERR(failed to create sysfs file\n);
+
dssdev-panel.timings = (struct omap_video_timings){640, 480, 25175, 
96, 16, 48, 2 , 11, 31};
 
DSSDBG(hdmi_panel_probe x_res= %d y_res = %d\n,
@@ -51,7 +88,7 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 
 static void hdmi_panel_remove(struct omap_dss_device *dssdev)
 {
-
+   device_remove_file(dssdev-dev, dev_attr_range);
 }
 
 static int hdmi_panel_enable(struct omap_dss_device *dssdev)
diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index ab0f2c2..a4dcb83 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h

[PATCH v4 1/3] OMAPDSS: HDMI: Move Avi-infoframe struct to hdmi_ip_data

2012-02-07 Thread mythripk
From: Mythri P K mythr...@ti.com

With AVI infoframe various parameters of video stream such as
aspect ratio, quantization range, videocode etc will be indicated
from source to sink.Thus AVI information needs to be set/accessed
by the middle ware based on the video content.
Thus this parameter is now moved to the ip_data structure.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |   42 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |8 +++---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |   40 ---
 3 files changed, 46 insertions(+), 44 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 26ec6d1..46e776c 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -113,6 +113,47 @@ struct ti_hdmi_ip_ops {
 
 };
 
+/*
+ * Refer to section 8.2 in HDMI 1.3 specification for
+ * details about infoframe databytes
+ */
+struct hdmi_core_infoframe_avi {
+   /* Y0, Y1 rgb,yCbCr */
+   u8  db1_format;
+   /* A0  Active information Present */
+   u8  db1_active_info;
+   /* B0, B1 Bar info data valid */
+   u8  db1_bar_info_dv;
+   /* S0, S1 scan information */
+   u8  db1_scan_info;
+   /* C0, C1 colorimetry */
+   u8  db2_colorimetry;
+   /* M0, M1 Aspect ratio (4:3, 16:9) */
+   u8  db2_aspect_ratio;
+   /* R0...R3 Active format aspect ratio */
+   u8  db2_active_fmt_ar;
+   /* ITC IT content. */
+   u8  db3_itc;
+   /* EC0, EC1, EC2 Extended colorimetry */
+   u8  db3_ec;
+   /* Q1, Q0 Quantization range */
+   u8  db3_q_range;
+   /* SC1, SC0 Non-uniform picture scaling */
+   u8  db3_nup_scaling;
+   /* VIC0..6 Video format identification */
+   u8  db4_videocode;
+   /* PR0..PR3 Pixel repetition factor */
+   u8  db5_pixel_repeat;
+   /* Line number end of top bar */
+   u16 db6_7_line_eoftop;
+   /* Line number start of bottom bar */
+   u16 db8_9_line_sofbottom;
+   /* Pixel number end of left bar */
+   u16 db10_11_pixel_eofleft;
+   /* Pixel number start of right bar */
+   u16 db12_13_pixel_sofright;
+};
+
 struct hdmi_ip_data {
void __iomem*base_wp;   /* HDMI wrapper */
unsigned long   core_sys_offset;
@@ -122,6 +163,7 @@ struct hdmi_ip_data {
const struct ti_hdmi_ip_ops *ops;
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
+   struct hdmi_core_infoframe_avi avi_cfg;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void 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 9bbf961..6f93271 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -534,12 +534,12 @@ static void hdmi_core_video_config(struct hdmi_ip_data 
*ip_data,
HDMI_CORE_SYS_TMDS_CTRL, cfg-tclk_sel_clkmult, 6, 5);
 }
 
-static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data,
-   struct hdmi_core_infoframe_avi info_avi)
+static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data)
 {
u32 val;
char sum = 0, checksum = 0;
void __iomem *av_base = hdmi_av_base(ip_data);
+   struct hdmi_core_infoframe_avi info_avi = ip_data-avi_cfg;
 
sum += 0x82 + 0x002 + 0x00D;
hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082);
@@ -718,7 +718,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
struct omap_video_timings video_timing;
struct hdmi_video_format video_format;
/* HDMI core */
-   struct hdmi_core_infoframe_avi avi_cfg;
+   struct hdmi_core_infoframe_avi avi_cfg = ip_data-avi_cfg;
struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg;
struct hdmi_config *cfg = ip_data-cfg;
@@ -780,7 +780,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
avi_cfg.db10_11_pixel_eofleft = 0;
avi_cfg.db12_13_pixel_sofright = 0;
 
-   hdmi_core_aux_infoframe_avi_config(ip_data, avi_cfg);
+   hdmi_core_aux_infoframe_avi_config(ip_data);
 
/* enable/repeat the infoframe */
repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 004b418..a14d1a0 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -450,46 +450,6 @@ struct hdmi_core_video_config {
  * Refer to section 8.2 in HDMI 1.3 specification for
  * details about infoframe databytes
  */
-struct hdmi_core_infoframe_avi {
-   /* Y0, Y1 rgb,yCbCr */
-   u8  db1_format;
-   

[PATCH v4 1/4] OMAPDSS: HDMI: remove duplicate video interface code

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

video interface structure is a duplicate structure with parameters which are
already present in ip_data config structure, Thus removing the structure and
modifying corresponding code.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   31 +++-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |7 --
 2 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index e1a6ce5..403d6fc 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -629,8 +629,7 @@ static void hdmi_core_av_packet_config(struct hdmi_ip_data 
*ip_data,
 }
 
 static void hdmi_wp_init(struct omap_video_timings *timings,
-   struct hdmi_video_format *video_fmt,
-   struct hdmi_video_interface *video_int)
+   struct hdmi_video_format *video_fmt)
 {
pr_debug(Enter hdmi_wp_init\n);
 
@@ -645,12 +644,6 @@ static void hdmi_wp_init(struct omap_video_timings 
*timings,
video_fmt-y_res = 0;
video_fmt-x_res = 0;
 
-   video_int-vsp = 0;
-   video_int-hsp = 0;
-
-   video_int-interlacing = 0;
-   video_int-tm = 0; /* HDMI_TIMING_SLAVE */
-
 }
 
 void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data, bool start)
@@ -687,17 +680,16 @@ static void hdmi_wp_video_config_format(struct 
hdmi_ip_data *ip_data,
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_SIZE, l);
 }
 
-static void hdmi_wp_video_config_interface(struct hdmi_ip_data *ip_data,
-   struct hdmi_video_interface *video_int)
+static void hdmi_wp_video_config_interface(struct hdmi_ip_data *ip_data)
 {
u32 r;
pr_debug(Enter hdmi_wp_video_config_interface\n);
 
r = hdmi_read_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG);
-   r = FLD_MOD(r, video_int-vsp, 7, 7);
-   r = FLD_MOD(r, video_int-hsp, 6, 6);
-   r = FLD_MOD(r, video_int-interlacing, 3, 3);
-   r = FLD_MOD(r, video_int-tm, 1, 0);
+   r = FLD_MOD(r, ip_data-cfg.timings.vsync_pol, 7, 7);
+   r = FLD_MOD(r, ip_data-cfg.timings.hsync_pol, 6, 6);
+   r = FLD_MOD(r, ip_data-cfg.interlace, 3, 3);
+   r = FLD_MOD(r, 1, 1, 0); /* HDMI_TIMING_MASTER_24BIT */
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG, r);
 }
 
@@ -725,15 +717,13 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
/* HDMI */
struct omap_video_timings video_timing;
struct hdmi_video_format video_format;
-   struct hdmi_video_interface video_interface;
/* HDMI core */
struct hdmi_core_infoframe_avi avi_cfg;
struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg;
struct hdmi_config *cfg = ip_data-cfg;
 
-   hdmi_wp_init(video_timing, video_format,
-   video_interface);
+   hdmi_wp_init(video_timing, video_format);
 
hdmi_core_init(v_core_cfg,
avi_cfg,
@@ -748,12 +738,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
 
hdmi_wp_video_config_format(ip_data, video_format);
 
-   video_interface.vsp = cfg-timings.vsync_pol;
-   video_interface.hsp = cfg-timings.hsync_pol;
-   video_interface.interlacing = cfg-interlace;
-   video_interface.tm = 1 ; /* HDMI_TIMING_MASTER_24BIT */
-
-   hdmi_wp_video_config_interface(ip_data, video_interface);
+   hdmi_wp_video_config_interface(ip_data);
 
/*
 * configure core video part
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 2040956..914bec6 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -517,13 +517,6 @@ struct hdmi_video_format {
u32 x_res;  /* pixel per line */
 };
 
-struct hdmi_video_interface {
-   int vsp;/* Vsync polarity */
-   int hsp;/* Hsync polarity */
-   int interlacing;
-   int tm; /* Timing mode */
-};
-
 struct hdmi_audio_format {
enum hdmi_stereo_channels   stereo_channels;
u8  active_chnnls_msk;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 0/4] OMAPDSS: HDMI: Improve the timings logic in HDMI

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

There are some duplicate timing structure which are not needed thus removing
them to clean the code.
Also the static mapped timing structure is quite complicated to add new
timings, so simplify it by using array indexed method.

changes since v3: Remove double call of function
changes since v2: Incorporate changes in find_timing function
changes since V1: change of hdmi_find_timing function to return pointer to the
timing struct rather than deep copy to timing structure passed as parameter
variable name change from temp to timing2 in comparator function.

Mythri P K (4):
  OMAPDSS: HDMI: remove duplicate video interface code
  OMAPDSS: HDMI: update static timing table
  OMAPDSS: HDMI: change the timing match logic
  OMAPDSS: HDMI: remove duplicate code and mode parameter

 drivers/video/omap2/dss/hdmi.c|  256 +
 drivers/video/omap2/dss/ti_hdmi.h |   14 +-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   47 ++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |7 -
 4 files changed, 135 insertions(+), 189 deletions(-)

-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 3/4] OMAPDSS: HDMI: change the timing match logic

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

Change the timing match logic, Instead of the statically mapped method
to get the corresponding timings for a given code and mode, move to a
simpler array indexed method. It  will help to scale up to add more
timings when needed.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |  176 +---
 1 files changed, 76 insertions(+), 100 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index f76ae47..309b238 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -58,8 +58,6 @@
 #define EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR 4
 #define EDID_SIZE_BLOCK1_TIMING_DESCRIPTOR 4
 
-#define OMAP_HDMI_TIMINGS_NB   34
-
 #define HDMI_DEFAULT_REGN 16
 #define HDMI_DEFAULT_REGM2 1
 
@@ -88,7 +86,7 @@ static struct {
  * map it to corresponding CEA or VESA index.
  */
 
-static const struct hdmi_config cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
+static const struct hdmi_config cea_timings[] = {
 { {640, 480, 25200, 96, 16, 48, 2, 10, 33, 0, 0, 0}, {1, HDMI_HDMI} },
 { {720, 480, 27027, 62, 16, 60, 6, 9, 30, 0, 0, 0}, {2, HDMI_HDMI} },
 { {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {4, HDMI_HDMI} },
@@ -104,6 +102,8 @@ static const struct hdmi_config 
cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
 { {1920, 1080, 74250, 44, 638, 148, 5, 4, 36, 1, 1, 0}, {32, HDMI_HDMI} },
 { {2880, 480, 108108, 248, 64, 240, 6, 9, 30, 0, 0, 0}, {35, HDMI_HDMI} },
 { {2880, 576, 108000, 256, 48, 272, 5, 5, 39, 0, 0, 0}, {37, HDMI_HDMI} },
+};
+static const struct hdmi_config vesa_timings[] = {
 /* VESA From Here */
 { {640, 480, 25175, 96, 16, 48, 2 , 11, 31, 0, 0, 0}, {4, HDMI_DVI} },
 { {800, 600, 4, 128, 40, 88, 4 , 1, 23, 1, 1, 0}, {9, HDMI_DVI} },
@@ -126,39 +126,6 @@ static const struct hdmi_config 
cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
 { {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {0x55, HDMI_DVI} }
 };
 
-/*
- * This is a static mapping array which maps the timing values
- * with corresponding CEA / VESA code
- */
-static const int code_index[OMAP_HDMI_TIMINGS_NB] = {
-   1, 19, 4, 2, 37, 6, 21, 20, 5, 16, 17, 29, 31, 35, 32,
-   /* --15 CEA 17-- vesa*/
-   4, 9, 0xE, 0x17, 0x1C, 0x27, 0x20, 0x23, 0x10, 0x2A,
-   0X2F, 0x3A, 0X51, 0X52, 0x16, 0x29, 0x39, 0x1B
-};
-
-/*
- * This is reverse static mapping which maps the CEA / VESA code
- * to the corresponding timing values
- */
-static const int code_cea[39] = {
-   -1,  0,  3,  3,  2,  8,  5,  5, -1, -1,
-   -1, -1, -1, -1, -1, -1,  9, 10, 10,  1,
-   7,   6,  6, -1, -1, -1, -1, -1, -1, 11,
-   11, 12, 14, -1, -1, 13, 13,  4,  4
-};
-
-static const int code_vesa[85] = {
-   -1, -1, -1, -1, 15, -1, -1, -1, -1, 16,
-   -1, -1, -1, -1, 17, -1, 23, -1, -1, -1,
-   -1, -1, 29, 18, -1, -1, -1, 32, 19, -1,
-   -1, -1, 21, -1, -1, 22, -1, -1, -1, 20,
-   -1, 30, 24, -1, -1, -1, -1, 25, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, 31, 26, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-   -1, 27, 28, -1, 33};
-
 static int hdmi_runtime_get(void)
 {
int r;
@@ -188,82 +155,83 @@ int hdmi_init_display(struct omap_dss_device *dssdev)
return 0;
 }
 
-static int get_timings_index(void)
+static const struct hdmi_config *hdmi_find_timing(
+   const struct hdmi_config *timings_arr,
+   int len)
 {
-   int code;
+   int i;
 
-   if (hdmi.mode == 0)
-   code = code_vesa[hdmi.code];
-   else
-   code = code_cea[hdmi.code];
+   for (i = 0; i  len; i++) {
+   if (timings_arr[i].cm.code == hdmi.code)
+   return timings_arr[i];
+   }
+   return NULL;
+}
 
-   if (code == -1) {
-   /* HDMI code 4 corresponds to 640 * 480 VGA */
-   hdmi.code = 4;
-   /* DVI mode 1 corresponds to HDMI 0 to DVI */
-   hdmi.mode = HDMI_DVI;
+static const struct hdmi_config *hdmi_get_timings(void)
+{
+   const struct hdmi_config *arr;
+   int len;
+
+   if (hdmi.mode == HDMI_DVI) {
+   arr = vesa_timings;
+   len = ARRAY_SIZE(vesa_timings);
+   } else {
+   arr = cea_timings;
+   len = ARRAY_SIZE(cea_timings);
+   }
+
+   return hdmi_find_timing(arr, len);
+}
+
+static bool hdmi_timings_compare(struct omap_video_timings *timing1,
+   const struct hdmi_video_timings *timing2)
+{
+   int timing1_vsync, timing1_hsync, timing2_vsync, timing2_hsync;
+
+   if ((timing2-pixel_clock == timing1-pixel_clock) 
+   (timing2-x_res == timing1-x_res) 
+   (timing2-y_res == timing1-y_res)) {
+
+   timing2_hsync = timing2-hfp + timing2-hsw + timing2-hbp;
+   

[PATCH v4 2/4] OMAPDSS: HDMI: update static timing table

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

Add the vsync polarity, hsync polarity, interlace to hdmi_video_timings.
Remove the now duplicate structure hdmi_timings.
update the static table structure in HDMI with CEA/VESA code and mode.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c|   96 ++--
 drivers/video/omap2/dss/ti_hdmi.h |   14 ++---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   20 +++---
 3 files changed, 63 insertions(+), 67 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index c56378c..f76ae47 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -88,42 +88,42 @@ static struct {
  * map it to corresponding CEA or VESA index.
  */
 
-static const struct hdmi_timings cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
-   { {640, 480, 25200, 96, 16, 48, 2, 10, 33} , 0 , 0},
-   { {1280, 720, 74250, 40, 440, 220, 5, 5, 20}, 1, 1},
-   { {1280, 720, 74250, 40, 110, 220, 5, 5, 20}, 1, 1},
-   { {720, 480, 27027, 62, 16, 60, 6, 9, 30}, 0, 0},
-   { {2880, 576, 108000, 256, 48, 272, 5, 5, 39}, 0, 0},
-   { {1440, 240, 27027, 124, 38, 114, 3, 4, 15}, 0, 0},
-   { {1440, 288, 27000, 126, 24, 138, 3, 2, 19}, 0, 0},
-   { {1920, 540, 74250, 44, 528, 148, 5, 2, 15}, 1, 1},
-   { {1920, 540, 74250, 44, 88, 148, 5, 2, 15}, 1, 1},
-   { {1920, 1080, 148500, 44, 88, 148, 5, 4, 36}, 1, 1},
-   { {720, 576, 27000, 64, 12, 68, 5, 5, 39}, 0, 0},
-   { {1440, 576, 54000, 128, 24, 136, 5, 5, 39}, 0, 0},
-   { {1920, 1080, 148500, 44, 528, 148, 5, 4, 36}, 1, 1},
-   { {2880, 480, 108108, 248, 64, 240, 6, 9, 30}, 0, 0},
-   { {1920, 1080, 74250, 44, 638, 148, 5, 4, 36}, 1, 1},
-   /* VESA From Here */
-   { {640, 480, 25175, 96, 16, 48, 2 , 11, 31}, 0, 0},
-   { {800, 600, 4, 128, 40, 88, 4 , 1, 23}, 1, 1},
-   { {848, 480, 33750, 112, 16, 112, 8 , 6, 23}, 1, 1},
-   { {1280, 768, 79500, 128, 64, 192, 7 , 3, 20}, 1, 0},
-   { {1280, 800, 83500, 128, 72, 200, 6 , 3, 22}, 1, 0},
-   { {1360, 768, 85500, 112, 64, 256, 6 , 3, 18}, 1, 1},
-   { {1280, 960, 108000, 112, 96, 312, 3 , 1, 36}, 1, 1},
-   { {1280, 1024, 108000, 112, 48, 248, 3 , 1, 38}, 1, 1},
-   { {1024, 768, 65000, 136, 24, 160, 6, 3, 29}, 0, 0},
-   { {1400, 1050, 121750, 144, 88, 232, 4, 3, 32}, 1, 0},
-   { {1440, 900, 106500, 152, 80, 232, 6, 3, 25}, 1, 0},
-   { {1680, 1050, 146250, 176 , 104, 280, 6, 3, 30}, 1, 0},
-   { {1366, 768, 85500, 143, 70, 213, 3, 3, 24}, 1, 1},
-   { {1920, 1080, 148500, 44, 148, 80, 5, 4, 36}, 1, 1},
-   { {1280, 768, 68250, 32, 48, 80, 7, 3, 12}, 0, 1},
-   { {1400, 1050, 101000, 32, 48, 80, 4, 3, 23}, 0, 1},
-   { {1680, 1050, 119000, 32, 48, 80, 6, 3, 21}, 0, 1},
-   { {1280, 800, 79500, 32, 48, 80, 6, 3, 14}, 0, 1},
-   { {1280, 720, 74250, 40, 110, 220, 5, 5, 20}, 1, 1}
+static const struct hdmi_config cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
+{ {640, 480, 25200, 96, 16, 48, 2, 10, 33, 0, 0, 0}, {1, HDMI_HDMI} },
+{ {720, 480, 27027, 62, 16, 60, 6, 9, 30, 0, 0, 0}, {2, HDMI_HDMI} },
+{ {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {4, HDMI_HDMI} },
+{ {1920, 540, 74250, 44, 88, 148, 5, 2, 15, 1, 1, 1}, {5, HDMI_HDMI} },
+{ {1440, 240, 27027, 124, 38, 114, 3, 4, 15, 0, 0, 1}, {6, HDMI_HDMI} },
+{ {1920, 1080, 148500, 44, 88, 148, 5, 4, 36, 1, 1, 0}, {16, HDMI_HDMI} },
+{ {720, 576, 27000, 64, 12, 68, 5, 5, 39, 0, 0, 0}, {17, HDMI_HDMI} },
+{ {1280, 720, 74250, 40, 440, 220, 5, 5, 20, 1, 1, 0}, {19, HDMI_HDMI} },
+{ {1920, 540, 74250, 44, 528, 148, 5, 2, 15, 1, 1, 1}, {20, HDMI_HDMI} },
+{ {1440, 288, 27000, 126, 24, 138, 3, 2, 19, 0, 0, 1}, {21, HDMI_HDMI} },
+{ {1440, 576, 54000, 128, 24, 136, 5, 5, 39, 0, 0, 0}, {29, HDMI_HDMI} },
+{ {1920, 1080, 148500, 44, 528, 148, 5, 4, 36, 1, 1, 0}, {31, HDMI_HDMI} },
+{ {1920, 1080, 74250, 44, 638, 148, 5, 4, 36, 1, 1, 0}, {32, HDMI_HDMI} },
+{ {2880, 480, 108108, 248, 64, 240, 6, 9, 30, 0, 0, 0}, {35, HDMI_HDMI} },
+{ {2880, 576, 108000, 256, 48, 272, 5, 5, 39, 0, 0, 0}, {37, HDMI_HDMI} },
+/* VESA From Here */
+{ {640, 480, 25175, 96, 16, 48, 2 , 11, 31, 0, 0, 0}, {4, HDMI_DVI} },
+{ {800, 600, 4, 128, 40, 88, 4 , 1, 23, 1, 1, 0}, {9, HDMI_DVI} },
+{ {848, 480, 33750, 112, 16, 112, 8 , 6, 23, 1, 1, 0}, {0xE, HDMI_DVI} },
+{ {1280, 768, 79500, 128, 64, 192, 7 , 3, 20, 1, 0, 0}, {0x17, HDMI_DVI} },
+{ {1280, 800, 83500, 128, 72, 200, 6 , 3, 22, 1, 0, 0}, {0x1C, HDMI_DVI} },
+{ {1360, 768, 85500, 112, 64, 256, 6 , 3, 18, 1, 1, 0}, {0x27, HDMI_DVI} },
+{ {1280, 960, 108000, 112, 96, 312, 3 , 1, 36, 1, 1, 0}, {0x20, HDMI_DVI} },
+{ {1280, 1024, 108000, 112, 48, 248, 3 , 1, 38, 1, 1, 0}, {0x23, HDMI_DVI} },
+{ {1024, 768, 65000, 136, 24, 160, 6, 3, 29, 0, 0, 0}, {0x10, HDMI_DVI} },
+{ {1400, 1050, 121750, 144, 88, 232, 4, 3, 32, 1, 0, 0}, {0x2A, HDMI_DVI} },
+{ {1440, 900, 106500, 152, 80, 232, 6, 3, 

[PATCH v4 4/4] OMAPDSS: HDMI: remove duplicate code and mode parameter

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

code and mode parameters are already a part of the ip_data structure
so no need to keep the same parameters again in hdmi global structure.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |   18 +++---
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 309b238..0caa1bb 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -66,8 +66,6 @@ static struct {
struct omap_display_platform_data *pdata;
struct platform_device *pdev;
struct hdmi_ip_data ip_data;
-   int code;
-   int mode;
 
struct clk *sys_clk;
 } hdmi;
@@ -162,7 +160,7 @@ static const struct hdmi_config *hdmi_find_timing(
int i;
 
for (i = 0; i  len; i++) {
-   if (timings_arr[i].cm.code == hdmi.code)
+   if (timings_arr[i].cm.code == hdmi.ip_data.cfg.cm.code)
return timings_arr[i];
}
return NULL;
@@ -173,7 +171,7 @@ static const struct hdmi_config *hdmi_get_timings(void)
const struct hdmi_config *arr;
int len;
 
-   if (hdmi.mode == HDMI_DVI) {
+   if (hdmi.ip_data.cfg.cm.mode == HDMI_DVI) {
arr = vesa_timings;
len = ARRAY_SIZE(vesa_timings);
} else {
@@ -313,9 +311,9 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
timing = hdmi_get_timings();
if (timing == NULL) {
/* HDMI code 4 corresponds to 640 * 480 VGA */
-   hdmi.code = 4;
+   hdmi.ip_data.cfg.cm.code = 4;
/* DVI mode 1 corresponds to HDMI 0 to DVI */
-   hdmi.mode = HDMI_DVI;
+   hdmi.ip_data.cfg.cm.mode = HDMI_DVI;
hdmi.ip_data.cfg = vesa_timings[0];
} else {
hdmi.ip_data.cfg = *timing;
@@ -339,8 +337,6 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
goto err;
}
 
-   hdmi.ip_data.cfg.cm.mode = hdmi.mode;
-   hdmi.ip_data.cfg.cm.code = hdmi.code;
hdmi.ip_data.ops-video_configure(hdmi.ip_data);
 
/* Make selection of HDMI in DSS */
@@ -400,8 +396,8 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device 
*dssdev)
struct hdmi_cm cm;
 
cm = hdmi_get_code(dssdev-panel.timings);
-   hdmi.code = cm.code;
-   hdmi.mode = cm.mode;
+   hdmi.ip_data.cfg.cm.code = cm.code;
+   hdmi.ip_data.cfg.cm.mode = cm.mode;
 
if (dssdev-state == OMAP_DSS_DISPLAY_ACTIVE) {
int r;
@@ -667,7 +663,7 @@ static int hdmi_audio_hw_params(struct hdmi_ip_data 
*ip_data,
 static int hdmi_audio_startup(struct snd_pcm_substream *substream,
  struct snd_soc_dai *dai)
 {
-   if (!hdmi.mode) {
+   if (!hdmi.ip_data.cfg.cm.mode) {
pr_err(Current video settings do not support audio.\n);
return -EIO;
}
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/3] OMAPDSS: HDMI: Move Avi-infoframe struct to hdmi_ip_data

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

With AVI infoframe various parameters of video stream such as
aspect ratio, quantization range, videocode etc will be indicated
from source to sink.Thus AVI information needs to be set/accessed
by the middle ware based on the video content.
Thus this parameter is now moved to the ip_data structure.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |   42 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |8 +++---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |   40 ---
 3 files changed, 46 insertions(+), 44 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 26ec6d1..46e776c 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -113,6 +113,47 @@ struct ti_hdmi_ip_ops {
 
 };
 
+/*
+ * Refer to section 8.2 in HDMI 1.3 specification for
+ * details about infoframe databytes
+ */
+struct hdmi_core_infoframe_avi {
+   /* Y0, Y1 rgb,yCbCr */
+   u8  db1_format;
+   /* A0  Active information Present */
+   u8  db1_active_info;
+   /* B0, B1 Bar info data valid */
+   u8  db1_bar_info_dv;
+   /* S0, S1 scan information */
+   u8  db1_scan_info;
+   /* C0, C1 colorimetry */
+   u8  db2_colorimetry;
+   /* M0, M1 Aspect ratio (4:3, 16:9) */
+   u8  db2_aspect_ratio;
+   /* R0...R3 Active format aspect ratio */
+   u8  db2_active_fmt_ar;
+   /* ITC IT content. */
+   u8  db3_itc;
+   /* EC0, EC1, EC2 Extended colorimetry */
+   u8  db3_ec;
+   /* Q1, Q0 Quantization range */
+   u8  db3_q_range;
+   /* SC1, SC0 Non-uniform picture scaling */
+   u8  db3_nup_scaling;
+   /* VIC0..6 Video format identification */
+   u8  db4_videocode;
+   /* PR0..PR3 Pixel repetition factor */
+   u8  db5_pixel_repeat;
+   /* Line number end of top bar */
+   u16 db6_7_line_eoftop;
+   /* Line number start of bottom bar */
+   u16 db8_9_line_sofbottom;
+   /* Pixel number end of left bar */
+   u16 db10_11_pixel_eofleft;
+   /* Pixel number start of right bar */
+   u16 db12_13_pixel_sofright;
+};
+
 struct hdmi_ip_data {
void __iomem*base_wp;   /* HDMI wrapper */
unsigned long   core_sys_offset;
@@ -122,6 +163,7 @@ struct hdmi_ip_data {
const struct ti_hdmi_ip_ops *ops;
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
+   struct hdmi_core_infoframe_avi avi_cfg;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void 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 a229ae7..d9ddb6d 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -534,12 +534,12 @@ static void hdmi_core_video_config(struct hdmi_ip_data 
*ip_data,
HDMI_CORE_SYS_TMDS_CTRL, cfg-tclk_sel_clkmult, 6, 5);
 }
 
-static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data,
-   struct hdmi_core_infoframe_avi info_avi)
+static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data)
 {
u32 val;
char sum = 0, checksum = 0;
void __iomem *av_base = hdmi_av_base(ip_data);
+   struct hdmi_core_infoframe_avi info_avi = ip_data-avi_cfg;
 
sum += 0x82 + 0x002 + 0x00D;
hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082);
@@ -718,7 +718,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
struct omap_video_timings video_timing;
struct hdmi_video_format video_format;
/* HDMI core */
-   struct hdmi_core_infoframe_avi avi_cfg;
+   struct hdmi_core_infoframe_avi avi_cfg = ip_data-avi_cfg;
struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg;
struct hdmi_config *cfg = ip_data-cfg;
@@ -780,7 +780,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
avi_cfg.db10_11_pixel_eofleft = 0;
avi_cfg.db12_13_pixel_sofright = 0;
 
-   hdmi_core_aux_infoframe_avi_config(ip_data, avi_cfg);
+   hdmi_core_aux_infoframe_avi_config(ip_data);
 
/* enable/repeat the infoframe */
repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 004b418..a14d1a0 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -450,46 +450,6 @@ struct hdmi_core_video_config {
  * Refer to section 8.2 in HDMI 1.3 specification for
  * details about infoframe databytes
  */
-struct hdmi_core_infoframe_avi {
-   /* Y0, Y1 rgb,yCbCr */
-   u8  db1_format;
-   

[PATCH v3 3/3] OMAPDSS: HDMI: Sysfs support to configure quantization range

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

Add sysfs support for the uset space to configure limited range or full range
quantization for HDMI.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss.h  |2 +
 drivers/video/omap2/dss/dss_features.c |1 +
 drivers/video/omap2/dss/hdmi.c |   28 +++
 drivers/video/omap2/dss/hdmi_panel.c   |   39 +++-
 drivers/video/omap2/dss/ti_hdmi.h  |2 +
 5 files changed, 71 insertions(+), 1 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 3cf99a9..0b1b6f2 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -518,6 +518,8 @@ int omapdss_hdmi_display_check_timing(struct 
omap_dss_device *dssdev,
struct omap_video_timings *timings);
 int omapdss_hdmi_read_edid(u8 *buf, int len);
 bool omapdss_hdmi_detect(void);
+int omapdss_hdmi_get_range(void);
+int omapdss_hdmi_set_range(enum hdmi_range range);
 int hdmi_panel_init(void);
 void hdmi_panel_exit(void);
 
diff --git a/drivers/video/omap2/dss/dss_features.c 
b/drivers/video/omap2/dss/dss_features.c
index afcb593..544b172 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -476,6 +476,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
.audio_enable   =   ti_hdmi_4xxx_wp_audio_enable,
 #endif
+   .configure_range=   ti_hdmi_4xxx_configure_range,
 
 };
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 92a6679..65397f7 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -384,6 +384,34 @@ static void hdmi_power_off(struct omap_dss_device *dssdev)
hdmi_runtime_put();
 }
 
+int omapdss_hdmi_set_range(enum hdmi_range range)
+{
+   int r = 0;
+   enum hdmi_range old_range;
+
+   old_range = hdmi.ip_data.range;
+   hdmi.ip_data.range = range;
+
+   /* HDMI 1.3 section 6.6 VGA (640x480) format requires Full Range */
+   if ((range == HDMI_LIMITED_RANGE) 
+   ((hdmi.ip_data.cfg.cm.code == 4 
+   hdmi.ip_data.cfg.cm.mode == HDMI_DVI) ||
+   (hdmi.ip_data.cfg.cm.code == 1 
+   hdmi.ip_data.cfg.cm.mode == HDMI_HDMI)))
+   return -EINVAL;
+
+   r = hdmi.ip_data.ops-configure_range(hdmi.ip_data);
+   if (r)
+   hdmi.ip_data.range = old_range;
+
+   return r;
+}
+
+int omapdss_hdmi_get_range(void)
+{
+   return hdmi.ip_data.range;
+}
+
 int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
struct omap_video_timings *timings)
 {
diff --git a/drivers/video/omap2/dss/hdmi_panel.c 
b/drivers/video/omap2/dss/hdmi_panel.c
index 533d5dc..3166602 100644
--- a/drivers/video/omap2/dss/hdmi_panel.c
+++ b/drivers/video/omap2/dss/hdmi_panel.c
@@ -33,6 +33,37 @@ static struct {
struct mutex hdmi_lock;
 } hdmi;
 
+static ssize_t hdmi_range_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   int r;
+
+   r = omapdss_hdmi_get_range();
+   return snprintf(buf, PAGE_SIZE, %d\n, r);
+}
+
+static ssize_t hdmi_range_store(struct device *dev,
+   struct device_attribute *attr,
+   const char *buf, size_t size)
+{
+   unsigned long range;
+   int r ;
+
+   if (strncmp(limited, buf, 7) == 0)
+   range = 0;
+   else if (strncmp(full, buf, 4) == 0)
+   range = 1;
+   else
+   return -EINVAL;
+
+   r = omapdss_hdmi_set_range(range);
+   if (r)
+   return r;
+
+   return size;
+}
+
+static DEVICE_ATTR(range, S_IRUGO | S_IWUSR, hdmi_range_show, 
hdmi_range_store);
 
 static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 {
@@ -41,6 +72,12 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
dssdev-panel.config = OMAP_DSS_LCD_TFT |
OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS;
 
+   /* sysfs entry to provide user space control to set
+* quantization range
+*/
+   if (device_create_file(dssdev-dev, dev_attr_range))
+   DSSERR(failed to create sysfs file\n);
+
dssdev-panel.timings = (struct omap_video_timings){640, 480, 25175, 
96, 16, 48, 2 , 11, 31};
 
DSSDBG(hdmi_panel_probe x_res= %d y_res = %d\n,
@@ -51,7 +88,7 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 
 static void hdmi_panel_remove(struct omap_dss_device *dssdev)
 {
-
+   device_remove_file(dssdev-dev, dev_attr_range);
 }
 
 static int hdmi_panel_enable(struct omap_dss_device *dssdev)
diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index ab0f2c2..9a31683 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ 

[PATCH v3 2/3] OMAPDSS: HDMI: Add quantization range support in IP lib

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

Configure the IP to support the limited range and full range quantization
mode. If the full range is configured HDMI transmitter will expand the range
of pixel data from 16-235 to full 8 bit 0-235.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |2 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   41 +
 include/video/omapdss.h   |5 +++
 3 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 46e776c..ab0f2c2 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -164,6 +164,7 @@ struct hdmi_ip_data {
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
struct hdmi_core_infoframe_avi avi_cfg;
+   enum hdmi_range range;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
@@ -181,4 +182,5 @@ void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, 
struct seq_file *s);
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
 void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable);
 #endif
+int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data);
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index d9ddb6d..58c5782 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -610,6 +610,47 @@ static void hdmi_core_aux_infoframe_avi_config(struct 
hdmi_ip_data *ip_data)
hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_CHSUM, checksum);
 }
 
+int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data)
+{
+   int var;
+
+   switch (ip_data-range) {
+   /*
+* Setting the AVI infroframe to respective limited range
+* 0 if limited range 1 if full range
+*/
+   case HDMI_LIMITED_RANGE:
+   ip_data-avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_LR;
+   hdmi_core_aux_infoframe_avi_config(ip_data);
+   var = hdmi_read_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_ACEN);
+   var = FLD_MOD(var, 1, 1, 1);
+   hdmi_write_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_ACEN, var);
+   break;
+   case HDMI_FULL_RANGE:
+   /* HDMI 1.3 section 6.6 YCBCR components shall
+* always be Limited Range
+*/
+   if (ip_data-avi_cfg.db1_format ==
+   HDMI_INFOFRAME_AVI_DB1Y_YUV422) {
+   pr_err(Only limited range is supported for YUV);
+   return -EINVAL;
+   }
+   ip_data-avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_FR;
+   hdmi_core_aux_infoframe_avi_config(ip_data);
+   var = hdmi_read_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_MODE);
+   var = FLD_MOD(var, 1, 4, 4);
+   hdmi_write_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_MODE, var);
+   break;
+   default:
+   return -EINVAL;
+   }
+   return 0;
+}
+
 static void hdmi_core_av_packet_config(struct hdmi_ip_data *ip_data,
struct hdmi_core_packet_enable_repeat repeat_cfg)
 {
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 062b3b2..29f4e78 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -204,6 +204,11 @@ enum omap_hdmi_flags {
OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1  0,
 };
 
+enum hdmi_range {
+   HDMI_LIMITED_RANGE = 0,
+   HDMI_FULL_RANGE = 1,
+};
+
 /* RFBI */
 
 struct rfbi_timings {
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/3] OMAPDSS: HDMI: Handle HPD event in ip

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

HPD event is notified to ip file and based on the
notification appropriate action is taken. As the PHY
should be in LDO_ON state and not TX_ON (transmission),
this transition is handled in ip file.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |4 +++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   31 
 2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 9a31683..eba2ed4 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -113,6 +113,8 @@ struct ti_hdmi_ip_ops {
 
int (*configure_range)(struct hdmi_ip_data *ip_data);
 
+   int (*notify_hpd)(struct hdmi_ip_data *ip_data, int hpd_state);
+
 };
 
 /*
@@ -167,6 +169,7 @@ struct hdmi_ip_data {
struct hdmi_pll_info pll_data;
struct hdmi_core_infoframe_avi avi_cfg;
enum hdmi_range range;
+   bool hdmi_phy_tx_enabled;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
@@ -185,4 +188,5 @@ void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, 
struct seq_file *s);
 void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable);
 #endif
 int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data);
+int ti_hdmi_4xxx_notify_hpd(struct hdmi_ip_data *ip_data, bool hpd_state);
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 58c5782..10c845d 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -223,15 +223,11 @@ void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data 
*ip_data)
hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_ALLOFF);
 }
 
-int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data)
+int ti_hdmi_4xxx_phy_poweron(struct hdmi_ip_data *ip_data)
 {
u16 r = 0;
void __iomem *phy_base = hdmi_phy_base(ip_data);
 
-   r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_LDOON);
-   if (r)
-   return r;
-
r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON);
if (r)
return r;
@@ -260,11 +256,36 @@ int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data)
return 0;
 }
 
+int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data)
+{
+   int r = 0;
+
+   r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_LDOON);
+
+   return r;
+}
+
 void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data)
 {
hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF);
 }
 
+int ti_hdmi_4xxx_notify_hpd(struct hdmi_ip_data *ip_data, bool hpd_state)
+{
+   int r = 0;
+
+   if (hpd_state != ip_data-hdmi_phy_tx_enabled) {
+   if (hpd_state)
+   r = ti_hdmi_4xxx_phy_poweron(ip_data);
+   else
+   r = ti_hdmi_4xxx_phy_enable(ip_data);
+   if (!r)
+   ip_data-hdmi_phy_tx_enabled = hpd_state;
+   }
+
+   return r;
+}
+
 static int hdmi_core_ddc_init(struct hdmi_ip_data *ip_data)
 {
void __iomem *base = hdmi_core_sys_base(ip_data);
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/3] OMAPDSS: HDMI: HPD support added to HDMI driver

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

GPIO based handling of connect/disconnect of the HDMI cable
(Hot-plug detect)is added to the HDMI driver.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss_features.c |1 +
 drivers/video/omap2/dss/hdmi.c |   49 
 2 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/dss_features.c 
b/drivers/video/omap2/dss/dss_features.c
index 544b172..ef3f666 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -477,6 +477,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
.audio_enable   =   ti_hdmi_4xxx_wp_audio_enable,
 #endif
.configure_range=   ti_hdmi_4xxx_configure_range,
+   .notify_hpd =   ti_hdmi_4xxx_notify_hpd,
 
 };
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 29de79f..4c3110d 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -66,6 +66,9 @@ static struct {
struct omap_display_platform_data *pdata;
struct platform_device *pdev;
struct hdmi_ip_data ip_data;
+   struct omap_dss_device *dssdev;
+
+   bool hpd;
 
struct clk *sys_clk;
 } hdmi;
@@ -461,6 +464,29 @@ void hdmi_dump_regs(struct seq_file *s)
mutex_unlock(hdmi.lock);
 }
 
+static int hdmi_get_current_hpd(void)
+{
+   return gpio_get_value(hdmi.dssdev-hpd_gpio);
+}
+
+static irqreturn_t hpd_enable_handler(int irq, void *ptr)
+{
+   DSSDBG(hpd enable %d\n, hdmi.hpd);
+
+   hdmi.ip_data.ops-notify_hpd(hdmi.ip_data, hdmi.hpd);
+
+   return IRQ_HANDLED;
+}
+
+static irqreturn_t hpd_irq_handler(int irq, void *ptr)
+{
+   if (hdmi.dssdev-state == OMAP_DSS_DISPLAY_ACTIVE) {
+   hdmi.hpd = hdmi_get_current_hpd();
+   return IRQ_WAKE_THREAD;
+   }
+   return IRQ_HANDLED;
+}
+
 int omapdss_hdmi_read_edid(u8 *buf, int len)
 {
int r;
@@ -782,11 +808,22 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
 {
struct resource *hdmi_mem;
int r;
+   struct omap_dss_board_info *board_data;
 
hdmi.pdata = pdev-dev.platform_data;
hdmi.pdev = pdev;
 
mutex_init(hdmi.lock);
+   /* save reference to HDMI device */
+   board_data = hdmi.pdata-board_data;
+   for (r = 0; r  board_data-num_devices; r++) {
+   if (board_data-devices[r]-type == OMAP_DISPLAY_TYPE_HDMI)
+   hdmi.dssdev = board_data-devices[r];
+   }
+   if (!hdmi.dssdev) {
+   DSSERR(can't get HDMI device\n);
+   return -EINVAL;
+   }
 
hdmi_mem = platform_get_resource(hdmi.pdev, IORESOURCE_MEM, 0);
if (!hdmi_mem) {
@@ -810,6 +847,16 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
 
pm_runtime_enable(pdev-dev);
 
+   r = request_threaded_irq(gpio_to_irq(hdmi.dssdev-hpd_gpio),
+   hpd_irq_handler, hpd_enable_handler,
+   IRQF_DISABLED | IRQF_TRIGGER_RISING |
+   IRQF_TRIGGER_FALLING, hpd, NULL);
+   if (r  0) {
+   pr_err(hdmi: request_irq %d failed\n,
+   gpio_to_irq(hdmi.dssdev-hpd_gpio));
+   return -EINVAL;
+   }
+
hdmi.ip_data.core_sys_offset = HDMI_CORE_SYS;
hdmi.ip_data.core_av_offset = HDMI_CORE_AV;
hdmi.ip_data.pll_offset = HDMI_PLLCTRL;
@@ -840,6 +887,8 @@ static int omapdss_hdmihw_remove(struct platform_device 
*pdev)
snd_soc_unregister_codec(pdev-dev);
 #endif
 
+   free_irq(gpio_to_irq(hdmi.dssdev-hpd_gpio), hpd_irq_handler);
+
pm_runtime_disable(pdev-dev);
 
hdmi_put_clocks();
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3] OMAPDSS: HDMI: HDMI Hot-plug detect support.

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

HDMI phy should be in the LDO_ON state when cable is not connected.
Only when cable is connected and transmission is possible HDMI Phy should move
to TX_ON state.
This is supported by the Hot-plug feature.
Now when HDMI is enabled the following steps are followed:
-It registers to the GPIO irq handler
-If an HPD interrupt is received the corresponding IRQ handler is called where
it checks if it is a connect / disconnect based on which PHY is moved to
appropriate state.

Mythri P K (3):
  OMAPDSS: HDMI: HPD support in boardfile
  OMAPDSS: HDMI: Handle HPD event in ip
  OMAPDSS: HDMI: HPD support added to HDMI driver

 arch/arm/mach-omap2/board-4430sdp.c   |   37 +---
 arch/arm/mach-omap2/board-omap4panda.c|   37 +---
 arch/arm/mach-omap2/display.c |   21 --
 drivers/video/omap2/dss/dss_features.c|1 +
 drivers/video/omap2/dss/hdmi.c|   65 ++---
 drivers/video/omap2/dss/ti_hdmi.h |4 ++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   31 +++--
 include/video/omapdss.h   |6 ++-
 8 files changed, 126 insertions(+), 76 deletions(-)

-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/3] OMAPDSS: HDMI: HPD support in boardfile

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

Add support for HPD GPIO configuration in board file.
Also remove the enabling  of GPIO's required for HDMI from
hdmi driver file to display.c based on the GPIO #'s sent from
board file.

Signed-off-by: Mythri P K mythr...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/board-4430sdp.c|   37 ++-
 arch/arm/mach-omap2/board-omap4panda.c |   37 +--
 arch/arm/mach-omap2/display.c  |   21 ++---
 drivers/video/omap2/dss/hdmi.c |   16 +-
 include/video/omapdss.h|6 -
 5 files changed, 46 insertions(+), 71 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 4af874a..d6b647d 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -52,8 +52,9 @@
 #define ETH_KS8851_QUART   138
 #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO   184
 #define OMAP4_SFH7741_ENABLE_GPIO  188
-#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
+#define HDMI_GPIO_CT_CP_HPD 60 /* Hot plug pin for HDMI */
 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
+#define HDMI_GPIO_HPD 63
 #define DISPLAY_SEL_GPIO   59  /* LCD2/PicoDLP switch */
 #define DLP_POWER_ON_GPIO  40
 
@@ -596,27 +597,11 @@ static void __init omap_sfh7741prox_init(void)
 }
 
 static struct gpio sdp4430_hdmi_gpios[] = {
-   { HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH,hdmi_gpio_hpd   },
-   { HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
+   { HDMI_GPIO_CT_CP_HPD,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ct_cp_hpd },
+   { HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
+   { HDMI_GPIO_HPD,  GPIOF_DIR_IN,hdmi_gpio_hpd },
 };
 
-static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
-{
-   int status;
-
-   status = gpio_request_array(sdp4430_hdmi_gpios,
-   ARRAY_SIZE(sdp4430_hdmi_gpios));
-   if (status)
-   pr_err(%s: Cannot request HDMI GPIOs\n, __func__);
-
-   return status;
-}
-
-static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev)
-{
-   gpio_free(HDMI_GPIO_LS_OE);
-   gpio_free(HDMI_GPIO_HPD);
-}
 
 static struct nokia_dsi_panel_data dsi1_panel = {
.name   = taal,
@@ -735,9 +720,8 @@ static struct omap_dss_device sdp4430_hdmi_device = {
.name = hdmi,
.driver_name = hdmi_panel,
.type = OMAP_DISPLAY_TYPE_HDMI,
-   .platform_enable = sdp4430_panel_enable_hdmi,
-   .platform_disable = sdp4430_panel_disable_hdmi,
.channel = OMAP_DSS_CHANNEL_DIGIT,
+   .hpd_gpio = 63,
 };
 
 static struct picodlp_panel_data sdp4430_picodlp_pdata = {
@@ -830,10 +814,13 @@ static void omap_4430sdp_display_init(void)
 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
 * later have external pull up on the HDMI I2C lines
 */
-   if (cpu_is_omap446x() || omap_rev()  OMAP4430_REV_ES2_2)
-   omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
+   if (cpu_is_omap446x() || (omap_rev()  OMAP4430_REV_ES2_2))
+   omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP, HDMI_GPIO_HPD,
+   sdp4430_hdmi_gpios,
+   ARRAY_SIZE(sdp4430_hdmi_gpios));
else
-   omap_hdmi_init(0);
+   omap_hdmi_init(0, HDMI_GPIO_HPD, sdp4430_hdmi_gpios,
+   ARRAY_SIZE(sdp4430_hdmi_gpios));
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index 00103e3..d60c674 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -51,8 +51,9 @@
 #define GPIO_HUB_NRESET62
 #define GPIO_WIFI_PMENA43
 #define GPIO_WIFI_IRQ  53
-#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
+#define HDMI_GPIO_CT_CP_HPD 60 /* Hot plug pin for HDMI */
 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
+#define HDMI_GPIO_HPD 63
 
 /* wl127x BT, FM, GPS connectivity chip */
 static int wl1271_gpios[] = {46, -1, -1};
@@ -479,35 +480,17 @@ int __init omap4_panda_dvi_init(void)
 }
 
 static struct gpio panda_hdmi_gpios[] = {
-   { HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH, hdmi_gpio_hpd   },
-   { HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH, hdmi_gpio_ls_oe },
+   { HDMI_GPIO_CT_CP_HPD,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ct_cp_hpd },
+   { HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
+   { HDMI_GPIO_HPD,  GPIOF_DIR_IN,hdmi_gpio_hpd },
 };
 
-static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev)
-{
-   int status;
-
-   status = gpio_request_array(panda_hdmi_gpios,
-   ARRAY_SIZE(panda_hdmi_gpios));
-  

[PATCH v3 0/4] OMAPDSS: HDMI: Improve the timings logic in HDMI

2012-01-04 Thread mythripk
From: Mythri P K mythr...@ti.com

There are some duplicate timing structure which are not needed thus removing
them to clean the code.
Also the static mapped timing structure is quite complicated to add new
timings, so simplify it by using array indexed method.

changes since v2: Incorporate changes in find_timing function
changes since V1: change of hdmi_find_timing function to return pointer to the
timing struct rather than deep copy to timing structure passed as parameter
variable name change from temp to timing2 in comparator function.

Mythri P K (4):
  OMAPDSS: HDMI: remove duplicate video interface code
  OMAPDSS: HDMI: update static timing table
  OMAPDSS: HDMI: change the timing match logic
  OMAPDSS: HDMI: remove duplicate code and mode parameter

 drivers/video/omap2/dss/hdmi.c|  257 +
 drivers/video/omap2/dss/ti_hdmi.h |   14 +-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   47 ++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |7 -
 4 files changed, 136 insertions(+), 189 deletions(-)

-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/4] OMAPDSS: HDMI: remove duplicate video interface code

2012-01-04 Thread mythripk
From: Mythri P K mythr...@ti.com

video interface structure is a duplicate structure with parameters which are
already present in ip_data config structure, Thus removing the structure and
modifying corresponding code.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   31 +++-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |7 --
 2 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index e1a6ce5..403d6fc 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -629,8 +629,7 @@ static void hdmi_core_av_packet_config(struct hdmi_ip_data 
*ip_data,
 }
 
 static void hdmi_wp_init(struct omap_video_timings *timings,
-   struct hdmi_video_format *video_fmt,
-   struct hdmi_video_interface *video_int)
+   struct hdmi_video_format *video_fmt)
 {
pr_debug(Enter hdmi_wp_init\n);
 
@@ -645,12 +644,6 @@ static void hdmi_wp_init(struct omap_video_timings 
*timings,
video_fmt-y_res = 0;
video_fmt-x_res = 0;
 
-   video_int-vsp = 0;
-   video_int-hsp = 0;
-
-   video_int-interlacing = 0;
-   video_int-tm = 0; /* HDMI_TIMING_SLAVE */
-
 }
 
 void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data, bool start)
@@ -687,17 +680,16 @@ static void hdmi_wp_video_config_format(struct 
hdmi_ip_data *ip_data,
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_SIZE, l);
 }
 
-static void hdmi_wp_video_config_interface(struct hdmi_ip_data *ip_data,
-   struct hdmi_video_interface *video_int)
+static void hdmi_wp_video_config_interface(struct hdmi_ip_data *ip_data)
 {
u32 r;
pr_debug(Enter hdmi_wp_video_config_interface\n);
 
r = hdmi_read_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG);
-   r = FLD_MOD(r, video_int-vsp, 7, 7);
-   r = FLD_MOD(r, video_int-hsp, 6, 6);
-   r = FLD_MOD(r, video_int-interlacing, 3, 3);
-   r = FLD_MOD(r, video_int-tm, 1, 0);
+   r = FLD_MOD(r, ip_data-cfg.timings.vsync_pol, 7, 7);
+   r = FLD_MOD(r, ip_data-cfg.timings.hsync_pol, 6, 6);
+   r = FLD_MOD(r, ip_data-cfg.interlace, 3, 3);
+   r = FLD_MOD(r, 1, 1, 0); /* HDMI_TIMING_MASTER_24BIT */
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG, r);
 }
 
@@ -725,15 +717,13 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
/* HDMI */
struct omap_video_timings video_timing;
struct hdmi_video_format video_format;
-   struct hdmi_video_interface video_interface;
/* HDMI core */
struct hdmi_core_infoframe_avi avi_cfg;
struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg;
struct hdmi_config *cfg = ip_data-cfg;
 
-   hdmi_wp_init(video_timing, video_format,
-   video_interface);
+   hdmi_wp_init(video_timing, video_format);
 
hdmi_core_init(v_core_cfg,
avi_cfg,
@@ -748,12 +738,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
 
hdmi_wp_video_config_format(ip_data, video_format);
 
-   video_interface.vsp = cfg-timings.vsync_pol;
-   video_interface.hsp = cfg-timings.hsync_pol;
-   video_interface.interlacing = cfg-interlace;
-   video_interface.tm = 1 ; /* HDMI_TIMING_MASTER_24BIT */
-
-   hdmi_wp_video_config_interface(ip_data, video_interface);
+   hdmi_wp_video_config_interface(ip_data);
 
/*
 * configure core video part
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 2040956..914bec6 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -517,13 +517,6 @@ struct hdmi_video_format {
u32 x_res;  /* pixel per line */
 };
 
-struct hdmi_video_interface {
-   int vsp;/* Vsync polarity */
-   int hsp;/* Hsync polarity */
-   int interlacing;
-   int tm; /* Timing mode */
-};
-
 struct hdmi_audio_format {
enum hdmi_stereo_channels   stereo_channels;
u8  active_chnnls_msk;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/4] OMAPDSS: HDMI: update static timing table

2012-01-04 Thread mythripk
From: Mythri P K mythr...@ti.com

Add the vsync polarity, hsync polarity, interlace to hdmi_video_timings.
Remove the now duplicate structure hdmi_timings.
update the static table structure in HDMI with CEA/VESA code and mode.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c|   96 ++--
 drivers/video/omap2/dss/ti_hdmi.h |   14 ++---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   20 +++---
 3 files changed, 63 insertions(+), 67 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index c56378c..f76ae47 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -88,42 +88,42 @@ static struct {
  * map it to corresponding CEA or VESA index.
  */
 
-static const struct hdmi_timings cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
-   { {640, 480, 25200, 96, 16, 48, 2, 10, 33} , 0 , 0},
-   { {1280, 720, 74250, 40, 440, 220, 5, 5, 20}, 1, 1},
-   { {1280, 720, 74250, 40, 110, 220, 5, 5, 20}, 1, 1},
-   { {720, 480, 27027, 62, 16, 60, 6, 9, 30}, 0, 0},
-   { {2880, 576, 108000, 256, 48, 272, 5, 5, 39}, 0, 0},
-   { {1440, 240, 27027, 124, 38, 114, 3, 4, 15}, 0, 0},
-   { {1440, 288, 27000, 126, 24, 138, 3, 2, 19}, 0, 0},
-   { {1920, 540, 74250, 44, 528, 148, 5, 2, 15}, 1, 1},
-   { {1920, 540, 74250, 44, 88, 148, 5, 2, 15}, 1, 1},
-   { {1920, 1080, 148500, 44, 88, 148, 5, 4, 36}, 1, 1},
-   { {720, 576, 27000, 64, 12, 68, 5, 5, 39}, 0, 0},
-   { {1440, 576, 54000, 128, 24, 136, 5, 5, 39}, 0, 0},
-   { {1920, 1080, 148500, 44, 528, 148, 5, 4, 36}, 1, 1},
-   { {2880, 480, 108108, 248, 64, 240, 6, 9, 30}, 0, 0},
-   { {1920, 1080, 74250, 44, 638, 148, 5, 4, 36}, 1, 1},
-   /* VESA From Here */
-   { {640, 480, 25175, 96, 16, 48, 2 , 11, 31}, 0, 0},
-   { {800, 600, 4, 128, 40, 88, 4 , 1, 23}, 1, 1},
-   { {848, 480, 33750, 112, 16, 112, 8 , 6, 23}, 1, 1},
-   { {1280, 768, 79500, 128, 64, 192, 7 , 3, 20}, 1, 0},
-   { {1280, 800, 83500, 128, 72, 200, 6 , 3, 22}, 1, 0},
-   { {1360, 768, 85500, 112, 64, 256, 6 , 3, 18}, 1, 1},
-   { {1280, 960, 108000, 112, 96, 312, 3 , 1, 36}, 1, 1},
-   { {1280, 1024, 108000, 112, 48, 248, 3 , 1, 38}, 1, 1},
-   { {1024, 768, 65000, 136, 24, 160, 6, 3, 29}, 0, 0},
-   { {1400, 1050, 121750, 144, 88, 232, 4, 3, 32}, 1, 0},
-   { {1440, 900, 106500, 152, 80, 232, 6, 3, 25}, 1, 0},
-   { {1680, 1050, 146250, 176 , 104, 280, 6, 3, 30}, 1, 0},
-   { {1366, 768, 85500, 143, 70, 213, 3, 3, 24}, 1, 1},
-   { {1920, 1080, 148500, 44, 148, 80, 5, 4, 36}, 1, 1},
-   { {1280, 768, 68250, 32, 48, 80, 7, 3, 12}, 0, 1},
-   { {1400, 1050, 101000, 32, 48, 80, 4, 3, 23}, 0, 1},
-   { {1680, 1050, 119000, 32, 48, 80, 6, 3, 21}, 0, 1},
-   { {1280, 800, 79500, 32, 48, 80, 6, 3, 14}, 0, 1},
-   { {1280, 720, 74250, 40, 110, 220, 5, 5, 20}, 1, 1}
+static const struct hdmi_config cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
+{ {640, 480, 25200, 96, 16, 48, 2, 10, 33, 0, 0, 0}, {1, HDMI_HDMI} },
+{ {720, 480, 27027, 62, 16, 60, 6, 9, 30, 0, 0, 0}, {2, HDMI_HDMI} },
+{ {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {4, HDMI_HDMI} },
+{ {1920, 540, 74250, 44, 88, 148, 5, 2, 15, 1, 1, 1}, {5, HDMI_HDMI} },
+{ {1440, 240, 27027, 124, 38, 114, 3, 4, 15, 0, 0, 1}, {6, HDMI_HDMI} },
+{ {1920, 1080, 148500, 44, 88, 148, 5, 4, 36, 1, 1, 0}, {16, HDMI_HDMI} },
+{ {720, 576, 27000, 64, 12, 68, 5, 5, 39, 0, 0, 0}, {17, HDMI_HDMI} },
+{ {1280, 720, 74250, 40, 440, 220, 5, 5, 20, 1, 1, 0}, {19, HDMI_HDMI} },
+{ {1920, 540, 74250, 44, 528, 148, 5, 2, 15, 1, 1, 1}, {20, HDMI_HDMI} },
+{ {1440, 288, 27000, 126, 24, 138, 3, 2, 19, 0, 0, 1}, {21, HDMI_HDMI} },
+{ {1440, 576, 54000, 128, 24, 136, 5, 5, 39, 0, 0, 0}, {29, HDMI_HDMI} },
+{ {1920, 1080, 148500, 44, 528, 148, 5, 4, 36, 1, 1, 0}, {31, HDMI_HDMI} },
+{ {1920, 1080, 74250, 44, 638, 148, 5, 4, 36, 1, 1, 0}, {32, HDMI_HDMI} },
+{ {2880, 480, 108108, 248, 64, 240, 6, 9, 30, 0, 0, 0}, {35, HDMI_HDMI} },
+{ {2880, 576, 108000, 256, 48, 272, 5, 5, 39, 0, 0, 0}, {37, HDMI_HDMI} },
+/* VESA From Here */
+{ {640, 480, 25175, 96, 16, 48, 2 , 11, 31, 0, 0, 0}, {4, HDMI_DVI} },
+{ {800, 600, 4, 128, 40, 88, 4 , 1, 23, 1, 1, 0}, {9, HDMI_DVI} },
+{ {848, 480, 33750, 112, 16, 112, 8 , 6, 23, 1, 1, 0}, {0xE, HDMI_DVI} },
+{ {1280, 768, 79500, 128, 64, 192, 7 , 3, 20, 1, 0, 0}, {0x17, HDMI_DVI} },
+{ {1280, 800, 83500, 128, 72, 200, 6 , 3, 22, 1, 0, 0}, {0x1C, HDMI_DVI} },
+{ {1360, 768, 85500, 112, 64, 256, 6 , 3, 18, 1, 1, 0}, {0x27, HDMI_DVI} },
+{ {1280, 960, 108000, 112, 96, 312, 3 , 1, 36, 1, 1, 0}, {0x20, HDMI_DVI} },
+{ {1280, 1024, 108000, 112, 48, 248, 3 , 1, 38, 1, 1, 0}, {0x23, HDMI_DVI} },
+{ {1024, 768, 65000, 136, 24, 160, 6, 3, 29, 0, 0, 0}, {0x10, HDMI_DVI} },
+{ {1400, 1050, 121750, 144, 88, 232, 4, 3, 32, 1, 0, 0}, {0x2A, HDMI_DVI} },
+{ {1440, 900, 106500, 152, 80, 232, 6, 3, 

[PATCH v3 3/4] OMAPDSS: HDMI: change the timing match logic

2012-01-04 Thread mythripk
From: Mythri P K mythr...@ti.com

Change the timing match logic, Instead of the statically mapped method
to get the corresponding timings for a given code and mode, move to a
simpler array indexed method. It  will help to scale up to add more
timings when needed.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |  177 +--
 1 files changed, 77 insertions(+), 100 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index f76ae47..78aa904 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -58,8 +58,6 @@
 #define EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR 4
 #define EDID_SIZE_BLOCK1_TIMING_DESCRIPTOR 4
 
-#define OMAP_HDMI_TIMINGS_NB   34
-
 #define HDMI_DEFAULT_REGN 16
 #define HDMI_DEFAULT_REGM2 1
 
@@ -88,7 +86,7 @@ static struct {
  * map it to corresponding CEA or VESA index.
  */
 
-static const struct hdmi_config cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
+static const struct hdmi_config cea_timings[] = {
 { {640, 480, 25200, 96, 16, 48, 2, 10, 33, 0, 0, 0}, {1, HDMI_HDMI} },
 { {720, 480, 27027, 62, 16, 60, 6, 9, 30, 0, 0, 0}, {2, HDMI_HDMI} },
 { {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {4, HDMI_HDMI} },
@@ -104,6 +102,8 @@ static const struct hdmi_config 
cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
 { {1920, 1080, 74250, 44, 638, 148, 5, 4, 36, 1, 1, 0}, {32, HDMI_HDMI} },
 { {2880, 480, 108108, 248, 64, 240, 6, 9, 30, 0, 0, 0}, {35, HDMI_HDMI} },
 { {2880, 576, 108000, 256, 48, 272, 5, 5, 39, 0, 0, 0}, {37, HDMI_HDMI} },
+};
+static const struct hdmi_config vesa_timings[] = {
 /* VESA From Here */
 { {640, 480, 25175, 96, 16, 48, 2 , 11, 31, 0, 0, 0}, {4, HDMI_DVI} },
 { {800, 600, 4, 128, 40, 88, 4 , 1, 23, 1, 1, 0}, {9, HDMI_DVI} },
@@ -126,39 +126,6 @@ static const struct hdmi_config 
cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
 { {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {0x55, HDMI_DVI} }
 };
 
-/*
- * This is a static mapping array which maps the timing values
- * with corresponding CEA / VESA code
- */
-static const int code_index[OMAP_HDMI_TIMINGS_NB] = {
-   1, 19, 4, 2, 37, 6, 21, 20, 5, 16, 17, 29, 31, 35, 32,
-   /* --15 CEA 17-- vesa*/
-   4, 9, 0xE, 0x17, 0x1C, 0x27, 0x20, 0x23, 0x10, 0x2A,
-   0X2F, 0x3A, 0X51, 0X52, 0x16, 0x29, 0x39, 0x1B
-};
-
-/*
- * This is reverse static mapping which maps the CEA / VESA code
- * to the corresponding timing values
- */
-static const int code_cea[39] = {
-   -1,  0,  3,  3,  2,  8,  5,  5, -1, -1,
-   -1, -1, -1, -1, -1, -1,  9, 10, 10,  1,
-   7,   6,  6, -1, -1, -1, -1, -1, -1, 11,
-   11, 12, 14, -1, -1, 13, 13,  4,  4
-};
-
-static const int code_vesa[85] = {
-   -1, -1, -1, -1, 15, -1, -1, -1, -1, 16,
-   -1, -1, -1, -1, 17, -1, 23, -1, -1, -1,
-   -1, -1, 29, 18, -1, -1, -1, 32, 19, -1,
-   -1, -1, 21, -1, -1, 22, -1, -1, -1, 20,
-   -1, 30, 24, -1, -1, -1, -1, 25, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, 31, 26, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-   -1, 27, 28, -1, 33};
-
 static int hdmi_runtime_get(void)
 {
int r;
@@ -188,82 +155,86 @@ int hdmi_init_display(struct omap_dss_device *dssdev)
return 0;
 }
 
-static int get_timings_index(void)
+static const struct hdmi_config *hdmi_find_timing(
+   const struct hdmi_config *timings_arr,
+   int len)
 {
-   int code;
+   int i;
+   const struct hdmi_config *timing = NULL;
 
-   if (hdmi.mode == 0)
-   code = code_vesa[hdmi.code];
-   else
-   code = code_cea[hdmi.code];
+   for (i = 0; i  len; i++) {
+   if (timings_arr[i].cm.code == hdmi.code) {
+   timing = timings_arr[i];
+   return timing;
+   }
+   }
+   return timing;
+}
 
-   if (code == -1) {
-   /* HDMI code 4 corresponds to 640 * 480 VGA */
-   hdmi.code = 4;
-   /* DVI mode 1 corresponds to HDMI 0 to DVI */
-   hdmi.mode = HDMI_DVI;
+static const struct hdmi_config *hdmi_get_timings(void)
+{
+   const struct hdmi_config *arr;
+   int len;
+
+   if (hdmi.mode == HDMI_DVI) {
+   arr = vesa_timings;
+   len = ARRAY_SIZE(vesa_timings);
+   } else {
+   arr = cea_timings;
+   len = ARRAY_SIZE(cea_timings);
+   }
+
+   return hdmi_find_timing(arr, len);
+}
+
+static bool hdmi_timings_compare(struct omap_video_timings *timing1,
+   const struct hdmi_video_timings *timing2)
+{
+   int timing1_vsync, timing1_hsync, timing2_vsync, timing2_hsync;
+
+   if ((timing2-pixel_clock == timing1-pixel_clock) 
+   (timing2-x_res == timing1-x_res) 
+   (timing2-y_res == 

[PATCH v3 4/4] OMAPDSS: HDMI: remove duplicate code and mode parameter

2012-01-04 Thread mythripk
From: Mythri P K mythr...@ti.com

code and mode parameters are already a part of the ip_data structure
so no need to keep the same parameters again in hdmi global structure.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |   18 +++---
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 78aa904..4bb7678 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -66,8 +66,6 @@ static struct {
struct omap_display_platform_data *pdata;
struct platform_device *pdev;
struct hdmi_ip_data ip_data;
-   int code;
-   int mode;
 
struct clk *sys_clk;
 } hdmi;
@@ -163,7 +161,7 @@ static const struct hdmi_config *hdmi_find_timing(
const struct hdmi_config *timing = NULL;
 
for (i = 0; i  len; i++) {
-   if (timings_arr[i].cm.code == hdmi.code) {
+   if (timings_arr[i].cm.code == hdmi.ip_data.cfg.cm.code) {
timing = timings_arr[i];
return timing;
}
@@ -176,7 +174,7 @@ static const struct hdmi_config *hdmi_get_timings(void)
const struct hdmi_config *arr;
int len;
 
-   if (hdmi.mode == HDMI_DVI) {
+   if (hdmi.ip_data.cfg.cm.mode == HDMI_DVI) {
arr = vesa_timings;
len = ARRAY_SIZE(vesa_timings);
} else {
@@ -314,9 +312,9 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
 
if (hdmi_get_timings() == NULL) {
/* HDMI code 4 corresponds to 640 * 480 VGA */
-   hdmi.code = 4;
+   hdmi.ip_data.cfg.cm.code = 4;
/* DVI mode 1 corresponds to HDMI 0 to DVI */
-   hdmi.mode = HDMI_DVI;
+   hdmi.ip_data.cfg.cm.mode = HDMI_DVI;
hdmi.ip_data.cfg = vesa_timings[0];
} else {
hdmi.ip_data.cfg = *(hdmi_get_timings());
@@ -340,8 +338,6 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
goto err;
}
 
-   hdmi.ip_data.cfg.cm.mode = hdmi.mode;
-   hdmi.ip_data.cfg.cm.code = hdmi.code;
hdmi.ip_data.ops-video_configure(hdmi.ip_data);
 
/* Make selection of HDMI in DSS */
@@ -401,8 +397,8 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device 
*dssdev)
struct hdmi_cm cm;
 
cm = hdmi_get_code(dssdev-panel.timings);
-   hdmi.code = cm.code;
-   hdmi.mode = cm.mode;
+   hdmi.ip_data.cfg.cm.code = cm.code;
+   hdmi.ip_data.cfg.cm.mode = cm.mode;
 
if (dssdev-state == OMAP_DSS_DISPLAY_ACTIVE) {
int r;
@@ -668,7 +664,7 @@ static int hdmi_audio_hw_params(struct hdmi_ip_data 
*ip_data,
 static int hdmi_audio_startup(struct snd_pcm_substream *substream,
  struct snd_soc_dai *dai)
 {
-   if (!hdmi.mode) {
+   if (!hdmi.ip_data.cfg.cm.mode) {
pr_err(Current video settings do not support audio.\n);
return -EIO;
}
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/3] OMAPDSS: HDMI: Add quantization range support in IP lib

2012-01-04 Thread mythripk
From: Mythri P K mythr...@ti.com

Configure the IP to support the limited range and full range quantization
mode. If the full range is configured HDMI transmitter will expand the range
of pixel data from 16-235 to full 8 bit 0-235.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |7 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   40 +
 2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 835cfb1..1b485ee 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -42,6 +42,11 @@ enum hdmi_clk_refsel {
HDMI_REFSEL_SYSCLK = 3
 };
 
+enum hdmi_range {
+   HDMI_LIMITED_RANGE = 0,
+   HDMI_FULL_RANGE = 1,
+};
+
 /* HDMI timing structure */
 struct hdmi_video_timings {
u16 x_res;
@@ -159,6 +164,7 @@ struct hdmi_ip_data {
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
struct hdmi_core_infoframe_avi avi_cfg;
+   enum hdmi_range range;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
@@ -172,5 +178,6 @@ void ti_hdmi_4xxx_wp_dump(struct hdmi_ip_data *ip_data, 
struct seq_file *s);
 void ti_hdmi_4xxx_pll_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
 void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
 void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data);
 
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index b66d82e..a98ce8a 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -610,6 +610,46 @@ static void hdmi_core_aux_infoframe_avi_config(struct 
hdmi_ip_data *ip_data)
hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_CHSUM, checksum);
 }
 
+int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data)
+{
+   int var;
+
+   switch (ip_data-range) {
+   /*
+* Setting the AVI infroframe to respective limited range
+* 0 if limited range 1 if full range
+*/
+   case HDMI_LIMITED_RANGE:
+   ip_data-avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_LR;
+   hdmi_core_aux_infoframe_avi_config(ip_data);
+   var = hdmi_read_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_ACEN);
+   var = FLD_MOD(var, 1, 1, 1);
+   hdmi_write_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_ACEN, var);
+   break;
+   case HDMI_FULL_RANGE:
+   default:
+   /* HDMI 1.3 section 6.6 YCBCR components shall
+* always be Limited Range
+*/
+   if (ip_data-avi_cfg.db1_format ==
+   HDMI_INFOFRAME_AVI_DB1Y_YUV422) {
+   pr_err(Only limited range is supported for YUV);
+   return -EINVAL;
+   }
+   ip_data-avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_FR;
+   hdmi_core_aux_infoframe_avi_config(ip_data);
+   var = hdmi_read_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_MODE);
+   var = FLD_MOD(var, 1, 4, 4);
+   hdmi_write_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_MODE, var);
+   break;
+   }
+   return 0;
+}
+
 static void hdmi_core_av_packet_config(struct hdmi_ip_data *ip_data,
struct hdmi_core_packet_enable_repeat repeat_cfg)
 {
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/3] OMAPDSS: HDMI: Sysfs support to configure quantization

2012-01-04 Thread mythripk
From: Mythri P K mythr...@ti.com

Add sysfs support for the uset space to configure limited range or full range
quantization for HDMI.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss.h  |2 +
 drivers/video/omap2/dss/dss_features.c |1 +
 drivers/video/omap2/dss/hdmi.c |   28 +
 drivers/video/omap2/dss/hdmi_panel.c   |   35 +++-
 drivers/video/omap2/dss/ti_hdmi.h  |2 +
 5 files changed, 67 insertions(+), 1 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 6308fc5..cf1f0f9 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -498,6 +498,8 @@ int omapdss_hdmi_display_check_timing(struct 
omap_dss_device *dssdev,
struct omap_video_timings *timings);
 int omapdss_hdmi_read_edid(u8 *buf, int len);
 bool omapdss_hdmi_detect(void);
+int omapdss_hdmi_get_range(void);
+int omapdss_hdmi_set_range(int range);
 int hdmi_panel_init(void);
 void hdmi_panel_exit(void);
 
diff --git a/drivers/video/omap2/dss/dss_features.c 
b/drivers/video/omap2/dss/dss_features.c
index b402699..c7e71b9 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -465,6 +465,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
.dump_core  =   ti_hdmi_4xxx_core_dump,
.dump_pll   =   ti_hdmi_4xxx_pll_dump,
.dump_phy   =   ti_hdmi_4xxx_phy_dump,
+   .configure_range=   ti_hdmi_4xxx_configure_range,
 
 };
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 4bb7678..ae7918e 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -378,6 +378,34 @@ static void hdmi_power_off(struct omap_dss_device *dssdev)
hdmi_runtime_put();
 }
 
+int omapdss_hdmi_set_range(int range)
+{
+   int r = 0;
+   enum hdmi_range old_range;
+
+   old_range = hdmi.ip_data.range;
+   hdmi.ip_data.range = range;
+
+   /* HDMI 1.3 section 6.6 VGA (640x480) format requires Full Range */
+   if ((range == 0) 
+   ((hdmi.ip_data.cfg.cm.code == 4 
+   hdmi.ip_data.cfg.cm.mode == HDMI_DVI) ||
+   (hdmi.ip_data.cfg.cm.code == 1 
+   hdmi.ip_data.cfg.cm.mode == HDMI_HDMI)))
+   return -EINVAL;
+
+   r = hdmi.ip_data.ops-configure_range(hdmi.ip_data);
+   if (r)
+   hdmi.ip_data.range = old_range;
+
+   return r;
+}
+
+int omapdss_hdmi_get_range(void)
+{
+   return hdmi.ip_data.range;
+}
+
 int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
struct omap_video_timings *timings)
 {
diff --git a/drivers/video/omap2/dss/hdmi_panel.c 
b/drivers/video/omap2/dss/hdmi_panel.c
index 533d5dc..c0aa922 100644
--- a/drivers/video/omap2/dss/hdmi_panel.c
+++ b/drivers/video/omap2/dss/hdmi_panel.c
@@ -33,6 +33,33 @@ static struct {
struct mutex hdmi_lock;
 } hdmi;
 
+static ssize_t hdmi_range_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   int r;
+
+   r = omapdss_hdmi_get_range();
+   return snprintf(buf, PAGE_SIZE, %d\n, r);
+}
+
+static ssize_t hdmi_range_store(struct device *dev,
+   struct device_attribute *attr,
+   const char *buf, size_t size)
+{
+   unsigned long range;
+   int r = kstrtoul(buf, 0, range);
+
+   if (r || range  1)
+   return -EINVAL;
+
+   r = omapdss_hdmi_set_range(range);
+   if (r)
+   return r;
+
+   return size;
+}
+
+static DEVICE_ATTR(range, S_IRUGO | S_IWUSR, hdmi_range_show, 
hdmi_range_store);
 
 static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 {
@@ -41,6 +68,12 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
dssdev-panel.config = OMAP_DSS_LCD_TFT |
OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS;
 
+   /* sysfs entry to provide user space control to set
+* quantization range
+*/
+   if (device_create_file(dssdev-dev, dev_attr_range))
+   DSSERR(failed to create sysfs file\n);
+
dssdev-panel.timings = (struct omap_video_timings){640, 480, 25175, 
96, 16, 48, 2 , 11, 31};
 
DSSDBG(hdmi_panel_probe x_res= %d y_res = %d\n,
@@ -51,7 +84,7 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 
 static void hdmi_panel_remove(struct omap_dss_device *dssdev)
 {
-
+   device_remove_file(dssdev-dev, dev_attr_range);
 }
 
 static int hdmi_panel_enable(struct omap_dss_device *dssdev)
diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 1b485ee..1f15d74 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -111,6 +111,8 @@ struct ti_hdmi_ip_ops {
 
void (*dump_phy)(struct 

[PATCH v2 1/3] OMAPDSS: HDMI: Move Avi-infoframe struct to hdmi_ip_data

2012-01-04 Thread mythripk
From: Mythri P K mythr...@ti.com

With AVI infoframe various parameters of video stream such as
aspect ratio, quantization range, videocode etc will be indicated
from source to sink.Thus AVI information needs to be set/accessed
by the middle ware based on the video content.
Thus this parameter is now moved to the ip_data structure.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |   42 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |8 +++---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |   40 ---
 3 files changed, 46 insertions(+), 44 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 3cf5198..835cfb1 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -108,6 +108,47 @@ struct ti_hdmi_ip_ops {
 
 };
 
+/*
+ * Refer to section 8.2 in HDMI 1.3 specification for
+ * details about infoframe databytes
+ */
+struct hdmi_core_infoframe_avi {
+   /* Y0, Y1 rgb,yCbCr */
+   u8  db1_format;
+   /* A0  Active information Present */
+   u8  db1_active_info;
+   /* B0, B1 Bar info data valid */
+   u8  db1_bar_info_dv;
+   /* S0, S1 scan information */
+   u8  db1_scan_info;
+   /* C0, C1 colorimetry */
+   u8  db2_colorimetry;
+   /* M0, M1 Aspect ratio (4:3, 16:9) */
+   u8  db2_aspect_ratio;
+   /* R0...R3 Active format aspect ratio */
+   u8  db2_active_fmt_ar;
+   /* ITC IT content. */
+   u8  db3_itc;
+   /* EC0, EC1, EC2 Extended colorimetry */
+   u8  db3_ec;
+   /* Q1, Q0 Quantization range */
+   u8  db3_q_range;
+   /* SC1, SC0 Non-uniform picture scaling */
+   u8  db3_nup_scaling;
+   /* VIC0..6 Video format identification */
+   u8  db4_videocode;
+   /* PR0..PR3 Pixel repetition factor */
+   u8  db5_pixel_repeat;
+   /* Line number end of top bar */
+   u16 db6_7_line_eoftop;
+   /* Line number start of bottom bar */
+   u16 db8_9_line_sofbottom;
+   /* Pixel number end of left bar */
+   u16 db10_11_pixel_eofleft;
+   /* Pixel number start of right bar */
+   u16 db12_13_pixel_sofright;
+};
+
 struct hdmi_ip_data {
void __iomem*base_wp;   /* HDMI wrapper */
unsigned long   core_sys_offset;
@@ -117,6 +158,7 @@ struct hdmi_ip_data {
const struct ti_hdmi_ip_ops *ops;
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
+   struct hdmi_core_infoframe_avi avi_cfg;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void 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 ccc6254..b66d82e 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -534,12 +534,12 @@ static void hdmi_core_video_config(struct hdmi_ip_data 
*ip_data,
HDMI_CORE_SYS_TMDS_CTRL, cfg-tclk_sel_clkmult, 6, 5);
 }
 
-static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data,
-   struct hdmi_core_infoframe_avi info_avi)
+static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data)
 {
u32 val;
char sum = 0, checksum = 0;
void __iomem *av_base = hdmi_av_base(ip_data);
+   struct hdmi_core_infoframe_avi info_avi = ip_data-avi_cfg;
 
sum += 0x82 + 0x002 + 0x00D;
hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082);
@@ -718,7 +718,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
struct omap_video_timings video_timing;
struct hdmi_video_format video_format;
/* HDMI core */
-   struct hdmi_core_infoframe_avi avi_cfg;
+   struct hdmi_core_infoframe_avi avi_cfg = ip_data-avi_cfg;
struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg;
struct hdmi_config *cfg = ip_data-cfg;
@@ -780,7 +780,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
avi_cfg.db10_11_pixel_eofleft = 0;
avi_cfg.db12_13_pixel_sofright = 0;
 
-   hdmi_core_aux_infoframe_avi_config(ip_data, avi_cfg);
+   hdmi_core_aux_infoframe_avi_config(ip_data);
 
/* enable/repeat the infoframe */
repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 914bec6..21f1d82 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -450,46 +450,6 @@ struct hdmi_core_video_config {
  * Refer to section 8.2 in HDMI 1.3 specification for
  * details about infoframe databytes
  */
-struct hdmi_core_infoframe_avi {
-   /* Y0, Y1 rgb,yCbCr */
-   u8  db1_format;
-   

[PATCH v4 0/2] OMAPDSS: HDMI: Boardfile cleanup

2012-01-02 Thread mythripk
From: Mythri P K mythr...@ti.com

Clean up of boardfiles to have the functions common to differnt boards in a
common display file, Also in some OMAP4 boards external pull-up's are enabled
thus enabling internal pull up should be a parameter from the boardfile.

changes since v3 : Comment improvement to move some portion from boardfile to
display.
changes since v2 : Make the flag as enum.
changes since v1 : Make omap hdmi_init generic to handle different parameters
and pass the pull up as a flag instead of int. 

Mythri P K (2):
  OMAPDSS: HDMI: Move duplicate code from boardfile
  OMAPDSS: HDMI: Disable DDC internal pull up

 arch/arm/mach-omap2/board-4430sdp.c|   23 ++
 arch/arm/mach-omap2/board-omap4panda.c |   25 +++-
 arch/arm/mach-omap2/display.c  |   39 
 include/video/omapdss.h|6 +
 4 files changed, 62 insertions(+), 31 deletions(-)

-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 1/2] OMAPDSS: HDMI: Move duplicate code from boardfile

2012-01-02 Thread mythripk
From: Mythri P K mythr...@ti.com

Move duplicate HDMI mux_init code from omap4 and panda board file
to display file.

Signed-off-by: Mythri P K mythr...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c|   16 +---
 arch/arm/mach-omap2/board-omap4panda.c |   17 +
 arch/arm/mach-omap2/display.c  |   23 +++
 include/video/omapdss.h|2 ++
 4 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 73b1e99..c3bd640 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -595,20 +595,6 @@ static void __init omap_sfh7741prox_init(void)
__func__, OMAP4_SFH7741_ENABLE_GPIO, error);
 }
 
-static void sdp4430_hdmi_mux_init(void)
-{
-   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
-   omap_mux_init_signal(hdmi_hpd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_cec,
-   OMAP_PIN_INPUT_PULLUP);
-   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
-   omap_mux_init_signal(hdmi_ddc_scl,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_ddc_sda,
-   OMAP_PIN_INPUT_PULLUP);
-}
-
 static struct gpio sdp4430_hdmi_gpios[] = {
{ HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH,hdmi_gpio_hpd   },
{ HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
@@ -838,9 +824,9 @@ static void omap_4430sdp_display_init(void)
pr_err(%s: Could not get display_sel GPIO\n, __func__);
 
sdp4430_lcd_init();
-   sdp4430_hdmi_mux_init();
sdp4430_picodlp_init();
omap_display_init(sdp4430_dss_data);
+   omap_hdmi_init();
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index a5b576b..d95df2e 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -478,21 +478,6 @@ int __init omap4_panda_dvi_init(void)
return r;
 }
 
-
-static void omap4_panda_hdmi_mux_init(void)
-{
-   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
-   omap_mux_init_signal(hdmi_hpd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_cec,
-   OMAP_PIN_INPUT_PULLUP);
-   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
-   omap_mux_init_signal(hdmi_ddc_scl,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_ddc_sda,
-   OMAP_PIN_INPUT_PULLUP);
-}
-
 static struct gpio panda_hdmi_gpios[] = {
{ HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH, hdmi_gpio_hpd   },
{ HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH, hdmi_gpio_ls_oe },
@@ -555,8 +540,8 @@ void omap4_panda_display_init(void)
if (r)
pr_err(error initializing panda DVI\n);
 
-   omap4_panda_hdmi_mux_init();
omap_display_init(omap4_panda_dss_data);
+   omap_hdmi_init();
 }
 
 static void __init omap4_panda_init(void)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index dce9905..8436088 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -29,6 +29,7 @@
 #include plat/omap-pm.h
 #include plat/common.h
 
+#include mux.h
 #include control.h
 #include display.h
 
@@ -96,6 +97,20 @@ static const struct omap_dss_hwmod_data 
omap4_dss_hwmod_data[] __initdata = {
{ dss_hdmi, omapdss_hdmi, -1 },
 };
 
+static void omap4_hdmi_mux_pads()
+{
+   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
+   omap_mux_init_signal(hdmi_hpd,
+   OMAP_PIN_INPUT_PULLUP);
+   omap_mux_init_signal(hdmi_cec,
+   OMAP_PIN_INPUT_PULLUP);
+   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
+   omap_mux_init_signal(hdmi_ddc_scl,
+   OMAP_PIN_INPUT_PULLUP);
+   omap_mux_init_signal(hdmi_ddc_sda,
+   OMAP_PIN_INPUT_PULLUP);
+}
+
 static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
 {
u32 enable_mask, enable_shift;
@@ -129,6 +144,14 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
return 0;
 }
 
+int omap_hdmi_init(void)
+{
+   if (cpu_is_omap44xx())
+   omap4_hdmi_mux_pads();
+
+   return 0;
+}
+
 static int omap_dsi_enable_pads(int dsi_id, unsigned lane_mask)
 {
if (cpu_is_omap44xx())
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 378c7ed..1e11683 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -309,6 +309,8 @@ struct omap_dss_board_info {
 
 /* Init with the board info */
 extern int omap_display_init(struct omap_dss_board_info *board_data);
+/* HDMI mux init*/
+extern int omap_hdmi_init(void);
 
 struct omap_display_platform_data {
struct omap_dss_board_info *board_data;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe 

[PATCH v4 2/2] OMAPDSS: HDMI: Disable DDC internal pull up

2012-01-02 Thread mythripk
From: Mythri P K mythr...@ti.com

Disables the internal pull resistor for SDA and SCL which are enabled by
default, as there are external pull up's in 4460 and 4430 ES2.3
SDP, Blaze and Panda Boards, It is done to avoid the EDID read failure.

Signed-off-by: Ricardo Salveti de Araujo ricardo.salv...@linaro.org
Signed-off-by: Mythri P K mythr...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c|9 -
 arch/arm/mach-omap2/board-omap4panda.c |   10 +-
 arch/arm/mach-omap2/display.c  |   22 +++---
 include/video/omapdss.h|6 +-
 4 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index c3bd640..4af874a 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -826,7 +826,14 @@ static void omap_4430sdp_display_init(void)
sdp4430_lcd_init();
sdp4430_picodlp_init();
omap_display_init(sdp4430_dss_data);
-   omap_hdmi_init();
+   /*
+* OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
+* later have external pull up on the HDMI I2C lines
+*/
+   if (cpu_is_omap446x() || omap_rev()  OMAP4430_REV_ES2_2)
+   omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
+   else
+   omap_hdmi_init(0);
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index d95df2e..00103e3 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -541,7 +541,15 @@ void omap4_panda_display_init(void)
pr_err(error initializing panda DVI\n);
 
omap_display_init(omap4_panda_dss_data);
-   omap_hdmi_init();
+
+   /*
+* OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
+* later have external pull up on the HDMI I2C lines
+*/
+   if (cpu_is_omap446x() || omap_rev()  OMAP4430_REV_ES2_2)
+   omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
+   else
+   omap_hdmi_init(0);
 }
 
 static void __init omap4_panda_init(void)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 8436088..ffd9bd9 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -97,8 +97,11 @@ static const struct omap_dss_hwmod_data 
omap4_dss_hwmod_data[] __initdata = {
{ dss_hdmi, omapdss_hdmi, -1 },
 };
 
-static void omap4_hdmi_mux_pads()
+static void omap4_hdmi_mux_pads(enum omap_hdmi_flags flags)
 {
+   u32 reg;
+   u16 control_i2c_1;
+
/* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
omap_mux_init_signal(hdmi_hpd,
OMAP_PIN_INPUT_PULLUP);
@@ -109,6 +112,19 @@ static void omap4_hdmi_mux_pads()
OMAP_PIN_INPUT_PULLUP);
omap_mux_init_signal(hdmi_ddc_sda,
OMAP_PIN_INPUT_PULLUP);
+
+   /*
+* CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and
+* HDMI_DDC_SCL_PULLUPRESX (bit 24) are set to disable
+* internal pull up resistor.
+*/
+   if (flags  OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP) {
+   control_i2c_1 = OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1;
+   reg = omap4_ctrl_pad_readl(control_i2c_1);
+   reg |= (OMAP4_HDMI_DDC_SDA_PULLUPRESX_MASK |
+   OMAP4_HDMI_DDC_SCL_PULLUPRESX_MASK);
+   omap4_ctrl_pad_writel(reg, control_i2c_1);
+   }
 }
 
 static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
@@ -144,10 +160,10 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
return 0;
 }
 
-int omap_hdmi_init(void)
+int omap_hdmi_init(enum omap_hdmi_flags flags)
 {
if (cpu_is_omap44xx())
-   omap4_hdmi_mux_pads();
+   omap4_hdmi_mux_pads(flags);
 
return 0;
 }
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 1e11683..05da097 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -200,6 +200,10 @@ enum omap_dss_clk_source {
OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI,/* OMAP4: PLL2_CLK2 */
 };
 
+enum omap_hdmi_flags {
+   OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1  0,
+};
+
 /* RFBI */
 
 struct rfbi_timings {
@@ -310,7 +314,7 @@ struct omap_dss_board_info {
 /* Init with the board info */
 extern int omap_display_init(struct omap_dss_board_info *board_data);
 /* HDMI mux init*/
-extern int omap_hdmi_init(void);
+extern int omap_hdmi_init(enum omap_hdmi_flags flags);
 
 struct omap_display_platform_data {
struct omap_dss_board_info *board_data;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/4] OMAPDSS: HDMI: Improve the timings logic in HDMI

2012-01-02 Thread mythripk
From: Mythri P K mythr...@ti.com

There are some duplicate timing structure which are not needed thus removing
them to clean the code.
Also the static mapped timing structure is quite complicated to add new
timings, so simplify it by using array indexed method.

changes since V1: change of hdmi_find_timing function to return pointer to the
timing struct rather than deep copy to timing structure passed as parameter
variable name change from temp to timing2 in comparator function.

Mythri P K (4):
  OMAPDSS: HDMI: remove duplicate video interface code
  OMAPDSS: HDMI: update static timing table
  OMAPDSS: HDMI: change the timing match logic
  OMAPDSS: HDMI: remove duplicate code and mode parameter

 drivers/video/omap2/dss/hdmi.c|  254 +
 drivers/video/omap2/dss/ti_hdmi.h |   14 +-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   47 ++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |7 -
 4 files changed, 134 insertions(+), 188 deletions(-)

-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/4] OMAPDSS: HDMI: remove duplicate video interface code

2012-01-02 Thread mythripk
From: Mythri P K mythr...@ti.com

video interface structure is a duplicate structure with parameters which are
already present in ip_data config structure, Thus removing the structure and
modifying corresponding code.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   31 +++-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |7 --
 2 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index e1a6ce5..403d6fc 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -629,8 +629,7 @@ static void hdmi_core_av_packet_config(struct hdmi_ip_data 
*ip_data,
 }
 
 static void hdmi_wp_init(struct omap_video_timings *timings,
-   struct hdmi_video_format *video_fmt,
-   struct hdmi_video_interface *video_int)
+   struct hdmi_video_format *video_fmt)
 {
pr_debug(Enter hdmi_wp_init\n);
 
@@ -645,12 +644,6 @@ static void hdmi_wp_init(struct omap_video_timings 
*timings,
video_fmt-y_res = 0;
video_fmt-x_res = 0;
 
-   video_int-vsp = 0;
-   video_int-hsp = 0;
-
-   video_int-interlacing = 0;
-   video_int-tm = 0; /* HDMI_TIMING_SLAVE */
-
 }
 
 void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data, bool start)
@@ -687,17 +680,16 @@ static void hdmi_wp_video_config_format(struct 
hdmi_ip_data *ip_data,
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_SIZE, l);
 }
 
-static void hdmi_wp_video_config_interface(struct hdmi_ip_data *ip_data,
-   struct hdmi_video_interface *video_int)
+static void hdmi_wp_video_config_interface(struct hdmi_ip_data *ip_data)
 {
u32 r;
pr_debug(Enter hdmi_wp_video_config_interface\n);
 
r = hdmi_read_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG);
-   r = FLD_MOD(r, video_int-vsp, 7, 7);
-   r = FLD_MOD(r, video_int-hsp, 6, 6);
-   r = FLD_MOD(r, video_int-interlacing, 3, 3);
-   r = FLD_MOD(r, video_int-tm, 1, 0);
+   r = FLD_MOD(r, ip_data-cfg.timings.vsync_pol, 7, 7);
+   r = FLD_MOD(r, ip_data-cfg.timings.hsync_pol, 6, 6);
+   r = FLD_MOD(r, ip_data-cfg.interlace, 3, 3);
+   r = FLD_MOD(r, 1, 1, 0); /* HDMI_TIMING_MASTER_24BIT */
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG, r);
 }
 
@@ -725,15 +717,13 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
/* HDMI */
struct omap_video_timings video_timing;
struct hdmi_video_format video_format;
-   struct hdmi_video_interface video_interface;
/* HDMI core */
struct hdmi_core_infoframe_avi avi_cfg;
struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg;
struct hdmi_config *cfg = ip_data-cfg;
 
-   hdmi_wp_init(video_timing, video_format,
-   video_interface);
+   hdmi_wp_init(video_timing, video_format);
 
hdmi_core_init(v_core_cfg,
avi_cfg,
@@ -748,12 +738,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
 
hdmi_wp_video_config_format(ip_data, video_format);
 
-   video_interface.vsp = cfg-timings.vsync_pol;
-   video_interface.hsp = cfg-timings.hsync_pol;
-   video_interface.interlacing = cfg-interlace;
-   video_interface.tm = 1 ; /* HDMI_TIMING_MASTER_24BIT */
-
-   hdmi_wp_video_config_interface(ip_data, video_interface);
+   hdmi_wp_video_config_interface(ip_data);
 
/*
 * configure core video part
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 2040956..914bec6 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -517,13 +517,6 @@ struct hdmi_video_format {
u32 x_res;  /* pixel per line */
 };
 
-struct hdmi_video_interface {
-   int vsp;/* Vsync polarity */
-   int hsp;/* Hsync polarity */
-   int interlacing;
-   int tm; /* Timing mode */
-};
-
 struct hdmi_audio_format {
enum hdmi_stereo_channels   stereo_channels;
u8  active_chnnls_msk;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 4/4] OMAPDSS: HDMI: remove duplicate code and mode parameter

2012-01-02 Thread mythripk
From: Mythri P K mythr...@ti.com

code and mode parameters are already a part of the ip_data structure
so no need to keep the same parameters again in hdmi global structure.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |   18 +++---
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 6892faa..34f3dae 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -66,8 +66,6 @@ static struct {
struct omap_display_platform_data *pdata;
struct platform_device *pdev;
struct hdmi_ip_data ip_data;
-   int code;
-   int mode;
 
struct clk *sys_clk;
 } hdmi;
@@ -163,7 +161,7 @@ static const struct hdmi_config *hdmi_find_timing(
const struct hdmi_config *timing, timing1 = { {0}, {0} };
 
for (i = 0; i  len; i++) {
-   if (timings_arr[i].cm.code == hdmi.code) {
+   if (timings_arr[i].cm.code == hdmi.ip_data.cfg.cm.code) {
timing = timings_arr[i];
return timing;
}
@@ -176,7 +174,7 @@ static const struct hdmi_config *hdmi_get_timings(void)
 {
const struct hdmi_config *timing;
 
-   if (hdmi.mode == 0) {
+   if (hdmi.ip_data.cfg.cm.mode == 0) {
timing = hdmi_find_timing(vesa_timings,
ARRAY_SIZE(vesa_timings));
} else {
@@ -314,9 +312,9 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
hdmi.ip_data.cfg = *(hdmi_get_timings());
if (hdmi.ip_data.cfg.timings.x_res == 0) {
/* HDMI code 4 corresponds to 640 * 480 VGA */
-   hdmi.code = 4;
+   hdmi.ip_data.cfg.cm.code = 4;
/* DVI mode 1 corresponds to HDMI 0 to DVI */
-   hdmi.mode = HDMI_DVI;
+   hdmi.ip_data.cfg.cm.mode = HDMI_DVI;
hdmi.ip_data.cfg = vesa_timings[0];
}
 
@@ -339,8 +337,6 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
goto err;
}
 
-   hdmi.ip_data.cfg.cm.mode = hdmi.mode;
-   hdmi.ip_data.cfg.cm.code = hdmi.code;
hdmi.ip_data.ops-video_configure(hdmi.ip_data);
 
/* Make selection of HDMI in DSS */
@@ -400,8 +396,8 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device 
*dssdev)
struct hdmi_cm cm;
 
cm = hdmi_get_code(dssdev-panel.timings);
-   hdmi.code = cm.code;
-   hdmi.mode = cm.mode;
+   hdmi.ip_data.cfg.cm.code = cm.code;
+   hdmi.ip_data.cfg.cm.mode = cm.mode;
 
if (dssdev-state == OMAP_DSS_DISPLAY_ACTIVE) {
int r;
@@ -667,7 +663,7 @@ static int hdmi_audio_hw_params(struct hdmi_ip_data 
*ip_data,
 static int hdmi_audio_startup(struct snd_pcm_substream *substream,
  struct snd_soc_dai *dai)
 {
-   if (!hdmi.mode) {
+   if (!hdmi.ip_data.cfg.cm.mode) {
pr_err(Current video settings do not support audio.\n);
return -EIO;
}
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/4] OMAPDSS: HDMI: change the timing match logic

2012-01-02 Thread mythripk
From: Mythri P K mythr...@ti.com

Change the timing match logic, Instead of the statically mapped method
to get the corresponding timings for a given code and mode, move to a
simpler array indexed method. It  will help to scale up to add more
timings when needed.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |  174 +---
 1 files changed, 75 insertions(+), 99 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index f76ae47..6892faa 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -58,8 +58,6 @@
 #define EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR 4
 #define EDID_SIZE_BLOCK1_TIMING_DESCRIPTOR 4
 
-#define OMAP_HDMI_TIMINGS_NB   34
-
 #define HDMI_DEFAULT_REGN 16
 #define HDMI_DEFAULT_REGM2 1
 
@@ -88,7 +86,7 @@ static struct {
  * map it to corresponding CEA or VESA index.
  */
 
-static const struct hdmi_config cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
+static const struct hdmi_config cea_timings[] = {
 { {640, 480, 25200, 96, 16, 48, 2, 10, 33, 0, 0, 0}, {1, HDMI_HDMI} },
 { {720, 480, 27027, 62, 16, 60, 6, 9, 30, 0, 0, 0}, {2, HDMI_HDMI} },
 { {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {4, HDMI_HDMI} },
@@ -104,6 +102,8 @@ static const struct hdmi_config 
cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
 { {1920, 1080, 74250, 44, 638, 148, 5, 4, 36, 1, 1, 0}, {32, HDMI_HDMI} },
 { {2880, 480, 108108, 248, 64, 240, 6, 9, 30, 0, 0, 0}, {35, HDMI_HDMI} },
 { {2880, 576, 108000, 256, 48, 272, 5, 5, 39, 0, 0, 0}, {37, HDMI_HDMI} },
+};
+static const struct hdmi_config vesa_timings[] = {
 /* VESA From Here */
 { {640, 480, 25175, 96, 16, 48, 2 , 11, 31, 0, 0, 0}, {4, HDMI_DVI} },
 { {800, 600, 4, 128, 40, 88, 4 , 1, 23, 1, 1, 0}, {9, HDMI_DVI} },
@@ -126,39 +126,6 @@ static const struct hdmi_config 
cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
 { {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {0x55, HDMI_DVI} }
 };
 
-/*
- * This is a static mapping array which maps the timing values
- * with corresponding CEA / VESA code
- */
-static const int code_index[OMAP_HDMI_TIMINGS_NB] = {
-   1, 19, 4, 2, 37, 6, 21, 20, 5, 16, 17, 29, 31, 35, 32,
-   /* --15 CEA 17-- vesa*/
-   4, 9, 0xE, 0x17, 0x1C, 0x27, 0x20, 0x23, 0x10, 0x2A,
-   0X2F, 0x3A, 0X51, 0X52, 0x16, 0x29, 0x39, 0x1B
-};
-
-/*
- * This is reverse static mapping which maps the CEA / VESA code
- * to the corresponding timing values
- */
-static const int code_cea[39] = {
-   -1,  0,  3,  3,  2,  8,  5,  5, -1, -1,
-   -1, -1, -1, -1, -1, -1,  9, 10, 10,  1,
-   7,   6,  6, -1, -1, -1, -1, -1, -1, 11,
-   11, 12, 14, -1, -1, 13, 13,  4,  4
-};
-
-static const int code_vesa[85] = {
-   -1, -1, -1, -1, 15, -1, -1, -1, -1, 16,
-   -1, -1, -1, -1, 17, -1, 23, -1, -1, -1,
-   -1, -1, 29, 18, -1, -1, -1, 32, 19, -1,
-   -1, -1, 21, -1, -1, 22, -1, -1, -1, 20,
-   -1, 30, 24, -1, -1, -1, -1, 25, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, 31, 26, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-   -1, 27, 28, -1, 33};
-
 static int hdmi_runtime_get(void)
 {
int r;
@@ -188,82 +155,85 @@ int hdmi_init_display(struct omap_dss_device *dssdev)
return 0;
 }
 
-static int get_timings_index(void)
+static const struct hdmi_config *hdmi_find_timing(
+   const struct hdmi_config *timings_arr,
+   int len)
 {
-   int code;
+   int i;
+   const struct hdmi_config *timing, timing1 = { {0}, {0} };
 
-   if (hdmi.mode == 0)
-   code = code_vesa[hdmi.code];
-   else
-   code = code_cea[hdmi.code];
+   for (i = 0; i  len; i++) {
+   if (timings_arr[i].cm.code == hdmi.code) {
+   timing = timings_arr[i];
+   return timing;
+   }
+   }
+   timing = timing1;
+   return timing;
+}
 
-   if (code == -1) {
-   /* HDMI code 4 corresponds to 640 * 480 VGA */
-   hdmi.code = 4;
-   /* DVI mode 1 corresponds to HDMI 0 to DVI */
-   hdmi.mode = HDMI_DVI;
+static const struct hdmi_config *hdmi_get_timings(void)
+{
+   const struct hdmi_config *timing;
 
-   code = code_vesa[hdmi.code];
+   if (hdmi.mode == 0) {
+   timing = hdmi_find_timing(vesa_timings,
+   ARRAY_SIZE(vesa_timings));
+   } else {
+   timing = hdmi_find_timing(cea_timings,
+   ARRAY_SIZE(cea_timings));
+   }
+   return timing;
+}
+
+static bool hdmi_timings_compare(struct omap_video_timings *timing1,
+   const struct hdmi_video_timings *timing2)
+{
+   int timing1_vsync, timing1_hsync, timing2_vsync, timing2_hsync;
+
+   if 

[PATCH v2 2/4] OMAPDSS: HDMI: update static timing table

2012-01-02 Thread mythripk
From: Mythri P K mythr...@ti.com

Add the vsync polarity, hsync polarity, interlace to hdmi_video_timings.
Remove the now duplicate structure hdmi_timings.
update the static table structure in HDMI with CEA/VESA code and mode.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c|   96 ++--
 drivers/video/omap2/dss/ti_hdmi.h |   14 ++---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   20 +++---
 3 files changed, 63 insertions(+), 67 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index c56378c..f76ae47 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -88,42 +88,42 @@ static struct {
  * map it to corresponding CEA or VESA index.
  */
 
-static const struct hdmi_timings cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
-   { {640, 480, 25200, 96, 16, 48, 2, 10, 33} , 0 , 0},
-   { {1280, 720, 74250, 40, 440, 220, 5, 5, 20}, 1, 1},
-   { {1280, 720, 74250, 40, 110, 220, 5, 5, 20}, 1, 1},
-   { {720, 480, 27027, 62, 16, 60, 6, 9, 30}, 0, 0},
-   { {2880, 576, 108000, 256, 48, 272, 5, 5, 39}, 0, 0},
-   { {1440, 240, 27027, 124, 38, 114, 3, 4, 15}, 0, 0},
-   { {1440, 288, 27000, 126, 24, 138, 3, 2, 19}, 0, 0},
-   { {1920, 540, 74250, 44, 528, 148, 5, 2, 15}, 1, 1},
-   { {1920, 540, 74250, 44, 88, 148, 5, 2, 15}, 1, 1},
-   { {1920, 1080, 148500, 44, 88, 148, 5, 4, 36}, 1, 1},
-   { {720, 576, 27000, 64, 12, 68, 5, 5, 39}, 0, 0},
-   { {1440, 576, 54000, 128, 24, 136, 5, 5, 39}, 0, 0},
-   { {1920, 1080, 148500, 44, 528, 148, 5, 4, 36}, 1, 1},
-   { {2880, 480, 108108, 248, 64, 240, 6, 9, 30}, 0, 0},
-   { {1920, 1080, 74250, 44, 638, 148, 5, 4, 36}, 1, 1},
-   /* VESA From Here */
-   { {640, 480, 25175, 96, 16, 48, 2 , 11, 31}, 0, 0},
-   { {800, 600, 4, 128, 40, 88, 4 , 1, 23}, 1, 1},
-   { {848, 480, 33750, 112, 16, 112, 8 , 6, 23}, 1, 1},
-   { {1280, 768, 79500, 128, 64, 192, 7 , 3, 20}, 1, 0},
-   { {1280, 800, 83500, 128, 72, 200, 6 , 3, 22}, 1, 0},
-   { {1360, 768, 85500, 112, 64, 256, 6 , 3, 18}, 1, 1},
-   { {1280, 960, 108000, 112, 96, 312, 3 , 1, 36}, 1, 1},
-   { {1280, 1024, 108000, 112, 48, 248, 3 , 1, 38}, 1, 1},
-   { {1024, 768, 65000, 136, 24, 160, 6, 3, 29}, 0, 0},
-   { {1400, 1050, 121750, 144, 88, 232, 4, 3, 32}, 1, 0},
-   { {1440, 900, 106500, 152, 80, 232, 6, 3, 25}, 1, 0},
-   { {1680, 1050, 146250, 176 , 104, 280, 6, 3, 30}, 1, 0},
-   { {1366, 768, 85500, 143, 70, 213, 3, 3, 24}, 1, 1},
-   { {1920, 1080, 148500, 44, 148, 80, 5, 4, 36}, 1, 1},
-   { {1280, 768, 68250, 32, 48, 80, 7, 3, 12}, 0, 1},
-   { {1400, 1050, 101000, 32, 48, 80, 4, 3, 23}, 0, 1},
-   { {1680, 1050, 119000, 32, 48, 80, 6, 3, 21}, 0, 1},
-   { {1280, 800, 79500, 32, 48, 80, 6, 3, 14}, 0, 1},
-   { {1280, 720, 74250, 40, 110, 220, 5, 5, 20}, 1, 1}
+static const struct hdmi_config cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
+{ {640, 480, 25200, 96, 16, 48, 2, 10, 33, 0, 0, 0}, {1, HDMI_HDMI} },
+{ {720, 480, 27027, 62, 16, 60, 6, 9, 30, 0, 0, 0}, {2, HDMI_HDMI} },
+{ {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {4, HDMI_HDMI} },
+{ {1920, 540, 74250, 44, 88, 148, 5, 2, 15, 1, 1, 1}, {5, HDMI_HDMI} },
+{ {1440, 240, 27027, 124, 38, 114, 3, 4, 15, 0, 0, 1}, {6, HDMI_HDMI} },
+{ {1920, 1080, 148500, 44, 88, 148, 5, 4, 36, 1, 1, 0}, {16, HDMI_HDMI} },
+{ {720, 576, 27000, 64, 12, 68, 5, 5, 39, 0, 0, 0}, {17, HDMI_HDMI} },
+{ {1280, 720, 74250, 40, 440, 220, 5, 5, 20, 1, 1, 0}, {19, HDMI_HDMI} },
+{ {1920, 540, 74250, 44, 528, 148, 5, 2, 15, 1, 1, 1}, {20, HDMI_HDMI} },
+{ {1440, 288, 27000, 126, 24, 138, 3, 2, 19, 0, 0, 1}, {21, HDMI_HDMI} },
+{ {1440, 576, 54000, 128, 24, 136, 5, 5, 39, 0, 0, 0}, {29, HDMI_HDMI} },
+{ {1920, 1080, 148500, 44, 528, 148, 5, 4, 36, 1, 1, 0}, {31, HDMI_HDMI} },
+{ {1920, 1080, 74250, 44, 638, 148, 5, 4, 36, 1, 1, 0}, {32, HDMI_HDMI} },
+{ {2880, 480, 108108, 248, 64, 240, 6, 9, 30, 0, 0, 0}, {35, HDMI_HDMI} },
+{ {2880, 576, 108000, 256, 48, 272, 5, 5, 39, 0, 0, 0}, {37, HDMI_HDMI} },
+/* VESA From Here */
+{ {640, 480, 25175, 96, 16, 48, 2 , 11, 31, 0, 0, 0}, {4, HDMI_DVI} },
+{ {800, 600, 4, 128, 40, 88, 4 , 1, 23, 1, 1, 0}, {9, HDMI_DVI} },
+{ {848, 480, 33750, 112, 16, 112, 8 , 6, 23, 1, 1, 0}, {0xE, HDMI_DVI} },
+{ {1280, 768, 79500, 128, 64, 192, 7 , 3, 20, 1, 0, 0}, {0x17, HDMI_DVI} },
+{ {1280, 800, 83500, 128, 72, 200, 6 , 3, 22, 1, 0, 0}, {0x1C, HDMI_DVI} },
+{ {1360, 768, 85500, 112, 64, 256, 6 , 3, 18, 1, 1, 0}, {0x27, HDMI_DVI} },
+{ {1280, 960, 108000, 112, 96, 312, 3 , 1, 36, 1, 1, 0}, {0x20, HDMI_DVI} },
+{ {1280, 1024, 108000, 112, 48, 248, 3 , 1, 38, 1, 1, 0}, {0x23, HDMI_DVI} },
+{ {1024, 768, 65000, 136, 24, 160, 6, 3, 29, 0, 0, 0}, {0x10, HDMI_DVI} },
+{ {1400, 1050, 121750, 144, 88, 232, 4, 3, 32, 1, 0, 0}, {0x2A, HDMI_DVI} },
+{ {1440, 900, 106500, 152, 80, 232, 6, 3, 

[PATCH 1/3 REPOST] OMAPDSS: HDMI: Move Avi infoframe structure to

2012-01-02 Thread mythripk
From: Mythri P K mythr...@ti.com

With AVI infoframe various parameters of video stream such as
aspect ratio, quantization range, videocode etc will be indicated
from source to sink.Thus AVI information needs to be set/accessed
by the middle ware based on the video content.
Thus this parameter is now moved to the ip_data structure.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |   42 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |8 +++---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |   40 ---
 3 files changed, 46 insertions(+), 44 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 3cf5198..835cfb1 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -108,6 +108,47 @@ struct ti_hdmi_ip_ops {
 
 };
 
+/*
+ * Refer to section 8.2 in HDMI 1.3 specification for
+ * details about infoframe databytes
+ */
+struct hdmi_core_infoframe_avi {
+   /* Y0, Y1 rgb,yCbCr */
+   u8  db1_format;
+   /* A0  Active information Present */
+   u8  db1_active_info;
+   /* B0, B1 Bar info data valid */
+   u8  db1_bar_info_dv;
+   /* S0, S1 scan information */
+   u8  db1_scan_info;
+   /* C0, C1 colorimetry */
+   u8  db2_colorimetry;
+   /* M0, M1 Aspect ratio (4:3, 16:9) */
+   u8  db2_aspect_ratio;
+   /* R0...R3 Active format aspect ratio */
+   u8  db2_active_fmt_ar;
+   /* ITC IT content. */
+   u8  db3_itc;
+   /* EC0, EC1, EC2 Extended colorimetry */
+   u8  db3_ec;
+   /* Q1, Q0 Quantization range */
+   u8  db3_q_range;
+   /* SC1, SC0 Non-uniform picture scaling */
+   u8  db3_nup_scaling;
+   /* VIC0..6 Video format identification */
+   u8  db4_videocode;
+   /* PR0..PR3 Pixel repetition factor */
+   u8  db5_pixel_repeat;
+   /* Line number end of top bar */
+   u16 db6_7_line_eoftop;
+   /* Line number start of bottom bar */
+   u16 db8_9_line_sofbottom;
+   /* Pixel number end of left bar */
+   u16 db10_11_pixel_eofleft;
+   /* Pixel number start of right bar */
+   u16 db12_13_pixel_sofright;
+};
+
 struct hdmi_ip_data {
void __iomem*base_wp;   /* HDMI wrapper */
unsigned long   core_sys_offset;
@@ -117,6 +158,7 @@ struct hdmi_ip_data {
const struct ti_hdmi_ip_ops *ops;
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
+   struct hdmi_core_infoframe_avi avi_cfg;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void 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 ccc6254..b66d82e 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -534,12 +534,12 @@ static void hdmi_core_video_config(struct hdmi_ip_data 
*ip_data,
HDMI_CORE_SYS_TMDS_CTRL, cfg-tclk_sel_clkmult, 6, 5);
 }
 
-static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data,
-   struct hdmi_core_infoframe_avi info_avi)
+static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data)
 {
u32 val;
char sum = 0, checksum = 0;
void __iomem *av_base = hdmi_av_base(ip_data);
+   struct hdmi_core_infoframe_avi info_avi = ip_data-avi_cfg;
 
sum += 0x82 + 0x002 + 0x00D;
hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082);
@@ -718,7 +718,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
struct omap_video_timings video_timing;
struct hdmi_video_format video_format;
/* HDMI core */
-   struct hdmi_core_infoframe_avi avi_cfg;
+   struct hdmi_core_infoframe_avi avi_cfg = ip_data-avi_cfg;
struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg;
struct hdmi_config *cfg = ip_data-cfg;
@@ -780,7 +780,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
avi_cfg.db10_11_pixel_eofleft = 0;
avi_cfg.db12_13_pixel_sofright = 0;
 
-   hdmi_core_aux_infoframe_avi_config(ip_data, avi_cfg);
+   hdmi_core_aux_infoframe_avi_config(ip_data);
 
/* enable/repeat the infoframe */
repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 914bec6..21f1d82 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -450,46 +450,6 @@ struct hdmi_core_video_config {
  * Refer to section 8.2 in HDMI 1.3 specification for
  * details about infoframe databytes
  */
-struct hdmi_core_infoframe_avi {
-   /* Y0, Y1 rgb,yCbCr */
-   u8  db1_format;
-   

[PATCH 3/3 REPOST] OMAPDSS: HDMI: Add sysfs support to configure

2012-01-02 Thread mythripk
From: Mythri P K mythr...@ti.com

Add sysfs support for the uset space to configure limited range or full range
quantization for HDMI.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss.h  |2 +
 drivers/video/omap2/dss/dss_features.c |1 +
 drivers/video/omap2/dss/hdmi.c |   28 +
 drivers/video/omap2/dss/hdmi_panel.c   |   35 +++-
 drivers/video/omap2/dss/ti_hdmi.h  |2 +
 5 files changed, 67 insertions(+), 1 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 6308fc5..cf1f0f9 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -498,6 +498,8 @@ int omapdss_hdmi_display_check_timing(struct 
omap_dss_device *dssdev,
struct omap_video_timings *timings);
 int omapdss_hdmi_read_edid(u8 *buf, int len);
 bool omapdss_hdmi_detect(void);
+int omapdss_hdmi_get_range(void);
+int omapdss_hdmi_set_range(int range);
 int hdmi_panel_init(void);
 void hdmi_panel_exit(void);
 
diff --git a/drivers/video/omap2/dss/dss_features.c 
b/drivers/video/omap2/dss/dss_features.c
index b402699..c7e71b9 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -465,6 +465,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
.dump_core  =   ti_hdmi_4xxx_core_dump,
.dump_pll   =   ti_hdmi_4xxx_pll_dump,
.dump_phy   =   ti_hdmi_4xxx_phy_dump,
+   .configure_range=   ti_hdmi_4xxx_configure_range,
 
 };
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 34f3dae..3a9a1a2 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -377,6 +377,34 @@ static void hdmi_power_off(struct omap_dss_device *dssdev)
hdmi_runtime_put();
 }
 
+int omapdss_hdmi_set_range(int range)
+{
+   int r = 0;
+   enum hdmi_range old_range;
+
+   old_range = hdmi.ip_data.range;
+   hdmi.ip_data.range = range;
+
+   /* HDMI 1.3 section 6.6 VGA (640x480) format requires Full Range */
+   if ((range == 0) 
+   ((hdmi.ip_data.cfg.cm.code == 4 
+   hdmi.ip_data.cfg.cm.mode == HDMI_DVI) ||
+   (hdmi.ip_data.cfg.cm.code == 1 
+   hdmi.ip_data.cfg.cm.mode == HDMI_HDMI)))
+   return -EINVAL;
+
+   r = hdmi.ip_data.ops-configure_range(hdmi.ip_data);
+   if (r)
+   hdmi.ip_data.range = old_range;
+
+   return r;
+}
+
+int omapdss_hdmi_get_range(void)
+{
+   return hdmi.ip_data.range;
+}
+
 int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
struct omap_video_timings *timings)
 {
diff --git a/drivers/video/omap2/dss/hdmi_panel.c 
b/drivers/video/omap2/dss/hdmi_panel.c
index 533d5dc..c0aa922 100644
--- a/drivers/video/omap2/dss/hdmi_panel.c
+++ b/drivers/video/omap2/dss/hdmi_panel.c
@@ -33,6 +33,33 @@ static struct {
struct mutex hdmi_lock;
 } hdmi;
 
+static ssize_t hdmi_range_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   int r;
+
+   r = omapdss_hdmi_get_range();
+   return snprintf(buf, PAGE_SIZE, %d\n, r);
+}
+
+static ssize_t hdmi_range_store(struct device *dev,
+   struct device_attribute *attr,
+   const char *buf, size_t size)
+{
+   unsigned long range;
+   int r = kstrtoul(buf, 0, range);
+
+   if (r || range  1)
+   return -EINVAL;
+
+   r = omapdss_hdmi_set_range(range);
+   if (r)
+   return r;
+
+   return size;
+}
+
+static DEVICE_ATTR(range, S_IRUGO | S_IWUSR, hdmi_range_show, 
hdmi_range_store);
 
 static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 {
@@ -41,6 +68,12 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
dssdev-panel.config = OMAP_DSS_LCD_TFT |
OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS;
 
+   /* sysfs entry to provide user space control to set
+* quantization range
+*/
+   if (device_create_file(dssdev-dev, dev_attr_range))
+   DSSERR(failed to create sysfs file\n);
+
dssdev-panel.timings = (struct omap_video_timings){640, 480, 25175, 
96, 16, 48, 2 , 11, 31};
 
DSSDBG(hdmi_panel_probe x_res= %d y_res = %d\n,
@@ -51,7 +84,7 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 
 static void hdmi_panel_remove(struct omap_dss_device *dssdev)
 {
-
+   device_remove_file(dssdev-dev, dev_attr_range);
 }
 
 static int hdmi_panel_enable(struct omap_dss_device *dssdev)
diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 1b485ee..1f15d74 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -111,6 +111,8 @@ struct ti_hdmi_ip_ops {
 
void (*dump_phy)(struct 

[PATCH 2/3 REPOST] OMAPDSS: HDMI: Add support to configure quantization

2012-01-02 Thread mythripk
From: Mythri P K mythr...@ti.com

Configure the IP to support the limited range and full range quantization
mode. If the full range is configured HDMI transmitter will expand the range
of pixel data from 16-235 to full 8 bit 0-235.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |7 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   40 +
 2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 835cfb1..1b485ee 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -42,6 +42,11 @@ enum hdmi_clk_refsel {
HDMI_REFSEL_SYSCLK = 3
 };
 
+enum hdmi_range {
+   HDMI_LIMITED_RANGE = 0,
+   HDMI_FULL_RANGE = 1,
+};
+
 /* HDMI timing structure */
 struct hdmi_video_timings {
u16 x_res;
@@ -159,6 +164,7 @@ struct hdmi_ip_data {
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
struct hdmi_core_infoframe_avi avi_cfg;
+   enum hdmi_range range;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
@@ -172,5 +178,6 @@ void ti_hdmi_4xxx_wp_dump(struct hdmi_ip_data *ip_data, 
struct seq_file *s);
 void ti_hdmi_4xxx_pll_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
 void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
 void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data);
 
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index b66d82e..a98ce8a 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -610,6 +610,46 @@ static void hdmi_core_aux_infoframe_avi_config(struct 
hdmi_ip_data *ip_data)
hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_CHSUM, checksum);
 }
 
+int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data)
+{
+   int var;
+
+   switch (ip_data-range) {
+   /*
+* Setting the AVI infroframe to respective limited range
+* 0 if limited range 1 if full range
+*/
+   case HDMI_LIMITED_RANGE:
+   ip_data-avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_LR;
+   hdmi_core_aux_infoframe_avi_config(ip_data);
+   var = hdmi_read_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_ACEN);
+   var = FLD_MOD(var, 1, 1, 1);
+   hdmi_write_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_ACEN, var);
+   break;
+   case HDMI_FULL_RANGE:
+   default:
+   /* HDMI 1.3 section 6.6 YCBCR components shall
+* always be Limited Range
+*/
+   if (ip_data-avi_cfg.db1_format ==
+   HDMI_INFOFRAME_AVI_DB1Y_YUV422) {
+   pr_err(Only limited range is supported for YUV);
+   return -EINVAL;
+   }
+   ip_data-avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_FR;
+   hdmi_core_aux_infoframe_avi_config(ip_data);
+   var = hdmi_read_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_MODE);
+   var = FLD_MOD(var, 1, 4, 4);
+   hdmi_write_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_MODE, var);
+   break;
+   }
+   return 0;
+}
+
 static void hdmi_core_av_packet_config(struct hdmi_ip_data *ip_data,
struct hdmi_core_packet_enable_repeat repeat_cfg)
 {
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3 REPOST] OMAPDSS: HDMI: Move Avi infoframe structure to

2012-01-02 Thread mythripk
From: Mythri P K mythr...@ti.com

With AVI infoframe various parameters of video stream such as
aspect ratio, quantization range, videocode etc will be indicated
from source to sink.Thus AVI information needs to be set/accessed
by the middle ware based on the video content.
Thus this parameter is now moved to the ip_data structure.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |   42 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |8 +++---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |   40 ---
 3 files changed, 46 insertions(+), 44 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 3cf5198..835cfb1 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -108,6 +108,47 @@ struct ti_hdmi_ip_ops {
 
 };
 
+/*
+ * Refer to section 8.2 in HDMI 1.3 specification for
+ * details about infoframe databytes
+ */
+struct hdmi_core_infoframe_avi {
+   /* Y0, Y1 rgb,yCbCr */
+   u8  db1_format;
+   /* A0  Active information Present */
+   u8  db1_active_info;
+   /* B0, B1 Bar info data valid */
+   u8  db1_bar_info_dv;
+   /* S0, S1 scan information */
+   u8  db1_scan_info;
+   /* C0, C1 colorimetry */
+   u8  db2_colorimetry;
+   /* M0, M1 Aspect ratio (4:3, 16:9) */
+   u8  db2_aspect_ratio;
+   /* R0...R3 Active format aspect ratio */
+   u8  db2_active_fmt_ar;
+   /* ITC IT content. */
+   u8  db3_itc;
+   /* EC0, EC1, EC2 Extended colorimetry */
+   u8  db3_ec;
+   /* Q1, Q0 Quantization range */
+   u8  db3_q_range;
+   /* SC1, SC0 Non-uniform picture scaling */
+   u8  db3_nup_scaling;
+   /* VIC0..6 Video format identification */
+   u8  db4_videocode;
+   /* PR0..PR3 Pixel repetition factor */
+   u8  db5_pixel_repeat;
+   /* Line number end of top bar */
+   u16 db6_7_line_eoftop;
+   /* Line number start of bottom bar */
+   u16 db8_9_line_sofbottom;
+   /* Pixel number end of left bar */
+   u16 db10_11_pixel_eofleft;
+   /* Pixel number start of right bar */
+   u16 db12_13_pixel_sofright;
+};
+
 struct hdmi_ip_data {
void __iomem*base_wp;   /* HDMI wrapper */
unsigned long   core_sys_offset;
@@ -117,6 +158,7 @@ struct hdmi_ip_data {
const struct ti_hdmi_ip_ops *ops;
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
+   struct hdmi_core_infoframe_avi avi_cfg;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void 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 ccc6254..b66d82e 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -534,12 +534,12 @@ static void hdmi_core_video_config(struct hdmi_ip_data 
*ip_data,
HDMI_CORE_SYS_TMDS_CTRL, cfg-tclk_sel_clkmult, 6, 5);
 }
 
-static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data,
-   struct hdmi_core_infoframe_avi info_avi)
+static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data)
 {
u32 val;
char sum = 0, checksum = 0;
void __iomem *av_base = hdmi_av_base(ip_data);
+   struct hdmi_core_infoframe_avi info_avi = ip_data-avi_cfg;
 
sum += 0x82 + 0x002 + 0x00D;
hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082);
@@ -718,7 +718,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
struct omap_video_timings video_timing;
struct hdmi_video_format video_format;
/* HDMI core */
-   struct hdmi_core_infoframe_avi avi_cfg;
+   struct hdmi_core_infoframe_avi avi_cfg = ip_data-avi_cfg;
struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg;
struct hdmi_config *cfg = ip_data-cfg;
@@ -780,7 +780,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
avi_cfg.db10_11_pixel_eofleft = 0;
avi_cfg.db12_13_pixel_sofright = 0;
 
-   hdmi_core_aux_infoframe_avi_config(ip_data, avi_cfg);
+   hdmi_core_aux_infoframe_avi_config(ip_data);
 
/* enable/repeat the infoframe */
repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 914bec6..21f1d82 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -450,46 +450,6 @@ struct hdmi_core_video_config {
  * Refer to section 8.2 in HDMI 1.3 specification for
  * details about infoframe databytes
  */
-struct hdmi_core_infoframe_avi {
-   /* Y0, Y1 rgb,yCbCr */
-   u8  db1_format;
-   

[PATCH v2 1/2] OMAPDSS: HDMI: Move duplicate code from boardfile

2011-12-20 Thread mythripk
From: Mythri P K mythr...@ti.com

Move duplicate HDMI mux_init code from omap4 and panda board file
to display file.

Signed-off-by: Mythri P K mythr...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c|   16 +---
 arch/arm/mach-omap2/board-omap4panda.c |   17 +
 arch/arm/mach-omap2/display.c  |   23 +++
 include/video/omapdss.h|2 ++
 4 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 73b1e99..c3bd640 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -595,20 +595,6 @@ static void __init omap_sfh7741prox_init(void)
__func__, OMAP4_SFH7741_ENABLE_GPIO, error);
 }
 
-static void sdp4430_hdmi_mux_init(void)
-{
-   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
-   omap_mux_init_signal(hdmi_hpd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_cec,
-   OMAP_PIN_INPUT_PULLUP);
-   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
-   omap_mux_init_signal(hdmi_ddc_scl,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_ddc_sda,
-   OMAP_PIN_INPUT_PULLUP);
-}
-
 static struct gpio sdp4430_hdmi_gpios[] = {
{ HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH,hdmi_gpio_hpd   },
{ HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
@@ -838,9 +824,9 @@ static void omap_4430sdp_display_init(void)
pr_err(%s: Could not get display_sel GPIO\n, __func__);
 
sdp4430_lcd_init();
-   sdp4430_hdmi_mux_init();
sdp4430_picodlp_init();
omap_display_init(sdp4430_dss_data);
+   omap_hdmi_init();
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index a5b576b..d95df2e 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -478,21 +478,6 @@ int __init omap4_panda_dvi_init(void)
return r;
 }
 
-
-static void omap4_panda_hdmi_mux_init(void)
-{
-   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
-   omap_mux_init_signal(hdmi_hpd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_cec,
-   OMAP_PIN_INPUT_PULLUP);
-   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
-   omap_mux_init_signal(hdmi_ddc_scl,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_ddc_sda,
-   OMAP_PIN_INPUT_PULLUP);
-}
-
 static struct gpio panda_hdmi_gpios[] = {
{ HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH, hdmi_gpio_hpd   },
{ HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH, hdmi_gpio_ls_oe },
@@ -555,8 +540,8 @@ void omap4_panda_display_init(void)
if (r)
pr_err(error initializing panda DVI\n);
 
-   omap4_panda_hdmi_mux_init();
omap_display_init(omap4_panda_dss_data);
+   omap_hdmi_init();
 }
 
 static void __init omap4_panda_init(void)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index dce9905..8436088 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -29,6 +29,7 @@
 #include plat/omap-pm.h
 #include plat/common.h
 
+#include mux.h
 #include control.h
 #include display.h
 
@@ -96,6 +97,20 @@ static const struct omap_dss_hwmod_data 
omap4_dss_hwmod_data[] __initdata = {
{ dss_hdmi, omapdss_hdmi, -1 },
 };
 
+static void omap4_hdmi_mux_pads()
+{
+   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
+   omap_mux_init_signal(hdmi_hpd,
+   OMAP_PIN_INPUT_PULLUP);
+   omap_mux_init_signal(hdmi_cec,
+   OMAP_PIN_INPUT_PULLUP);
+   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
+   omap_mux_init_signal(hdmi_ddc_scl,
+   OMAP_PIN_INPUT_PULLUP);
+   omap_mux_init_signal(hdmi_ddc_sda,
+   OMAP_PIN_INPUT_PULLUP);
+}
+
 static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
 {
u32 enable_mask, enable_shift;
@@ -129,6 +144,14 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
return 0;
 }
 
+int omap_hdmi_init(void)
+{
+   if (cpu_is_omap44xx())
+   omap4_hdmi_mux_pads();
+
+   return 0;
+}
+
 static int omap_dsi_enable_pads(int dsi_id, unsigned lane_mask)
 {
if (cpu_is_omap44xx())
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 378c7ed..0cb0469 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -309,6 +309,8 @@ struct omap_dss_board_info {
 
 /* Init with the board info */
 extern int omap_display_init(struct omap_dss_board_info *board_data);
+/* HDMI mux init*/
+extern int omap_hdmi_init(void);
 
 struct omap_display_platform_data {
struct omap_dss_board_info *board_data;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe 

[PATCH v3 2/2] OMAPDSS: HDMI: Disable DDC internal pull up

2011-12-20 Thread mythripk
From: Mythri P K mythr...@ti.com

Disables the internal pull resistor for SDA and SCL which are enabled by
default, as there are external pull up's in 4460 and 4430 ES2.3
SDP, Blaze and Panda Boards, It is done to avoid the EDID read failure.

Signed-off-by: Ricardo Salveti de Araujo ricardo.salv...@linaro.org
Signed-off-by: Mythri P K mythr...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c|9 -
 arch/arm/mach-omap2/board-omap4panda.c |   10 +-
 arch/arm/mach-omap2/display.c  |   22 +++---
 include/video/omapdss.h|6 +-
 4 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index c3bd640..4af874a 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -826,7 +826,14 @@ static void omap_4430sdp_display_init(void)
sdp4430_lcd_init();
sdp4430_picodlp_init();
omap_display_init(sdp4430_dss_data);
-   omap_hdmi_init();
+   /*
+* OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
+* later have external pull up on the HDMI I2C lines
+*/
+   if (cpu_is_omap446x() || omap_rev()  OMAP4430_REV_ES2_2)
+   omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
+   else
+   omap_hdmi_init(0);
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index d95df2e..00103e3 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -541,7 +541,15 @@ void omap4_panda_display_init(void)
pr_err(error initializing panda DVI\n);
 
omap_display_init(omap4_panda_dss_data);
-   omap_hdmi_init();
+
+   /*
+* OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
+* later have external pull up on the HDMI I2C lines
+*/
+   if (cpu_is_omap446x() || omap_rev()  OMAP4430_REV_ES2_2)
+   omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
+   else
+   omap_hdmi_init(0);
 }
 
 static void __init omap4_panda_init(void)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 8436088..ffd9bd9 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -97,8 +97,11 @@ static const struct omap_dss_hwmod_data 
omap4_dss_hwmod_data[] __initdata = {
{ dss_hdmi, omapdss_hdmi, -1 },
 };
 
-static void omap4_hdmi_mux_pads()
+static void omap4_hdmi_mux_pads(enum omap_hdmi_flags flags)
 {
+   u32 reg;
+   u16 control_i2c_1;
+
/* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
omap_mux_init_signal(hdmi_hpd,
OMAP_PIN_INPUT_PULLUP);
@@ -109,6 +112,19 @@ static void omap4_hdmi_mux_pads()
OMAP_PIN_INPUT_PULLUP);
omap_mux_init_signal(hdmi_ddc_sda,
OMAP_PIN_INPUT_PULLUP);
+
+   /*
+* CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and
+* HDMI_DDC_SCL_PULLUPRESX (bit 24) are set to disable
+* internal pull up resistor.
+*/
+   if (flags  OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP) {
+   control_i2c_1 = OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1;
+   reg = omap4_ctrl_pad_readl(control_i2c_1);
+   reg |= (OMAP4_HDMI_DDC_SDA_PULLUPRESX_MASK |
+   OMAP4_HDMI_DDC_SCL_PULLUPRESX_MASK);
+   omap4_ctrl_pad_writel(reg, control_i2c_1);
+   }
 }
 
 static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
@@ -144,10 +160,10 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
return 0;
 }
 
-int omap_hdmi_init(void)
+int omap_hdmi_init(enum omap_hdmi_flags flags)
 {
if (cpu_is_omap44xx())
-   omap4_hdmi_mux_pads();
+   omap4_hdmi_mux_pads(flags);
 
return 0;
 }
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 0cb0469..05da097 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -200,6 +200,10 @@ enum omap_dss_clk_source {
OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI,/* OMAP4: PLL2_CLK2 */
 };
 
+enum omap_hdmi_flags {
+   OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1  0,
+};
+
 /* RFBI */
 
 struct rfbi_timings {
@@ -310,7 +314,7 @@ struct omap_dss_board_info {
 /* Init with the board info */
 extern int omap_display_init(struct omap_dss_board_info *board_data);
 /* HDMI mux init*/
-extern int  omap_hdmi_init(void);
+extern int omap_hdmi_init(enum omap_hdmi_flags flags);
 
 struct omap_display_platform_data {
struct omap_dss_board_info *board_data;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/2] OMAPDSS: HDMI: Move duplicate code from boardfile

2011-12-19 Thread mythripk
From: Mythri P K mythr...@ti.com

Move duplicate HDMI mux_init code from omap4 and panda board file
to display file.

Signed-off-by: Mythri P K mythr...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c|   16 +---
 arch/arm/mach-omap2/board-omap4panda.c |   17 +
 arch/arm/mach-omap2/display.c  |   23 +++
 include/video/omapdss.h|2 ++
 4 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 73b1e99..c3bd640 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -595,20 +595,6 @@ static void __init omap_sfh7741prox_init(void)
__func__, OMAP4_SFH7741_ENABLE_GPIO, error);
 }
 
-static void sdp4430_hdmi_mux_init(void)
-{
-   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
-   omap_mux_init_signal(hdmi_hpd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_cec,
-   OMAP_PIN_INPUT_PULLUP);
-   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
-   omap_mux_init_signal(hdmi_ddc_scl,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_ddc_sda,
-   OMAP_PIN_INPUT_PULLUP);
-}
-
 static struct gpio sdp4430_hdmi_gpios[] = {
{ HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH,hdmi_gpio_hpd   },
{ HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
@@ -838,9 +824,9 @@ static void omap_4430sdp_display_init(void)
pr_err(%s: Could not get display_sel GPIO\n, __func__);
 
sdp4430_lcd_init();
-   sdp4430_hdmi_mux_init();
sdp4430_picodlp_init();
omap_display_init(sdp4430_dss_data);
+   omap_hdmi_init();
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index a5b576b..d95df2e 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -478,21 +478,6 @@ int __init omap4_panda_dvi_init(void)
return r;
 }
 
-
-static void omap4_panda_hdmi_mux_init(void)
-{
-   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
-   omap_mux_init_signal(hdmi_hpd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_cec,
-   OMAP_PIN_INPUT_PULLUP);
-   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
-   omap_mux_init_signal(hdmi_ddc_scl,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_ddc_sda,
-   OMAP_PIN_INPUT_PULLUP);
-}
-
 static struct gpio panda_hdmi_gpios[] = {
{ HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH, hdmi_gpio_hpd   },
{ HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH, hdmi_gpio_ls_oe },
@@ -555,8 +540,8 @@ void omap4_panda_display_init(void)
if (r)
pr_err(error initializing panda DVI\n);
 
-   omap4_panda_hdmi_mux_init();
omap_display_init(omap4_panda_dss_data);
+   omap_hdmi_init();
 }
 
 static void __init omap4_panda_init(void)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index dce9905..8436088 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -29,6 +29,7 @@
 #include plat/omap-pm.h
 #include plat/common.h
 
+#include mux.h
 #include control.h
 #include display.h
 
@@ -96,6 +97,20 @@ static const struct omap_dss_hwmod_data 
omap4_dss_hwmod_data[] __initdata = {
{ dss_hdmi, omapdss_hdmi, -1 },
 };
 
+static void omap4_hdmi_mux_pads()
+{
+   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
+   omap_mux_init_signal(hdmi_hpd,
+   OMAP_PIN_INPUT_PULLUP);
+   omap_mux_init_signal(hdmi_cec,
+   OMAP_PIN_INPUT_PULLUP);
+   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
+   omap_mux_init_signal(hdmi_ddc_scl,
+   OMAP_PIN_INPUT_PULLUP);
+   omap_mux_init_signal(hdmi_ddc_sda,
+   OMAP_PIN_INPUT_PULLUP);
+}
+
 static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
 {
u32 enable_mask, enable_shift;
@@ -129,6 +144,14 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
return 0;
 }
 
+int omap_hdmi_init(void)
+{
+   if (cpu_is_omap44xx())
+   omap4_hdmi_mux_pads();
+
+   return 0;
+}
+
 static int omap_dsi_enable_pads(int dsi_id, unsigned lane_mask)
 {
if (cpu_is_omap44xx())
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 378c7ed..0cb0469 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -309,6 +309,8 @@ struct omap_dss_board_info {
 
 /* Init with the board info */
 extern int omap_display_init(struct omap_dss_board_info *board_data);
+/* HDMI mux init*/
+extern int omap_hdmi_init(void);
 
 struct omap_display_platform_data {
struct omap_dss_board_info *board_data;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe 

[PATCH v2 2/2] OMAPDSS: HDMI: Disable DDC internal pull up

2011-12-19 Thread mythripk
From: Mythri P K mythr...@ti.com

Disables the internal pull resistor for SDA and SCL which are enabled by
default, as there are external pull up's in 4460 and 4430 ES2.3
SDP, Blaze and Panda Boards, It is done to avoid the EDID read failure.

Signed-off-by: Ricardo Salveti de Araujo ricardo.salv...@linaro.org
Signed-off-by: Mythri P K mythr...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c|9 -
 arch/arm/mach-omap2/board-omap4panda.c |   10 +-
 arch/arm/mach-omap2/display.c  |   22 +++---
 include/video/omapdss.h|6 +-
 4 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index c3bd640..4af874a 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -826,7 +826,14 @@ static void omap_4430sdp_display_init(void)
sdp4430_lcd_init();
sdp4430_picodlp_init();
omap_display_init(sdp4430_dss_data);
-   omap_hdmi_init();
+   /*
+* OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
+* later have external pull up on the HDMI I2C lines
+*/
+   if (cpu_is_omap446x() || omap_rev()  OMAP4430_REV_ES2_2)
+   omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
+   else
+   omap_hdmi_init(0);
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index d95df2e..00103e3 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -541,7 +541,15 @@ void omap4_panda_display_init(void)
pr_err(error initializing panda DVI\n);
 
omap_display_init(omap4_panda_dss_data);
-   omap_hdmi_init();
+
+   /*
+* OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
+* later have external pull up on the HDMI I2C lines
+*/
+   if (cpu_is_omap446x() || omap_rev()  OMAP4430_REV_ES2_2)
+   omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
+   else
+   omap_hdmi_init(0);
 }
 
 static void __init omap4_panda_init(void)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 8436088..041fc52 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -97,8 +97,11 @@ static const struct omap_dss_hwmod_data 
omap4_dss_hwmod_data[] __initdata = {
{ dss_hdmi, omapdss_hdmi, -1 },
 };
 
-static void omap4_hdmi_mux_pads()
+static void omap4_hdmi_mux_pads(int flags)
 {
+   u32 reg;
+   u16 control_i2c_1;
+
/* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
omap_mux_init_signal(hdmi_hpd,
OMAP_PIN_INPUT_PULLUP);
@@ -109,6 +112,19 @@ static void omap4_hdmi_mux_pads()
OMAP_PIN_INPUT_PULLUP);
omap_mux_init_signal(hdmi_ddc_sda,
OMAP_PIN_INPUT_PULLUP);
+
+   /*
+* CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and
+* HDMI_DDC_SCL_PULLUPRESX (bit 24) are set to disable
+* internal pull up resistor.
+*/
+   if (flags  OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP) {
+   control_i2c_1 = OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1;
+   reg = omap4_ctrl_pad_readl(control_i2c_1);
+   reg |= (OMAP4_HDMI_DDC_SDA_PULLUPRESX_MASK |
+   OMAP4_HDMI_DDC_SCL_PULLUPRESX_MASK);
+   omap4_ctrl_pad_writel(reg, control_i2c_1);
+   }
 }
 
 static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
@@ -144,10 +160,10 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
return 0;
 }
 
-int omap_hdmi_init(void)
+int omap_hdmi_init(int flags)
 {
if (cpu_is_omap44xx())
-   omap4_hdmi_mux_pads();
+   omap4_hdmi_mux_pads(flags);
 
return 0;
 }
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 0cb0469..799470f 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -200,6 +200,10 @@ enum omap_dss_clk_source {
OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI,/* OMAP4: PLL2_CLK2 */
 };
 
+enum omap_hdmi_flags {
+   OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1  0,
+};
+
 /* RFBI */
 
 struct rfbi_timings {
@@ -310,7 +314,7 @@ struct omap_dss_board_info {
 /* Init with the board info */
 extern int omap_display_init(struct omap_dss_board_info *board_data);
 /* HDMI mux init*/
-extern int  omap_hdmi_init(void);
+extern int omap_hdmi_init(int flags);
 
 struct omap_display_platform_data {
struct omap_dss_board_info *board_data;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3] OMAPDSS: HDMI: HDMI Hot-plug detect support.

2011-12-13 Thread mythripk
From: Mythri P K mythr...@ti.com

HDMI even if enabled by default should be powered on only when the cable is
connected. This is supported by the Hot-plug feature.
Now when HDMI is enabled the following steps are followed:
-Display enable for HDMI is based on Hot-plug-detect(HPD).
-It registers to the GPIO irq handler and checks if cable is connected,
-If yes then it turns on HDMI
-If an HPD interrupt is received the corresponding IRQ handler is called where
it checks if it is a connect / disconnect based on which appropriate action
is taken. 


Mythri P K (3):
  OMAPDSS: HDMI: HPD support in boardfile
  OMAPDSS: HDMI: HPD support added to HDMI driver
  OMAPDSS: HDMI: Add option to enable HDMI in HPD mode

 arch/arm/mach-omap2/board-4430sdp.c|   35 
 arch/arm/mach-omap2/board-omap4panda.c |   35 -
 arch/arm/mach-omap2/display.c  |   20 ++--
 drivers/video/omap2/dss/dss.h  |2 +
 drivers/video/omap2/dss/hdmi.c |   92 ++-
 drivers/video/omap2/dss/hdmi_panel.c   |   54 ++-
 include/video/omapdss.h|   10 +++-
 7 files changed, 176 insertions(+), 72 deletions(-)

-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] OMAPDSS: HDMI: HPD support in boardfile

2011-12-13 Thread mythripk
From: Mythri P K mythr...@ti.com

Add support for HPD GPIO configuration in board file.
Also remove the enabling  of GPIO's required for HDMI from
hdmi driver file to display.c based on the GPIO #'s sent from
board file.

Signed-off-by: Mythri P K mythr...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c|   35 ++-
 arch/arm/mach-omap2/board-omap4panda.c |   35 +--
 arch/arm/mach-omap2/display.c  |   20 ++---
 drivers/video/omap2/dss/hdmi.c |   16 +-
 include/video/omapdss.h|6 -
 5 files changed, 43 insertions(+), 69 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 1b7c5e5..ba32b81 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -52,8 +52,9 @@
 #define ETH_KS8851_QUART   138
 #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO   184
 #define OMAP4_SFH7741_ENABLE_GPIO  188
-#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
+#define HDMI_GPIO_CT_CP_HPD 60 /* Hot plug pin for HDMI */
 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
+#define HDMI_GPIO_HPD 63
 #define DISPLAY_SEL_GPIO   59  /* LCD2/PicoDLP switch */
 #define DLP_POWER_ON_GPIO  40
 
@@ -596,27 +597,11 @@ static void __init omap_sfh7741prox_init(void)
 }
 
 static struct gpio sdp4430_hdmi_gpios[] = {
-   { HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH,hdmi_gpio_hpd   },
-   { HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
+   {HDMI_GPIO_CT_CP_HPD,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ct_cp_hpd },
+   {HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
+   {HDMI_GPIO_HPD,  GPIOF_DIR_IN,hdmi_gpio_hpd },
 };
 
-static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
-{
-   int status;
-
-   status = gpio_request_array(sdp4430_hdmi_gpios,
-   ARRAY_SIZE(sdp4430_hdmi_gpios));
-   if (status)
-   pr_err(%s: Cannot request HDMI GPIOs\n, __func__);
-
-   return status;
-}
-
-static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev)
-{
-   gpio_free(HDMI_GPIO_LS_OE);
-   gpio_free(HDMI_GPIO_HPD);
-}
 
 static struct nokia_dsi_panel_data dsi1_panel = {
.name   = taal,
@@ -735,9 +720,8 @@ static struct omap_dss_device sdp4430_hdmi_device = {
.name = hdmi,
.driver_name = hdmi_panel,
.type = OMAP_DISPLAY_TYPE_HDMI,
-   .platform_enable = sdp4430_panel_enable_hdmi,
-   .platform_disable = sdp4430_panel_disable_hdmi,
.channel = OMAP_DSS_CHANNEL_DIGIT,
+   .hpd_gpio = 63,
 };
 
 static struct picodlp_panel_data sdp4430_picodlp_pdata = {
@@ -835,9 +819,12 @@ static void omap_4430sdp_display_init(void)
 * EDID read failure.
 */
if (cpu_is_omap446x() || (omap_rev()  OMAP4430_REV_ES2_2))
-   omap_hdmi_init(OMAP_HDMI_EXTERNAL_PULLUP);
+   omap_hdmi_init(OMAP_HDMI_EXTERNAL_PULLUP, HDMI_GPIO_HPD,
+   sdp4430_hdmi_gpios,
+   ARRAY_SIZE(sdp4430_hdmi_gpios));
else
-   omap_hdmi_init(0);
+   omap_hdmi_init(0, HDMI_GPIO_HPD, sdp4430_hdmi_gpios,
+   ARRAY_SIZE(sdp4430_hdmi_gpios));
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index 212e06c..e13d116 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -51,8 +51,9 @@
 #define GPIO_HUB_NRESET62
 #define GPIO_WIFI_PMENA43
 #define GPIO_WIFI_IRQ  53
-#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
+#define HDMI_GPIO_CT_CP_HPD 60 /* Hot plug pin for HDMI */
 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
+#define HDMI_GPIO_HPD 63
 
 /* wl127x BT, FM, GPS connectivity chip */
 static int wl1271_gpios[] = {46, -1, -1};
@@ -479,35 +480,17 @@ int __init omap4_panda_dvi_init(void)
 }
 
 static struct gpio panda_hdmi_gpios[] = {
-   { HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH, hdmi_gpio_hpd   },
-   { HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH, hdmi_gpio_ls_oe },
+   {HDMI_GPIO_CT_CP_HPD,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ct_cp_hpd },
+   {HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
+   {HDMI_GPIO_HPD,  GPIOF_DIR_IN,hdmi_gpio_hpd },
 };
 
-static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev)
-{
-   int status;
-
-   status = gpio_request_array(panda_hdmi_gpios,
-   ARRAY_SIZE(panda_hdmi_gpios));
-   if (status)
-   pr_err(Cannot request HDMI GPIOs\n);
-
-   return status;
-}
-
-static void omap4_panda_panel_disable_hdmi(struct omap_dss_device *dssdev)
-{
-   gpio_free(HDMI_GPIO_LS_OE);
-   

[PATCH 3/3] OMAPDSS: HDMI: Add option to enable HDMI in HPD mode

2011-12-13 Thread mythripk
From: Mythri P K mythr...@ti.com

Add option in the panel to enable HDMI in HPD mode to enable the interrupt to
detect cable connect/disconnect, HDMI will be powered on only when the cable is
connected and powered down when cable is disconnected.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi_panel.c |   54 --
 include/video/omapdss.h  |1 +
 2 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi_panel.c 
b/drivers/video/omap2/dss/hdmi_panel.c
index 533d5dc..0b8a8ac 100644
--- a/drivers/video/omap2/dss/hdmi_panel.c
+++ b/drivers/video/omap2/dss/hdmi_panel.c
@@ -61,7 +61,7 @@ static int hdmi_panel_enable(struct omap_dss_device *dssdev)
 
mutex_lock(hdmi.hdmi_lock);
 
-   if (dssdev-state != OMAP_DSS_DISPLAY_DISABLED) {
+   if (dssdev-state == OMAP_DSS_DISPLAY_ACTIVE) {
r = -EINVAL;
goto err;
}
@@ -222,11 +222,57 @@ err:
return r;
 }
 
+static void hdmi_hpd_disable(struct omap_dss_device *dssdev)
+{
+   mutex_lock(hdmi.hdmi_lock);
+
+   if (dssdev-state == OMAP_DSS_DISPLAY_ACTIVE ||
+   dssdev-state == OMAP_DSS_DISPLAY_HOTPLUG)
+   omapdss_hdmi_hpd_disable(dssdev);
+
+   dssdev-state = OMAP_DSS_DISPLAY_DISABLED;
+
+   mutex_unlock(hdmi.hdmi_lock);
+}
+
+static int hdmi_hpd_enable(struct omap_dss_device *dssdev)
+{
+   int r = 0;
+   DSSDBG(ENTER hdmi_hpd_enable\n);
+
+   mutex_lock(hdmi.hdmi_lock);
+
+   if (dssdev-state != OMAP_DSS_DISPLAY_DISABLED) {
+   r = -EINVAL;
+   goto err;
+   }
+
+   r = omapdss_hdmi_hpd_enable(dssdev);
+
+   if (r  0) {
+   DSSERR(failed to power on\n);
+   goto err;
+   } else if (r == 1) {
+   r = omapdss_hdmi_display_enable(dssdev);
+   if (r) {
+   DSSERR(failed to power on\n);
+   goto err;
+   }
+   dssdev-state = OMAP_DSS_DISPLAY_ACTIVE;
+   } else {
+   dssdev-state = OMAP_DSS_DISPLAY_HOTPLUG;
+   }
+
+err:   mutex_unlock(hdmi.hdmi_lock);
+
+   return r;
+}
+
 static struct omap_dss_driver hdmi_driver = {
.probe  = hdmi_panel_probe,
.remove = hdmi_panel_remove,
-   .enable = hdmi_panel_enable,
-   .disable= hdmi_panel_disable,
+   .enable = hdmi_hpd_enable,
+   .disable= hdmi_hpd_disable,
.suspend= hdmi_panel_suspend,
.resume = hdmi_panel_resume,
.get_timings= hdmi_get_timings,
@@ -234,6 +280,8 @@ static struct omap_dss_driver hdmi_driver = {
.check_timings  = hdmi_check_timings,
.read_edid  = hdmi_read_edid,
.detect = hdmi_detect,
+   .default_enable = hdmi_panel_enable,
+   .default_disable = hdmi_panel_disable,
.driver = {
.name   = hdmi_panel,
.owner  = THIS_MODULE,
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 82e2c3e..5623a34 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -159,6 +159,7 @@ enum omap_dss_display_state {
OMAP_DSS_DISPLAY_DISABLED = 0,
OMAP_DSS_DISPLAY_ACTIVE,
OMAP_DSS_DISPLAY_SUSPENDED,
+   OMAP_DSS_DISPLAY_HOTPLUG,
 };
 
 /* XXX perhaps this should be removed */
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] OMAPDSS: HDMI: HPD support added to HDMI driver

2011-12-13 Thread mythripk
From: Mythri P K mythr...@ti.com

GPIO based handling of connect/disconnect of the HDMI cable
(Hot-plug detect)is added to the HDMI driver.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss.h  |2 +
 drivers/video/omap2/dss/hdmi.c |   76 
 include/video/omapdss.h|3 ++
 3 files changed, 81 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 6308fc5..c1279a3 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -498,6 +498,8 @@ int omapdss_hdmi_display_check_timing(struct 
omap_dss_device *dssdev,
struct omap_video_timings *timings);
 int omapdss_hdmi_read_edid(u8 *buf, int len);
 bool omapdss_hdmi_detect(void);
+int omapdss_hdmi_hpd_enable(struct omap_dss_device *dssdev);
+void omapdss_hdmi_hpd_disable(struct omap_dss_device *dssdev);
 int hdmi_panel_init(void);
 void hdmi_panel_exit(void);
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 36a7541..1fe8e84 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -67,9 +67,12 @@ static struct {
struct mutex lock;
struct omap_display_platform_data *pdata;
struct platform_device *pdev;
+   struct omap_dss_device *dssdev;
+
struct hdmi_ip_data ip_data;
int code;
int mode;
+   int hpd;
 
struct clk *sys_clk;
 } hdmi;
@@ -454,6 +457,32 @@ void hdmi_dump_regs(struct seq_file *s)
mutex_unlock(hdmi.lock);
 }
 
+static int hdmi_get_current_hpd(void)
+{
+   return gpio_get_value(hdmi.dssdev-hpd_gpio);
+}
+
+static irqreturn_t hpd_enable_handler(int irq, void *ptr)
+{
+   DSSDBG(hpd enable %d\n, hdmi.hpd);
+
+   if (hdmi.hpd)
+   hdmi.dssdev-driver-default_enable(hdmi.dssdev);
+   else
+   hdmi.dssdev-driver-default_disable(hdmi.dssdev);
+
+   return IRQ_HANDLED;
+}
+
+static irqreturn_t hpd_irq_handler(int irq, void *ptr)
+{
+   hdmi.hpd = hdmi_get_current_hpd();
+
+   DSSDBG(hpd %d\n, hdmi.hpd);
+
+   return IRQ_WAKE_THREAD;
+}
+
 int omapdss_hdmi_read_edid(u8 *buf, int len)
 {
int r;
@@ -488,6 +517,41 @@ bool omapdss_hdmi_detect(void)
return r == 1;
 }
 
+void omapdss_hdmi_hpd_disable(struct omap_dss_device *dssdev)
+{
+   DSSDBG(Enter hdmi_hpd_disable\n);
+
+   if (hdmi.dssdev)
+   free_irq(gpio_to_irq(hdmi.dssdev-hpd_gpio), hpd_irq_handler);
+
+   mutex_unlock(hdmi.lock);
+}
+
+int omapdss_hdmi_hpd_enable(struct omap_dss_device *dssdev)
+{
+   int r = 0;
+
+   DSSDBG(ENTER hdmi_hpd_enable\n);
+
+   mutex_lock(hdmi.lock);
+
+   r = request_threaded_irq(gpio_to_irq(hdmi.dssdev-hpd_gpio),
+   hpd_irq_handler, hpd_enable_handler,
+   IRQF_DISABLED | IRQF_TRIGGER_RISING |
+   IRQF_TRIGGER_FALLING, hpd, NULL);
+   if (r  0) {
+   pr_err(hdmi: request_irq %d failed\n,
+   gpio_to_irq(hdmi.dssdev-hpd_gpio));
+   return -EINVAL;
+   }
+
+   r = hdmi_get_current_hpd();
+
+   mutex_unlock(hdmi.lock);
+
+   return r;
+}
+
 int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev)
 {
int r = 0;
@@ -733,12 +797,24 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
 {
struct resource *hdmi_mem;
int r;
+   struct omap_dss_board_info *board_data;
 
hdmi.pdata = pdev-dev.platform_data;
hdmi.pdev = pdev;
 
mutex_init(hdmi.lock);
 
+   /* save reference to HDMI device */
+   board_data = hdmi.pdata-board_data;
+   for (r = 0; r  board_data-num_devices; r++) {
+   if (board_data-devices[r]-type == OMAP_DISPLAY_TYPE_HDMI)
+   hdmi.dssdev = board_data-devices[r];
+   }
+   if (!hdmi.dssdev) {
+   DSSERR(can't get HDMI device\n);
+   return -EINVAL;
+   }
+
hdmi_mem = platform_get_resource(hdmi.pdev, IORESOURCE_MEM, 0);
if (!hdmi_mem) {
DSSERR(can't get IORESOURCE_MEM HDMI\n);
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index ffd5d42..82e2c3e 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -630,6 +630,9 @@ struct omap_dss_driver {
 
int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
bool (*detect)(struct omap_dss_device *dssdev);
+
+   int (*default_enable)(struct omap_dss_device *dssdev);
+   void (*default_disable)(struct omap_dss_device *dssdev);
 };
 
 int omap_dss_register_driver(struct omap_dss_driver *);
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] OMAPDSS: HDMI: Move duplicate code from boardfile

2011-12-12 Thread mythripk
From: Mythri P K mythr...@ti.com

Move duplicate HDMI mux_init code from omap4 and panda board file
to display file.

Signed-off-by: Mythri P K mythr...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c|   16 +---
 arch/arm/mach-omap2/board-omap4panda.c |   17 +
 arch/arm/mach-omap2/display.c  |   23 +++
 include/video/omapdss.h|2 ++
 4 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 73b1e99..c3bd640 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -595,20 +595,6 @@ static void __init omap_sfh7741prox_init(void)
__func__, OMAP4_SFH7741_ENABLE_GPIO, error);
 }
 
-static void sdp4430_hdmi_mux_init(void)
-{
-   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
-   omap_mux_init_signal(hdmi_hpd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_cec,
-   OMAP_PIN_INPUT_PULLUP);
-   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
-   omap_mux_init_signal(hdmi_ddc_scl,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_ddc_sda,
-   OMAP_PIN_INPUT_PULLUP);
-}
-
 static struct gpio sdp4430_hdmi_gpios[] = {
{ HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH,hdmi_gpio_hpd   },
{ HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
@@ -838,9 +824,9 @@ static void omap_4430sdp_display_init(void)
pr_err(%s: Could not get display_sel GPIO\n, __func__);
 
sdp4430_lcd_init();
-   sdp4430_hdmi_mux_init();
sdp4430_picodlp_init();
omap_display_init(sdp4430_dss_data);
+   omap_hdmi_init();
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index a5b576b..d95df2e 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -478,21 +478,6 @@ int __init omap4_panda_dvi_init(void)
return r;
 }
 
-
-static void omap4_panda_hdmi_mux_init(void)
-{
-   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
-   omap_mux_init_signal(hdmi_hpd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_cec,
-   OMAP_PIN_INPUT_PULLUP);
-   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
-   omap_mux_init_signal(hdmi_ddc_scl,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_ddc_sda,
-   OMAP_PIN_INPUT_PULLUP);
-}
-
 static struct gpio panda_hdmi_gpios[] = {
{ HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH, hdmi_gpio_hpd   },
{ HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH, hdmi_gpio_ls_oe },
@@ -555,8 +540,8 @@ void omap4_panda_display_init(void)
if (r)
pr_err(error initializing panda DVI\n);
 
-   omap4_panda_hdmi_mux_init();
omap_display_init(omap4_panda_dss_data);
+   omap_hdmi_init();
 }
 
 static void __init omap4_panda_init(void)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index dce9905..8436088 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -29,6 +29,7 @@
 #include plat/omap-pm.h
 #include plat/common.h
 
+#include mux.h
 #include control.h
 #include display.h
 
@@ -96,6 +97,20 @@ static const struct omap_dss_hwmod_data 
omap4_dss_hwmod_data[] __initdata = {
{ dss_hdmi, omapdss_hdmi, -1 },
 };
 
+static void omap4_hdmi_mux_pads()
+{
+   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
+   omap_mux_init_signal(hdmi_hpd,
+   OMAP_PIN_INPUT_PULLUP);
+   omap_mux_init_signal(hdmi_cec,
+   OMAP_PIN_INPUT_PULLUP);
+   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
+   omap_mux_init_signal(hdmi_ddc_scl,
+   OMAP_PIN_INPUT_PULLUP);
+   omap_mux_init_signal(hdmi_ddc_sda,
+   OMAP_PIN_INPUT_PULLUP);
+}
+
 static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
 {
u32 enable_mask, enable_shift;
@@ -129,6 +144,14 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
return 0;
 }
 
+int omap_hdmi_init(void)
+{
+   if (cpu_is_omap44xx())
+   omap4_hdmi_mux_pads();
+
+   return 0;
+}
+
 static int omap_dsi_enable_pads(int dsi_id, unsigned lane_mask)
 {
if (cpu_is_omap44xx())
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 378c7ed..0cb0469 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -309,6 +309,8 @@ struct omap_dss_board_info {
 
 /* Init with the board info */
 extern int omap_display_init(struct omap_dss_board_info *board_data);
+/* HDMI mux init*/
+extern int  omap_hdmi_init(void);
 
 struct omap_display_platform_data {
struct omap_dss_board_info *board_data;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe 

[PATCH 2/2] OMAPDSS: HDMI: Disable DDC internal pull up

2011-12-12 Thread mythripk
From: Mythri P K mythr...@ti.com

Disables the internal pull resistor for SDA and SCL which are enabled by
default, as there are expernal pull up's in 4460 and 4430 ES2.3
SDP, Blaze and Panda Boards, It is done to avoid the EDID read failure.

Signed-off-by: Ricardo Salveti de Araujo ricardo.salv...@linaro.org
Signed-off-by: Mythri P K mythr...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c|   13 -
 arch/arm/mach-omap2/board-omap4panda.c |   14 +-
 arch/arm/mach-omap2/display.c  |   17 ++---
 include/video/omapdss.h|4 +++-
 4 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index c3bd640..1b7c5e5 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -826,7 +826,18 @@ static void omap_4430sdp_display_init(void)
sdp4430_lcd_init();
sdp4430_picodlp_init();
omap_display_init(sdp4430_dss_data);
-   omap_hdmi_init();
+   /*
+* CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and
+* HDMI_DDC_SCL_PULLUPRESX (bit 24) are set to disable
+* internal pull up resistor - This is a change needed in
+* OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze Boards as the
+* external pull up are present. This is needed to avoid
+* EDID read failure.
+*/
+   if (cpu_is_omap446x() || (omap_rev()  OMAP4430_REV_ES2_2))
+   omap_hdmi_init(OMAP_HDMI_EXTERNAL_PULLUP);
+   else
+   omap_hdmi_init(0);
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index d95df2e..212e06c 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -541,7 +541,19 @@ void omap4_panda_display_init(void)
pr_err(error initializing panda DVI\n);
 
omap_display_init(omap4_panda_dss_data);
-   omap_hdmi_init();
+
+   /*
+* CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and
+* HDMI_DDC_SCL_PULLUPRESX (bit 24) are set to disable
+* internal pull up resistor - This is a change needed in
+* OMAP4460 Panda and OMAP4430 ES2.3 Panda Boards as the
+* external pull up are present. This is needed to avoid
+* EDID read failure.
+*/
+   if (cpu_is_omap446x() || (omap_rev()  OMAP4430_REV_ES2_2))
+   omap_hdmi_init(OMAP_HDMI_EXTERNAL_PULLUP);
+   else
+   omap_hdmi_init(0);
 }
 
 static void __init omap4_panda_init(void)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 8436088..a75e179 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -97,8 +97,11 @@ static const struct omap_dss_hwmod_data 
omap4_dss_hwmod_data[] __initdata = {
{ dss_hdmi, omapdss_hdmi, -1 },
 };
 
-static void omap4_hdmi_mux_pads()
+static void omap4_hdmi_mux_pads(int flags)
 {
+   u32 reg;
+   u16 control_i2c_1;
+
/* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
omap_mux_init_signal(hdmi_hpd,
OMAP_PIN_INPUT_PULLUP);
@@ -109,6 +112,14 @@ static void omap4_hdmi_mux_pads()
OMAP_PIN_INPUT_PULLUP);
omap_mux_init_signal(hdmi_ddc_sda,
OMAP_PIN_INPUT_PULLUP);
+
+   if (flags  OMAP_HDMI_EXTERNAL_PULLUP) {
+   control_i2c_1 = OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1;
+   reg = omap4_ctrl_pad_readl(control_i2c_1);
+   reg |= (OMAP4_HDMI_DDC_SDA_PULLUPRESX_MASK |
+   OMAP4_HDMI_DDC_SCL_PULLUPRESX_MASK);
+   omap4_ctrl_pad_writel(reg, control_i2c_1);
+   }
 }
 
 static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
@@ -144,10 +155,10 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
return 0;
 }
 
-int omap_hdmi_init(void)
+int omap_hdmi_init(int flags)
 {
if (cpu_is_omap44xx())
-   omap4_hdmi_mux_pads();
+   omap4_hdmi_mux_pads(flags);
 
return 0;
 }
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 0cb0469..df585b5 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -49,6 +49,8 @@
 #define DISPC_IRQ_FRAMEDONETV  (1  24)
 #define DISPC_IRQ_WBBUFFEROVERFLOW (1  25)
 
+#define OMAP_HDMI_EXTERNAL_PULLUP  0x1
+
 struct omap_dss_device;
 struct omap_overlay_manager;
 
@@ -310,7 +312,7 @@ struct omap_dss_board_info {
 /* Init with the board info */
 extern int omap_display_init(struct omap_dss_board_info *board_data);
 /* HDMI mux init*/
-extern int  omap_hdmi_init(void);
+extern int  omap_hdmi_init(int flags);
 
 struct omap_display_platform_data {
struct omap_dss_board_info *board_data;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo 

[PATCH v3 1/2] OMAPDSS: HDMI: Move duplicate code from boardfile

2011-11-15 Thread mythripk
From: Mythri P K mythr...@ti.com

Move duplicate HDMI mux_init code from omap4 and panda board file
to display file.

Signed-off-by: Mythri P K mythr...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c|   16 +---
 arch/arm/mach-omap2/board-omap4panda.c |   17 +
 arch/arm/mach-omap2/display.c  |   23 +++
 include/video/omapdss.h|2 ++
 4 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 73b1e99..c3bd640 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -595,20 +595,6 @@ static void __init omap_sfh7741prox_init(void)
__func__, OMAP4_SFH7741_ENABLE_GPIO, error);
 }
 
-static void sdp4430_hdmi_mux_init(void)
-{
-   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
-   omap_mux_init_signal(hdmi_hpd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_cec,
-   OMAP_PIN_INPUT_PULLUP);
-   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
-   omap_mux_init_signal(hdmi_ddc_scl,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_ddc_sda,
-   OMAP_PIN_INPUT_PULLUP);
-}
-
 static struct gpio sdp4430_hdmi_gpios[] = {
{ HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH,hdmi_gpio_hpd   },
{ HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
@@ -838,9 +824,9 @@ static void omap_4430sdp_display_init(void)
pr_err(%s: Could not get display_sel GPIO\n, __func__);
 
sdp4430_lcd_init();
-   sdp4430_hdmi_mux_init();
sdp4430_picodlp_init();
omap_display_init(sdp4430_dss_data);
+   omap_hdmi_init();
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index a5b576b..d95df2e 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -478,21 +478,6 @@ int __init omap4_panda_dvi_init(void)
return r;
 }
 
-
-static void omap4_panda_hdmi_mux_init(void)
-{
-   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
-   omap_mux_init_signal(hdmi_hpd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_cec,
-   OMAP_PIN_INPUT_PULLUP);
-   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
-   omap_mux_init_signal(hdmi_ddc_scl,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_ddc_sda,
-   OMAP_PIN_INPUT_PULLUP);
-}
-
 static struct gpio panda_hdmi_gpios[] = {
{ HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH, hdmi_gpio_hpd   },
{ HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH, hdmi_gpio_ls_oe },
@@ -555,8 +540,8 @@ void omap4_panda_display_init(void)
if (r)
pr_err(error initializing panda DVI\n);
 
-   omap4_panda_hdmi_mux_init();
omap_display_init(omap4_panda_dss_data);
+   omap_hdmi_init();
 }
 
 static void __init omap4_panda_init(void)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index dce9905..8436088 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -29,6 +29,7 @@
 #include plat/omap-pm.h
 #include plat/common.h
 
+#include mux.h
 #include control.h
 #include display.h
 
@@ -96,6 +97,20 @@ static const struct omap_dss_hwmod_data 
omap4_dss_hwmod_data[] __initdata = {
{ dss_hdmi, omapdss_hdmi, -1 },
 };
 
+static void omap4_hdmi_mux_pads()
+{
+   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
+   omap_mux_init_signal(hdmi_hpd,
+   OMAP_PIN_INPUT_PULLUP);
+   omap_mux_init_signal(hdmi_cec,
+   OMAP_PIN_INPUT_PULLUP);
+   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
+   omap_mux_init_signal(hdmi_ddc_scl,
+   OMAP_PIN_INPUT_PULLUP);
+   omap_mux_init_signal(hdmi_ddc_sda,
+   OMAP_PIN_INPUT_PULLUP);
+}
+
 static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
 {
u32 enable_mask, enable_shift;
@@ -129,6 +144,14 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
return 0;
 }
 
+int omap_hdmi_init(void)
+{
+   if (cpu_is_omap44xx())
+   omap4_hdmi_mux_pads();
+
+   return 0;
+}
+
 static int omap_dsi_enable_pads(int dsi_id, unsigned lane_mask)
 {
if (cpu_is_omap44xx())
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 378c7ed..0cb0469 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -309,6 +309,8 @@ struct omap_dss_board_info {
 
 /* Init with the board info */
 extern int omap_display_init(struct omap_dss_board_info *board_data);
+/* HDMI mux init*/
+extern int  omap_hdmi_init(void);
 
 struct omap_display_platform_data {
struct omap_dss_board_info *board_data;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe 

[PATCH v3 2/2] OMAPDSS: HDMI: Disable DDC internal pull up

2011-11-15 Thread mythripk
From: Mythri P K mythr...@ti.com

Disables the internal pull resistor for SDA and SCL which are enabled by
default, as there are expernal pull up's in 4460 and 4430 ES2.3
SDP, Blaze and Panda Boards, It is done to avoid the EDID read failure.

Signed-off-by: Ricardo Salveti de Araujo ricardo.salv...@linaro.org
Signed-off-by: Mythri P K mythr...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c|   13 -
 arch/arm/mach-omap2/board-omap4panda.c |   14 +-
 arch/arm/mach-omap2/display.c  |   17 ++---
 include/video/omapdss.h|4 +++-
 4 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index c3bd640..d0a82f9 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -826,7 +826,18 @@ static void omap_4430sdp_display_init(void)
sdp4430_lcd_init();
sdp4430_picodlp_init();
omap_display_init(sdp4430_dss_data);
-   omap_hdmi_init();
+   /*
+* CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and
+* HDMI_DDC_SCL_PULLUPRESX (bit 24) are set to disable
+* internal pull up resistor - This is a change needed in
+* OMAP4460 and OMAP4430 ES2.3 SDP, Blaze and Panda as the
+* external pull up are present. This is needed to avoid
+* EDID read failure.
+*/
+   if (cpu_is_omap446x() || (omap_rev()  OMAP4430_REV_ES2_2))
+   omap_hdmi_init(OMAP_HDMI_EXTERNAL_PULLUP);
+   else
+   omap_hdmi_init(0);
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index d95df2e..44ff8e0 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -541,7 +541,19 @@ void omap4_panda_display_init(void)
pr_err(error initializing panda DVI\n);
 
omap_display_init(omap4_panda_dss_data);
-   omap_hdmi_init();
+
+   /*
+* CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and
+* HDMI_DDC_SCL_PULLUPRESX (bit 24) are set to disable
+* internal pull up resistor - This is a change needed in
+* OMAP4460 and OMAP4430 ES2.3 SDP, Blaze and Panda as the
+* external pull up are present. This is needed to avoid
+* EDID read failure.
+*/
+   if (cpu_is_omap446x() || (omap_rev()  OMAP4430_REV_ES2_2))
+   omap_hdmi_init(OMAP_HDMI_EXTERNAL_PULLUP);
+   else
+   omap_hdmi_init(0);
 }
 
 static void __init omap4_panda_init(void)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 8436088..a75e179 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -97,8 +97,11 @@ static const struct omap_dss_hwmod_data 
omap4_dss_hwmod_data[] __initdata = {
{ dss_hdmi, omapdss_hdmi, -1 },
 };
 
-static void omap4_hdmi_mux_pads()
+static void omap4_hdmi_mux_pads(int flags)
 {
+   u32 reg;
+   u16 control_i2c_1;
+
/* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
omap_mux_init_signal(hdmi_hpd,
OMAP_PIN_INPUT_PULLUP);
@@ -109,6 +112,14 @@ static void omap4_hdmi_mux_pads()
OMAP_PIN_INPUT_PULLUP);
omap_mux_init_signal(hdmi_ddc_sda,
OMAP_PIN_INPUT_PULLUP);
+
+   if (flags  OMAP_HDMI_EXTERNAL_PULLUP) {
+   control_i2c_1 = OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1;
+   reg = omap4_ctrl_pad_readl(control_i2c_1);
+   reg |= (OMAP4_HDMI_DDC_SDA_PULLUPRESX_MASK |
+   OMAP4_HDMI_DDC_SCL_PULLUPRESX_MASK);
+   omap4_ctrl_pad_writel(reg, control_i2c_1);
+   }
 }
 
 static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
@@ -144,10 +155,10 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
return 0;
 }
 
-int omap_hdmi_init(void)
+int omap_hdmi_init(int flags)
 {
if (cpu_is_omap44xx())
-   omap4_hdmi_mux_pads();
+   omap4_hdmi_mux_pads(flags);
 
return 0;
 }
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 0cb0469..df585b5 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -49,6 +49,8 @@
 #define DISPC_IRQ_FRAMEDONETV  (1  24)
 #define DISPC_IRQ_WBBUFFEROVERFLOW (1  25)
 
+#define OMAP_HDMI_EXTERNAL_PULLUP  0x1
+
 struct omap_dss_device;
 struct omap_overlay_manager;
 
@@ -310,7 +312,7 @@ struct omap_dss_board_info {
 /* Init with the board info */
 extern int omap_display_init(struct omap_dss_board_info *board_data);
 /* HDMI mux init*/
-extern int  omap_hdmi_init(void);
+extern int  omap_hdmi_init(int flags);
 
 struct omap_display_platform_data {
struct omap_dss_board_info *board_data;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info 

[PATCH v2 1/2] OMAPDSS: HDMI: Move duplicate code from boardfile to

2011-11-11 Thread mythripk
From: Mythri P K mythr...@ti.com

Move duplicate HDMI mux_init code from omap4 and panda board file
to display file.

Signed-off-by: Mythri P K mythr...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c|   16 +---
 arch/arm/mach-omap2/board-omap4panda.c |   17 +
 arch/arm/mach-omap2/display.c  |   23 +++
 include/video/omapdss.h|2 ++
 4 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 73b1e99..4a519a3 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -595,20 +595,6 @@ static void __init omap_sfh7741prox_init(void)
__func__, OMAP4_SFH7741_ENABLE_GPIO, error);
 }
 
-static void sdp4430_hdmi_mux_init(void)
-{
-   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
-   omap_mux_init_signal(hdmi_hpd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_cec,
-   OMAP_PIN_INPUT_PULLUP);
-   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
-   omap_mux_init_signal(hdmi_ddc_scl,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_ddc_sda,
-   OMAP_PIN_INPUT_PULLUP);
-}
-
 static struct gpio sdp4430_hdmi_gpios[] = {
{ HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH,hdmi_gpio_hpd   },
{ HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
@@ -838,9 +824,9 @@ static void omap_4430sdp_display_init(void)
pr_err(%s: Could not get display_sel GPIO\n, __func__);
 
sdp4430_lcd_init();
-   sdp4430_hdmi_mux_init();
sdp4430_picodlp_init();
omap_display_init(sdp4430_dss_data);
+   omap_hdmi_enable_pads();
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index a5b576b..26c6440 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -478,21 +478,6 @@ int __init omap4_panda_dvi_init(void)
return r;
 }
 
-
-static void omap4_panda_hdmi_mux_init(void)
-{
-   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
-   omap_mux_init_signal(hdmi_hpd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_cec,
-   OMAP_PIN_INPUT_PULLUP);
-   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
-   omap_mux_init_signal(hdmi_ddc_scl,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_ddc_sda,
-   OMAP_PIN_INPUT_PULLUP);
-}
-
 static struct gpio panda_hdmi_gpios[] = {
{ HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH, hdmi_gpio_hpd   },
{ HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH, hdmi_gpio_ls_oe },
@@ -555,8 +540,8 @@ void omap4_panda_display_init(void)
if (r)
pr_err(error initializing panda DVI\n);
 
-   omap4_panda_hdmi_mux_init();
omap_display_init(omap4_panda_dss_data);
+   omap_hdmi_enable_pads();
 }
 
 static void __init omap4_panda_init(void)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index dce9905..ec7ac1b 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -29,6 +29,7 @@
 #include plat/omap-pm.h
 #include plat/common.h
 
+#include mux.h
 #include control.h
 #include display.h
 
@@ -96,6 +97,20 @@ static const struct omap_dss_hwmod_data 
omap4_dss_hwmod_data[] __initdata = {
{ dss_hdmi, omapdss_hdmi, -1 },
 };
 
+static void omap4_hdmi_mux_pads(void)
+{
+   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
+   omap_mux_init_signal(hdmi_hpd,
+   OMAP_PIN_INPUT_PULLUP);
+   omap_mux_init_signal(hdmi_cec,
+   OMAP_PIN_INPUT_PULLUP);
+   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
+   omap_mux_init_signal(hdmi_ddc_scl,
+   OMAP_PIN_INPUT_PULLUP);
+   omap_mux_init_signal(hdmi_ddc_sda,
+   OMAP_PIN_INPUT_PULLUP);
+}
+
 static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
 {
u32 enable_mask, enable_shift;
@@ -129,6 +144,14 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
return 0;
 }
 
+int omap_hdmi_enable_pads(void)
+{
+   if (cpu_is_omap44xx())
+   omap4_hdmi_mux_pads();
+
+   return 0;
+}
+
 static int omap_dsi_enable_pads(int dsi_id, unsigned lane_mask)
 {
if (cpu_is_omap44xx())
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 378c7ed..f4913d6 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -309,6 +309,8 @@ struct omap_dss_board_info {
 
 /* Init with the board info */
 extern int omap_display_init(struct omap_dss_board_info *board_data);
+/* HDMI mux init*/
+extern int omap_hdmi_enable_pads(void);
 
 struct omap_display_platform_data {
struct omap_dss_board_info *board_data;
-- 
1.7.5.4

--
To unsubscribe from this 

[PATCH v2 1/2] OMAPDSS: HDMI: Move duplicate code from boardfile to

2011-11-11 Thread mythripk
From: Mythri P K mythr...@ti.com

Move duplicate HDMI mux_init code from omap4 and panda board file
to display file.

Signed-off-by: Mythri P K mythr...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c|   16 +---
 arch/arm/mach-omap2/board-omap4panda.c |   17 +
 arch/arm/mach-omap2/display.c  |   23 +++
 include/video/omapdss.h|2 ++
 4 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 73b1e99..4a519a3 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -595,20 +595,6 @@ static void __init omap_sfh7741prox_init(void)
__func__, OMAP4_SFH7741_ENABLE_GPIO, error);
 }
 
-static void sdp4430_hdmi_mux_init(void)
-{
-   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
-   omap_mux_init_signal(hdmi_hpd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_cec,
-   OMAP_PIN_INPUT_PULLUP);
-   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
-   omap_mux_init_signal(hdmi_ddc_scl,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_ddc_sda,
-   OMAP_PIN_INPUT_PULLUP);
-}
-
 static struct gpio sdp4430_hdmi_gpios[] = {
{ HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH,hdmi_gpio_hpd   },
{ HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
@@ -838,9 +824,9 @@ static void omap_4430sdp_display_init(void)
pr_err(%s: Could not get display_sel GPIO\n, __func__);
 
sdp4430_lcd_init();
-   sdp4430_hdmi_mux_init();
sdp4430_picodlp_init();
omap_display_init(sdp4430_dss_data);
+   omap_hdmi_enable_pads();
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index a5b576b..26c6440 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -478,21 +478,6 @@ int __init omap4_panda_dvi_init(void)
return r;
 }
 
-
-static void omap4_panda_hdmi_mux_init(void)
-{
-   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
-   omap_mux_init_signal(hdmi_hpd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_cec,
-   OMAP_PIN_INPUT_PULLUP);
-   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
-   omap_mux_init_signal(hdmi_ddc_scl,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(hdmi_ddc_sda,
-   OMAP_PIN_INPUT_PULLUP);
-}
-
 static struct gpio panda_hdmi_gpios[] = {
{ HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH, hdmi_gpio_hpd   },
{ HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH, hdmi_gpio_ls_oe },
@@ -555,8 +540,8 @@ void omap4_panda_display_init(void)
if (r)
pr_err(error initializing panda DVI\n);
 
-   omap4_panda_hdmi_mux_init();
omap_display_init(omap4_panda_dss_data);
+   omap_hdmi_enable_pads();
 }
 
 static void __init omap4_panda_init(void)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index dce9905..ec7ac1b 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -29,6 +29,7 @@
 #include plat/omap-pm.h
 #include plat/common.h
 
+#include mux.h
 #include control.h
 #include display.h
 
@@ -96,6 +97,20 @@ static const struct omap_dss_hwmod_data 
omap4_dss_hwmod_data[] __initdata = {
{ dss_hdmi, omapdss_hdmi, -1 },
 };
 
+static void omap4_hdmi_mux_pads(void)
+{
+   /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
+   omap_mux_init_signal(hdmi_hpd,
+   OMAP_PIN_INPUT_PULLUP);
+   omap_mux_init_signal(hdmi_cec,
+   OMAP_PIN_INPUT_PULLUP);
+   /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
+   omap_mux_init_signal(hdmi_ddc_scl,
+   OMAP_PIN_INPUT_PULLUP);
+   omap_mux_init_signal(hdmi_ddc_sda,
+   OMAP_PIN_INPUT_PULLUP);
+}
+
 static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
 {
u32 enable_mask, enable_shift;
@@ -129,6 +144,14 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
return 0;
 }
 
+int omap_hdmi_enable_pads(void)
+{
+   if (cpu_is_omap44xx())
+   omap4_hdmi_mux_pads();
+
+   return 0;
+}
+
 static int omap_dsi_enable_pads(int dsi_id, unsigned lane_mask)
 {
if (cpu_is_omap44xx())
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 378c7ed..f4913d6 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -309,6 +309,8 @@ struct omap_dss_board_info {
 
 /* Init with the board info */
 extern int omap_display_init(struct omap_dss_board_info *board_data);
+/* HDMI mux init*/
+extern int omap_hdmi_enable_pads(void);
 
 struct omap_display_platform_data {
struct omap_dss_board_info *board_data;
-- 
1.7.5.4

--
To unsubscribe from this 

[PATCH v2 2/2] OMAPDSS: HDMI: Disable HDMI DDC internal pull up

2011-11-11 Thread mythripk
From: Mythri P K mythr...@ti.com

Disables the internal pull resistor for SDA and SCL enabled by
default as there are expernal pull up's in 4460 and 4430 ES2.3,
It is done to avoid the EDID read failure.

Signed-off-by: Ricardo Salveti de Araujo ricardo.salv...@linaro.org
Signed-off-by: Mythri P K mythr...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c|   12 +++-
 arch/arm/mach-omap2/board-omap4panda.c |   13 -
 arch/arm/mach-omap2/display.c  |   17 ++---
 include/video/omapdss.h|2 +-
 4 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 4a519a3..91d3742 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -826,7 +826,17 @@ static void omap_4430sdp_display_init(void)
sdp4430_lcd_init();
sdp4430_picodlp_init();
omap_display_init(sdp4430_dss_data);
-   omap_hdmi_enable_pads();
+   /*
+* CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and
+* HDMI_DDC_SCL_PULLUPRESX (bit 24) are set to disable
+* internal pull up resistor - This is a change needed in
+* OMAP4460 and OMAP4430 ES2.3 as the external pull up
+* are present. This is needed to avoid EDID read failure.
+*/
+   if (cpu_is_omap446x() || (omap_rev()  OMAP4430_REV_ES2_2))
+   omap_hdmi_enable_pads(1);
+   else
+   omap_hdmi_enable_pads(0);
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index 26c6440..a4e7bf8 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -541,7 +541,18 @@ void omap4_panda_display_init(void)
pr_err(error initializing panda DVI\n);
 
omap_display_init(omap4_panda_dss_data);
-   omap_hdmi_enable_pads();
+
+   /*
+* CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and
+* HDMI_DDC_SCL_PULLUPRESX (bit 24) are set to disable
+* internal pull up resistor - This is a change needed in
+* OMAP4460 and OMAP4430 ES2.3 as the external pull up
+* are present. This is needed to avoid EDID read failure.
+*/
+   if (cpu_is_omap446x() || (omap_rev()  OMAP4430_REV_ES2_2))
+   omap_hdmi_enable_pads(1);
+   else
+   omap_hdmi_enable_pads(0);
 }
 
 static void __init omap4_panda_init(void)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index ec7ac1b..8af5714 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -97,8 +97,11 @@ static const struct omap_dss_hwmod_data 
omap4_dss_hwmod_data[] __initdata = {
{ dss_hdmi, omapdss_hdmi, -1 },
 };
 
-static void omap4_hdmi_mux_pads(void)
+static void omap4_hdmi_mux_pads(int ext_pull_up)
 {
+   u32 reg;
+   u16 control_i2c_1;
+
/* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
omap_mux_init_signal(hdmi_hpd,
OMAP_PIN_INPUT_PULLUP);
@@ -109,6 +112,14 @@ static void omap4_hdmi_mux_pads(void)
OMAP_PIN_INPUT_PULLUP);
omap_mux_init_signal(hdmi_ddc_sda,
OMAP_PIN_INPUT_PULLUP);
+
+   if (ext_pull_up) {
+   control_i2c_1 = OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1;
+   reg = omap4_ctrl_pad_readl(control_i2c_1);
+   reg |= (OMAP4_HDMI_DDC_SDA_PULLUPRESX_MASK |
+   OMAP4_HDMI_DDC_SCL_PULLUPRESX_MASK);
+   omap4_ctrl_pad_writel(reg, control_i2c_1);
+   }
 }
 
 static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
@@ -144,10 +155,10 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
return 0;
 }
 
-int omap_hdmi_enable_pads(void)
+int omap_hdmi_enable_pads(int ext_pull_up)
 {
if (cpu_is_omap44xx())
-   omap4_hdmi_mux_pads();
+   omap4_hdmi_mux_pads(ext_pull_up);
 
return 0;
 }
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index f4913d6..27b71f4 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -310,7 +310,7 @@ struct omap_dss_board_info {
 /* Init with the board info */
 extern int omap_display_init(struct omap_dss_board_info *board_data);
 /* HDMI mux init*/
-extern int omap_hdmi_enable_pads(void);
+extern int omap_hdmi_enable_pads(int ext_pull_up);
 
 struct omap_display_platform_data {
struct omap_dss_board_info *board_data;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/2] OMAPDSS: HDMI: Disable HDMI DDC internal pull up

2011-11-11 Thread mythripk
From: Mythri P K mythr...@ti.com

Disables the internal pull resistor for SDA and SCL enabled by
default as there are expernal pull up's in 4460 and 4430 ES2.3,
It is done to avoid the EDID read failure.

Signed-off-by: Ricardo Salveti de Araujo ricardo.salv...@linaro.org
Signed-off-by: Mythri P K mythr...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c|   12 +++-
 arch/arm/mach-omap2/board-omap4panda.c |   13 -
 arch/arm/mach-omap2/display.c  |   17 ++---
 include/video/omapdss.h|2 +-
 4 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 4a519a3..91d3742 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -826,7 +826,17 @@ static void omap_4430sdp_display_init(void)
sdp4430_lcd_init();
sdp4430_picodlp_init();
omap_display_init(sdp4430_dss_data);
-   omap_hdmi_enable_pads();
+   /*
+* CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and
+* HDMI_DDC_SCL_PULLUPRESX (bit 24) are set to disable
+* internal pull up resistor - This is a change needed in
+* OMAP4460 and OMAP4430 ES2.3 as the external pull up
+* are present. This is needed to avoid EDID read failure.
+*/
+   if (cpu_is_omap446x() || (omap_rev()  OMAP4430_REV_ES2_2))
+   omap_hdmi_enable_pads(1);
+   else
+   omap_hdmi_enable_pads(0);
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index 26c6440..a4e7bf8 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -541,7 +541,18 @@ void omap4_panda_display_init(void)
pr_err(error initializing panda DVI\n);
 
omap_display_init(omap4_panda_dss_data);
-   omap_hdmi_enable_pads();
+
+   /*
+* CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and
+* HDMI_DDC_SCL_PULLUPRESX (bit 24) are set to disable
+* internal pull up resistor - This is a change needed in
+* OMAP4460 and OMAP4430 ES2.3 as the external pull up
+* are present. This is needed to avoid EDID read failure.
+*/
+   if (cpu_is_omap446x() || (omap_rev()  OMAP4430_REV_ES2_2))
+   omap_hdmi_enable_pads(1);
+   else
+   omap_hdmi_enable_pads(0);
 }
 
 static void __init omap4_panda_init(void)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index ec7ac1b..8af5714 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -97,8 +97,11 @@ static const struct omap_dss_hwmod_data 
omap4_dss_hwmod_data[] __initdata = {
{ dss_hdmi, omapdss_hdmi, -1 },
 };
 
-static void omap4_hdmi_mux_pads(void)
+static void omap4_hdmi_mux_pads(int ext_pull_up)
 {
+   u32 reg;
+   u16 control_i2c_1;
+
/* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
omap_mux_init_signal(hdmi_hpd,
OMAP_PIN_INPUT_PULLUP);
@@ -109,6 +112,14 @@ static void omap4_hdmi_mux_pads(void)
OMAP_PIN_INPUT_PULLUP);
omap_mux_init_signal(hdmi_ddc_sda,
OMAP_PIN_INPUT_PULLUP);
+
+   if (ext_pull_up) {
+   control_i2c_1 = OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1;
+   reg = omap4_ctrl_pad_readl(control_i2c_1);
+   reg |= (OMAP4_HDMI_DDC_SDA_PULLUPRESX_MASK |
+   OMAP4_HDMI_DDC_SCL_PULLUPRESX_MASK);
+   omap4_ctrl_pad_writel(reg, control_i2c_1);
+   }
 }
 
 static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
@@ -144,10 +155,10 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
return 0;
 }
 
-int omap_hdmi_enable_pads(void)
+int omap_hdmi_enable_pads(int ext_pull_up)
 {
if (cpu_is_omap44xx())
-   omap4_hdmi_mux_pads();
+   omap4_hdmi_mux_pads(ext_pull_up);
 
return 0;
 }
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index f4913d6..27b71f4 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -310,7 +310,7 @@ struct omap_dss_board_info {
 /* Init with the board info */
 extern int omap_display_init(struct omap_dss_board_info *board_data);
 /* HDMI mux init*/
-extern int omap_hdmi_enable_pads(void);
+extern int omap_hdmi_enable_pads(int ext_pull_up);
 
 struct omap_display_platform_data {
struct omap_dss_board_info *board_data;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] OMAPDSS: HDMI: remove duplicate video interface code

2011-11-11 Thread mythripk
From: Mythri P K mythr...@ti.com

video interface structure is a duplicate structure with parameters which are
already present in ip_data config structure, Thus removing the structure and
modifying corresponding code.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   31 +++-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |7 --
 2 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index e1a6ce5..403d6fc 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -629,8 +629,7 @@ static void hdmi_core_av_packet_config(struct hdmi_ip_data 
*ip_data,
 }
 
 static void hdmi_wp_init(struct omap_video_timings *timings,
-   struct hdmi_video_format *video_fmt,
-   struct hdmi_video_interface *video_int)
+   struct hdmi_video_format *video_fmt)
 {
pr_debug(Enter hdmi_wp_init\n);
 
@@ -645,12 +644,6 @@ static void hdmi_wp_init(struct omap_video_timings 
*timings,
video_fmt-y_res = 0;
video_fmt-x_res = 0;
 
-   video_int-vsp = 0;
-   video_int-hsp = 0;
-
-   video_int-interlacing = 0;
-   video_int-tm = 0; /* HDMI_TIMING_SLAVE */
-
 }
 
 void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data, bool start)
@@ -687,17 +680,16 @@ static void hdmi_wp_video_config_format(struct 
hdmi_ip_data *ip_data,
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_SIZE, l);
 }
 
-static void hdmi_wp_video_config_interface(struct hdmi_ip_data *ip_data,
-   struct hdmi_video_interface *video_int)
+static void hdmi_wp_video_config_interface(struct hdmi_ip_data *ip_data)
 {
u32 r;
pr_debug(Enter hdmi_wp_video_config_interface\n);
 
r = hdmi_read_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG);
-   r = FLD_MOD(r, video_int-vsp, 7, 7);
-   r = FLD_MOD(r, video_int-hsp, 6, 6);
-   r = FLD_MOD(r, video_int-interlacing, 3, 3);
-   r = FLD_MOD(r, video_int-tm, 1, 0);
+   r = FLD_MOD(r, ip_data-cfg.timings.vsync_pol, 7, 7);
+   r = FLD_MOD(r, ip_data-cfg.timings.hsync_pol, 6, 6);
+   r = FLD_MOD(r, ip_data-cfg.interlace, 3, 3);
+   r = FLD_MOD(r, 1, 1, 0); /* HDMI_TIMING_MASTER_24BIT */
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG, r);
 }
 
@@ -725,15 +717,13 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
/* HDMI */
struct omap_video_timings video_timing;
struct hdmi_video_format video_format;
-   struct hdmi_video_interface video_interface;
/* HDMI core */
struct hdmi_core_infoframe_avi avi_cfg;
struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg;
struct hdmi_config *cfg = ip_data-cfg;
 
-   hdmi_wp_init(video_timing, video_format,
-   video_interface);
+   hdmi_wp_init(video_timing, video_format);
 
hdmi_core_init(v_core_cfg,
avi_cfg,
@@ -748,12 +738,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
 
hdmi_wp_video_config_format(ip_data, video_format);
 
-   video_interface.vsp = cfg-timings.vsync_pol;
-   video_interface.hsp = cfg-timings.hsync_pol;
-   video_interface.interlacing = cfg-interlace;
-   video_interface.tm = 1 ; /* HDMI_TIMING_MASTER_24BIT */
-
-   hdmi_wp_video_config_interface(ip_data, video_interface);
+   hdmi_wp_video_config_interface(ip_data);
 
/*
 * configure core video part
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 2040956..914bec6 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -517,13 +517,6 @@ struct hdmi_video_format {
u32 x_res;  /* pixel per line */
 };
 
-struct hdmi_video_interface {
-   int vsp;/* Vsync polarity */
-   int hsp;/* Hsync polarity */
-   int interlacing;
-   int tm; /* Timing mode */
-};
-
 struct hdmi_audio_format {
enum hdmi_stereo_channels   stereo_channels;
u8  active_chnnls_msk;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] OMAPDSS: HDMI: change the timing match logic

2011-11-11 Thread mythripk
From: Mythri P K mythr...@ti.com

Change the timing match logic, Instead of the statically mapped method
to get the corresponding timings for a given code and mode, move to a
simpler array indexed method. It  will help to scale up to add more
timings when needed.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |  162 ---
 1 files changed, 67 insertions(+), 95 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index f76ae47..b859350 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -58,8 +58,6 @@
 #define EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR 4
 #define EDID_SIZE_BLOCK1_TIMING_DESCRIPTOR 4
 
-#define OMAP_HDMI_TIMINGS_NB   34
-
 #define HDMI_DEFAULT_REGN 16
 #define HDMI_DEFAULT_REGM2 1
 
@@ -88,7 +86,7 @@ static struct {
  * map it to corresponding CEA or VESA index.
  */
 
-static const struct hdmi_config cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
+static const struct hdmi_config cea_timings[] = {
 { {640, 480, 25200, 96, 16, 48, 2, 10, 33, 0, 0, 0}, {1, HDMI_HDMI} },
 { {720, 480, 27027, 62, 16, 60, 6, 9, 30, 0, 0, 0}, {2, HDMI_HDMI} },
 { {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {4, HDMI_HDMI} },
@@ -104,6 +102,8 @@ static const struct hdmi_config 
cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
 { {1920, 1080, 74250, 44, 638, 148, 5, 4, 36, 1, 1, 0}, {32, HDMI_HDMI} },
 { {2880, 480, 108108, 248, 64, 240, 6, 9, 30, 0, 0, 0}, {35, HDMI_HDMI} },
 { {2880, 576, 108000, 256, 48, 272, 5, 5, 39, 0, 0, 0}, {37, HDMI_HDMI} },
+};
+static const struct hdmi_config vesa_timings[] = {
 /* VESA From Here */
 { {640, 480, 25175, 96, 16, 48, 2 , 11, 31, 0, 0, 0}, {4, HDMI_DVI} },
 { {800, 600, 4, 128, 40, 88, 4 , 1, 23, 1, 1, 0}, {9, HDMI_DVI} },
@@ -126,39 +126,6 @@ static const struct hdmi_config 
cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
 { {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {0x55, HDMI_DVI} }
 };
 
-/*
- * This is a static mapping array which maps the timing values
- * with corresponding CEA / VESA code
- */
-static const int code_index[OMAP_HDMI_TIMINGS_NB] = {
-   1, 19, 4, 2, 37, 6, 21, 20, 5, 16, 17, 29, 31, 35, 32,
-   /* --15 CEA 17-- vesa*/
-   4, 9, 0xE, 0x17, 0x1C, 0x27, 0x20, 0x23, 0x10, 0x2A,
-   0X2F, 0x3A, 0X51, 0X52, 0x16, 0x29, 0x39, 0x1B
-};
-
-/*
- * This is reverse static mapping which maps the CEA / VESA code
- * to the corresponding timing values
- */
-static const int code_cea[39] = {
-   -1,  0,  3,  3,  2,  8,  5,  5, -1, -1,
-   -1, -1, -1, -1, -1, -1,  9, 10, 10,  1,
-   7,   6,  6, -1, -1, -1, -1, -1, -1, 11,
-   11, 12, 14, -1, -1, 13, 13,  4,  4
-};
-
-static const int code_vesa[85] = {
-   -1, -1, -1, -1, 15, -1, -1, -1, -1, 16,
-   -1, -1, -1, -1, 17, -1, 23, -1, -1, -1,
-   -1, -1, 29, 18, -1, -1, -1, 32, 19, -1,
-   -1, -1, 21, -1, -1, 22, -1, -1, -1, 20,
-   -1, 30, 24, -1, -1, -1, -1, 25, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, 31, 26, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-   -1, 27, 28, -1, 33};
-
 static int hdmi_runtime_get(void)
 {
int r;
@@ -188,82 +155,88 @@ int hdmi_init_display(struct omap_dss_device *dssdev)
return 0;
 }
 
-static int get_timings_index(void)
+static bool hdmi_find_code(const struct hdmi_config *timings_arr,
+   int len, struct hdmi_config *timing)
 {
-   int code;
+   int i;
 
-   if (hdmi.mode == 0)
-   code = code_vesa[hdmi.code];
-   else
-   code = code_cea[hdmi.code];
+   for (i = 0; i  len; i++) {
+   if (timings_arr[i].cm.code == hdmi.code) {
+   *timing = timings_arr[i];
+   return true;
+   }
+   }
+
+   return false;
+}
 
-   if (code == -1) {
+static void hdmi_get_timings(struct hdmi_config *timing)
+{
+   int r;
+
+   if (hdmi.mode == 0) {
+   r = hdmi_find_code(vesa_timings,
+   ARRAY_SIZE(vesa_timings), timing);
+   } else {
+   r =  hdmi_find_code(cea_timings,
+   ARRAY_SIZE(cea_timings), timing);
+   }
+   if (!r) {
/* HDMI code 4 corresponds to 640 * 480 VGA */
hdmi.code = 4;
/* DVI mode 1 corresponds to HDMI 0 to DVI */
hdmi.mode = HDMI_DVI;
+   *timing = vesa_timings[0];
+   }
+}
+
+static bool hdmi_timings_compare(struct omap_video_timings *timing,
+   const struct hdmi_video_timings *temp)
+{
+   int timing_vsync, timing_hsync, temp_vsync, temp_hsync;
+
+   if ((temp-pixel_clock == timing-pixel_clock) 
+   (temp-x_res == timing-x_res) 
+   (temp-y_res == timing-y_res)) {
 
-   code = code_vesa[hdmi.code];
+  

[PATCH 0/4] OMAPDSS: HDMI: Improve the timings logic in HDMI

2011-11-11 Thread mythripk
From: Mythri P K mythr...@ti.com

There are some duplicate timing structure which are not needed thus removing
them to clean the code.
Also the static mapped timing structure is quite complicated to add new
timings, so simplify it by using array indexed method.

Mythri P K (4):
  OMAPDSS: HDMI: remove duplicate video interface code
  OMAPDSS: HDMI: update static timing table
  OMAPDSS: HDMI: change the timing match logic
  OMAPDSS: HDMI: remove duplicate code and mode parameter

 drivers/video/omap2/dss/hdmi.c|  246 +
 drivers/video/omap2/dss/ti_hdmi.h |   14 +-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   47 ++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |7 -
 4 files changed, 128 insertions(+), 186 deletions(-)

-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] OMAPDSS: HDMI: remove duplicate code and mode parameter

2011-11-11 Thread mythripk
From: Mythri P K mythr...@ti.com

code and mode parameters are already a part of the ip_data structure
so no need to keep the same parameters again in hdmi global structure.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |   18 +++---
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index b859350..8d06ce6 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -66,8 +66,6 @@ static struct {
struct omap_display_platform_data *pdata;
struct platform_device *pdev;
struct hdmi_ip_data ip_data;
-   int code;
-   int mode;
 
struct clk *sys_clk;
 } hdmi;
@@ -161,7 +159,7 @@ static bool hdmi_find_code(const struct hdmi_config 
*timings_arr,
int i;
 
for (i = 0; i  len; i++) {
-   if (timings_arr[i].cm.code == hdmi.code) {
+   if (timings_arr[i].cm.code == hdmi.ip_data.cfg.cm.code) {
*timing = timings_arr[i];
return true;
}
@@ -174,7 +172,7 @@ static void hdmi_get_timings(struct hdmi_config *timing)
 {
int r;
 
-   if (hdmi.mode == 0) {
+   if (hdmi.ip_data.cfg.cm.mode == 0) {
r = hdmi_find_code(vesa_timings,
ARRAY_SIZE(vesa_timings), timing);
} else {
@@ -183,9 +181,9 @@ static void hdmi_get_timings(struct hdmi_config *timing)
}
if (!r) {
/* HDMI code 4 corresponds to 640 * 480 VGA */
-   hdmi.code = 4;
+   hdmi.ip_data.cfg.cm.code = 4;
/* DVI mode 1 corresponds to HDMI 0 to DVI */
-   hdmi.mode = HDMI_DVI;
+   hdmi.ip_data.cfg.cm.mode = HDMI_DVI;
*timing = vesa_timings[0];
}
 }
@@ -335,8 +333,6 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
goto err;
}
 
-   hdmi.ip_data.cfg.cm.mode = hdmi.mode;
-   hdmi.ip_data.cfg.cm.code = hdmi.code;
hdmi.ip_data.ops-video_configure(hdmi.ip_data);
 
/* Make selection of HDMI in DSS */
@@ -396,8 +392,8 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device 
*dssdev)
struct hdmi_cm cm;
 
cm = hdmi_get_code(dssdev-panel.timings);
-   hdmi.code = cm.code;
-   hdmi.mode = cm.mode;
+   hdmi.ip_data.cfg.cm.code = cm.code;
+   hdmi.ip_data.cfg.cm.mode = cm.mode;
 
if (dssdev-state == OMAP_DSS_DISPLAY_ACTIVE) {
int r;
@@ -663,7 +659,7 @@ static int hdmi_audio_hw_params(struct hdmi_ip_data 
*ip_data,
 static int hdmi_audio_startup(struct snd_pcm_substream *substream,
  struct snd_soc_dai *dai)
 {
-   if (!hdmi.mode) {
+   if (!hdmi.ip_data.cfg.cm.mode) {
pr_err(Current video settings do not support audio.\n);
return -EIO;
}
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] OMAPDSS: HDMI: update static timing table

2011-11-11 Thread mythripk
From: Mythri P K mythr...@ti.com

Add the vsync polarity, hsync polarity, interlace to hdmi_video_timings.
Remove the now duplicate structure hdmi_timings.
update the static table structure in HDMI with CEA/VESA code and mode.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c|   96 ++--
 drivers/video/omap2/dss/ti_hdmi.h |   14 ++---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   20 +++---
 3 files changed, 63 insertions(+), 67 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index c56378c..f76ae47 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -88,42 +88,42 @@ static struct {
  * map it to corresponding CEA or VESA index.
  */
 
-static const struct hdmi_timings cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
-   { {640, 480, 25200, 96, 16, 48, 2, 10, 33} , 0 , 0},
-   { {1280, 720, 74250, 40, 440, 220, 5, 5, 20}, 1, 1},
-   { {1280, 720, 74250, 40, 110, 220, 5, 5, 20}, 1, 1},
-   { {720, 480, 27027, 62, 16, 60, 6, 9, 30}, 0, 0},
-   { {2880, 576, 108000, 256, 48, 272, 5, 5, 39}, 0, 0},
-   { {1440, 240, 27027, 124, 38, 114, 3, 4, 15}, 0, 0},
-   { {1440, 288, 27000, 126, 24, 138, 3, 2, 19}, 0, 0},
-   { {1920, 540, 74250, 44, 528, 148, 5, 2, 15}, 1, 1},
-   { {1920, 540, 74250, 44, 88, 148, 5, 2, 15}, 1, 1},
-   { {1920, 1080, 148500, 44, 88, 148, 5, 4, 36}, 1, 1},
-   { {720, 576, 27000, 64, 12, 68, 5, 5, 39}, 0, 0},
-   { {1440, 576, 54000, 128, 24, 136, 5, 5, 39}, 0, 0},
-   { {1920, 1080, 148500, 44, 528, 148, 5, 4, 36}, 1, 1},
-   { {2880, 480, 108108, 248, 64, 240, 6, 9, 30}, 0, 0},
-   { {1920, 1080, 74250, 44, 638, 148, 5, 4, 36}, 1, 1},
-   /* VESA From Here */
-   { {640, 480, 25175, 96, 16, 48, 2 , 11, 31}, 0, 0},
-   { {800, 600, 4, 128, 40, 88, 4 , 1, 23}, 1, 1},
-   { {848, 480, 33750, 112, 16, 112, 8 , 6, 23}, 1, 1},
-   { {1280, 768, 79500, 128, 64, 192, 7 , 3, 20}, 1, 0},
-   { {1280, 800, 83500, 128, 72, 200, 6 , 3, 22}, 1, 0},
-   { {1360, 768, 85500, 112, 64, 256, 6 , 3, 18}, 1, 1},
-   { {1280, 960, 108000, 112, 96, 312, 3 , 1, 36}, 1, 1},
-   { {1280, 1024, 108000, 112, 48, 248, 3 , 1, 38}, 1, 1},
-   { {1024, 768, 65000, 136, 24, 160, 6, 3, 29}, 0, 0},
-   { {1400, 1050, 121750, 144, 88, 232, 4, 3, 32}, 1, 0},
-   { {1440, 900, 106500, 152, 80, 232, 6, 3, 25}, 1, 0},
-   { {1680, 1050, 146250, 176 , 104, 280, 6, 3, 30}, 1, 0},
-   { {1366, 768, 85500, 143, 70, 213, 3, 3, 24}, 1, 1},
-   { {1920, 1080, 148500, 44, 148, 80, 5, 4, 36}, 1, 1},
-   { {1280, 768, 68250, 32, 48, 80, 7, 3, 12}, 0, 1},
-   { {1400, 1050, 101000, 32, 48, 80, 4, 3, 23}, 0, 1},
-   { {1680, 1050, 119000, 32, 48, 80, 6, 3, 21}, 0, 1},
-   { {1280, 800, 79500, 32, 48, 80, 6, 3, 14}, 0, 1},
-   { {1280, 720, 74250, 40, 110, 220, 5, 5, 20}, 1, 1}
+static const struct hdmi_config cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
+{ {640, 480, 25200, 96, 16, 48, 2, 10, 33, 0, 0, 0}, {1, HDMI_HDMI} },
+{ {720, 480, 27027, 62, 16, 60, 6, 9, 30, 0, 0, 0}, {2, HDMI_HDMI} },
+{ {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {4, HDMI_HDMI} },
+{ {1920, 540, 74250, 44, 88, 148, 5, 2, 15, 1, 1, 1}, {5, HDMI_HDMI} },
+{ {1440, 240, 27027, 124, 38, 114, 3, 4, 15, 0, 0, 1}, {6, HDMI_HDMI} },
+{ {1920, 1080, 148500, 44, 88, 148, 5, 4, 36, 1, 1, 0}, {16, HDMI_HDMI} },
+{ {720, 576, 27000, 64, 12, 68, 5, 5, 39, 0, 0, 0}, {17, HDMI_HDMI} },
+{ {1280, 720, 74250, 40, 440, 220, 5, 5, 20, 1, 1, 0}, {19, HDMI_HDMI} },
+{ {1920, 540, 74250, 44, 528, 148, 5, 2, 15, 1, 1, 1}, {20, HDMI_HDMI} },
+{ {1440, 288, 27000, 126, 24, 138, 3, 2, 19, 0, 0, 1}, {21, HDMI_HDMI} },
+{ {1440, 576, 54000, 128, 24, 136, 5, 5, 39, 0, 0, 0}, {29, HDMI_HDMI} },
+{ {1920, 1080, 148500, 44, 528, 148, 5, 4, 36, 1, 1, 0}, {31, HDMI_HDMI} },
+{ {1920, 1080, 74250, 44, 638, 148, 5, 4, 36, 1, 1, 0}, {32, HDMI_HDMI} },
+{ {2880, 480, 108108, 248, 64, 240, 6, 9, 30, 0, 0, 0}, {35, HDMI_HDMI} },
+{ {2880, 576, 108000, 256, 48, 272, 5, 5, 39, 0, 0, 0}, {37, HDMI_HDMI} },
+/* VESA From Here */
+{ {640, 480, 25175, 96, 16, 48, 2 , 11, 31, 0, 0, 0}, {4, HDMI_DVI} },
+{ {800, 600, 4, 128, 40, 88, 4 , 1, 23, 1, 1, 0}, {9, HDMI_DVI} },
+{ {848, 480, 33750, 112, 16, 112, 8 , 6, 23, 1, 1, 0}, {0xE, HDMI_DVI} },
+{ {1280, 768, 79500, 128, 64, 192, 7 , 3, 20, 1, 0, 0}, {0x17, HDMI_DVI} },
+{ {1280, 800, 83500, 128, 72, 200, 6 , 3, 22, 1, 0, 0}, {0x1C, HDMI_DVI} },
+{ {1360, 768, 85500, 112, 64, 256, 6 , 3, 18, 1, 1, 0}, {0x27, HDMI_DVI} },
+{ {1280, 960, 108000, 112, 96, 312, 3 , 1, 36, 1, 1, 0}, {0x20, HDMI_DVI} },
+{ {1280, 1024, 108000, 112, 48, 248, 3 , 1, 38, 1, 1, 0}, {0x23, HDMI_DVI} },
+{ {1024, 768, 65000, 136, 24, 160, 6, 3, 29, 0, 0, 0}, {0x10, HDMI_DVI} },
+{ {1400, 1050, 121750, 144, 88, 232, 4, 3, 32, 1, 0, 0}, {0x2A, HDMI_DVI} },
+{ {1440, 900, 106500, 152, 80, 232, 6, 3, 

[PATCHv3 5/5] OMAPDSS: HDMI: Add support to dump clocks through

2011-09-23 Thread mythripk
From: Mythri P K mythr...@ti.com

Add support to dump the HDMI PLL dividers such as regm, regn etc
and other clock dumps such as pixel clock rate, TMDS clock rate.

changes since V2:
Add pixel clock and TMDS clock dump and remove dcofreq and DISPC clock source
print.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss.c  |3 +++
 drivers/video/omap2/dss/dss.h  |1 +
 drivers/video/omap2/dss/hdmi.c |   33 +
 3 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 3e09726..76e2bcd 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -732,6 +732,9 @@ void dss_debug_dump_clocks(struct seq_file *s)
 #ifdef CONFIG_OMAP2_DSS_DSI
dsi_dump_clocks(s);
 #endif
+#ifdef CONFIG_OMAP4_DSS_HDMI
+   hdmi_dump_clocks(s);
+#endif
 }
 #endif
 
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 8652007..ef8770a 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -473,6 +473,7 @@ void hdmi_uninit_platform_driver(void);
 int hdmi_init_display(struct omap_dss_device *dssdev);
 unsigned long hdmi_get_pixel_clock(void);
 void hdmi_dump_regs(struct seq_file *s);
+void hdmi_dump_clocks(struct seq_file *s);
 #else
 static inline int hdmi_init_display(struct omap_dss_device *dssdev)
 {
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 3262f0f..0510655 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -33,6 +33,8 @@
 #include linux/pm_runtime.h
 #include linux/clk.h
 #include video/omapdss.h
+#include linux/seq_file.h
+
 #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
 #include sound/soc.h
@@ -454,6 +456,37 @@ void hdmi_dump_regs(struct seq_file *s)
mutex_unlock(hdmi.lock);
 }
 
+void hdmi_dump_clocks(struct seq_file *s)
+{
+   enum omap_dss_clk_source dispc_clk_src;
+
+   dispc_clk_src = dss_get_dispc_clk_source();
+
+   if (hdmi_runtime_get())
+   return;
+
+   seq_printf(s, - HDMI PLL -\n);
+
+   seq_printf(s, hdmi %s source rate = %lu\n,
+   hdmi.ip_data.pll_data.refsel == HDMI_REFSEL_SYSCLK ?
+   sysclk : pclk/ref1/ref2,
+   clk_get_rate(hdmi.sys_clk));
+
+   seq_printf(s, Pixel clock frequency = %u\n,
+   hdmi.ip_data.cfg.timings.timings.pixel_clock);
+
+   seq_printf(s, TMDS clock frequency = %u\n,
+   10 * hdmi.ip_data.cfg.timings.timings.pixel_clock);
+
+   seq_printf(s, regm\t%u\n, hdmi.ip_data.pll_data.regm);
+
+   seq_printf(s, regmf\t%u\n, hdmi.ip_data.pll_data.regmf);
+
+   seq_printf(s, regsd\t%u\n, hdmi.ip_data.pll_data.regsd);
+
+   hdmi_runtime_put();
+}
+
 int omapdss_hdmi_read_edid(u8 *buf, int len)
 {
int r;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv3 4/4] OMAPDSS: HDMI: Add support to dump registers

2011-09-23 Thread mythripk
From: Mythri P K mythr...@ti.com

Add support to dump the HDMI wrapper, core, PLL and PHY registers
through debugfs.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/core.c|4 +
 drivers/video/omap2/dss/dss.h |1 +
 drivers/video/omap2/dss/dss_features.c|5 +
 drivers/video/omap2/dss/hdmi.c|   16 +++
 drivers/video/omap2/dss/ti_hdmi.h |   14 +++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |  173 +
 6 files changed, 213 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 76821fe..86ec12e 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -145,6 +145,10 @@ static int dss_initialize_debugfs(void)
debugfs_create_file(venc, S_IRUGO, dss_debugfs_dir,
venc_dump_regs, dss_debug_fops);
 #endif
+#ifdef CONFIG_OMAP4_DSS_HDMI
+   debugfs_create_file(hdmi, S_IRUGO, dss_debugfs_dir,
+   hdmi_dump_regs, dss_debug_fops);
+#endif
return 0;
 }
 
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 47eebd8..8652007 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -472,6 +472,7 @@ int hdmi_init_platform_driver(void);
 void hdmi_uninit_platform_driver(void);
 int hdmi_init_display(struct omap_dss_device *dssdev);
 unsigned long hdmi_get_pixel_clock(void);
+void hdmi_dump_regs(struct seq_file *s);
 #else
 static inline int hdmi_init_display(struct omap_dss_device *dssdev)
 {
diff --git a/drivers/video/omap2/dss/dss_features.c 
b/drivers/video/omap2/dss/dss_features.c
index 47e66d8..a2fc8e0 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -447,6 +447,11 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
.pll_enable =   ti_hdmi_4xxx_pll_enable,
.pll_disable=   ti_hdmi_4xxx_pll_disable,
.video_enable   =   ti_hdmi_4xxx_wp_video_start,
+   .dump_wrapper   =   ti_hdmi_4xxx_wp_dump,
+   .dump_core  =   ti_hdmi_4xxx_core_dump,
+   .dump_pll   =   ti_hdmi_4xxx_pll_dump,
+   .dump_phy   =   ti_hdmi_4xxx_phy_dump,
+
 };
 
 void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 2f554ae..3262f0f 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -438,6 +438,22 @@ void omapdss_hdmi_display_set_timing(struct 
omap_dss_device *dssdev)
}
 }
 
+void hdmi_dump_regs(struct seq_file *s)
+{
+   mutex_lock(hdmi.lock);
+
+   if (hdmi_runtime_get())
+   return;
+
+   hdmi.ip_data.ops-dump_wrapper(hdmi.ip_data, s);
+   hdmi.ip_data.ops-dump_pll(hdmi.ip_data, s);
+   hdmi.ip_data.ops-dump_phy(hdmi.ip_data, s);
+   hdmi.ip_data.ops-dump_core(hdmi.ip_data, s);
+
+   hdmi_runtime_put();
+   mutex_unlock(hdmi.lock);
+}
+
 int omapdss_hdmi_read_edid(u8 *buf, int len)
 {
int r;
diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index d48603c..2c3443d 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -101,6 +101,15 @@ struct ti_hdmi_ip_ops {
void (*pll_disable)(struct hdmi_ip_data *ip_data);
 
void (*video_enable)(struct hdmi_ip_data *ip_data, bool start);
+
+   void (*dump_wrapper)(struct hdmi_ip_data *ip_data, struct seq_file *s);
+
+   void (*dump_core)(struct hdmi_ip_data *ip_data, struct seq_file *s);
+
+   void (*dump_pll)(struct hdmi_ip_data *ip_data, struct seq_file *s);
+
+   void (*dump_phy)(struct hdmi_ip_data *ip_data, struct seq_file *s);
+
 };
 
 struct hdmi_ip_data {
@@ -121,4 +130,9 @@ void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data 
*ip_data, bool start);
 int ti_hdmi_4xxx_pll_enable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data);
+void ti_hdmi_4xxx_wp_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+void ti_hdmi_4xxx_pll_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 5f22d2e..e1a6ce5 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -27,6 +27,7 @@
 #include linux/mutex.h
 #include linux/delay.h
 #include linux/string.h
+#include linux/seq_file.h
 
 #include ti_hdmi_4xxx_ip.h
 #include dss.h
@@ -805,6 +806,178 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)

[PATCH v2 1/5] OMAPDSS: HDMI: Move the comments in avi infoframe

2011-09-22 Thread mythripk
From: Mythri P K mythr...@ti.com

Move the comments in AVI infoframe structure above each parameter
to align with other comments in the header file

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |   34 ++--
 1 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 929de88..de1e199 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -455,40 +455,40 @@ struct hdmi_core_video_config {
  * details about infoframe databytes
  */
 struct hdmi_core_infoframe_avi {
+   /* Y0, Y1 rgb,yCbCr */
u8  db1_format;
-   /* Y0, Y1 rgb,yCbCr */
+   /* A0  Active information Present */
u8  db1_active_info;
-   /* A0  Active information Present */
+   /* B0, B1 Bar info data valid */
u8  db1_bar_info_dv;
-   /* B0, B1 Bar info data valid */
+   /* S0, S1 scan information */
u8  db1_scan_info;
-   /* S0, S1 scan information */
+   /* C0, C1 colorimetry */
u8  db2_colorimetry;
-   /* C0, C1 colorimetry */
+   /* M0, M1 Aspect ratio (4:3, 16:9) */
u8  db2_aspect_ratio;
-   /* M0, M1 Aspect ratio (4:3, 16:9) */
+   /* R0...R3 Active format aspect ratio */
u8  db2_active_fmt_ar;
-   /* R0...R3 Active format aspect ratio */
+   /* ITC IT content. */
u8  db3_itc;
-   /* ITC IT content. */
+   /* EC0, EC1, EC2 Extended colorimetry */
u8  db3_ec;
-   /* EC0, EC1, EC2 Extended colorimetry */
+   /* Q1, Q0 Quantization range */
u8  db3_q_range;
-   /* Q1, Q0 Quantization range */
+   /* SC1, SC0 Non-uniform picture scaling */
u8  db3_nup_scaling;
-   /* SC1, SC0 Non-uniform picture scaling */
+   /* VIC0..6 Video format identification */
u8  db4_videocode;
-   /* VIC0..6 Video format identification */
+   /* PR0..PR3 Pixel repetition factor */
u8  db5_pixel_repeat;
-   /* PR0..PR3 Pixel repetition factor */
+   /* Line number end of top bar */
u16 db6_7_line_eoftop;
-   /* Line number end of top bar */
+   /* Line number start of bottom bar */
u16 db8_9_line_sofbottom;
-   /* Line number start of bottom bar */
+   /* Pixel number end of left bar */
u16 db10_11_pixel_eofleft;
-   /* Pixel number end of left bar */
+   /* Pixel number start of right bar */
u16 db12_13_pixel_sofright;
-   /* Pixel number start of right bar */
 };
 /*
  * Refer to section 8.2 in HDMI 1.3 specification for
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/5] OMAPDSS: HDMI: Replace hdmi_reg struct with u16

2011-09-22 Thread mythripk
From: Mythri P K mythr...@ti.com

Remove usage of hdmi_reg struct to use u16 instead in the
HDMI IP header file.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   10 +-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |  262 ++---
 2 files changed, 134 insertions(+), 138 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index da7fe50..5f22d2e 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -32,15 +32,15 @@
 #include dss.h
 
 static inline void hdmi_write_reg(void __iomem *base_addr,
-   const struct hdmi_reg idx, u32 val)
+   const u16 idx, u32 val)
 {
-   __raw_writel(val, base_addr + idx.idx);
+   __raw_writel(val, base_addr + idx);
 }
 
 static inline u32 hdmi_read_reg(void __iomem *base_addr,
-   const struct hdmi_reg idx)
+   const u16 idx)
 {
-   return __raw_readl(base_addr + idx.idx);
+   return __raw_readl(base_addr + idx);
 }
 
 static inline void __iomem *hdmi_wp_base(struct hdmi_ip_data *ip_data)
@@ -69,7 +69,7 @@ static inline void __iomem *hdmi_core_sys_base(struct 
hdmi_ip_data *ip_data)
 }
 
 static inline int hdmi_wait_for_bit_change(void __iomem *base_addr,
-   const struct hdmi_reg idx,
+   const u16 idx,
int b2, int b1, u32 val)
 {
u32 t = 0;
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index de1e199..694888a 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -30,142 +30,138 @@
 #include sound/pcm_params.h
 #endif
 
-struct hdmi_reg { u16 idx; };
-
-#define HDMI_REG(idx)  ((const struct hdmi_reg) { idx })
-
 /* HDMI Wrapper */
 
-#define HDMI_WP_REVISION   HDMI_REG(0x0)
-#define HDMI_WP_SYSCONFIG  HDMI_REG(0x10)
-#define HDMI_WP_IRQSTATUS_RAW  HDMI_REG(0x24)
-#define HDMI_WP_IRQSTATUS  HDMI_REG(0x28)
-#define HDMI_WP_PWR_CTRL   HDMI_REG(0x40)
-#define HDMI_WP_IRQENABLE_SET  HDMI_REG(0x2C)
-#define HDMI_WP_VIDEO_CFG  HDMI_REG(0x50)
-#define HDMI_WP_VIDEO_SIZE HDMI_REG(0x60)
-#define HDMI_WP_VIDEO_TIMING_H HDMI_REG(0x68)
-#define HDMI_WP_VIDEO_TIMING_V HDMI_REG(0x6C)
-#define HDMI_WP_WP_CLK HDMI_REG(0x70)
-#define HDMI_WP_AUDIO_CFG  HDMI_REG(0x80)
-#define HDMI_WP_AUDIO_CFG2 HDMI_REG(0x84)
-#define HDMI_WP_AUDIO_CTRL HDMI_REG(0x88)
-#define HDMI_WP_AUDIO_DATA HDMI_REG(0x8C)
+#define HDMI_WP_REVISION   0x0
+#define HDMI_WP_SYSCONFIG  0x10
+#define HDMI_WP_IRQSTATUS_RAW  0x24
+#define HDMI_WP_IRQSTATUS  0x28
+#define HDMI_WP_PWR_CTRL   0x40
+#define HDMI_WP_IRQENABLE_SET  0x2C
+#define HDMI_WP_VIDEO_CFG  0x50
+#define HDMI_WP_VIDEO_SIZE 0x60
+#define HDMI_WP_VIDEO_TIMING_H 0x68
+#define HDMI_WP_VIDEO_TIMING_V 0x6C
+#define HDMI_WP_WP_CLK 0x70
+#define HDMI_WP_AUDIO_CFG  0x80
+#define HDMI_WP_AUDIO_CFG2 0x84
+#define HDMI_WP_AUDIO_CTRL 0x88
+#define HDMI_WP_AUDIO_DATA 0x8C
 
 /* HDMI IP Core System */
 
-#define HDMI_CORE_SYS_VND_IDL  HDMI_REG(0x0)
-#define HDMI_CORE_SYS_DEV_IDL  HDMI_REG(0x8)
-#define HDMI_CORE_SYS_DEV_IDH  HDMI_REG(0xC)
-#define HDMI_CORE_SYS_DEV_REV  HDMI_REG(0x10)
-#define HDMI_CORE_SYS_SRST HDMI_REG(0x14)
-#define HDMI_CORE_CTRL1HDMI_REG(0x20)
-#define HDMI_CORE_SYS_SYS_STAT HDMI_REG(0x24)
-#define HDMI_CORE_SYS_VID_ACEN HDMI_REG(0x124)
-#define HDMI_CORE_SYS_VID_MODE HDMI_REG(0x128)
-#define HDMI_CORE_SYS_INTR_STATE   HDMI_REG(0x1C0)
-#define HDMI_CORE_SYS_INTR1HDMI_REG(0x1C4)
-#define HDMI_CORE_SYS_INTR2HDMI_REG(0x1C8)
-#define HDMI_CORE_SYS_INTR3HDMI_REG(0x1CC)
-#define HDMI_CORE_SYS_INTR4HDMI_REG(0x1D0)
-#define HDMI_CORE_SYS_UMASK1   HDMI_REG(0x1D4)
-#define HDMI_CORE_SYS_TMDS_CTRLHDMI_REG(0x208)
-#define HDMI_CORE_SYS_DE_DLY   HDMI_REG(0xC8)
-#define HDMI_CORE_SYS_DE_CTRL  HDMI_REG(0xCC)
-#define HDMI_CORE_SYS_DE_TOP   HDMI_REG(0xD0)

[PATCH v2 3/5] OMAPDSS: HDMI: Add missing register definitions

2011-09-22 Thread mythripk
From: Mythri P K mythr...@ti.com

Add some of the missing register definitions, which are h/w indexable.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 694888a..2040956 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -100,15 +100,15 @@
 #define HDMI_CORE_AV_AVI_CHSUM 0x10C
 #define HDMI_CORE_AV_AVI_DBYTE(n)  (n * 4 + 0x110)
 #define HDMI_CORE_AV_AVI_DBYTE_NELEMS  15
-#define HDMI_CORE_AV_SPD_DBYTE 0x190
+#define HDMI_CORE_AV_SPD_DBYTE(n)  (n * 4 + 0x190)
 #define HDMI_CORE_AV_SPD_DBYTE_NELEMS  27
 #define HDMI_CORE_AV_AUD_DBYTE(n)  (n * 4 + 0x210)
 #define HDMI_CORE_AV_AUD_DBYTE_NELEMS  10
-#define HDMI_CORE_AV_MPEG_DBYTE0x290
+#define HDMI_CORE_AV_MPEG_DBYTE(n) (n * 4 + 0x290)
 #define HDMI_CORE_AV_MPEG_DBYTE_NELEMS 27
-#define HDMI_CORE_AV_GEN_DBYTE 0x300
+#define HDMI_CORE_AV_GEN_DBYTE(n)  (n * 4 + 0x300)
 #define HDMI_CORE_AV_GEN_DBYTE_NELEMS  31
-#define HDMI_CORE_AV_GEN2_DBYTE0x380
+#define HDMI_CORE_AV_GEN2_DBYTE(n) (n * 4 + 0x380)
 #define HDMI_CORE_AV_GEN2_DBYTE_NELEMS 31
 #define HDMI_CORE_AV_ACR_CTRL  0x4
 #define HDMI_CORE_AV_FREQ_SVAL 0x8
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 5/5] OMAPDSS: HDMI: Add support to dump clocks through

2011-09-22 Thread mythripk
From: Mythri P K mythr...@ti.com

Add support to dump the HDMI regm, regn, and other clock parameters.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss.c  |3 +++
 drivers/video/omap2/dss/dss.h  |1 +
 drivers/video/omap2/dss/hdmi.c |   35 +++
 3 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 3e09726..76e2bcd 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -732,6 +732,9 @@ void dss_debug_dump_clocks(struct seq_file *s)
 #ifdef CONFIG_OMAP2_DSS_DSI
dsi_dump_clocks(s);
 #endif
+#ifdef CONFIG_OMAP4_DSS_HDMI
+   hdmi_dump_clocks(s);
+#endif
 }
 #endif
 
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 8652007..ef8770a 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -473,6 +473,7 @@ void hdmi_uninit_platform_driver(void);
 int hdmi_init_display(struct omap_dss_device *dssdev);
 unsigned long hdmi_get_pixel_clock(void);
 void hdmi_dump_regs(struct seq_file *s);
+void hdmi_dump_clocks(struct seq_file *s);
 #else
 static inline int hdmi_init_display(struct omap_dss_device *dssdev)
 {
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 3262f0f..8930998 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -33,6 +33,8 @@
 #include linux/pm_runtime.h
 #include linux/clk.h
 #include video/omapdss.h
+#include linux/seq_file.h
+
 #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
 #include sound/soc.h
@@ -454,6 +456,39 @@ void hdmi_dump_regs(struct seq_file *s)
mutex_unlock(hdmi.lock);
 }
 
+void hdmi_dump_clocks(struct seq_file *s)
+{
+   enum omap_dss_clk_source dispc_clk_src;
+
+   dispc_clk_src = dss_get_dispc_clk_source();
+
+   if (hdmi_runtime_get())
+   return;
+
+   seq_printf(s, - HDMI PLL -\n);
+
+   seq_printf(s, regm\t%u\n, hdmi.ip_data.pll_data.regm);
+
+   seq_printf(s, regmf\t%u\n, hdmi.ip_data.pll_data.regmf);
+
+   seq_printf(s, dcofreq\t%u\n, hdmi.ip_data.pll_data.dcofreq);
+
+   seq_printf(s, regsd\t%u\n, hdmi.ip_data.pll_data.regsd);
+
+   seq_printf(s, DISPC clock source %s (%s)\t(%s)\n,
+   dss_get_generic_clk_source_name(dispc_clk_src),
+   dss_feat_get_clk_source_name(dispc_clk_src),
+   dispc_clk_src == OMAP_DSS_CLK_SRC_FCK ?
+   off : on);
+
+   seq_printf(s, hdmi %s source rate = %lu\n,
+   hdmi.ip_data.pll_data.refsel == HDMI_REFSEL_SYSCLK ?
+   sysclk : pclk/ref1/ref2,
+   clk_get_rate(hdmi.sys_clk));
+
+   hdmi_runtime_put();
+}
+
 int omapdss_hdmi_read_edid(u8 *buf, int len)
 {
int r;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 4/5] OMAPDSS: HDMI: Add support to dump registers through

2011-09-22 Thread mythripk
From: Mythri P K mythr...@ti.com

Add support to dump the HDMI wrapper ,core, PLL and PHY registers
through debugfs

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/core.c|4 +
 drivers/video/omap2/dss/dss.h |1 +
 drivers/video/omap2/dss/dss_features.c|5 +
 drivers/video/omap2/dss/hdmi.c|   16 +++
 drivers/video/omap2/dss/ti_hdmi.h |   14 +++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |  173 +
 6 files changed, 213 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 76821fe..86ec12e 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -145,6 +145,10 @@ static int dss_initialize_debugfs(void)
debugfs_create_file(venc, S_IRUGO, dss_debugfs_dir,
venc_dump_regs, dss_debug_fops);
 #endif
+#ifdef CONFIG_OMAP4_DSS_HDMI
+   debugfs_create_file(hdmi, S_IRUGO, dss_debugfs_dir,
+   hdmi_dump_regs, dss_debug_fops);
+#endif
return 0;
 }
 
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 47eebd8..8652007 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -472,6 +472,7 @@ int hdmi_init_platform_driver(void);
 void hdmi_uninit_platform_driver(void);
 int hdmi_init_display(struct omap_dss_device *dssdev);
 unsigned long hdmi_get_pixel_clock(void);
+void hdmi_dump_regs(struct seq_file *s);
 #else
 static inline int hdmi_init_display(struct omap_dss_device *dssdev)
 {
diff --git a/drivers/video/omap2/dss/dss_features.c 
b/drivers/video/omap2/dss/dss_features.c
index 47e66d8..a2fc8e0 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -447,6 +447,11 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
.pll_enable =   ti_hdmi_4xxx_pll_enable,
.pll_disable=   ti_hdmi_4xxx_pll_disable,
.video_enable   =   ti_hdmi_4xxx_wp_video_start,
+   .dump_wrapper   =   ti_hdmi_4xxx_wp_dump,
+   .dump_core  =   ti_hdmi_4xxx_core_dump,
+   .dump_pll   =   ti_hdmi_4xxx_pll_dump,
+   .dump_phy   =   ti_hdmi_4xxx_phy_dump,
+
 };
 
 void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 2f554ae..3262f0f 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -438,6 +438,22 @@ void omapdss_hdmi_display_set_timing(struct 
omap_dss_device *dssdev)
}
 }
 
+void hdmi_dump_regs(struct seq_file *s)
+{
+   mutex_lock(hdmi.lock);
+
+   if (hdmi_runtime_get())
+   return;
+
+   hdmi.ip_data.ops-dump_wrapper(hdmi.ip_data, s);
+   hdmi.ip_data.ops-dump_pll(hdmi.ip_data, s);
+   hdmi.ip_data.ops-dump_phy(hdmi.ip_data, s);
+   hdmi.ip_data.ops-dump_core(hdmi.ip_data, s);
+
+   hdmi_runtime_put();
+   mutex_unlock(hdmi.lock);
+}
+
 int omapdss_hdmi_read_edid(u8 *buf, int len)
 {
int r;
diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index d48603c..2c3443d 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -101,6 +101,15 @@ struct ti_hdmi_ip_ops {
void (*pll_disable)(struct hdmi_ip_data *ip_data);
 
void (*video_enable)(struct hdmi_ip_data *ip_data, bool start);
+
+   void (*dump_wrapper)(struct hdmi_ip_data *ip_data, struct seq_file *s);
+
+   void (*dump_core)(struct hdmi_ip_data *ip_data, struct seq_file *s);
+
+   void (*dump_pll)(struct hdmi_ip_data *ip_data, struct seq_file *s);
+
+   void (*dump_phy)(struct hdmi_ip_data *ip_data, struct seq_file *s);
+
 };
 
 struct hdmi_ip_data {
@@ -121,4 +130,9 @@ void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data 
*ip_data, bool start);
 int ti_hdmi_4xxx_pll_enable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data);
+void ti_hdmi_4xxx_wp_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+void ti_hdmi_4xxx_pll_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 5f22d2e..e1a6ce5 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -27,6 +27,7 @@
 #include linux/mutex.h
 #include linux/delay.h
 #include linux/string.h
+#include linux/seq_file.h
 
 #include ti_hdmi_4xxx_ip.h
 #include dss.h
@@ -805,6 +806,178 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)

[PATCH 1/3] OMAPDSS: HDMI: Move Avi infoframe structure to

2011-09-22 Thread mythripk
From: Mythri P K mythr...@ti.com

With AVI infoframe various parameters of video stream such as
aspect ratio, quantization range, videocode etc will be indicated
from source to sink.Thus AVI information needs to be set/accessed
by the middle ware based on the video content.
Thus this parameter is now moved to the ip_data structure.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |   42 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |8 +++---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |   40 ---
 3 files changed, 46 insertions(+), 44 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 2c3443d..f28f779 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -112,6 +112,47 @@ struct ti_hdmi_ip_ops {
 
 };
 
+/*
+ * Refer to section 8.2 in HDMI 1.3 specification for
+ * details about infoframe databytes
+ */
+struct hdmi_core_infoframe_avi {
+   /* Y0, Y1 rgb,yCbCr */
+   u8  db1_format;
+   /* A0  Active information Present */
+   u8  db1_active_info;
+   /* B0, B1 Bar info data valid */
+   u8  db1_bar_info_dv;
+   /* S0, S1 scan information */
+   u8  db1_scan_info;
+   /* C0, C1 colorimetry */
+   u8  db2_colorimetry;
+   /* M0, M1 Aspect ratio (4:3, 16:9) */
+   u8  db2_aspect_ratio;
+   /* R0...R3 Active format aspect ratio */
+   u8  db2_active_fmt_ar;
+   /* ITC IT content. */
+   u8  db3_itc;
+   /* EC0, EC1, EC2 Extended colorimetry */
+   u8  db3_ec;
+   /* Q1, Q0 Quantization range */
+   u8  db3_q_range;
+   /* SC1, SC0 Non-uniform picture scaling */
+   u8  db3_nup_scaling;
+   /* VIC0..6 Video format identification */
+   u8  db4_videocode;
+   /* PR0..PR3 Pixel repetition factor */
+   u8  db5_pixel_repeat;
+   /* Line number end of top bar */
+   u16 db6_7_line_eoftop;
+   /* Line number start of bottom bar */
+   u16 db8_9_line_sofbottom;
+   /* Pixel number end of left bar */
+   u16 db10_11_pixel_eofleft;
+   /* Pixel number start of right bar */
+   u16 db12_13_pixel_sofright;
+};
+
 struct hdmi_ip_data {
void __iomem*base_wp;   /* HDMI wrapper */
unsigned long   core_sys_offset;
@@ -121,6 +162,7 @@ struct hdmi_ip_data {
const struct ti_hdmi_ip_ops *ops;
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
+   struct hdmi_core_infoframe_avi avi_cfg;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void 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 e1a6ce5..7b0dcd2 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -534,12 +534,12 @@ static void hdmi_core_video_config(struct hdmi_ip_data 
*ip_data,
HDMI_CORE_SYS_TMDS_CTRL, cfg-tclk_sel_clkmult, 6, 5);
 }
 
-static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data,
-   struct hdmi_core_infoframe_avi info_avi)
+static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data)
 {
u32 val;
char sum = 0, checksum = 0;
void __iomem *av_base = hdmi_av_base(ip_data);
+   struct hdmi_core_infoframe_avi info_avi = ip_data-avi_cfg;
 
sum += 0x82 + 0x002 + 0x00D;
hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082);
@@ -727,7 +727,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
struct hdmi_video_format video_format;
struct hdmi_video_interface video_interface;
/* HDMI core */
-   struct hdmi_core_infoframe_avi avi_cfg;
+   struct hdmi_core_infoframe_avi avi_cfg = ip_data-avi_cfg;
struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg;
struct hdmi_config *cfg = ip_data-cfg;
@@ -795,7 +795,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
avi_cfg.db10_11_pixel_eofleft = 0;
avi_cfg.db12_13_pixel_sofright = 0;
 
-   hdmi_core_aux_infoframe_avi_config(ip_data, avi_cfg);
+   hdmi_core_aux_infoframe_avi_config(ip_data);
 
/* enable/repeat the infoframe */
repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 2040956..9f383c9 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -450,46 +450,6 @@ struct hdmi_core_video_config {
  * Refer to section 8.2 in HDMI 1.3 specification for
  * details about infoframe databytes
  */
-struct hdmi_core_infoframe_avi {
-   /* Y0, Y1 rgb,yCbCr */
-   u8  db1_format;
-  

[PATCH 2/3] OMAPDSS: HDMI: Add support to configure quantization

2011-09-22 Thread mythripk
From: Mythri P K mythr...@ti.com

Configure the IP to support the limited range and full range quantization
mode. If the full range is configured HDMI transmitter will expand the range
of pixel data from 16-235 to full 8 bit 0-235.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |7 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   40 +
 2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index f28f779..ec30961 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -42,6 +42,11 @@ enum hdmi_clk_refsel {
HDMI_REFSEL_SYSCLK = 3
 };
 
+enum hdmi_range {
+   HDMI_LIMITED_RANGE = 0,
+   HDMI_FULL_RANGE = 1,
+};
+
 struct hdmi_video_timings {
u16 x_res;
u16 y_res;
@@ -163,6 +168,7 @@ struct hdmi_ip_data {
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
struct hdmi_core_infoframe_avi avi_cfg;
+   enum hdmi_range range;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
@@ -176,5 +182,6 @@ void ti_hdmi_4xxx_wp_dump(struct hdmi_ip_data *ip_data, 
struct seq_file *s);
 void ti_hdmi_4xxx_pll_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
 void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
 void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data);
 
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 7b0dcd2..e30fb22 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -610,6 +610,46 @@ static void hdmi_core_aux_infoframe_avi_config(struct 
hdmi_ip_data *ip_data)
hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_CHSUM, checksum);
 }
 
+int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data)
+{
+   int var;
+
+   switch (ip_data-range) {
+   /*
+* Setting the AVI infroframe to respective limited range
+* 0 if limited range 1 if full range
+*/
+   case HDMI_LIMITED_RANGE:
+   ip_data-avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_LR;
+   hdmi_core_aux_infoframe_avi_config(ip_data);
+   var = hdmi_read_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_ACEN);
+   var = FLD_MOD(var, 1, 1, 1);
+   hdmi_write_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_ACEN, var);
+   break;
+   case HDMI_FULL_RANGE:
+   default:
+   /* HDMI 1.3 section 6.6 YCBCR components shall
+* always be Limited Range
+*/
+   if (ip_data-avi_cfg.db1_format ==
+   HDMI_INFOFRAME_AVI_DB1Y_YUV422) {
+   pr_err(Only limited range is supported for YUV);
+   return -EINVAL;
+   }
+   ip_data-avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_FR;
+   hdmi_core_aux_infoframe_avi_config(ip_data);
+   var = hdmi_read_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_MODE);
+   var = FLD_MOD(var, 1, 4, 4);
+   hdmi_write_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_MODE, var);
+   break;
+   }
+   return 0;
+}
+
 static void hdmi_core_av_packet_config(struct hdmi_ip_data *ip_data,
struct hdmi_core_packet_enable_repeat repeat_cfg)
 {
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] OMAPDSS: HDMI: Add sysfs support to configure

2011-09-22 Thread mythripk
From: Mythri P K mythr...@ti.com

Add sysfs support for the uset space to configure limited range or full range
quantization for HDMI.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss.h  |2 +
 drivers/video/omap2/dss/dss_features.c |1 +
 drivers/video/omap2/dss/hdmi.c |   28 +
 drivers/video/omap2/dss/hdmi_panel.c   |   35 +++-
 drivers/video/omap2/dss/ti_hdmi.h  |2 +
 5 files changed, 67 insertions(+), 1 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index ef8770a..bcfb5fa 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -499,6 +499,8 @@ int omapdss_hdmi_display_check_timing(struct 
omap_dss_device *dssdev,
struct omap_video_timings *timings);
 int omapdss_hdmi_read_edid(u8 *buf, int len);
 bool omapdss_hdmi_detect(void);
+int omapdss_hdmi_get_range(void);
+int omapdss_hdmi_set_range(int range);
 int hdmi_panel_init(void);
 void hdmi_panel_exit(void);
 
diff --git a/drivers/video/omap2/dss/dss_features.c 
b/drivers/video/omap2/dss/dss_features.c
index a2fc8e0..8303ea2 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -451,6 +451,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
.dump_core  =   ti_hdmi_4xxx_core_dump,
.dump_pll   =   ti_hdmi_4xxx_pll_dump,
.dump_phy   =   ti_hdmi_4xxx_phy_dump,
+   .configure_range=   ti_hdmi_4xxx_configure_range,
 
 };
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 8930998..ff33cb2 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -407,6 +407,34 @@ static void hdmi_power_off(struct omap_dss_device *dssdev)
hdmi_runtime_put();
 }
 
+int omapdss_hdmi_set_range(int range)
+{
+   int r = 0;
+   enum hdmi_range old_range;
+
+   old_range = hdmi.ip_data.range;
+   hdmi.ip_data.range = range;
+
+   /* HDMI 1.3 section 6.6 VGA (640x480) format requires Full Range */
+   if ((range == 0) 
+   ((hdmi.ip_data.cfg.cm.code == 4 
+   hdmi.ip_data.cfg.cm.mode == HDMI_DVI) ||
+   (hdmi.ip_data.cfg.cm.code == 1 
+   hdmi.ip_data.cfg.cm.mode == HDMI_HDMI)))
+   return -EINVAL;
+
+   r = hdmi.ip_data.ops-configure_range(hdmi.ip_data);
+   if (r)
+   hdmi.ip_data.range = old_range;
+
+   return r;
+}
+
+int omapdss_hdmi_get_range(void)
+{
+   return hdmi.ip_data.range;
+}
+
 int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
struct omap_video_timings *timings)
 {
diff --git a/drivers/video/omap2/dss/hdmi_panel.c 
b/drivers/video/omap2/dss/hdmi_panel.c
index 533d5dc..c0aa922 100644
--- a/drivers/video/omap2/dss/hdmi_panel.c
+++ b/drivers/video/omap2/dss/hdmi_panel.c
@@ -33,6 +33,33 @@ static struct {
struct mutex hdmi_lock;
 } hdmi;
 
+static ssize_t hdmi_range_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   int r;
+
+   r = omapdss_hdmi_get_range();
+   return snprintf(buf, PAGE_SIZE, %d\n, r);
+}
+
+static ssize_t hdmi_range_store(struct device *dev,
+   struct device_attribute *attr,
+   const char *buf, size_t size)
+{
+   unsigned long range;
+   int r = kstrtoul(buf, 0, range);
+
+   if (r || range  1)
+   return -EINVAL;
+
+   r = omapdss_hdmi_set_range(range);
+   if (r)
+   return r;
+
+   return size;
+}
+
+static DEVICE_ATTR(range, S_IRUGO | S_IWUSR, hdmi_range_show, 
hdmi_range_store);
 
 static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 {
@@ -41,6 +68,12 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
dssdev-panel.config = OMAP_DSS_LCD_TFT |
OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS;
 
+   /* sysfs entry to provide user space control to set
+* quantization range
+*/
+   if (device_create_file(dssdev-dev, dev_attr_range))
+   DSSERR(failed to create sysfs file\n);
+
dssdev-panel.timings = (struct omap_video_timings){640, 480, 25175, 
96, 16, 48, 2 , 11, 31};
 
DSSDBG(hdmi_panel_probe x_res= %d y_res = %d\n,
@@ -51,7 +84,7 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 
 static void hdmi_panel_remove(struct omap_dss_device *dssdev)
 {
-
+   device_remove_file(dssdev-dev, dev_attr_range);
 }
 
 static int hdmi_panel_enable(struct omap_dss_device *dssdev)
diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index ec30961..4e2418e 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -115,6 +115,8 @@ struct ti_hdmi_ip_ops {
 
void (*dump_phy)(struct 

[PATCH 0/5] OMAPDSS: HDMI: Debug support and Register cleanup

2011-09-20 Thread mythripk
From: Mythri P K mythr...@ti.com

Add support to dump HDMI core, wrapper, PHY and PLL registers and the clock
dividers for HDMI.
Some changes such as 
1.Add some H/w indexable registers missed in definition.
2.Remove usage of struct hdmi_reg and use u16 instead.
3.Move the avi_infoframe parameters comments above the field.
are also added as a part of this patch series.

Mythri P K (5):
  OMAPDSS: HDMI: Move the comments in avi infoframe structure
  OMAPDSS: HDMI: Replace hdmi_reg struct with u16
  OMAPDSS: HDMI: Add missing register definitions
  OMAPDSS: HDMI: Add support to dump registers through debugfs
  OMAPDSS: HDMI: Add support to dump clocks through debugfs

 drivers/video/omap2/dss/core.c|4 +
 drivers/video/omap2/dss/dss.c |3 +
 drivers/video/omap2/dss/dss.h |2 +
 drivers/video/omap2/dss/dss_features.c|5 +
 drivers/video/omap2/dss/hdmi.c|   47 +
 drivers/video/omap2/dss/ti_hdmi.h |   14 ++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |  178 +-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |  296 ++---
 8 files changed, 394 insertions(+), 155 deletions(-)

-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] OMAPDSS: HDMI: Move the comments in avi infoframe

2011-09-20 Thread mythripk
From: Mythri P K mythr...@ti.com

Move the comments in AVI infoframe structure above each parameter
to align with other comments in the header file

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |   34 ++--
 1 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 929de88..de1e199 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -455,40 +455,40 @@ struct hdmi_core_video_config {
  * details about infoframe databytes
  */
 struct hdmi_core_infoframe_avi {
+   /* Y0, Y1 rgb,yCbCr */
u8  db1_format;
-   /* Y0, Y1 rgb,yCbCr */
+   /* A0  Active information Present */
u8  db1_active_info;
-   /* A0  Active information Present */
+   /* B0, B1 Bar info data valid */
u8  db1_bar_info_dv;
-   /* B0, B1 Bar info data valid */
+   /* S0, S1 scan information */
u8  db1_scan_info;
-   /* S0, S1 scan information */
+   /* C0, C1 colorimetry */
u8  db2_colorimetry;
-   /* C0, C1 colorimetry */
+   /* M0, M1 Aspect ratio (4:3, 16:9) */
u8  db2_aspect_ratio;
-   /* M0, M1 Aspect ratio (4:3, 16:9) */
+   /* R0...R3 Active format aspect ratio */
u8  db2_active_fmt_ar;
-   /* R0...R3 Active format aspect ratio */
+   /* ITC IT content. */
u8  db3_itc;
-   /* ITC IT content. */
+   /* EC0, EC1, EC2 Extended colorimetry */
u8  db3_ec;
-   /* EC0, EC1, EC2 Extended colorimetry */
+   /* Q1, Q0 Quantization range */
u8  db3_q_range;
-   /* Q1, Q0 Quantization range */
+   /* SC1, SC0 Non-uniform picture scaling */
u8  db3_nup_scaling;
-   /* SC1, SC0 Non-uniform picture scaling */
+   /* VIC0..6 Video format identification */
u8  db4_videocode;
-   /* VIC0..6 Video format identification */
+   /* PR0..PR3 Pixel repetition factor */
u8  db5_pixel_repeat;
-   /* PR0..PR3 Pixel repetition factor */
+   /* Line number end of top bar */
u16 db6_7_line_eoftop;
-   /* Line number end of top bar */
+   /* Line number start of bottom bar */
u16 db8_9_line_sofbottom;
-   /* Line number start of bottom bar */
+   /* Pixel number end of left bar */
u16 db10_11_pixel_eofleft;
-   /* Pixel number end of left bar */
+   /* Pixel number start of right bar */
u16 db12_13_pixel_sofright;
-   /* Pixel number start of right bar */
 };
 /*
  * Refer to section 8.2 in HDMI 1.3 specification for
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] OMAPDSS: HDMI: Add support to dump registers through

2011-09-20 Thread mythripk
From: Mythri P K mythr...@ti.com

Add support to dump the HDMI core, PLL and PHY registers through debugfs

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/core.c|4 +
 drivers/video/omap2/dss/dss.h |1 +
 drivers/video/omap2/dss/dss_features.c|5 +
 drivers/video/omap2/dss/hdmi.c|   16 +++
 drivers/video/omap2/dss/ti_hdmi.h |   14 +++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |  168 +
 6 files changed, 208 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 76821fe..86ec12e 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -145,6 +145,10 @@ static int dss_initialize_debugfs(void)
debugfs_create_file(venc, S_IRUGO, dss_debugfs_dir,
venc_dump_regs, dss_debug_fops);
 #endif
+#ifdef CONFIG_OMAP4_DSS_HDMI
+   debugfs_create_file(hdmi, S_IRUGO, dss_debugfs_dir,
+   hdmi_dump_regs, dss_debug_fops);
+#endif
return 0;
 }
 
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 47eebd8..8652007 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -472,6 +472,7 @@ int hdmi_init_platform_driver(void);
 void hdmi_uninit_platform_driver(void);
 int hdmi_init_display(struct omap_dss_device *dssdev);
 unsigned long hdmi_get_pixel_clock(void);
+void hdmi_dump_regs(struct seq_file *s);
 #else
 static inline int hdmi_init_display(struct omap_dss_device *dssdev)
 {
diff --git a/drivers/video/omap2/dss/dss_features.c 
b/drivers/video/omap2/dss/dss_features.c
index 47e66d8..a2fc8e0 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -447,6 +447,11 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
.pll_enable =   ti_hdmi_4xxx_pll_enable,
.pll_disable=   ti_hdmi_4xxx_pll_disable,
.video_enable   =   ti_hdmi_4xxx_wp_video_start,
+   .dump_wrapper   =   ti_hdmi_4xxx_wp_dump,
+   .dump_core  =   ti_hdmi_4xxx_core_dump,
+   .dump_pll   =   ti_hdmi_4xxx_pll_dump,
+   .dump_phy   =   ti_hdmi_4xxx_phy_dump,
+
 };
 
 void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 2f554ae..3262f0f 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -438,6 +438,22 @@ void omapdss_hdmi_display_set_timing(struct 
omap_dss_device *dssdev)
}
 }
 
+void hdmi_dump_regs(struct seq_file *s)
+{
+   mutex_lock(hdmi.lock);
+
+   if (hdmi_runtime_get())
+   return;
+
+   hdmi.ip_data.ops-dump_wrapper(hdmi.ip_data, s);
+   hdmi.ip_data.ops-dump_pll(hdmi.ip_data, s);
+   hdmi.ip_data.ops-dump_phy(hdmi.ip_data, s);
+   hdmi.ip_data.ops-dump_core(hdmi.ip_data, s);
+
+   hdmi_runtime_put();
+   mutex_unlock(hdmi.lock);
+}
+
 int omapdss_hdmi_read_edid(u8 *buf, int len)
 {
int r;
diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index d48603c..2c3443d 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -101,6 +101,15 @@ struct ti_hdmi_ip_ops {
void (*pll_disable)(struct hdmi_ip_data *ip_data);
 
void (*video_enable)(struct hdmi_ip_data *ip_data, bool start);
+
+   void (*dump_wrapper)(struct hdmi_ip_data *ip_data, struct seq_file *s);
+
+   void (*dump_core)(struct hdmi_ip_data *ip_data, struct seq_file *s);
+
+   void (*dump_pll)(struct hdmi_ip_data *ip_data, struct seq_file *s);
+
+   void (*dump_phy)(struct hdmi_ip_data *ip_data, struct seq_file *s);
+
 };
 
 struct hdmi_ip_data {
@@ -121,4 +130,9 @@ void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data 
*ip_data, bool start);
 int ti_hdmi_4xxx_pll_enable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data);
+void ti_hdmi_4xxx_wp_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+void ti_hdmi_4xxx_pll_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 5f22d2e..8355c4f 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -27,6 +27,7 @@
 #include linux/mutex.h
 #include linux/delay.h
 #include linux/string.h
+#include linux/seq_file.h
 
 #include ti_hdmi_4xxx_ip.h
 #include dss.h
@@ -805,6 +806,173 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)

[PATCH 3/5] OMAPDSS: HDMI: Add missing register definitions

2011-09-20 Thread mythripk
From: Mythri P K mythr...@ti.com

Add some of the missing register definitions, which are h/w indexable.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 694888a..2040956 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -100,15 +100,15 @@
 #define HDMI_CORE_AV_AVI_CHSUM 0x10C
 #define HDMI_CORE_AV_AVI_DBYTE(n)  (n * 4 + 0x110)
 #define HDMI_CORE_AV_AVI_DBYTE_NELEMS  15
-#define HDMI_CORE_AV_SPD_DBYTE 0x190
+#define HDMI_CORE_AV_SPD_DBYTE(n)  (n * 4 + 0x190)
 #define HDMI_CORE_AV_SPD_DBYTE_NELEMS  27
 #define HDMI_CORE_AV_AUD_DBYTE(n)  (n * 4 + 0x210)
 #define HDMI_CORE_AV_AUD_DBYTE_NELEMS  10
-#define HDMI_CORE_AV_MPEG_DBYTE0x290
+#define HDMI_CORE_AV_MPEG_DBYTE(n) (n * 4 + 0x290)
 #define HDMI_CORE_AV_MPEG_DBYTE_NELEMS 27
-#define HDMI_CORE_AV_GEN_DBYTE 0x300
+#define HDMI_CORE_AV_GEN_DBYTE(n)  (n * 4 + 0x300)
 #define HDMI_CORE_AV_GEN_DBYTE_NELEMS  31
-#define HDMI_CORE_AV_GEN2_DBYTE0x380
+#define HDMI_CORE_AV_GEN2_DBYTE(n) (n * 4 + 0x380)
 #define HDMI_CORE_AV_GEN2_DBYTE_NELEMS 31
 #define HDMI_CORE_AV_ACR_CTRL  0x4
 #define HDMI_CORE_AV_FREQ_SVAL 0x8
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] OMAPDSS: HDMI: Replace hdmi_reg struct with u16

2011-09-20 Thread mythripk
From: Mythri P K mythr...@ti.com

Remove usage of hdmi_reg struct to use u16 instead in the HDMI IP header file.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   10 +-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |  262 ++---
 2 files changed, 134 insertions(+), 138 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index da7fe50..5f22d2e 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -32,15 +32,15 @@
 #include dss.h
 
 static inline void hdmi_write_reg(void __iomem *base_addr,
-   const struct hdmi_reg idx, u32 val)
+   const u16 idx, u32 val)
 {
-   __raw_writel(val, base_addr + idx.idx);
+   __raw_writel(val, base_addr + idx);
 }
 
 static inline u32 hdmi_read_reg(void __iomem *base_addr,
-   const struct hdmi_reg idx)
+   const u16 idx)
 {
-   return __raw_readl(base_addr + idx.idx);
+   return __raw_readl(base_addr + idx);
 }
 
 static inline void __iomem *hdmi_wp_base(struct hdmi_ip_data *ip_data)
@@ -69,7 +69,7 @@ static inline void __iomem *hdmi_core_sys_base(struct 
hdmi_ip_data *ip_data)
 }
 
 static inline int hdmi_wait_for_bit_change(void __iomem *base_addr,
-   const struct hdmi_reg idx,
+   const u16 idx,
int b2, int b1, u32 val)
 {
u32 t = 0;
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index de1e199..694888a 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -30,142 +30,138 @@
 #include sound/pcm_params.h
 #endif
 
-struct hdmi_reg { u16 idx; };
-
-#define HDMI_REG(idx)  ((const struct hdmi_reg) { idx })
-
 /* HDMI Wrapper */
 
-#define HDMI_WP_REVISION   HDMI_REG(0x0)
-#define HDMI_WP_SYSCONFIG  HDMI_REG(0x10)
-#define HDMI_WP_IRQSTATUS_RAW  HDMI_REG(0x24)
-#define HDMI_WP_IRQSTATUS  HDMI_REG(0x28)
-#define HDMI_WP_PWR_CTRL   HDMI_REG(0x40)
-#define HDMI_WP_IRQENABLE_SET  HDMI_REG(0x2C)
-#define HDMI_WP_VIDEO_CFG  HDMI_REG(0x50)
-#define HDMI_WP_VIDEO_SIZE HDMI_REG(0x60)
-#define HDMI_WP_VIDEO_TIMING_H HDMI_REG(0x68)
-#define HDMI_WP_VIDEO_TIMING_V HDMI_REG(0x6C)
-#define HDMI_WP_WP_CLK HDMI_REG(0x70)
-#define HDMI_WP_AUDIO_CFG  HDMI_REG(0x80)
-#define HDMI_WP_AUDIO_CFG2 HDMI_REG(0x84)
-#define HDMI_WP_AUDIO_CTRL HDMI_REG(0x88)
-#define HDMI_WP_AUDIO_DATA HDMI_REG(0x8C)
+#define HDMI_WP_REVISION   0x0
+#define HDMI_WP_SYSCONFIG  0x10
+#define HDMI_WP_IRQSTATUS_RAW  0x24
+#define HDMI_WP_IRQSTATUS  0x28
+#define HDMI_WP_PWR_CTRL   0x40
+#define HDMI_WP_IRQENABLE_SET  0x2C
+#define HDMI_WP_VIDEO_CFG  0x50
+#define HDMI_WP_VIDEO_SIZE 0x60
+#define HDMI_WP_VIDEO_TIMING_H 0x68
+#define HDMI_WP_VIDEO_TIMING_V 0x6C
+#define HDMI_WP_WP_CLK 0x70
+#define HDMI_WP_AUDIO_CFG  0x80
+#define HDMI_WP_AUDIO_CFG2 0x84
+#define HDMI_WP_AUDIO_CTRL 0x88
+#define HDMI_WP_AUDIO_DATA 0x8C
 
 /* HDMI IP Core System */
 
-#define HDMI_CORE_SYS_VND_IDL  HDMI_REG(0x0)
-#define HDMI_CORE_SYS_DEV_IDL  HDMI_REG(0x8)
-#define HDMI_CORE_SYS_DEV_IDH  HDMI_REG(0xC)
-#define HDMI_CORE_SYS_DEV_REV  HDMI_REG(0x10)
-#define HDMI_CORE_SYS_SRST HDMI_REG(0x14)
-#define HDMI_CORE_CTRL1HDMI_REG(0x20)
-#define HDMI_CORE_SYS_SYS_STAT HDMI_REG(0x24)
-#define HDMI_CORE_SYS_VID_ACEN HDMI_REG(0x124)
-#define HDMI_CORE_SYS_VID_MODE HDMI_REG(0x128)
-#define HDMI_CORE_SYS_INTR_STATE   HDMI_REG(0x1C0)
-#define HDMI_CORE_SYS_INTR1HDMI_REG(0x1C4)
-#define HDMI_CORE_SYS_INTR2HDMI_REG(0x1C8)
-#define HDMI_CORE_SYS_INTR3HDMI_REG(0x1CC)
-#define HDMI_CORE_SYS_INTR4HDMI_REG(0x1D0)
-#define HDMI_CORE_SYS_UMASK1   HDMI_REG(0x1D4)
-#define HDMI_CORE_SYS_TMDS_CTRLHDMI_REG(0x208)
-#define HDMI_CORE_SYS_DE_DLY   HDMI_REG(0xC8)
-#define HDMI_CORE_SYS_DE_CTRL  HDMI_REG(0xCC)
-#define HDMI_CORE_SYS_DE_TOP   HDMI_REG(0xD0)

[PATCH 5/5] OMAPDSS: HDMI: Add support to dump clocks through

2011-09-20 Thread mythripk
From: Mythri P K mythr...@ti.com

Add support to dump the HDMI regm, regn, and other clock parameters.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss.c  |3 +++
 drivers/video/omap2/dss/dss.h  |1 +
 drivers/video/omap2/dss/hdmi.c |   31 +++
 3 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 3e09726..816daef 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -732,6 +732,9 @@ void dss_debug_dump_clocks(struct seq_file *s)
 #ifdef CONFIG_OMAP2_DSS_DSI
dsi_dump_clocks(s);
 #endif
+#ifdef CONFIG_OMAP2_DSS_HDMI
+   hdmi_dump_clocks(s);
+#endif
 }
 #endif
 
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 8652007..ef8770a 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -473,6 +473,7 @@ void hdmi_uninit_platform_driver(void);
 int hdmi_init_display(struct omap_dss_device *dssdev);
 unsigned long hdmi_get_pixel_clock(void);
 void hdmi_dump_regs(struct seq_file *s);
+void hdmi_dump_clocks(struct seq_file *s);
 #else
 static inline int hdmi_init_display(struct omap_dss_device *dssdev)
 {
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 3262f0f..6751b1a 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -33,6 +33,8 @@
 #include linux/pm_runtime.h
 #include linux/clk.h
 #include video/omapdss.h
+#include linux/seq_file.h
+
 #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
 #include sound/soc.h
@@ -454,6 +456,35 @@ void hdmi_dump_regs(struct seq_file *s)
mutex_unlock(hdmi.lock);
 }
 
+void hdmi_dump_clocks(struct seq_file *s)
+{
+   enum omap_dss_clk_source dispc_clk_src;
+
+   dispc_clk_src = dss_get_dispc_clk_source();
+
+   if (hdmi_runtime_get())
+   return;
+
+   seq_printf(s, HDMI Clock Info\n);
+
+   seq_printf(s, regm\t\t%dregmf %u\n,
+   hdmi.ip_data.pll_data.regm, hdmi.ip_data.pll_data.regm);
+
+   seq_printf(s, dcofreq\t%dregsd %u\n,
+   hdmi.ip_data.pll_data.dcofreq,
+   hdmi.ip_data.pll_data.regsd);
+
+   seq_printf(s, %s (%s)\t(%s)\n,
+   dss_get_generic_clk_source_name(dispc_clk_src),
+   dss_feat_get_clk_source_name(dispc_clk_src),
+   dispc_clk_src == OMAP_DSS_CLK_SRC_FCK ?
+   off : on);
+
+   seq_printf(s, hdmi fclk source = %d\n, hdmi.ip_data.pll_data.refsel);
+
+   hdmi_runtime_put();
+}
+
 int omapdss_hdmi_read_edid(u8 *buf, int len)
 {
int r;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] OMAPDSS: HDMI: Register definition cleanup and improvements

2011-09-16 Thread mythripk
From: Mythri P K mythr...@ti.com

1.Add some H/w indexable registers missed in definition.
2.Remove usage of struct hdmi_reg and use u16 instead.
3.Move the avi_infoframe parameters comments above the field.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   10 +-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |  296 ++---
 2 files changed, 151 insertions(+), 155 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index da7fe50..5f22d2e 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -32,15 +32,15 @@
 #include dss.h
 
 static inline void hdmi_write_reg(void __iomem *base_addr,
-   const struct hdmi_reg idx, u32 val)
+   const u16 idx, u32 val)
 {
-   __raw_writel(val, base_addr + idx.idx);
+   __raw_writel(val, base_addr + idx);
 }
 
 static inline u32 hdmi_read_reg(void __iomem *base_addr,
-   const struct hdmi_reg idx)
+   const u16 idx)
 {
-   return __raw_readl(base_addr + idx.idx);
+   return __raw_readl(base_addr + idx);
 }
 
 static inline void __iomem *hdmi_wp_base(struct hdmi_ip_data *ip_data)
@@ -69,7 +69,7 @@ static inline void __iomem *hdmi_core_sys_base(struct 
hdmi_ip_data *ip_data)
 }
 
 static inline int hdmi_wait_for_bit_change(void __iomem *base_addr,
-   const struct hdmi_reg idx,
+   const u16 idx,
int b2, int b1, u32 val)
 {
u32 t = 0;
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 929de88..2040956 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -30,142 +30,138 @@
 #include sound/pcm_params.h
 #endif
 
-struct hdmi_reg { u16 idx; };
-
-#define HDMI_REG(idx)  ((const struct hdmi_reg) { idx })
-
 /* HDMI Wrapper */
 
-#define HDMI_WP_REVISION   HDMI_REG(0x0)
-#define HDMI_WP_SYSCONFIG  HDMI_REG(0x10)
-#define HDMI_WP_IRQSTATUS_RAW  HDMI_REG(0x24)
-#define HDMI_WP_IRQSTATUS  HDMI_REG(0x28)
-#define HDMI_WP_PWR_CTRL   HDMI_REG(0x40)
-#define HDMI_WP_IRQENABLE_SET  HDMI_REG(0x2C)
-#define HDMI_WP_VIDEO_CFG  HDMI_REG(0x50)
-#define HDMI_WP_VIDEO_SIZE HDMI_REG(0x60)
-#define HDMI_WP_VIDEO_TIMING_H HDMI_REG(0x68)
-#define HDMI_WP_VIDEO_TIMING_V HDMI_REG(0x6C)
-#define HDMI_WP_WP_CLK HDMI_REG(0x70)
-#define HDMI_WP_AUDIO_CFG  HDMI_REG(0x80)
-#define HDMI_WP_AUDIO_CFG2 HDMI_REG(0x84)
-#define HDMI_WP_AUDIO_CTRL HDMI_REG(0x88)
-#define HDMI_WP_AUDIO_DATA HDMI_REG(0x8C)
+#define HDMI_WP_REVISION   0x0
+#define HDMI_WP_SYSCONFIG  0x10
+#define HDMI_WP_IRQSTATUS_RAW  0x24
+#define HDMI_WP_IRQSTATUS  0x28
+#define HDMI_WP_PWR_CTRL   0x40
+#define HDMI_WP_IRQENABLE_SET  0x2C
+#define HDMI_WP_VIDEO_CFG  0x50
+#define HDMI_WP_VIDEO_SIZE 0x60
+#define HDMI_WP_VIDEO_TIMING_H 0x68
+#define HDMI_WP_VIDEO_TIMING_V 0x6C
+#define HDMI_WP_WP_CLK 0x70
+#define HDMI_WP_AUDIO_CFG  0x80
+#define HDMI_WP_AUDIO_CFG2 0x84
+#define HDMI_WP_AUDIO_CTRL 0x88
+#define HDMI_WP_AUDIO_DATA 0x8C
 
 /* HDMI IP Core System */
 
-#define HDMI_CORE_SYS_VND_IDL  HDMI_REG(0x0)
-#define HDMI_CORE_SYS_DEV_IDL  HDMI_REG(0x8)
-#define HDMI_CORE_SYS_DEV_IDH  HDMI_REG(0xC)
-#define HDMI_CORE_SYS_DEV_REV  HDMI_REG(0x10)
-#define HDMI_CORE_SYS_SRST HDMI_REG(0x14)
-#define HDMI_CORE_CTRL1HDMI_REG(0x20)
-#define HDMI_CORE_SYS_SYS_STAT HDMI_REG(0x24)
-#define HDMI_CORE_SYS_VID_ACEN HDMI_REG(0x124)
-#define HDMI_CORE_SYS_VID_MODE HDMI_REG(0x128)
-#define HDMI_CORE_SYS_INTR_STATE   HDMI_REG(0x1C0)
-#define HDMI_CORE_SYS_INTR1HDMI_REG(0x1C4)
-#define HDMI_CORE_SYS_INTR2HDMI_REG(0x1C8)
-#define HDMI_CORE_SYS_INTR3HDMI_REG(0x1CC)
-#define HDMI_CORE_SYS_INTR4HDMI_REG(0x1D0)
-#define HDMI_CORE_SYS_UMASK1   HDMI_REG(0x1D4)
-#define HDMI_CORE_SYS_TMDS_CTRLHDMI_REG(0x208)
-#define HDMI_CORE_SYS_DE_DLY   HDMI_REG(0xC8)
-#define HDMI_CORE_SYS_DE_CTRL 

[PATCH 00/10] OMAP4: DSS2: HDMI: Split hdmi.c in DSS to seperate

2011-09-08 Thread mythripk
From: Mythri P K mythr...@ti.com

HDMI IP block is common between TI OMAP4 Procerssor and Netra processor although
the Display subsytem is different. Also the IP block in future OMAP's may differ
from the one existing in OMAP4. Thus to reuse the code between these two
processors , and maintain the multi omap build functionality in DSS,
HDMI IP dependant code is seperated out from hdmi.c and moved to
new library file ti_hdmi_4xxx_ip.c. From the DSS dependent HDMI code only the
function pointer to functionality/features offered by HDMI is called.

This patch series does the split and also renames hdmi_omap4_panel.c to
hdmi_panel.c as that file has nothing specific to OMAP4 and can be reused for
other OMAP family of processors as well.

This patch series is based on Tomi's LO-DSS2 master branch.

changes since
V4: Change the description of patch.
Fix the bug to use refsel in the PLL_CFG2.
Pass parameters to copy_hdmi_to_dss_timings by pointer.
V3: Handle the sparse error for set_pll_pwr function
Move audio functions out of hdmi.c to ip file.
Rename hdmi_data to ip_data 
V2: Rename certain files/function to have standard format.H
Handle scenario when hdmi is disabled.
V1: Add Function pointer approach to call the HDMI IP functions
from DSS HDMI
Mythri P K (10):
  OMAP4: DSS: HDMI: HDMI clean up to pass base_address dynamically to
IP dependant functions of HDMI
  OMAP4: DSS: HDMI: Move pll and video configuration  info to
ip_data structure
  OMAP4: DSS: HDMI: Use specific HDMI timings structure  instead of
OMAP DSS timings
  OMAP4: DSS: HDMI: Move IP independent common header file definition
to generic header file
  OMAP4 : DSS : HDMI : Move the EDID portion from HDMI IP header
  OMAP4: DSS2: HDMI: Split the HDMI driver to DSS and IP   
specific portion.
  OMAP4: DSS2: HDMI: Move the HDMI IP dependent audio functions to IP
library
  OMAP4: DSS: HDMI: Rename the functions in HDMI IP library to IP
specific name
  OMAP4: DSS2: HDMI: Function pointer approach to call  HDMI IP
driver function from DSS
  OMAP4: DSS: Rename hdmi_omap4_panel.c to hdmi_panel.c

 drivers/video/omap2/dss/Makefile   |2 +-
 drivers/video/omap2/dss/dss.h  |   10 -
 drivers/video/omap2/dss/dss_features.c |   20 +
 drivers/video/omap2/dss/dss_features.h |7 +
 drivers/video/omap2/dss/hdmi.c | 1027 ++--
 drivers/video/omap2/dss/hdmi.h |  631 
 .../omap2/dss/{hdmi_omap4_panel.c = hdmi_panel.c} |2 +-
 drivers/video/omap2/dss/ti_hdmi.h  |  123 +++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c  | 1033 
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h  |  597 +++
 10 files changed, 1853 insertions(+), 1599 deletions(-)
 delete mode 100644 drivers/video/omap2/dss/hdmi.h
 rename drivers/video/omap2/dss/{hdmi_omap4_panel.c = hdmi_panel.c} (99%)
 create mode 100644 drivers/video/omap2/dss/ti_hdmi.h
 create mode 100644 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
 create mode 100644 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h

-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/10] OMAP4: DSS: HDMI: HDMI clean up to pass base_address

2011-09-08 Thread mythripk
From: Mythri P K mythr...@ti.com

As the base_address of the HDMI might differ across SoC's, offset of the HDMI
logical blocks(PHY, PLL and Core) and base address procured from the platform 
data are passed dynamically to the functions that modify HDMI IP registers.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |  501 +++-
 drivers/video/omap2/dss/hdmi.h |  292 
 2 files changed, 435 insertions(+), 358 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index b8e02e4..bfd113c 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -43,11 +43,17 @@
 #include hdmi.h
 #include dss_features.h
 
+#define HDMI_WP0x0
+#define HDMI_CORE_SYS  0x400
+#define HDMI_CORE_AV   0x900
+#define HDMI_PLLCTRL   0x200
+#define HDMI_PHY   0x300
+
 static struct {
struct mutex lock;
struct omap_display_platform_data *pdata;
struct platform_device *pdev;
-   void __iomem *base_wp;  /* HDMI wrapper */
+   struct hdmi_ip_data ip_data;
int code;
int mode;
u8 edid[HDMI_EDID_MAX_LENGTH];
@@ -145,21 +151,49 @@ static const int code_vesa[85] = {
 
 static const u8 edid_header[8] = {0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0x0};
 
-static inline void hdmi_write_reg(const struct hdmi_reg idx, u32 val)
+static inline void hdmi_write_reg(void __iomem *base_addr,
+   const struct hdmi_reg idx, u32 val)
+{
+   __raw_writel(val, base_addr + idx.idx);
+}
+
+static inline u32 hdmi_read_reg(void __iomem *base_addr,
+   const struct hdmi_reg idx)
+{
+   return __raw_readl(base_addr + idx.idx);
+}
+
+static inline void __iomem *hdmi_wp_base(struct hdmi_ip_data *ip_data)
+{
+   return ip_data-base_wp;
+}
+
+static inline void __iomem *hdmi_phy_base(struct hdmi_ip_data *ip_data)
 {
-   __raw_writel(val, hdmi.base_wp + idx.idx);
+   return ip_data-base_wp + ip_data-phy_offset;
 }
 
-static inline u32 hdmi_read_reg(const struct hdmi_reg idx)
+static inline void __iomem *hdmi_pll_base(struct hdmi_ip_data *ip_data)
 {
-   return __raw_readl(hdmi.base_wp + idx.idx);
+   return ip_data-base_wp + ip_data-pll_offset;
 }
 
-static inline int hdmi_wait_for_bit_change(const struct hdmi_reg idx,
+static inline void __iomem *hdmi_av_base(struct hdmi_ip_data *ip_data)
+{
+   return ip_data-base_wp + ip_data-core_av_offset;
+}
+
+static inline void __iomem *hdmi_core_sys_base(struct hdmi_ip_data *ip_data)
+{
+   return ip_data-base_wp + ip_data-core_sys_offset;
+}
+
+static inline int hdmi_wait_for_bit_change(void __iomem *base_addr,
+   const struct hdmi_reg idx,
int b2, int b1, u32 val)
 {
u32 t = 0;
-   while (val != REG_GET(idx, b2, b1)) {
+   while (val != REG_GET(base_addr, idx, b2, b1)) {
udelay(1);
if (t++  1)
return !val;
@@ -195,21 +229,23 @@ int hdmi_init_display(struct omap_dss_device *dssdev)
return 0;
 }
 
-static int hdmi_pll_init(enum hdmi_clk_refsel refsel, int dcofreq,
+static int hdmi_pll_init(struct hdmi_ip_data *ip_data,
+   enum hdmi_clk_refsel refsel, int dcofreq,
struct hdmi_pll_info *fmt, u16 sd)
 {
u32 r;
+   void __iomem *pll_base = hdmi_pll_base(ip_data);
 
/* PLL start always use manual mode */
-   REG_FLD_MOD(PLLCTRL_PLL_CONTROL, 0x0, 0, 0);
+   REG_FLD_MOD(pll_base, PLLCTRL_PLL_CONTROL, 0x0, 0, 0);
 
-   r = hdmi_read_reg(PLLCTRL_CFG1);
+   r = hdmi_read_reg(pll_base, PLLCTRL_CFG1);
r = FLD_MOD(r, fmt-regm, 20, 9); /* CFG1_PLL_REGM */
r = FLD_MOD(r, fmt-regn, 8, 1);  /* CFG1_PLL_REGN */
 
-   hdmi_write_reg(PLLCTRL_CFG1, r);
+   hdmi_write_reg(pll_base, PLLCTRL_CFG1, r);
 
-   r = hdmi_read_reg(PLLCTRL_CFG2);
+   r = hdmi_read_reg(pll_base, PLLCTRL_CFG2);
 
r = FLD_MOD(r, 0x0, 12, 12); /* PLL_HIGHFREQ divide by 2 */
r = FLD_MOD(r, 0x1, 13, 13); /* PLL_REFEN */
@@ -217,38 +253,40 @@ static int hdmi_pll_init(enum hdmi_clk_refsel refsel, int 
dcofreq,
 
if (dcofreq) {
/* divider programming for frequency beyond 1000Mhz */
-   REG_FLD_MOD(PLLCTRL_CFG3, sd, 17, 10);
+   REG_FLD_MOD(pll_base, PLLCTRL_CFG3, sd, 17, 10);
r = FLD_MOD(r, 0x4, 3, 1); /* 1000MHz and 2000MHz */
} else {
r = FLD_MOD(r, 0x2, 3, 1); /* 500MHz and 1000MHz */
}
 
-   hdmi_write_reg(PLLCTRL_CFG2, r);
+   hdmi_write_reg(pll_base, PLLCTRL_CFG2, r);
 
-   r = hdmi_read_reg(PLLCTRL_CFG4);
+   r = hdmi_read_reg(pll_base, PLLCTRL_CFG4);
r = FLD_MOD(r, fmt-regm2, 24, 18);
r = FLD_MOD(r, fmt-regmf, 17, 0);
 
-   

[PATCH 02/10] OMAP4: DSS: HDMI: Move pll and video configuration

2011-09-08 Thread mythripk
From: Mythri P K mythr...@ti.com

As the pll and the video configuration info are part of the ip_data, pll
and video structures are moved to the ip_data structure. Also the pll and
video configuration functions are modified accordingly to take care of the
structure movement.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss.h  |8 +++
 drivers/video/omap2/dss/hdmi.c |   42 ++-
 drivers/video/omap2/dss/hdmi.h |   25 +--
 3 files changed, 37 insertions(+), 38 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index a095a62..4cb264e 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -150,6 +150,13 @@ struct dsi_clock_info {
bool use_sys_clk;
 };
 
+enum hdmi_clk_refsel {
+   HDMI_REFSEL_PCLK = 0,
+   HDMI_REFSEL_REF1 = 1,
+   HDMI_REFSEL_REF2 = 2,
+   HDMI_REFSEL_SYSCLK = 3
+};
+
 /* HDMI PLL structure */
 struct hdmi_pll_info {
u16 regn;
@@ -158,6 +165,7 @@ struct hdmi_pll_info {
u16 regm2;
u16 regsd;
u16 dcofreq;
+   enum hdmi_clk_refsel refsel;
 };
 
 struct seq_file;
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index bfd113c..47e9f4a 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -59,7 +59,6 @@ static struct {
u8 edid[HDMI_EDID_MAX_LENGTH];
u8 edid_set;
bool custom_set;
-   struct hdmi_config cfg;
 
struct clk *sys_clk;
 } hdmi;
@@ -229,12 +228,11 @@ int hdmi_init_display(struct omap_dss_device *dssdev)
return 0;
 }
 
-static int hdmi_pll_init(struct hdmi_ip_data *ip_data,
-   enum hdmi_clk_refsel refsel, int dcofreq,
-   struct hdmi_pll_info *fmt, u16 sd)
+static int hdmi_pll_init(struct hdmi_ip_data *ip_data)
 {
u32 r;
void __iomem *pll_base = hdmi_pll_base(ip_data);
+   struct hdmi_pll_info *fmt = ip_data-pll_data;
 
/* PLL start always use manual mode */
REG_FLD_MOD(pll_base, PLLCTRL_PLL_CONTROL, 0x0, 0, 0);
@@ -250,10 +248,11 @@ static int hdmi_pll_init(struct hdmi_ip_data *ip_data,
r = FLD_MOD(r, 0x0, 12, 12); /* PLL_HIGHFREQ divide by 2 */
r = FLD_MOD(r, 0x1, 13, 13); /* PLL_REFEN */
r = FLD_MOD(r, 0x0, 14, 14); /* PHY_CLKINEN de-assert during locking */
+   r = FLD_MOD(r, fmt-refsel, 22, 21); /* REFSEL */
 
-   if (dcofreq) {
+   if (fmt-dcofreq) {
/* divider programming for frequency beyond 1000Mhz */
-   REG_FLD_MOD(pll_base, PLLCTRL_CFG3, sd, 17, 10);
+   REG_FLD_MOD(pll_base, PLLCTRL_CFG3, fmt-regsd, 17, 10);
r = FLD_MOD(r, 0x4, 3, 1); /* 1000MHz and 2000MHz */
} else {
r = FLD_MOD(r, 0x2, 3, 1); /* 500MHz and 1000MHz */
@@ -379,11 +378,9 @@ static int hdmi_phy_init(struct hdmi_ip_data *ip_data)
return 0;
 }
 
-static int hdmi_pll_program(struct hdmi_ip_data *ip_data,
-   struct hdmi_pll_info *fmt)
+static int hdmi_pll_program(struct hdmi_ip_data *ip_data)
 {
u16 r = 0;
-   enum hdmi_clk_refsel refsel;
 
r = hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_ALLOFF);
if (r)
@@ -397,9 +394,7 @@ static int hdmi_pll_program(struct hdmi_ip_data *ip_data,
if (r)
return r;
 
-   refsel = HDMI_REFSEL_SYSCLK;
-
-   r = hdmi_pll_init(ip_data, refsel, fmt-dcofreq, fmt, fmt-regsd);
+   r = hdmi_pll_init(ip_data);
if (r)
return r;
 
@@ -1015,8 +1010,7 @@ static void hdmi_wp_video_config_timing(struct 
hdmi_ip_data *ip_data,
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_TIMING_V, timing_v);
 }
 
-static void hdmi_basic_configure(struct hdmi_ip_data *ip_data,
-   struct hdmi_config *cfg)
+static void hdmi_basic_configure(struct hdmi_ip_data *ip_data)
 {
/* HDMI */
struct omap_video_timings video_timing;
@@ -1026,6 +1020,7 @@ static void hdmi_basic_configure(struct hdmi_ip_data 
*ip_data,
struct hdmi_core_infoframe_avi avi_cfg;
struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg;
+   struct hdmi_config *cfg = ip_data-cfg;
 
hdmi_wp_init(video_timing, video_format,
video_interface);
@@ -1034,8 +1029,7 @@ static void hdmi_basic_configure(struct hdmi_ip_data 
*ip_data,
avi_cfg,
repeat_cfg);
 
-   hdmi_wp_video_init_format(video_format,
-   video_timing, cfg);
+   hdmi_wp_video_init_format(video_format, video_timing, cfg);
 
hdmi_wp_video_config_timing(ip_data, video_timing);
 
@@ -1154,6 +1148,9 @@ static void hdmi_compute_pll(struct omap_dss_device 
*dssdev, int phy,
pi-dcofreq = phy  1000 * 100;
pi-regsd = ((pi-regm * clkin / 10) / ((pi-regn + 1) * 250) + 5) / 10;
 
+   /* 

[PATCH 03/10] OMAP4: DSS: HDMI: Use specific HDMI timings structure

2011-09-08 Thread mythripk
From: Mythri P K mythr...@ti.com

As hdmi has few additional parameters such as vsync and hsync
polarity which is missing in DSS timing structure, define HDMI timings
structure for hdmi to use instead of OMAP DSS timing structure.


Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |   23 ---
 drivers/video/omap2/dss/hdmi.h |   15 ++-
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 47e9f4a..c387bf4 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -534,6 +534,21 @@ static int read_edid(struct hdmi_ip_data *ip_data, u8 
*pedid, u16 max_length)
return 0;
 }
 
+static void copy_hdmi_to_dss_timings(
+   const struct hdmi_video_timings *hdmi_timings,
+   struct omap_video_timings *timings)
+{
+   timings-x_res = hdmi_timings-x_res;
+   timings-y_res = hdmi_timings-y_res;
+   timings-pixel_clock = hdmi_timings-pixel_clock;
+   timings-hbp = hdmi_timings-hbp;
+   timings-hfp = hdmi_timings-hfp;
+   timings-hsw = hdmi_timings-hsw;
+   timings-vbp = hdmi_timings-vbp;
+   timings-vfp = hdmi_timings-vfp;
+   timings-vsw = hdmi_timings-vsw;
+}
+
 static int get_timings_index(void)
 {
int code;
@@ -558,7 +573,7 @@ static struct hdmi_cm hdmi_get_code(struct 
omap_video_timings *timing)
 {
int i = 0, code = -1, temp_vsync = 0, temp_hsync = 0;
int timing_vsync = 0, timing_hsync = 0;
-   struct omap_video_timings temp;
+   struct hdmi_video_timings temp;
struct hdmi_cm cm = {-1};
DSSDBG(hdmi_get_code\n);
 
@@ -716,7 +731,8 @@ static void hdmi_read_edid(struct omap_video_timings *dp)
 
code = get_timings_index();
 
-   *dp = cea_vesa_timings[code].timings;
+   copy_hdmi_to_dss_timings(cea_vesa_timings[code].timings, dp);
+
 }
 
 static void hdmi_core_init(struct hdmi_core_video_config *video_cfg,
@@ -1178,7 +1194,8 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
hdmi_read_edid(p);
}
code = get_timings_index();
-   dssdev-panel.timings = cea_vesa_timings[code].timings;
+   copy_hdmi_to_dss_timings(cea_vesa_timings[code].timings,
+   dssdev-panel.timings);
update_hdmi_timings(hdmi.ip_data.cfg, p, code);
 
phy = p-pixel_clock;
diff --git a/drivers/video/omap2/dss/hdmi.h b/drivers/video/omap2/dss/hdmi.h
index d2913f8..02342f6 100644
--- a/drivers/video/omap2/dss/hdmi.h
+++ b/drivers/video/omap2/dss/hdmi.h
@@ -198,9 +198,22 @@ struct hdmi_reg { u16 idx; };
 #define REG_GET(base, idx, start, end) \
FLD_GET(hdmi_read_reg(base, idx), start, end)
 
+struct hdmi_video_timings {
+   u16 x_res;
+   u16 y_res;
+   /* Unit: KHz */
+   u32 pixel_clock;
+   u16 hsw;
+   u16 hfp;
+   u16 hbp;
+   u16 vsw;
+   u16 vfp;
+   u16 vbp;
+};
+
 /* HDMI timing structure */
 struct hdmi_timings {
-   struct omap_video_timings timings;
+   struct hdmi_video_timings timings;
int vsync_pol;
int hsync_pol;
 };
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/10] OMAP4: DSS: Rename hdmi_omap4_panel.c to hdmi_panel.c

2011-09-08 Thread mythripk
From: Mythri P K mythr...@ti.com

As the panel driver will remain generic across OMAP's renaming it to
hdmi_panel.c

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/Makefile   |2 +-
 .../omap2/dss/{hdmi_omap4_panel.c = hdmi_panel.c} |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
 rename drivers/video/omap2/dss/{hdmi_omap4_panel.c = hdmi_panel.c} (99%)

diff --git a/drivers/video/omap2/dss/Makefile b/drivers/video/omap2/dss/Makefile
index 9627829..bd34ac5 100644
--- a/drivers/video/omap2/dss/Makefile
+++ b/drivers/video/omap2/dss/Makefile
@@ -6,4 +6,4 @@ omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
 omapdss-$(CONFIG_OMAP2_DSS_SDI) += sdi.o
 omapdss-$(CONFIG_OMAP2_DSS_DSI) += dsi.o
 omapdss-$(CONFIG_OMAP4_DSS_HDMI) += hdmi.o \
-   hdmi_omap4_panel.o ti_hdmi_4xxx_ip.o
+   hdmi_panel.o ti_hdmi_4xxx_ip.o
diff --git a/drivers/video/omap2/dss/hdmi_omap4_panel.c 
b/drivers/video/omap2/dss/hdmi_panel.c
similarity index 99%
rename from drivers/video/omap2/dss/hdmi_omap4_panel.c
rename to drivers/video/omap2/dss/hdmi_panel.c
index 7d4f2bd..e30182f 100644
--- a/drivers/video/omap2/dss/hdmi_omap4_panel.c
+++ b/drivers/video/omap2/dss/hdmi_panel.c
@@ -1,5 +1,5 @@
 /*
- * hdmi_omap4_panel.c
+ * hdmi_panel.c
  *
  * HDMI library support functions for TI OMAP4 processors.
  *
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/10] OMAP4: DSS2: HDMI: Function pointer approach to call

2011-09-08 Thread mythripk
From: Mythri P K mythr...@ti.com

HDMI IP fundamentally has replaceable core PHY and PLL blocks.
These blocks might vary across OMAP's but the end functionality such as to
enable or disable PLL, PHY, function to read EDID would remain the same.

Thus to make the current hdmi DSS driver compatible with different OMAP's having
different IP blocks( A combination of different core, PHY, PLL blocks), function
pointer approach is introduced.

With function pointer, relevant IP dependent functions are mapped to the generic
functions used by DSS during the initialization based on the OMAP compiled.
Thus making hdmi DSS driver IP agnostic.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss_features.c |   20 
 drivers/video/omap2/dss/dss_features.h |7 +++
 drivers/video/omap2/dss/hdmi.c |   19 ++-
 drivers/video/omap2/dss/ti_hdmi.h  |   21 +
 4 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/drivers/video/omap2/dss/dss_features.c 
b/drivers/video/omap2/dss/dss_features.c
index b63c5f8..8670612 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -429,6 +429,26 @@ static const struct omap_dss_features omap4_dss_features = 
{
.burst_size_unit = 16,
 };
 
+#if defined(CONFIG_OMAP4_DSS_HDMI)
+/* HDMI OMAP4 Functions*/
+static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
+
+   .video_configure=   ti_hdmi_4xxx_basic_configure,
+   .phy_enable =   ti_hdmi_4xxx_phy_enable,
+   .phy_disable=   ti_hdmi_4xxx_phy_disable,
+   .read_edid  =   ti_hdmi_4xxx_read_edid,
+   .pll_enable =   ti_hdmi_4xxx_pll_enable,
+   .pll_disable=   ti_hdmi_4xxx_pll_disable,
+   .video_enable   =   ti_hdmi_4xxx_wp_video_start,
+};
+
+void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
+{
+   if (cpu_is_omap44xx())
+   ip_data-ops = omap4_hdmi_functions;
+}
+#endif
+
 /* Functions returning values related to a DSS feature */
 int dss_feat_get_num_mgrs(void)
 {
diff --git a/drivers/video/omap2/dss/dss_features.h 
b/drivers/video/omap2/dss/dss_features.h
index 4271e96..e89ae5f 100644
--- a/drivers/video/omap2/dss/dss_features.h
+++ b/drivers/video/omap2/dss/dss_features.h
@@ -20,6 +20,10 @@
 #ifndef __OMAP2_DSS_FEATURES_H
 #define __OMAP2_DSS_FEATURES_H
 
+#if defined(CONFIG_OMAP4_DSS_HDMI)
+#include ti_hdmi.h
+#endif
+
 #define MAX_DSS_MANAGERS   3
 #define MAX_DSS_OVERLAYS   3
 #define MAX_DSS_LCD_MANAGERS   2
@@ -99,4 +103,7 @@ u32 dss_feat_get_burst_size_unit(void);  /* in 
bytes */
 bool dss_has_feature(enum dss_feat_id id);
 void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end);
 void dss_features_init(void);
+#if defined(CONFIG_OMAP4_DSS_HDMI)
+void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data);
+#endif
 #endif
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 5afc51b..8cef940 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -186,6 +186,7 @@ int hdmi_init_display(struct omap_dss_device *dssdev)
 {
DSSDBG(init_display\n);
 
+   dss_init_hdmi_ip_ops(hdmi.ip_data);
return 0;
 }
 
@@ -366,7 +367,7 @@ static void hdmi_read_edid(struct omap_video_timings *dp)
memset(hdmi.edid, 0, HDMI_EDID_MAX_LENGTH);
 
if (!hdmi.edid_set)
-   ret = ti_hdmi_4xxx_read_edid(hdmi.ip_data, hdmi.edid,
+   ret = hdmi.ip_data.ops-read_edid(hdmi.ip_data, hdmi.edid,
HDMI_EDID_MAX_LENGTH);
if (!ret) {
if (!memcmp(hdmi.edid, edid_header, sizeof(edid_header))) {
@@ -480,16 +481,16 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
 
hdmi_compute_pll(dssdev, phy, hdmi.ip_data.pll_data);
 
-   ti_hdmi_4xxx_wp_video_start(hdmi.ip_data, 0);
+   hdmi.ip_data.ops-video_enable(hdmi.ip_data, 0);
 
/* config the PLL and PHY hdmi_set_pll_pwrfirst */
-   r = ti_hdmi_4xxx_pll_enable(hdmi.ip_data);
+   r = hdmi.ip_data.ops-pll_enable(hdmi.ip_data);
if (r) {
DSSDBG(Failed to lock PLL\n);
goto err;
}
 
-   r = ti_hdmi_4xxx_phy_enable(hdmi.ip_data);
+   r = hdmi.ip_data.ops-phy_enable(hdmi.ip_data);
if (r) {
DSSDBG(Failed to start PHY\n);
goto err;
@@ -497,7 +498,7 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
 
hdmi.ip_data.cfg.cm.mode = hdmi.mode;
hdmi.ip_data.cfg.cm.code = hdmi.code;
-   ti_hdmi_4xxx_basic_configure(hdmi.ip_data);
+   hdmi.ip_data.ops-video_configure(hdmi.ip_data);
 
/* Make selection of HDMI in DSS */
dss_select_hdmi_venc_clk_source(DSS_HDMI_M_PCLK);
@@ -519,7 +520,7 @@ static int hdmi_power_on(struct omap_dss_device 

[PATCH 06/10] OMAP4: DSS2: HDMI: Split the current HDMI driver to move

2011-09-08 Thread mythripk
From: Mythri P K mythr...@ti.com

Split the current HDMI driver to move the HDMI IP dependent ( PLL/PHY/Core
configuration code) to a new IP file (ti_hdmi_4xxx_ip.c.
This is to separate IP dependent OMAP agnostic code from OMAP specific DSS
dependent code.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/Makefile   |2 +-
 drivers/video/omap2/dss/hdmi.c |  734 ---
 drivers/video/omap2/dss/ti_hdmi.h  |7 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c  |  767 
 .../video/omap2/dss/{hdmi.h = ti_hdmi_4xxx_ip.h}  |9 +-
 5 files changed, 780 insertions(+), 739 deletions(-)
 create mode 100644 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
 rename drivers/video/omap2/dss/{hdmi.h = ti_hdmi_4xxx_ip.h} (99%)

diff --git a/drivers/video/omap2/dss/Makefile b/drivers/video/omap2/dss/Makefile
index 10d9d3b..9627829 100644
--- a/drivers/video/omap2/dss/Makefile
+++ b/drivers/video/omap2/dss/Makefile
@@ -6,4 +6,4 @@ omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
 omapdss-$(CONFIG_OMAP2_DSS_SDI) += sdi.o
 omapdss-$(CONFIG_OMAP2_DSS_DSI) += dsi.o
 omapdss-$(CONFIG_OMAP4_DSS_HDMI) += hdmi.o \
-   hdmi_omap4_panel.o
+   hdmi_omap4_panel.o ti_hdmi_4xxx_ip.o
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 96a0ac9..b6d63c6 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -41,7 +41,6 @@
 
 #include ti_hdmi.h
 #include dss.h
-#include hdmi.h
 #include dss_features.h
 
 #define HDMI_WP0x0
@@ -161,56 +160,6 @@ static const int code_vesa[85] = {
 
 static const u8 edid_header[8] = {0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0x0};
 
-static inline void hdmi_write_reg(void __iomem *base_addr,
-   const struct hdmi_reg idx, u32 val)
-{
-   __raw_writel(val, base_addr + idx.idx);
-}
-
-static inline u32 hdmi_read_reg(void __iomem *base_addr,
-   const struct hdmi_reg idx)
-{
-   return __raw_readl(base_addr + idx.idx);
-}
-
-static inline void __iomem *hdmi_wp_base(struct hdmi_ip_data *ip_data)
-{
-   return ip_data-base_wp;
-}
-
-static inline void __iomem *hdmi_phy_base(struct hdmi_ip_data *ip_data)
-{
-   return ip_data-base_wp + ip_data-phy_offset;
-}
-
-static inline void __iomem *hdmi_pll_base(struct hdmi_ip_data *ip_data)
-{
-   return ip_data-base_wp + ip_data-pll_offset;
-}
-
-static inline void __iomem *hdmi_av_base(struct hdmi_ip_data *ip_data)
-{
-   return ip_data-base_wp + ip_data-core_av_offset;
-}
-
-static inline void __iomem *hdmi_core_sys_base(struct hdmi_ip_data *ip_data)
-{
-   return ip_data-base_wp + ip_data-core_sys_offset;
-}
-
-static inline int hdmi_wait_for_bit_change(void __iomem *base_addr,
-   const struct hdmi_reg idx,
-   int b2, int b1, u32 val)
-{
-   u32 t = 0;
-   while (val != REG_GET(base_addr, idx, b2, b1)) {
-   udelay(1);
-   if (t++  1)
-   return !val;
-   }
-   return val;
-}
-
 static int hdmi_runtime_get(void)
 {
int r;
@@ -239,312 +188,6 @@ int hdmi_init_display(struct omap_dss_device *dssdev)
return 0;
 }
 
-static int hdmi_pll_init(struct hdmi_ip_data *ip_data)
-{
-   u32 r;
-   void __iomem *pll_base = hdmi_pll_base(ip_data);
-   struct hdmi_pll_info *fmt = ip_data-pll_data;
-
-   /* PLL start always use manual mode */
-   REG_FLD_MOD(pll_base, PLLCTRL_PLL_CONTROL, 0x0, 0, 0);
-
-   r = hdmi_read_reg(pll_base, PLLCTRL_CFG1);
-   r = FLD_MOD(r, fmt-regm, 20, 9); /* CFG1_PLL_REGM */
-   r = FLD_MOD(r, fmt-regn, 8, 1);  /* CFG1_PLL_REGN */
-
-   hdmi_write_reg(pll_base, PLLCTRL_CFG1, r);
-
-   r = hdmi_read_reg(pll_base, PLLCTRL_CFG2);
-
-   r = FLD_MOD(r, 0x0, 12, 12); /* PLL_HIGHFREQ divide by 2 */
-   r = FLD_MOD(r, 0x1, 13, 13); /* PLL_REFEN */
-   r = FLD_MOD(r, 0x0, 14, 14); /* PHY_CLKINEN de-assert during locking */
-   r = FLD_MOD(r, fmt-refsel, 22, 21); /* REFSEL */
-
-   if (fmt-dcofreq) {
-   /* divider programming for frequency beyond 1000Mhz */
-   REG_FLD_MOD(pll_base, PLLCTRL_CFG3, fmt-regsd, 17, 10);
-   r = FLD_MOD(r, 0x4, 3, 1); /* 1000MHz and 2000MHz */
-   } else {
-   r = FLD_MOD(r, 0x2, 3, 1); /* 500MHz and 1000MHz */
-   }
-
-   hdmi_write_reg(pll_base, PLLCTRL_CFG2, r);
-
-   r = hdmi_read_reg(pll_base, PLLCTRL_CFG4);
-   r = FLD_MOD(r, fmt-regm2, 24, 18);
-   r = FLD_MOD(r, fmt-regmf, 17, 0);
-
-   hdmi_write_reg(pll_base, PLLCTRL_CFG4, r);
-
-   /* go now */
-   REG_FLD_MOD(pll_base, PLLCTRL_PLL_GO, 0x1, 0, 0);
-
-   /* wait for bit change */
-   if (hdmi_wait_for_bit_change(pll_base, PLLCTRL_PLL_GO,
- 

[PATCH 08/10] OMAP4: DSS: HDMI: Rename the functions in HDMI IP library

2011-09-08 Thread mythripk
From: Mythri P K mythr...@ti.com

Functions that are included in HDMI IP driver is renamed to have
IP specific names so that it will not conflict with similar functions
from other IP.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c|   18 +-
 drivers/video/omap2/dss/ti_hdmi.h |   15 ---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   20 +---
 3 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 2a8a55d..5afc51b 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -366,7 +366,7 @@ static void hdmi_read_edid(struct omap_video_timings *dp)
memset(hdmi.edid, 0, HDMI_EDID_MAX_LENGTH);
 
if (!hdmi.edid_set)
-   ret = read_edid(hdmi.ip_data, hdmi.edid,
+   ret = ti_hdmi_4xxx_read_edid(hdmi.ip_data, hdmi.edid,
HDMI_EDID_MAX_LENGTH);
if (!ret) {
if (!memcmp(hdmi.edid, edid_header, sizeof(edid_header))) {
@@ -480,16 +480,16 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
 
hdmi_compute_pll(dssdev, phy, hdmi.ip_data.pll_data);
 
-   hdmi_wp_video_start(hdmi.ip_data, 0);
+   ti_hdmi_4xxx_wp_video_start(hdmi.ip_data, 0);
 
/* config the PLL and PHY hdmi_set_pll_pwrfirst */
-   r = hdmi_pll_program(hdmi.ip_data);
+   r = ti_hdmi_4xxx_pll_enable(hdmi.ip_data);
if (r) {
DSSDBG(Failed to lock PLL\n);
goto err;
}
 
-   r = hdmi_phy_init(hdmi.ip_data);
+   r = ti_hdmi_4xxx_phy_enable(hdmi.ip_data);
if (r) {
DSSDBG(Failed to start PHY\n);
goto err;
@@ -497,7 +497,7 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
 
hdmi.ip_data.cfg.cm.mode = hdmi.mode;
hdmi.ip_data.cfg.cm.code = hdmi.code;
-   hdmi_basic_configure(hdmi.ip_data);
+   ti_hdmi_4xxx_basic_configure(hdmi.ip_data);
 
/* Make selection of HDMI in DSS */
dss_select_hdmi_venc_clk_source(DSS_HDMI_M_PCLK);
@@ -519,7 +519,7 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
 
dispc_mgr_enable(OMAP_DSS_CHANNEL_DIGIT, 1);
 
-   hdmi_wp_video_start(hdmi.ip_data, 1);
+   ti_hdmi_4xxx_wp_video_start(hdmi.ip_data, 1);
 
return 0;
 err:
@@ -531,9 +531,9 @@ static void hdmi_power_off(struct omap_dss_device *dssdev)
 {
dispc_mgr_enable(OMAP_DSS_CHANNEL_DIGIT, 0);
 
-   hdmi_wp_video_start(hdmi.ip_data, 0);
-   hdmi_phy_off(hdmi.ip_data);
-   hdmi_set_pll_pwr(hdmi.ip_data, HDMI_PLLPWRCMD_ALLOFF);
+   ti_hdmi_4xxx_wp_video_start(hdmi.ip_data, 0);
+   ti_hdmi_4xxx_phy_disable(hdmi.ip_data);
+   ti_hdmi_4xxx_pll_disable(hdmi.ip_data);
hdmi_runtime_put();
 
hdmi.edid_set = 0;
diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 7c63098..823fbe6 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -91,11 +91,12 @@ struct hdmi_ip_data {
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
 };
-int hdmi_phy_init(struct hdmi_ip_data *ip_data);
-void hdmi_phy_off(struct hdmi_ip_data *ip_data);
-int read_edid(struct hdmi_ip_data *ip_data, u8 *pedid, u16 max_length);
-void hdmi_wp_video_start(struct hdmi_ip_data *ip_data, bool start);
-int hdmi_pll_program(struct hdmi_ip_data *ip_data);
-int hdmi_set_pll_pwr(struct hdmi_ip_data *ip_data, enum hdmi_pll_pwr val);
-void hdmi_basic_configure(struct hdmi_ip_data *ip_data);
+int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
+void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
+int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data,
+   u8 *pedid, u16 max_length);
+void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data, bool start);
+int ti_hdmi_4xxx_pll_enable(struct hdmi_ip_data *ip_data);
+void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data);
+void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data);
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index c2a98f8..cb3a2d6 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -164,7 +164,7 @@ static int hdmi_set_phy_pwr(struct hdmi_ip_data *ip_data, 
enum hdmi_phy_pwr val)
 }
 
 /* PLL_PWR_CMD */
-int hdmi_set_pll_pwr(struct hdmi_ip_data *ip_data, enum hdmi_pll_pwr val)
+static int hdmi_set_pll_pwr(struct hdmi_ip_data *ip_data, enum hdmi_pll_pwr 
val)
 {
/* Command for power control of HDMI PLL */
REG_FLD_MOD(hdmi_wp_base(ip_data), HDMI_WP_PWR_CTRL, val, 3, 2);
@@ -194,7 +194,7 @@ static int hdmi_pll_reset(struct hdmi_ip_data *ip_data)
return 0;
 }
 
-int hdmi_pll_program(struct hdmi_ip_data *ip_data)
+int 

[PATCH 05/10] OMAP4 : DSS : HDMI : Move the EDID definition from HDMI

2011-09-08 Thread mythripk
From: Mythri P K mythr...@ti.com

Clean up to move the EDID definition from the IP dependent header file to 
hdmi.c  

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |   10 ++
 drivers/video/omap2/dss/hdmi.h |   10 --
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index bf76c87..96a0ac9 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -50,6 +50,16 @@
 #define HDMI_PLLCTRL   0x200
 #define HDMI_PHY   0x300
 
+/* HDMI EDID Length move this */
+#define HDMI_EDID_MAX_LENGTH   256
+#define EDID_TIMING_DESCRIPTOR_SIZE0x12
+#define EDID_DESCRIPTOR_BLOCK0_ADDRESS 0x36
+#define EDID_DESCRIPTOR_BLOCK1_ADDRESS 0x80
+#define EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR 4
+#define EDID_SIZE_BLOCK1_TIMING_DESCRIPTOR 4
+
+#define OMAP_HDMI_TIMINGS_NB   34
+
 static struct {
struct mutex lock;
struct omap_display_platform_data *pdata;
diff --git a/drivers/video/omap2/dss/hdmi.h b/drivers/video/omap2/dss/hdmi.h
index cb50f6a..2d4a22e 100644
--- a/drivers/video/omap2/dss/hdmi.h
+++ b/drivers/video/omap2/dss/hdmi.h
@@ -182,16 +182,6 @@ struct hdmi_reg { u16 idx; };
 #define HDMI_TXPHY_POWER_CTRL  HDMI_REG(0x8)
 #define HDMI_TXPHY_PAD_CFG_CTRLHDMI_REG(0xC)
 
-/* HDMI EDID Length  */
-#define HDMI_EDID_MAX_LENGTH   256
-#define EDID_TIMING_DESCRIPTOR_SIZE0x12
-#define EDID_DESCRIPTOR_BLOCK0_ADDRESS 0x36
-#define EDID_DESCRIPTOR_BLOCK1_ADDRESS 0x80
-#define EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR 4
-#define EDID_SIZE_BLOCK1_TIMING_DESCRIPTOR 4
-
-#define OMAP_HDMI_TIMINGS_NB   34
-
 #define REG_FLD_MOD(base, idx, val, start, end) \
hdmi_write_reg(base, idx, FLD_MOD(hdmi_read_reg(base, idx),\
val, start, end))
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/10] OMAP4: DSS: HDMI: Move HDMI IP independent generic header

2011-09-08 Thread mythripk
From: Mythri P K mythr...@ti.com

Some of the header file definitions that are there in the hdmi.h are generic
and can be used across OMAP's, Thus moving generic definition to new file.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss.h |   18 ---
 drivers/video/omap2/dss/hdmi.c|1 +
 drivers/video/omap2/dss/hdmi.h|   53 -
 drivers/video/omap2/dss/ti_hdmi.h |   94 +
 4 files changed, 95 insertions(+), 71 deletions(-)
 create mode 100644 drivers/video/omap2/dss/ti_hdmi.h

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 4cb264e..7c9565f 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -150,24 +150,6 @@ struct dsi_clock_info {
bool use_sys_clk;
 };
 
-enum hdmi_clk_refsel {
-   HDMI_REFSEL_PCLK = 0,
-   HDMI_REFSEL_REF1 = 1,
-   HDMI_REFSEL_REF2 = 2,
-   HDMI_REFSEL_SYSCLK = 3
-};
-
-/* HDMI PLL structure */
-struct hdmi_pll_info {
-   u16 regn;
-   u16 regm;
-   u32 regmf;
-   u16 regm2;
-   u16 regsd;
-   u16 dcofreq;
-   enum hdmi_clk_refsel refsel;
-};
-
 struct seq_file;
 struct platform_device;
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index c387bf4..bf76c87 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -39,6 +39,7 @@
 #include sound/pcm_params.h
 #endif
 
+#include ti_hdmi.h
 #include dss.h
 #include hdmi.h
 #include dss_features.h
diff --git a/drivers/video/omap2/dss/hdmi.h b/drivers/video/omap2/dss/hdmi.h
index 02342f6..cb50f6a 100644
--- a/drivers/video/omap2/dss/hdmi.h
+++ b/drivers/video/omap2/dss/hdmi.h
@@ -198,39 +198,12 @@ struct hdmi_reg { u16 idx; };
 #define REG_GET(base, idx, start, end) \
FLD_GET(hdmi_read_reg(base, idx), start, end)
 
-struct hdmi_video_timings {
-   u16 x_res;
-   u16 y_res;
-   /* Unit: KHz */
-   u32 pixel_clock;
-   u16 hsw;
-   u16 hfp;
-   u16 hbp;
-   u16 vsw;
-   u16 vfp;
-   u16 vbp;
-};
-
-/* HDMI timing structure */
-struct hdmi_timings {
-   struct hdmi_video_timings timings;
-   int vsync_pol;
-   int hsync_pol;
-};
-
 enum hdmi_phy_pwr {
HDMI_PHYPWRCMD_OFF = 0,
HDMI_PHYPWRCMD_LDOON = 1,
HDMI_PHYPWRCMD_TXON = 2
 };
 
-enum hdmi_pll_pwr {
-   HDMI_PLLPWRCMD_ALLOFF = 0,
-   HDMI_PLLPWRCMD_PLLONLY = 1,
-   HDMI_PLLPWRCMD_BOTHON_ALLCLKS = 2,
-   HDMI_PLLPWRCMD_BOTHON_NOPHYCLK = 3
-};
-
 enum hdmi_core_inputbus_width {
HDMI_INPUT_8BIT = 0,
HDMI_INPUT_10BIT = 1,
@@ -259,11 +232,6 @@ enum hdmi_core_packet_mode {
HDMI_PACKETMODE48BITPERPIXEL = 7
 };
 
-enum hdmi_core_hdmi_dvi {
-   HDMI_DVI = 0,
-   HDMI_HDMI = 1
-};
-
 enum hdmi_core_tclkselclkmult {
HDMI_FPLL05IDCK = 0,
HDMI_FPLL10IDCK = 1,
@@ -564,27 +532,6 @@ struct hdmi_video_interface {
int tm; /* Timing mode */
 };
 
-struct hdmi_cm {
-   int code;
-   int mode;
-};
-
-struct hdmi_config {
-   struct hdmi_timings timings;
-   u16 interlace;
-   struct hdmi_cm cm;
-};
-
-struct hdmi_ip_data {
-   void __iomem*base_wp;   /* HDMI wrapper */
-   unsigned long   core_sys_offset;
-   unsigned long   core_av_offset;
-   unsigned long   pll_offset;
-   unsigned long   phy_offset;
-   struct hdmi_config cfg;
-   struct hdmi_pll_info pll_data;
-};
-
 struct hdmi_audio_format {
enum hdmi_stereo_channels   stereo_channels;
u8  active_chnnls_msk;
diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
new file mode 100644
index 000..f0e508e
--- /dev/null
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -0,0 +1,94 @@
+/*
+ * ti_hdmi.h
+ *
+ * HDMI driver definition for TI OMAP4, DM81xx, DM38xx  Processor.
+ *
+ * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see http://www.gnu.org/licenses/.
+ */
+
+#ifndef _TI_HDMI_H
+#define _TI_HDMI_H
+
+enum hdmi_pll_pwr {
+   HDMI_PLLPWRCMD_ALLOFF = 0,
+   HDMI_PLLPWRCMD_PLLONLY = 1,
+   HDMI_PLLPWRCMD_BOTHON_ALLCLKS = 2,
+   HDMI_PLLPWRCMD_BOTHON_NOPHYCLK = 3
+};
+
+enum hdmi_core_hdmi_dvi {
+   HDMI_DVI = 0,
+   HDMI_HDMI = 1
+};
+
+enum hdmi_clk_refsel {
+   

[PATCH 07/10]OMAP4: DSS2: HDMI: Move the HDMI IP dependent audio

2011-09-08 Thread mythripk
From: Mythri P K mythr...@ti.com

Move HDMI IP dependent audio functions from HDMI DSS file  to IP library.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c|  257 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |  260 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |   22 +++
 3 files changed, 283 insertions(+), 256 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index b6d63c6..2a8a55d 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -37,6 +37,7 @@
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
 #include sound/soc.h
 #include sound/pcm_params.h
+#include ti_hdmi_4xxx_ip.h
 #endif
 
 #include ti_hdmi.h
@@ -630,229 +631,6 @@ void omapdss_hdmi_display_disable(struct omap_dss_device 
*dssdev)
 
 #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
-static void hdmi_wp_audio_config_format(struct hdmi_ip_data *ip_data,
-   struct hdmi_audio_format *aud_fmt)
-{
-   u32 r;
-
-   DSSDBG(Enter hdmi_wp_audio_config_format\n);
-
-   r = hdmi_read_reg(hdmi_wp_base(ip_data), HDMI_WP_AUDIO_CFG);
-   r = FLD_MOD(r, aud_fmt-stereo_channels, 26, 24);
-   r = FLD_MOD(r, aud_fmt-active_chnnls_msk, 23, 16);
-   r = FLD_MOD(r, aud_fmt-en_sig_blk_strt_end, 5, 5);
-   r = FLD_MOD(r, aud_fmt-type, 4, 4);
-   r = FLD_MOD(r, aud_fmt-justification, 3, 3);
-   r = FLD_MOD(r, aud_fmt-sample_order, 2, 2);
-   r = FLD_MOD(r, aud_fmt-samples_per_word, 1, 1);
-   r = FLD_MOD(r, aud_fmt-sample_size, 0, 0);
-   hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_AUDIO_CFG, r);
-}
-
-static void hdmi_wp_audio_config_dma(struct hdmi_ip_data *ip_data,
-   struct hdmi_audio_dma *aud_dma)
-{
-   u32 r;
-
-   DSSDBG(Enter hdmi_wp_audio_config_dma\n);
-
-   r = hdmi_read_reg(hdmi_wp_base(ip_data), HDMI_WP_AUDIO_CFG2);
-   r = FLD_MOD(r, aud_dma-transfer_size, 15, 8);
-   r = FLD_MOD(r, aud_dma-block_size, 7, 0);
-   hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_AUDIO_CFG2, r);
-
-   r = hdmi_read_reg(hdmi_wp_base(ip_data), HDMI_WP_AUDIO_CTRL);
-   r = FLD_MOD(r, aud_dma-mode, 9, 9);
-   r = FLD_MOD(r, aud_dma-fifo_threshold, 8, 0);
-   hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_AUDIO_CTRL, r);
-}
-
-static void hdmi_core_audio_config(struct hdmi_ip_data *ip_data,
-   struct hdmi_core_audio_config *cfg)
-{
-   u32 r;
-   void __iomem *av_base = hdmi_av_base(ip_data);
-
-   /* audio clock recovery parameters */
-   r = hdmi_read_reg(av_base, HDMI_CORE_AV_ACR_CTRL);
-   r = FLD_MOD(r, cfg-use_mclk, 2, 2);
-   r = FLD_MOD(r, cfg-en_acr_pkt, 1, 1);
-   r = FLD_MOD(r, cfg-cts_mode, 0, 0);
-   hdmi_write_reg(av_base, HDMI_CORE_AV_ACR_CTRL, r);
-
-   REG_FLD_MOD(av_base, HDMI_CORE_AV_N_SVAL1, cfg-n, 7, 0);
-   REG_FLD_MOD(av_base, HDMI_CORE_AV_N_SVAL2, cfg-n  8, 7, 0);
-   REG_FLD_MOD(av_base, HDMI_CORE_AV_N_SVAL3, cfg-n  16, 7, 0);
-
-   if (cfg-cts_mode == HDMI_AUDIO_CTS_MODE_SW) {
-   REG_FLD_MOD(av_base, HDMI_CORE_AV_CTS_SVAL1, cfg-cts, 7, 0);
-   REG_FLD_MOD(av_base,
-   HDMI_CORE_AV_CTS_SVAL2, cfg-cts  8, 7, 0);
-   REG_FLD_MOD(av_base,
-   HDMI_CORE_AV_CTS_SVAL3, cfg-cts  16, 7, 0);
-   } else {
-   /*
-* HDMI IP uses this configuration to divide the MCLK to
-* update CTS value.
-*/
-   REG_FLD_MOD(av_base,
-   HDMI_CORE_AV_FREQ_SVAL, cfg-mclk_mode, 2, 0);
-
-   /* Configure clock for audio packets */
-   REG_FLD_MOD(av_base, HDMI_CORE_AV_AUD_PAR_BUSCLK_1,
-   cfg-aud_par_busclk, 7, 0);
-   REG_FLD_MOD(av_base, HDMI_CORE_AV_AUD_PAR_BUSCLK_2,
-   (cfg-aud_par_busclk  8), 7, 0);
-   REG_FLD_MOD(av_base, HDMI_CORE_AV_AUD_PAR_BUSCLK_3,
-   (cfg-aud_par_busclk  16), 7, 0);
-   }
-
-   /* Override of SPDIF sample frequency with value in I2S_CHST4 */
-   REG_FLD_MOD(av_base, HDMI_CORE_AV_SPDIF_CTRL,
-   cfg-fs_override, 1, 1);
-
-   /* I2S parameters */
-   REG_FLD_MOD(av_base, HDMI_CORE_AV_I2S_CHST4,
-   cfg-freq_sample, 3, 0);
-
-   r = hdmi_read_reg(av_base, HDMI_CORE_AV_I2S_IN_CTRL);
-   r = FLD_MOD(r, cfg-i2s_cfg.en_high_bitrate_aud, 7, 7);
-   r = FLD_MOD(r, cfg-i2s_cfg.sck_edge_mode, 6, 6);
-   r = FLD_MOD(r, cfg-i2s_cfg.cbit_order, 5, 5);
-   r = FLD_MOD(r, cfg-i2s_cfg.vbit, 4, 4);
-   r = FLD_MOD(r, cfg-i2s_cfg.ws_polarity, 3, 3);
-   

[PATCH v4 00/11] HDMI: Split hdmi.c in DSS to seperate OMAP dependent

2011-09-06 Thread mythripk
From: Mythri P K mythr...@ti.com

HDMI IP block is common between TI OMAP4 Procerssor and Netra processor although
the Display subsytem is different.Also the IP block in future OMAP may differ
from the one existing in OMAP4. Thus to reuse the code between these two
processors , and maintain the multi omap build functionality in DSS.
HDMI IP dependant code is seperated out from hdmi.c and moved to
new library file hdmi_ti_4xxx_ip.c.From the DSS dependent HDMI code only the
function pointer to functionality/features offered by HDMI is called.

This patch series does the split and also renames hdmi_omap4_panel.c to
hdmi_panel.c as that file has nothing specific to OMAP4 and can be reused for
other OMAP family of processors as well.

This patch series is based on Tomi's LO-DSS2 master branch.

changes since
v3:Handle the sparse error for set_pll_pwr function
Move audio functions out of hdmi.c to ip file.
rename hdmi_data to ip_data 
V2: Rename certain files/function to have standard format and handle scenario
when hdmi is disabled.
V1: Function pointer approach to call the HDMI IP functions from DSS HDMI

Mythri P K (11):
  OMAP4: DSS: HDMI: HDMI clean up to pass base_address dynamically to
IP dependant functions of HDMI
  OMAP4: DSS: HDMI: Move pll and video configuration info to ip_data
structure
  OMAP4: DSS: HDMI: Use specific HDMI timings structure instead of OMAP
DSS timings
  OMAP4: DSS: HDMI: Move IP independent common header file definition
to generic header file
  OMAP4 : DSS : HDMI : Move the EDID portion from HDMI IP header
  OMAP4: DSS2: HDMI: Split the HDMI driver to DSS and IP  
specific portion.
  OMAP4: DSS2: HDMI: Move the HDMI IP dependent audio functions to IP
library
  OMAP4: DSS: HDMI: Rename the functions in HDMI IP  library to IP
specific name
  OMAP4: DSS: HDMI: Move the common HDMI header file  definition to
Include/video
  OMAP4: DSS2: HDMI: Function pointer approach to call HDMI IP driver
function from DSS
  OMAP4: DSS: Rename hdmi_omap4_panel.c to hdmi_panel.c

 drivers/video/omap2/dss/Makefile   |2 +-
 drivers/video/omap2/dss/dss.h  |   10 -
 drivers/video/omap2/dss/dss_features.c |   20 +
 drivers/video/omap2/dss/dss_features.h |3 +
 drivers/video/omap2/dss/hdmi.c | 1027 ++--
 drivers/video/omap2/dss/hdmi.h |  631 
 .../omap2/dss/{hdmi_omap4_panel.c = hdmi_panel.c} |2 +-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c  | 1032 
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h  |  597 +++
 include/video/omapdss.h|   23 +
 include/video/ti_hdmi.h|  103 ++
 11 files changed, 1851 insertions(+), 1599 deletions(-)
 delete mode 100644 drivers/video/omap2/dss/hdmi.h
 rename drivers/video/omap2/dss/{hdmi_omap4_panel.c = hdmi_panel.c} (99%)
 create mode 100644 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
 create mode 100644 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
 create mode 100644 include/video/ti_hdmi.h

-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 02/11] OMAP4: DSS: HDMI: Move pll and video configuration

2011-09-06 Thread mythripk
From: Mythri P K mythr...@ti.com

As the pll and the video configuration info are part of the ip_data those
structures are moved to the ip_data structure. Also the functions are modified
accordingly to take care of this movement.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss.h  |8 +++
 drivers/video/omap2/dss/hdmi.c |   41 +--
 drivers/video/omap2/dss/hdmi.h |   25 +--
 3 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index a095a62..4cb264e 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -150,6 +150,13 @@ struct dsi_clock_info {
bool use_sys_clk;
 };
 
+enum hdmi_clk_refsel {
+   HDMI_REFSEL_PCLK = 0,
+   HDMI_REFSEL_REF1 = 1,
+   HDMI_REFSEL_REF2 = 2,
+   HDMI_REFSEL_SYSCLK = 3
+};
+
 /* HDMI PLL structure */
 struct hdmi_pll_info {
u16 regn;
@@ -158,6 +165,7 @@ struct hdmi_pll_info {
u16 regm2;
u16 regsd;
u16 dcofreq;
+   enum hdmi_clk_refsel refsel;
 };
 
 struct seq_file;
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index bfd113c..9074123 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -59,7 +59,6 @@ static struct {
u8 edid[HDMI_EDID_MAX_LENGTH];
u8 edid_set;
bool custom_set;
-   struct hdmi_config cfg;
 
struct clk *sys_clk;
 } hdmi;
@@ -229,12 +228,11 @@ int hdmi_init_display(struct omap_dss_device *dssdev)
return 0;
 }
 
-static int hdmi_pll_init(struct hdmi_ip_data *ip_data,
-   enum hdmi_clk_refsel refsel, int dcofreq,
-   struct hdmi_pll_info *fmt, u16 sd)
+static int hdmi_pll_init(struct hdmi_ip_data *ip_data)
 {
u32 r;
void __iomem *pll_base = hdmi_pll_base(ip_data);
+   struct hdmi_pll_info *fmt = ip_data-pll_data;
 
/* PLL start always use manual mode */
REG_FLD_MOD(pll_base, PLLCTRL_PLL_CONTROL, 0x0, 0, 0);
@@ -251,9 +249,9 @@ static int hdmi_pll_init(struct hdmi_ip_data *ip_data,
r = FLD_MOD(r, 0x1, 13, 13); /* PLL_REFEN */
r = FLD_MOD(r, 0x0, 14, 14); /* PHY_CLKINEN de-assert during locking */
 
-   if (dcofreq) {
+   if (fmt-dcofreq) {
/* divider programming for frequency beyond 1000Mhz */
-   REG_FLD_MOD(pll_base, PLLCTRL_CFG3, sd, 17, 10);
+   REG_FLD_MOD(pll_base, PLLCTRL_CFG3, fmt-regsd, 17, 10);
r = FLD_MOD(r, 0x4, 3, 1); /* 1000MHz and 2000MHz */
} else {
r = FLD_MOD(r, 0x2, 3, 1); /* 500MHz and 1000MHz */
@@ -379,11 +377,9 @@ static int hdmi_phy_init(struct hdmi_ip_data *ip_data)
return 0;
 }
 
-static int hdmi_pll_program(struct hdmi_ip_data *ip_data,
-   struct hdmi_pll_info *fmt)
+static int hdmi_pll_program(struct hdmi_ip_data *ip_data)
 {
u16 r = 0;
-   enum hdmi_clk_refsel refsel;
 
r = hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_ALLOFF);
if (r)
@@ -397,9 +393,7 @@ static int hdmi_pll_program(struct hdmi_ip_data *ip_data,
if (r)
return r;
 
-   refsel = HDMI_REFSEL_SYSCLK;
-
-   r = hdmi_pll_init(ip_data, refsel, fmt-dcofreq, fmt, fmt-regsd);
+   r = hdmi_pll_init(ip_data);
if (r)
return r;
 
@@ -1015,8 +1009,7 @@ static void hdmi_wp_video_config_timing(struct 
hdmi_ip_data *ip_data,
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_TIMING_V, timing_v);
 }
 
-static void hdmi_basic_configure(struct hdmi_ip_data *ip_data,
-   struct hdmi_config *cfg)
+static void hdmi_basic_configure(struct hdmi_ip_data *ip_data)
 {
/* HDMI */
struct omap_video_timings video_timing;
@@ -1026,6 +1019,7 @@ static void hdmi_basic_configure(struct hdmi_ip_data 
*ip_data,
struct hdmi_core_infoframe_avi avi_cfg;
struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg;
+   struct hdmi_config *cfg = ip_data-cfg;
 
hdmi_wp_init(video_timing, video_format,
video_interface);
@@ -1034,8 +1028,7 @@ static void hdmi_basic_configure(struct hdmi_ip_data 
*ip_data,
avi_cfg,
repeat_cfg);
 
-   hdmi_wp_video_init_format(video_format,
-   video_timing, cfg);
+   hdmi_wp_video_init_format(video_format, video_timing, cfg);
 
hdmi_wp_video_config_timing(ip_data, video_timing);
 
@@ -1154,6 +1147,9 @@ static void hdmi_compute_pll(struct omap_dss_device 
*dssdev, int phy,
pi-dcofreq = phy  1000 * 100;
pi-regsd = ((pi-regm * clkin / 10) / ((pi-regn + 1) * 250) + 5) / 10;
 
+   /* Set the reference clock to sysclk reference */
+   pi-refsel = HDMI_REFSEL_SYSCLK;
+
DSSDBG(M = %d Mf = %d\n, pi-regm, pi-regmf);
DSSDBG(range = %d sd = 

[PATCH v4 05/11] OMAP4 : DSS : HDMI : Move the EDID portion from HDMI

2011-09-06 Thread mythripk
From: Mythri P K mythr...@ti.com

Clean up to move the EDID definition to hdmi.c from the header file which is IP
dependent.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |   10 ++
 drivers/video/omap2/dss/hdmi.h |   10 --
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index d58e09f..1e37097 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -50,6 +50,16 @@
 #define HDMI_PLLCTRL   0x200
 #define HDMI_PHY   0x300
 
+/* HDMI EDID Length move this */
+#define HDMI_EDID_MAX_LENGTH   256
+#define EDID_TIMING_DESCRIPTOR_SIZE0x12
+#define EDID_DESCRIPTOR_BLOCK0_ADDRESS 0x36
+#define EDID_DESCRIPTOR_BLOCK1_ADDRESS 0x80
+#define EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR 4
+#define EDID_SIZE_BLOCK1_TIMING_DESCRIPTOR 4
+
+#define OMAP_HDMI_TIMINGS_NB   34
+
 static struct {
struct mutex lock;
struct omap_display_platform_data *pdata;
diff --git a/drivers/video/omap2/dss/hdmi.h b/drivers/video/omap2/dss/hdmi.h
index cb50f6a..2d4a22e 100644
--- a/drivers/video/omap2/dss/hdmi.h
+++ b/drivers/video/omap2/dss/hdmi.h
@@ -182,16 +182,6 @@ struct hdmi_reg { u16 idx; };
 #define HDMI_TXPHY_POWER_CTRL  HDMI_REG(0x8)
 #define HDMI_TXPHY_PAD_CFG_CTRLHDMI_REG(0xC)
 
-/* HDMI EDID Length  */
-#define HDMI_EDID_MAX_LENGTH   256
-#define EDID_TIMING_DESCRIPTOR_SIZE0x12
-#define EDID_DESCRIPTOR_BLOCK0_ADDRESS 0x36
-#define EDID_DESCRIPTOR_BLOCK1_ADDRESS 0x80
-#define EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR 4
-#define EDID_SIZE_BLOCK1_TIMING_DESCRIPTOR 4
-
-#define OMAP_HDMI_TIMINGS_NB   34
-
 #define REG_FLD_MOD(base, idx, val, start, end) \
hdmi_write_reg(base, idx, FLD_MOD(hdmi_read_reg(base, idx),\
val, start, end))
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 08/11] OMAP4: DSS: HDMI: Rename the functions in HDMI IP

2011-09-06 Thread mythripk
From: Mythri P K mythr...@ti.com

Functions that are included in HDMI IP driver is renamed to have
IP specific names so that it will not conflict with similar functions
from other IP.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c|   18 +-
 drivers/video/omap2/dss/ti_hdmi.h |   15 ---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   20 +---
 3 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index dac2156..32af867 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -366,7 +366,7 @@ static void hdmi_read_edid(struct omap_video_timings *dp)
memset(hdmi.edid, 0, HDMI_EDID_MAX_LENGTH);
 
if (!hdmi.edid_set)
-   ret = read_edid(hdmi.ip_data, hdmi.edid,
+   ret = ti_hdmi_4xxx_read_edid(hdmi.ip_data, hdmi.edid,
HDMI_EDID_MAX_LENGTH);
if (!ret) {
if (!memcmp(hdmi.edid, edid_header, sizeof(edid_header))) {
@@ -480,16 +480,16 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
 
hdmi_compute_pll(dssdev, phy, hdmi.ip_data.pll_data);
 
-   hdmi_wp_video_start(hdmi.ip_data, 0);
+   ti_hdmi_4xxx_wp_video_start(hdmi.ip_data, 0);
 
/* config the PLL and PHY hdmi_set_pll_pwrfirst */
-   r = hdmi_pll_program(hdmi.ip_data);
+   r = ti_hdmi_4xxx_pll_enable(hdmi.ip_data);
if (r) {
DSSDBG(Failed to lock PLL\n);
goto err;
}
 
-   r = hdmi_phy_init(hdmi.ip_data);
+   r = ti_hdmi_4xxx_phy_enable(hdmi.ip_data);
if (r) {
DSSDBG(Failed to start PHY\n);
goto err;
@@ -497,7 +497,7 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
 
hdmi.ip_data.cfg.cm.mode = hdmi.mode;
hdmi.ip_data.cfg.cm.code = hdmi.code;
-   hdmi_basic_configure(hdmi.ip_data);
+   ti_hdmi_4xxx_basic_configure(hdmi.ip_data);
 
/* Make selection of HDMI in DSS */
dss_select_hdmi_venc_clk_source(DSS_HDMI_M_PCLK);
@@ -519,7 +519,7 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
 
dispc_mgr_enable(OMAP_DSS_CHANNEL_DIGIT, 1);
 
-   hdmi_wp_video_start(hdmi.ip_data, 1);
+   ti_hdmi_4xxx_wp_video_start(hdmi.ip_data, 1);
 
return 0;
 err:
@@ -531,9 +531,9 @@ static void hdmi_power_off(struct omap_dss_device *dssdev)
 {
dispc_mgr_enable(OMAP_DSS_CHANNEL_DIGIT, 0);
 
-   hdmi_wp_video_start(hdmi.ip_data, 0);
-   hdmi_phy_off(hdmi.ip_data);
-   hdmi_set_pll_pwr(hdmi.ip_data, HDMI_PLLPWRCMD_ALLOFF);
+   ti_hdmi_4xxx_wp_video_start(hdmi.ip_data, 0);
+   ti_hdmi_4xxx_phy_disable(hdmi.ip_data);
+   ti_hdmi_4xxx_pll_disable(hdmi.ip_data);
hdmi_runtime_put();
 
hdmi.edid_set = 0;
diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 7c63098..823fbe6 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -91,11 +91,12 @@ struct hdmi_ip_data {
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
 };
-int hdmi_phy_init(struct hdmi_ip_data *ip_data);
-void hdmi_phy_off(struct hdmi_ip_data *ip_data);
-int read_edid(struct hdmi_ip_data *ip_data, u8 *pedid, u16 max_length);
-void hdmi_wp_video_start(struct hdmi_ip_data *ip_data, bool start);
-int hdmi_pll_program(struct hdmi_ip_data *ip_data);
-int hdmi_set_pll_pwr(struct hdmi_ip_data *ip_data, enum hdmi_pll_pwr val);
-void hdmi_basic_configure(struct hdmi_ip_data *ip_data);
+int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
+void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
+int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data,
+   u8 *pedid, u16 max_length);
+void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data, bool start);
+int ti_hdmi_4xxx_pll_enable(struct hdmi_ip_data *ip_data);
+void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data);
+void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data);
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 8501aae..8c552e9 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -163,7 +163,7 @@ static int hdmi_set_phy_pwr(struct hdmi_ip_data *ip_data, 
enum hdmi_phy_pwr val)
 }
 
 /* PLL_PWR_CMD */
-int hdmi_set_pll_pwr(struct hdmi_ip_data *ip_data, enum hdmi_pll_pwr val)
+static int hdmi_set_pll_pwr(struct hdmi_ip_data *ip_data, enum hdmi_pll_pwr 
val)
 {
/* Command for power control of HDMI PLL */
REG_FLD_MOD(hdmi_wp_base(ip_data), HDMI_WP_PWR_CTRL, val, 3, 2);
@@ -193,7 +193,7 @@ static int hdmi_pll_reset(struct hdmi_ip_data *ip_data)
return 0;
 }
 
-int hdmi_pll_program(struct hdmi_ip_data *ip_data)
+int 

  1   2   >