xref: /openbmc/linux/include/drm/bridge/dw_hdmi.h (revision aac5987a)
1 /*
2  * Copyright (C) 2011 Freescale Semiconductor, Inc.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  */
9 
10 #ifndef __DW_HDMI__
11 #define __DW_HDMI__
12 
13 #include <drm/drmP.h>
14 
15 struct dw_hdmi;
16 
17 enum {
18 	DW_HDMI_RES_8,
19 	DW_HDMI_RES_10,
20 	DW_HDMI_RES_12,
21 	DW_HDMI_RES_MAX,
22 };
23 
24 enum dw_hdmi_devtype {
25 	IMX6Q_HDMI,
26 	IMX6DL_HDMI,
27 	RK3288_HDMI,
28 };
29 
30 enum dw_hdmi_phy_type {
31 	DW_HDMI_PHY_DWC_HDMI_TX_PHY = 0x00,
32 	DW_HDMI_PHY_DWC_MHL_PHY_HEAC = 0xb2,
33 	DW_HDMI_PHY_DWC_MHL_PHY = 0xc2,
34 	DW_HDMI_PHY_DWC_HDMI_3D_TX_PHY_HEAC = 0xe2,
35 	DW_HDMI_PHY_DWC_HDMI_3D_TX_PHY = 0xf2,
36 	DW_HDMI_PHY_DWC_HDMI20_TX_PHY = 0xf3,
37 	DW_HDMI_PHY_VENDOR_PHY = 0xfe,
38 };
39 
40 struct dw_hdmi_mpll_config {
41 	unsigned long mpixelclock;
42 	struct {
43 		u16 cpce;
44 		u16 gmp;
45 	} res[DW_HDMI_RES_MAX];
46 };
47 
48 struct dw_hdmi_curr_ctrl {
49 	unsigned long mpixelclock;
50 	u16 curr[DW_HDMI_RES_MAX];
51 };
52 
53 struct dw_hdmi_phy_config {
54 	unsigned long mpixelclock;
55 	u16 sym_ctr;    /*clock symbol and transmitter control*/
56 	u16 term;       /*transmission termination value*/
57 	u16 vlev_ctr;   /* voltage level control */
58 };
59 
60 struct dw_hdmi_plat_data {
61 	enum dw_hdmi_devtype dev_type;
62 	const struct dw_hdmi_mpll_config *mpll_cfg;
63 	const struct dw_hdmi_curr_ctrl *cur_ctr;
64 	const struct dw_hdmi_phy_config *phy_config;
65 	enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
66 					   struct drm_display_mode *mode);
67 };
68 
69 int dw_hdmi_probe(struct platform_device *pdev,
70 		  const struct dw_hdmi_plat_data *plat_data);
71 void dw_hdmi_remove(struct platform_device *pdev);
72 void dw_hdmi_unbind(struct device *dev);
73 int dw_hdmi_bind(struct platform_device *pdev, struct drm_encoder *encoder,
74 		 const struct dw_hdmi_plat_data *plat_data);
75 
76 void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate);
77 void dw_hdmi_audio_enable(struct dw_hdmi *hdmi);
78 void dw_hdmi_audio_disable(struct dw_hdmi *hdmi);
79 
80 #endif /* __IMX_HDMI_H__ */
81