dev: gcdb: display: allow overriding DSI clock rate from panel header

For certain boards it may be required to fine tune the MIPI DSI clock
rates to specific frequency in order to address any EMI considerations.
To support these cases, GCDB framework allows clock rates to be
specified as part of the panel header. Modify DSI auto PLL
implementation to use these clock rates whenever they are specified.

Change-Id: Ic21aae4b2c4d89f4e5296418d2c7857d928935a6
diff --git a/dev/gcdb/display/gcdb_autopll.c b/dev/gcdb/display/gcdb_autopll.c
index 646d575..4a5ca26 100755
--- a/dev/gcdb/display/gcdb_autopll.c
+++ b/dev/gcdb/display/gcdb_autopll.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -56,16 +56,20 @@
 		pinfo->lcdc.v_front_porch + pinfo->lcdc.v_pulse_width +
 		pinfo->lcdc.yres_pad;
 
-	/* Pixel clock rate */
-	pll_data.pixel_clock = h_period * v_period * pinfo->mipi.frame_rate;
-
-	/* Store all bit clock form data */
+	/*
+	 * If a bit clock rate is not specified, calculate it based
+	 * on panel parameters
+	 */
 	if (pinfo->mipi.bitclock == 0)
-		pll_data.bit_clock = (pll_data.pixel_clock * pinfo->bpp) /
-					pinfo->mipi.num_of_lanes;
+		pll_data.bit_clock = (h_period * v_period *
+				pinfo->mipi.frame_rate * pinfo->bpp) /
+				pinfo->mipi.num_of_lanes;
 	else
 		pll_data.bit_clock = pinfo->mipi.bitclock;
 
+	pll_data.pixel_clock = (pll_data.bit_clock * pinfo->mipi.num_of_lanes) /
+				pinfo->bpp;
+
 	pll_data.byte_clock = pll_data.bit_clock >> 3;
 
 	pll_data.halfbit_clock = pll_data.bit_clock >> 1;
diff --git a/dev/gcdb/display/include/panel.h b/dev/gcdb/display/include/panel.h
index e20b76a..f015aae 100755
--- a/dev/gcdb/display/include/panel.h
+++ b/dev/gcdb/display/include/panel.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -62,6 +62,7 @@
 	uint16_t panel_type;
 	char   *panel_destination;
 	uint32_t panel_orientation;
+	/* panel_clockrate is deprecated in favor of panel_bitclock_freq */
 	uint32_t panel_clockrate;
 	uint16_t panel_framerate;
 	uint16_t panel_channelid;
diff --git a/dev/gcdb/display/panel_display.c b/dev/gcdb/display/panel_display.c
index 9ae9bf6..7b0d930 100755
--- a/dev/gcdb/display/panel_display.c
+++ b/dev/gcdb/display/panel_display.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -155,6 +155,10 @@
 		pinfo->mipi.dual_dsi = 1;
 	pinfo->mipi.mode_gpio_state = pstruct->paneldata->mode_gpio_state;
 	pinfo->mipi.bitclock = pstruct->paneldata->panel_bitclock_freq;
+	if (pinfo->mipi.bitclock) {
+		/* panel_clockrate is depcrated in favor of bitclock_freq */
+		pinfo->clk_rate = pinfo->mipi.bitclock;
+	}
 	pinfo->mipi.use_enable_gpio =
 		pstruct->paneldata->panel_with_enable_gpio;
 	ret = dsi_panel_ctl_base_setup(pinfo,