hub.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright (C) 2017 NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef TEGRA_HUB_H
  9. #define TEGRA_HUB_H 1
  10. #include <drm/drmP.h>
  11. #include <drm/drm_plane.h>
  12. #include "plane.h"
  13. struct tegra_dc;
  14. struct tegra_windowgroup {
  15. unsigned int usecount;
  16. struct mutex lock;
  17. unsigned int index;
  18. struct device *parent;
  19. struct reset_control *rst;
  20. };
  21. struct tegra_shared_plane {
  22. struct tegra_plane base;
  23. struct tegra_windowgroup *wgrp;
  24. };
  25. static inline struct tegra_shared_plane *
  26. to_tegra_shared_plane(struct drm_plane *plane)
  27. {
  28. return container_of(plane, struct tegra_shared_plane, base.base);
  29. }
  30. struct tegra_display_hub_soc {
  31. unsigned int num_wgrps;
  32. };
  33. struct tegra_display_hub {
  34. struct host1x_client client;
  35. struct clk *clk_disp;
  36. struct clk *clk_dsc;
  37. struct clk *clk_hub;
  38. struct reset_control *rst;
  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_dc;
  48. struct tegra_plane;
  49. int tegra_display_hub_prepare(struct tegra_display_hub *hub);
  50. void tegra_display_hub_cleanup(struct tegra_display_hub *hub);
  51. struct drm_plane *tegra_shared_plane_create(struct drm_device *drm,
  52. struct tegra_dc *dc,
  53. unsigned int wgrp,
  54. unsigned int index);
  55. void tegra_display_hub_atomic_commit(struct drm_device *drm,
  56. struct drm_atomic_state *state);
  57. #define DC_CMD_IHUB_COMMON_MISC_CTL 0x068
  58. #define LATENCY_EVENT (1 << 3)
  59. #define DC_DISP_IHUB_COMMON_DISPLAY_FETCH_METER 0x451
  60. #define CURS_SLOTS(x) (((x) & 0xff) << 8)
  61. #define WGRP_SLOTS(x) (((x) & 0xff) << 0)
  62. #endif /* TEGRA_HUB_H */