From: Jackie Li <[email protected]>

user mode cannot get mipi panel physical sizes, add hard coded physical sizes,
will update it to after figuring out a way to query panel data.

Change-Id: I7bab0ccc6439c1ac6b29b6b9015b1bc3d536cd2e
Signed-off-by: Jackie Li <[email protected]>
---
 drivers/staging/mrst/drv/mdfld_dsi_output.c |   18 +++++++++++++++---
 drivers/staging/mrst/drv/mdfld_output.h     |   15 +++++++++++++++
 drivers/staging/mrst/drv/pyr_cmd.c          |   14 ++++++++++++++
 drivers/staging/mrst/drv/tmd_vid.c          |   14 ++++++++++++++
 drivers/staging/mrst/drv/tpo_cmd.c          |   13 +++++++++++++
 drivers/staging/mrst/drv/tpo_vid.c          |   14 ++++++++++++++
 6 files changed, 85 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/mrst/drv/mdfld_dsi_output.c 
b/drivers/staging/mrst/drv/mdfld_dsi_output.c
index 12c54e5..5bf6069 100644
--- a/drivers/staging/mrst/drv/mdfld_dsi_output.c
+++ b/drivers/staging/mrst/drv/mdfld_dsi_output.c
@@ -875,6 +875,8 @@ void mdfld_dsi_output_init(struct drm_device * dev,
        struct drm_connector * connector;
        struct mdfld_dsi_encoder * encoder;
        struct drm_psb_private * dev_priv = dev->dev_private;
+       struct panel_info dsi_panel_info;
+       u32 width_mm, height_mm;
 
        PSB_DEBUG_ENTRY("init DSI output on pipe %d\n", pipe);
        
@@ -911,11 +913,19 @@ void mdfld_dsi_output_init(struct drm_device * dev,
        dsi_config->dev = dev;
        
        /*init fixed mode basing on DSI config type*/
-       if(dsi_config->type == MDFLD_DSI_ENCODER_DBI) 
+       if(dsi_config->type == MDFLD_DSI_ENCODER_DBI) {
                dsi_config->fixed_mode = p_cmd_funcs->get_config_mode(dev);
-       else if(dsi_config->type == MDFLD_DSI_ENCODER_DPI)
+               if(p_cmd_funcs->get_panel_info(dev, pipe, &dsi_panel_info))
+                       goto dsi_init_err0;
+       } else if(dsi_config->type == MDFLD_DSI_ENCODER_DPI) {
                dsi_config->fixed_mode = p_vid_funcs->get_config_mode(dev);
-               
+               if(p_vid_funcs->get_panel_info(dev, pipe, &dsi_panel_info))
+                       goto dsi_init_err0;
+       }
+
+       width_mm = dsi_panel_info.width_mm;
+       height_mm = dsi_panel_info.height_mm;
+
        dsi_config->mode = dsi_config->fixed_mode;
        dsi_config->connector = dsi_connector;
        
@@ -943,6 +953,8 @@ void mdfld_dsi_output_init(struct drm_device * dev,
        drm_connector_helper_add(connector, &mdfld_dsi_connector_helper_funcs);
        
        connector->display_info.subpixel_order = SubPixelHorizontalRGB;
+       connector->display_info.width_mm = width_mm;
+       connector->display_info.height_mm = height_mm;
        connector->interlace_allowed = false;
        connector->doublescan_allowed = false;
        
diff --git a/drivers/staging/mrst/drv/mdfld_output.h 
b/drivers/staging/mrst/drv/mdfld_output.h
index 448dec3..4d96b8f 100644
--- a/drivers/staging/mrst/drv/mdfld_output.h
+++ b/drivers/staging/mrst/drv/mdfld_output.h
@@ -37,11 +37,26 @@
 
 #include "psb_drv.h"
 
+#define TPO_PANEL_WIDTH        84
+#define TPO_PANEL_HEIGHT       46
+#define TMD_PANEL_WIDTH        39
+#define TMD_PANEL_HEIGHT       71
+#define PYR_PANEL_WIDTH        53
+#define PYR_PANEL_HEIGHT       95
+
+struct panel_info {
+       u32 width_mm;
+       u32 height_mm;
+
+       /*other infos*/
+};
+
 struct panel_funcs {
        const struct drm_encoder_funcs* encoder_funcs;
        const struct drm_encoder_helper_funcs* encoder_helper_funcs;
        struct drm_display_mode* (*get_config_mode)(struct drm_device*);
        void (*update_fb)(struct mdfld_dsi_dbi_output*, int);
+       int (*get_panel_info)(struct drm_device *, int, struct panel_info *);
 };
 
 void mdfld_output_init(struct drm_device* dev);
diff --git a/drivers/staging/mrst/drv/pyr_cmd.c 
b/drivers/staging/mrst/drv/pyr_cmd.c
index b152711..151c12a 100644
--- a/drivers/staging/mrst/drv/pyr_cmd.c
+++ b/drivers/staging/mrst/drv/pyr_cmd.c
@@ -564,6 +564,19 @@ void pyr_dsi_adapter_init(struct mdfld_dsi_config * 
dsi_config, int pipe)
        pyr_dsi_controller_dbi_init(dsi_config, pipe);
 }
 
+static int pyr_cmd_get_panel_info(struct drm_device * dev,
+                               int pipe,
+                               struct panel_info * pi)
+{
+       if(!dev || !pi)
+               return -EINVAL;
+
+       pi->width_mm = PYR_PANEL_WIDTH;
+       pi->height_mm = PYR_PANEL_HEIGHT;
+
+       return 0;
+}
+
 /*TPO DBI encoder helper funcs*/
 static const struct drm_encoder_helper_funcs pyr_dsi_dbi_helper_funcs = {
        .dpms = pyr_dsi_dbi_dpms,
@@ -584,4 +597,5 @@ void pyr_cmd_init(struct drm_device* dev, struct 
panel_funcs* p_funcs)
        p_funcs->encoder_helper_funcs = &pyr_dsi_dbi_helper_funcs;
        p_funcs->get_config_mode = &pyr_cmd_get_config_mode;
        p_funcs->update_fb = pyr_dsi_dbi_update_fb;
+       p_funcs->get_panel_info = pyr_cmd_get_panel_info;
 }
diff --git a/drivers/staging/mrst/drv/tmd_vid.c 
b/drivers/staging/mrst/drv/tmd_vid.c
index 99fd3b7..6b85825 100644
--- a/drivers/staging/mrst/drv/tmd_vid.c
+++ b/drivers/staging/mrst/drv/tmd_vid.c
@@ -97,6 +97,19 @@ tmd_vid_get_config_mode(struct drm_device* dev)
        return mode;
 }
 
+static int tmd_vid_get_panel_info(struct drm_device * dev,
+                               int pipe,
+                               struct panel_info * pi)
+{
+       if(!dev || !pi)
+               return -EINVAL;
+
+       pi->width_mm = TMD_PANEL_WIDTH;
+       pi->height_mm = TMD_PANEL_HEIGHT;
+
+       return 0;
+}
+
 /*TPO DPI encoder helper funcs*/
 static const struct drm_encoder_helper_funcs 
mdfld_tpo_dpi_encoder_helper_funcs = {
        .dpms = mdfld_dsi_dpi_dpms,
@@ -124,4 +137,5 @@ void tmd_vid_init(struct drm_device* dev, struct 
panel_funcs* p_funcs)
        p_funcs->encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs;
        p_funcs->get_config_mode = &tmd_vid_get_config_mode;
        p_funcs->update_fb = NULL;
+       p_funcs->get_panel_info = tmd_vid_get_panel_info;
 }
diff --git a/drivers/staging/mrst/drv/tpo_cmd.c 
b/drivers/staging/mrst/drv/tpo_cmd.c
index e3218b5..ad3ac74 100644
--- a/drivers/staging/mrst/drv/tpo_cmd.c
+++ b/drivers/staging/mrst/drv/tpo_cmd.c
@@ -499,6 +499,18 @@ update_fb_out0:
        ospm_power_using_hw_end(OSPM_DISPLAY_ISLAND);
 }
 
+static int tpo_cmd_get_panel_info(struct drm_device * dev,
+                               int pipe,
+                               struct panel_info * pi)
+{
+       if(!dev || !pi)
+               return -EINVAL;
+
+       pi->width_mm = TPO_PANEL_WIDTH;
+       pi->height_mm = TPO_PANEL_HEIGHT;
+
+       return 0;
+}
 
 
 /*TPO DBI encoder helper funcs*/
@@ -521,4 +533,5 @@ void tpo_cmd_init(struct drm_device* dev, struct 
panel_funcs* p_funcs)
        p_funcs->encoder_helper_funcs = &mdfld_dsi_dbi_helper_funcs;
        p_funcs->get_config_mode = &tpo_cmd_get_config_mode;
        p_funcs->update_fb = mdfld_dsi_dbi_update_fb;
+       p_funcs->get_panel_info = tpo_cmd_get_panel_info;
 }
diff --git a/drivers/staging/mrst/drv/tpo_vid.c 
b/drivers/staging/mrst/drv/tpo_vid.c
index 960c4b2..f9631c0 100644
--- a/drivers/staging/mrst/drv/tpo_vid.c
+++ b/drivers/staging/mrst/drv/tpo_vid.c
@@ -95,6 +95,19 @@ tpo_vid_get_config_mode(struct drm_device* dev)
        return mode;
 }
 
+static int tpo_vid_get_panel_info(struct drm_device * dev,
+                               int pipe,
+                               struct panel_info * pi)
+{
+       if(!dev || !pi)
+               return -EINVAL;
+
+       pi->width_mm = TPO_PANEL_WIDTH;
+       pi->height_mm = TPO_PANEL_HEIGHT;
+
+       return 0;
+}
+
 /*TPO DPI encoder helper funcs*/
 static const struct drm_encoder_helper_funcs 
mdfld_tpo_dpi_encoder_helper_funcs = {
        .dpms = mdfld_dsi_dpi_dpms,
@@ -122,4 +135,5 @@ void tpo_vid_init(struct drm_device* dev, struct 
panel_funcs* p_funcs)
        p_funcs->encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs;
        p_funcs->get_config_mode = &tpo_vid_get_config_mode;
        p_funcs->update_fb = NULL;
+       p_funcs->get_panel_info = tpo_vid_get_panel_info;
 }
-- 
1.7.1

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

Reply via email to