summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/video/tegra/dc/dc.c5
-rw-r--r--drivers/video/tegra/dc/dp.c39
-rw-r--r--drivers/video/tegra/dc/dp.h5
-rw-r--r--drivers/video/tegra/dc/sor.c7
4 files changed, 35 insertions, 21 deletions
diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c
index 926b404ef..72aeb91b7 100644
--- a/drivers/video/tegra/dc/dc.c
+++ b/drivers/video/tegra/dc/dc.c
@@ -4185,8 +4185,9 @@ static int tegra_dc_probe(struct platform_device *ndev)
4185 4185
4186 if (dc->pdata->flags & TEGRA_DC_FLAG_ENABLED) { 4186 if (dc->pdata->flags & TEGRA_DC_FLAG_ENABLED) {
4187 /* WAR: BL is putting DC in bad state for EDP configuration */ 4187 /* WAR: BL is putting DC in bad state for EDP configuration */
4188 if (dc->out->type == TEGRA_DC_OUT_DP || 4188 if (!tegra_platform_is_linsim() &&
4189 dc->out->type == TEGRA_DC_OUT_NVSR_DP) { 4189 (dc->out->type == TEGRA_DC_OUT_DP ||
4190 dc->out->type == TEGRA_DC_OUT_NVSR_DP)) {
4190 clk_prepare_enable(dc->clk); 4191 clk_prepare_enable(dc->clk);
4191 tegra_periph_reset_assert(dc->clk); 4192 tegra_periph_reset_assert(dc->clk);
4192 udelay(10); 4193 udelay(10);
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);
diff --git a/drivers/video/tegra/dc/dp.h b/drivers/video/tegra/dc/dp.h
index ca5547c0d..8a0c69295 100644
--- a/drivers/video/tegra/dc/dp.h
+++ b/drivers/video/tegra/dc/dp.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * drivers/video/tegra/dc/dp.h 2 * drivers/video/tegra/dc/dp.h
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
@@ -74,7 +74,8 @@ static const u32 tegra_dp_vs_regs[][4][4] = {
74/* Both 12x and 13x config enabled for 13x */ 74/* Both 12x and 13x config enabled for 13x */
75#if (defined(CONFIG_ARCH_TEGRA_12x_SOC) && \ 75#if (defined(CONFIG_ARCH_TEGRA_12x_SOC) && \
76 !defined(CONFIG_ARCH_TEGRA_13x_SOC)) || \ 76 !defined(CONFIG_ARCH_TEGRA_13x_SOC)) || \
77 defined(CONFIG_ARCH_TEGRA_21x_SOC) 77 defined(CONFIG_ARCH_TEGRA_21x_SOC) || \
78 defined(CONFIG_TEGRA_NVDISPLAY)
78static const u32 tegra_dp_pe_regs[][4][4] = { 79static const u32 tegra_dp_pe_regs[][4][4] = {
79 /* postcursor2 L0 */ 80 /* postcursor2 L0 */
80 { 81 {
diff --git a/drivers/video/tegra/dc/sor.c b/drivers/video/tegra/dc/sor.c
index b36a50092..a28551b9c 100644
--- a/drivers/video/tegra/dc/sor.c
+++ b/drivers/video/tegra/dc/sor.c
@@ -1378,9 +1378,6 @@ void tegra_sor_start_dc(struct tegra_dc_sor_data *sor)
1378 struct tegra_dc *dc = sor->dc; 1378 struct tegra_dc *dc = sor->dc;
1379 u32 reg_val; 1379 u32 reg_val;
1380 1380
1381 if (tegra_platform_is_linsim())
1382 return;
1383
1384 if (sor->sor_state == SOR_ATTACHED) 1381 if (sor->sor_state == SOR_ATTACHED)
1385 return; 1382 return;
1386 1383
@@ -1465,6 +1462,7 @@ void tegra_dc_sor_attach(struct tegra_dc_sor_data *sor)
1465 NV_SOR_SUPER_STATE1_ASY_HEAD_OP_AWAKE | 1462 NV_SOR_SUPER_STATE1_ASY_HEAD_OP_AWAKE |
1466 NV_SOR_SUPER_STATE1_ASY_ORMODE_NORMAL | 1463 NV_SOR_SUPER_STATE1_ASY_ORMODE_NORMAL |
1467 NV_SOR_SUPER_STATE1_ATTACHED_YES); 1464 NV_SOR_SUPER_STATE1_ATTACHED_YES);
1465 tegra_dc_sor_super_update(sor);
1468 1466
1469 tegra_dc_sor_enable_dc(sor); 1467 tegra_dc_sor_enable_dc(sor);
1470 1468
@@ -1567,8 +1565,6 @@ void tegra_sor_stop_dc(struct tegra_dc_sor_data *sor)
1567{ 1565{
1568 struct tegra_dc *dc = sor->dc; 1566 struct tegra_dc *dc = sor->dc;
1569 1567
1570 if (tegra_platform_is_linsim())
1571 return;
1572 tegra_dc_get(dc); 1568 tegra_dc_get(dc);
1573 1569
1574 /* Stop DC->SOR path */ 1570 /* Stop DC->SOR path */
@@ -1611,6 +1607,7 @@ void tegra_dc_sor_pre_detach(struct tegra_dc_sor_data *sor)
1611 NV_SOR_SUPER_STATE1_ASY_HEAD_OP_SLEEP | 1607 NV_SOR_SUPER_STATE1_ASY_HEAD_OP_SLEEP |
1612 NV_SOR_SUPER_STATE1_ASY_ORMODE_SAFE | 1608 NV_SOR_SUPER_STATE1_ASY_ORMODE_SAFE |
1613 NV_SOR_SUPER_STATE1_ATTACHED_YES); 1609 NV_SOR_SUPER_STATE1_ATTACHED_YES);
1610 tegra_dc_sor_super_update(sor);
1614 1611
1615 tegra_dc_sor_disable_win_short_raster(dc, sor->dc_reg_ctx); 1612 tegra_dc_sor_disable_win_short_raster(dc, sor->dc_reg_ctx);
1616#endif 1613#endif