diff options
author | Vineel Kumar Reddy Kovvuri <vineelkumarr@nvidia.com> | 2013-04-18 05:34:20 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:04:17 -0400 |
commit | 0ff752467af9ae153199d2ccf9b33180f99d9cf8 (patch) | |
tree | 049244476a9cdf6b4abac0737a99c569541b76d7 /drivers/video/tegra/dc/dsi.c | |
parent | 174e63e296d8280e1a5674dd0f0bc98e07b15505 (diff) |
video: tegra: dsi: Enable MIPI auto calibration
Implementation of DSI MIPI auto calibration
Bug 1166307
Change-Id: Id4be420978b56d662d77c6d145f9e51dc881d159
Signed-off-by: Vineel Kumar Reddy Kovvuri <vineelkumarr@nvidia.com>
Reviewed-on: http://git-master/r/209885
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
Diffstat (limited to 'drivers/video/tegra/dc/dsi.c')
-rw-r--r-- | drivers/video/tegra/dc/dsi.c | 114 |
1 files changed, 106 insertions, 8 deletions
diff --git a/drivers/video/tegra/dc/dsi.c b/drivers/video/tegra/dc/dsi.c index 620598e79..89715c85b 100644 --- a/drivers/video/tegra/dc/dsi.c +++ b/drivers/video/tegra/dc/dsi.c | |||
@@ -2016,28 +2016,126 @@ static void tegra_dsi_pad_enable(struct tegra_dc_dsi_data *dsi) | |||
2016 | tegra_dsi_writel(dsi, val, DSI_PAD_CONTROL); | 2016 | tegra_dsi_writel(dsi, val, DSI_PAD_CONTROL); |
2017 | } | 2017 | } |
2018 | } | 2018 | } |
2019 | 2019 | #ifdef CONFIG_ARCH_TEGRA_11x_SOC | |
2020 | static void tegra_dsi_pad_calibration(struct tegra_dc_dsi_data *dsi) | 2020 | static void tegra_dsi_mipi_calibration_11x(struct tegra_dc_dsi_data *dsi) |
2021 | { | 2021 | { |
2022 | u32 val; | 2022 | u32 val; |
2023 | /* Calibration settings begin */ | ||
2024 | val = (DSI_PAD_SLEWUPADJ(0x7) | DSI_PAD_SLEWDNADJ(0x7) | | ||
2025 | DSI_PAD_LPUPADJ(0x1) | DSI_PAD_LPDNADJ(0x1) | | ||
2026 | DSI_PAD_OUTADJCLK(0x0)); | ||
2027 | tegra_dsi_writel(dsi, val, DSI_PAD_CONTROL_2_VS1); | ||
2028 | |||
2029 | if (!dsi->controller_index) { | ||
2030 | val = tegra_dsi_readl(dsi, | ||
2031 | MIPI_CAL_DSIA_MIPI_CAL_CONFIG_0); | ||
2032 | val = MIPI_CAL_OVERIDEDSIA(0x0) | | ||
2033 | MIPI_CAL_SELDSIA(0x1) | | ||
2034 | MIPI_CAL_HSPDOSDSIA(0x2) | | ||
2035 | MIPI_CAL_HSPUOSDSIA(0x0) | | ||
2036 | MIPI_CAL_TERMOSDSIA(0x5); | ||
2037 | tegra_mipi_cal_write(dsi->mipi_cal, val, | ||
2038 | MIPI_CAL_DSIA_MIPI_CAL_CONFIG_0); | ||
2039 | tegra_mipi_cal_write(dsi->mipi_cal, val, | ||
2040 | MIPI_CAL_DSIB_MIPI_CAL_CONFIG_0); | ||
2041 | |||
2042 | /* Deselect PAD C */ | ||
2043 | val = tegra_mipi_cal_read(dsi->mipi_cal, | ||
2044 | MIPI_CAL_DSIC_MIPI_CAL_CONFIG_0); | ||
2045 | val &= ~(MIPI_CAL_SELDSIC(0x1)); | ||
2046 | tegra_mipi_cal_write(dsi->mipi_cal, val, | ||
2047 | MIPI_CAL_DSIC_MIPI_CAL_CONFIG_0); | ||
2048 | |||
2049 | /* Deselect PAD D */ | ||
2050 | val = tegra_mipi_cal_read(dsi->mipi_cal, | ||
2051 | MIPI_CAL_DSID_MIPI_CAL_CONFIG_0); | ||
2052 | val &= ~(MIPI_CAL_SELDSID(0x1)); | ||
2053 | tegra_mipi_cal_write(dsi->mipi_cal, val, | ||
2054 | MIPI_CAL_DSID_MIPI_CAL_CONFIG_0); | ||
2055 | } else { | ||
2056 | val = tegra_dsi_readl(dsi, | ||
2057 | MIPI_CAL_DSIC_MIPI_CAL_CONFIG_0); | ||
2058 | val = MIPI_CAL_OVERIDEDSIC(0x0) | | ||
2059 | MIPI_CAL_SELDSIC(0x1) | | ||
2060 | MIPI_CAL_HSPDOSDSIC(0x2) | | ||
2061 | MIPI_CAL_HSPUOSDSIC(0x0) | | ||
2062 | MIPI_CAL_TERMOSDSIC(0x5); | ||
2063 | tegra_mipi_cal_write(dsi->mipi_cal, val, | ||
2064 | MIPI_CAL_DSIC_MIPI_CAL_CONFIG_0); | ||
2065 | tegra_mipi_cal_write(dsi->mipi_cal, val, | ||
2066 | MIPI_CAL_DSID_MIPI_CAL_CONFIG_0); | ||
2067 | |||
2068 | /* Deselect PAD A */ | ||
2069 | val = tegra_mipi_cal_read(dsi->mipi_cal, | ||
2070 | MIPI_CAL_DSIA_MIPI_CAL_CONFIG_0); | ||
2071 | val &= ~(MIPI_CAL_SELDSIA(0x1)); | ||
2072 | tegra_mipi_cal_write(dsi->mipi_cal, val, | ||
2073 | MIPI_CAL_DSIA_MIPI_CAL_CONFIG_0); | ||
2074 | |||
2075 | /* Deselect PAD B */ | ||
2076 | val = tegra_mipi_cal_read(dsi->mipi_cal, | ||
2077 | MIPI_CAL_DSIB_MIPI_CAL_CONFIG_0); | ||
2078 | val &= ~(MIPI_CAL_SELDSIB(0x1)); | ||
2079 | tegra_mipi_cal_write(dsi->mipi_cal, val, | ||
2080 | MIPI_CAL_DSIB_MIPI_CAL_CONFIG_0); | ||
2081 | } | ||
2082 | |||
2083 | val = tegra_mipi_cal_read(dsi->mipi_cal, | ||
2084 | MIPI_CAL_MIPI_CAL_CTRL_0); | ||
2085 | val = MIPI_CAL_NOISE_FLT(0xa) | | ||
2086 | MIPI_CAL_PRESCALE(0x2) | | ||
2087 | MIPI_CAL_CLKEN_OVR(0x1) | | ||
2088 | MIPI_CAL_AUTOCAL_EN(0x0); | ||
2089 | tegra_mipi_cal_write(dsi->mipi_cal, val, | ||
2090 | MIPI_CAL_MIPI_CAL_CTRL_0); | ||
2023 | 2091 | ||
2092 | } | ||
2093 | #endif | ||
2094 | static void tegra_dsi_pad_calibration(struct tegra_dc_dsi_data *dsi) | ||
2095 | { | ||
2096 | u32 val = 0; | ||
2097 | u32 timeout = 0; | ||
2024 | if (!dsi->ulpm) | 2098 | if (!dsi->ulpm) |
2025 | tegra_dsi_pad_enable(dsi); | 2099 | tegra_dsi_pad_enable(dsi); |
2026 | else | 2100 | else |
2027 | tegra_dsi_pad_disable(dsi); | 2101 | tegra_dsi_pad_disable(dsi); |
2028 | 2102 | ||
2029 | if (dsi->info.controller_vs == DSI_VS_1) { | 2103 | if (dsi->info.controller_vs == DSI_VS_1) { |
2030 | /* TODO: characterization parameters */ | ||
2031 | tegra_mipi_cal_clk_enable(dsi->mipi_cal); | ||
2032 | 2104 | ||
2033 | tegra_mipi_cal_init_hw(dsi->mipi_cal); | 2105 | tegra_mipi_cal_init_hw(dsi->mipi_cal); |
2034 | 2106 | ||
2107 | tegra_mipi_cal_clk_enable(dsi->mipi_cal); | ||
2108 | |||
2035 | tegra_mipi_cal_write(dsi->mipi_cal, | 2109 | tegra_mipi_cal_write(dsi->mipi_cal, |
2036 | MIPI_BIAS_PAD_E_VCLAMP_REF(0x1), | 2110 | MIPI_BIAS_PAD_E_VCLAMP_REF(0x1), |
2037 | MIPI_CAL_MIPI_BIAS_PAD_CFG0_0); | 2111 | MIPI_CAL_MIPI_BIAS_PAD_CFG0_0); |
2038 | tegra_mipi_cal_write(dsi->mipi_cal, | 2112 | tegra_mipi_cal_write(dsi->mipi_cal, |
2039 | PAD_PDVREG(0x0), | 2113 | PAD_PDVREG(0x0) | PAD_VCLAMP_LEVEL(0x0), |
2040 | MIPI_CAL_MIPI_BIAS_PAD_CFG2_0); | 2114 | MIPI_CAL_MIPI_BIAS_PAD_CFG2_0); |
2115 | |||
2116 | #ifdef CONFIG_ARCH_TEGRA_11x_SOC | ||
2117 | tegra_dsi_mipi_calibration_11x(dsi); | ||
2118 | #endif | ||
2119 | /* Start calibration */ | ||
2120 | val = tegra_mipi_cal_read(dsi->mipi_cal, | ||
2121 | MIPI_CAL_MIPI_CAL_CTRL_0); | ||
2122 | val |= (MIPI_CAL_STARTCAL(0x1)); | ||
2123 | tegra_mipi_cal_write(dsi->mipi_cal, val, | ||
2124 | MIPI_CAL_MIPI_CAL_CTRL_0); | ||
2125 | |||
2126 | for (timeout = MIPI_DSI_AUTOCAL_TIMEOUT_USEC; | ||
2127 | timeout; timeout -= 100) { | ||
2128 | val = tegra_mipi_cal_read(dsi->mipi_cal, | ||
2129 | MIPI_CAL_CIL_MIPI_CAL_STATUS_0); | ||
2130 | if (!(val & MIPI_CAL_ACTIVE(0x1)) && | ||
2131 | (val & MIPI_AUTO_CAL_DONE(0x1))) { | ||
2132 | dev_info(&dsi->dc->ndev->dev, "DSI pad calibration done\n"); | ||
2133 | break; | ||
2134 | } | ||
2135 | usleep_range(10, 100); | ||
2136 | } | ||
2137 | if (timeout <= 0) | ||
2138 | dev_err(&dsi->dc->ndev->dev, "DSI calibration timed out\n"); | ||
2041 | 2139 | ||
2042 | tegra_mipi_cal_clk_disable(dsi->mipi_cal); | 2140 | tegra_mipi_cal_clk_disable(dsi->mipi_cal); |
2043 | } else { | 2141 | } else { |