hub.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2017 NVIDIA CORPORATION. All rights reserved.
  4. */
  5. #ifndef TEGRA_HUB_H
  6. #define TEGRA_HUB_H 1
  7. #include <drm/drm_plane.h>
  8. #include "plane.h"
  9. struct tegra_dc;
  10. struct tegra_windowgroup {
  11. unsigned int usecount;
  12. struct mutex lock;
  13. unsigned int index;
  14. struct host1x_client *parent;
  15. struct reset_control *rst;
  16. };
  17. struct tegra_shared_plane {
  18. struct tegra_plane base;
  19. struct tegra_windowgroup *wgrp;
  20. };
  21. static inline struct tegra_shared_plane *
  22. to_tegra_shared_plane(struct drm_plane *plane)
  23. {
  24. return container_of(plane, struct tegra_shared_plane, base.base);
  25. }
  26. struct tegra_display_hub_soc {
  27. unsigned int num_wgrps;
  28. bool supports_dsc;
  29. };
  30. struct tegra_display_hub {
  31. struct drm_private_obj base;
  32. struct host1x_client client;
  33. struct clk *clk_disp;
  34. struct clk *clk_dsc;
  35. struct clk *clk_hub;
  36. struct reset_control *rst;
  37. unsigned int num_heads;
  38. struct clk **clk_heads;
  39. const struct tegra_display_hub_soc *soc;
  40. struct tegra_windowgroup *wgrps;
  41. };
  42. static inline struct tegra_display_hub *
  43. to_tegra_display_hub(struct host1x_client *client)
  44. {
  45. return container_of(client, struct tegra_display_hub, client);
  46. }
  47. struct tegra_display_hub_state {
  48. struct drm_private_state base;
  49. struct tegra_dc *dc;
  50. unsigned long rate;
  51. struct clk *clk;
  52. };
  53. static inline struct tegra_display_hub_state *
  54. to_tegra_display_hub_state(struct drm_private_state *priv)
  55. {
  56. return container_of(priv, struct tegra_display_hub_state, base);
  57. }
  58. struct tegra_plane;
  59. int tegra_display_hub_prepare(struct tegra_display_hub *hub);
  60. void tegra_display_hub_cleanup(struct tegra_display_hub *hub);
  61. struct drm_plane *tegra_shared_plane_create(struct drm_device *drm,
  62. struct tegra_dc *dc,
  63. unsigned int wgrp,
  64. unsigned int index);
  65. int tegra_display_hub_atomic_check(struct drm_device *drm,
  66. struct drm_atomic_state *state);
  67. void tegra_display_hub_atomic_commit(struct drm_device *drm,
  68. struct drm_atomic_state *state);
  69. #define DC_CMD_IHUB_COMMON_MISC_CTL 0x068
  70. #define LATENCY_EVENT (1 << 3)
  71. #define DC_DISP_IHUB_COMMON_DISPLAY_FETCH_METER 0x451
  72. #define CURS_SLOTS(x) (((x) & 0xff) << 8)
  73. #define WGRP_SLOTS(x) (((x) & 0xff) << 0)
  74. #endif /* TEGRA_HUB_H */