diff options
author | Min-wuk Lee <mlee@nvidia.com> | 2014-04-15 16:14:08 +0900 |
---|---|---|
committer | Seema Khowala <seemaj@nvidia.com> | 2014-04-23 14:05:06 -0700 |
commit | 2c2bf15133b73c4e7fe68764b1e6906c66331987 (patch) | |
tree | 6aa338c449b27a03eacd26dac7ed7286e917c3c3 /drivers/video | |
parent | e9b3b2f61526bc4a16f4c79d9e65dd274cc17b0a (diff) |
video: tegra: dc: nvidia,dc-connection property
nvidia,dc-connection property will indicate
if target dc device is used for internal lcd
or external display.
For internal lcd, it will get dc output type from
selected panel node among device tree multiple
panel nodes: It can be TEGRA_DC_OUT_DSI or
TEGRA_DC_OUT_DP, etc.
For external display, dc output type will be set
to TEGRA_DC_OUT_HDMI.
Bug 1371533
Change-Id: I94f7f0a2e93c5550aa2ea8f7e2069e52bdc799df
Signed-off-by: Min-wuk Lee <mlee@nvidia.com>
Reviewed-on: http://git-master/r/395028
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Animesh Kishore <ankishore@nvidia.com>
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/tegra/dc/of_dc.c | 61 |
1 files changed, 49 insertions, 12 deletions
diff --git a/drivers/video/tegra/dc/of_dc.c b/drivers/video/tegra/dc/of_dc.c index 45f45c7481a8..44bb47060da4 100644 --- a/drivers/video/tegra/dc/of_dc.c +++ b/drivers/video/tegra/dc/of_dc.c @@ -126,23 +126,60 @@ static struct tegra_dc_cmu default_cmu = { #endif #ifdef CONFIG_OF + +static int out_type_from_pn(struct device_node *panel_node) +{ + struct device_node *default_out_np = NULL; + u32 temp; + + if (panel_node && of_device_is_available(panel_node)) + default_out_np = of_get_child_by_name(panel_node, + "disp-default-out"); + if (default_out_np && !of_property_read_u32(default_out_np, + "nvidia,out-type", &temp)) { + return (int)temp; + } else + return -EINVAL; +} + static int parse_dc_out_type(struct device_node *np, struct tegra_dc_out *default_out) { - u32 temp; - if (!of_property_read_u32(np, "nvidia,out-type", &temp)) { - if (temp == TEGRA_DC_OUT_DSI) - OF_DC_LOG("dsi out type\n"); - else if (temp == TEGRA_DC_OUT_HDMI) - OF_DC_LOG("hdmi out type\n"); - else { - pr_err("Not support except dsi / hdmi type\n"); - return -EINVAL; + const char *temp_str0; + struct device_node *np_target_disps[2] = {NULL,}; + struct device_node *np_hdmi = + of_find_node_by_path(HDMI_NODE); + int out_type; + + np_target_disps[0] = tegra_panel_get_dt_node(NULL); + np_target_disps[1] = of_get_child_by_name(np_hdmi, "hdmi-display"); + + if (of_property_read_string(np, "nvidia,dc-connection", + &temp_str0)) { + pr_err("no nvidia,dc-connection\n"); + return -EINVAL; + } + + if (!strncmp(temp_str0, "internal-lcd", + strlen(temp_str0))) { + out_type = out_type_from_pn(np_target_disps[0]); + if (out_type >= 0) { + default_out->type = out_type; + return 0; } - default_out->type = (int)temp; - return 0; + } else if (!strncmp(temp_str0, "external-display", + strlen(temp_str0))) { + out_type = out_type_from_pn(np_target_disps[1]); + if (out_type >= 0) { + default_out->type = out_type; + return 0; + } + /* TODO: If hdmi/hdmi-display node is not valid, + * future SoC may need to search DP node + * for external display + */ } - /* out type should be parsed properly */ + pr_err("invalid nvidia,dc-connection or nvidia,out-type\n"); return -EINVAL; } |