From d41e30fc1d8d1e35eb3abfa0e60084cd93624735 Mon Sep 17 00:00:00 2001 From: Dominik Sliwa Date: Fri, 16 Nov 2018 16:25:42 +0100 Subject: apalis-tk1: lvds: fix dts and allow setting lane4 drive strength Previously, lvds-drive-strength was located in a wrong node and there was no control of the 5th lane. Signed-off-by: Dominik Sliwa Acked-by: Marcel Ziswiler --- drivers/video/tegra/dc/of_dc.c | 25 ++++++++++++++----------- drivers/video/tegra/dc/sor.c | 10 ++++++++-- 2 files changed, 22 insertions(+), 13 deletions(-) (limited to 'drivers') diff --git a/drivers/video/tegra/dc/of_dc.c b/drivers/video/tegra/dc/of_dc.c index 4e071cf9f139..57ebf761531d 100644 --- a/drivers/video/tegra/dc/of_dc.c +++ b/drivers/video/tegra/dc/of_dc.c @@ -144,7 +144,7 @@ static int parse_dc_out_type(struct device_node *np, struct tegra_dc_out *default_out) { int out_type; - + out_type = out_type_from_pn( of_get_child_by_name(np, "display")); if (out_type >= 0) { @@ -246,20 +246,20 @@ parse_tmds_fail: return -EINVAL; } -static u32 parse_dt_lvds_drive_strength(struct device_node *np) +static u64 parse_dt_lvds_drive_strength(struct device_node *np) { - u32 temp[4]; - u32 drive_strength = 0; + u32 temp[5]; + u64 drive_strength = 0; if(of_property_read_u32_array(np, "lvds-drive-strength", - temp, 4)) { + temp, 5)) { OF_DC_LOG("No lvds-drive-strength entry\n"); return 0; } - for (int i = 0; i < 4;i++) { + for (int i = 0; i < 5;i++) { if (temp[i] < 0x100) { - drive_strength += (temp[i] << i*8); + drive_strength += ((u64)temp[i] << i*8); } else { OF_DC_LOG("Invalid LVDS driver strength for lane %d\n", i); return 0; @@ -1732,9 +1732,9 @@ struct tegra_dc_platform_data * what out type of display is used for * current dc id. */ - + dc_connection = of_parse_phandle(np, "nvidia,dc-connection", 0); - + if (dc_connection == NULL) { pr_err("no nvidia,dc-connection\n"); goto fail_parse; @@ -1819,6 +1819,7 @@ struct tegra_dc_platform_data if (err) goto fail_parse; } else if (pdata->default_out->type == TEGRA_DC_OUT_LVDS) { + u64 lvds_ds; np_target_disp = of_get_child_by_name(dc_connection, "display"); if (!np_target_disp || @@ -1826,8 +1827,10 @@ struct tegra_dc_platform_data pr_err("lvds/display node is NOT valid\n"); goto fail_parse; } - pdata->default_out->lvds_drive_strength = - parse_dt_lvds_drive_strength(np_target_disp); + lvds_ds = parse_dt_lvds_drive_strength(np_target_disp); + pdata->default_out->lvds_lane_drive_str = lvds_ds & 0xFFFFFFFF; + pdata->default_out->lvds_lane4_drive_str = (lvds_ds >> 32) + & 0xFF; pdata->default_out->enable = dc_lvds_enable; pdata->default_out->disable = dc_lvds_disable; diff --git a/drivers/video/tegra/dc/sor.c b/drivers/video/tegra/dc/sor.c index f80d9e8f7ac0..77cbcbd72441 100644 --- a/drivers/video/tegra/dc/sor.c +++ b/drivers/video/tegra/dc/sor.c @@ -1277,9 +1277,9 @@ void tegra_dc_sor_enable_lvds(struct tegra_dc_sor_data *sor, reg_val |= (NV_SOR_LVDS_PD_TXDA_3_DISABLE); tegra_sor_writel(sor, NV_SOR_LVDS, reg_val); - if (sor->dc->pdata->default_out->lvds_drive_strength > 0 ) { + if (sor->dc->pdata->default_out->lvds_lane_drive_str > 0 ) { tegra_sor_writel(sor, NV_SOR_LANE_DRIVE_CURRENT(sor->portnum), - sor->dc->pdata->default_out->lvds_drive_strength); + sor->dc->pdata->default_out->lvds_lane_drive_str); } else { tegra_sor_writel(sor, NV_SOR_LANE_DRIVE_CURRENT(sor->portnum), 0x40404040); @@ -1292,8 +1292,14 @@ void tegra_dc_sor_enable_lvds(struct tegra_dc_sor_data *sor, TEGRA_DC_LVDS_24_1 ? 6 << NV_SOR_LVDS_ROTDAT_SHIFT: 0 << NV_SOR_LVDS_ROTDAT_SHIFT); + if (sor->dc->pdata->default_out->lvds_lane4_drive_str > 0 ) { + tegra_sor_writel(sor, + NV_SOR_LANE4_DRIVE_CURRENT(sor->portnum), + sor->dc->pdata->default_out->lvds_lane4_drive_str); + } else { tegra_sor_writel(sor, NV_SOR_LANE4_DRIVE_CURRENT(sor->portnum), 0x40); + } } #if 0 -- cgit v1.2.3