summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantosh Reddy Galma <galmar@nvidia.com>2016-10-04 23:27:05 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-01-16 15:14:50 -0500
commit1df65fce9afbcfb7f7d9b10b237b76ac1146b762 (patch)
treec418b46f86fbc7c34e31fe77a990d75d6ecbcd85
parentc26520230bcca8d8b4ef7b5b002b168764684b68 (diff)
video: tegra: read and use display hw data runtime
currently, TEGRA_MAX_DC and DC_N_WINDOWS macros are used to represent number of display heads, windows based on chip config. This change does following to support multiple SOCs on a single binary. - use tegra_dc_hw_data data structure and populate it based on the chip compatible field. - expose API's to read number of display heads, windows for other modules. - use the above data structure fields or API's in place of macros in display drivers and other modules like fb,ext,screen capture. - remove TEGRA_MAX_DC macro usage completely. - make runtime alloc for data structures which were using static alloc previously based on macros at compile time. - code re-organization and cleanup with above change. TDS-1305 TDS-1301 TDS-1408 TDS-1307 Change-Id: Ief70aa7fdac420a7a8375fe91dfae58116d3eb6e Signed-off-by: Santosh Reddy Galma <galmar@nvidia.com> Reviewed-on: http://git-master/r/1231688 Reviewed-by: Ujwal Patel <ujwalp@nvidia.com> Tested-by: Ujwal Patel <ujwalp@nvidia.com> Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
-rw-r--r--drivers/video/tegra/dc/bandwidth.c37
-rw-r--r--drivers/video/tegra/dc/dc.c124
-rw-r--r--drivers/video/tegra/dc/dc_priv_defs.h7
-rw-r--r--drivers/video/tegra/dc/ext/dev.c49
-rw-r--r--drivers/video/tegra/dc/ext/scrncapt.c53
-rw-r--r--drivers/video/tegra/dc/lut.c5
-rw-r--r--drivers/video/tegra/dc/sor.c8
-rw-r--r--drivers/video/tegra/dc/window.c12
-rw-r--r--drivers/video/tegra/fb.c4
-rw-r--r--include/video/tegra_dc_ext.h2
-rw-r--r--include/video/tegra_dc_ext_kernel.h8
11 files changed, 179 insertions, 130 deletions
diff --git a/drivers/video/tegra/dc/bandwidth.c b/drivers/video/tegra/dc/bandwidth.c
index 6b3aa0242..a33c2cd60 100644
--- a/drivers/video/tegra/dc/bandwidth.c
+++ b/drivers/video/tegra/dc/bandwidth.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * drivers/video/tegra/dc/bandwidth.c 2 * drivers/video/tegra/dc/bandwidth.c
3 * 3 *
4 * Copyright (c) 2010-2016, NVIDIA CORPORATION, All rights reserved. 4 * Copyright (c) 2010-2017, NVIDIA CORPORATION, All rights reserved.
5 * 5 *
6 * Author: Jon Mayo <jmayo@nvidia.com> 6 * Author: Jon Mayo <jmayo@nvidia.com>
7 * 7 *
@@ -40,7 +40,6 @@ static int use_dynamic_emc = 1;
40 40
41module_param_named(use_dynamic_emc, use_dynamic_emc, int, S_IRUGO | S_IWUSR); 41module_param_named(use_dynamic_emc, use_dynamic_emc, int, S_IRUGO | S_IWUSR);
42 42
43static unsigned int tegra_dcs_total_bw[TEGRA_MAX_DC] = {0};
44DEFINE_MUTEX(tegra_dcs_total_bw_lock); 43DEFINE_MUTEX(tegra_dcs_total_bw_lock);
45 44
46/* windows A, B, C for first and second display */ 45/* windows A, B, C for first and second display */
@@ -73,7 +72,8 @@ static unsigned int num_active_internal_wins(struct tegra_dc *dc)
73 unsigned int num_active_internal_wins = 0; 72 unsigned int num_active_internal_wins = 0;
74 int i = 0; 73 int i = 0;
75 74
76 for_each_set_bit(i, &dc->valid_windows, DC_N_WINDOWS) { 75 for_each_set_bit(i, &dc->valid_windows,
76 tegra_dc_get_numof_dispwindows()) {
77 struct tegra_dc_win *curr_win = tegra_dc_get_window(dc, i); 77 struct tegra_dc_win *curr_win = tegra_dc_get_window(dc, i);
78 enum tegra_la_id curr_win_la_id = 78 enum tegra_la_id curr_win_la_id =
79 la_id_tab[dc->ctrl_num][curr_win->idx]; 79 la_id_tab[dc->ctrl_num][curr_win->idx];
@@ -93,7 +93,8 @@ static unsigned int num_active_external_wins(struct tegra_dc *dc)
93 unsigned int num_active_external_wins = 0; 93 unsigned int num_active_external_wins = 0;
94 int i = 0; 94 int i = 0;
95 95
96 for_each_set_bit(i, &dc->valid_windows, DC_N_WINDOWS) { 96 for_each_set_bit(i, &dc->valid_windows,
97 tegra_dc_get_numof_dispwindows()) {
97 struct tegra_dc_win *curr_win = tegra_dc_get_window(dc, i); 98 struct tegra_dc_win *curr_win = tegra_dc_get_window(dc, i);
98 enum tegra_la_id curr_win_la_id = 99 enum tegra_la_id curr_win_la_id =
99 la_id_tab[dc->ctrl_num][curr_win->idx]; 100 la_id_tab[dc->ctrl_num][curr_win->idx];
@@ -379,7 +380,8 @@ static void calc_disp_params(struct tegra_dc *dc,
379 if (is_internal_win(la_id)) { 380 if (is_internal_win(la_id)) {
380 int i = 0; 381 int i = 0;
381 382
382 for_each_set_bit(i, &dc->valid_windows, DC_N_WINDOWS) { 383 for_each_set_bit(i, &dc->valid_windows,
384 tegra_dc_get_numof_dispwindows()) {
383 struct tegra_dc_win *curr_win = 385 struct tegra_dc_win *curr_win =
384 tegra_dc_get_window(dc, i); 386 tegra_dc_get_window(dc, i);
385 enum tegra_la_id curr_win_la_id = 387 enum tegra_la_id curr_win_la_id =
@@ -401,7 +403,8 @@ static void calc_disp_params(struct tegra_dc *dc,
401 } else { 403 } else {
402 int i = 0; 404 int i = 0;
403 405
404 for_each_set_bit(i, &dc->valid_windows, DC_N_WINDOWS) { 406 for_each_set_bit(i, &dc->valid_windows,
407 tegra_dc_get_numof_dispwindows()) {
405 struct tegra_dc_win *curr_win = 408 struct tegra_dc_win *curr_win =
406 tegra_dc_get_window(dc, i); 409 tegra_dc_get_window(dc, i);
407 enum tegra_la_id curr_win_la_id = 410 enum tegra_la_id curr_win_la_id =
@@ -482,9 +485,12 @@ static void calc_disp_params(struct tegra_dc *dc,
482 * round up bandwidth to next 1MBps */ 485 * round up bandwidth to next 1MBps */
483 if (curr_dc_head_bw != ULONG_MAX) 486 if (curr_dc_head_bw != ULONG_MAX)
484 curr_dc_head_bw = curr_dc_head_bw / 1000 + 1; 487 curr_dc_head_bw = curr_dc_head_bw / 1000 + 1;
485 tegra_dcs_total_bw[dc->ctrl_num] = curr_dc_head_bw; 488
486 disp_params->total_dc0_bw = tegra_dcs_total_bw[0]; 489 if (dc->ctrl_num)
487 disp_params->total_dc1_bw = tegra_dcs_total_bw[1]; 490 disp_params->total_dc1_bw = curr_dc_head_bw;
491 else
492 disp_params->total_dc0_bw = curr_dc_head_bw;
493
488 mutex_unlock(&tegra_dcs_total_bw_lock); 494 mutex_unlock(&tegra_dcs_total_bw_lock);
489} 495}
490 496
@@ -703,7 +709,7 @@ unsigned long tegra_dc_get_bandwidth(
703{ 709{
704 int i; 710 int i;
705 711
706 BUG_ON(n > DC_N_WINDOWS); 712 BUG_ON(n > tegra_dc_get_numof_dispwindows());
707 713
708 /* emc rate and latency allowance both need to know per window 714 /* emc rate and latency allowance both need to know per window
709 * bandwidths */ 715 * bandwidths */
@@ -821,7 +827,8 @@ void tegra_dc_program_bandwidth(struct tegra_dc *dc, bool use_new)
821 dc->bw_kbps = dc->new_bw_kbps; 827 dc->bw_kbps = dc->new_bw_kbps;
822 } 828 }
823 829
824 for_each_set_bit(i, &dc->valid_windows, DC_N_WINDOWS) { 830 for_each_set_bit(i, &dc->valid_windows,
831 tegra_dc_get_numof_dispwindows()) {
825 struct tegra_dc_win *w = tegra_dc_get_window(dc, i); 832 struct tegra_dc_win *w = tegra_dc_get_window(dc, i);
826 833
827 if ((use_new || w->bandwidth != w->new_bandwidth) && 834 if ((use_new || w->bandwidth != w->new_bandwidth) &&
@@ -835,14 +842,15 @@ void tegra_dc_program_bandwidth(struct tegra_dc *dc, bool use_new)
835int tegra_dc_set_dynamic_emc(struct tegra_dc *dc) 842int tegra_dc_set_dynamic_emc(struct tegra_dc *dc)
836{ 843{
837 unsigned long new_rate; 844 unsigned long new_rate;
838 struct tegra_dc_win *windows[DC_N_WINDOWS]; 845 int nwins = tegra_dc_get_numof_dispwindows();
846 struct tegra_dc_win *windows[nwins];
839 unsigned i; 847 unsigned i;
840 unsigned len; 848 unsigned len;
841 849
842 if (!use_dynamic_emc) 850 if (!use_dynamic_emc)
843 return 0; 851 return 0;
844 852
845 for (i = 0, len = 0; i < DC_N_WINDOWS; i++) { 853 for (i = 0, len = 0; i < tegra_dc_get_numof_dispwindows(); i++) {
846 struct tegra_dc_win *win = tegra_dc_get_window(dc, i); 854 struct tegra_dc_win *win = tegra_dc_get_window(dc, i);
847 if (win) 855 if (win)
848 windows[len++] = win; 856 windows[len++] = win;
@@ -945,7 +953,8 @@ int tegra_dc_bandwidth_negotiate_bw(struct tegra_dc *dc,
945 dc->bw_kbps = bw; 953 dc->bw_kbps = bw;
946 } 954 }
947 955
948 for_each_set_bit(i, &dc->valid_windows, DC_N_WINDOWS) { 956 for_each_set_bit(i, &dc->valid_windows,
957 tegra_dc_get_numof_dispwindows()) {
949 struct tegra_dc_win *w = tegra_dc_get_window(dc, i); 958 struct tegra_dc_win *w = tegra_dc_get_window(dc, i);
950 if ((w->bandwidth != w->new_bandwidth) && 959 if ((w->bandwidth != w->new_bandwidth) &&
951 w->new_bandwidth != 0) { 960 w->new_bandwidth != 0) {
diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c
index 0bc098639..9b0483e5a 100644
--- a/drivers/video/tegra/dc/dc.c
+++ b/drivers/video/tegra/dc/dc.c
@@ -27,6 +27,7 @@
27#include <linux/pm.h> 27#include <linux/pm.h>
28#include <linux/tegra-pm.h> 28#include <linux/tegra-pm.h>
29#include <linux/pm_runtime.h> 29#include <linux/pm_runtime.h>
30#include <linux/of_device.h>
30#include <linux/clk.h> 31#include <linux/clk.h>
31#include <linux/mutex.h> 32#include <linux/mutex.h>
32#include <linux/delay.h> 33#include <linux/delay.h>
@@ -93,6 +94,17 @@ EXPORT_TRACEPOINT_SYMBOL(display_readl);
93 94
94#define MAX_VRR_V_FRONT_PORCH 0x1000 95#define MAX_VRR_V_FRONT_PORCH 0x1000
95 96
97static struct tegra_dc_hw_data *hw_data;
98static struct tegra_dc_hw_data t21x_hw_data;
99static struct tegra_dc_hw_data t18x_hw_data;
100
101static const struct of_device_id tegra_display_of_match[] = {
102 {.compatible = "nvidia,tegra210-dc", .data = &t21x_hw_data },
103 {.compatible = "nvidia,tegra186-dc", .data = &t18x_hw_data },
104 { },
105};
106MODULE_DEVICE_TABLE(of, tegra_display_of_match);