1/*
2 * Copyright 2011-2015, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Michael Lotz, mmlr@mlotz.ch
7 *		Alexander von Gluck IV, kallisti5@unixzen.com
8 */
9#ifndef INTEL_PIPE_H
10#define INTEL_PIPE_H
11
12
13#include <edid.h>
14
15#include "intel_extreme.h"
16
17#include "pll.h"
18#include "FlexibleDisplayInterface.h"
19#include "PanelFitter.h"
20
21
22#define MAX_PIPES	4	// not all cards have this much though
23
24
25void program_pipe_color_modes(uint32 colorMode);
26
27//class FDILink;
28//class PanelFitter;
29
30class Pipe {
31public:
32									Pipe(pipe_index pipeIndex);
33									~Pipe();
34
35		pipe_index					Index()
36										{ return fPipeIndex; }
37
38		bool						IsEnabled();
39		void						Enable(bool enable);
40		void						Disable();
41
42		void						Configure(display_mode* mode);
43		status_t					SetFDILink(
44										const display_timing& timing,
45										uint32 linkBandwidth,
46										uint32 lanes,
47										uint32 bitsPerPixel);
48		void						ConfigureScalePos(display_mode* mode);
49		void						ConfigureTimings(display_mode* mode,
50										bool hardware = true,
51										port_index portIndex = INTEL_PORT_ANY);
52		void						ConfigureClocks(
53										const pll_divisors& divisors,
54										uint32 pixelClock,
55										uint32 extraFlags);
56		void						ConfigureClocksSKL(
57										const skl_wrpll_params& wrpll_params,
58										uint32 pixelClock,
59										port_index pllForPort,
60										uint32* pllSel);
61
62		// access to the various parts of the pipe
63		::FDILink*					FDI()
64										{ return fFDILink; }
65		::PanelFitter*				PFT()
66										{ return fPanelFitter; }
67
68private:
69		void						_ConfigureTranscoder(display_mode* mode);
70
71		bool						fHasTranscoder;
72
73		FDILink*					fFDILink;
74		PanelFitter*				fPanelFitter;
75
76		pipe_index					fPipeIndex;
77
78		addr_t						fPipeOffset;
79		addr_t						fPlaneOffset;
80};
81
82
83#endif // INTEL_PIPE_H
84