Lines Matching +full:mipi +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0-only
9 #include "mipi-phy.h"
12 * Default D-PHY timings based on MIPI D-PHY specification. Derived from the
13 * valid ranges specified in Section 6.9, Table 14, Page 40 of the D-PHY
19 timing->clkmiss = 0; in mipi_dphy_timing_get_default()
20 timing->clkpost = 70 + 52 * period; in mipi_dphy_timing_get_default()
21 timing->clkpre = 8; in mipi_dphy_timing_get_default()
22 timing->clkprepare = 65; in mipi_dphy_timing_get_default()
23 timing->clksettle = 95; in mipi_dphy_timing_get_default()
24 timing->clktermen = 0; in mipi_dphy_timing_get_default()
25 timing->clktrail = 80; in mipi_dphy_timing_get_default()
26 timing->clkzero = 260; in mipi_dphy_timing_get_default()
27 timing->dtermen = 0; in mipi_dphy_timing_get_default()
28 timing->eot = 0; in mipi_dphy_timing_get_default()
29 timing->hsexit = 120; in mipi_dphy_timing_get_default()
30 timing->hsprepare = 65 + 5 * period; in mipi_dphy_timing_get_default()
31 timing->hszero = 145 + 5 * period; in mipi_dphy_timing_get_default()
32 timing->hssettle = 85 + 6 * period; in mipi_dphy_timing_get_default()
33 timing->hsskip = 40; in mipi_dphy_timing_get_default()
36 * The MIPI D-PHY specification (Section 6.9, v1.2, Table 14, Page 40) in mipi_dphy_timing_get_default()
39 * T_HS-TRAIL = max(n * 8 * period, 60 + n * 4 * period) in mipi_dphy_timing_get_default()
41 * where n = 1 for forward-direction HS mode and n = 4 for reverse- in mipi_dphy_timing_get_default()
42 * direction HS mode. There's only one setting and this function does in mipi_dphy_timing_get_default()
44 * assumes that reverse-direction HS mode is supported and uses n = 4. in mipi_dphy_timing_get_default()
46 timing->hstrail = max(4 * 8 * period, 60 + 4 * 4 * period); in mipi_dphy_timing_get_default()
48 timing->init = 100000; in mipi_dphy_timing_get_default()
49 timing->lpx = 60; in mipi_dphy_timing_get_default()
50 timing->taget = 5 * timing->lpx; in mipi_dphy_timing_get_default()
51 timing->tago = 4 * timing->lpx; in mipi_dphy_timing_get_default()
52 timing->tasure = 2 * timing->lpx; in mipi_dphy_timing_get_default()
53 timing->wakeup = 1000000; in mipi_dphy_timing_get_default()
59 * Validate D-PHY timing according to MIPI D-PHY specification (v1.2, Section
65 if (timing->clkmiss > 60) in mipi_dphy_timing_validate()
66 return -EINVAL; in mipi_dphy_timing_validate()
68 if (timing->clkpost < (60 + 52 * period)) in mipi_dphy_timing_validate()
69 return -EINVAL; in mipi_dphy_timing_validate()
71 if (timing->clkpre < 8) in mipi_dphy_timing_validate()
72 return -EINVAL; in mipi_dphy_timing_validate()
74 if (timing->clkprepare < 38 || timing->clkprepare > 95) in mipi_dphy_timing_validate()
75 return -EINVAL; in mipi_dphy_timing_validate()
77 if (timing->clksettle < 95 || timing->clksettle > 300) in mipi_dphy_timing_validate()
78 return -EINVAL; in mipi_dphy_timing_validate()
80 if (timing->clktermen > 38) in mipi_dphy_timing_validate()
81 return -EINVAL; in mipi_dphy_timing_validate()
83 if (timing->clktrail < 60) in mipi_dphy_timing_validate()
84 return -EINVAL; in mipi_dphy_timing_validate()
86 if (timing->clkprepare + timing->clkzero < 300) in mipi_dphy_timing_validate()
87 return -EINVAL; in mipi_dphy_timing_validate()
89 if (timing->dtermen > 35 + 4 * period) in mipi_dphy_timing_validate()
90 return -EINVAL; in mipi_dphy_timing_validate()
92 if (timing->eot > 105 + 12 * period) in mipi_dphy_timing_validate()
93 return -EINVAL; in mipi_dphy_timing_validate()
95 if (timing->hsexit < 100) in mipi_dphy_timing_validate()
96 return -EINVAL; in mipi_dphy_timing_validate()
98 if (timing->hsprepare < 40 + 4 * period || in mipi_dphy_timing_validate()
99 timing->hsprepare > 85 + 6 * period) in mipi_dphy_timing_validate()
100 return -EINVAL; in mipi_dphy_timing_validate()
102 if (timing->hsprepare + timing->hszero < 145 + 10 * period) in mipi_dphy_timing_validate()
103 return -EINVAL; in mipi_dphy_timing_validate()
105 if ((timing->hssettle < 85 + 6 * period) || in mipi_dphy_timing_validate()
106 (timing->hssettle > 145 + 10 * period)) in mipi_dphy_timing_validate()
107 return -EINVAL; in mipi_dphy_timing_validate()
109 if (timing->hsskip < 40 || timing->hsskip > 55 + 4 * period) in mipi_dphy_timing_validate()
110 return -EINVAL; in mipi_dphy_timing_validate()
112 if (timing->hstrail < max(8 * period, 60 + 4 * period)) in mipi_dphy_timing_validate()
113 return -EINVAL; in mipi_dphy_timing_validate()
115 if (timing->init < 100000) in mipi_dphy_timing_validate()
116 return -EINVAL; in mipi_dphy_timing_validate()
118 if (timing->lpx < 50) in mipi_dphy_timing_validate()
119 return -EINVAL; in mipi_dphy_timing_validate()
121 if (timing->taget != 5 * timing->lpx) in mipi_dphy_timing_validate()
122 return -EINVAL; in mipi_dphy_timing_validate()
124 if (timing->tago != 4 * timing->lpx) in mipi_dphy_timing_validate()
125 return -EINVAL; in mipi_dphy_timing_validate()
127 if (timing->tasure < timing->lpx || timing->tasure > 2 * timing->lpx) in mipi_dphy_timing_validate()
128 return -EINVAL; in mipi_dphy_timing_validate()
130 if (timing->wakeup < 1000000) in mipi_dphy_timing_validate()
131 return -EINVAL; in mipi_dphy_timing_validate()