platform: msm_shared: enable different panel configuration modes
Add support to specify multiple working configurations for a given
panel. Choose the default configuration through target specific oem panel
module. Add support to select non-default configuration, if supported by
given panel, through "fastboot oem select-display-panel". Add support to
convey selected lk config to kernel by modifying kernel command line.
Ex:
fastboot oem select-display-panel nt35597_wqxga_dsc_video
fastboot oem select-display-panel nt35597_wqxga_dsc_video:cfg[0..2]
fastboot oem select-display-panel nt35597_wqxga_dsc_video:cfg[0..2]#sim
fastboot oem select-display-panel nt35597_wqxga_dsc_cmd
fastboot oem select-display-panel nt35597_wqxga_dsc_cmd:cfg[0..2]
fastboot oem select-display-panel nt35597_wqxga_dsc_cmd:cfg[0..2]#sim
Change-Id: I39f4434b5d8f81229dfc95990b558efaab382c8d
diff --git a/target/msm8952/oem_panel.c b/target/msm8952/oem_panel.c
index 30a56e9..114fa41 100644
--- a/target/msm8952/oem_panel.c
+++ b/target/msm8952/oem_panel.c
@@ -38,6 +38,7 @@
#include <mdp5.h>
#include <target/display.h>
+#include "gcdb_display.h"
#include "include/panel.h"
#include "panel_display.h"
@@ -132,6 +133,7 @@
struct mdss_dsi_phy_ctrl *phy_db)
{
int pan_type = PANEL_TYPE_DSI;
+ struct oem_panel_data *oem_data = mdss_dsi_get_oem_data_ptr();
switch (panel_id) {
case TRULY_1080P_VIDEO_PANEL:
@@ -359,9 +361,27 @@
panelstruct->paneltiminginfo->tclk_post = 0x04;
panelstruct->paneltiminginfo->tclk_pre = 0x20;
pinfo->mipi.tx_eot_append = true;
+
+ panelstruct->paneldata->panel_operating_mode &= ~DUAL_PIPE_FLAG;
+ panelstruct->config = &nt35597_wqxga_dsc_video_config0;
+ if (oem_data) {
+ switch (oem_data->cfg_num[0]) {
+ case -1: /* default */
+ case 0:
+ panelstruct->config =
+ &nt35597_wqxga_dsc_video_config0;
+ break;
+ default:
+ dprintf(CRITICAL, "topology config%d not supported. fallback to default config0\n",
+ oem_data->cfg_num[0]);
+ panelstruct->config = &nt35597_wqxga_dsc_video_config0;
+ }
+ }
+ pinfo->lm_split[0] = panelstruct->config->lm_split[0];
+ pinfo->lm_split[1] = panelstruct->config->lm_split[1];
+ pinfo->num_dsc_enc = panelstruct->config->num_dsc_enc;
pinfo->compression_mode = COMPRESSION_DSC;
- memcpy(&panelstruct->dsc_paras, &nt35597_wqxga_dsc_video_paras,
- sizeof(struct dsc_parameters));
+
pinfo->dsc.parameter_calc = mdss_dsc_parameters_calc;
pinfo->dsc.dsc2buf = mdss_dsc_to_buf;
pinfo->dsc.dsi_dsc_config = mdss_dsc_dsi_config;
@@ -398,9 +418,27 @@
panelstruct->paneltiminginfo->tclk_post = 0x04;
panelstruct->paneltiminginfo->tclk_pre = 0x20;
pinfo->mipi.tx_eot_append = true;
+
+ panelstruct->paneldata->panel_operating_mode &= ~DUAL_PIPE_FLAG;
+ panelstruct->config = &nt35597_wqxga_dsc_cmd_config0;
+ if (oem_data) {
+ switch (oem_data->cfg_num[0]) {
+ case -1: /* default */
+ case 0:
+ panelstruct->config =
+ &nt35597_wqxga_dsc_cmd_config0;
+ break;
+ default:
+ dprintf(CRITICAL, "topology config%d not supported. fallback to default config0\n",
+ oem_data->cfg_num[0]);
+ panelstruct->config = &nt35597_wqxga_dsc_cmd_config0;
+ }
+ }
+ pinfo->lm_split[0] = panelstruct->config->lm_split[0];
+ pinfo->lm_split[1] = panelstruct->config->lm_split[1];
+ pinfo->num_dsc_enc = panelstruct->config->num_dsc_enc;
pinfo->compression_mode = COMPRESSION_DSC;
- memcpy(&panelstruct->dsc_paras, &nt35597_wqxga_dsc_cmd_paras,
- sizeof(struct dsc_parameters));
+
pinfo->dsc.parameter_calc = mdss_dsc_parameters_calc;
pinfo->dsc.dsc2buf = mdss_dsc_to_buf;
pinfo->dsc.dsi_dsc_config = mdss_dsc_dsi_config;
@@ -444,6 +482,11 @@
pan_type = PANEL_TYPE_UNKNOWN;
break;
}
+
+ dprintf(SPEW, "lm_split[0]=%d lm_split[1]=%d mode=0x%x\n",
+ pinfo->lm_split[0], pinfo->lm_split[1],
+ panelstruct->paneldata->panel_operating_mode);
+
return pan_type;
}
diff --git a/target/msm8996/oem_panel.c b/target/msm8996/oem_panel.c
index 1a57835..824b7a3 100644
--- a/target/msm8996/oem_panel.c
+++ b/target/msm8996/oem_panel.c
@@ -37,6 +37,7 @@
#include <qtimer.h>
#include <platform.h>
+#include "gcdb_display.h"
#include "include/panel.h"
#include "target/display.h"
#include "panel_display.h"
@@ -115,6 +116,7 @@
struct mdss_dsi_phy_ctrl *phy_db)
{
int pan_type;
+ struct oem_panel_data *oem_data = mdss_dsi_get_oem_data_ptr();
switch (panel_id) {
case SHARP_WQXGA_DUALDSI_VIDEO_PANEL:
@@ -245,9 +247,38 @@
MAX_TIMING_CONFIG * sizeof(uint32_t));
pinfo->mipi.tx_eot_append = true;
+ /*
+ * remove DUAL_PIPE_FLAG because on this target for this panel,
+ * it will be added based on one of the selected configurations.
+ */
+ panelstruct->paneldata->panel_operating_mode &= ~DUAL_PIPE_FLAG;
+ panelstruct->config = &nt35597_wqxga_dsc_video_config2;
+ if (oem_data) {
+ switch (oem_data->cfg_num[0]) {
+ case -1: /* default */
+ case 0:
+ panelstruct->config =
+ &nt35597_wqxga_dsc_video_config0;
+ break;
+ case 1:
+ panelstruct->config =
+ &nt35597_wqxga_dsc_video_config1;
+ break;
+ case 2:
+ panelstruct->config =
+ &nt35597_wqxga_dsc_video_config2;
+ break;
+ default:
+ dprintf(CRITICAL, "topology config%d not supported. fallback to default config2\n",
+ oem_data->cfg_num[0]);
+ panelstruct->config = &nt35597_wqxga_dsc_video_config2;
+ }
+ }
+ pinfo->lm_split[0] = panelstruct->config->lm_split[0];
+ pinfo->lm_split[1] = panelstruct->config->lm_split[1];
+ pinfo->num_dsc_enc = panelstruct->config->num_dsc_enc;
+
pinfo->compression_mode = COMPRESSION_DSC;
- memcpy(&panelstruct->dsc_paras, &nt35597_wqxga_dsc_video_paras,
- sizeof(struct dsc_parameters));
pinfo->dsc.parameter_calc = mdss_dsc_parameters_calc;
pinfo->dsc.dsc2buf = mdss_dsc_to_buf;
pinfo->dsc.dsi_dsc_config = mdss_dsc_dsi_config;
@@ -284,9 +315,39 @@
MAX_TIMING_CONFIG * sizeof(uint32_t));
pinfo->mipi.tx_eot_append = true;
+ /*
+ * remove DUAL_PIPE_FLAG because on this target for this panel,
+ * it will be added based on one of the selected configurations.
+ */
+ panelstruct->paneldata->panel_operating_mode &= ~DUAL_PIPE_FLAG;
+ panelstruct->config = &nt35597_wqxga_dsc_cmd_config2;
+ if (oem_data) {
+ switch (oem_data->cfg_num[0]) {
+ case 0:
+ panelstruct->config =
+ &nt35597_wqxga_dsc_cmd_config0;
+ break;
+ case 1:
+ panelstruct->config =
+ &nt35597_wqxga_dsc_cmd_config1;
+ break;
+ case -1: /* default */
+ case 2:
+ panelstruct->config =
+ &nt35597_wqxga_dsc_cmd_config2;
+ break;
+ default:
+ dprintf(CRITICAL, "topology config%d not supported. fallback to default config2\n",
+ oem_data->cfg_num[0]);
+ panelstruct->config = &nt35597_wqxga_dsc_cmd_config2;
+ }
+ }
+
+ pinfo->lm_split[0] = panelstruct->config->lm_split[0];
+ pinfo->lm_split[1] = panelstruct->config->lm_split[1];
+ pinfo->num_dsc_enc = panelstruct->config->num_dsc_enc;
+
pinfo->compression_mode = COMPRESSION_DSC;
- memcpy(&panelstruct->dsc_paras, &nt35597_wqxga_dsc_cmd_paras,
- sizeof(struct dsc_parameters));
pinfo->dsc.parameter_calc = mdss_dsc_parameters_calc;
pinfo->dsc.dsc2buf = mdss_dsc_to_buf;
pinfo->dsc.dsi_dsc_config = mdss_dsc_dsi_config;
@@ -417,6 +478,11 @@
pan_type = PANEL_TYPE_UNKNOWN;
break;
}
+
+ dprintf(SPEW, "lm_split[0]=%d lm_split[1]=%d mode=0x%x\n",
+ pinfo->lm_split[0], pinfo->lm_split[1],
+ panelstruct->paneldata->panel_operating_mode);
+
return pan_type;
}