summaryrefslogtreecommitdiffstats
path: root/drivers/video/tegra/dc/dp.c
diff options
context:
space:
mode:
authorVinod G <vinodg@nvidia.com>2015-02-06 20:52:05 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2015-04-04 21:05:59 -0400
commit154d712756d1da6dba5098174a33bebae31a789e (patch)
tree4909d073d9800acb71ec59642c9d22e2e4314a53 /drivers/video/tegra/dc/dp.c
parente218f24e0a890d07db5f7a52554b5891f2f0600e (diff)
kernel: video: dc: dp fixes for nvdisp
Fix Dp to work for single channel. Correction for dp to work with unitfpga. Change-Id: I656dd39cf37a3aa6f2a997f07f82efff80228e38 Signed-off-by: Vinod G <vinodg@nvidia.com> Reviewed-on: http://git-master/r/682174 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Jon Mayo <jmayo@nvidia.com>
Diffstat (limited to 'drivers/video/tegra/dc/dp.c')
-rw-r--r--drivers/video/tegra/dc/dp.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/drivers/video/tegra/dc/dp.c b/drivers/video/tegra/dc/dp.c
index 75c6dc770..a3ca11737 100644
--- a/drivers/video/tegra/dc/dp.c
+++ b/drivers/video/tegra/dc/dp.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * drivers/video/tegra/dc/dp.c 2 * drivers/video/tegra/dc/dp.c
3 * 3 *
4 * Copyright (c) 2011-2014, NVIDIA CORPORATION, All rights reserved. 4 * Copyright (c) 2011-2015, NVIDIA CORPORATION, All rights reserved.
5 * 5 *
6 * This software is licensed under the terms of the GNU General Public 6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 7 * License version 2, as published by the Free Software Foundation, and
@@ -456,7 +456,7 @@ static int tegra_dc_dpaux_read_chunk_locked(struct tegra_dc_dp_data *dp,
456 *aux_stat = tegra_dpaux_readl(dp, DPAUX_DP_AUXSTAT); 456 *aux_stat = tegra_dpaux_readl(dp, DPAUX_DP_AUXSTAT);
457 457
458 /* Ignore I2C errors on fpga */ 458 /* Ignore I2C errors on fpga */
459 if (tegra_platform_is_fpga()) 459 if (!tegra_platform_is_silicon())
460 *aux_stat &= ~DPAUX_DP_AUXSTAT_REPLYTYPE_I2CNACK; 460 *aux_stat &= ~DPAUX_DP_AUXSTAT_REPLYTYPE_I2CNACK;
461 461
462 if ((*aux_stat & DPAUX_DP_AUXSTAT_TIMEOUT_ERROR_PENDING) || 462 if ((*aux_stat & DPAUX_DP_AUXSTAT_TIMEOUT_ERROR_PENDING) ||
@@ -1811,7 +1811,7 @@ static int tegra_dp_hpd_plug(struct tegra_dc_dp_data *dp)
1811 1811
1812 might_sleep(); 1812 might_sleep();
1813 1813
1814 if (tegra_platform_is_fpga()) { 1814 if (!tegra_platform_is_silicon()) {
1815 msleep(TEGRA_DP_HPD_PLUG_TIMEOUT_MS); 1815 msleep(TEGRA_DP_HPD_PLUG_TIMEOUT_MS);
1816 return 0; 1816 return 0;
1817 } 1817 }
@@ -1871,6 +1871,9 @@ static void tegra_dp_lt_config(struct tegra_dc_dp_data *dp,
1871 u32 cnt; 1871 u32 cnt;
1872 u32 val; 1872 u32 val;
1873 1873
1874 /* support for 1 lane */
1875 u32 loopcnt = (n_lanes == 1) ? 1 : n_lanes >> 1;
1876
1874 for (cnt = 0; cnt < n_lanes; cnt++) { 1877 for (cnt = 0; cnt < n_lanes; cnt++) {
1875 u32 mask = 0; 1878 u32 mask = 0;
1876 u32 pe_reg, vs_reg, pc_reg; 1879 u32 pe_reg, vs_reg, pc_reg;
@@ -1938,7 +1941,7 @@ static void tegra_dp_lt_config(struct tegra_dc_dp_data *dp,
1938 (NV_DPCD_TRAINING_LANE0_SET + cnt), val); 1941 (NV_DPCD_TRAINING_LANE0_SET + cnt), val);
1939 } 1942 }
1940 if (pc_supported) { 1943 if (pc_supported) {
1941 for (cnt = 0; cnt < n_lanes / 2; cnt++) { 1944 for (cnt = 0; cnt < loopcnt; cnt++) {
1942 u32 max_pc_flag0 = tegra_dp_is_max_pc(pc[cnt]); 1945 u32 max_pc_flag0 = tegra_dp_is_max_pc(pc[cnt]);
1943 u32 max_pc_flag1 = tegra_dp_is_max_pc(pc[cnt + 1]); 1946 u32 max_pc_flag1 = tegra_dp_is_max_pc(pc[cnt + 1]);
1944 val = (pc[cnt] << NV_DPCD_LANEX_SET2_PC2_SHIFT) | 1947 val = (pc[cnt] << NV_DPCD_LANEX_SET2_PC2_SHIFT) |
@@ -1962,7 +1965,10 @@ static bool tegra_dp_clock_recovery_status(struct tegra_dc_dp_data *dp)
1962 u32 n_lanes = dp->link_cfg.lane_count; 1965 u32 n_lanes = dp->link_cfg.lane_count;
1963 u8 data_ptr; 1966 u8 data_ptr;
1964 1967
1965 for (cnt = 0; cnt < n_lanes / 2; cnt++) { 1968 /* support for 1 lane */
1969 u32 loopcnt = (n_lanes == 1) ? 1 : n_lanes >> 1;
1970
1971 for (cnt = 0; cnt < loopcnt; cnt++) {
1966 tegra_dc_dp_dpcd_read(dp, 1972 tegra_dc_dp_dpcd_read(dp,
1967 (NV_DPCD_LANE0_1_STATUS + cnt), &data_ptr); 1973 (NV_DPCD_LANE0_1_STATUS + cnt), &data_ptr);
1968 1974
@@ -1981,11 +1987,14 @@ static void tegra_dp_lt_adjust(struct tegra_dc_dp_data *dp,
1981 u32 pe[4], u32 vs[4], u32 pc[4], 1987 u32 pe[4], u32 vs[4], u32 pc[4],
1982 bool pc_supported) 1988 bool pc_supported)
1983{ 1989{
1984 size_t cnt; 1990 u32 cnt;
1985 u8 data_ptr; 1991 u8 data_ptr;
1986 u32 n_lanes = dp->link_cfg.lane_count; 1992 u32 n_lanes = dp->link_cfg.lane_count;
1987 1993
1988 for (cnt = 0; cnt < n_lanes / 2; cnt++) { 1994 /* support for 1 lane */
1995 u32 loopcnt = (n_lanes == 1) ? 1 : n_lanes >> 1;
1996
1997 for (cnt = 0; cnt < loopcnt; cnt++) {
1989 tegra_dc_dp_dpcd_read(dp, 1998 tegra_dc_dp_dpcd_read(dp,
1990 (NV_DPCD_LANE0_1_ADJUST_REQ + cnt), &data_ptr); 1999 (NV_DPCD_LANE0_1_ADJUST_REQ + cnt), &data_ptr);
1991 pe[2 * cnt] = (data_ptr & NV_DPCD_ADJUST_REQ_LANEX_PE_MASK) >> 2000 pe[2 * cnt] = (data_ptr & NV_DPCD_ADJUST_REQ_LANEX_PE_MASK) >>
@@ -2061,7 +2070,10 @@ static bool tegra_dp_channel_eq_status(struct tegra_dc_dp_data *dp)
2061 u8 data_ptr; 2070 u8 data_ptr;
2062 bool ce_done = true; 2071 bool ce_done = true;
2063 2072
2064 for (cnt = 0; cnt < n_lanes / 2; cnt++) { 2073 /* support for 1 lane */
2074 u32 loopcnt = (n_lanes == 1) ? 1 : n_lanes >> 1;
2075
2076 for (cnt = 0; cnt < loopcnt; cnt++) {
2065 tegra_dc_dp_dpcd_read(dp, 2077 tegra_dc_dp_dpcd_read(dp,
2066 (NV_DPCD_LANE0_1_STATUS + cnt), &data_ptr); 2078 (NV_DPCD_LANE0_1_STATUS + cnt), &data_ptr);
2067 2079
@@ -2417,7 +2429,8 @@ static void tegra_dc_dp_enable(struct tegra_dc *dc)
2417 } 2429 }
2418 2430
2419 if (dp->dp_edid && !dp->dp_edid->data && 2431 if (dp->dp_edid && !dp->dp_edid->data &&
2420 (dp->dc->out->type != TEGRA_DC_OUT_FAKE_DP)) 2432 (dp->dc->out->type != TEGRA_DC_OUT_FAKE_DP) &&
2433 !tegra_platform_is_linsim())
2421 tegra_dp_edid(dp); 2434 tegra_dp_edid(dp);
2422 2435
2423 tegra_dp_dpcd_init(dp); 2436 tegra_dp_dpcd_init(dp);
@@ -2527,7 +2540,7 @@ static long tegra_dc_dp_setup_clk(struct tegra_dc *dc, struct clk *clk)
2527 struct tegra_dc_dp_data *dp = tegra_dc_get_outdata(dc); 2540 struct tegra_dc_dp_data *dp = tegra_dc_get_outdata(dc);
2528 struct clk *dc_parent_clk; 2541 struct clk *dc_parent_clk;
2529 2542
2530 if (tegra_platform_is_fpga()) 2543 if (!tegra_platform_is_silicon())
2531 return tegra_dc_pclk_round_rate(dc, dc->mode.pclk); 2544 return tegra_dc_pclk_round_rate(dc, dc->mode.pclk);
2532 2545
2533 if (clk == dc->clk) { 2546 if (clk == dc->clk) {
@@ -2550,7 +2563,8 @@ static bool tegra_dc_dp_detect(struct tegra_dc *dc)
2550 struct tegra_dc_dp_data *dp = tegra_dc_get_outdata(dc); 2563 struct tegra_dc_dp_data *dp = tegra_dc_get_outdata(dc);
2551 u32 rd; 2564 u32 rd;
2552 2565
2553 if (dp->dc->out->type == TEGRA_DC_OUT_FAKE_DP) 2566 if (dp->dc->out->type == TEGRA_DC_OUT_FAKE_DP ||
2567 tegra_platform_is_linsim())
2554 return true; 2568 return true;
2555 2569
2556 tegra_dc_io_start(dc); 2570 tegra_dc_io_start(dc);
@@ -2575,7 +2589,8 @@ static void tegra_dc_dp_modeset_notifier(struct tegra_dc *dc)
2575 tegra_dc_sor_modeset_notifier(dp->sor, false); 2589 tegra_dc_sor_modeset_notifier(dp->sor, false);
2576 /* Pixel clock may be changed in new mode, 2590 /* Pixel clock may be changed in new mode,
2577 * recalculate link config */ 2591 * recalculate link config */
2578 tegra_dc_dp_calc_config(dp, dp->mode, &dp->link_cfg); 2592 if (!tegra_platform_is_linsim())
2593 tegra_dc_dp_calc_config(dp, dp->mode, &dp->link_cfg);
2579 2594
2580 2595
2581 tegra_dpaux_clk_disable(dp); 2596 tegra_dpaux_clk_disable(dp);