diff options
author | Kevin Huang <kevinh@nvidia.com> | 2011-11-04 14:40:21 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:01:49 -0400 |
commit | c7f8da9c8842fe40e5b8748b5f2fbb6f718e2957 (patch) | |
tree | b14422155172b0db5da7982d2bd942b60277ba58 /drivers/video/tegra/dc/dsi.c | |
parent | 20c8b79997ffb506a3b323633b6b77d93ecec795 (diff) |
video: tegra: dsi: Refactor code in tegra_dsi_hw_init()
Reviewed-on: http://git-master/r/54824
Reviewed-by: Kevin Huang (Eng-SW) <kevinh@nvidia.com>
Tested-by: Kevin Huang (Eng-SW) <kevinh@nvidia.com>
Reviewed-by: Jon Mayo <jmayo@nvidia.com>
(cherry picked from commit 4681815651f5949840815a03698d55ec8186796c)
Change-Id: I5553b52806c63f8fb1fdc38f151a144ec103bcc5
Reviewed-on: http://git-master/r/61617
Reviewed-by: Kevin Huang (Eng-SW) <kevinh@nvidia.com>
Tested-by: Kevin Huang (Eng-SW) <kevinh@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Rebase-Id: Rf733836f46f9afb42b5d680683d98e04c4a0e776
Diffstat (limited to 'drivers/video/tegra/dc/dsi.c')
-rw-r--r-- | drivers/video/tegra/dc/dsi.c | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/drivers/video/tegra/dc/dsi.c b/drivers/video/tegra/dc/dsi.c index 55baca3f3..5b74afc38 100644 --- a/drivers/video/tegra/dc/dsi.c +++ b/drivers/video/tegra/dc/dsi.c | |||
@@ -1083,38 +1083,15 @@ static void tegra_dsi_set_control_reg_hs(struct tegra_dc_dsi_data *dsi) | |||
1083 | tegra_dsi_writel(dsi, host_dsi_control, DSI_HOST_DSI_CONTROL); | 1083 | tegra_dsi_writel(dsi, host_dsi_control, DSI_HOST_DSI_CONTROL); |
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | static int tegra_dsi_init_hw(struct tegra_dc *dc, | 1086 | static void tegra_dsi_pad_caliberation(struct tegra_dc_dsi_data *dsi) |
1087 | struct tegra_dc_dsi_data *dsi) | ||
1088 | { | 1087 | { |
1089 | u32 val; | 1088 | u32 val; |
1090 | u32 i; | ||
1091 | |||
1092 | val = DSI_POWER_CONTROL_LEG_DSI_ENABLE(TEGRA_DSI_DISABLE); | ||
1093 | tegra_dsi_writel(dsi, val, DSI_POWER_CONTROL); | ||
1094 | |||
1095 | tegra_dsi_set_dsi_clk(dc, dsi, dsi->target_lp_clk_khz); | ||
1096 | if (dsi->info.dsi_instance) { | ||
1097 | /* TODO:Set the misc register */ | ||
1098 | } | ||
1099 | |||
1100 | /* TODO: only need to change the timing for bta */ | ||
1101 | tegra_dsi_set_phy_timing(dsi); | ||
1102 | 1089 | ||
1103 | if (dsi->status.dc_stream == DSI_DC_STREAM_ENABLE) | ||
1104 | tegra_dsi_stop_dc_stream(dc, dsi); | ||
1105 | |||
1106 | /* Initializing DSI registers */ | ||
1107 | for (i = 0; i < ARRAY_SIZE(init_reg); i++) | ||
1108 | tegra_dsi_writel(dsi, 0, init_reg[i]); | ||
1109 | |||
1110 | tegra_dsi_writel(dsi, dsi->dsi_control_val, DSI_CONTROL); | ||
1111 | /* Initialize DSI_PAD_CONTROL register. */ | ||
1112 | val = DSI_PAD_CONTROL_PAD_LPUPADJ(0x1) | | 1090 | val = DSI_PAD_CONTROL_PAD_LPUPADJ(0x1) | |
1113 | DSI_PAD_CONTROL_PAD_LPDNADJ(0x1) | | 1091 | DSI_PAD_CONTROL_PAD_LPDNADJ(0x1) | |
1114 | DSI_PAD_CONTROL_PAD_PREEMP_EN(0x1) | | 1092 | DSI_PAD_CONTROL_PAD_PREEMP_EN(0x1) | |
1115 | DSI_PAD_CONTROL_PAD_SLEWDNADJ(0x6) | | 1093 | DSI_PAD_CONTROL_PAD_SLEWDNADJ(0x6) | |
1116 | DSI_PAD_CONTROL_PAD_SLEWUPADJ(0x6); | 1094 | DSI_PAD_CONTROL_PAD_SLEWUPADJ(0x6); |
1117 | |||
1118 | if (!dsi->ulpm) { | 1095 | if (!dsi->ulpm) { |
1119 | val |= DSI_PAD_CONTROL_PAD_PDIO(0) | | 1096 | val |= DSI_PAD_CONTROL_PAD_PDIO(0) | |
1120 | DSI_PAD_CONTROL_PAD_PDIO_CLK(0) | | 1097 | DSI_PAD_CONTROL_PAD_PDIO_CLK(0) | |
@@ -1137,6 +1114,35 @@ static int tegra_dsi_init_hw(struct tegra_dc *dc, | |||
1137 | 1114 | ||
1138 | val = PAD_DRIV_DN_REF(0x5) | PAD_DRIV_UP_REF(0x7); | 1115 | val = PAD_DRIV_DN_REF(0x5) | PAD_DRIV_UP_REF(0x7); |
1139 | tegra_vi_csi_writel(val, CSI_MIPIBIAS_PAD_CONFIG); | 1116 | tegra_vi_csi_writel(val, CSI_MIPIBIAS_PAD_CONFIG); |
1117 | } | ||
1118 | |||
1119 | static int tegra_dsi_init_hw(struct tegra_dc *dc, | ||
1120 | struct tegra_dc_dsi_data *dsi) | ||
1121 | { | ||
1122 | u32 val; | ||
1123 | u32 i; | ||
1124 | |||
1125 | val = DSI_POWER_CONTROL_LEG_DSI_ENABLE(TEGRA_DSI_DISABLE); | ||
1126 | tegra_dsi_writel(dsi, val, DSI_POWER_CONTROL); | ||
1127 | |||
1128 | tegra_dsi_set_dsi_clk(dc, dsi, dsi->target_lp_clk_khz); | ||
1129 | if (dsi->info.dsi_instance) { | ||
1130 | /* TODO:Set the misc register*/ | ||
1131 | } | ||
1132 | |||
1133 | /* TODO: only need to change the timing for bta */ | ||
1134 | tegra_dsi_set_phy_timing(dsi); | ||
1135 | |||
1136 | if (dsi->status.dc_stream == DSI_DC_STREAM_ENABLE) | ||
1137 | tegra_dsi_stop_dc_stream(dc, dsi); | ||
1138 | |||
1139 | /* Initializing DSI registers */ | ||
1140 | for (i = 0; i < ARRAY_SIZE(init_reg); i++) | ||
1141 | tegra_dsi_writel(dsi, 0, init_reg[i]); | ||
1142 | |||
1143 | tegra_dsi_writel(dsi, dsi->dsi_control_val, DSI_CONTROL); | ||
1144 | |||
1145 | tegra_dsi_pad_caliberation(dsi); | ||
1140 | 1146 | ||
1141 | val = DSI_POWER_CONTROL_LEG_DSI_ENABLE(TEGRA_DSI_ENABLE); | 1147 | val = DSI_POWER_CONTROL_LEG_DSI_ENABLE(TEGRA_DSI_ENABLE); |
1142 | tegra_dsi_writel(dsi, val, DSI_POWER_CONTROL); | 1148 | tegra_dsi_writel(dsi, val, DSI_POWER_CONTROL); |