msm: mdss: primary panel config from boot param
Add ability to read kernel's boot parameters to
check for primary panel interface and panel
configuration. The parameter passes three
fields of information which are parsed by the MDP
driver as a part of the device probe.
Format for cmdline param expected is:
"mdss_mdp.panel=<lk_cfg>:<pan_intf>:<dt_node_name_panel>"
where <lk_cfg> is "1" - lk/gcdb config or "0" non-lk/non-gcdb
config;
<pan_intf> is one of "dsi:<ctrl_id>", "hdmi", "edp";
and <dt_node_name_panel> is the string identical to panel's
device node name from the DT.
Change-Id: Ib9e7e4b69c62537f551aaf9ccaf0dd69eddd6889
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
diff --git a/Documentation/devicetree/bindings/fb/mdss-dsi-ctrl.txt b/Documentation/devicetree/bindings/fb/mdss-dsi-ctrl.txt
index 075ee86..81dd825 100644
--- a/Documentation/devicetree/bindings/fb/mdss-dsi-ctrl.txt
+++ b/Documentation/devicetree/bindings/fb/mdss-dsi-ctrl.txt
@@ -12,6 +12,7 @@
- vdda-supply: Phandle for vreg regulator device node.
- qcom,mdss-fb-map: pHandle that specifies the framebuffer to which the
interface is mapped.
+- qcom,mdss-mdp: pHandle that specifies the mdss-mdp device.
- qcom,platform-regulator-settings: An array of length 7 that specifies the PHY
regulator settings.
- qcom,platform-strength-ctrl: An array of length 2 that specifies the PHY
@@ -69,6 +70,7 @@
00 00 00 00 0f 00 00 01 97
00 c0 00 00 00 00 00 01 bb];
qcom,mdss-fb-map = <&mdss_fb0>;
+ qcom,mdss-mdp = <&mdss_mdp>;
qcom,platform-reset-gpio = <&msmgpio 25 1>;
qcom,platform-te-gpio = <&msmgpio 24 0>;
qcom,platform-enable-gpio = <&msmgpio 58 1>;
diff --git a/Documentation/devicetree/bindings/fb/mdss-mdp.txt b/Documentation/devicetree/bindings/fb/mdss-mdp.txt
index 2ed4172..829cce2 100644
--- a/Documentation/devicetree/bindings/fb/mdss-mdp.txt
+++ b/Documentation/devicetree/bindings/fb/mdss-mdp.txt
@@ -165,7 +165,7 @@
size is greater than max mixer width.
Example:
- qcom,mdss_mdp@fd900000 {
+ mdss_mdp: qcom,mdss_mdp@fd900000 {
compatible = "qcom,mdss_mdp";
reg = <0xfd900000 0x22100>,
<0xfd924000 0x1000>;
diff --git a/arch/arm/boot/dts/msm8226-mdss.dtsi b/arch/arm/boot/dts/msm8226-mdss.dtsi
index 8852a8d..fac3b83 100644
--- a/arch/arm/boot/dts/msm8226-mdss.dtsi
+++ b/arch/arm/boot/dts/msm8226-mdss.dtsi
@@ -11,7 +11,7 @@
*/
&soc {
- qcom,mdss_mdp@fd900000 {
+ mdss_mdp: qcom,mdss_mdp@fd900000 {
compatible = "qcom,mdss_mdp";
reg = <0xfd900000 0x22100>,
<0xfd924000 0x1000>;
@@ -63,6 +63,7 @@
cell-index = <0>;
reg = <0xfd922800 0x600>;
qcom,mdss-fb-map = <&mdss_fb0>;
+ qcom,mdss-mdp = <&mdss_mdp>;
vdd-supply = <&pm8226_l15>;
vddio-supply = <&pm8226_l8>;
vdda-supply = <&pm8226_l4>;
diff --git a/arch/arm/boot/dts/msm8974-mdss.dtsi b/arch/arm/boot/dts/msm8974-mdss.dtsi
index b615ebe..2328f44 100644
--- a/arch/arm/boot/dts/msm8974-mdss.dtsi
+++ b/arch/arm/boot/dts/msm8974-mdss.dtsi
@@ -86,6 +86,7 @@
vddio-supply = <&pm8941_l12>;
vdda-supply = <&pm8941_l2>;
qcom,mdss-fb-map = <&mdss_fb0>;
+ qcom,mdss-mdp = <&mdss_mdp>;
qcom,platform-reset-gpio = <&pm8941_gpios 19 1>;
qcom,platform-enable-gpio = <&msmgpio 58 1>;
qcom,platform-reset-sequence = <1 20 0 200 1 20 2>;
@@ -141,6 +142,7 @@
vddio-supply = <&pm8941_l12>;
vdda-supply = <&pm8941_l2>;
qcom,mdss-fb-map = <&mdss_fb0>;
+ qcom,mdss-mdp = <&mdss_mdp>;
};
mdss_hdmi_tx: qcom,hdmi_tx@fd922100 {
diff --git a/drivers/video/msm/mdss/mdss_dsi.c b/drivers/video/msm/mdss/mdss_dsi.c
index 71a11de..c6b0cfd 100644
--- a/drivers/video/msm/mdss/mdss_dsi.c
+++ b/drivers/video/msm/mdss/mdss_dsi.c
@@ -841,6 +841,8 @@
goto error_pan_node;
}
+ cmd_cfg_cont_splash = mdss_panel_get_boot_cfg() ? true : false;
+
rc = mdss_dsi_panel_init(dsi_pan_node, &vendor_pdata);
if (rc) {
pr_err("%s: dsi panel init failed\n", __func__);
@@ -855,7 +857,6 @@
}
pr_debug("%s: Dsi Ctrl->%d initialized\n", __func__, index);
-
return 0;
error_pan_node:
diff --git a/drivers/video/msm/mdss/mdss_dsi_panel.c b/drivers/video/msm/mdss/mdss_dsi_panel.c
index 05fca63..36428d4 100644
--- a/drivers/video/msm/mdss/mdss_dsi_panel.c
+++ b/drivers/video/msm/mdss/mdss_dsi_panel.c
@@ -788,8 +788,10 @@
pr_info("%s: Panel Name = %s\n", __func__, panel_name);
rc = mdss_panel_parse_dt(node, vendor_pdata);
- if (rc)
+ if (rc) {
+ pr_err("%s:%d panel dt parse failed\n", __func__, __LINE__);
return rc;
+ }
vendor_pdata->on = mdss_dsi_panel_on;
vendor_pdata->off = mdss_dsi_panel_off;
diff --git a/drivers/video/msm/mdss/mdss_mdp.c b/drivers/video/msm/mdss/mdss_mdp.c
index 4828644..86a2e45 100644
--- a/drivers/video/msm/mdss/mdss_mdp.c
+++ b/drivers/video/msm/mdss/mdss_mdp.c
@@ -1109,7 +1109,6 @@
mdss_mdp_pp_term(&pdev->dev);
}
- mdata->pan_cfg.init_done = true;
return rc;
}
@@ -1187,6 +1186,52 @@
return rc;
}
+static int mdss_mdp_get_pan_cfg(struct mdss_panel_cfg *pan_cfg)
+{
+ char *t = NULL;
+ char pan_intf_str[MDSS_MAX_PANEL_LEN];
+ int rc, i;
+ char pan_name[MDSS_MAX_PANEL_LEN];
+
+ if (!pan_cfg)
+ return -EINVAL;
+
+ strlcpy(pan_name, &pan_cfg->arg_cfg[0], sizeof(pan_cfg->arg_cfg));
+ if (pan_name[0] == '0') {
+ pan_cfg->lk_cfg = false;
+ } else if (pan_name[0] == '1') {
+ pan_cfg->lk_cfg = true;
+ } else {
+ /* read from dt */
+ pan_cfg->lk_cfg = true;
+ pan_cfg->pan_intf = MDSS_PANEL_INTF_INVALID;
+ return -EINVAL;
+ }
+
+ /* skip lk cfg and delimiter; ex: "0:" */
+ strlcpy(pan_name, &pan_name[2], MDSS_MAX_PANEL_LEN);
+ t = strnstr(pan_name, ":", MDSS_MAX_PANEL_LEN);
+ if (!t) {
+ pr_err("%s: pan_name=[%s] invalid\n",
+ __func__, pan_name);
+ pan_cfg->pan_intf = MDSS_PANEL_INTF_INVALID;
+ return -EINVAL;
+ }
+
+ for (i = 0; ((pan_name + i) < t) && (i < 4); i++)
+ pan_intf_str[i] = *(pan_name + i);
+ pan_intf_str[i] = 0;
+ pr_debug("%s:%d panel intf %s\n", __func__, __LINE__, pan_intf_str);
+ /* point to the start of panel name */
+ t = t + 1;
+ strlcpy(&pan_cfg->arg_cfg[0], t, sizeof(pan_cfg->arg_cfg));
+ pr_debug("%s:%d: t=[%s] panel name=[%s]\n", __func__, __LINE__,
+ t, pan_cfg->arg_cfg);
+ rc = mdss_mdp_get_pan_intf(pan_intf_str);
+ pan_cfg->pan_intf = (rc < 0) ? MDSS_PANEL_INTF_INVALID : rc;
+ return 0;
+}
+
static int mdss_mdp_parse_dt_pan_intf(struct platform_device *pdev)
{
int rc;
@@ -1208,6 +1253,102 @@
return rc;
}
+static int mdss_mdp_parse_bootarg(struct platform_device *pdev)
+{
+ struct device_node *chosen_node;
+ static const char *cmd_line;
+ char *disp_idx, *end_idx;
+ int rc, len = 0, name_len, cmd_len;
+ int *intf_type;
+ char *panel_name;
+ struct mdss_panel_cfg *pan_cfg;
+ struct mdss_data_type *mdata = platform_get_drvdata(pdev);
+
+ mdata->pan_cfg.arg_cfg[MDSS_MAX_PANEL_LEN] = 0;
+ pan_cfg = &mdata->pan_cfg;
+ panel_name = &pan_cfg->arg_cfg[0];
+ intf_type = &pan_cfg->pan_intf;
+
+ /* reads from dt by default */
+ pan_cfg->lk_cfg = true;
+
+ chosen_node = of_find_node_by_name(NULL, "chosen");
+ if (!chosen_node) {
+ pr_err("%s: get chosen node failed\n", __func__);
+ rc = -ENODEV;
+ goto get_dt_pan;
+ }
+
+ cmd_line = of_get_property(chosen_node, "bootargs", &len);
+ if (!cmd_line || len <= 0) {
+ pr_err("%s: get bootargs failed\n", __func__);
+ rc = -ENODEV;
+ goto get_dt_pan;
+ }
+
+ name_len = strlen("mdss_mdp.panel=");
+ cmd_len = strlen(cmd_line);
+ disp_idx = strnstr(cmd_line, "mdss_mdp.panel=", cmd_len);
+ if (!disp_idx) {
+ pr_err("%s:%d:cmdline panel not set disp_idx=[%p]\n",
+ __func__, __LINE__, disp_idx);
+ memset(panel_name, 0x00, MDSS_MAX_PANEL_LEN);
+ *intf_type = MDSS_PANEL_INTF_INVALID;
+ rc = MDSS_PANEL_INTF_INVALID;
+ goto get_dt_pan;
+ }
+
+ disp_idx += name_len;
+
+ end_idx = strnstr(disp_idx, " ", MDSS_MAX_PANEL_LEN);
+ pr_debug("%s:%d: pan_name=[%s] end=[%s]\n", __func__, __LINE__,
+ disp_idx, end_idx);
+ if (!end_idx) {
+ end_idx = disp_idx + strlen(disp_idx) + 1;
+ pr_warn("%s:%d: pan_name=[%s] end=[%s]\n", __func__,
+ __LINE__, disp_idx, end_idx);
+ }
+
+ if (end_idx <= disp_idx) {
+ pr_err("%s:%d:cmdline pan incorrect end=[%p] disp=[%p]\n",
+ __func__, __LINE__, end_idx, disp_idx);
+ memset(panel_name, 0x00, MDSS_MAX_PANEL_LEN);
+ *intf_type = MDSS_PANEL_INTF_INVALID;
+ rc = MDSS_PANEL_INTF_INVALID;
+ goto get_dt_pan;
+ }
+
+ *end_idx = 0;
+ len = end_idx - disp_idx + 1;
+ if (len <= 0) {
+ pr_warn("%s: panel name not rx", __func__);
+ rc = -EINVAL;
+ goto get_dt_pan;
+ }
+
+ strlcpy(panel_name, disp_idx, min(++len, MDSS_MAX_PANEL_LEN));
+ pr_debug("%s:%d panel:[%s]", __func__, __LINE__, panel_name);
+ of_node_put(chosen_node);
+
+ rc = mdss_mdp_get_pan_cfg(pan_cfg);
+ if (!rc)
+ pan_cfg->init_done = true;
+
+ return rc;
+
+get_dt_pan:
+ rc = mdss_mdp_parse_dt_pan_intf(pdev);
+ /* if pref pan intf is not present */
+ if (rc)
+ pr_err("%s:unable to parse device tree for pan intf\n",
+ __func__);
+ else
+ pan_cfg->init_done = true;
+
+ of_node_put(chosen_node);
+ return rc;
+}
+
static int mdss_mdp_parse_dt(struct platform_device *pdev)
{
int rc;
@@ -1260,10 +1401,12 @@
return rc;
}
- rc = mdss_mdp_parse_dt_pan_intf(pdev);
- /* if pref pan intf is not present */
- if (rc)
- pr_warn("Error in device tree : pan_intf\n");
+ rc = mdss_mdp_parse_bootarg(pdev);
+ if (rc) {
+ pr_err("%s: Error in panel override:rc=[%d]\n",
+ __func__, rc);
+ return rc;
+ }
return 0;
}
@@ -1772,6 +1915,19 @@
}
EXPORT_SYMBOL(mdss_panel_intf_type);
+int mdss_panel_get_boot_cfg(void)
+{
+ int rc;
+
+ if (!mdss_res || !mdss_res->pan_cfg.init_done)
+ rc = -EPROBE_DEFER;
+ if (mdss_res->pan_cfg.lk_cfg)
+ rc = 1;
+ else
+ rc = 0;
+ return rc;
+}
+
static void mdss_mdp_footswitch_ctrl(struct mdss_data_type *mdata, int on)
{
if (!mdata->fs)
diff --git a/drivers/video/msm/mdss/mdss_panel.h b/drivers/video/msm/mdss/mdss_panel.h
index d16a286..833bf14 100644
--- a/drivers/video/msm/mdss/mdss_panel.h
+++ b/drivers/video/msm/mdss/mdss_panel.h
@@ -366,6 +366,16 @@
struct mdss_panel_cfg *mdss_panel_intf_type(int intf_val);
/**
+ * mdss_panel_get_boot_cfg() - checks if bootloader config present
+ *
+ * Function returns true if bootloader has configured the parameters
+ * for primary controller and panel config data.
+ *
+ * returns true if bootloader configured, else false
+ */
+int mdss_panel_get_boot_cfg(void);
+
+/**
* mdss_is_ready() - checks if mdss is probed and ready
*
* Checks if mdss resources have been initialized