• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2007-2019 Allwinnertech Co., Ltd.
3  * Author: zhengwanyu <zhengwanyu@allwinnertech.com>
4  *
5  * This software is licensed under the terms of the GNU General Public
6  * License version 2, as published by the Free Software Foundation, and
7  * may be copied, distributed, and modified under those terms.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  */
15 #ifndef _SUNXI_HDMI14_H_
16 #define _SUNXI_HDMI14_H_
17 
18 #include <linux/delay.h>
19 #include <linux/of_address.h>
20 #include <linux/of_device.h>
21 #include <linux/of_platform.h>
22 #include <linux/dma-mapping.h>
23 #include <drm/drmP.h>
24 #include <linux/clk.h>
25 
26 #include <video/sunxi_display2.h>
27 
28 #include "hdmi_bsp.h"
29 #include "sunxi_common.h"
30 #include "sunxi_hdmi.h"
31 
32 #define Abort_Current_Operation             0
33 #define Special_Offset_Address_Read         1
34 #define Explicit_Offset_Address_Write       2
35 #define Implicit_Offset_Address_Write       3
36 #define Explicit_Offset_Address_Read        4
37 #define Implicit_Offset_Address_Read        5
38 #define Explicit_Offset_Address_E_DDC_Read  6
39 #define Implicit_Offset_Address_E_DDC_Read  7
40 
41 #define HDMI1440_480I 6
42 #define HDMI1440_576I 21
43 #define HDMI480P 2
44 #define HDMI576P 17
45 #define HDMI720P_50 19
46 #define HDMI720P_60 4
47 #define HDMI1080I_50 20
48 #define HDMI1080I_60 5
49 #define HDMI1080P_50 31
50 #define HDMI1080P_60 16
51 #define HDMI1080P_24 32
52 #define HDMI1080P_25 33
53 #define HDMI1080P_30 34
54 #define HDMI1080P_24_3D_FP (HDMI1080P_24 + 0x80)
55 #define HDMI720P_50_3D_FP (HDMI720P_50 + 0x80)
56 #define HDMI720P_60_3D_FP (HDMI720P_60 + 0x80)
57 #define HDMI3840_2160P_30 (0x01 + 0x100)
58 #define HDMI3840_2160P_25 (0x02 + 0x100)
59 #define HDMI3840_2160P_24 (0x03 + 0x100)
60 #define HDMI4096_2160P_24 (0x04 + 0x100)
61 
62 /**
63  * sunxi_hdmi device class
64  */
65 struct sunxi_hdmi {
66 	struct platform_device *pdev;
67 
68 	/*sunxi hdmi virtual address*/
69 	void __iomem *reg_base;
70 
71 	/*hdmi clk in ccmu*/
72 	struct clk *mclk;
73 	/*hdmi's parent clk in ccmu*/
74 	struct clk *mclk_parent;
75 
76 	/*hdmi ddc clk in ccmu*/
77 	struct clk *ddc_clk;
78 
79 	/*hdmi cec clk in ccmu*/
80 	struct clk *cec_clk;
81 
82 	/*name of axp power*/
83 	const char *power;
84 
85 	struct audio_para audio;
86 	struct video_para video;
87 
88 	struct disp_video_timings *video_info;
89 
90 	const struct sunxi_hdmi_funcs *funcs;
91 };
92 
93 int __init sunxi_hdmi_module_init(void);
94 void __exit sunxi_hdmi_module_exit(void);
95 
96 struct sunxi_hdmi_funcs *sunxi_hdmi_get_funcs(void);
97 extern unsigned int __clk_get_enable_count(struct clk *clk);
98 #define HDMI_INFO(fmt, arg...)   DRM_INFO("[SUNXI-HDMI]"fmt, ##arg)
99 #define HDMI_ERR(fmt, arg...)   DRM_ERROR("%s()%d - "fmt, __func__, __LINE__, ##arg)
100 #endif
101