cdn-dp-core.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2016 Chris Zhong <zyw@rock-chips.com>
  4. * Copyright (C) 2016 ROCKCHIP, Inc.
  5. */
  6. #ifndef _CDN_DP_CORE_H
  7. #define _CDN_DP_CORE_H
  8. #include <drm/drm_dp_helper.h>
  9. #include <drm/drm_panel.h>
  10. #include <drm/drm_probe_helper.h>
  11. #include "rockchip_drm_drv.h"
  12. #define MAX_PHY 2
  13. enum audio_format {
  14. AFMT_I2S = 0,
  15. AFMT_SPDIF = 1,
  16. AFMT_UNUSED,
  17. };
  18. struct audio_info {
  19. enum audio_format format;
  20. int sample_rate;
  21. int channels;
  22. int sample_width;
  23. };
  24. enum vic_pxl_encoding_format {
  25. PXL_RGB = 0x1,
  26. YCBCR_4_4_4 = 0x2,
  27. YCBCR_4_2_2 = 0x4,
  28. YCBCR_4_2_0 = 0x8,
  29. Y_ONLY = 0x10,
  30. };
  31. struct video_info {
  32. bool h_sync_polarity;
  33. bool v_sync_polarity;
  34. bool interlaced;
  35. int color_depth;
  36. enum vic_pxl_encoding_format color_fmt;
  37. };
  38. struct cdn_firmware_header {
  39. u32 size_bytes; /* size of the entire header+image(s) in bytes */
  40. u32 header_size; /* size of just the header in bytes */
  41. u32 iram_size; /* size of iram */
  42. u32 dram_size; /* size of dram */
  43. };
  44. struct cdn_dp_port {
  45. struct cdn_dp_device *dp;
  46. struct notifier_block event_nb;
  47. struct extcon_dev *extcon;
  48. struct phy *phy;
  49. u8 lanes;
  50. bool phy_enabled;
  51. u8 id;
  52. };
  53. struct cdn_dp_device {
  54. struct device *dev;
  55. struct drm_device *drm_dev;
  56. struct drm_connector connector;
  57. struct drm_encoder encoder;
  58. struct drm_display_mode mode;
  59. struct platform_device *audio_pdev;
  60. struct work_struct event_work;
  61. struct edid *edid;
  62. struct mutex lock;
  63. bool connected;
  64. bool active;
  65. bool suspended;
  66. const struct firmware *fw; /* cdn dp firmware */
  67. unsigned int fw_version; /* cdn fw version */
  68. bool fw_loaded;
  69. void __iomem *regs;
  70. struct regmap *grf;
  71. struct clk *core_clk;
  72. struct clk *pclk;
  73. struct clk *spdif_clk;
  74. struct clk *grf_clk;
  75. struct reset_control *spdif_rst;
  76. struct reset_control *dptx_rst;
  77. struct reset_control *apb_rst;
  78. struct reset_control *core_rst;
  79. struct audio_info audio_info;
  80. struct video_info video_info;
  81. struct cdn_dp_port *port[MAX_PHY];
  82. u8 ports;
  83. u8 max_lanes;
  84. unsigned int max_rate;
  85. u8 lanes;
  86. int active_port;
  87. u8 dpcd[DP_RECEIVER_CAP_SIZE];
  88. bool sink_has_audio;
  89. };
  90. #endif /* _CDN_DP_CORE_H */