xref: /aosp_15_r20/external/coreboot/src/soc/nvidia/tegra210/include/soc/mipi-phy.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef _TEGRA_MIPI_PHY_H
3 #define _TEGRA_MIPI_PHY_H
4 
5 /*
6  * Macros for calculating the phy timings
7  */
8 /* Period of one bit time in nano seconds */
9 #define DSI_TBIT_Factorized(Freq)    (((1000) * (1000))/(Freq))
10 #define DSI_TBIT(Freq)       (DSI_TBIT_Factorized(Freq)/(1000))
11 
12 //#define NV_MAX(a,b) (((a) > (b)) ? (a) : (b))
13 
14 /* Period of one byte time in nano seconds */
15 #define DSI_TBYTE(Freq)    ((DSI_TBIT_Factorized(Freq)) * (8))
16 #define DSI_PHY_TIMING_DIV(X, Freq) ((X*1000) / (DSI_TBYTE(Freq)))
17 
18 /*
19  * As per Mipi spec (minimum):
20  * (3 + MAX(8 * DSI_TBIT, 60 + 4 * DSI_TBIT) / DSI_TBYTE)
21  */
22 #define DSI_THSTRAIL_VAL(Freq) \
23      (MAX(((8) * (DSI_TBIT(Freq))), ((60) + ((4) * (DSI_TBIT(Freq))))))
24 
25 int mipi_dphy_set_timing(struct tegra_dsi *dsi);
26 
27 #endif
28