1 /* SPDX-License-Identifier: GPL-2.0+
2  *
3  * Copyright (c) 2017 FriendlyARM (www.arm9.net)
4  *
5  * Copyright (c) 2010 Samsung Electronics Co., Ltd.
6  *              http://www.samsung.com/
7  *
8  * Header file for NXP Display Driver
9  */
10 
11 #ifndef __MACH_NXP_FB_H__
12 #define __MACH_NXP_FB_H__
13 
14 /*
15  * struct nxp_lcd_polarity
16  * @rise_vclk:	if 1, video data is fetched at rising edge
17  * @inv_hsync:	if HSYNC polarity is inversed
18  * @inv_vsync:	if VSYNC polarity is inversed
19  * @inv_vden:	if VDEN polarity is inversed
20  */
21 struct nxp_lcd_polarity {
22 	int	rise_vclk;
23 	int	inv_hsync;
24 	int	inv_vsync;
25 	int	inv_vden;
26 };
27 
28 /*
29  * struct nxp_lcd_timing
30  * @h_fp:	horizontal front porch
31  * @h_bp:	horizontal back porch
32  * @h_sw:	horizontal sync width
33  * @v_fp:	vertical front porch
34  * @v_fpe:	vertical front porch for even field
35  * @v_bp:	vertical back porch
36  * @v_bpe:	vertical back porch for even field
37  */
38 struct nxp_lcd_timing {
39 	int	h_fp;
40 	int	h_bp;
41 	int	h_sw;
42 	int	v_fp;
43 	int	v_fpe;
44 	int	v_bp;
45 	int	v_bpe;
46 	int	v_sw;
47 };
48 
49 /*
50  * struct nxp_lcd
51  * @width:		horizontal resolution
52  * @height:		vertical resolution
53  * @p_width:	width of lcd in mm
54  * @p_height:	height of lcd in mm
55  * @bpp:		bits per pixel
56  * @freq:		vframe frequency
57  * @timing:		timing values
58  * @polarity:	polarity settings
59  * @gpio_init:	pointer to GPIO init function
60  *
61  */
62 struct nxp_lcd {
63 	int	width;
64 	int	height;
65 	int	p_width;
66 	int	p_height;
67 	int	bpp;
68 	int	freq;
69 	struct	nxp_lcd_timing timing;
70 	struct	nxp_lcd_polarity polarity;
71 	void	(*gpio_init)(void);
72 };
73 
74 /**
75  * Public interfaces
76  */
77 enum lcd_format {
78 	LCD_VESA	= 0,
79 	LCD_JEIDA	= 1,
80 	LCD_LOC		= 2,
81 
82 	LCD_RGB		= 4,
83 	LCD_HDMI	= 5,
84 };
85 
86 extern int bd_setup_lcd_by_id(int id);
87 extern int bd_setup_lcd_by_name(char *name);
88 extern struct nxp_lcd *bd_get_lcd(void);
89 extern const char *bd_get_lcd_name(void);
90 extern int bd_get_lcd_density(void);
91 extern enum lcd_format bd_get_lcd_format(void);
92 extern int bd_fixup_lcd_fdt(void *blob, struct nxp_lcd *cfg);
93 
94 #endif /* __MACH_NXP_FB_H__ */
95