2 * Copyright (C) 2013 NVIDIA Corporation
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
9 #include <linux/errno.h>
10 #include <linux/kernel.h>
15 * Default D-PHY timings based on MIPI D-PHY specification. Derived from
16 * the valid ranges specified in Section 5.9 of the D-PHY specification
17 * with minor adjustments.
19 int mipi_dphy_timing_get_default(struct mipi_dphy_timing
*timing
,
23 timing
->clkpost
= 70 + 52 * period
;
25 timing
->clkprepare
= 65;
26 timing
->clksettle
= 95;
27 timing
->clktermen
= 0;
28 timing
->clktrail
= 80;
29 timing
->clkzero
= 260;
33 timing
->hsprepare
= 65 + 5 * period
;
34 timing
->hszero
= 145 + 5 * period
;
35 timing
->hssettle
= 85 + 6 * period
;
37 timing
->hstrail
= max(8 * period
, 60 + 4 * period
);
38 timing
->init
= 100000;
40 timing
->taget
= 5 * timing
->lpx
;
41 timing
->tago
= 4 * timing
->lpx
;
42 timing
->tasure
= 2 * timing
->lpx
;
43 timing
->wakeup
= 1000000;
49 * Validate D-PHY timing according to MIPI Alliance Specification for D-PHY,
50 * Section 5.9 "Global Operation Timing Parameters".
52 int mipi_dphy_timing_validate(struct mipi_dphy_timing
*timing
,
55 if (timing
->clkmiss
> 60)
58 if (timing
->clkpost
< (60 + 52 * period
))
61 if (timing
->clkpre
< 8)
64 if (timing
->clkprepare
< 38 || timing
->clkprepare
> 95)
67 if (timing
->clksettle
< 95 || timing
->clksettle
> 300)
70 if (timing
->clktermen
> 38)
73 if (timing
->clktrail
< 60)
76 if (timing
->clkprepare
+ timing
->clkzero
< 300)
79 if (timing
->dtermen
> 35 + 4 * period
)
82 if (timing
->eot
> 105 + 12 * period
)
85 if (timing
->hsexit
< 100)
88 if (timing
->hsprepare
< 40 + 4 * period
||
89 timing
->hsprepare
> 85 + 6 * period
)
92 if (timing
->hsprepare
+ timing
->hszero
< 145 + 10 * period
)
95 if ((timing
->hssettle
< 85 + 6 * period
) ||
96 (timing
->hssettle
> 145 + 10 * period
))
99 if (timing
->hsskip
< 40 || timing
->hsskip
> 55 + 4 * period
)
102 if (timing
->hstrail
< max(8 * period
, 60 + 4 * period
))
105 if (timing
->init
< 100000)
108 if (timing
->lpx
< 50)
111 if (timing
->taget
!= 5 * timing
->lpx
)
114 if (timing
->tago
!= 4 * timing
->lpx
)
117 if (timing
->tasure
< timing
->lpx
|| timing
->tasure
> 2 * timing
->lpx
)
120 if (timing
->wakeup
< 1000000)
This page took 0.044984 seconds and 5 git commands to generate.