cdn-dp-core.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Copyright (C) 2016 Chris Zhong <zyw@rock-chips.com>
  3. * Copyright (C) 2016 ROCKCHIP, Inc.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #ifndef _CDN_DP_CORE_H
  15. #define _CDN_DP_CORE_H
  16. #include <drm/drmP.h>
  17. #include <drm/drm_crtc_helper.h>
  18. #include <drm/drm_dp_helper.h>
  19. #include <drm/drm_panel.h>
  20. #include "rockchip_drm_drv.h"
  21. #define MAX_PHY 2
  22. enum audio_format {
  23. AFMT_I2S = 0,
  24. AFMT_SPDIF = 1,
  25. AFMT_UNUSED,
  26. };
  27. struct audio_info {
  28. enum audio_format format;
  29. int sample_rate;
  30. int channels;
  31. int sample_width;
  32. };
  33. enum vic_pxl_encoding_format {
  34. PXL_RGB = 0x1,
  35. YCBCR_4_4_4 = 0x2,
  36. YCBCR_4_2_2 = 0x4,
  37. YCBCR_4_2_0 = 0x8,
  38. Y_ONLY = 0x10,
  39. };
  40. struct video_info {
  41. bool h_sync_polarity;
  42. bool v_sync_polarity;
  43. bool interlaced;
  44. int color_depth;
  45. enum vic_pxl_encoding_format color_fmt;
  46. };
  47. struct cdn_firmware_header {
  48. u32 size_bytes; /* size of the entire header+image(s) in bytes */
  49. u32 header_size; /* size of just the header in bytes */
  50. u32 iram_size; /* size of iram */
  51. u32 dram_size; /* size of dram */
  52. };
  53. struct cdn_dp_port {
  54. struct cdn_dp_device *dp;
  55. struct notifier_block event_nb;
  56. struct extcon_dev *extcon;
  57. struct phy *phy;
  58. u8 lanes;
  59. bool phy_enabled;
  60. u8 id;
  61. };
  62. struct cdn_dp_device {
  63. struct device *dev;
  64. struct drm_device *drm_dev;
  65. struct drm_connector connector;
  66. struct drm_encoder encoder;
  67. struct drm_display_mode mode;
  68. struct platform_device *audio_pdev;
  69. struct work_struct event_work;
  70. struct edid *edid;
  71. struct mutex lock;
  72. bool connected;
  73. bool active;
  74. bool suspended;
  75. const struct firmware *fw; /* cdn dp firmware */
  76. unsigned int fw_version; /* cdn fw version */
  77. bool fw_loaded;
  78. void __iomem *regs;
  79. struct regmap *grf;
  80. struct clk *core_clk;
  81. struct clk *pclk;
  82. struct clk *spdif_clk;
  83. struct clk *grf_clk;
  84. struct reset_control *spdif_rst;
  85. struct reset_control *dptx_rst;
  86. struct reset_control *apb_rst;
  87. struct reset_control *core_rst;
  88. struct audio_info audio_info;
  89. struct video_info video_info;
  90. struct drm_dp_link link;
  91. struct cdn_dp_port *port[MAX_PHY];
  92. u8 ports;
  93. u8 lanes;
  94. int active_port;
  95. u8 dpcd[DP_RECEIVER_CAP_SIZE];
  96. bool sink_has_audio;
  97. };
  98. #endif /* _CDN_DP_CORE_H */