Enable the OTM HDMI driver on ICS.
authorHu Tiger Chen <hu.tiger.chen@intel.com>
Mon, 30 Jan 2012 22:17:15 +0000 (00:17 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Jul 2012 09:29:37 +0000 (12:29 +0300)
Enable the OTM HDMI driver to be called from display driver and remove
older HDMI related code.

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
18 files changed:
drivers/staging/mrst/Makefile
drivers/staging/mrst/drv/mdfld_dsi_output.c
drivers/staging/mrst/drv/mdfld_hdcp_if.h
drivers/staging/mrst/drv/mdfld_hdmi_audio.c
drivers/staging/mrst/drv/mdfld_hdmi_audio_if.h
drivers/staging/mrst/drv/mdfld_intel_hdcp.c
drivers/staging/mrst/drv/mdfld_msic.c
drivers/staging/mrst/drv/mdfld_msic.h
drivers/staging/mrst/drv/mdfld_output.c
drivers/staging/mrst/drv/otm_hdmi/Makefile
drivers/staging/mrst/drv/otm_hdmi/os/android/include/android_hdmi.h
drivers/staging/mrst/drv/psb_drv.c
drivers/staging/mrst/drv/psb_drv.h
drivers/staging/mrst/drv/psb_fb.c
drivers/staging/mrst/drv/psb_intel_display.c
drivers/staging/mrst/drv/psb_intel_hdmi.c
drivers/staging/mrst/drv/psb_intel_hdmi.h
drivers/staging/mrst/drv/psb_powermgmt.h

index 5b52d39..8701448 100644 (file)
@@ -17,6 +17,7 @@ ccflags-y += \
        -I$(srctree)/$(src)/pvr/services4/system/include \
        -I$(srctree)/$(src)/pvr/services4/system/unified \
        -I$(srctree)/include/drm \
+       -I$(srctree)/$(src)/drv/otm_hdmi/os/android/include \
        -Iinclude/linux
 
 ccflags-y += -DSGX540 -DSUPPORT_SGX540 -DSGX_CORE_REV=121
@@ -223,3 +224,4 @@ medfield_gfx-$(CONFIG_DEBUG_FS) += $(PVRDIR)/pvr_debugfs.o
 medfield_gfx-$(CONFIG_PVR_TRACE_CMD) += $(PVRDIR)/pvr_trace_cmd.o
 
 obj-$(CONFIG_DRM_MDFLD) += medfield_gfx.o
+obj-$(CONFIG_MDFD_HDMI) += $(DRMDRVDIR)/otm_hdmi/
index f3bed42..32d2cb4 100644 (file)
@@ -469,6 +469,7 @@ mdfld_dsi_connector_detect(struct drm_connector *connector, bool force)
        struct mdfld_dsi_connector *dsi_connector
                = MDFLD_DSI_CONNECTOR(psb_output);
 
+       dsi_connector->status = connector_status_connected;
        PSB_DEBUG_ENTRY("\n");
 
        return dsi_connector->status;
index 49f06f8..e3d97b7 100644 (file)
@@ -74,6 +74,5 @@ typedef struct _cp_parameters {
 
 extern uint32_t hdcp_set_cp_data(cp_parameters_t* cp);
 extern uint32_t hdcp_get_cp_data(cp_parameters_t* cp);
-void mdfld_hdcp_init(struct mid_intel_hdmi_priv *p_hdmi_priv);
 
 #endif /* MDFLD_HDCP_IF_H */
index 5a2d9df..0b2351e 100644 (file)
@@ -36,9 +36,9 @@
 /*
  *
  */
-static struct mid_intel_hdmi_priv *hdmi_priv;
+static struct android_hdmi_priv *hdmi_priv;
 
-void mdfld_hdmi_audio_init(struct mid_intel_hdmi_priv *p_hdmi_priv)
+void mdfld_hdmi_audio_init(struct android_hdmi_priv *p_hdmi_priv)
 {
        hdmi_priv = p_hdmi_priv;
 }
index e5ece79..979b206 100644 (file)
@@ -83,6 +83,4 @@ struct snd_intel_had_interface {
 extern int intel_hdmi_audio_query_capabilities (had_event_call_back audio_callbacks, struct hdmi_audio_registers_ops *reg_ops,struct hdmi_audio_query_set_ops *query_ops);
 extern  int display_register(struct snd_intel_had_interface *driver,void * had_data);
 
-void mdfld_hdmi_audio_init(struct mid_intel_hdmi_priv *p_hdmi_priv);
-
 #endif /* MDFLD_HDMI_AUDIO_IF_H */
index 91ac18c..a357cb6 100644 (file)
@@ -31,9 +31,9 @@
 /*
  *
  */
-static struct mid_intel_hdmi_priv *hdmi_priv;
+static struct android_hdmi_priv *hdmi_priv;
 
-void mdfld_hdcp_init(struct mid_intel_hdmi_priv *p_hdmi_priv)
+void mdfld_hdcp_init(struct android_hdmi_priv *p_hdmi_priv)
 {
        hdmi_priv = p_hdmi_priv;
 }
index 40b6053..3f86ba7 100644 (file)
@@ -35,9 +35,9 @@ static u8 __iomem *sram_vreg_addr;
 /*
  *
  */
-static struct mid_intel_hdmi_priv *hdmi_priv;
+static struct android_hdmi_priv *hdmi_priv;
 
-void mdfld_msic_init(struct mid_intel_hdmi_priv *p_hdmi_priv)
+void mdfld_msic_init(struct android_hdmi_priv *p_hdmi_priv)
 {
        hdmi_priv = p_hdmi_priv;
 }
index d2e255e..6c3a0b1 100644 (file)
@@ -34,6 +34,4 @@
 int msic_regsiter_driver(void);
 int msic_unregister_driver(void);
 extern void hpd_notify_um (void);
-void mdfld_msic_init(struct mid_intel_hdmi_priv *p_hdmi_priv);
-
 #endif /* MDFLD_MSIC_H */
index 562e00a..dfb5286 100644 (file)
@@ -82,7 +82,7 @@ void mdfld_output_init(struct drm_device* dev)
 
 #ifdef CONFIG_MDFD_HDMI
        /* HDMI panel */
-       init_panel(dev, 0, HDMI);
+       init_panel(dev, 1, HDMI);
 #endif
 }
 
@@ -125,10 +125,15 @@ void init_panel(struct drm_device* dev, int mipi_pipe, enum panel_type p_type)
        case TMD:
                break;
        case HDMI:
-               /*hdmi_init(dev);*/
-               printk(KERN_ALERT "GFX: Initializing HDMI");
-               mdfld_hdmi_init(dev, &dev_priv->mode_dev);
-               /*hdmi_output_init(dev);*/
+               if (dev_priv && dev_priv->hdmi_present) {
+                       printk(KERN_ALERT "GFX: Initializing HDMI");
+                       mdfld_hdmi_init(dev, &dev_priv->mode_dev);
+               } else {
+                       printk(KERN_ERR "HDMI dev priv should not be null"
+                              "at this time!\n");
+                       BUG();
+               }
+
                break;
        default:
                break;
index 24ac818..43bc075 100644 (file)
@@ -226,17 +226,15 @@ ifeq ($(CONFIG_MDFD_HDMI_GREENRIDGE),y)
    $(TARGET)-y += ipil/specific/oktl-sdv/ips_hdmi.o
    $(TARGET)-y += ipil/specific/oktl-sdv/ips_hdcp.o
    $(TARGET)-y += pil/specific/oktl/ps_hdmi.o
-   obj-$(CONFIG_DRM_MRST) += $(TARGET).o
 else ifeq ($(CONFIG_MDFD_HDMI_REDRIDGE),y)
       $(TARGET)-y += ipil/specific/mfld/ips_hdmi.o
       $(TARGET)-y += ipil/specific/mfld/ips_hdcp.o
       $(TARGET)-y += pil/specific/mfld/ps_hdmi.o
       $(TARGET)-y += pil/specific/mfld/ps_hdmi_tablet.o
-      obj-$(CONFIG_DRM_MDFLD) += $(TARGET).o
 else ifeq ($(CONFIG_MDFD_HDMI_PR2),y)
       $(TARGET)-y += ipil/specific/mfld/ips_hdmi.o
       $(TARGET)-y += ipil/specific/mfld/ips_hdcp.o
       $(TARGET)-y += pil/specific/mfld/ps_hdmi.o
       $(TARGET)-y += pil/specific/mfld/ps_hdmi_phone.o
-      obj-$(CONFIG_DRM_MDFLD) += $(TARGET).o
 endif
+obj-$(CONFIG_MDFD_HDMI) += $(TARGET).o
index bfa0cb2..41d8479 100644 (file)
@@ -65,6 +65,9 @@
 #define __ANDROID_HDMI_H
 
 #include <linux/types.h>
+#include "drm.h"
+#include "drmP.h"
+#include "drm_crtc.h"
 
 #define CEA_EXT     0x02
 #define VTB_EXT     0x10
@@ -279,6 +282,16 @@ extern const struct drm_connector_funcs mdfld_hdmi_connector_funcs;
 extern const struct drm_connector_helper_funcs
                        mdfld_hdmi_connector_helper_funcs;
 
+/* TODO: do this down the layers. */
+extern int psb_intel_panel_fitter_pipe(struct drm_device *dev);
+
+/* TODO: medfiled specific */
+extern void mdfld_hdmi_audio_init(struct android_hdmi_priv *p_hdmi_priv);
+
+extern void mdfld_msic_init(struct android_hdmi_priv *p_hdmi_priv);
+
+#ifdef CONFIG_MDFD_HDMI
+
 extern void android_hdmi_driver_init(struct drm_device *dev,
                                                void *mode_dev);
 
@@ -323,13 +336,6 @@ extern void android_hdmi_enc_mode_set(struct drm_encoder *encoder,
                                struct drm_display_mode *mode,
                                struct drm_display_mode *adjusted_mode);
 
-/* TODO: do this down the layers. */
-extern int psb_intel_panel_fitter_pipe(struct drm_device *dev);
-
-/* TODO: medfiled specific */
-extern void mdfld_hdmi_audio_init(struct android_hdmi_priv *p_hdmi_priv);
-extern void mdfld_msic_init(struct android_hdmi_priv *p_hdmi_priv);
-
 /*
  * Allocates the hdmi buffers of specified dimensions.
  * Initializes Scaling related paramters.
@@ -394,4 +400,50 @@ extern enum drm_connector_status android_hdmi_detect(struct drm_connector
 extern void android_hdmi_dpms(struct drm_encoder *encoder,
                                int mode);
 
+#else /* CONFIG_MDFD_HDMI */
+
+static inline void android_hdmi_driver_init(struct drm_device *dev,
+                                               void *mode_dev) {}
+
+static inline void android_hdmi_enable_hotplug(struct drm_device *dev) {}
+
+static inline void android_hdmi_driver_setup(struct drm_device *dev) {}
+
+static inline void android_hdmi_context_init(void *context) {}
+
+static inline int android_hdmi_mode_valid(struct drm_connector *connector,
+                                       struct drm_display_mode *mode) { return 0; }
+
+static inline int android_hdmi_get_modes(struct drm_connector *connector) { return 0; }
+
+static inline int android_hdmi_crtc_mode_set(struct drm_crtc *crtc,
+                               struct drm_display_mode *mode,
+                               struct drm_display_mode *adjusted_mode,
+                               int x, int y,
+                               struct drm_framebuffer *old_fb) { return 0; }
+
+static inline void android_hdmi_enc_mode_set(struct drm_encoder *encoder,
+                               struct drm_display_mode *mode,
+                               struct drm_display_mode *adjusted_mode) {}
+
+static inline int android_hdmi_setup_hdmibuffers(struct drm_device *psDrmDev,
+                               u32 ui32HdmiWidth, u32 ui32HdmiHeight,
+                               u32 ui32BufferCount, int bpp, u32 ui32LvdsWidth,
+                               u32 ui32LvdsHeight) { return 0; }
+
+static inline void android_hdmi_restore_and_enable_display(struct drm_device *dev) {}
+
+static inline void android_hdmi_save_display_registers(struct drm_device *dev) {}
+
+static inline void android_disable_hdmi(struct drm_device *dev) {}
+
+static inline enum drm_connector_status android_hdmi_detect(struct drm_connector
+                                                               *connector)
+{ return connector_status_disconnected; }
+static inline void android_hdmi_dpms(struct drm_encoder *encoder,
+                               int mode) {}
+
+
+#endif /* CONFIG_MDFD_HDMI */
+
 #endif /* __ANDROID_HDMI_H */
index d76dc18..8547b29 100644 (file)
@@ -60,6 +60,8 @@
 
 #include "bufferclass_video_linux.h"
 
+#include "android_hdmi.h"
+
 int drm_psb_debug;
 /*EXPORT_SYMBOL(drm_psb_debug); */
 static int drm_psb_trap_pagefaults;
@@ -1118,6 +1120,9 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
        if (!dev_priv->sgx_reg)
                goto out_err;
 
+       /* setup hdmi driver */
+       android_hdmi_driver_setup(dev);
+
        mrst_get_fuse_settings(dev);
        mrst_get_vbt_data(dev_priv);
        mid_get_pci_revID(dev_priv);
@@ -2507,10 +2512,6 @@ static int __init psb_init(void)
                return ret;
        }
 
-#ifdef CONFIG_MDFD_HDMI
-       msic_regsiter_driver();
-#endif
-
        return ret;
 }
 
@@ -2522,9 +2523,6 @@ static void __exit psb_exit(void)
        if (ret != 0) {
                return;
        }
-#ifdef CONFIG_MDFD_HDMI
-       msic_unregister_driver();
-#endif
        drm_pci_exit(&driver, &psb_pci_driver);
 }
 
index 6d7ae63..de6013d 100644 (file)
@@ -495,6 +495,7 @@ struct drm_psb_private {
        */
        uint32_t ospm_base;
        spinlock_t ospm_lock;
+       uint8_t panel_desc;
 
        /*
         * Sizes info
@@ -525,6 +526,13 @@ struct drm_psb_private {
        struct bdb_lvds_backlight *lvds_bl; /*LVDS backlight info from VBT*/
        struct psb_intel_i2c_chan *lvds_i2c_bus;
 
+       /*
+        * HDMI info
+        */
+       struct android_hdmi_priv *hdmi_priv;
+       /* TODO: choose either hdmi_present or HDMI_enable in this struct.*/
+       uint32_t hdmi_present;
+
        /* Feature bits from the VBIOS*/
        unsigned int int_tv_support:1;
        unsigned int lvds_dither:1;
index 5f14dfb..64e76c9 100644 (file)
@@ -303,6 +303,7 @@ static struct drm_framebuffer *psb_user_framebuffer_create
        if (!info)
                return ERR_PTR(-ENOMEM);
 
+       info->par = fbdev;
        strcpy(info->fix.id, "psbfb");
 
        info->flags = FBINFO_DEFAULT;
index 67af879..5d7d8ab 100644 (file)
@@ -122,7 +122,7 @@ static bool psb_intel_crtc_mode_fixup(struct drm_crtc *crtc,
  * Return the pipe currently connected to the panel fitter,
  * or -1 if the panel fitter is not present or not in use
  */
-static int psb_intel_panel_fitter_pipe(struct drm_device *dev)
+int psb_intel_panel_fitter_pipe(struct drm_device *dev)
 {
        u32 pfit_control;
 
@@ -1541,7 +1541,16 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
        struct drm_connector * connector;
        int timeout = 0;
 
-       PSB_DEBUG_ENTRY("pipe = 0x%x \n", pipe);
+       PSB_DEBUG_ENTRY("pipe = 0x%x\n", pipe);
+
+       if (pipe == 1) {
+               if (!ospm_power_using_hw_begin(OSPM_DISPLAY_ISLAND,
+                               OSPM_UHB_FORCE_POWER_ON))
+                       return 0;
+               android_hdmi_crtc_mode_set(crtc, mode, adjusted_mode,
+                       x, y, old_fb);
+               goto mrst_crtc_mode_set_exit;
+       }
 
        switch (pipe) {
        case 0:
index 2d2160e..9eebdef 100644 (file)
 #include "mdfld_hdmi_audio_if.h"
 #include "mdfld_msic.h"
 #include "mdfld_hdcp_if.h"
+#include <linux/switch.h>
 #include <linux/pm_runtime.h>
 #include <asm/intel_scu_ipc.h>
 
+/* Global devices for switch class used for hotplug notification */
+struct switch_dev g_switch_hdmi_dev;
+struct switch_dev g_switch_dvi_dev;
+
 /* FIXME_MDFLD HDMI EDID supports */
 
 static char EDID_Samsung[EDID_LENGTH + HDMI_CEA_EDID_BLOCK_SIZE] =
@@ -176,48 +181,13 @@ static bool mdfld_hdmi_mode_fixup(struct drm_encoder *encoder,
        struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(encoder->crtc);
        PSB_DEBUG_ENTRY("hdisplay = %d, vdisplay = %d. a_hdisplay = %d, a_vdisplay = %d.\n", mode->hdisplay, mode->vdisplay, adjusted_mode->hdisplay, adjusted_mode->vdisplay);
 
-       /* Should never happen!! */
-       if (psb_intel_crtc->pipe != 1) {
-               printk(KERN_ERR
-                      "Only support HDMI on pipe B on MID \n");
-       }
-
-       /* FIXME: To make HDMI display with 1920x1080, 
-       * in 864x480 (TPO), 480x864 (PYR) or 480x854 (TMD) fixed mode. */
-       if ((mode->hdisplay == 864 && mode->vdisplay == 480)
-                      || (mode->hdisplay == 854 && mode->vdisplay == 480)
-                      || (mode->hdisplay == 480 && mode->vdisplay == 864)
-                      || (mode->hdisplay == 480 && mode->vdisplay == 854)) {
-              adjusted_mode->hdisplay = 1920;
-              adjusted_mode->htotal = 2200;
-              adjusted_mode->hsync_start = 2008;
-              adjusted_mode->hsync_end = 2052;
-              adjusted_mode->hskew = 0;
-              adjusted_mode->vdisplay = 1080;
-              adjusted_mode->vtotal = 1125;
-              adjusted_mode->vsync_start = 1084;
-              adjusted_mode->vsync_end = 1089;
-              adjusted_mode->vscan = 0;
-              adjusted_mode->clock = 148500;
-
-              /* Apply the adjusted mode to CRTC mode setting parameters. */
-              drm_mode_set_crtcinfo(adjusted_mode, CRTC_INTERLACE_HALVE_V);
-       }
-
-#if 0 /* MDFLD_HDMI_JLIU7_HACKS */
-       if (mode->hdisplay == 864 && mode->vdisplay == 480) { 
-               adjusted_mode->hdisplay = 0x500;
-               adjusted_mode->htotal = 0x672;
-               adjusted_mode->hsync_start = 0x56e;
-               adjusted_mode->hsync_end = 0x596;
-               adjusted_mode->vdisplay = 0x2d0; 
-               adjusted_mode->vtotal = 0x2ee;
-               adjusted_mode->vsync_start = 0x2d5;
-               adjusted_mode->vsync_end = 0x2da;
-               drm_mode_set_crtcinfo(adjusted_mode,
-                               CRTC_INTERLACE_HALVE_V);
+       /* Should never happen!! */
+       if (psb_intel_crtc->pipe != 1) {
+               printk(KERN_ERR
+                       "Only support HDMI on pipe B on MID\n");
+               return false;
        }
-#endif /* MDFLD_HDMI_JLIU7_HACKS */ /* Debug HDMI - Can't enalbe HDMI */
+
 #if 0 // MDFLD_HDMI_JLIU7_HACKS /* Debug HDMI - Can't enalbe HDMI */
 #if 1 /* 720p - Adeel */
        adjusted_mode->hdisplay = 0x500;
@@ -328,10 +298,10 @@ static void mdfld_hdmi_dpms(struct drm_encoder *encoder, int mode)
 {
        struct drm_device *dev = encoder->dev;
        struct psb_intel_output *output = enc_to_psb_intel_output(encoder);
-       struct mid_intel_hdmi_priv *hdmi_priv = output->dev_priv;
+       struct android_hdmi_priv *hdmi_priv = output->dev_priv;
        u32 hdmib, hdmi_phy_misc;
 
-       PSB_DEBUG_ENTRY("%s \n", mode == DRM_MODE_DPMS_ON ? "on" : "off");
+       PSB_DEBUG_ENTRY("%s\n", mode == DRM_MODE_DPMS_ON ? "on" : "off");
 
        hdmib = REG_READ(hdmi_priv->hdmib_reg) | HDMIB_PIPE_B_SELECT | HDMIB_NULL_PACKET;
        hdmi_phy_misc = REG_READ(HDMIPHYMISCCTL);
@@ -986,30 +956,30 @@ static void psb_intel_lvds_enc_destroy(struct drm_encoder *encoder)
 }
 
 /* Note: taken from psb_intel_lvds.c */
-static const struct drm_encoder_funcs psb_intel_lvds_enc_funcs = {
+const struct drm_encoder_funcs psb_intel_lvds_enc_funcs = {
        .destroy = psb_intel_lvds_enc_destroy,
 };
 
-static const struct drm_encoder_helper_funcs mdfld_hdmi_helper_funcs = {
+const struct drm_encoder_helper_funcs mdfld_hdmi_helper_funcs = {
        .dpms = mdfld_hdmi_dpms,
        .mode_fixup = mdfld_hdmi_mode_fixup,
        .prepare = psb_intel_encoder_prepare,
-       .mode_set = mdfld_hdmi_mode_set,
+       .mode_set = android_hdmi_enc_mode_set,
        .commit = psb_intel_encoder_commit,
 };
 
-static const struct drm_connector_helper_funcs
+const struct drm_connector_helper_funcs
     mdfld_hdmi_connector_helper_funcs = {
-       .get_modes = mdfld_hdmi_get_modes,
-       .mode_valid = mdfld_hdmi_mode_valid,
+       .get_modes = android_hdmi_get_modes,
+       .mode_valid = android_hdmi_mode_valid,
        .best_encoder = psb_intel_best_encoder,
 };
 
-static const struct drm_connector_funcs mdfld_hdmi_connector_funcs = {
+const struct drm_connector_funcs mdfld_hdmi_connector_funcs = {
        .dpms = mdfld_hdmi_connector_dpms,
        .save = mdfld_hdmi_save,
        .restore = mdfld_hdmi_restore,
-       .detect = mdfld_hdmi_detect,
+       .detect = android_hdmi_detect,
        .fill_modes = drm_helper_probe_single_connector_modes,
        .set_property = mdfld_hdmi_set_property,
        .destroy = psb_intel_lvds_destroy,
@@ -1018,68 +988,28 @@ static const struct drm_connector_funcs mdfld_hdmi_connector_funcs = {
 void mdfld_hdmi_init(struct drm_device *dev,
                    struct psb_intel_mode_device *mode_dev)
 {
-#if 0
-       DRM_DRIVER_PRIVATE_T *dev_priv = dev->dev_private;
-#endif 
-       struct psb_intel_output *psb_intel_output;
-       struct drm_connector *connector;
-       struct drm_encoder *encoder;
-       struct mid_intel_hdmi_priv *hdmi_priv;
-
        PSB_DEBUG_ENTRY("\n");
 
-       psb_intel_output = kzalloc(sizeof(struct psb_intel_output) +
-                              sizeof(struct mid_intel_hdmi_priv), GFP_KERNEL);
-       if (!psb_intel_output)
-               return;
-
-       hdmi_priv = (struct mid_intel_hdmi_priv *)(psb_intel_output + 1);
-       psb_intel_output->mode_dev = mode_dev;
-       connector = &psb_intel_output->base;
-       encoder = &psb_intel_output->enc;
-       drm_connector_init(dev, &psb_intel_output->base,
-                          &mdfld_hdmi_connector_funcs,
-                          DRM_MODE_CONNECTOR_DVID);
-
-       drm_encoder_init(dev, &psb_intel_output->enc, &psb_intel_lvds_enc_funcs,
-                        DRM_MODE_ENCODER_TMDS);
-
-       drm_mode_connector_attach_encoder(&psb_intel_output->base,
-                                         &psb_intel_output->enc);
-       psb_intel_output->type = INTEL_OUTPUT_HDMI;
-       /*FIXME: May need to get this somewhere, but CG code seems hard coded it*/
-       hdmi_priv->hdmib_reg = HDMIB_CONTROL;
-       hdmi_priv->has_hdmi_sink = false;
-       psb_intel_output->dev_priv = hdmi_priv;
+       android_hdmi_driver_init(dev, (void *) mode_dev);
 
-       drm_encoder_helper_add(encoder, &mdfld_hdmi_helper_funcs);
-       drm_connector_helper_add(connector,
-                                &mdfld_hdmi_connector_helper_funcs);
-       connector->display_info.subpixel_order = SubPixelHorizontalRGB;
-       connector->interlace_allowed = false;
-       connector->doublescan_allowed = false;
-
-       drm_connector_attach_property(connector, dev->mode_config.scaling_mode_property, DRM_MODE_SCALE_FULLSCREEN);
-
-       /* hard-coded the HDMI_I2C_ADAPTER_ID to be 3, Should get from GCT*/
-       psb_intel_output->hdmi_i2c_adapter = i2c_get_adapter(3);
+       /* turn on HDMI power rails. These will be on in all non-S0iX
+        * states so that HPD and connection status will work. VCC330
+        * will have ~1.7mW usage during idle states when the display
+        * is active.
+        */
+       intel_scu_ipc_iowrite8(MSIC_VCC330CNT, VCC330_ON);
 
-       if (psb_intel_output->hdmi_i2c_adapter) {
-               /* HACKS_JLIU7 */
-               DRM_INFO("Enter mdfld_hdmi_init, i2c_adapter is availabe.\n");
-       
-       } else {
-               printk(KERN_ALERT "No ddc adapter available!\n");
-       }
+       /* MSIC documentation requires that there be a 500us delay
+        * after enabling VCC330 before you can enable VHDMI
+        */
+       usleep_range(500, 1000);
 
-       hdmi_priv->is_hdcp_supported = true;
-       hdmi_priv->hdmi_i2c_adapter = psb_intel_output->hdmi_i2c_adapter;
-       hdmi_priv->dev = dev; 
-       mdfld_hdcp_init(hdmi_priv);
-       mdfld_hdmi_audio_init(hdmi_priv);
-       mdfld_msic_init(hdmi_priv);
+       /* Extend VHDMI switch de-bounce time, to avoid redundant MSIC
+        * VREG/HDMI interrupt during HDMI cable plugged
+        * in/out.
+        */
+       intel_scu_ipc_iowrite8(MSIC_VHDMICNT, VHDMI_ON | VHDMI_DB_30MS);
 
-       drm_sysfs_connector_add(connector);
        return;
 }
 #endif
index 23e3583..0cd2946 100644 (file)
@@ -28,6 +28,8 @@
 #ifndef __PSB_INTEL_HDMI_H__
 #define __PSB_INTEL_HDMI_H__
 
+#include "android_hdmi.h"
+
 #include <linux/types.h>
 #include <linux/version.h>
 
@@ -67,6 +69,9 @@ DEFINE_GUID(GUID_AVI_INFOFRAME, 0xdfcb113b, 0xe54f, 0x49a2, 0xb5, 0xe3, 0x78, 0x
 // Header = 4, Baseline Data = 80 and Vendor (INTEL) specific = 2 as per EELD spec
 // 4 + 80 + = 84
 #define HDMI_EELD_SIZE 84
+extern void mdfld_hdcp_init(struct android_hdmi_priv *p_hdmi_priv);
+extern void mdfld_hdmi_audio_init(struct android_hdmi_priv *p_hdmi_priv);
+extern void mdfld_msic_init(struct android_hdmi_priv *p_hdmi_priv);
 
 //
 // HDMI command types
@@ -461,160 +466,6 @@ typedef union _lpcm_cad {
 } lpcm_cad_t;
 
 //
-// CEA Short Audio Descriptor
-// 
-typedef struct _cea_861b_adb {
-#pragma pack(1)
-    union
-    {
-        uint8_t byte1;
-        struct
-        {
-            uint8_t   max_channels        :3; // Bits[0-2]
-            uint8_t   audio_format_code   :4;    // Bits[3-6], see AUDIO_FORMAT_CODES
-            uint8_t   b1reserved          :1;    // Bit[7] - reserved
-        };
-    };
-    union
-    {
-        uint8_t    byte2;
-        struct
-        {
-            uint8_t   sp_rate_32kHz             :1;    // Bit[0] sample rate = 32kHz
-            uint8_t   sp_rate_44kHz             :1;    // Bit[1] sample rate = 44kHz
-            uint8_t   sp_rate_48kHz             :1;    // Bit[2] sample rate = 48kHz
-            uint8_t   sp_rate_88kHz             :1;    // Bit[3] sample rate = 88kHz
-            uint8_t   sp_rate_96kHz             :1;    // Bit[4] sample rate = 96kHz
-            uint8_t   sp_rate_176kHz            :1;    // Bit[5] sample rate = 176kHz
-            uint8_t   sp_rate_192kHz            :1;    // Bit[6] sample rate = 192kHz
-            uint8_t   sp_rate_b2reserved        :1;    // Bit[7] - reserved
-        };
-    };
-    union
-    {
-        uint8_t   byte3;    // maximum bit rate divided by 8kHz
-        // following is the format of 3rd byte for uncompressed(LPCM) audio
-        struct
-        {
-            uint8_t    bit_rate_16bit                :1;    // Bit[0]
-            uint8_t    bit_rate_20bit                :1;    // Bit[1]
-            uint8_t    bit_rate_24bit                :1;    // Bit[2]
-            uint8_t    bit_rate_b3reserved        :5;    // Bits[3-7]
-        };
-    };
-#pragma pack()
-}cea_861b_adb_t; 
-
-//
-// Enhanced EDID Like Data aka EELD structure
-//
-typedef union _hdmi_eeld {
-    uint8_t eeld[HDMI_EELD_SIZE];
-    #pragma pack(1)
-    struct
-    {
-        // Byte[0] = ELD Version Number
-        union
-        {
-            uint8_t   byte0;          
-            struct
-            {
-                uint8_t reserved:3;      // Reserf
-                uint8_t eld_ver:5;      // ELD Version Number
-                                        //  00000b - reserved
-                                        //  00001b - first rev
-                                        //  00010b:11111b - reserved for future
-            };
-        };
-
-        // Byte[1] = Vendor Version Field
-               union
-               {
-                       uint8_t vendor_version;
-                       struct
-                       {
-                               uint8_t reserved1:3;
-                               uint8_t veld_ver:5; // Version number of the ELD extension.
-                                                   // This value is provisioned and unique to each vendor.
-                       };
-               };
-
-               // Byte[2] = Baseline Lenght field
-               uint8_t baseline_eld_length; // Length of the Baseline structure divided by Four.
-
-               // Byte [3] = Reserved for future use
-               uint8_t byte3;
-
-               // Starting of the BaseLine EELD structure
-               // Byte[4] = Monitor Name Length 
-               union
-               {
-                       uint8_t byte4;
-                       struct
-                       {
-                               uint8_t mnl:5;
-                               uint8_t cea_edid_rev_id:3;
-                       };
-               };
-
-               // Byte[5] = Capabilities
-               union
-               {
-                       uint8_t capabilities;
-                       struct
-                       {
-                               uint8_t hdcp:1; // Indicates HDCP support
-                               uint8_t ai_support:1;   // Inidcates AI support
-                               uint8_t connection_type:2; // Indicates Connection type 
-                                                         // 00 - HDMI
-                                                         // 01 - DP
-                                                         // 10 -11  Reserved for future connection types
-                               uint8_t sadc:4; // Indicates number of 3 bytes Short Audio Descriptors. 
-                       };
-               };
-
-               // Byte[6] = Audio Synch Delay
-               uint8_t audio_synch_delay; // Amount of time reported by the sink that the video trails audio in milliseconds.
-
-               // Byte[7] = Speaker Allocation Block
-               union
-               {
-                       uint8_t speaker_allocation_block;
-                       struct
-                       {
-                               uint8_t flr:1; // Front Left and Right channels
-                               uint8_t lfe:1; // Low Frequency Effect channel
-                               uint8_t fc:1;  // Center transmission channel
-                               uint8_t rlr:1; // Rear Left and Right channels
-                               uint8_t rc:1; // Rear Center channel
-                               uint8_t flrc:1; // Front left and Right of Center transmission channels
-                               uint8_t rlrc:1; // Rear left and Right of Center transmission channels
-                               uint8_t reserved3:1; // Reserved
-                       };
-               };
-
-               // Byte[8 - 15] - 8 Byte port identification value
-               uint8_t port_id_value[8];
-
-        // Byte[16 - 17] - 2 Byte Manufacturer ID
-        uint8_t manufacturer_id[2];
-
-        // Byte[18 - 19] - 2 Byte Product ID
-        uint8_t product_id[2];
-
-               // Byte [20-83] - 64 Bytes of BaseLine Data
-       uint8_t mn_sand_sads[64]; // This will include
-                                       // - ASCII string of Monitor name
-                                // - List of 3 byte SADs
-                                       // - Zero padding
-
-               // Vendor ELD Block should continue here!
-        // No Vendor ELD block defined as of now. 
-       };
-    #pragma pack()
-} hdmi_eeld_t;
-
-//
 // Data structure for misc HDMI data
 //
 typedef struct _misc_hdmi_data {
@@ -931,6 +782,7 @@ struct hdmi_edid_info {
 #define MSIC_VHDMICNT 0xde
   #define VHDMI_OFF 0x25
   #define VHDMI_ON 0xa5
+  #define VHDMI_DB_30MS 0x60
 #define MSIC_HDMI_STATUS 0x281
   #define HPD_SIGNAL_STATUS (1 << 0)
 
index 2b6b53a..10e352f 100644 (file)
@@ -31,6 +31,8 @@
 
 #include <linux/pci.h>
 #include <drm/drmP.h>
+#include <drm/drm_crtc.h>
+#include <linux/intel_mid_pm.h>
 #ifdef CONFIG_PM_RUNTIME
 #include <linux/pm_runtime.h>
 #endif
 #define IPC_CMD_PANEL_ON        1
 #define IPC_CMD_PANEL_OFF       0
 
+#define DISPLAY_A 0x1
+#define DISPLAY_B 0x2
+#define DISPLAY_C 0x4
+
 typedef enum _UHBUsage
 {
     OSPM_UHB_ONLY_IF_ON = 0,