hub.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 drm_private_obj base;
  35. struct host1x_client client;
  36. struct clk *clk_disp;
  37. struct clk *clk_dsc;
  38. struct clk *clk_hub;
  39. struct reset_control *rst;
  40. const struct tegra_display_hub_soc *soc;
  41. struct tegra_windowgroup *wgrps;
  42. };
  43. static inline struct tegra_display_hub *
  44. to_tegra_display_hub(struct host1x_client *client)
  45. {
  46. return container_of(client, struct tegra_display_hub, client);
  47. }
  48. struct tegra_display_hub_state {
  49. struct drm_private_state base;
  50. struct tegra_dc *dc;
  51. unsigned long rate;
  52. struct clk *clk;
  53. };
  54. static inline struct tegra_display_hub_state *
  55. to_tegra_display_hub_state(struct drm_private_state *priv)
  56. {
  57. return container_of(priv, struct tegra_display_hub_state, base);
  58. }
  59. struct tegra_dc;
  60. struct tegra_plane;
  61. int tegra_display_hub_prepare(struct tegra_display_hub *hub);
  62. void tegra_display_hub_cleanup(struct tegra_display_hub *hub);
  63. struct drm_plane *tegra_shared_plane_create(struct drm_device *drm,
  64. struct tegra_dc *dc,
  65. unsigned int wgrp,
  66. unsigned int index);
  67. int tegra_display_hub_atomic_check(struct drm_device *drm,
  68. struct drm_atomic_state *state);
  69. void tegra_display_hub_atomic_commit(struct drm_device *drm,
  70. struct drm_atomic_state *state);
  71. #define DC_CMD_IHUB_COMMON_MISC_CTL 0x068
  72. #define LATENCY_EVENT (1 << 3)
  73. #define DC_DISP_IHUB_COMMON_DISPLAY_FETCH_METER 0x451
  74. #define CURS_SLOTS(x) (((x) & 0xff) << 8)
  75. #define WGRP_SLOTS(x) (((x) & 0xff) << 0)
  76. #endif /* TEGRA_HUB_H */