[Meego-kernel] [PATCH 02/26] GFX: Added command line option to control LABC.

hitesh.k.patel at intel.com hitesh.k.patel at intel.com
Wed Nov 24 19:59:16 PST 2010


From: Jim Liu <jim.liu at intel.com>

If MIPI panel has LABC feature it can be enabled by Command line
parameter.

Signed-off-by: Jim Liu <jim.liu at intel.com>
Signed-off-by: Hitesh K. Patel <hitesh.k.patel at intel.com>
---
 drivers/staging/mrst/drv/mdfld_dsi_output.c |   44 ++++++++++++++++++++++-----
 drivers/staging/mrst/drv/psb_drv.h          |    1 +
 2 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/mrst/drv/mdfld_dsi_output.c b/drivers/staging/mrst/drv/mdfld_dsi_output.c
index 31ab4f6..033be2f 100644
--- a/drivers/staging/mrst/drv/mdfld_dsi_output.c
+++ b/drivers/staging/mrst/drv/mdfld_dsi_output.c
@@ -34,15 +34,17 @@
 
 /* get the CABC LABC from command line. */
 static int CABC_control = 1;
+static int LABC_control = 1;
 
 #ifdef MODULE
 module_param (CABC_control, int, 0644);
+module_param (LABC_control, int, 0644);
 #else
 static int __init parse_CABC_control(char *arg)
 {
 	/* CABC control can be passed in as a cmdline parameter */
-	/* to enable this feature add cabc=1 to cmdline */
-	/* to disable this feature add cabc=0 to cmdline */
+	/* to enable this feature add CABC=1 to cmdline */
+	/* to disable this feature add CABC=0 to cmdline */
 	if (!arg)
 		return -EINVAL;
 
@@ -54,6 +56,23 @@ static int __init parse_CABC_control(char *arg)
 	return 0;
 }
 early_param ("CABC", parse_CABC_control);
+
+static int __init parse_LABC_control(char *arg)
+{
+	/* LABC control can be passed in as a cmdline parameter */
+	/* to enable this feature add LABC=1 to cmdline */
+	/* to disable this feature add LABC=0 to cmdline */
+	if (!arg)
+		return -EINVAL;
+
+	if (!strcasecmp(arg, "0"))
+		LABC_control = 0;
+	else if (!strcasecmp (arg, "1"))
+		LABC_control = 1;
+
+	return 0;
+}
+early_param ("LABC", parse_LABC_control);
 #endif
 
 /**
@@ -251,7 +270,8 @@ void mdfld_dsi_gen_fifo_ready (struct drm_device *dev, u32 gen_fifo_stat_reg, u3
  */
 void mdfld_dsi_brightness_init (struct mdfld_dsi_config * dsi_config, int pipe)
 {
-	struct drm_device * dev;
+	struct drm_device * dev = dsi_config->dev;
+	DRM_DRIVER_PRIVATE_T *dev_priv = dev->dev_private;
 	u32 hs_gen_ctrl_reg = MIPIA_HS_GEN_CTRL_REG;
 	u32 gen_fifo_stat_reg = MIPIA_GEN_FIFO_STAT_REG;
 	u32 gen_ctrl_val = 0;
@@ -264,7 +284,6 @@ void mdfld_dsi_brightness_init (struct mdfld_dsi_config * dsi_config, int pipe)
 	
 	PSB_DEBUG_ENTRY("pipe = %d.  \n", pipe);
 
-	dev = dsi_config->dev;
 	dcsChannelNumber = dsi_config->channel_num;
 
 	if (pipe == 2) {
@@ -302,9 +321,18 @@ void mdfld_dsi_brightness_init (struct mdfld_dsi_config * dsi_config, int pipe)
 	mdfld_dsi_gen_fifo_ready (dev, gen_fifo_stat_reg, HS_CTRL_FIFO_EMPTY | HS_DATA_FIFO_EMPTY);
 	mdfld_dsi_write_gamma_setting (dsi_config, pipe);
 
-	/* Enable LABC */
+	/* Enable backlight or/and LABC */
 	mdfld_dsi_gen_fifo_ready (dev, gen_fifo_stat_reg, HS_CTRL_FIFO_EMPTY | HS_DATA_FIFO_EMPTY);
-	gen_ctrl_val = BRIGHT_CNTL_BLOCK_ON | AMBIENT_LIGHT_SENSE_ON | DISPLAY_DIMMING_ON| BACKLIGHT_ON | DISPLAY_BRIGHTNESS_AUTO | GAMMA_AUTO;
+	gen_ctrl_val = BRIGHT_CNTL_BLOCK_ON | DISPLAY_DIMMING_ON| BACKLIGHT_ON;
+
+	if (LABC_control == 1 || CABC_control == 1)
+		gen_ctrl_val |= DISPLAY_DIMMING_ON| DISPLAY_BRIGHTNESS_AUTO | GAMMA_AUTO;
+
+	if (LABC_control == 1)
+		gen_ctrl_val |= AMBIENT_LIGHT_SENSE_ON;
+
+	dev_priv->mipi_ctrl_display = gen_ctrl_val;
+
 	gen_ctrl_val <<= MCS_PARAMETER_POS;
 	gen_ctrl_val |= write_ctrl_display << MCS_COMMANDS_POS;
 	gen_ctrl_val |= dcsChannelNumber << DCS_CHANNEL_NUMBER_POS;
@@ -355,13 +383,13 @@ void mdfld_dsi_brightness_control (struct drm_device *dev, int pipe, int level)
 	mdfld_dsi_gen_fifo_ready (dev, gen_fifo_stat_reg, HS_CTRL_FIFO_EMPTY | HS_DATA_FIFO_EMPTY);
 	REG_WRITE(hs_gen_ctrl_reg, gen_ctrl_val);
 
-	/* Enable LABC */
+	/* Enable backlight control */
 	mdfld_dsi_gen_fifo_ready (dev, gen_fifo_stat_reg, HS_CTRL_FIFO_EMPTY | HS_DATA_FIFO_EMPTY);
 
 	if (level == 0)
 		gen_ctrl_val = 0;
 	else 
-		gen_ctrl_val = BRIGHT_CNTL_BLOCK_ON | AMBIENT_LIGHT_SENSE_ON | DISPLAY_DIMMING_ON| BACKLIGHT_ON | DISPLAY_BRIGHTNESS_AUTO | GAMMA_AUTO;
+		gen_ctrl_val = dev_priv->mipi_ctrl_display;
 
 	gen_ctrl_val <<= MCS_PARAMETER_POS;
 	gen_ctrl_val |= write_ctrl_display << MCS_COMMANDS_POS;
diff --git a/drivers/staging/mrst/drv/psb_drv.h b/drivers/staging/mrst/drv/psb_drv.h
index 72aec16..44d2cee 100644
--- a/drivers/staging/mrst/drv/psb_drv.h
+++ b/drivers/staging/mrst/drv/psb_drv.h
@@ -585,6 +585,7 @@ struct drm_psb_private {
 	bool dual_mipi;
 	uint32_t ksel;
 	uint32_t mipi_lane_config;
+	uint32_t mipi_ctrl_display;
 	/*
 	 *MRST DSI info
 	 */
-- 
1.7.1



More information about the MeeGo-kernel mailing list