mtk_hdmi_phy.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (c) 2018 MediaTek Inc.
  4. * Author: Chunhui Dai <chunhui.dai@mediatek.com>
  5. */
  6. #ifndef _MTK_HDMI_PHY_H
  7. #define _MTK_HDMI_PHY_H
  8. #include <linux/clk.h>
  9. #include <linux/clk-provider.h>
  10. #include <linux/delay.h>
  11. #include <linux/io.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. struct mtk_hdmi_phy;
  19. struct mtk_hdmi_phy_conf {
  20. bool tz_disabled;
  21. const struct clk_ops *hdmi_phy_clk_ops;
  22. void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
  23. void (*hdmi_phy_disable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
  24. };
  25. struct mtk_hdmi_phy {
  26. void __iomem *regs;
  27. struct device *dev;
  28. struct mtk_hdmi_phy_conf *conf;
  29. struct clk *pll;
  30. struct clk_hw pll_hw;
  31. unsigned long pll_rate;
  32. unsigned char drv_imp_clk;
  33. unsigned char drv_imp_d2;
  34. unsigned char drv_imp_d1;
  35. unsigned char drv_imp_d0;
  36. unsigned int ibias;
  37. unsigned int ibias_up;
  38. };
  39. void mtk_hdmi_phy_clear_bits(struct mtk_hdmi_phy *hdmi_phy, u32 offset,
  40. u32 bits);
  41. void mtk_hdmi_phy_set_bits(struct mtk_hdmi_phy *hdmi_phy, u32 offset,
  42. u32 bits);
  43. void mtk_hdmi_phy_mask(struct mtk_hdmi_phy *hdmi_phy, u32 offset,
  44. u32 val, u32 mask);
  45. struct mtk_hdmi_phy *to_mtk_hdmi_phy(struct clk_hw *hw);
  46. long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate,
  47. unsigned long *parent_rate);
  48. unsigned long mtk_hdmi_pll_recalc_rate(struct clk_hw *hw,
  49. unsigned long parent_rate);
  50. extern struct platform_driver mtk_hdmi_phy_driver;
  51. extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_8173_conf;
  52. extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf;
  53. #endif /* _MTK_HDMI_PHY_H */