1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2018 MediaTek Inc.
4  * Author: Chunhui Dai <chunhui.dai@mediatek.com>
5  */
6 
7 #ifndef _MTK_HDMI_PHY_H
8 #define _MTK_HDMI_PHY_H
9 #include <linux/clk.h>
10 #include <linux/clk-provider.h>
11 #include <linux/delay.h>
12 #include <linux/mfd/syscon.h>
13 #include <linux/module.h>
14 #include <linux/of_device.h>
15 #include <linux/phy/phy.h>
16 #include <linux/platform_device.h>
17 #include <linux/types.h>
18 
19 struct mtk_hdmi_phy;
20 
21 struct mtk_hdmi_phy_conf {
22 	unsigned long flags;
23 	bool pll_default_off;
24 	const struct clk_ops *hdmi_phy_clk_ops;
25 	void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
26 	void (*hdmi_phy_disable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
27 	int (*hdmi_phy_configure)(struct phy *phy, union phy_configure_opts *opts);
28 };
29 
30 struct mtk_hdmi_phy {
31 	void __iomem *regs;
32 	struct device *dev;
33 	struct mtk_hdmi_phy_conf *conf;
34 	struct clk *pll;
35 	struct clk_hw pll_hw;
36 	unsigned long pll_rate;
37 	unsigned char drv_imp_clk;
38 	unsigned char drv_imp_d2;
39 	unsigned char drv_imp_d1;
40 	unsigned char drv_imp_d0;
41 	unsigned int ibias;
42 	unsigned int ibias_up;
43 	bool tmds_over_340M;
44 };
45 
46 struct mtk_hdmi_phy *to_mtk_hdmi_phy(struct clk_hw *hw);
47 
48 extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_8195_conf;
49 extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_8173_conf;
50 extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf;
51 
52 #endif /* _MTK_HDMI_PHY_H */
53