sti_hdmi.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. struct sti_hdmi;
  13. struct hdmi_phy_ops {
  14. bool (*start)(struct sti_hdmi *hdmi);
  15. void (*stop)(struct sti_hdmi *hdmi);
  16. };
  17. /**
  18. * STI hdmi structure
  19. *
  20. * @dev: driver device
  21. * @drm_dev: pointer to drm device
  22. * @mode: current display mode selected
  23. * @regs: hdmi register
  24. * @syscfg: syscfg register for pll rejection configuration
  25. * @clk_pix: hdmi pixel clock
  26. * @clk_tmds: hdmi tmds clock
  27. * @clk_phy: hdmi phy clock
  28. * @clk_audio: hdmi audio clock
  29. * @irq: hdmi interrupt number
  30. * @irq_status: interrupt status register
  31. * @phy_ops: phy start/stop operations
  32. * @enabled: true if hdmi is enabled else false
  33. * @hpd_gpio: hdmi hot plug detect gpio number
  34. * @hpd: hot plug detect status
  35. * @wait_event: wait event
  36. * @event_received: wait event status
  37. * @reset: reset control of the hdmi phy
  38. */
  39. struct sti_hdmi {
  40. struct device dev;
  41. struct drm_device *drm_dev;
  42. struct drm_display_mode mode;
  43. void __iomem *regs;
  44. void __iomem *syscfg;
  45. struct clk *clk_pix;
  46. struct clk *clk_tmds;
  47. struct clk *clk_phy;
  48. struct clk *clk_audio;
  49. int irq;
  50. u32 irq_status;
  51. struct hdmi_phy_ops *phy_ops;
  52. bool enabled;
  53. int hpd_gpio;
  54. bool hpd;
  55. wait_queue_head_t wait_event;
  56. bool event_received;
  57. struct reset_control *reset;
  58. };
  59. u32 hdmi_read(struct sti_hdmi *hdmi, int offset);
  60. void hdmi_write(struct sti_hdmi *hdmi, u32 val, int offset);
  61. /**
  62. * hdmi phy config structure
  63. *
  64. * A pointer to an array of these structures is passed to a TMDS (HDMI) output
  65. * via the control interface to provide board and SoC specific
  66. * configurations of the HDMI PHY. Each entry in the array specifies a hardware
  67. * specific configuration for a given TMDS clock frequency range.
  68. *
  69. * @min_tmds_freq: Lower bound of TMDS clock frequency this entry applies to
  70. * @max_tmds_freq: Upper bound of TMDS clock frequency this entry applies to
  71. * @config: SoC specific register configuration
  72. */
  73. struct hdmi_phy_config {
  74. u32 min_tmds_freq;
  75. u32 max_tmds_freq;
  76. u32 config[4];
  77. };
  78. #endif