summaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorDominik Sliwa <dominik.sliwa@toradex.com>2018-09-06 11:17:37 +0200
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2018-09-27 18:08:45 +0200
commitba01a34d91b3cc65484edea5930ac85c5ebf524d (patch)
tree3a309ac31dc662b9b5df55b8e382ed8058ffa350 /drivers/video
parent810169d226296592ba8e7d72676c9106080ce4c4 (diff)
apalis-tk1: lvds: allow setting LVDS drive strength in dt
Hardcoded value was used before. This allows setting drive strength values in the devicetree. Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/tegra/dc/of_dc.c25
-rw-r--r--drivers/video/tegra/dc/sor.c8
-rw-r--r--drivers/video/tegra/dc/sor.h1
3 files changed, 33 insertions, 1 deletions
diff --git a/drivers/video/tegra/dc/of_dc.c b/drivers/video/tegra/dc/of_dc.c
index aed0fda91299..4e071cf9f139 100644
--- a/drivers/video/tegra/dc/of_dc.c
+++ b/drivers/video/tegra/dc/of_dc.c
@@ -246,6 +246,29 @@ parse_tmds_fail:
return -EINVAL;
}
+static u32 parse_dt_lvds_drive_strength(struct device_node *np)
+{
+ u32 temp[4];
+ u32 drive_strength = 0;
+
+ if(of_property_read_u32_array(np, "lvds-drive-strength",
+ temp, 4)) {
+ OF_DC_LOG("No lvds-drive-strength entry\n");
+ return 0;
+ }
+
+ for (int i = 0; i < 4;i++) {
+ if (temp[i] < 0x100) {
+ drive_strength += (temp[i] << i*8);
+ } else {
+ OF_DC_LOG("Invalid LVDS driver strength for lane %d\n", i);
+ return 0;
+ }
+ }
+
+ return drive_strength;
+}
+
static int parse_dt_lt(struct device_node *np,
u8 *addr)
{
@@ -1803,6 +1826,8 @@ 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);
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 5fee008d122a..f80d9e8f7ac0 100644
--- a/drivers/video/tegra/dc/sor.c
+++ b/drivers/video/tegra/dc/sor.c
@@ -1277,8 +1277,14 @@ 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);
- tegra_sor_writel(sor, NV_SOR_LANE_DRIVE_CURRENT(sor->portnum),
+ if (sor->dc->pdata->default_out->lvds_drive_strength > 0 ) {
+ tegra_sor_writel(sor, NV_SOR_LANE_DRIVE_CURRENT(sor->portnum),
+ sor->dc->pdata->default_out->lvds_drive_strength);
+ } else {
+ tegra_sor_writel(sor, NV_SOR_LANE_DRIVE_CURRENT(sor->portnum),
0x40404040);
+ }
+
if (!conforming && (sor->dc->pdata->default_out->depth == 24)) {
tegra_sor_write_field(sor, NV_SOR_LVDS,
NV_SOR_LVDS_ROTDAT_DEFAULT_MASK,
diff --git a/drivers/video/tegra/dc/sor.h b/drivers/video/tegra/dc/sor.h
index 261716950372..e7282d2fd36b 100644
--- a/drivers/video/tegra/dc/sor.h
+++ b/drivers/video/tegra/dc/sor.h
@@ -93,6 +93,7 @@ struct tegra_dc_sor_data {
u8 portnum; /* 0 or 1 */
const struct tegra_dc_dp_link_config *link_cfg;
+ u32 lvds_drive_strength;
bool power_is_up;