OMAP4: DSS2: HDMI: Split the current HDMI driver to move
authorMythri P K <mythripk@ti.com>
Thu, 8 Sep 2011 13:36:23 +0000 (19:06 +0530)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 30 Sep 2011 13:16:32 +0000 (16:16 +0300)
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 <mythripk@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/omap2/dss/Makefile
drivers/video/omap2/dss/hdmi.c
drivers/video/omap2/dss/hdmi.h [deleted file]
drivers/video/omap2/dss/ti_hdmi.h
drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c [new file with mode: 0644]
drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h [new file with mode: 0644]

index 10d9d3bb3e24c5b4f6eb9a9944a8ad6e9634ac32..96278292724306f9ad482e81a3f5b487141fa150 100644 (file)
@@ -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
index 96a0ac941126c628a71477d260cf346a9dafe631..b6d63c63c9fda7d59d9a373e69b4ce9a4b8ebcdd 100644 (file)
@@ -41,7 +41,6 @@
 
 #include "ti_hdmi.h"
 #include "dss.h"
-#include "hdmi.h"
 #include "dss_features.h"
 
 #define HDMI_WP                        0x0
@@ -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++ > 10000)
-                       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,
-                                                       0, 0, 1) != 1) {
-               DSSERR("PLL GO bit not set\n");
-               return -ETIMEDOUT;
-       }
-
-       /* Wait till the lock bit is set in PLL status */
-       if (hdmi_wait_for_bit_change(pll_base,
-                               PLLCTRL_PLL_STATUS, 1, 1, 1) != 1) {
-               DSSWARN("cannot lock PLL\n");
-               DSSWARN("CFG1 0x%x\n",
-                       hdmi_read_reg(pll_base, PLLCTRL_CFG1));
-               DSSWARN("CFG2 0x%x\n",
-                       hdmi_read_reg(pll_base, PLLCTRL_CFG2));
-               DSSWARN("CFG4 0x%x\n",
-                       hdmi_read_reg(pll_base, PLLCTRL_CFG4));
-               return -ETIMEDOUT;
-       }
-
-       DSSDBG("PLL locked!\n");
-
-       return 0;
-}
-
-/* PHY_PWR_CMD */
-static int hdmi_set_phy_pwr(struct hdmi_ip_data *ip_data, enum hdmi_phy_pwr val)
-{
-       /* Command for power control of HDMI PHY */
-       REG_FLD_MOD(hdmi_wp_base(ip_data), HDMI_WP_PWR_CTRL, val, 7, 6);
-
-       /* Status of the power control of HDMI PHY */
-       if (hdmi_wait_for_bit_change(hdmi_wp_base(ip_data),
-                               HDMI_WP_PWR_CTRL, 5, 4, val) != val) {
-               DSSERR("Failed to set PHY power mode to %d\n", val);
-               return -ETIMEDOUT;
-       }
-
-       return 0;
-}
-
-/* PLL_PWR_CMD */
-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);
-
-       /* wait till PHY_PWR_STATUS is set */
-       if (hdmi_wait_for_bit_change(hdmi_wp_base(ip_data), HDMI_WP_PWR_CTRL,
-                                               1, 0, val) != val) {
-               DSSERR("Failed to set PHY_PWR_STATUS\n");
-               return -ETIMEDOUT;
-       }
-
-       return 0;
-}
-
-static int hdmi_pll_reset(struct hdmi_ip_data *ip_data)
-{
-       /* SYSRESET  controlled by power FSM */
-       REG_FLD_MOD(hdmi_pll_base(ip_data), PLLCTRL_PLL_CONTROL, 0x0, 3, 3);
-
-       /* READ 0x0 reset is in progress */
-       if (hdmi_wait_for_bit_change(hdmi_pll_base(ip_data),
-                               PLLCTRL_PLL_STATUS, 0, 0, 1) != 1) {
-               DSSERR("Failed to sysreset PLL\n");
-               return -ETIMEDOUT;
-       }
-
-       return 0;
-}
-
-static int hdmi_phy_init(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;
-
-       /*
-        * Read address 0 in order to get the SCP reset done completed
-        * Dummy access performed to make sure reset is done
-        */
-       hdmi_read_reg(phy_base, HDMI_TXPHY_TX_CTRL);
-
-       /*
-        * Write to phy address 0 to configure the clock
-        * use HFBITCLK write HDMI_TXPHY_TX_CONTROL_FREQOUT field
-        */
-       REG_FLD_MOD(phy_base, HDMI_TXPHY_TX_CTRL, 0x1, 31, 30);
-
-       /* Write to phy address 1 to start HDMI line (TXVALID and TMDSCLKEN) */
-       hdmi_write_reg(phy_base, HDMI_TXPHY_DIGITAL_CTRL, 0xF0000000);
-
-       /* Setup max LDO voltage */
-       REG_FLD_MOD(phy_base, HDMI_TXPHY_POWER_CTRL, 0xB, 3, 0);
-
-       /* Write to phy address 3 to change the polarity control */
-       REG_FLD_MOD(phy_base, HDMI_TXPHY_PAD_CFG_CTRL, 0x1, 27, 27);
-
-       return 0;
-}
-
-static int hdmi_pll_program(struct hdmi_ip_data *ip_data)
-{
-       u16 r = 0;
-
-       r = hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_ALLOFF);
-       if (r)
-               return r;
-
-       r = hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_BOTHON_ALLCLKS);
-       if (r)
-               return r;
-
-       r = hdmi_pll_reset(ip_data);
-       if (r)
-               return r;
-
-       r = hdmi_pll_init(ip_data);
-       if (r)
-               return r;
-
-       return 0;
-}
-
-static void hdmi_phy_off(struct hdmi_ip_data *ip_data)
-{
-       hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF);
-}
-
-static int hdmi_core_ddc_edid(struct hdmi_ip_data *ip_data,
-                                               u8 *pedid, int ext)
-{
-       u32 i, j;
-       char checksum = 0;
-       u32 offset = 0;
-       void __iomem *core_sys_base = hdmi_core_sys_base(ip_data);
-
-       /* Turn on CLK for DDC */
-       REG_FLD_MOD(hdmi_av_base(ip_data), HDMI_CORE_AV_DPD, 0x7, 2, 0);
-
-       /*
-        * SW HACK : Without the Delay DDC(i2c bus) reads 0 values /
-        * right shifted values( The behavior is not consistent and seen only
-        * with some TV's)
-        */
-       usleep_range(800, 1000);
-
-       if (!ext) {
-               /* Clk SCL Devices */
-               REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_CMD, 0xA, 3, 0);
-
-               /* HDMI_CORE_DDC_STATUS_IN_PROG */
-               if (hdmi_wait_for_bit_change(core_sys_base,
-                                       HDMI_CORE_DDC_STATUS, 4, 4, 0) != 0) {
-                       DSSERR("Failed to program DDC\n");
-                       return -ETIMEDOUT;
-               }
-
-               /* Clear FIFO */
-               REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_CMD, 0x9, 3, 0);
-
-               /* HDMI_CORE_DDC_STATUS_IN_PROG */
-               if (hdmi_wait_for_bit_change(core_sys_base,
-                                       HDMI_CORE_DDC_STATUS, 4, 4, 0) != 0) {
-                       DSSERR("Failed to program DDC\n");
-                       return -ETIMEDOUT;
-               }
-
-       } else {
-               if (ext % 2 != 0)
-                       offset = 0x80;
-       }
-
-       /* Load Segment Address Register */
-       REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_SEGM, ext/2, 7, 0);
-
-       /* Load Slave Address Register */
-       REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_ADDR, 0xA0 >> 1, 7, 1);
-
-       /* Load Offset Address Register */
-       REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_OFFSET, offset, 7, 0);
-
-       /* Load Byte Count */
-       REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_COUNT1, 0x80, 7, 0);
-       REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_COUNT2, 0x0, 1, 0);
-
-       /* Set DDC_CMD */
-       if (ext)
-               REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_CMD, 0x4, 3, 0);
-       else
-               REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_CMD, 0x2, 3, 0);
-
-       /* HDMI_CORE_DDC_STATUS_BUS_LOW */
-       if (REG_GET(core_sys_base, HDMI_CORE_DDC_STATUS, 6, 6) == 1) {
-               DSSWARN("I2C Bus Low?\n");
-               return -EIO;
-       }
-       /* HDMI_CORE_DDC_STATUS_NO_ACK */
-       if (REG_GET(core_sys_base, HDMI_CORE_DDC_STATUS, 5, 5) == 1) {
-               DSSWARN("I2C No Ack\n");
-               return -EIO;
-       }
-
-       i = ext * 128;
-       j = 0;
-       while (((REG_GET(core_sys_base, HDMI_CORE_DDC_STATUS, 4, 4) == 1) ||
-                       (REG_GET(core_sys_base,
-                       HDMI_CORE_DDC_STATUS, 2, 2) == 0)) && j < 128) {
-
-               if (REG_GET(core_sys_base, HDMI_CORE_DDC_STATUS, 2, 2) == 0) {
-                       /* FIFO not empty */
-                       pedid[i++] = REG_GET(core_sys_base,
-                                               HDMI_CORE_DDC_DATA, 7, 0);
-                       j++;
-               }
-       }
-
-       for (j = 0; j < 128; j++)
-               checksum += pedid[j];
-
-       if (checksum != 0) {
-               DSSERR("E-EDID checksum failed!!\n");
-               return -EIO;
-       }
-
-       return 0;
-}
-
-static int read_edid(struct hdmi_ip_data *ip_data, u8 *pedid, u16 max_length)
-{
-       int r = 0, n = 0, i = 0;
-       int max_ext_blocks = (max_length / 128) - 1;
-
-       r = hdmi_core_ddc_edid(ip_data, pedid, 0);
-       if (r) {
-               return r;
-       } else {
-               n = pedid[0x7e];
-
-               /*
-                * README: need to comply with max_length set by the caller.
-                * Better implementation should be to allocate necessary
-                * memory to store EDID according to nb_block field found
-                * in first block
-                */
-               if (n > max_ext_blocks)
-                       n = max_ext_blocks;
-
-               for (i = 1; i <= n; i++) {
-                       r = hdmi_core_ddc_edid(ip_data, pedid, i);
-                       if (r)
-                               return r;
-               }
-       }
-       return 0;
-}
-
 static void copy_hdmi_to_dss_timings(
                const struct hdmi_video_timings *hdmi_timings,
                struct omap_video_timings *timings)
@@ -746,383 +389,6 @@ static void hdmi_read_edid(struct omap_video_timings *dp)
 
 }
 
-static void hdmi_core_init(struct hdmi_core_video_config *video_cfg,
-                       struct hdmi_core_infoframe_avi *avi_cfg,
-                       struct hdmi_core_packet_enable_repeat *repeat_cfg)
-{
-       DSSDBG("Enter hdmi_core_init\n");
-
-       /* video core */
-       video_cfg->ip_bus_width = HDMI_INPUT_8BIT;
-       video_cfg->op_dither_truc = HDMI_OUTPUTTRUNCATION_8BIT;
-       video_cfg->deep_color_pkt = HDMI_DEEPCOLORPACKECTDISABLE;
-       video_cfg->pkt_mode = HDMI_PACKETMODERESERVEDVALUE;
-       video_cfg->hdmi_dvi = HDMI_DVI;
-       video_cfg->tclk_sel_clkmult = HDMI_FPLL10IDCK;
-
-       /* info frame */
-       avi_cfg->db1_format = 0;
-       avi_cfg->db1_active_info = 0;
-       avi_cfg->db1_bar_info_dv = 0;
-       avi_cfg->db1_scan_info = 0;
-       avi_cfg->db2_colorimetry = 0;
-       avi_cfg->db2_aspect_ratio = 0;
-       avi_cfg->db2_active_fmt_ar = 0;
-       avi_cfg->db3_itc = 0;
-       avi_cfg->db3_ec = 0;
-       avi_cfg->db3_q_range = 0;
-       avi_cfg->db3_nup_scaling = 0;
-       avi_cfg->db4_videocode = 0;
-       avi_cfg->db5_pixel_repeat = 0;
-       avi_cfg->db6_7_line_eoftop = 0 ;
-       avi_cfg->db8_9_line_sofbottom = 0;
-       avi_cfg->db10_11_pixel_eofleft = 0;
-       avi_cfg->db12_13_pixel_sofright = 0;
-
-       /* packet enable and repeat */
-       repeat_cfg->audio_pkt = 0;
-       repeat_cfg->audio_pkt_repeat = 0;
-       repeat_cfg->avi_infoframe = 0;
-       repeat_cfg->avi_infoframe_repeat = 0;
-       repeat_cfg->gen_cntrl_pkt = 0;
-       repeat_cfg->gen_cntrl_pkt_repeat = 0;
-       repeat_cfg->generic_pkt = 0;
-       repeat_cfg->generic_pkt_repeat = 0;
-}
-
-static void hdmi_core_powerdown_disable(struct hdmi_ip_data *ip_data)
-{
-       DSSDBG("Enter hdmi_core_powerdown_disable\n");
-       REG_FLD_MOD(hdmi_core_sys_base(ip_data), HDMI_CORE_CTRL1, 0x0, 0, 0);
-}
-
-static void hdmi_core_swreset_release(struct hdmi_ip_data *ip_data)
-{
-       DSSDBG("Enter hdmi_core_swreset_release\n");
-       REG_FLD_MOD(hdmi_core_sys_base(ip_data), HDMI_CORE_SYS_SRST, 0x0, 0, 0);
-}
-
-static void hdmi_core_swreset_assert(struct hdmi_ip_data *ip_data)
-{
-       DSSDBG("Enter hdmi_core_swreset_assert\n");
-       REG_FLD_MOD(hdmi_core_sys_base(ip_data), HDMI_CORE_SYS_SRST, 0x1, 0, 0);
-}
-
-/* HDMI_CORE_VIDEO_CONFIG */
-static void hdmi_core_video_config(struct hdmi_ip_data *ip_data,
-                               struct hdmi_core_video_config *cfg)
-{
-       u32 r = 0;
-       void __iomem *core_sys_base = hdmi_core_sys_base(ip_data);
-
-       /* sys_ctrl1 default configuration not tunable */
-       r = hdmi_read_reg(core_sys_base, HDMI_CORE_CTRL1);
-       r = FLD_MOD(r, HDMI_CORE_CTRL1_VEN_FOLLOWVSYNC, 5, 5);
-       r = FLD_MOD(r, HDMI_CORE_CTRL1_HEN_FOLLOWHSYNC, 4, 4);
-       r = FLD_MOD(r, HDMI_CORE_CTRL1_BSEL_24BITBUS, 2, 2);
-       r = FLD_MOD(r, HDMI_CORE_CTRL1_EDGE_RISINGEDGE, 1, 1);
-       hdmi_write_reg(core_sys_base, HDMI_CORE_CTRL1, r);
-
-       REG_FLD_MOD(core_sys_base,
-                       HDMI_CORE_SYS_VID_ACEN, cfg->ip_bus_width, 7, 6);
-
-       /* Vid_Mode */
-       r = hdmi_read_reg(core_sys_base, HDMI_CORE_SYS_VID_MODE);
-
-       /* dither truncation configuration */
-       if (cfg->op_dither_truc > HDMI_OUTPUTTRUNCATION_12BIT) {
-               r = FLD_MOD(r, cfg->op_dither_truc - 3, 7, 6);
-               r = FLD_MOD(r, 1, 5, 5);
-       } else {
-               r = FLD_MOD(r, cfg->op_dither_truc, 7, 6);
-               r = FLD_MOD(r, 0, 5, 5);
-       }
-       hdmi_write_reg(core_sys_base, HDMI_CORE_SYS_VID_MODE, r);
-
-       /* HDMI_Ctrl */
-       r = hdmi_read_reg(hdmi_av_base(ip_data), HDMI_CORE_AV_HDMI_CTRL);
-       r = FLD_MOD(r, cfg->deep_color_pkt, 6, 6);
-       r = FLD_MOD(r, cfg->pkt_mode, 5, 3);
-       r = FLD_MOD(r, cfg->hdmi_dvi, 0, 0);
-       hdmi_write_reg(hdmi_av_base(ip_data), HDMI_CORE_AV_HDMI_CTRL, r);
-
-       /* TMDS_CTRL */
-       REG_FLD_MOD(core_sys_base,
-                       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)
-{
-       u32 val;
-       char sum = 0, checksum = 0;
-       void __iomem *av_base = hdmi_av_base(ip_data);
-
-       sum += 0x82 + 0x002 + 0x00D;
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082);
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_VERS, 0x002);
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_LEN, 0x00D);
-
-       val = (info_avi.db1_format << 5) |
-               (info_avi.db1_active_info << 4) |
-               (info_avi.db1_bar_info_dv << 2) |
-               (info_avi.db1_scan_info);
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(0), val);
-       sum += val;
-
-       val = (info_avi.db2_colorimetry << 6) |
-               (info_avi.db2_aspect_ratio << 4) |
-               (info_avi.db2_active_fmt_ar);
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(1), val);
-       sum += val;
-
-       val = (info_avi.db3_itc << 7) |
-               (info_avi.db3_ec << 4) |
-               (info_avi.db3_q_range << 2) |
-               (info_avi.db3_nup_scaling);
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(2), val);
-       sum += val;
-
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(3),
-                                       info_avi.db4_videocode);
-       sum += info_avi.db4_videocode;
-
-       val = info_avi.db5_pixel_repeat;
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(4), val);
-       sum += val;
-
-       val = info_avi.db6_7_line_eoftop & 0x00FF;
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(5), val);
-       sum += val;
-
-       val = ((info_avi.db6_7_line_eoftop >> 8) & 0x00FF);
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(6), val);
-       sum += val;
-
-       val = info_avi.db8_9_line_sofbottom & 0x00FF;
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(7), val);
-       sum += val;
-
-       val = ((info_avi.db8_9_line_sofbottom >> 8) & 0x00FF);
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(8), val);
-       sum += val;
-
-       val = info_avi.db10_11_pixel_eofleft & 0x00FF;
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(9), val);
-       sum += val;
-
-       val = ((info_avi.db10_11_pixel_eofleft >> 8) & 0x00FF);
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(10), val);
-       sum += val;
-
-       val = info_avi.db12_13_pixel_sofright & 0x00FF;
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(11), val);
-       sum += val;
-
-       val = ((info_avi.db12_13_pixel_sofright >> 8) & 0x00FF);
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(12), val);
-       sum += val;
-
-       checksum = 0x100 - sum;
-       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_CHSUM, checksum);
-}
-
-static void hdmi_core_av_packet_config(struct hdmi_ip_data *ip_data,
-               struct hdmi_core_packet_enable_repeat repeat_cfg)
-{
-       /* enable/repeat the infoframe */
-       hdmi_write_reg(hdmi_av_base(ip_data), HDMI_CORE_AV_PB_CTRL1,
-               (repeat_cfg.audio_pkt << 5) |
-               (repeat_cfg.audio_pkt_repeat << 4) |
-               (repeat_cfg.avi_infoframe << 1) |
-               (repeat_cfg.avi_infoframe_repeat));
-
-       /* enable/repeat the packet */
-       hdmi_write_reg(hdmi_av_base(ip_data), HDMI_CORE_AV_PB_CTRL2,
-               (repeat_cfg.gen_cntrl_pkt << 3) |
-               (repeat_cfg.gen_cntrl_pkt_repeat << 2) |
-               (repeat_cfg.generic_pkt << 1) |
-               (repeat_cfg.generic_pkt_repeat));
-}
-
-static void hdmi_wp_init(struct omap_video_timings *timings,
-                       struct hdmi_video_format *video_fmt,
-                       struct hdmi_video_interface *video_int)
-{
-       DSSDBG("Enter hdmi_wp_init\n");
-
-       timings->hbp = 0;
-       timings->hfp = 0;
-       timings->hsw = 0;
-       timings->vbp = 0;
-       timings->vfp = 0;
-       timings->vsw = 0;
-
-       video_fmt->packing_mode = HDMI_PACK_10b_RGB_YUV444;
-       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 */
-
-}
-
-static void hdmi_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,
-       struct omap_video_timings *timings, struct hdmi_config *param)
-{
-       DSSDBG("Enter hdmi_wp_video_init_format\n");
-
-       video_fmt->y_res = param->timings.timings.y_res;
-       video_fmt->x_res = param->timings.timings.x_res;
-
-       timings->hbp = param->timings.timings.hbp;
-       timings->hfp = param->timings.timings.hfp;
-       timings->hsw = param->timings.timings.hsw;
-       timings->vbp = param->timings.timings.vbp;
-       timings->vfp = param->timings.timings.vfp;
-       timings->vsw = param->timings.timings.vsw;
-}
-
-static void hdmi_wp_video_config_format(struct hdmi_ip_data *ip_data,
-               struct hdmi_video_format *video_fmt)
-{
-       u32 l = 0;
-
-       REG_FLD_MOD(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG,
-                       video_fmt->packing_mode, 10, 8);
-
-       l |= FLD_VAL(video_fmt->y_res, 31, 16);
-       l |= FLD_VAL(video_fmt->x_res, 15, 0);
-       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)
-{
-       u32 r;
-       DSSDBG("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);
-       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,
-               struct omap_video_timings *timings)
-{
-       u32 timing_h = 0;
-       u32 timing_v = 0;
-
-       DSSDBG("Enter hdmi_wp_video_config_timing\n");
-
-       timing_h |= FLD_VAL(timings->hbp, 31, 20);
-       timing_h |= FLD_VAL(timings->hfp, 19, 8);
-       timing_h |= FLD_VAL(timings->hsw, 7, 0);
-       hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_TIMING_H, timing_h);
-
-       timing_v |= FLD_VAL(timings->vbp, 31, 20);
-       timing_v |= FLD_VAL(timings->vfp, 19, 8);
-       timing_v |= FLD_VAL(timings->vsw, 7, 0);
-       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)
-{
-       /* 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_core_init(&v_core_cfg,
-               &avi_cfg,
-               &repeat_cfg);
-
-       hdmi_wp_video_init_format(&video_format, &video_timing, cfg);
-
-       hdmi_wp_video_config_timing(ip_data, &video_timing);
-
-       /* video config */
-       video_format.packing_mode = HDMI_PACK_24b_RGB_YUV444_YUV422;
-
-       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);
-
-       /*
-        * configure core video part
-        * set software reset in the core
-        */
-       hdmi_core_swreset_assert(ip_data);
-
-       /* power down off */
-       hdmi_core_powerdown_disable(ip_data);
-
-       v_core_cfg.pkt_mode = HDMI_PACKETMODE24BITPERPIXEL;
-       v_core_cfg.hdmi_dvi = cfg->cm.mode;
-
-       hdmi_core_video_config(ip_data, &v_core_cfg);
-
-       /* release software reset in the core */
-       hdmi_core_swreset_release(ip_data);
-
-       /*
-        * configure packet
-        * info frame video see doc CEA861-D page 65
-        */
-       avi_cfg.db1_format = HDMI_INFOFRAME_AVI_DB1Y_RGB;
-       avi_cfg.db1_active_info =
-               HDMI_INFOFRAME_AVI_DB1A_ACTIVE_FORMAT_OFF;
-       avi_cfg.db1_bar_info_dv = HDMI_INFOFRAME_AVI_DB1B_NO;
-       avi_cfg.db1_scan_info = HDMI_INFOFRAME_AVI_DB1S_0;
-       avi_cfg.db2_colorimetry = HDMI_INFOFRAME_AVI_DB2C_NO;
-       avi_cfg.db2_aspect_ratio = HDMI_INFOFRAME_AVI_DB2M_NO;
-       avi_cfg.db2_active_fmt_ar = HDMI_INFOFRAME_AVI_DB2R_SAME;
-       avi_cfg.db3_itc = HDMI_INFOFRAME_AVI_DB3ITC_NO;
-       avi_cfg.db3_ec = HDMI_INFOFRAME_AVI_DB3EC_XVYUV601;
-       avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_DEFAULT;
-       avi_cfg.db3_nup_scaling = HDMI_INFOFRAME_AVI_DB3SC_NO;
-       avi_cfg.db4_videocode = cfg->cm.code;
-       avi_cfg.db5_pixel_repeat = HDMI_INFOFRAME_AVI_DB5PR_NO;
-       avi_cfg.db6_7_line_eoftop = 0;
-       avi_cfg.db8_9_line_sofbottom = 0;
-       avi_cfg.db10_11_pixel_eofleft = 0;
-       avi_cfg.db12_13_pixel_sofright = 0;
-
-       hdmi_core_aux_infoframe_avi_config(ip_data, avi_cfg);
-
-       /* enable/repeat the infoframe */
-       repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
-       repeat_cfg.avi_infoframe_repeat = HDMI_PACKETREPEATON;
-       /* wakeup */
-       repeat_cfg.audio_pkt = HDMI_PACKETENABLE;
-       repeat_cfg.audio_pkt_repeat = HDMI_PACKETREPEATON;
-       hdmi_core_av_packet_config(ip_data, repeat_cfg);
-}
-
 static void update_hdmi_timings(struct hdmi_config *cfg,
                struct omap_video_timings *timings, int code)
 {
diff --git a/drivers/video/omap2/dss/hdmi.h b/drivers/video/omap2/dss/hdmi.h
deleted file mode 100644 (file)
index 2d4a22e..0000000
+++ /dev/null
@@ -1,574 +0,0 @@
-/*
- * hdmi.h
- *
- * HDMI driver definition for TI OMAP4 processors.
- *
- * 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 _OMAP4_DSS_HDMI_H_
-#define _OMAP4_DSS_HDMI_H_
-
-#include <linux/string.h>
-#include <video/omapdss.h>
-
-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)
-
-/* 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_CTRL1                                HDMI_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_INTR1                    HDMI_REG(0x1C4)
-#define HDMI_CORE_SYS_INTR2                    HDMI_REG(0x1C8)
-#define HDMI_CORE_SYS_INTR3                    HDMI_REG(0x1CC)
-#define HDMI_CORE_SYS_INTR4                    HDMI_REG(0x1D0)
-#define HDMI_CORE_SYS_UMASK1                   HDMI_REG(0x1D4)
-#define HDMI_CORE_SYS_TMDS_CTRL                        HDMI_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)
-#define HDMI_CORE_SYS_DE_CNTL                  HDMI_REG(0xD8)
-#define HDMI_CORE_SYS_DE_CNTH                  HDMI_REG(0xDC)
-#define HDMI_CORE_SYS_DE_LINL                  HDMI_REG(0xE0)
-#define HDMI_CORE_SYS_DE_LINH_1                        HDMI_REG(0xE4)
-#define HDMI_CORE_CTRL1_VEN_FOLLOWVSYNC        0x1
-#define HDMI_CORE_CTRL1_HEN_FOLLOWHSYNC        0x1
-#define HDMI_CORE_CTRL1_BSEL_24BITBUS          0x1
-#define HDMI_CORE_CTRL1_EDGE_RISINGEDGE        0x1
-
-/* HDMI DDC E-DID */
-#define HDMI_CORE_DDC_CMD                      HDMI_REG(0x3CC)
-#define HDMI_CORE_DDC_STATUS                   HDMI_REG(0x3C8)
-#define HDMI_CORE_DDC_ADDR                     HDMI_REG(0x3B4)
-#define HDMI_CORE_DDC_OFFSET                   HDMI_REG(0x3BC)
-#define HDMI_CORE_DDC_COUNT1                   HDMI_REG(0x3C0)
-#define HDMI_CORE_DDC_COUNT2                   HDMI_REG(0x3C4)
-#define HDMI_CORE_DDC_DATA                     HDMI_REG(0x3D0)
-#define HDMI_CORE_DDC_SEGM                     HDMI_REG(0x3B8)
-
-/* HDMI IP Core Audio Video */
-
-#define HDMI_CORE_AV_HDMI_CTRL                 HDMI_REG(0xBC)
-#define HDMI_CORE_AV_DPD                       HDMI_REG(0xF4)
-#define HDMI_CORE_AV_PB_CTRL1                  HDMI_REG(0xF8)
-#define HDMI_CORE_AV_PB_CTRL2                  HDMI_REG(0xFC)
-#define HDMI_CORE_AV_AVI_TYPE                  HDMI_REG(0x100)
-#define HDMI_CORE_AV_AVI_VERS                  HDMI_REG(0x104)
-#define HDMI_CORE_AV_AVI_LEN                   HDMI_REG(0x108)
-#define HDMI_CORE_AV_AVI_CHSUM                 HDMI_REG(0x10C)
-#define HDMI_CORE_AV_AVI_DBYTE(n)              HDMI_REG(n * 4 + 0x110)
-#define HDMI_CORE_AV_AVI_DBYTE_NELEMS          HDMI_REG(15)
-#define HDMI_CORE_AV_SPD_DBYTE                 HDMI_REG(0x190)
-#define HDMI_CORE_AV_SPD_DBYTE_NELEMS          HDMI_REG(27)
-#define HDMI_CORE_AV_AUD_DBYTE(n)              HDMI_REG(n * 4 + 0x210)
-#define HDMI_CORE_AV_AUD_DBYTE_NELEMS          HDMI_REG(10)
-#define HDMI_CORE_AV_MPEG_DBYTE                        HDMI_REG(0x290)
-#define HDMI_CORE_AV_MPEG_DBYTE_NELEMS         HDMI_REG(27)
-#define HDMI_CORE_AV_GEN_DBYTE                 HDMI_REG(0x300)
-#define HDMI_CORE_AV_GEN_DBYTE_NELEMS          HDMI_REG(31)
-#define HDMI_CORE_AV_GEN2_DBYTE                        HDMI_REG(0x380)
-#define HDMI_CORE_AV_GEN2_DBYTE_NELEMS         HDMI_REG(31)
-#define HDMI_CORE_AV_ACR_CTRL                  HDMI_REG(0x4)
-#define HDMI_CORE_AV_FREQ_SVAL                 HDMI_REG(0x8)
-#define HDMI_CORE_AV_N_SVAL1                   HDMI_REG(0xC)
-#define HDMI_CORE_AV_N_SVAL2                   HDMI_REG(0x10)
-#define HDMI_CORE_AV_N_SVAL3                   HDMI_REG(0x14)
-#define HDMI_CORE_AV_CTS_SVAL1                 HDMI_REG(0x18)
-#define HDMI_CORE_AV_CTS_SVAL2                 HDMI_REG(0x1C)
-#define HDMI_CORE_AV_CTS_SVAL3                 HDMI_REG(0x20)
-#define HDMI_CORE_AV_CTS_HVAL1                 HDMI_REG(0x24)
-#define HDMI_CORE_AV_CTS_HVAL2                 HDMI_REG(0x28)
-#define HDMI_CORE_AV_CTS_HVAL3                 HDMI_REG(0x2C)
-#define HDMI_CORE_AV_AUD_MODE                  HDMI_REG(0x50)
-#define HDMI_CORE_AV_SPDIF_CTRL                        HDMI_REG(0x54)
-#define HDMI_CORE_AV_HW_SPDIF_FS               HDMI_REG(0x60)
-#define HDMI_CORE_AV_SWAP_I2S                  HDMI_REG(0x64)
-#define HDMI_CORE_AV_SPDIF_ERTH                        HDMI_REG(0x6C)
-#define HDMI_CORE_AV_I2S_IN_MAP                        HDMI_REG(0x70)
-#define HDMI_CORE_AV_I2S_IN_CTRL               HDMI_REG(0x74)
-#define HDMI_CORE_AV_I2S_CHST0                 HDMI_REG(0x78)
-#define HDMI_CORE_AV_I2S_CHST1                 HDMI_REG(0x7C)
-#define HDMI_CORE_AV_I2S_CHST2                 HDMI_REG(0x80)
-#define HDMI_CORE_AV_I2S_CHST4                 HDMI_REG(0x84)
-#define HDMI_CORE_AV_I2S_CHST5                 HDMI_REG(0x88)
-#define HDMI_CORE_AV_ASRC                      HDMI_REG(0x8C)
-#define HDMI_CORE_AV_I2S_IN_LEN                        HDMI_REG(0x90)
-#define HDMI_CORE_AV_HDMI_CTRL                 HDMI_REG(0xBC)
-#define HDMI_CORE_AV_AUDO_TXSTAT               HDMI_REG(0xC0)
-#define HDMI_CORE_AV_AUD_PAR_BUSCLK_1          HDMI_REG(0xCC)
-#define HDMI_CORE_AV_AUD_PAR_BUSCLK_2          HDMI_REG(0xD0)
-#define HDMI_CORE_AV_AUD_PAR_BUSCLK_3          HDMI_REG(0xD4)
-#define HDMI_CORE_AV_TEST_TXCTRL               HDMI_REG(0xF0)
-#define HDMI_CORE_AV_DPD                       HDMI_REG(0xF4)
-#define HDMI_CORE_AV_PB_CTRL1                  HDMI_REG(0xF8)
-#define HDMI_CORE_AV_PB_CTRL2                  HDMI_REG(0xFC)
-#define HDMI_CORE_AV_AVI_TYPE                  HDMI_REG(0x100)
-#define HDMI_CORE_AV_AVI_VERS                  HDMI_REG(0x104)
-#define HDMI_CORE_AV_AVI_LEN                   HDMI_REG(0x108)
-#define HDMI_CORE_AV_AVI_CHSUM                 HDMI_REG(0x10C)
-#define HDMI_CORE_AV_SPD_TYPE                  HDMI_REG(0x180)
-#define HDMI_CORE_AV_SPD_VERS                  HDMI_REG(0x184)
-#define HDMI_CORE_AV_SPD_LEN                   HDMI_REG(0x188)
-#define HDMI_CORE_AV_SPD_CHSUM                 HDMI_REG(0x18C)
-#define HDMI_CORE_AV_AUDIO_TYPE                        HDMI_REG(0x200)
-#define HDMI_CORE_AV_AUDIO_VERS                        HDMI_REG(0x204)
-#define HDMI_CORE_AV_AUDIO_LEN                 HDMI_REG(0x208)
-#define HDMI_CORE_AV_AUDIO_CHSUM               HDMI_REG(0x20C)
-#define HDMI_CORE_AV_MPEG_TYPE                 HDMI_REG(0x280)
-#define HDMI_CORE_AV_MPEG_VERS                 HDMI_REG(0x284)
-#define HDMI_CORE_AV_MPEG_LEN                  HDMI_REG(0x288)
-#define HDMI_CORE_AV_MPEG_CHSUM                        HDMI_REG(0x28C)
-#define HDMI_CORE_AV_CP_BYTE1                  HDMI_REG(0x37C)
-#define HDMI_CORE_AV_CEC_ADDR_ID               HDMI_REG(0x3FC)
-#define HDMI_CORE_AV_SPD_DBYTE_ELSIZE          0x4
-#define HDMI_CORE_AV_GEN2_DBYTE_ELSIZE         0x4
-#define HDMI_CORE_AV_MPEG_DBYTE_ELSIZE         0x4
-#define HDMI_CORE_AV_GEN_DBYTE_ELSIZE          0x4
-
-/* PLL */
-
-#define PLLCTRL_PLL_CONTROL                    HDMI_REG(0x0)
-#define PLLCTRL_PLL_STATUS                     HDMI_REG(0x4)
-#define PLLCTRL_PLL_GO                         HDMI_REG(0x8)
-#define PLLCTRL_CFG1                           HDMI_REG(0xC)
-#define PLLCTRL_CFG2                           HDMI_REG(0x10)
-#define PLLCTRL_CFG3                           HDMI_REG(0x14)
-#define PLLCTRL_CFG4                           HDMI_REG(0x20)
-
-/* HDMI PHY */
-
-#define HDMI_TXPHY_TX_CTRL                     HDMI_REG(0x0)
-#define HDMI_TXPHY_DIGITAL_CTRL                        HDMI_REG(0x4)
-#define HDMI_TXPHY_POWER_CTRL                  HDMI_REG(0x8)
-#define HDMI_TXPHY_PAD_CFG_CTRL                        HDMI_REG(0xC)
-
-#define REG_FLD_MOD(base, idx, val, start, end) \
-       hdmi_write_reg(base, idx, FLD_MOD(hdmi_read_reg(base, idx),\
-                                                       val, start, end))
-#define REG_GET(base, idx, start, end) \
-       FLD_GET(hdmi_read_reg(base, idx), start, end)
-
-enum hdmi_phy_pwr {
-       HDMI_PHYPWRCMD_OFF = 0,
-       HDMI_PHYPWRCMD_LDOON = 1,
-       HDMI_PHYPWRCMD_TXON = 2
-};
-
-enum hdmi_core_inputbus_width {
-       HDMI_INPUT_8BIT = 0,
-       HDMI_INPUT_10BIT = 1,
-       HDMI_INPUT_12BIT = 2
-};
-
-enum hdmi_core_dither_trunc {
-       HDMI_OUTPUTTRUNCATION_8BIT = 0,
-       HDMI_OUTPUTTRUNCATION_10BIT = 1,
-       HDMI_OUTPUTTRUNCATION_12BIT = 2,
-       HDMI_OUTPUTDITHER_8BIT = 3,
-       HDMI_OUTPUTDITHER_10BIT = 4,
-       HDMI_OUTPUTDITHER_12BIT = 5
-};
-
-enum hdmi_core_deepcolor_ed {
-       HDMI_DEEPCOLORPACKECTDISABLE = 0,
-       HDMI_DEEPCOLORPACKECTENABLE = 1
-};
-
-enum hdmi_core_packet_mode {
-       HDMI_PACKETMODERESERVEDVALUE = 0,
-       HDMI_PACKETMODE24BITPERPIXEL = 4,
-       HDMI_PACKETMODE30BITPERPIXEL = 5,
-       HDMI_PACKETMODE36BITPERPIXEL = 6,
-       HDMI_PACKETMODE48BITPERPIXEL = 7
-};
-
-enum hdmi_core_tclkselclkmult {
-       HDMI_FPLL05IDCK = 0,
-       HDMI_FPLL10IDCK = 1,
-       HDMI_FPLL20IDCK = 2,
-       HDMI_FPLL40IDCK = 3
-};
-
-enum hdmi_core_packet_ctrl {
-       HDMI_PACKETENABLE = 1,
-       HDMI_PACKETDISABLE = 0,
-       HDMI_PACKETREPEATON = 1,
-       HDMI_PACKETREPEATOFF = 0
-};
-
-/* INFOFRAME_AVI_ and INFOFRAME_AUDIO_ definitions */
-enum hdmi_core_infoframe {
-       HDMI_INFOFRAME_AVI_DB1Y_RGB = 0,
-       HDMI_INFOFRAME_AVI_DB1Y_YUV422 = 1,
-       HDMI_INFOFRAME_AVI_DB1Y_YUV444 = 2,
-       HDMI_INFOFRAME_AVI_DB1A_ACTIVE_FORMAT_OFF = 0,
-       HDMI_INFOFRAME_AVI_DB1A_ACTIVE_FORMAT_ON =  1,
-       HDMI_INFOFRAME_AVI_DB1B_NO = 0,
-       HDMI_INFOFRAME_AVI_DB1B_VERT = 1,
-       HDMI_INFOFRAME_AVI_DB1B_HORI = 2,
-       HDMI_INFOFRAME_AVI_DB1B_VERTHORI = 3,
-       HDMI_INFOFRAME_AVI_DB1S_0 = 0,
-       HDMI_INFOFRAME_AVI_DB1S_1 = 1,
-       HDMI_INFOFRAME_AVI_DB1S_2 = 2,
-       HDMI_INFOFRAME_AVI_DB2C_NO = 0,
-       HDMI_INFOFRAME_AVI_DB2C_ITU601 = 1,
-       HDMI_INFOFRAME_AVI_DB2C_ITU709 = 2,
-       HDMI_INFOFRAME_AVI_DB2C_EC_EXTENDED = 3,
-       HDMI_INFOFRAME_AVI_DB2M_NO = 0,
-       HDMI_INFOFRAME_AVI_DB2M_43 = 1,
-       HDMI_INFOFRAME_AVI_DB2M_169 = 2,
-       HDMI_INFOFRAME_AVI_DB2R_SAME = 8,
-       HDMI_INFOFRAME_AVI_DB2R_43 = 9,
-       HDMI_INFOFRAME_AVI_DB2R_169 = 10,
-       HDMI_INFOFRAME_AVI_DB2R_149 = 11,
-       HDMI_INFOFRAME_AVI_DB3ITC_NO = 0,
-       HDMI_INFOFRAME_AVI_DB3ITC_YES = 1,
-       HDMI_INFOFRAME_AVI_DB3EC_XVYUV601 = 0,
-       HDMI_INFOFRAME_AVI_DB3EC_XVYUV709 = 1,
-       HDMI_INFOFRAME_AVI_DB3Q_DEFAULT = 0,
-       HDMI_INFOFRAME_AVI_DB3Q_LR = 1,
-       HDMI_INFOFRAME_AVI_DB3Q_FR = 2,
-       HDMI_INFOFRAME_AVI_DB3SC_NO = 0,
-       HDMI_INFOFRAME_AVI_DB3SC_HORI = 1,
-       HDMI_INFOFRAME_AVI_DB3SC_VERT = 2,
-       HDMI_INFOFRAME_AVI_DB3SC_HORIVERT = 3,
-       HDMI_INFOFRAME_AVI_DB5PR_NO = 0,
-       HDMI_INFOFRAME_AVI_DB5PR_2 = 1,
-       HDMI_INFOFRAME_AVI_DB5PR_3 = 2,
-       HDMI_INFOFRAME_AVI_DB5PR_4 = 3,
-       HDMI_INFOFRAME_AVI_DB5PR_5 = 4,
-       HDMI_INFOFRAME_AVI_DB5PR_6 = 5,
-       HDMI_INFOFRAME_AVI_DB5PR_7 = 6,
-       HDMI_INFOFRAME_AVI_DB5PR_8 = 7,
-       HDMI_INFOFRAME_AVI_DB5PR_9 = 8,
-       HDMI_INFOFRAME_AVI_DB5PR_10 = 9,
-       HDMI_INFOFRAME_AUDIO_DB1CT_FROM_STREAM = 0,
-       HDMI_INFOFRAME_AUDIO_DB1CT_IEC60958 = 1,
-       HDMI_INFOFRAME_AUDIO_DB1CT_AC3 = 2,
-       HDMI_INFOFRAME_AUDIO_DB1CT_MPEG1 = 3,
-       HDMI_INFOFRAME_AUDIO_DB1CT_MP3 = 4,
-       HDMI_INFOFRAME_AUDIO_DB1CT_MPEG2_MULTICH = 5,
-       HDMI_INFOFRAME_AUDIO_DB1CT_AAC = 6,
-       HDMI_INFOFRAME_AUDIO_DB1CT_DTS = 7,
-       HDMI_INFOFRAME_AUDIO_DB1CT_ATRAC = 8,
-       HDMI_INFOFRAME_AUDIO_DB1CT_ONEBIT = 9,
-       HDMI_INFOFRAME_AUDIO_DB1CT_DOLBY_DIGITAL_PLUS = 10,
-       HDMI_INFOFRAME_AUDIO_DB1CT_DTS_HD = 11,
-       HDMI_INFOFRAME_AUDIO_DB1CT_MAT = 12,
-       HDMI_INFOFRAME_AUDIO_DB1CT_DST = 13,
-       HDMI_INFOFRAME_AUDIO_DB1CT_WMA_PRO = 14,
-       HDMI_INFOFRAME_AUDIO_DB2SF_FROM_STREAM = 0,
-       HDMI_INFOFRAME_AUDIO_DB2SF_32000 = 1,
-       HDMI_INFOFRAME_AUDIO_DB2SF_44100 = 2,
-       HDMI_INFOFRAME_AUDIO_DB2SF_48000 = 3,
-       HDMI_INFOFRAME_AUDIO_DB2SF_88200 = 4,
-       HDMI_INFOFRAME_AUDIO_DB2SF_96000 = 5,
-       HDMI_INFOFRAME_AUDIO_DB2SF_176400 = 6,
-       HDMI_INFOFRAME_AUDIO_DB2SF_192000 = 7,
-       HDMI_INFOFRAME_AUDIO_DB2SS_FROM_STREAM = 0,
-       HDMI_INFOFRAME_AUDIO_DB2SS_16BIT = 1,
-       HDMI_INFOFRAME_AUDIO_DB2SS_20BIT = 2,
-       HDMI_INFOFRAME_AUDIO_DB2SS_24BIT = 3,
-       HDMI_INFOFRAME_AUDIO_DB5_DM_INH_PERMITTED = 0,
-       HDMI_INFOFRAME_AUDIO_DB5_DM_INH_PROHIBITED = 1
-};
-
-enum hdmi_packing_mode {
-       HDMI_PACK_10b_RGB_YUV444 = 0,
-       HDMI_PACK_24b_RGB_YUV444_YUV422 = 1,
-       HDMI_PACK_20b_YUV422 = 2,
-       HDMI_PACK_ALREADYPACKED = 7
-};
-
-enum hdmi_core_audio_sample_freq {
-       HDMI_AUDIO_FS_32000 = 0x3,
-       HDMI_AUDIO_FS_44100 = 0x0,
-       HDMI_AUDIO_FS_48000 = 0x2,
-       HDMI_AUDIO_FS_88200 = 0x8,
-       HDMI_AUDIO_FS_96000 = 0xA,
-       HDMI_AUDIO_FS_176400 = 0xC,
-       HDMI_AUDIO_FS_192000 = 0xE,
-       HDMI_AUDIO_FS_NOT_INDICATED = 0x1
-};
-
-enum hdmi_core_audio_layout {
-       HDMI_AUDIO_LAYOUT_2CH = 0,
-       HDMI_AUDIO_LAYOUT_8CH = 1
-};
-
-enum hdmi_core_cts_mode {
-       HDMI_AUDIO_CTS_MODE_HW = 0,
-       HDMI_AUDIO_CTS_MODE_SW = 1
-};
-
-enum hdmi_stereo_channels {
-       HDMI_AUDIO_STEREO_NOCHANNELS = 0,
-       HDMI_AUDIO_STEREO_ONECHANNEL = 1,
-       HDMI_AUDIO_STEREO_TWOCHANNELS = 2,
-       HDMI_AUDIO_STEREO_THREECHANNELS = 3,
-       HDMI_AUDIO_STEREO_FOURCHANNELS = 4
-};
-
-enum hdmi_audio_type {
-       HDMI_AUDIO_TYPE_LPCM = 0,
-       HDMI_AUDIO_TYPE_IEC = 1
-};
-
-enum hdmi_audio_justify {
-       HDMI_AUDIO_JUSTIFY_LEFT = 0,
-       HDMI_AUDIO_JUSTIFY_RIGHT = 1
-};
-
-enum hdmi_audio_sample_order {
-       HDMI_AUDIO_SAMPLE_RIGHT_FIRST = 0,
-       HDMI_AUDIO_SAMPLE_LEFT_FIRST = 1
-};
-
-enum hdmi_audio_samples_perword {
-       HDMI_AUDIO_ONEWORD_ONESAMPLE = 0,
-       HDMI_AUDIO_ONEWORD_TWOSAMPLES = 1
-};
-
-enum hdmi_audio_sample_size {
-       HDMI_AUDIO_SAMPLE_16BITS = 0,
-       HDMI_AUDIO_SAMPLE_24BITS = 1
-};
-
-enum hdmi_audio_transf_mode {
-       HDMI_AUDIO_TRANSF_DMA = 0,
-       HDMI_AUDIO_TRANSF_IRQ = 1
-};
-
-enum hdmi_audio_blk_strt_end_sig {
-       HDMI_AUDIO_BLOCK_SIG_STARTEND_ON = 0,
-       HDMI_AUDIO_BLOCK_SIG_STARTEND_OFF = 1
-};
-
-enum hdmi_audio_i2s_config {
-       HDMI_AUDIO_I2S_WS_POLARITY_LOW_IS_LEFT = 0,
-       HDMI_AUDIO_I2S_WS_POLARIT_YLOW_IS_RIGHT = 1,
-       HDMI_AUDIO_I2S_MSB_SHIFTED_FIRST = 0,
-       HDMI_AUDIO_I2S_LSB_SHIFTED_FIRST = 1,
-       HDMI_AUDIO_I2S_MAX_WORD_20BITS = 0,
-       HDMI_AUDIO_I2S_MAX_WORD_24BITS = 1,
-       HDMI_AUDIO_I2S_CHST_WORD_NOT_SPECIFIED = 0,
-       HDMI_AUDIO_I2S_CHST_WORD_16_BITS = 1,
-       HDMI_AUDIO_I2S_CHST_WORD_17_BITS = 6,
-       HDMI_AUDIO_I2S_CHST_WORD_18_BITS = 2,
-       HDMI_AUDIO_I2S_CHST_WORD_19_BITS = 4,
-       HDMI_AUDIO_I2S_CHST_WORD_20_BITS_20MAX = 5,
-       HDMI_AUDIO_I2S_CHST_WORD_20_BITS_24MAX = 1,
-       HDMI_AUDIO_I2S_CHST_WORD_21_BITS = 6,
-       HDMI_AUDIO_I2S_CHST_WORD_22_BITS = 2,
-       HDMI_AUDIO_I2S_CHST_WORD_23_BITS = 4,
-       HDMI_AUDIO_I2S_CHST_WORD_24_BITS = 5,
-       HDMI_AUDIO_I2S_SCK_EDGE_FALLING = 0,
-       HDMI_AUDIO_I2S_SCK_EDGE_RISING = 1,
-       HDMI_AUDIO_I2S_VBIT_FOR_PCM = 0,
-       HDMI_AUDIO_I2S_VBIT_FOR_COMPRESSED = 1,
-       HDMI_AUDIO_I2S_INPUT_LENGTH_NA = 0,
-       HDMI_AUDIO_I2S_INPUT_LENGTH_16 = 2,
-       HDMI_AUDIO_I2S_INPUT_LENGTH_17 = 12,
-       HDMI_AUDIO_I2S_INPUT_LENGTH_18 = 4,
-       HDMI_AUDIO_I2S_INPUT_LENGTH_19 = 8,
-       HDMI_AUDIO_I2S_INPUT_LENGTH_20 = 10,
-       HDMI_AUDIO_I2S_INPUT_LENGTH_21 = 13,
-       HDMI_AUDIO_I2S_INPUT_LENGTH_22 = 5,
-       HDMI_AUDIO_I2S_INPUT_LENGTH_23 = 9,
-       HDMI_AUDIO_I2S_INPUT_LENGTH_24 = 11,
-       HDMI_AUDIO_I2S_FIRST_BIT_SHIFT = 0,
-       HDMI_AUDIO_I2S_FIRST_BIT_NO_SHIFT = 1,
-       HDMI_AUDIO_I2S_SD0_EN = 1,
-       HDMI_AUDIO_I2S_SD1_EN = 1 << 1,
-       HDMI_AUDIO_I2S_SD2_EN = 1 << 2,
-       HDMI_AUDIO_I2S_SD3_EN = 1 << 3,
-};
-
-enum hdmi_audio_mclk_mode {
-       HDMI_AUDIO_MCLK_128FS = 0,
-       HDMI_AUDIO_MCLK_256FS = 1,
-       HDMI_AUDIO_MCLK_384FS = 2,
-       HDMI_AUDIO_MCLK_512FS = 3,
-       HDMI_AUDIO_MCLK_768FS = 4,
-       HDMI_AUDIO_MCLK_1024FS = 5,
-       HDMI_AUDIO_MCLK_1152FS = 6,
-       HDMI_AUDIO_MCLK_192FS = 7
-};
-
-struct hdmi_core_video_config {
-       enum hdmi_core_inputbus_width   ip_bus_width;
-       enum hdmi_core_dither_trunc     op_dither_truc;
-       enum hdmi_core_deepcolor_ed     deep_color_pkt;
-       enum hdmi_core_packet_mode      pkt_mode;
-       enum hdmi_core_hdmi_dvi         hdmi_dvi;
-       enum hdmi_core_tclkselclkmult   tclk_sel_clkmult;
-};
-
-/*
- * Refer to section 8.2 in HDMI 1.3 specification for
- * details about infoframe databytes
- */
-struct hdmi_core_infoframe_avi {
-       u8      db1_format;
-               /* Y0, Y1 rgb,yCbCr */
-       u8      db1_active_info;
-               /* A0  Active information Present */
-       u8      db1_bar_info_dv;
-               /* B0, B1 Bar info data valid */
-       u8      db1_scan_info;
-               /* S0, S1 scan information */
-       u8      db2_colorimetry;
-               /* C0, C1 colorimetry */
-       u8      db2_aspect_ratio;
-               /* M0, M1 Aspect ratio (4:3, 16:9) */
-       u8      db2_active_fmt_ar;
-               /* R0...R3 Active format aspect ratio */
-       u8      db3_itc;
-               /* ITC IT content. */
-       u8      db3_ec;
-               /* EC0, EC1, EC2 Extended colorimetry */
-       u8      db3_q_range;
-               /* Q1, Q0 Quantization range */
-       u8      db3_nup_scaling;
-               /* SC1, SC0 Non-uniform picture scaling */
-       u8      db4_videocode;
-               /* VIC0..6 Video format identification */
-       u8      db5_pixel_repeat;
-               /* PR0..PR3 Pixel repetition factor */
-       u16     db6_7_line_eoftop;
-               /* Line number end of top bar */
-       u16     db8_9_line_sofbottom;
-               /* Line number start of bottom bar */
-       u16     db10_11_pixel_eofleft;
-               /* Pixel number end of left bar */
-       u16     db12_13_pixel_sofright;
-               /* Pixel number start of right bar */
-};
-/*
- * Refer to section 8.2 in HDMI 1.3 specification for
- * details about infoframe databytes
- */
-struct hdmi_core_infoframe_audio {
-       u8 db1_coding_type;
-       u8 db1_channel_count;
-       u8 db2_sample_freq;
-       u8 db2_sample_size;
-       u8 db4_channel_alloc;
-       bool db5_downmix_inh;
-       u8 db5_lsv;     /* Level shift values for downmix */
-};
-
-struct hdmi_core_packet_enable_repeat {
-       u32     audio_pkt;
-       u32     audio_pkt_repeat;
-       u32     avi_infoframe;
-       u32     avi_infoframe_repeat;
-       u32     gen_cntrl_pkt;
-       u32     gen_cntrl_pkt_repeat;
-       u32     generic_pkt;
-       u32     generic_pkt_repeat;
-};
-
-struct hdmi_video_format {
-       enum hdmi_packing_mode  packing_mode;
-       u32                     y_res;  /* Line per panel */
-       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;
-       enum hdmi_audio_type                    type;
-       enum hdmi_audio_justify                 justification;
-       enum hdmi_audio_sample_order            sample_order;
-       enum hdmi_audio_samples_perword         samples_per_word;
-       enum hdmi_audio_sample_size             sample_size;
-       enum hdmi_audio_blk_strt_end_sig        en_sig_blk_strt_end;
-};
-
-struct hdmi_audio_dma {
-       u8                              transfer_size;
-       u8                              block_size;
-       enum hdmi_audio_transf_mode     mode;
-       u16                             fifo_threshold;
-};
-
-struct hdmi_core_audio_i2s_config {
-       u8 word_max_length;
-       u8 word_length;
-       u8 in_length_bits;
-       u8 justification;
-       u8 en_high_bitrate_aud;
-       u8 sck_edge_mode;
-       u8 cbit_order;
-       u8 vbit;
-       u8 ws_polarity;
-       u8 direction;
-       u8 shift;
-       u8 active_sds;
-};
-
-struct hdmi_core_audio_config {
-       struct hdmi_core_audio_i2s_config       i2s_cfg;
-       enum hdmi_core_audio_sample_freq        freq_sample;
-       bool                                    fs_override;
-       u32                                     n;
-       u32                                     cts;
-       u32                                     aud_par_busclk;
-       enum hdmi_core_audio_layout             layout;
-       enum hdmi_core_cts_mode                 cts_mode;
-       bool                                    use_mclk;
-       enum hdmi_audio_mclk_mode               mclk_mode;
-       bool                                    en_acr_pkt;
-       bool                                    en_dsd_audio;
-       bool                                    en_parallel_aud_input;
-       bool                                    en_spdif;
-};
-#endif
index f0e508ec28d1532dac5e282521d77d7e4a963483..7c630984767d9449fa3f71d3822c627982b0d6e9 100644 (file)
@@ -91,4 +91,11 @@ 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);
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
new file mode 100644 (file)
index 0000000..b97a3c0
--- /dev/null
@@ -0,0 +1,767 @@
+/*
+ * ti_hdmi_4xxx_ip.c
+ *
+ * HDMI TI81xx, TI38xx, TI OMAP4 etc IP driver Library
+ * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/
+ * Authors: Yong Zhi
+ *     Mythri pk <mythripk@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 "ti_hdmi_4xxx_ip.h"
+#include "dss.h"
+
+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++ > 10000)
+                       return !val;
+       }
+       return val;
+}
+
+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,
+                                                       0, 0, 1) != 1) {
+               pr_err("PLL GO bit not set\n");
+               return -ETIMEDOUT;
+       }
+
+       /* Wait till the lock bit is set in PLL status */
+       if (hdmi_wait_for_bit_change(pll_base,
+                               PLLCTRL_PLL_STATUS, 1, 1, 1) != 1) {
+               pr_err("cannot lock PLL\n");
+               pr_err("CFG1 0x%x\n",
+                       hdmi_read_reg(pll_base, PLLCTRL_CFG1));
+               pr_err("CFG2 0x%x\n",
+                       hdmi_read_reg(pll_base, PLLCTRL_CFG2));
+               pr_err("CFG4 0x%x\n",
+                       hdmi_read_reg(pll_base, PLLCTRL_CFG4));
+               return -ETIMEDOUT;
+       }
+
+       pr_debug("PLL locked!\n");
+
+       return 0;
+}
+
+/* PHY_PWR_CMD */
+static int hdmi_set_phy_pwr(struct hdmi_ip_data *ip_data, enum hdmi_phy_pwr val)
+{
+       /* Command for power control of HDMI PHY */
+       REG_FLD_MOD(hdmi_wp_base(ip_data), HDMI_WP_PWR_CTRL, val, 7, 6);
+
+       /* Status of the power control of HDMI PHY */
+       if (hdmi_wait_for_bit_change(hdmi_wp_base(ip_data),
+                               HDMI_WP_PWR_CTRL, 5, 4, val) != val) {
+               pr_err("Failed to set PHY power mode to %d\n", val);
+               return -ETIMEDOUT;
+       }
+
+       return 0;
+}
+
+/* PLL_PWR_CMD */
+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);
+
+       /* wait till PHY_PWR_STATUS is set */
+       if (hdmi_wait_for_bit_change(hdmi_wp_base(ip_data), HDMI_WP_PWR_CTRL,
+                                               1, 0, val) != val) {
+               pr_err("Failed to set PLL_PWR_STATUS\n");
+               return -ETIMEDOUT;
+       }
+
+       return 0;
+}
+
+static int hdmi_pll_reset(struct hdmi_ip_data *ip_data)
+{
+       /* SYSRESET  controlled by power FSM */
+       REG_FLD_MOD(hdmi_pll_base(ip_data), PLLCTRL_PLL_CONTROL, 0x0, 3, 3);
+
+       /* READ 0x0 reset is in progress */
+       if (hdmi_wait_for_bit_change(hdmi_pll_base(ip_data),
+                               PLLCTRL_PLL_STATUS, 0, 0, 1) != 1) {
+               pr_err("Failed to sysreset PLL\n");
+               return -ETIMEDOUT;
+       }
+
+       return 0;
+}
+
+int hdmi_pll_program(struct hdmi_ip_data *ip_data)
+{
+       u16 r = 0;
+
+       r = hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_ALLOFF);
+       if (r)
+               return r;
+
+       r = hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_BOTHON_ALLCLKS);
+       if (r)
+               return r;
+
+       r = hdmi_pll_reset(ip_data);
+       if (r)
+               return r;
+
+       r = hdmi_pll_init(ip_data);
+       if (r)
+               return r;
+
+       return 0;
+}
+
+int hdmi_phy_init(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;
+
+       /*
+        * Read address 0 in order to get the SCP reset done completed
+        * Dummy access performed to make sure reset is done
+        */
+       hdmi_read_reg(phy_base, HDMI_TXPHY_TX_CTRL);
+
+       /*
+        * Write to phy address 0 to configure the clock
+        * use HFBITCLK write HDMI_TXPHY_TX_CONTROL_FREQOUT field
+        */
+       REG_FLD_MOD(phy_base, HDMI_TXPHY_TX_CTRL, 0x1, 31, 30);
+
+       /* Write to phy address 1 to start HDMI line (TXVALID and TMDSCLKEN) */
+       hdmi_write_reg(phy_base, HDMI_TXPHY_DIGITAL_CTRL, 0xF0000000);
+
+       /* Setup max LDO voltage */
+       REG_FLD_MOD(phy_base, HDMI_TXPHY_POWER_CTRL, 0xB, 3, 0);
+
+       /* Write to phy address 3 to change the polarity control */
+       REG_FLD_MOD(phy_base, HDMI_TXPHY_PAD_CFG_CTRL, 0x1, 27, 27);
+
+       return 0;
+}
+
+void hdmi_phy_off(struct hdmi_ip_data *ip_data)
+{
+       hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF);
+}
+
+static int hdmi_core_ddc_edid(struct hdmi_ip_data *ip_data,
+                                               u8 *pedid, int ext)
+{
+       u32 i, j;
+       char checksum = 0;
+       u32 offset = 0;
+       void __iomem *core_sys_base = hdmi_core_sys_base(ip_data);
+
+       /* Turn on CLK for DDC */
+       REG_FLD_MOD(hdmi_av_base(ip_data), HDMI_CORE_AV_DPD, 0x7, 2, 0);
+
+       /*
+        * SW HACK : Without the Delay DDC(i2c bus) reads 0 values /
+        * right shifted values( The behavior is not consistent and seen only
+        * with some TV's)
+        */
+       usleep_range(800, 1000);
+
+       if (!ext) {
+               /* Clk SCL Devices */
+               REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_CMD, 0xA, 3, 0);
+
+               /* HDMI_CORE_DDC_STATUS_IN_PROG */
+               if (hdmi_wait_for_bit_change(core_sys_base,
+                                       HDMI_CORE_DDC_STATUS, 4, 4, 0) != 0) {
+                       pr_err("Failed to program DDC\n");
+                       return -ETIMEDOUT;
+               }
+
+               /* Clear FIFO */
+               REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_CMD, 0x9, 3, 0);
+
+               /* HDMI_CORE_DDC_STATUS_IN_PROG */
+               if (hdmi_wait_for_bit_change(core_sys_base,
+                                       HDMI_CORE_DDC_STATUS, 4, 4, 0) != 0) {
+                       pr_err("Failed to program DDC\n");
+                       return -ETIMEDOUT;
+               }
+
+       } else {
+               if (ext % 2 != 0)
+                       offset = 0x80;
+       }
+
+       /* Load Segment Address Register */
+       REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_SEGM, ext/2, 7, 0);
+
+       /* Load Slave Address Register */
+       REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_ADDR, 0xA0 >> 1, 7, 1);
+
+       /* Load Offset Address Register */
+       REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_OFFSET, offset, 7, 0);
+
+       /* Load Byte Count */
+       REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_COUNT1, 0x80, 7, 0);
+       REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_COUNT2, 0x0, 1, 0);
+
+       /* Set DDC_CMD */
+       if (ext)
+               REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_CMD, 0x4, 3, 0);
+       else
+               REG_FLD_MOD(core_sys_base, HDMI_CORE_DDC_CMD, 0x2, 3, 0);
+
+       /* HDMI_CORE_DDC_STATUS_BUS_LOW */
+       if (REG_GET(core_sys_base,
+                                       HDMI_CORE_DDC_STATUS, 6, 6) == 1) {
+               pr_err("I2C Bus Low?\n");
+               return -EIO;
+       }
+       /* HDMI_CORE_DDC_STATUS_NO_ACK */
+       if (REG_GET(core_sys_base,
+                                       HDMI_CORE_DDC_STATUS, 5, 5) == 1) {
+               pr_err("I2C No Ack\n");
+               return -EIO;
+       }
+
+       i = ext * 128;
+       j = 0;
+       while (((REG_GET(core_sys_base, HDMI_CORE_DDC_STATUS, 4, 4) == 1) ||
+                       (REG_GET(core_sys_base,
+                       HDMI_CORE_DDC_STATUS, 2, 2) == 0)) && j < 128) {
+
+               if (REG_GET(core_sys_base, HDMI_CORE_DDC_STATUS, 2, 2) == 0) {
+                       /* FIFO not empty */
+                       pedid[i++] = REG_GET(core_sys_base,
+                                               HDMI_CORE_DDC_DATA, 7, 0);
+                       j++;
+               }
+       }
+
+       for (j = 0; j < 128; j++)
+               checksum += pedid[j];
+
+       if (checksum != 0) {
+               pr_err("E-EDID checksum failed!!\n");
+               return -EIO;
+       }
+
+       return 0;
+}
+
+int read_edid(struct hdmi_ip_data *ip_data, u8 *pedid, u16 max_length)
+{
+       int r = 0, n = 0, i = 0;
+       int max_ext_blocks = (max_length / 128) - 1;
+
+       r = hdmi_core_ddc_edid(ip_data, pedid, 0);
+       if (r) {
+               return r;
+       } else {
+               n = pedid[0x7e];
+
+               /*
+                * README: need to comply with max_length set by the caller.
+                * Better implementation should be to allocate necessary
+                * memory to store EDID according to nb_block field found
+                * in first block
+                */
+               if (n > max_ext_blocks)
+                       n = max_ext_blocks;
+
+               for (i = 1; i <= n; i++) {
+                       r = hdmi_core_ddc_edid(ip_data, pedid, i);
+                       if (r)
+                               return r;
+               }
+       }
+       return 0;
+}
+
+static void hdmi_core_init(struct hdmi_core_video_config *video_cfg,
+                       struct hdmi_core_infoframe_avi *avi_cfg,
+                       struct hdmi_core_packet_enable_repeat *repeat_cfg)
+{
+       pr_debug("Enter hdmi_core_init\n");
+
+       /* video core */
+       video_cfg->ip_bus_width = HDMI_INPUT_8BIT;
+       video_cfg->op_dither_truc = HDMI_OUTPUTTRUNCATION_8BIT;
+       video_cfg->deep_color_pkt = HDMI_DEEPCOLORPACKECTDISABLE;
+       video_cfg->pkt_mode = HDMI_PACKETMODERESERVEDVALUE;
+       video_cfg->hdmi_dvi = HDMI_DVI;
+       video_cfg->tclk_sel_clkmult = HDMI_FPLL10IDCK;
+
+       /* info frame */
+       avi_cfg->db1_format = 0;
+       avi_cfg->db1_active_info = 0;
+       avi_cfg->db1_bar_info_dv = 0;
+       avi_cfg->db1_scan_info = 0;
+       avi_cfg->db2_colorimetry = 0;
+       avi_cfg->db2_aspect_ratio = 0;
+       avi_cfg->db2_active_fmt_ar = 0;
+       avi_cfg->db3_itc = 0;
+       avi_cfg->db3_ec = 0;
+       avi_cfg->db3_q_range = 0;
+       avi_cfg->db3_nup_scaling = 0;
+       avi_cfg->db4_videocode = 0;
+       avi_cfg->db5_pixel_repeat = 0;
+       avi_cfg->db6_7_line_eoftop = 0 ;
+       avi_cfg->db8_9_line_sofbottom = 0;
+       avi_cfg->db10_11_pixel_eofleft = 0;
+       avi_cfg->db12_13_pixel_sofright = 0;
+
+       /* packet enable and repeat */
+       repeat_cfg->audio_pkt = 0;
+       repeat_cfg->audio_pkt_repeat = 0;
+       repeat_cfg->avi_infoframe = 0;
+       repeat_cfg->avi_infoframe_repeat = 0;
+       repeat_cfg->gen_cntrl_pkt = 0;
+       repeat_cfg->gen_cntrl_pkt_repeat = 0;
+       repeat_cfg->generic_pkt = 0;
+       repeat_cfg->generic_pkt_repeat = 0;
+}
+
+static void hdmi_core_powerdown_disable(struct hdmi_ip_data *ip_data)
+{
+       pr_debug("Enter hdmi_core_powerdown_disable\n");
+       REG_FLD_MOD(hdmi_core_sys_base(ip_data), HDMI_CORE_CTRL1, 0x0, 0, 0);
+}
+
+static void hdmi_core_swreset_release(struct hdmi_ip_data *ip_data)
+{
+       pr_debug("Enter hdmi_core_swreset_release\n");
+       REG_FLD_MOD(hdmi_core_sys_base(ip_data), HDMI_CORE_SYS_SRST, 0x0, 0, 0);
+}
+
+static void hdmi_core_swreset_assert(struct hdmi_ip_data *ip_data)
+{
+       pr_debug("Enter hdmi_core_swreset_assert\n");
+       REG_FLD_MOD(hdmi_core_sys_base(ip_data), HDMI_CORE_SYS_SRST, 0x1, 0, 0);
+}
+
+/* HDMI_CORE_VIDEO_CONFIG */
+static void hdmi_core_video_config(struct hdmi_ip_data *ip_data,
+                               struct hdmi_core_video_config *cfg)
+{
+       u32 r = 0;
+       void __iomem *core_sys_base = hdmi_core_sys_base(ip_data);
+
+       /* sys_ctrl1 default configuration not tunable */
+       r = hdmi_read_reg(core_sys_base, HDMI_CORE_CTRL1);
+       r = FLD_MOD(r, HDMI_CORE_CTRL1_VEN_FOLLOWVSYNC, 5, 5);
+       r = FLD_MOD(r, HDMI_CORE_CTRL1_HEN_FOLLOWHSYNC, 4, 4);
+       r = FLD_MOD(r, HDMI_CORE_CTRL1_BSEL_24BITBUS, 2, 2);
+       r = FLD_MOD(r, HDMI_CORE_CTRL1_EDGE_RISINGEDGE, 1, 1);
+       hdmi_write_reg(core_sys_base, HDMI_CORE_CTRL1, r);
+
+       REG_FLD_MOD(core_sys_base,
+                       HDMI_CORE_SYS_VID_ACEN, cfg->ip_bus_width, 7, 6);
+
+       /* Vid_Mode */
+       r = hdmi_read_reg(core_sys_base, HDMI_CORE_SYS_VID_MODE);
+
+       /* dither truncation configuration */
+       if (cfg->op_dither_truc > HDMI_OUTPUTTRUNCATION_12BIT) {
+               r = FLD_MOD(r, cfg->op_dither_truc - 3, 7, 6);
+               r = FLD_MOD(r, 1, 5, 5);
+       } else {
+               r = FLD_MOD(r, cfg->op_dither_truc, 7, 6);
+               r = FLD_MOD(r, 0, 5, 5);
+       }
+       hdmi_write_reg(core_sys_base, HDMI_CORE_SYS_VID_MODE, r);
+
+       /* HDMI_Ctrl */
+       r = hdmi_read_reg(hdmi_av_base(ip_data), HDMI_CORE_AV_HDMI_CTRL);
+       r = FLD_MOD(r, cfg->deep_color_pkt, 6, 6);
+       r = FLD_MOD(r, cfg->pkt_mode, 5, 3);
+       r = FLD_MOD(r, cfg->hdmi_dvi, 0, 0);
+       hdmi_write_reg(hdmi_av_base(ip_data), HDMI_CORE_AV_HDMI_CTRL, r);
+
+       /* TMDS_CTRL */
+       REG_FLD_MOD(core_sys_base,
+                       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)
+{
+       u32 val;
+       char sum = 0, checksum = 0;
+       void __iomem *av_base = hdmi_av_base(ip_data);
+
+       sum += 0x82 + 0x002 + 0x00D;
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082);
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_VERS, 0x002);
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_LEN, 0x00D);
+
+       val = (info_avi.db1_format << 5) |
+               (info_avi.db1_active_info << 4) |
+               (info_avi.db1_bar_info_dv << 2) |
+               (info_avi.db1_scan_info);
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(0), val);
+       sum += val;
+
+       val = (info_avi.db2_colorimetry << 6) |
+               (info_avi.db2_aspect_ratio << 4) |
+               (info_avi.db2_active_fmt_ar);
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(1), val);
+       sum += val;
+
+       val = (info_avi.db3_itc << 7) |
+               (info_avi.db3_ec << 4) |
+               (info_avi.db3_q_range << 2) |
+               (info_avi.db3_nup_scaling);
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(2), val);
+       sum += val;
+
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(3),
+                                       info_avi.db4_videocode);
+       sum += info_avi.db4_videocode;
+
+       val = info_avi.db5_pixel_repeat;
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(4), val);
+       sum += val;
+
+       val = info_avi.db6_7_line_eoftop & 0x00FF;
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(5), val);
+       sum += val;
+
+       val = ((info_avi.db6_7_line_eoftop >> 8) & 0x00FF);
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(6), val);
+       sum += val;
+
+       val = info_avi.db8_9_line_sofbottom & 0x00FF;
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(7), val);
+       sum += val;
+
+       val = ((info_avi.db8_9_line_sofbottom >> 8) & 0x00FF);
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(8), val);
+       sum += val;
+
+       val = info_avi.db10_11_pixel_eofleft & 0x00FF;
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(9), val);
+       sum += val;
+
+       val = ((info_avi.db10_11_pixel_eofleft >> 8) & 0x00FF);
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(10), val);
+       sum += val;
+
+       val = info_avi.db12_13_pixel_sofright & 0x00FF;
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(11), val);
+       sum += val;
+
+       val = ((info_avi.db12_13_pixel_sofright >> 8) & 0x00FF);
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(12), val);
+       sum += val;
+
+       checksum = 0x100 - sum;
+       hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_CHSUM, checksum);
+}
+
+static void hdmi_core_av_packet_config(struct hdmi_ip_data *ip_data,
+               struct hdmi_core_packet_enable_repeat repeat_cfg)
+{
+       /* enable/repeat the infoframe */
+       hdmi_write_reg(hdmi_av_base(ip_data), HDMI_CORE_AV_PB_CTRL1,
+               (repeat_cfg.audio_pkt << 5) |
+               (repeat_cfg.audio_pkt_repeat << 4) |
+               (repeat_cfg.avi_infoframe << 1) |
+               (repeat_cfg.avi_infoframe_repeat));
+
+       /* enable/repeat the packet */
+       hdmi_write_reg(hdmi_av_base(ip_data), HDMI_CORE_AV_PB_CTRL2,
+               (repeat_cfg.gen_cntrl_pkt << 3) |
+               (repeat_cfg.gen_cntrl_pkt_repeat << 2) |
+               (repeat_cfg.generic_pkt << 1) |
+               (repeat_cfg.generic_pkt_repeat));
+}
+
+static void hdmi_wp_init(struct omap_video_timings *timings,
+                       struct hdmi_video_format *video_fmt,
+                       struct hdmi_video_interface *video_int)
+{
+       pr_debug("Enter hdmi_wp_init\n");
+
+       timings->hbp = 0;
+       timings->hfp = 0;
+       timings->hsw = 0;
+       timings->vbp = 0;
+       timings->vfp = 0;
+       timings->vsw = 0;
+
+       video_fmt->packing_mode = HDMI_PACK_10b_RGB_YUV444;
+       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 hdmi_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,
+       struct omap_video_timings *timings, struct hdmi_config *param)
+{
+       pr_debug("Enter hdmi_wp_video_init_format\n");
+
+       video_fmt->y_res = param->timings.timings.y_res;
+       video_fmt->x_res = param->timings.timings.x_res;
+
+       timings->hbp = param->timings.timings.hbp;
+       timings->hfp = param->timings.timings.hfp;
+       timings->hsw = param->timings.timings.hsw;
+       timings->vbp = param->timings.timings.vbp;
+       timings->vfp = param->timings.timings.vfp;
+       timings->vsw = param->timings.timings.vsw;
+}
+
+static void hdmi_wp_video_config_format(struct hdmi_ip_data *ip_data,
+               struct hdmi_video_format *video_fmt)
+{
+       u32 l = 0;
+
+       REG_FLD_MOD(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG,
+                       video_fmt->packing_mode, 10, 8);
+
+       l |= FLD_VAL(video_fmt->y_res, 31, 16);
+       l |= FLD_VAL(video_fmt->x_res, 15, 0);
+       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)
+{
+       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);
+       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,
+               struct omap_video_timings *timings)
+{
+       u32 timing_h = 0;
+       u32 timing_v = 0;
+
+       pr_debug("Enter hdmi_wp_video_config_timing\n");
+
+       timing_h |= FLD_VAL(timings->hbp, 31, 20);
+       timing_h |= FLD_VAL(timings->hfp, 19, 8);
+       timing_h |= FLD_VAL(timings->hsw, 7, 0);
+       hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_TIMING_H, timing_h);
+
+       timing_v |= FLD_VAL(timings->vbp, 31, 20);
+       timing_v |= FLD_VAL(timings->vfp, 19, 8);
+       timing_v |= FLD_VAL(timings->vsw, 7, 0);
+       hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_TIMING_V, timing_v);
+}
+
+void hdmi_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_core_init(&v_core_cfg,
+               &avi_cfg,
+               &repeat_cfg);
+
+       hdmi_wp_video_init_format(&video_format, &video_timing, cfg);
+
+       hdmi_wp_video_config_timing(ip_data, &video_timing);
+
+       /* video config */
+       video_format.packing_mode = HDMI_PACK_24b_RGB_YUV444_YUV422;
+
+       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);
+
+       /*
+        * configure core video part
+        * set software reset in the core
+        */
+       hdmi_core_swreset_assert(ip_data);
+
+       /* power down off */
+       hdmi_core_powerdown_disable(ip_data);
+
+       v_core_cfg.pkt_mode = HDMI_PACKETMODE24BITPERPIXEL;
+       v_core_cfg.hdmi_dvi = cfg->cm.mode;
+
+       hdmi_core_video_config(ip_data, &v_core_cfg);
+
+       /* release software reset in the core */
+       hdmi_core_swreset_release(ip_data);
+
+       /*
+        * configure packet
+        * info frame video see doc CEA861-D page 65
+        */
+       avi_cfg.db1_format = HDMI_INFOFRAME_AVI_DB1Y_RGB;
+       avi_cfg.db1_active_info =
+               HDMI_INFOFRAME_AVI_DB1A_ACTIVE_FORMAT_OFF;
+       avi_cfg.db1_bar_info_dv = HDMI_INFOFRAME_AVI_DB1B_NO;
+       avi_cfg.db1_scan_info = HDMI_INFOFRAME_AVI_DB1S_0;
+       avi_cfg.db2_colorimetry = HDMI_INFOFRAME_AVI_DB2C_NO;
+       avi_cfg.db2_aspect_ratio = HDMI_INFOFRAME_AVI_DB2M_NO;
+       avi_cfg.db2_active_fmt_ar = HDMI_INFOFRAME_AVI_DB2R_SAME;
+       avi_cfg.db3_itc = HDMI_INFOFRAME_AVI_DB3ITC_NO;
+       avi_cfg.db3_ec = HDMI_INFOFRAME_AVI_DB3EC_XVYUV601;
+       avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_DEFAULT;
+       avi_cfg.db3_nup_scaling = HDMI_INFOFRAME_AVI_DB3SC_NO;
+       avi_cfg.db4_videocode = cfg->cm.code;
+       avi_cfg.db5_pixel_repeat = HDMI_INFOFRAME_AVI_DB5PR_NO;
+       avi_cfg.db6_7_line_eoftop = 0;
+       avi_cfg.db8_9_line_sofbottom = 0;
+       avi_cfg.db10_11_pixel_eofleft = 0;
+       avi_cfg.db12_13_pixel_sofright = 0;
+
+       hdmi_core_aux_infoframe_avi_config(ip_data, avi_cfg);
+
+       /* enable/repeat the infoframe */
+       repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
+       repeat_cfg.avi_infoframe_repeat = HDMI_PACKETREPEATON;
+       /* wakeup */
+       repeat_cfg.audio_pkt = HDMI_PACKETENABLE;
+       repeat_cfg.audio_pkt_repeat = HDMI_PACKETREPEATON;
+       hdmi_core_av_packet_config(ip_data, repeat_cfg);
+}
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
new file mode 100644 (file)
index 0000000..7feead1
--- /dev/null
@@ -0,0 +1,575 @@
+/*
+ * ti_hdmi_4xxx_ip.h
+ *
+ * HDMI header definition for DM81xx, DM38xx, TI OMAP4 etc processors.
+ *
+ * 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 _HDMI_TI_4xxx_H_
+#define _HDMI_TI_4xxx_H_
+
+#include <linux/string.h>
+#include <video/omapdss.h>
+#include "ti_hdmi.h"
+
+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)
+
+/* 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_CTRL1                                HDMI_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_INTR1                    HDMI_REG(0x1C4)
+#define HDMI_CORE_SYS_INTR2                    HDMI_REG(0x1C8)
+#define HDMI_CORE_SYS_INTR3                    HDMI_REG(0x1CC)
+#define HDMI_CORE_SYS_INTR4                    HDMI_REG(0x1D0)
+#define HDMI_CORE_SYS_UMASK1                   HDMI_REG(0x1D4)
+#define HDMI_CORE_SYS_TMDS_CTRL                        HDMI_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)
+#define HDMI_CORE_SYS_DE_CNTL                  HDMI_REG(0xD8)
+#define HDMI_CORE_SYS_DE_CNTH                  HDMI_REG(0xDC)
+#define HDMI_CORE_SYS_DE_LINL                  HDMI_REG(0xE0)
+#define HDMI_CORE_SYS_DE_LINH_1                        HDMI_REG(0xE4)
+#define HDMI_CORE_CTRL1_VEN_FOLLOWVSYNC        0x1
+#define HDMI_CORE_CTRL1_HEN_FOLLOWHSYNC        0x1
+#define HDMI_CORE_CTRL1_BSEL_24BITBUS          0x1
+#define HDMI_CORE_CTRL1_EDGE_RISINGEDGE        0x1
+
+/* HDMI DDC E-DID */
+#define HDMI_CORE_DDC_CMD                      HDMI_REG(0x3CC)
+#define HDMI_CORE_DDC_STATUS                   HDMI_REG(0x3C8)
+#define HDMI_CORE_DDC_ADDR                     HDMI_REG(0x3B4)
+#define HDMI_CORE_DDC_OFFSET                   HDMI_REG(0x3BC)
+#define HDMI_CORE_DDC_COUNT1                   HDMI_REG(0x3C0)
+#define HDMI_CORE_DDC_COUNT2                   HDMI_REG(0x3C4)
+#define HDMI_CORE_DDC_DATA                     HDMI_REG(0x3D0)
+#define HDMI_CORE_DDC_SEGM                     HDMI_REG(0x3B8)
+
+/* HDMI IP Core Audio Video */
+
+#define HDMI_CORE_AV_HDMI_CTRL                 HDMI_REG(0xBC)
+#define HDMI_CORE_AV_DPD                       HDMI_REG(0xF4)
+#define HDMI_CORE_AV_PB_CTRL1                  HDMI_REG(0xF8)
+#define HDMI_CORE_AV_PB_CTRL2                  HDMI_REG(0xFC)
+#define HDMI_CORE_AV_AVI_TYPE                  HDMI_REG(0x100)
+#define HDMI_CORE_AV_AVI_VERS                  HDMI_REG(0x104)
+#define HDMI_CORE_AV_AVI_LEN                   HDMI_REG(0x108)
+#define HDMI_CORE_AV_AVI_CHSUM                 HDMI_REG(0x10C)
+#define HDMI_CORE_AV_AVI_DBYTE(n)              HDMI_REG(n * 4 + 0x110)
+#define HDMI_CORE_AV_AVI_DBYTE_NELEMS          HDMI_REG(15)
+#define HDMI_CORE_AV_SPD_DBYTE                 HDMI_REG(0x190)
+#define HDMI_CORE_AV_SPD_DBYTE_NELEMS          HDMI_REG(27)
+#define HDMI_CORE_AV_AUD_DBYTE(n)              HDMI_REG(n * 4 + 0x210)
+#define HDMI_CORE_AV_AUD_DBYTE_NELEMS          HDMI_REG(10)
+#define HDMI_CORE_AV_MPEG_DBYTE                        HDMI_REG(0x290)
+#define HDMI_CORE_AV_MPEG_DBYTE_NELEMS         HDMI_REG(27)
+#define HDMI_CORE_AV_GEN_DBYTE                 HDMI_REG(0x300)
+#define HDMI_CORE_AV_GEN_DBYTE_NELEMS          HDMI_REG(31)
+#define HDMI_CORE_AV_GEN2_DBYTE                        HDMI_REG(0x380)
+#define HDMI_CORE_AV_GEN2_DBYTE_NELEMS         HDMI_REG(31)
+#define HDMI_CORE_AV_ACR_CTRL                  HDMI_REG(0x4)
+#define HDMI_CORE_AV_FREQ_SVAL                 HDMI_REG(0x8)
+#define HDMI_CORE_AV_N_SVAL1                   HDMI_REG(0xC)
+#define HDMI_CORE_AV_N_SVAL2                   HDMI_REG(0x10)
+#define HDMI_CORE_AV_N_SVAL3                   HDMI_REG(0x14)
+#define HDMI_CORE_AV_CTS_SVAL1                 HDMI_REG(0x18)
+#define HDMI_CORE_AV_CTS_SVAL2                 HDMI_REG(0x1C)
+#define HDMI_CORE_AV_CTS_SVAL3                 HDMI_REG(0x20)
+#define HDMI_CORE_AV_CTS_HVAL1                 HDMI_REG(0x24)
+#define HDMI_CORE_AV_CTS_HVAL2                 HDMI_REG(0x28)
+#define HDMI_CORE_AV_CTS_HVAL3                 HDMI_REG(0x2C)
+#define HDMI_CORE_AV_AUD_MODE                  HDMI_REG(0x50)
+#define HDMI_CORE_AV_SPDIF_CTRL                        HDMI_REG(0x54)
+#define HDMI_CORE_AV_HW_SPDIF_FS               HDMI_REG(0x60)
+#define HDMI_CORE_AV_SWAP_I2S                  HDMI_REG(0x64)
+#define HDMI_CORE_AV_SPDIF_ERTH                        HDMI_REG(0x6C)
+#define HDMI_CORE_AV_I2S_IN_MAP                        HDMI_REG(0x70)
+#define HDMI_CORE_AV_I2S_IN_CTRL               HDMI_REG(0x74)
+#define HDMI_CORE_AV_I2S_CHST0                 HDMI_REG(0x78)
+#define HDMI_CORE_AV_I2S_CHST1                 HDMI_REG(0x7C)
+#define HDMI_CORE_AV_I2S_CHST2                 HDMI_REG(0x80)
+#define HDMI_CORE_AV_I2S_CHST4                 HDMI_REG(0x84)
+#define HDMI_CORE_AV_I2S_CHST5                 HDMI_REG(0x88)
+#define HDMI_CORE_AV_ASRC                      HDMI_REG(0x8C)
+#define HDMI_CORE_AV_I2S_IN_LEN                        HDMI_REG(0x90)
+#define HDMI_CORE_AV_HDMI_CTRL                 HDMI_REG(0xBC)
+#define HDMI_CORE_AV_AUDO_TXSTAT               HDMI_REG(0xC0)
+#define HDMI_CORE_AV_AUD_PAR_BUSCLK_1          HDMI_REG(0xCC)
+#define HDMI_CORE_AV_AUD_PAR_BUSCLK_2          HDMI_REG(0xD0)
+#define HDMI_CORE_AV_AUD_PAR_BUSCLK_3          HDMI_REG(0xD4)
+#define HDMI_CORE_AV_TEST_TXCTRL               HDMI_REG(0xF0)
+#define HDMI_CORE_AV_DPD                       HDMI_REG(0xF4)
+#define HDMI_CORE_AV_PB_CTRL1                  HDMI_REG(0xF8)
+#define HDMI_CORE_AV_PB_CTRL2                  HDMI_REG(0xFC)
+#define HDMI_CORE_AV_AVI_TYPE                  HDMI_REG(0x100)
+#define HDMI_CORE_AV_AVI_VERS                  HDMI_REG(0x104)
+#define HDMI_CORE_AV_AVI_LEN                   HDMI_REG(0x108)
+#define HDMI_CORE_AV_AVI_CHSUM                 HDMI_REG(0x10C)
+#define HDMI_CORE_AV_SPD_TYPE                  HDMI_REG(0x180)
+#define HDMI_CORE_AV_SPD_VERS                  HDMI_REG(0x184)
+#define HDMI_CORE_AV_SPD_LEN                   HDMI_REG(0x188)
+#define HDMI_CORE_AV_SPD_CHSUM                 HDMI_REG(0x18C)
+#define HDMI_CORE_AV_AUDIO_TYPE                        HDMI_REG(0x200)
+#define HDMI_CORE_AV_AUDIO_VERS                        HDMI_REG(0x204)
+#define HDMI_CORE_AV_AUDIO_LEN                 HDMI_REG(0x208)
+#define HDMI_CORE_AV_AUDIO_CHSUM               HDMI_REG(0x20C)
+#define HDMI_CORE_AV_MPEG_TYPE                 HDMI_REG(0x280)
+#define HDMI_CORE_AV_MPEG_VERS                 HDMI_REG(0x284)
+#define HDMI_CORE_AV_MPEG_LEN                  HDMI_REG(0x288)
+#define HDMI_CORE_AV_MPEG_CHSUM                        HDMI_REG(0x28C)
+#define HDMI_CORE_AV_CP_BYTE1                  HDMI_REG(0x37C)
+#define HDMI_CORE_AV_CEC_ADDR_ID               HDMI_REG(0x3FC)
+#define HDMI_CORE_AV_SPD_DBYTE_ELSIZE          0x4
+#define HDMI_CORE_AV_GEN2_DBYTE_ELSIZE         0x4
+#define HDMI_CORE_AV_MPEG_DBYTE_ELSIZE         0x4
+#define HDMI_CORE_AV_GEN_DBYTE_ELSIZE          0x4
+
+/* PLL */
+
+#define PLLCTRL_PLL_CONTROL                    HDMI_REG(0x0)
+#define PLLCTRL_PLL_STATUS                     HDMI_REG(0x4)
+#define PLLCTRL_PLL_GO                         HDMI_REG(0x8)
+#define PLLCTRL_CFG1                           HDMI_REG(0xC)
+#define PLLCTRL_CFG2                           HDMI_REG(0x10)
+#define PLLCTRL_CFG3                           HDMI_REG(0x14)
+#define PLLCTRL_CFG4                           HDMI_REG(0x20)
+
+/* HDMI PHY */
+
+#define HDMI_TXPHY_TX_CTRL                     HDMI_REG(0x0)
+#define HDMI_TXPHY_DIGITAL_CTRL                        HDMI_REG(0x4)
+#define HDMI_TXPHY_POWER_CTRL                  HDMI_REG(0x8)
+#define HDMI_TXPHY_PAD_CFG_CTRL                        HDMI_REG(0xC)
+
+#define REG_FLD_MOD(base, idx, val, start, end) \
+       hdmi_write_reg(base, idx, FLD_MOD(hdmi_read_reg(base, idx),\
+                                                       val, start, end))
+#define REG_GET(base, idx, start, end) \
+       FLD_GET(hdmi_read_reg(base, idx), start, end)
+
+enum hdmi_phy_pwr {
+       HDMI_PHYPWRCMD_OFF = 0,
+       HDMI_PHYPWRCMD_LDOON = 1,
+       HDMI_PHYPWRCMD_TXON = 2
+};
+
+enum hdmi_core_inputbus_width {
+       HDMI_INPUT_8BIT = 0,
+       HDMI_INPUT_10BIT = 1,
+       HDMI_INPUT_12BIT = 2
+};
+
+enum hdmi_core_dither_trunc {
+       HDMI_OUTPUTTRUNCATION_8BIT = 0,
+       HDMI_OUTPUTTRUNCATION_10BIT = 1,
+       HDMI_OUTPUTTRUNCATION_12BIT = 2,
+       HDMI_OUTPUTDITHER_8BIT = 3,
+       HDMI_OUTPUTDITHER_10BIT = 4,
+       HDMI_OUTPUTDITHER_12BIT = 5
+};
+
+enum hdmi_core_deepcolor_ed {
+       HDMI_DEEPCOLORPACKECTDISABLE = 0,
+       HDMI_DEEPCOLORPACKECTENABLE = 1
+};
+
+enum hdmi_core_packet_mode {
+       HDMI_PACKETMODERESERVEDVALUE = 0,
+       HDMI_PACKETMODE24BITPERPIXEL = 4,
+       HDMI_PACKETMODE30BITPERPIXEL = 5,
+       HDMI_PACKETMODE36BITPERPIXEL = 6,
+       HDMI_PACKETMODE48BITPERPIXEL = 7
+};
+
+enum hdmi_core_tclkselclkmult {
+       HDMI_FPLL05IDCK = 0,
+       HDMI_FPLL10IDCK = 1,
+       HDMI_FPLL20IDCK = 2,
+       HDMI_FPLL40IDCK = 3
+};
+
+enum hdmi_core_packet_ctrl {
+       HDMI_PACKETENABLE = 1,
+       HDMI_PACKETDISABLE = 0,
+       HDMI_PACKETREPEATON = 1,
+       HDMI_PACKETREPEATOFF = 0
+};
+
+/* INFOFRAME_AVI_ and INFOFRAME_AUDIO_ definitions */
+enum hdmi_core_infoframe {
+       HDMI_INFOFRAME_AVI_DB1Y_RGB = 0,
+       HDMI_INFOFRAME_AVI_DB1Y_YUV422 = 1,
+       HDMI_INFOFRAME_AVI_DB1Y_YUV444 = 2,
+       HDMI_INFOFRAME_AVI_DB1A_ACTIVE_FORMAT_OFF = 0,
+       HDMI_INFOFRAME_AVI_DB1A_ACTIVE_FORMAT_ON =  1,
+       HDMI_INFOFRAME_AVI_DB1B_NO = 0,
+       HDMI_INFOFRAME_AVI_DB1B_VERT = 1,
+       HDMI_INFOFRAME_AVI_DB1B_HORI = 2,
+       HDMI_INFOFRAME_AVI_DB1B_VERTHORI = 3,
+       HDMI_INFOFRAME_AVI_DB1S_0 = 0,
+       HDMI_INFOFRAME_AVI_DB1S_1 = 1,
+       HDMI_INFOFRAME_AVI_DB1S_2 = 2,
+       HDMI_INFOFRAME_AVI_DB2C_NO = 0,
+       HDMI_INFOFRAME_AVI_DB2C_ITU601 = 1,
+       HDMI_INFOFRAME_AVI_DB2C_ITU709 = 2,
+       HDMI_INFOFRAME_AVI_DB2C_EC_EXTENDED = 3,
+       HDMI_INFOFRAME_AVI_DB2M_NO = 0,
+       HDMI_INFOFRAME_AVI_DB2M_43 = 1,
+       HDMI_INFOFRAME_AVI_DB2M_169 = 2,
+       HDMI_INFOFRAME_AVI_DB2R_SAME = 8,
+       HDMI_INFOFRAME_AVI_DB2R_43 = 9,
+       HDMI_INFOFRAME_AVI_DB2R_169 = 10,
+       HDMI_INFOFRAME_AVI_DB2R_149 = 11,
+       HDMI_INFOFRAME_AVI_DB3ITC_NO = 0,
+       HDMI_INFOFRAME_AVI_DB3ITC_YES = 1,
+       HDMI_INFOFRAME_AVI_DB3EC_XVYUV601 = 0,
+       HDMI_INFOFRAME_AVI_DB3EC_XVYUV709 = 1,
+       HDMI_INFOFRAME_AVI_DB3Q_DEFAULT = 0,
+       HDMI_INFOFRAME_AVI_DB3Q_LR = 1,
+       HDMI_INFOFRAME_AVI_DB3Q_FR = 2,
+       HDMI_INFOFRAME_AVI_DB3SC_NO = 0,
+       HDMI_INFOFRAME_AVI_DB3SC_HORI = 1,
+       HDMI_INFOFRAME_AVI_DB3SC_VERT = 2,
+       HDMI_INFOFRAME_AVI_DB3SC_HORIVERT = 3,
+       HDMI_INFOFRAME_AVI_DB5PR_NO = 0,
+       HDMI_INFOFRAME_AVI_DB5PR_2 = 1,
+       HDMI_INFOFRAME_AVI_DB5PR_3 = 2,
+       HDMI_INFOFRAME_AVI_DB5PR_4 = 3,
+       HDMI_INFOFRAME_AVI_DB5PR_5 = 4,
+       HDMI_INFOFRAME_AVI_DB5PR_6 = 5,
+       HDMI_INFOFRAME_AVI_DB5PR_7 = 6,
+       HDMI_INFOFRAME_AVI_DB5PR_8 = 7,
+       HDMI_INFOFRAME_AVI_DB5PR_9 = 8,
+       HDMI_INFOFRAME_AVI_DB5PR_10 = 9,
+       HDMI_INFOFRAME_AUDIO_DB1CT_FROM_STREAM = 0,
+       HDMI_INFOFRAME_AUDIO_DB1CT_IEC60958 = 1,
+       HDMI_INFOFRAME_AUDIO_DB1CT_AC3 = 2,
+       HDMI_INFOFRAME_AUDIO_DB1CT_MPEG1 = 3,
+       HDMI_INFOFRAME_AUDIO_DB1CT_MP3 = 4,
+       HDMI_INFOFRAME_AUDIO_DB1CT_MPEG2_MULTICH = 5,
+       HDMI_INFOFRAME_AUDIO_DB1CT_AAC = 6,
+       HDMI_INFOFRAME_AUDIO_DB1CT_DTS = 7,
+       HDMI_INFOFRAME_AUDIO_DB1CT_ATRAC = 8,
+       HDMI_INFOFRAME_AUDIO_DB1CT_ONEBIT = 9,
+       HDMI_INFOFRAME_AUDIO_DB1CT_DOLBY_DIGITAL_PLUS = 10,
+       HDMI_INFOFRAME_AUDIO_DB1CT_DTS_HD = 11,
+       HDMI_INFOFRAME_AUDIO_DB1CT_MAT = 12,
+       HDMI_INFOFRAME_AUDIO_DB1CT_DST = 13,
+       HDMI_INFOFRAME_AUDIO_DB1CT_WMA_PRO = 14,
+       HDMI_INFOFRAME_AUDIO_DB2SF_FROM_STREAM = 0,
+       HDMI_INFOFRAME_AUDIO_DB2SF_32000 = 1,
+       HDMI_INFOFRAME_AUDIO_DB2SF_44100 = 2,
+       HDMI_INFOFRAME_AUDIO_DB2SF_48000 = 3,
+       HDMI_INFOFRAME_AUDIO_DB2SF_88200 = 4,
+       HDMI_INFOFRAME_AUDIO_DB2SF_96000 = 5,
+       HDMI_INFOFRAME_AUDIO_DB2SF_176400 = 6,
+       HDMI_INFOFRAME_AUDIO_DB2SF_192000 = 7,
+       HDMI_INFOFRAME_AUDIO_DB2SS_FROM_STREAM = 0,
+       HDMI_INFOFRAME_AUDIO_DB2SS_16BIT = 1,
+       HDMI_INFOFRAME_AUDIO_DB2SS_20BIT = 2,
+       HDMI_INFOFRAME_AUDIO_DB2SS_24BIT = 3,
+       HDMI_INFOFRAME_AUDIO_DB5_DM_INH_PERMITTED = 0,
+       HDMI_INFOFRAME_AUDIO_DB5_DM_INH_PROHIBITED = 1
+};
+
+enum hdmi_packing_mode {
+       HDMI_PACK_10b_RGB_YUV444 = 0,
+       HDMI_PACK_24b_RGB_YUV444_YUV422 = 1,
+       HDMI_PACK_20b_YUV422 = 2,
+       HDMI_PACK_ALREADYPACKED = 7
+};
+
+enum hdmi_core_audio_sample_freq {
+       HDMI_AUDIO_FS_32000 = 0x3,
+       HDMI_AUDIO_FS_44100 = 0x0,
+       HDMI_AUDIO_FS_48000 = 0x2,
+       HDMI_AUDIO_FS_88200 = 0x8,
+       HDMI_AUDIO_FS_96000 = 0xA,
+       HDMI_AUDIO_FS_176400 = 0xC,
+       HDMI_AUDIO_FS_192000 = 0xE,
+       HDMI_AUDIO_FS_NOT_INDICATED = 0x1
+};
+
+enum hdmi_core_audio_layout {
+       HDMI_AUDIO_LAYOUT_2CH = 0,
+       HDMI_AUDIO_LAYOUT_8CH = 1
+};
+
+enum hdmi_core_cts_mode {
+       HDMI_AUDIO_CTS_MODE_HW = 0,
+       HDMI_AUDIO_CTS_MODE_SW = 1
+};
+
+enum hdmi_stereo_channels {
+       HDMI_AUDIO_STEREO_NOCHANNELS = 0,
+       HDMI_AUDIO_STEREO_ONECHANNEL = 1,
+       HDMI_AUDIO_STEREO_TWOCHANNELS = 2,
+       HDMI_AUDIO_STEREO_THREECHANNELS = 3,
+       HDMI_AUDIO_STEREO_FOURCHANNELS = 4
+};
+
+enum hdmi_audio_type {
+       HDMI_AUDIO_TYPE_LPCM = 0,
+       HDMI_AUDIO_TYPE_IEC = 1
+};
+
+enum hdmi_audio_justify {
+       HDMI_AUDIO_JUSTIFY_LEFT = 0,
+       HDMI_AUDIO_JUSTIFY_RIGHT = 1
+};
+
+enum hdmi_audio_sample_order {
+       HDMI_AUDIO_SAMPLE_RIGHT_FIRST = 0,
+       HDMI_AUDIO_SAMPLE_LEFT_FIRST = 1
+};
+
+enum hdmi_audio_samples_perword {
+       HDMI_AUDIO_ONEWORD_ONESAMPLE = 0,
+       HDMI_AUDIO_ONEWORD_TWOSAMPLES = 1
+};
+
+enum hdmi_audio_sample_size {
+       HDMI_AUDIO_SAMPLE_16BITS = 0,
+       HDMI_AUDIO_SAMPLE_24BITS = 1
+};
+
+enum hdmi_audio_transf_mode {
+       HDMI_AUDIO_TRANSF_DMA = 0,
+       HDMI_AUDIO_TRANSF_IRQ = 1
+};
+
+enum hdmi_audio_blk_strt_end_sig {
+       HDMI_AUDIO_BLOCK_SIG_STARTEND_ON = 0,
+       HDMI_AUDIO_BLOCK_SIG_STARTEND_OFF = 1
+};
+
+enum hdmi_audio_i2s_config {
+       HDMI_AUDIO_I2S_WS_POLARITY_LOW_IS_LEFT = 0,
+       HDMI_AUDIO_I2S_WS_POLARIT_YLOW_IS_RIGHT = 1,
+       HDMI_AUDIO_I2S_MSB_SHIFTED_FIRST = 0,
+       HDMI_AUDIO_I2S_LSB_SHIFTED_FIRST = 1,
+       HDMI_AUDIO_I2S_MAX_WORD_20BITS = 0,
+       HDMI_AUDIO_I2S_MAX_WORD_24BITS = 1,
+       HDMI_AUDIO_I2S_CHST_WORD_NOT_SPECIFIED = 0,
+       HDMI_AUDIO_I2S_CHST_WORD_16_BITS = 1,
+       HDMI_AUDIO_I2S_CHST_WORD_17_BITS = 6,
+       HDMI_AUDIO_I2S_CHST_WORD_18_BITS = 2,
+       HDMI_AUDIO_I2S_CHST_WORD_19_BITS = 4,
+       HDMI_AUDIO_I2S_CHST_WORD_20_BITS_20MAX = 5,
+       HDMI_AUDIO_I2S_CHST_WORD_20_BITS_24MAX = 1,
+       HDMI_AUDIO_I2S_CHST_WORD_21_BITS = 6,
+       HDMI_AUDIO_I2S_CHST_WORD_22_BITS = 2,
+       HDMI_AUDIO_I2S_CHST_WORD_23_BITS = 4,
+       HDMI_AUDIO_I2S_CHST_WORD_24_BITS = 5,
+       HDMI_AUDIO_I2S_SCK_EDGE_FALLING = 0,
+       HDMI_AUDIO_I2S_SCK_EDGE_RISING = 1,
+       HDMI_AUDIO_I2S_VBIT_FOR_PCM = 0,
+       HDMI_AUDIO_I2S_VBIT_FOR_COMPRESSED = 1,
+       HDMI_AUDIO_I2S_INPUT_LENGTH_NA = 0,
+       HDMI_AUDIO_I2S_INPUT_LENGTH_16 = 2,
+       HDMI_AUDIO_I2S_INPUT_LENGTH_17 = 12,
+       HDMI_AUDIO_I2S_INPUT_LENGTH_18 = 4,
+       HDMI_AUDIO_I2S_INPUT_LENGTH_19 = 8,
+       HDMI_AUDIO_I2S_INPUT_LENGTH_20 = 10,
+       HDMI_AUDIO_I2S_INPUT_LENGTH_21 = 13,
+       HDMI_AUDIO_I2S_INPUT_LENGTH_22 = 5,
+       HDMI_AUDIO_I2S_INPUT_LENGTH_23 = 9,
+       HDMI_AUDIO_I2S_INPUT_LENGTH_24 = 11,
+       HDMI_AUDIO_I2S_FIRST_BIT_SHIFT = 0,
+       HDMI_AUDIO_I2S_FIRST_BIT_NO_SHIFT = 1,
+       HDMI_AUDIO_I2S_SD0_EN = 1,
+       HDMI_AUDIO_I2S_SD1_EN = 1 << 1,
+       HDMI_AUDIO_I2S_SD2_EN = 1 << 2,
+       HDMI_AUDIO_I2S_SD3_EN = 1 << 3,
+};
+
+enum hdmi_audio_mclk_mode {
+       HDMI_AUDIO_MCLK_128FS = 0,
+       HDMI_AUDIO_MCLK_256FS = 1,
+       HDMI_AUDIO_MCLK_384FS = 2,
+       HDMI_AUDIO_MCLK_512FS = 3,
+       HDMI_AUDIO_MCLK_768FS = 4,
+       HDMI_AUDIO_MCLK_1024FS = 5,
+       HDMI_AUDIO_MCLK_1152FS = 6,
+       HDMI_AUDIO_MCLK_192FS = 7
+};
+
+struct hdmi_core_video_config {
+       enum hdmi_core_inputbus_width   ip_bus_width;
+       enum hdmi_core_dither_trunc     op_dither_truc;
+       enum hdmi_core_deepcolor_ed     deep_color_pkt;
+       enum hdmi_core_packet_mode      pkt_mode;
+       enum hdmi_core_hdmi_dvi         hdmi_dvi;
+       enum hdmi_core_tclkselclkmult   tclk_sel_clkmult;
+};
+
+/*
+ * Refer to section 8.2 in HDMI 1.3 specification for
+ * details about infoframe databytes
+ */
+struct hdmi_core_infoframe_avi {
+       u8      db1_format;
+               /* Y0, Y1 rgb,yCbCr */
+       u8      db1_active_info;
+               /* A0  Active information Present */
+       u8      db1_bar_info_dv;
+               /* B0, B1 Bar info data valid */
+       u8      db1_scan_info;
+               /* S0, S1 scan information */
+       u8      db2_colorimetry;
+               /* C0, C1 colorimetry */
+       u8      db2_aspect_ratio;
+               /* M0, M1 Aspect ratio (4:3, 16:9) */
+       u8      db2_active_fmt_ar;
+               /* R0...R3 Active format aspect ratio */
+       u8      db3_itc;
+               /* ITC IT content. */
+       u8      db3_ec;
+               /* EC0, EC1, EC2 Extended colorimetry */
+       u8      db3_q_range;
+               /* Q1, Q0 Quantization range */
+       u8      db3_nup_scaling;
+               /* SC1, SC0 Non-uniform picture scaling */
+       u8      db4_videocode;
+               /* VIC0..6 Video format identification */
+       u8      db5_pixel_repeat;
+               /* PR0..PR3 Pixel repetition factor */
+       u16     db6_7_line_eoftop;
+               /* Line number end of top bar */
+       u16     db8_9_line_sofbottom;
+               /* Line number start of bottom bar */
+       u16     db10_11_pixel_eofleft;
+               /* Pixel number end of left bar */
+       u16     db12_13_pixel_sofright;
+               /* Pixel number start of right bar */
+};
+/*
+ * Refer to section 8.2 in HDMI 1.3 specification for
+ * details about infoframe databytes
+ */
+struct hdmi_core_infoframe_audio {
+       u8 db1_coding_type;
+       u8 db1_channel_count;
+       u8 db2_sample_freq;
+       u8 db2_sample_size;
+       u8 db4_channel_alloc;
+       bool db5_downmix_inh;
+       u8 db5_lsv;     /* Level shift values for downmix */
+};
+
+struct hdmi_core_packet_enable_repeat {
+       u32     audio_pkt;
+       u32     audio_pkt_repeat;
+       u32     avi_infoframe;
+       u32     avi_infoframe_repeat;
+       u32     gen_cntrl_pkt;
+       u32     gen_cntrl_pkt_repeat;
+       u32     generic_pkt;
+       u32     generic_pkt_repeat;
+};
+
+struct hdmi_video_format {
+       enum hdmi_packing_mode  packing_mode;
+       u32                     y_res;  /* Line per panel */
+       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;
+       enum hdmi_audio_type                    type;
+       enum hdmi_audio_justify                 justification;
+       enum hdmi_audio_sample_order            sample_order;
+       enum hdmi_audio_samples_perword         samples_per_word;
+       enum hdmi_audio_sample_size             sample_size;
+       enum hdmi_audio_blk_strt_end_sig        en_sig_blk_strt_end;
+};
+
+struct hdmi_audio_dma {
+       u8                              transfer_size;
+       u8                              block_size;
+       enum hdmi_audio_transf_mode     mode;
+       u16                             fifo_threshold;
+};
+
+struct hdmi_core_audio_i2s_config {
+       u8 word_max_length;
+       u8 word_length;
+       u8 in_length_bits;
+       u8 justification;
+       u8 en_high_bitrate_aud;
+       u8 sck_edge_mode;
+       u8 cbit_order;
+       u8 vbit;
+       u8 ws_polarity;
+       u8 direction;
+       u8 shift;
+       u8 active_sds;
+};
+
+struct hdmi_core_audio_config {
+       struct hdmi_core_audio_i2s_config       i2s_cfg;
+       enum hdmi_core_audio_sample_freq        freq_sample;
+       bool                                    fs_override;
+       u32                                     n;
+       u32                                     cts;
+       u32                                     aud_par_busclk;
+       enum hdmi_core_audio_layout             layout;
+       enum hdmi_core_cts_mode                 cts_mode;
+       bool                                    use_mclk;
+       enum hdmi_audio_mclk_mode               mclk_mode;
+       bool                                    en_acr_pkt;
+       bool                                    en_dsd_audio;
+       bool                                    en_parallel_aud_input;
+       bool                                    en_spdif;
+};
+#endif