drm: bridge: dw-hdmi: remove the function is_rockchip
[firefly-linux-kernel-4.4.55.git] / include / drm / bridge / dw_hdmi.h
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         RK3368_HDMI,
29         RK3399_HDMI,
30 };
31
32 struct dw_hdmi_audio_tmds_n {
33         unsigned long tmds;
34         unsigned int n_32k;
35         unsigned int n_44k1;
36         unsigned int n_48k;
37 };
38
39 enum dw_hdmi_phy_type {
40         DW_HDMI_PHY_DWC_HDMI_TX_PHY = 0x00,
41         DW_HDMI_PHY_DWC_MHL_PHY_HEAC = 0xb2,
42         DW_HDMI_PHY_DWC_MHL_PHY = 0xc2,
43         DW_HDMI_PHY_DWC_HDMI_3D_TX_PHY_HEAC = 0xe2,
44         DW_HDMI_PHY_DWC_HDMI_3D_TX_PHY = 0xf2,
45         DW_HDMI_PHY_DWC_HDMI20_TX_PHY = 0xf3,
46         DW_HDMI_PHY_VENDOR_PHY = 0xfe,
47 };
48
49 struct dw_hdmi_mpll_config {
50         unsigned long mpixelclock;
51         struct {
52                 u16 cpce;
53                 u16 gmp;
54         } res[DW_HDMI_RES_MAX];
55 };
56
57 struct dw_hdmi_curr_ctrl {
58         unsigned long mpixelclock;
59         u16 curr[DW_HDMI_RES_MAX];
60 };
61
62 struct dw_hdmi_phy_config {
63         unsigned long mpixelclock;
64         u16 sym_ctr;    /*clock symbol and transmitter control*/
65         u16 term;       /*transmission termination value*/
66         u16 vlev_ctr;   /* voltage level control */
67 };
68
69 struct dw_hdmi_phy_ops {
70         int (*init)(struct dw_hdmi *hdmi, void *data,
71                     struct drm_display_mode *mode);
72         void (*disable)(struct dw_hdmi *hdmi, void *data);
73         enum drm_connector_status (*read_hpd)(struct dw_hdmi *hdmi, void *data);
74 };
75
76 struct dw_hdmi_plat_data {
77         enum dw_hdmi_devtype dev_type;
78         const struct dw_hdmi_audio_tmds_n *tmds_n_table;
79         enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
80                                            struct drm_display_mode *mode);
81         /* Vendor PHY support */
82         const struct dw_hdmi_phy_ops *phy_ops;
83         const char *phy_name;
84         void *phy_data;
85
86         /* Synopsys PHY support */
87         const struct dw_hdmi_mpll_config *mpll_cfg;
88         const struct dw_hdmi_curr_ctrl *cur_ctr;
89         const struct dw_hdmi_phy_config *phy_config;
90         int (*configure_phy)(struct dw_hdmi *hdmi,
91                              const struct dw_hdmi_plat_data *pdata,
92                              unsigned long mpixelclock);
93 };
94
95 void dw_hdmi_unbind(struct device *dev, struct device *master, void *data);
96 int dw_hdmi_bind(struct device *dev, struct device *master,
97                  void *data, struct drm_encoder *encoder,
98                  struct resource *iores, int irq,
99                  const struct dw_hdmi_plat_data *plat_data);
100 void dw_hdmi_suspend(struct device *dev);
101 void dw_hdmi_resume(struct device *dev);
102
103 void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate);
104 void dw_hdmi_audio_enable(struct dw_hdmi *hdmi);
105 void dw_hdmi_audio_disable(struct dw_hdmi *hdmi);
106
107 /* PHY configuration */
108 void dw_hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data,
109                            unsigned char addr);
110
111 #endif /* __IMX_HDMI_H__ */