clk.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #ifndef __NVKM_CLK_H__
  2. #define __NVKM_CLK_H__
  3. #include <core/subdev.h>
  4. #include <core/notify.h>
  5. struct nvbios_pll;
  6. struct nvkm_pll_vals;
  7. enum nv_clk_src {
  8. nv_clk_src_crystal,
  9. nv_clk_src_href,
  10. nv_clk_src_hclk,
  11. nv_clk_src_hclkm3,
  12. nv_clk_src_hclkm3d2,
  13. nv_clk_src_hclkm2d3, /* NVAA */
  14. nv_clk_src_hclkm4, /* NVAA */
  15. nv_clk_src_cclk, /* NVAA */
  16. nv_clk_src_host,
  17. nv_clk_src_sppll0,
  18. nv_clk_src_sppll1,
  19. nv_clk_src_mpllsrcref,
  20. nv_clk_src_mpllsrc,
  21. nv_clk_src_mpll,
  22. nv_clk_src_mdiv,
  23. nv_clk_src_core,
  24. nv_clk_src_core_intm,
  25. nv_clk_src_shader,
  26. nv_clk_src_mem,
  27. nv_clk_src_gpc,
  28. nv_clk_src_rop,
  29. nv_clk_src_hubk01,
  30. nv_clk_src_hubk06,
  31. nv_clk_src_hubk07,
  32. nv_clk_src_copy,
  33. nv_clk_src_daemon,
  34. nv_clk_src_disp,
  35. nv_clk_src_vdec,
  36. nv_clk_src_dom6,
  37. nv_clk_src_max,
  38. };
  39. struct nvkm_cstate {
  40. struct list_head head;
  41. u8 voltage;
  42. u32 domain[nv_clk_src_max];
  43. };
  44. struct nvkm_pstate {
  45. struct list_head head;
  46. struct list_head list; /* c-states */
  47. struct nvkm_cstate base;
  48. u8 pstate;
  49. u8 fanspeed;
  50. };
  51. struct nvkm_domain {
  52. enum nv_clk_src name;
  53. u8 bios; /* 0xff for none */
  54. #define NVKM_CLK_DOM_FLAG_CORE 0x01
  55. u8 flags;
  56. const char *mname;
  57. int mdiv;
  58. };
  59. struct nvkm_clk {
  60. const struct nvkm_clk_func *func;
  61. struct nvkm_subdev subdev;
  62. const struct nvkm_domain *domains;
  63. struct nvkm_pstate bstate;
  64. struct list_head states;
  65. int state_nr;
  66. struct work_struct work;
  67. wait_queue_head_t wait;
  68. atomic_t waiting;
  69. struct nvkm_notify pwrsrc_ntfy;
  70. int pwrsrc;
  71. int pstate; /* current */
  72. int ustate_ac; /* user-requested (-1 disabled, -2 perfmon) */
  73. int ustate_dc; /* user-requested (-1 disabled, -2 perfmon) */
  74. int astate; /* perfmon adjustment (base) */
  75. int tstate; /* thermal adjustment (max-) */
  76. int dstate; /* display adjustment (min+) */
  77. bool allow_reclock;
  78. /*XXX: die, these are here *only* to support the completely
  79. * bat-shit insane what-was-nouveau_hw.c code
  80. */
  81. int (*pll_calc)(struct nvkm_clk *, struct nvbios_pll *, int clk,
  82. struct nvkm_pll_vals *pv);
  83. int (*pll_prog)(struct nvkm_clk *, u32 reg1, struct nvkm_pll_vals *pv);
  84. };
  85. int nvkm_clk_read(struct nvkm_clk *, enum nv_clk_src);
  86. int nvkm_clk_ustate(struct nvkm_clk *, int req, int pwr);
  87. int nvkm_clk_astate(struct nvkm_clk *, int req, int rel, bool wait);
  88. int nvkm_clk_dstate(struct nvkm_clk *, int req, int rel);
  89. int nvkm_clk_tstate(struct nvkm_clk *, int req, int rel);
  90. int nv04_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
  91. int nv40_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
  92. int nv50_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
  93. int g84_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
  94. int mcp77_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
  95. int gt215_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
  96. int gf100_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
  97. int gk104_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
  98. int gk20a_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
  99. #endif