Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9905ac9d authored by Dhaval Patel's avatar Dhaval Patel
Browse files

msm: mdss: parse dual DSI config from kernel cmd line



Update DSI panel configuration API to parse the
dual DSI configuration passed from kernel command
line.

Change-Id: I1a6f65a5ea385df46db2d81dcedc24c192ce1388
Signed-off-by: default avatarDhaval Patel <pdhaval@codeaurora.org>
parent e5421545
Loading
Loading
Loading
Loading
+30 −23
Original line number Diff line number Diff line
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -815,35 +815,39 @@ static struct device_node *mdss_dsi_pref_prim_panel(
static struct device_node *mdss_dsi_find_panel_of_node(
		struct platform_device *pdev, char *panel_cfg)
{
	int l;
	int ctrl_id = -1;
	char *panel_name;
	int len, i;
	int ctrl_id = pdev->id - 1;
	char panel_name[MDSS_MAX_PANEL_LEN];
	char ctrl_id_stream[3] =  "0:";
	char *stream = NULL, *pan = NULL;
	struct device_node *dsi_pan_node = NULL, *mdss_node = NULL;

	l = strlen(panel_cfg);
	if (!l) {
	len = strlen(panel_cfg);
	if (!len) {
		/* no panel cfg chg, parse dt */
		pr_debug("%s:%d: no cmd line cfg present\n",
			 __func__, __LINE__);
		dsi_pan_node = mdss_dsi_pref_prim_panel(pdev);
		goto end;
	} else {
		if (panel_cfg[0] == '0') {
			pr_debug("%s:%d: DSI ctrl 1\n", __func__, __LINE__);
			ctrl_id = 0;
		} else if (panel_cfg[0] == '1') {
			pr_debug("%s:%d: DSI ctrl 2\n", __func__, __LINE__);
			ctrl_id = 1;
		}
		if ((pdev->id - 1) != ctrl_id) {
			pr_err("%s:%d:pdev_ID=[%d]\n",
			       __func__, __LINE__, pdev->id);
			return NULL;
		if (ctrl_id == 1)
			strlcpy(ctrl_id_stream, "1:", 3);

		stream = strnstr(panel_cfg, ctrl_id_stream, len);
		if (!stream) {
			pr_err("controller config is not present\n");
			goto end;
		}
		/*
		 * skip first two chars '<dsi_ctrl_id>' and
		 * ':' to get to the panel name
		 */
		panel_name = panel_cfg + 2;
		stream += 2;

		pan = strnchr(stream, strlen(stream), ':');
		if (!pan) {
			strlcpy(panel_name, stream, MDSS_MAX_PANEL_LEN);
		} else {
			for (i = 0; (stream + i) < pan; i++)
				panel_name[i] = *(stream + i);
			panel_name[i] = 0;
		}

		pr_debug("%s:%d:%s:%s\n", __func__, __LINE__,
			 panel_cfg, panel_name);

@@ -860,9 +864,12 @@ static struct device_node *mdss_dsi_find_panel_of_node(
		if (!dsi_pan_node) {
			pr_err("%s: invalid pan node, selecting prim panel\n",
			       __func__);
			dsi_pan_node = mdss_dsi_pref_prim_panel(pdev);
			goto end;
		}
		return dsi_pan_node;
	}
end:
	dsi_pan_node = mdss_dsi_pref_prim_panel(pdev);

	return dsi_pan_node;
}