From: Daniel(Qiang), Miao <[email protected]>

In order to fix issue of video encode driver broken

1. add platform specfic handling fork for both Moorestown and Medfiled in 
function psb_irq_postinstall_islands() and psb_irq_uninstall_islands
2. fix missing handling of Medfield in function psb_irq_uninstall_islands()
3. fix wrong platform identification and register definition in function 
pnw_map_topaz_reg/pnw_unmap_topaz_reg in pnw_topaz.c
4. remove obsolete video decoder/encoder codes in msvdx_power.c topaz_power.c 
and medfield-sysconfig.c

Change-Id: Icd664f12a290ca8ea3feb3155a24250f60c977b9
Signed-off-by: Hitesh K. Patel <[email protected]>
---
 drivers/staging/mrst/drv/psb_irq.c                 |   22 +++++++++++++------
 drivers/staging/mrst/imgv/msvdx_power.c            |    6 +++-
 drivers/staging/mrst/imgv/pnw_topaz.c              |   21 ++++++++----------
 drivers/staging/mrst/imgv/topaz_power.c            |    4 +-
 .../mrst/pvr/services4/system/medfield/sysconfig.c |    7 ++++-
 5 files changed, 35 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/mrst/drv/psb_irq.c 
b/drivers/staging/mrst/drv/psb_irq.c
index 4ccf6a0..93a02be 100644
--- a/drivers/staging/mrst/drv/psb_irq.c
+++ b/drivers/staging/mrst/drv/psb_irq.c
@@ -330,7 +330,7 @@ irqreturn_t psb_irq_handler(DRM_IRQ_ARGS)
        if ((IS_MDFLD(dev) && topaz_int)) {
                pnw_topaz_interrupt(dev);
                handled = 1;
-       } else if (IS_MID(dev) && topaz_int &&
+       } else if (IS_MRST(dev) && topaz_int &&
                ospm_power_is_hw_on(OSPM_VIDEO_ENC_ISLAND)) {
                /* sometimes, even topaz power down, IIR 
                 * may still have topaz bit set
@@ -450,8 +450,12 @@ int psb_irq_postinstall_islands(struct drm_device *dev, 
int hw_islands)
 
        if (IS_MID(dev) && !dev_priv->topaz_disabled)
                if (hw_islands & OSPM_VIDEO_ENC_ISLAND)
-                       if (true/*powermgmt_is_hw_on(dev->pdev, 
PSB_VIDEO_ENC_ISLAND)*/)
-                               lnc_topaz_enableirq(dev);
+                       if (ospm_power_is_hw_on(OSPM_VIDEO_ENC_ISLAND)) {
+                               if (IS_MRST(dev))
+                                       lnc_topaz_enableirq(dev);
+                               if (IS_MDFLD(dev))
+                                       pnw_topaz_enableirq(dev);
+                       }
 
        if (hw_islands & OSPM_VIDEO_DEC_ISLAND)
                if (true/*powermgmt_is_hw_on(dev->pdev, PSB_VIDEO_DEC_ISLAND)*/)
@@ -502,10 +506,10 @@ void psb_irq_uninstall_islands(struct drm_device *dev, 
int hw_islands)
        if (hw_islands & OSPM_GRAPHICS_ISLAND)
                dev_priv->vdc_irq_mask &= ~_PSB_IRQ_SGX_FLAG;
 
-       if ((hw_islands & OSPM_VIDEO_DEC_ISLAND) && IS_MRST(dev))
+       if ((hw_islands & OSPM_VIDEO_DEC_ISLAND) && IS_MID(dev))
                dev_priv->vdc_irq_mask &= ~_PSB_IRQ_MSVDX_FLAG;
 
-       if ((hw_islands & OSPM_VIDEO_ENC_ISLAND) && IS_MRST(dev))
+       if ((hw_islands & OSPM_VIDEO_ENC_ISLAND) && IS_MID(dev))
                dev_priv->vdc_irq_mask &= ~_LNC_IRQ_TOPAZ_FLAG;
 
        /*These two registers are safe even if display island is off*/
@@ -519,8 +523,12 @@ void psb_irq_uninstall_islands(struct drm_device *dev, int 
hw_islands)
 
        if (IS_MID(dev) && !dev_priv->topaz_disabled)
                if (hw_islands & OSPM_VIDEO_ENC_ISLAND)
-                       if (ospm_power_is_hw_on(OSPM_VIDEO_ENC_ISLAND))
-                               lnc_topaz_disableirq(dev);
+                       if (ospm_power_is_hw_on(OSPM_VIDEO_ENC_ISLAND)) {
+                               if (IS_MRST(dev))
+                                       lnc_topaz_disableirq(dev);
+                               if (IS_MDFLD(dev))
+                                       pnw_topaz_disableirq(dev);
+                       }
        if (hw_islands & OSPM_VIDEO_DEC_ISLAND)
                if (ospm_power_is_hw_on(OSPM_VIDEO_DEC_ISLAND))
                        psb_msvdx_disableirq(dev);
diff --git a/drivers/staging/mrst/imgv/msvdx_power.c 
b/drivers/staging/mrst/imgv/msvdx_power.c
index 803e04d..27ed96e 100644
--- a/drivers/staging/mrst/imgv/msvdx_power.c
+++ b/drivers/staging/mrst/imgv/msvdx_power.c
@@ -93,6 +93,7 @@ PVRSRV_ERROR MSVDXPrePowerState(IMG_HANDLE hDevHandle,
                                 PVRSRV_DEV_POWER_STATE eNewPowerState,
                                 PVRSRV_DEV_POWER_STATE eCurrentPowerState)
 {
+#if 0
        /* ask for a change not power on*/
        if ((eNewPowerState != eCurrentPowerState) &&
            (eNewPowerState != PVRSRV_DEV_POWER_STATE_ON)) {
@@ -116,7 +117,7 @@ PVRSRV_ERROR MSVDXPrePowerState(IMG_HANDLE hDevHandle,
                                eNewPowerState));
                }
        }
-
+#endif
        return PVRSRV_OK;
 }
 
@@ -124,6 +125,7 @@ PVRSRV_ERROR MSVDXPostPowerState(IMG_HANDLE hDevHandle,
                                 PVRSRV_DEV_POWER_STATE eNewPowerState,
                                 PVRSRV_DEV_POWER_STATE eCurrentPowerState)
 {
+#if 0
        /* if ask for change & current status is not on */
        if ((eNewPowerState != eCurrentPowerState) &&
            (eCurrentPowerState != PVRSRV_DEV_POWER_STATE_ON)) {
@@ -145,7 +147,7 @@ PVRSRV_ERROR MSVDXPostPowerState(IMG_HANDLE hDevHandle,
                                eNewPowerState));
                }
        }
-
+#endif
        return PVRSRV_OK;
 }
 
diff --git a/drivers/staging/mrst/imgv/pnw_topaz.c 
b/drivers/staging/mrst/imgv/pnw_topaz.c
index 8dd4d49..5795bf8 100644
--- a/drivers/staging/mrst/imgv/pnw_topaz.c
+++ b/drivers/staging/mrst/imgv/pnw_topaz.c
@@ -75,16 +75,16 @@ IMG_BOOL pnw_topaz_interrupt(IMG_VOID *pvData)
 
        dev = (struct drm_device *)pvData;
         
-       /*if (!ospm_power_is_hw_on(OSPM_VIDEO_ENC_ISLAND)) {
+       if (!ospm_power_is_hw_on(OSPM_VIDEO_ENC_ISLAND)) {
                DRM_ERROR("ERROR: interrupt arrived but HW is power off\n");
                return IMG_FALSE;
-       }*/
+       }
 
        dev_priv = (struct drm_psb_private *) dev->dev_private;
        topaz_priv = dev_priv->topaz_private;
 
        /*TODO : check if topaz is busy*/
-       /*topaz_priv->topaz_hw_busy = REG_READ(0x20D0) & (0x1 << 11)*/;
+       topaz_priv->topaz_hw_busy = REG_READ(0x20D0) & (0x1 << 11);
 
        TOPAZ_READ32(TOPAZ_CR_IMG_TOPAZ_INTSTAT, &topaz_stat, 0);
        clr_flag = pnw_topaz_queryirq(dev);
@@ -819,15 +819,13 @@ inline int psb_try_power_down_topaz(struct drm_device 
*dev)
 void pnw_map_topaz_reg(struct drm_device *dev)
 {
        unsigned long resource_start;
-       struct drm_psb_private *dev_priv =
-               (struct drm_psb_private *)dev->dev_private;
+       struct drm_psb_private *dev_priv = (struct drm_psb_private 
*)dev->dev_private;
 
        resource_start = pci_resource_start(dev->pdev, PSB_MMIO_RESOURCE);
 
-       if (IS_MRST(dev) && !dev_priv->topaz_disabled) {
-               dev_priv->topaz_reg =
-                   ioremap(resource_start + LNC_TOPAZ_OFFSET,
-                           LNC_TOPAZ_SIZE);
+       if (IS_MDFLD(dev) && !dev_priv->topaz_disabled) {
+               dev_priv->topaz_reg = ioremap(resource_start + PNW_TOPAZ_OFFSET,
+                                             PNW_TOPAZ_SIZE);
                if (!dev_priv->topaz_reg)
                        DRM_ERROR("failed to map TOPAZ register address\n");
        }
@@ -837,10 +835,9 @@ void pnw_map_topaz_reg(struct drm_device *dev)
 
 void pnw_unmap_topaz_reg(struct drm_device *dev)
 {
-       struct drm_psb_private *dev_priv =
-               (struct drm_psb_private *)dev->dev_private;
+       struct drm_psb_private *dev_priv = (struct drm_psb_private 
*)dev->dev_private;
 
-       if (IS_MRST(dev)) {
+       if (IS_MDFLD(dev)) {
                if (dev_priv->topaz_reg) {
                        iounmap(dev_priv->topaz_reg);
                        dev_priv->topaz_reg = NULL;
diff --git a/drivers/staging/mrst/imgv/topaz_power.c 
b/drivers/staging/mrst/imgv/topaz_power.c
index afeedd6..04b33ba 100644
--- a/drivers/staging/mrst/imgv/topaz_power.c
+++ b/drivers/staging/mrst/imgv/topaz_power.c
@@ -96,7 +96,7 @@ PVRSRV_ERROR TOPAZPrePowerState(IMG_HANDLE            
hDevHandle,
                                 PVRSRV_DEV_POWER_STATE eNewPowerState,
                                 PVRSRV_DEV_POWER_STATE eCurrentPowerState)
 {
-#if 1
+#if 0
        /* ask for a change not power on*/
        if ((eNewPowerState != eCurrentPowerState) &&
            (eNewPowerState != PVRSRV_DEV_POWER_STATE_ON)) {
@@ -160,7 +160,7 @@ PVRSRV_ERROR TOPAZPostPowerState(IMG_HANDLE         
hDevHandle,
                                PVRSRV_DEV_POWER_STATE  eNewPowerState,
                                PVRSRV_DEV_POWER_STATE  eCurrentPowerState)
 {
-#if 1
+#if 0
        /* if ask for change & current status is not on */
        if ((eNewPowerState != eCurrentPowerState) &&
            (eCurrentPowerState != PVRSRV_DEV_POWER_STATE_ON)) {
diff --git a/drivers/staging/mrst/pvr/services4/system/medfield/sysconfig.c 
b/drivers/staging/mrst/pvr/services4/system/medfield/sysconfig.c
index 3ea30f8..011cb88 100644
--- a/drivers/staging/mrst/pvr/services4/system/medfield/sysconfig.c
+++ b/drivers/staging/mrst/pvr/services4/system/medfield/sysconfig.c
@@ -1168,6 +1168,7 @@ PVRSRV_ERROR SysDevicePrePowerState(IMG_UINT32            
        ui32DeviceIndex,
                        ospm_power_island_down(OSPM_GRAPHICS_ISLAND);   
 #endif
                }
+#if 0
                else if (ui32DeviceIndex == gui32MRSTMSVDXDeviceID)
                {                       
                        if (ospm_power_is_hw_on(OSPM_DISPLAY_ISLAND)) {
@@ -1200,7 +1201,8 @@ PVRSRV_ERROR SysDevicePrePowerState(IMG_UINT32            
        ui32DeviceIndex,
                        ospm_power_using_hw_end(OSPM_DISPLAY_ISLAND);
 #endif
 #endif
-               }
+#endif
+       }
        
        return PVRSRV_OK;
 }
@@ -1221,7 +1223,7 @@ PVRSRV_ERROR SysDevicePostPowerState(IMG_UINT32           
        ui32DeviceIndex,
 #endif
 
                }
-
+#if 0
                else if (ui32DeviceIndex == gui32MRSTMSVDXDeviceID)
                {
                        PVR_DPF((PVR_DBG_MESSAGE,"SysDevicePrePowerState: 
Restore MSVDX power"));
@@ -1274,6 +1276,7 @@ PVRSRV_ERROR SysDevicePostPowerState(IMG_UINT32           
        ui32DeviceIndex,
 #endif
 #endif
                }
+#endif
        }
 
        return PVRSRV_OK;
-- 
1.7.1

_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to