sti_hdmi.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright (C) STMicroelectronics SA 2014
  3. * Author: Vincent Abriou <vincent.abriou@st.com> for STMicroelectronics.
  4. * License terms: GNU General Public License (GPL), version 2
  5. */
  6. #ifndef _STI_HDMI_H_
  7. #define _STI_HDMI_H_
  8. #include <linux/platform_device.h>
  9. #include <drm/drmP.h>
  10. #define HDMI_STA 0x0010
  11. #define HDMI_STA_DLL_LCK BIT(5)
  12. #define HDMI_STA_HOT_PLUG_SHIFT 4
  13. #define HDMI_STA_HOT_PLUG (1 << HDMI_STA_HOT_PLUG_SHIFT)
  14. struct sti_hdmi;
  15. struct hdmi_phy_ops {
  16. bool (*start)(struct sti_hdmi *hdmi);
  17. void (*stop)(struct sti_hdmi *hdmi);
  18. };
  19. /**
  20. * STI hdmi structure
  21. *
  22. * @dev: driver device
  23. * @drm_dev: pointer to drm device
  24. * @mode: current display mode selected
  25. * @regs: hdmi register
  26. * @syscfg: syscfg register for pll rejection configuration
  27. * @clk_pix: hdmi pixel clock
  28. * @clk_tmds: hdmi tmds clock
  29. * @clk_phy: hdmi phy clock
  30. * @clk_audio: hdmi audio clock
  31. * @irq: hdmi interrupt number
  32. * @irq_status: interrupt status register
  33. * @phy_ops: phy start/stop operations
  34. * @enabled: true if hdmi is enabled else false
  35. * @hpd: hot plug detect status
  36. * @wait_event: wait event
  37. * @event_received: wait event status
  38. * @reset: reset control of the hdmi phy
  39. */
  40. struct sti_hdmi {
  41. struct device dev;
  42. struct drm_device *drm_dev;
  43. struct drm_display_mode mode;
  44. void __iomem *regs;
  45. void __iomem *syscfg;
  46. struct clk *clk_pix;
  47. struct clk *clk_tmds;
  48. struct clk *clk_phy;
  49. struct clk *clk_audio;
  50. int irq;
  51. u32 irq_status;
  52. struct hdmi_phy_ops *phy_ops;
  53. bool enabled;
  54. bool hpd;
  55. wait_queue_head_t wait_event;
  56. bool event_received;
  57. struct reset_control *reset;
  58. struct i2c_adapter *ddc_adapt;
  59. };
  60. u32 hdmi_read(struct sti_hdmi *hdmi, int offset);
  61. void hdmi_write(struct sti_hdmi *hdmi, u32 val, int offset);
  62. /**
  63. * hdmi phy config structure
  64. *
  65. * A pointer to an array of these structures is passed to a TMDS (HDMI) output
  66. * via the control interface to provide board and SoC specific
  67. * configurations of the HDMI PHY. Each entry in the array specifies a hardware
  68. * specific configuration for a given TMDS clock frequency range.
  69. *
  70. * @min_tmds_freq: Lower bound of TMDS clock frequency this entry applies to
  71. * @max_tmds_freq: Upper bound of TMDS clock frequency this entry applies to
  72. * @config: SoC specific register configuration
  73. */
  74. struct hdmi_phy_config {
  75. u32 min_tmds_freq;
  76. u32 max_tmds_freq;
  77. u32 config[4];
  78. };
  79. #endif