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 | |
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')
-rw-r--r-- | drivers/video/tegra/dc/dsi.c | 114 | ||||
-rw-r--r-- | drivers/video/tegra/dc/dsi_regs.h | 28 | ||||
-rw-r--r-- | drivers/video/tegra/dc/mipi_cal.c | 33 | ||||
-rw-r--r-- | drivers/video/tegra/dc/mipi_cal.h | 5 | ||||
-rw-r--r-- | drivers/video/tegra/dc/mipi_cal_regs.h | 86 |
5 files changed, 252 insertions, 14 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 { |
diff --git a/drivers/video/tegra/dc/dsi_regs.h b/drivers/video/tegra/dc/dsi_regs.h index 1d077ce43..18a2c63df 100644 --- a/drivers/video/tegra/dc/dsi_regs.h +++ b/drivers/video/tegra/dc/dsi_regs.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/video/tegra/dc/dsi_regs.h | 2 | * drivers/video/tegra/dc/dsi_regs.h |
3 | * | 3 | * |
4 | * Copyright (c) 2011-2012, NVIDIA CORPORATION, All rights reserved. | 4 | * Copyright (c) 2011-2013, 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 |
@@ -353,10 +353,36 @@ enum { | |||
353 | #define DSI_PAD_CONTROL_CD_VS1 0x4c | 353 | #define DSI_PAD_CONTROL_CD_VS1 0x4c |
354 | #define DSI_PAD_CD_STATUS 0x4d | 354 | #define DSI_PAD_CD_STATUS 0x4d |
355 | #define DSI_PAD_CD_STATUS_VS1 0x4d | 355 | #define DSI_PAD_CD_STATUS_VS1 0x4d |
356 | |||
356 | #define DSI_PAD_CONTROL_1_VS1 0x4f | 357 | #define DSI_PAD_CONTROL_1_VS1 0x4f |
358 | #define DSI_PAD_OUTADJ3(x) (((x) & 0x7) << 12) | ||
359 | #define DSI_PAD_OUTADJ2(x) (((x) & 0x7) << 8) | ||
360 | #define DSI_PAD_OUTADJ1(x) (((x) & 0x7) << 4) | ||
361 | #define DSI_PAD_OUTADJ0(x) (((x) & 0x7) << 0) | ||
362 | |||
357 | #define DSI_PAD_CONTROL_2_VS1 0x50 | 363 | #define DSI_PAD_CONTROL_2_VS1 0x50 |
364 | #define DSI_PAD_SLEWUPADJ(x) (((x) & 0x7) << 16) | ||
365 | #define DSI_PAD_SLEWDNADJ(x) (((x) & 0x7) << 12) | ||
366 | #define DSI_PAD_LPUPADJ(x) (((x) & 0x7) << 8) | ||
367 | #define DSI_PAD_LPDNADJ(x) (((x) & 0x7) << 4) | ||
368 | #define DSI_PAD_OUTADJCLK(x) (((x) & 0x7) << 0) | ||
369 | |||
358 | #define DSI_PAD_CONTROL_3_VS1 0x51 | 370 | #define DSI_PAD_CONTROL_3_VS1 0x51 |
371 | #define DSI_PAD_PDVCLAMP(x) (((x) & 0x1) << 28) | ||
372 | #define DSI_PAD_BANDWD_IN(x) (((x) & 0x1) << 16) | ||
373 | #define DSI_PAD_PREEMP_PD_CLK(x) (((x) & 0x3) << 12) | ||
374 | #define DSI_PAD_PREEMP_PU_CLK(x) (((x) & 0x3) << 8) | ||
375 | #define DSI_PAD_PREEMP_PD(x) (((x) & 0x3) << 4) | ||
376 | #define DSI_PAD_PREEMP_PU(x) (((x) & 0x3) << 0) | ||
377 | |||
359 | #define DSI_PAD_CONTROL_4_VS1 0x52 | 378 | #define DSI_PAD_CONTROL_4_VS1 0x52 |
379 | #define DSI_PAD_HS_BSO_CLK(x) (((x) & 0x1) << 28) | ||
380 | #define DSI_PAD_HS_BSO(x) (((x) & 0xf) << 20) | ||
381 | #define DSI_PAD_LP_BSO_CLK(x) (((x) & 0x1) << 16) | ||
382 | #define DSI_PAD_LP_BSO(x) (((x) & 0xf) << 8) | ||
383 | #define DSI_PAD_TXBW_EN(x) (((x) & 0x1) << 4) | ||
384 | #define DSI_PAD_REV_CLK(x) (((x) & 0x1) << 0) | ||
385 | |||
360 | #define DSI_VID_MODE_CONTROL 0x4e | 386 | #define DSI_VID_MODE_CONTROL 0x4e |
361 | 387 | ||
362 | #define DSI_GANGED_MODE_CONTROL 0x53 | 388 | #define DSI_GANGED_MODE_CONTROL 0x53 |
diff --git a/drivers/video/tegra/dc/mipi_cal.c b/drivers/video/tegra/dc/mipi_cal.c index ccd54e637..6d8e33d74 100644 --- a/drivers/video/tegra/dc/mipi_cal.c +++ b/drivers/video/tegra/dc/mipi_cal.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/video/tegra/dc/mipi_cal.c | 2 | * drivers/video/tegra/dc/mipi_cal.c |
3 | * | 3 | * |
4 | * Copyright (c) 2012, NVIDIA CORPORATION, All rights reserved. | 4 | * Copyright (c) 2012-2013, 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 |
@@ -28,12 +28,31 @@ int tegra_mipi_cal_init_hw(struct tegra_mipi_cal *mipi_cal) | |||
28 | BUG_ON(IS_ERR_OR_NULL(mipi_cal)); | 28 | BUG_ON(IS_ERR_OR_NULL(mipi_cal)); |
29 | 29 | ||
30 | mutex_lock(&mipi_cal->lock); | 30 | mutex_lock(&mipi_cal->lock); |
31 | clk_prepare_enable(mipi_cal->clk); | 31 | |
32 | tegra_mipi_cal_clk_enable(mipi_cal); | ||
32 | 33 | ||
33 | for (; cnt <= MIPI_CAL_MIPI_BIAS_PAD_CFG2_0; cnt += 4) | 34 | for (; cnt <= MIPI_CAL_MIPI_BIAS_PAD_CFG2_0; cnt += 4) |
34 | tegra_mipi_cal_write(mipi_cal, 0, cnt); | 35 | tegra_mipi_cal_write(mipi_cal, 0, cnt); |
35 | 36 | ||
36 | clk_disable_unprepare(mipi_cal->clk); | 37 | /* Clear MIPI cal status register */ |
38 | tegra_mipi_cal_write(mipi_cal, | ||
39 | MIPI_AUTO_CAL_DONE_DSID(0x1) | | ||
40 | MIPI_AUTO_CAL_DONE_DSIC(0x1) | | ||
41 | MIPI_AUTO_CAL_DONE_DSIB(0x1) | | ||
42 | MIPI_AUTO_CAL_DONE_DSIA(0x1) | | ||
43 | MIPI_AUTO_CAL_DONE_CSIE(0x1) | | ||
44 | MIPI_AUTO_CAL_DONE_CSID(0x1) | | ||
45 | MIPI_AUTO_CAL_DONE_CSIC(0x1) | | ||
46 | MIPI_AUTO_CAL_DONE_CSIB(0x1) | | ||
47 | MIPI_AUTO_CAL_DONE_CSIA(0x1) | | ||
48 | MIPI_AUTO_CAL_DONE(0x1) | | ||
49 | MIPI_CAL_DRIV_DN_ADJ(0x0) | | ||
50 | MIPI_CAL_DRIV_UP_ADJ(0x0) | | ||
51 | MIPI_CAL_TERMADJ(0x0) | | ||
52 | MIPI_CAL_ACTIVE(0x0), | ||
53 | MIPI_CAL_CIL_MIPI_CAL_STATUS_0); | ||
54 | |||
55 | tegra_mipi_cal_clk_disable(mipi_cal); | ||
37 | mutex_unlock(&mipi_cal->lock); | 56 | mutex_unlock(&mipi_cal->lock); |
38 | 57 | ||
39 | return 0; | 58 | return 0; |
@@ -45,6 +64,7 @@ struct tegra_mipi_cal *tegra_mipi_cal_init_sw(struct tegra_dc *dc) | |||
45 | struct tegra_mipi_cal *mipi_cal; | 64 | struct tegra_mipi_cal *mipi_cal; |
46 | struct resource *res; | 65 | struct resource *res; |
47 | struct clk *clk; | 66 | struct clk *clk; |
67 | struct clk *fixed_clk; | ||
48 | void __iomem *base; | 68 | void __iomem *base; |
49 | int err = 0; | 69 | int err = 0; |
50 | 70 | ||
@@ -76,12 +96,19 @@ struct tegra_mipi_cal *tegra_mipi_cal_init_sw(struct tegra_dc *dc) | |||
76 | err = PTR_ERR(clk); | 96 | err = PTR_ERR(clk); |
77 | goto fail_free_map; | 97 | goto fail_free_map; |
78 | } | 98 | } |
99 | fixed_clk = clk_get_sys("mipi-cal-fixed", NULL); | ||
100 | if (IS_ERR_OR_NULL(fixed_clk)) { | ||
101 | dev_err(&dc->ndev->dev, "mipi_cal: fixed clk get failed\n"); | ||
102 | err = PTR_ERR(fixed_clk); | ||
103 | goto fail_free_map; | ||
104 | } | ||
79 | 105 | ||
80 | mutex_init(&mipi_cal->lock); | 106 | mutex_init(&mipi_cal->lock); |
81 | mipi_cal->dc = dc; | 107 | mipi_cal->dc = dc; |
82 | mipi_cal->res = res; | 108 | mipi_cal->res = res; |
83 | mipi_cal->base = base; | 109 | mipi_cal->base = base; |
84 | mipi_cal->clk = clk; | 110 | mipi_cal->clk = clk; |
111 | mipi_cal->fixed_clk = fixed_clk; | ||
85 | 112 | ||
86 | return mipi_cal; | 113 | return mipi_cal; |
87 | 114 | ||
diff --git a/drivers/video/tegra/dc/mipi_cal.h b/drivers/video/tegra/dc/mipi_cal.h index 8f254d61c..47b764c1f 100644 --- a/drivers/video/tegra/dc/mipi_cal.h +++ b/drivers/video/tegra/dc/mipi_cal.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/video/tegra/dc/mipi_cal.h | 2 | * drivers/video/tegra/dc/mipi_cal.h |
3 | * | 3 | * |
4 | * Copyright (c) 2012, NVIDIA CORPORATION, All rights reserved. | 4 | * Copyright (c) 2012-2013, 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 |
@@ -23,6 +23,7 @@ struct tegra_mipi_cal { | |||
23 | struct tegra_dc *dc; | 23 | struct tegra_dc *dc; |
24 | struct resource *res; | 24 | struct resource *res; |
25 | struct clk *clk; | 25 | struct clk *clk; |
26 | struct clk *fixed_clk; | ||
26 | void __iomem *base; | 27 | void __iomem *base; |
27 | struct mutex lock; | 28 | struct mutex lock; |
28 | }; | 29 | }; |
@@ -31,6 +32,7 @@ struct tegra_mipi_cal { | |||
31 | static inline void tegra_mipi_cal_clk_enable(struct tegra_mipi_cal *mipi_cal) | 32 | static inline void tegra_mipi_cal_clk_enable(struct tegra_mipi_cal *mipi_cal) |
32 | { | 33 | { |
33 | BUG_ON(IS_ERR_OR_NULL(mipi_cal)); | 34 | BUG_ON(IS_ERR_OR_NULL(mipi_cal)); |
35 | clk_prepare_enable(mipi_cal->fixed_clk); | ||
34 | clk_prepare_enable(mipi_cal->clk); | 36 | clk_prepare_enable(mipi_cal->clk); |
35 | } | 37 | } |
36 | 38 | ||
@@ -38,6 +40,7 @@ static inline void tegra_mipi_cal_clk_disable(struct tegra_mipi_cal *mipi_cal) | |||
38 | { | 40 | { |
39 | BUG_ON(IS_ERR_OR_NULL(mipi_cal)); | 41 | BUG_ON(IS_ERR_OR_NULL(mipi_cal)); |
40 | clk_disable_unprepare(mipi_cal->clk); | 42 | clk_disable_unprepare(mipi_cal->clk); |
43 | clk_disable_unprepare(mipi_cal->fixed_clk); | ||
41 | } | 44 | } |
42 | 45 | ||
43 | /* reg is word offset */ | 46 | /* reg is word offset */ |
diff --git a/drivers/video/tegra/dc/mipi_cal_regs.h b/drivers/video/tegra/dc/mipi_cal_regs.h index 2c1995356..9094a5c35 100644 --- a/drivers/video/tegra/dc/mipi_cal_regs.h +++ b/drivers/video/tegra/dc/mipi_cal_regs.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/video/tegra/dc/mipi_cal_regs.h | 2 | * drivers/video/tegra/dc/mipi_cal_regs.h |
3 | * | 3 | * |
4 | * Copyright (c) 2012, NVIDIA CORPORATION, All rights reserved. | 4 | * Copyright (c) 2012-2013, 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 |
@@ -17,6 +17,8 @@ | |||
17 | #ifndef __DRIVERS_VIDEO_TEGRA_DC_MIPI_CAL_REG_H__ | 17 | #ifndef __DRIVERS_VIDEO_TEGRA_DC_MIPI_CAL_REG_H__ |
18 | #define __DRIVERS_VIDEO_TEGRA_DC_MIPI_CAL_REG_H__ | 18 | #define __DRIVERS_VIDEO_TEGRA_DC_MIPI_CAL_REG_H__ |
19 | 19 | ||
20 | #define MIPI_DSI_AUTOCAL_TIMEOUT_USEC 2000 | ||
21 | |||
20 | #define MIPI_CAL_MIPI_CAL_CTRL_0 0x0 | 22 | #define MIPI_CAL_MIPI_CAL_CTRL_0 0x0 |
21 | #define MIPI_CAL_NOISE_FLT(x) (((x) & 0xf) << 26) | 23 | #define MIPI_CAL_NOISE_FLT(x) (((x) & 0xf) << 26) |
22 | #define MIPI_CAL_PRESCALE(x) (((x) & 0x3) << 24) | 24 | #define MIPI_CAL_PRESCALE(x) (((x) & 0x3) << 24) |
@@ -24,6 +26,41 @@ | |||
24 | #define MIPI_CAL_AUTOCAL_EN(x) (((x) & 0x1) << 1) | 26 | #define MIPI_CAL_AUTOCAL_EN(x) (((x) & 0x1) << 1) |
25 | #define MIPI_CAL_STARTCAL(x) (((x) & 0x1) << 0) | 27 | #define MIPI_CAL_STARTCAL(x) (((x) & 0x1) << 0) |
26 | 28 | ||
29 | #define MIPI_CAL_CILA_MIPI_CAL_CONFIG_0 0x14 | ||
30 | #define MIPI_CAL_OVERIDEA(x) (((x) & 0x1) << 30) | ||
31 | #define MIPI_CAL_SELA(x) (((x) & 0x1) << 21) | ||
32 | #define MIPI_CAL_HSPDOSA(x) (((x) & 0x1f) << 16) | ||
33 | #define MIPI_CAL_HSPUOSA(x) (((x) & 0x1f) << 8) | ||
34 | #define MIPI_CAL_TERMOSA(x) (((x) & 0x1f) << 0) | ||
35 | |||
36 | #define MIPI_CAL_CILB_MIPI_CAL_CONFIG_0 0x18 | ||
37 | #define MIPI_CAL_OVERIDEB(x) (((x) & 0x1) << 30) | ||
38 | #define MIPI_CAL_SELB(x) (((x) & 0x1) << 21) | ||
39 | #define MIPI_CAL_HSPDOSB(x) (((x) & 0x1f) << 16) | ||
40 | #define MIPI_CAL_HSPUOSB(x) (((x) & 0x1f) << 8) | ||
41 | #define MIPI_CAL_TERMOSB(x) (((x) & 0x1f) << 0) | ||
42 | |||
43 | #define MIPI_CAL_CILC_MIPI_CAL_CONFIG_0 0x1c | ||
44 | #define MIPI_CAL_OVERIDEC(x) (((x) & 0x1) << 30) | ||
45 | #define MIPI_CAL_SELC(x) (((x) & 0x1) << 21) | ||
46 | #define MIPI_CAL_HSPDOSC(x) (((x) & 0x1f) << 16) | ||
47 | #define MIPI_CAL_HSPUOSC(x) (((x) & 0x1f) << 8) | ||
48 | #define MIPI_CAL_TERMOSC(x) (((x) & 0x1f) << 0) | ||
49 | |||
50 | #define MIPI_CAL_CILD_MIPI_CAL_CONFIG_0 0x20 | ||
51 | #define MIPI_CAL_OVERIDED(x) (((x) & 0x1) << 30) | ||
52 | #define MIPI_CAL_SELD(x) (((x) & 0x1) << 21) | ||
53 | #define MIPI_CAL_HSPDOSD(x) (((x) & 0x1f) << 16) | ||
54 | #define MIPI_CAL_HSPUOSD(x) (((x) & 0x1f) << 8) | ||
55 | #define MIPI_CAL_TERMOSD(x) (((x) & 0x1f) << 0) | ||
56 | |||
57 | #define MIPI_CAL_CILE_MIPI_CAL_CONFIG_0 0x24 | ||
58 | #define MIPI_CAL_OVERIDEE(x) (((x) & 0x1) << 30) | ||
59 | #define MIPI_CAL_SELE(x) (((x) & 0x1) << 21) | ||
60 | #define MIPI_CAL_HSPDOSE(x) (((x) & 0x1f) << 16) | ||
61 | #define MIPI_CAL_HSPUOSE(x) (((x) & 0x1f) << 8) | ||
62 | #define MIPI_CAL_TERMOSE(x) (((x) & 0x1f) << 0) | ||
63 | |||
27 | #define MIPI_CAL_MIPI_BIAS_PAD_CFG0_0 0x58 | 64 | #define MIPI_CAL_MIPI_BIAS_PAD_CFG0_0 0x58 |
28 | #define MIPI_BIAS_PAD_PDVCLAMP(x) (((x) & 0x1) << 1) | 65 | #define MIPI_BIAS_PAD_PDVCLAMP(x) (((x) & 0x1) << 1) |
29 | #define MIPI_BIAS_PAD_E_VCLAMP_REF(x) (((x) & 0x1) << 0) | 66 | #define MIPI_BIAS_PAD_E_VCLAMP_REF(x) (((x) & 0x1) << 0) |
@@ -41,4 +78,51 @@ | |||
41 | #define PAD_PDVREG(x) (((x) & 0x1) << 1) | 78 | #define PAD_PDVREG(x) (((x) & 0x1) << 1) |
42 | #define PAD_VBYPASS(x) (((x) & 0x1) << 0) | 79 | #define PAD_VBYPASS(x) (((x) & 0x1) << 0) |
43 | 80 | ||
81 | #define MIPI_CAL_DSIA_MIPI_CAL_CONFIG_0 0x38 | ||
82 | #define MIPI_CAL_OVERIDEDSIA(x) (((x) & 0x1) << 30) | ||
83 | #define MIPI_CAL_SELDSIA(x) (((x) & 0x1) << 21) | ||
84 | #define MIPI_CAL_HSPDOSDSIA(x) (((x) & 0x1f) << 16) | ||
85 | #define MIPI_CAL_HSPUOSDSIA(x) (((x) & 0x1f) << 8) | ||
86 | #define MIPI_CAL_TERMOSDSIA(x) (((x) & 0x1f) << 0) | ||
87 | |||
88 | #define MIPI_CAL_DSIB_MIPI_CAL_CONFIG_0 0x3c | ||
89 | #define MIPI_CAL_OVERIDEDSIB(x) (((x) & 0x1) << 30) | ||
90 | #define MIPI_CAL_SELDSIB(x) (((x) & 0x1) << 21) | ||
91 | #define MIPI_CAL_HSPDOSDSIB(x) (((x) & 0x1f) << 16) | ||
92 | #define MIPI_CAL_HSPUOSDSIB(x) (((x) & 0x1f) << 8) | ||
93 | #define MIPI_CAL_TERMOSDSIB(x) (((x) & 0x1f) << 0) | ||
94 | |||
95 | #define MIPI_CAL_DSIC_MIPI_CAL_CONFIG_0 0x40 | ||
96 | #define MIPI_CAL_OVERIDEDSIC(x) (((x) & 0x1) << 30) | ||
97 | #define MIPI_CAL_SELDSIC(x) (((x) & 0x1) << 21) | ||
98 | #define MIPI_CAL_HSPDOSDSIC(x) (((x) & 0x1f) << 16) | ||
99 | #define MIPI_CAL_HSPUOSDSIC(x) (((x) & 0x1f) << 8) | ||
100 | #define MIPI_CAL_TERMOSDSIC(x) (((x) & 0x1f) << 0) | ||
101 | |||
102 | #define MIPI_CAL_DSID_MIPI_CAL_CONFIG_0 0x44 | ||
103 | #define MIPI_CAL_OVERIDEDSID(x) (((x) & 0x1) << 30) | ||
104 | #define MIPI_CAL_SELDSID(x) (((x) & 0x1) << 21) | ||
105 | #define MIPI_CAL_HSPDOSDSID(x) (((x) & 0x1f) << 16) | ||
106 | #define MIPI_CAL_HSPUOSDSID(x) (((x) & 0x1f) << 8) | ||
107 | #define MIPI_CAL_TERMOSDSID(x) (((x) & 0x1f) << 0) | ||
108 | |||
109 | #define MIPI_CAL_MIPI_CAL_AUTOCAL_CTRL0_0 0x4 | ||
110 | #define MIPI_CAL_AUTOCAL_PERIOD(x) ((x) << 0) | ||
111 | |||
112 | #define MIPI_CAL_CIL_MIPI_CAL_STATUS_0 0x8 | ||
113 | #define MIPI_AUTO_CAL_DONE_DSID(x) (((x) & 0x1) << 31) | ||
114 | #define MIPI_AUTO_CAL_DONE_DSIC(x) (((x) & 0x1) << 30) | ||
115 | #define MIPI_AUTO_CAL_DONE_DSIB(x) (((x) & 0x1) << 29) | ||
116 | #define MIPI_AUTO_CAL_DONE_DSIA(x) (((x) & 0x1) << 28) | ||
117 | #define MIPI_AUTO_CAL_DONE_CSIE(x) (((x) & 0x1) << 24) | ||
118 | #define MIPI_AUTO_CAL_DONE_CSID(x) (((x) & 0x1) << 23) | ||
119 | #define MIPI_AUTO_CAL_DONE_CSIC(x) (((x) & 0x1) << 22) | ||
120 | #define MIPI_AUTO_CAL_DONE_CSIB(x) (((x) & 0x1) << 21) | ||
121 | #define MIPI_AUTO_CAL_DONE_CSIA(x) (((x) & 0x1) << 20) | ||
122 | #define MIPI_AUTO_CAL_DONE(x) (((x) & 0x1) << 16) | ||
123 | #define MIPI_CAL_DRIV_DN_ADJ(x) (((x) & 0xf) << 12) | ||
124 | #define MIPI_CAL_DRIV_UP_ADJ(x) (((x) & 0xf) << 8) | ||
125 | #define MIPI_CAL_TERMADJ(x) (((x) & 0xf) << 4) | ||
126 | #define MIPI_CAL_ACTIVE(x) (((x) & 0x1) << 0) | ||
127 | |||
44 | #endif | 128 | #endif |