priv.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #ifndef __NVTHERM_PRIV_H__
  2. #define __NVTHERM_PRIV_H__
  3. #define nvkm_therm(p) container_of((p), struct nvkm_therm, subdev)
  4. /*
  5. * Copyright 2012 The Nouveau community
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a
  8. * copy of this software and associated documentation files (the "Software"),
  9. * to deal in the Software without restriction, including without limitation
  10. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  11. * and/or sell copies of the Software, and to permit persons to whom the
  12. * Software is furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in
  15. * all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  20. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  21. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  22. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  23. * OTHER DEALINGS IN THE SOFTWARE.
  24. *
  25. * Authors: Martin Peres
  26. */
  27. #include <subdev/therm.h>
  28. #include <subdev/bios.h>
  29. #include <subdev/bios/extdev.h>
  30. #include <subdev/bios/gpio.h>
  31. #include <subdev/bios/perf.h>
  32. int nvkm_therm_new_(const struct nvkm_therm_func *, struct nvkm_device *,
  33. int index, struct nvkm_therm **);
  34. struct nvkm_fan {
  35. struct nvkm_therm *parent;
  36. const char *type;
  37. struct nvbios_therm_fan bios;
  38. struct nvbios_perf_fan perf;
  39. struct nvkm_alarm alarm;
  40. spinlock_t lock;
  41. int percent;
  42. int (*get)(struct nvkm_therm *);
  43. int (*set)(struct nvkm_therm *, int percent);
  44. struct dcb_gpio_func tach;
  45. };
  46. int nvkm_therm_fan_mode(struct nvkm_therm *, int mode);
  47. int nvkm_therm_attr_get(struct nvkm_therm *, enum nvkm_therm_attr_type);
  48. int nvkm_therm_attr_set(struct nvkm_therm *, enum nvkm_therm_attr_type, int);
  49. void nvkm_therm_ic_ctor(struct nvkm_therm *);
  50. int nvkm_therm_sensor_ctor(struct nvkm_therm *);
  51. int nvkm_therm_fan_ctor(struct nvkm_therm *);
  52. int nvkm_therm_fan_init(struct nvkm_therm *);
  53. int nvkm_therm_fan_fini(struct nvkm_therm *, bool suspend);
  54. int nvkm_therm_fan_get(struct nvkm_therm *);
  55. int nvkm_therm_fan_set(struct nvkm_therm *, bool now, int percent);
  56. int nvkm_therm_fan_user_get(struct nvkm_therm *);
  57. int nvkm_therm_fan_user_set(struct nvkm_therm *, int percent);
  58. int nvkm_therm_preinit(struct nvkm_therm *);
  59. int nvkm_therm_sensor_init(struct nvkm_therm *);
  60. int nvkm_therm_sensor_fini(struct nvkm_therm *, bool suspend);
  61. void nvkm_therm_sensor_preinit(struct nvkm_therm *);
  62. void nvkm_therm_sensor_set_threshold_state(struct nvkm_therm *,
  63. enum nvkm_therm_thrs,
  64. enum nvkm_therm_thrs_state);
  65. enum nvkm_therm_thrs_state
  66. nvkm_therm_sensor_get_threshold_state(struct nvkm_therm *,
  67. enum nvkm_therm_thrs);
  68. void nvkm_therm_sensor_event(struct nvkm_therm *, enum nvkm_therm_thrs,
  69. enum nvkm_therm_thrs_direction);
  70. void nvkm_therm_program_alarms_polling(struct nvkm_therm *);
  71. struct nvkm_therm_func {
  72. void (*init)(struct nvkm_therm *);
  73. void (*fini)(struct nvkm_therm *);
  74. void (*intr)(struct nvkm_therm *);
  75. int (*pwm_ctrl)(struct nvkm_therm *, int line, bool);
  76. int (*pwm_get)(struct nvkm_therm *, int line, u32 *, u32 *);
  77. int (*pwm_set)(struct nvkm_therm *, int line, u32, u32);
  78. int (*pwm_clock)(struct nvkm_therm *, int line);
  79. int (*temp_get)(struct nvkm_therm *);
  80. int (*fan_sense)(struct nvkm_therm *);
  81. void (*program_alarms)(struct nvkm_therm *);
  82. };
  83. void nv40_therm_intr(struct nvkm_therm *);
  84. int nv50_fan_pwm_ctrl(struct nvkm_therm *, int, bool);
  85. int nv50_fan_pwm_get(struct nvkm_therm *, int, u32 *, u32 *);
  86. int nv50_fan_pwm_set(struct nvkm_therm *, int, u32, u32);
  87. int nv50_fan_pwm_clock(struct nvkm_therm *, int);
  88. int g84_temp_get(struct nvkm_therm *);
  89. void g84_sensor_setup(struct nvkm_therm *);
  90. void g84_therm_fini(struct nvkm_therm *);
  91. int gt215_therm_fan_sense(struct nvkm_therm *);
  92. void gf119_therm_init(struct nvkm_therm *);
  93. int nvkm_fanpwm_create(struct nvkm_therm *, struct dcb_gpio_func *);
  94. int nvkm_fantog_create(struct nvkm_therm *, struct dcb_gpio_func *);
  95. int nvkm_fannil_create(struct nvkm_therm *);
  96. #endif