1/*
2 * Copyright 2006-2015, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *      Axel D��rfler, axeld@pinc-software.de
7 *      Alexander von Gluck IV, kallisti5@unixzen.com
8 */
9#ifndef INTEL_EXTREME_PLL_H
10#define INTEL_EXTREME_PLL_H
11
12
13#include "intel_extreme.h"
14
15
16struct pll_divisors {
17	uint32  p;
18	uint32  p1;
19	uint32  p2;
20	uint32  n;
21	uint32  m;
22	uint32  m1;
23	uint32  m2;
24};
25
26struct pll_limits {
27	pll_divisors    min;
28	pll_divisors    max;
29	uint32			dot_limit;
30	uint32          min_vco;
31	uint32          max_vco;
32};
33
34struct skl_wrpll_params {
35	uint32 dco_fraction;
36	uint32 dco_integer;
37	uint32 qdiv_ratio;
38	uint32 qdiv_mode;
39	uint32 kdiv;
40	uint32 pdiv;
41	uint32 central_freq;
42};
43
44bool valid_pll_divisors(pll_divisors* divisors, pll_limits* limits);
45void compute_pll_divisors(display_timing* current, pll_divisors* divisors,
46	bool isLVDS);
47
48void refclk_activate_ilk(bool hasPanel);
49
50void hsw_ddi_calculate_wrpll(int clock /* in Hz */,
51			unsigned *r2_out, unsigned *n2_out, unsigned *p_out);
52bool skl_ddi_calculate_wrpll(int clock /* in Hz */,
53			int ref_clock, struct skl_wrpll_params *wrpll_params);
54
55#endif /* INTEL_EXTREME_PLL_H */
56