drm/bridge: dw_hdmi: clear ih_mute register when system resume
[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         RK3399_HDMI,
29 };
30
31 struct dw_hdmi_audio_tmds_n {
32         unsigned long tmds;
33         unsigned int n_32k;
34         unsigned int n_44k1;
35         unsigned int n_48k;
36 };
37
38 struct dw_hdmi_mpll_config {
39         unsigned long mpixelclock;
40         struct {
41                 u16 cpce;
42                 u16 gmp;
43         } res[DW_HDMI_RES_MAX];
44 };
45
46 struct dw_hdmi_curr_ctrl {
47         unsigned long mpixelclock;
48         u16 curr[DW_HDMI_RES_MAX];
49 };
50
51 struct dw_hdmi_phy_config {
52         unsigned long mpixelclock;
53         u16 sym_ctr;    /*clock symbol and transmitter control*/
54         u16 term;       /*transmission termination value*/
55         u16 vlev_ctr;   /* voltage level control */
56 };
57
58 struct dw_hdmi_plat_data {
59         enum dw_hdmi_devtype dev_type;
60         const struct dw_hdmi_audio_tmds_n *tmds_n_table;
61         const struct dw_hdmi_mpll_config *mpll_cfg;
62         const struct dw_hdmi_curr_ctrl *cur_ctr;
63         const struct dw_hdmi_phy_config *phy_config;
64         enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
65                                            struct drm_display_mode *mode);
66 };
67
68 static inline bool is_rockchip(enum dw_hdmi_devtype dev_type)
69 {
70         return dev_type == RK3288_HDMI || dev_type == RK3399_HDMI;
71 }
72
73 void dw_hdmi_unbind(struct device *dev, struct device *master, void *data);
74 int dw_hdmi_bind(struct device *dev, struct device *master,
75                  void *data, struct drm_encoder *encoder,
76                  struct resource *iores, int irq,
77                  const struct dw_hdmi_plat_data *plat_data);
78 void dw_hdmi_suspend(struct device *dev);
79 void dw_hdmi_resume(struct device *dev);
80
81 void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate);
82 void dw_hdmi_audio_enable(struct dw_hdmi *hdmi);
83 void dw_hdmi_audio_disable(struct dw_hdmi *hdmi);
84
85 #endif /* __IMX_HDMI_H__ */