2012-12-04 09:50:33 +10:00
|
|
|
#ifndef __NVTHERM_PRIV_H__
|
|
|
|
#define __NVTHERM_PRIV_H__
|
|
|
|
|
2012-09-02 02:55:58 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2012 The Nouveau community
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Authors: Martin Peres
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <subdev/therm.h>
|
|
|
|
|
|
|
|
#include <subdev/bios/extdev.h>
|
2012-12-04 13:25:26 +10:00
|
|
|
#include <subdev/bios/gpio.h>
|
2012-09-02 02:55:58 +02:00
|
|
|
#include <subdev/bios/perf.h>
|
|
|
|
#include <subdev/bios/therm.h>
|
2012-09-03 01:37:02 +02:00
|
|
|
#include <subdev/timer.h>
|
2012-09-02 02:55:58 +02:00
|
|
|
|
2012-12-05 16:21:59 +10:00
|
|
|
struct nouveau_fan {
|
2012-12-05 19:46:35 +10:00
|
|
|
struct nouveau_therm *parent;
|
2012-12-05 16:21:59 +10:00
|
|
|
const char *type;
|
|
|
|
|
|
|
|
struct nvbios_therm_fan bios;
|
|
|
|
struct nvbios_perf_fan perf;
|
|
|
|
|
2012-12-05 19:46:35 +10:00
|
|
|
struct nouveau_alarm alarm;
|
|
|
|
spinlock_t lock;
|
|
|
|
int percent;
|
|
|
|
|
2012-12-05 16:21:59 +10:00
|
|
|
int (*get)(struct nouveau_therm *therm);
|
|
|
|
int (*set)(struct nouveau_therm *therm, int percent);
|
|
|
|
|
|
|
|
struct dcb_gpio_func tach;
|
|
|
|
};
|
|
|
|
|
2012-11-05 00:18:49 +01:00
|
|
|
enum nouveau_therm_thrs_direction {
|
|
|
|
NOUVEAU_THERM_THRS_FALLING = 0,
|
|
|
|
NOUVEAU_THERM_THRS_RISING = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
enum nouveau_therm_thrs_state {
|
|
|
|
NOUVEAU_THERM_THRS_LOWER = 0,
|
|
|
|
NOUVEAU_THERM_THRS_HIGHER = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
enum nouveau_therm_thrs {
|
|
|
|
NOUVEAU_THERM_THRS_FANBOOST = 0,
|
|
|
|
NOUVEAU_THERM_THRS_DOWNCLOCK = 1,
|
|
|
|
NOUVEAU_THERM_THRS_CRITICAL = 2,
|
|
|
|
NOUVEAU_THERM_THRS_SHUTDOWN = 3,
|
|
|
|
NOUVEAU_THERM_THRS_NR
|
|
|
|
};
|
|
|
|
|
2012-09-02 02:55:58 +02:00
|
|
|
struct nouveau_therm_priv {
|
|
|
|
struct nouveau_therm base;
|
|
|
|
|
2012-12-05 20:28:09 +10:00
|
|
|
/* automatic thermal management */
|
|
|
|
struct nouveau_alarm alarm;
|
|
|
|
spinlock_t lock;
|
|
|
|
struct nouveau_therm_trip_point *last_trip;
|
|
|
|
int mode;
|
2013-07-26 09:15:57 +10:00
|
|
|
int cstate;
|
2012-12-06 10:28:34 +10:00
|
|
|
int suspend;
|
2012-12-05 20:28:09 +10:00
|
|
|
|
2012-09-02 02:55:58 +02:00
|
|
|
/* bios */
|
|
|
|
struct nvbios_therm_sensor bios_sensor;
|
|
|
|
|
|
|
|
/* fan priv */
|
2012-12-05 16:21:59 +10:00
|
|
|
struct nouveau_fan *fan;
|
2012-09-02 02:55:58 +02:00
|
|
|
|
2012-11-05 00:18:49 +01:00
|
|
|
/* alarms priv */
|
|
|
|
struct {
|
|
|
|
spinlock_t alarm_program_lock;
|
|
|
|
struct nouveau_alarm therm_poll_alarm;
|
|
|
|
enum nouveau_therm_thrs_state alarm_state[NOUVEAU_THERM_THRS_NR];
|
|
|
|
void (*program_alarms)(struct nouveau_therm *);
|
|
|
|
} sensor;
|
|
|
|
|
|
|
|
/* what should be done if the card overheats */
|
|
|
|
struct {
|
|
|
|
void (*downclock)(struct nouveau_therm *, bool active);
|
|
|
|
void (*pause)(struct nouveau_therm *, bool active);
|
|
|
|
} emergency;
|
|
|
|
|
2012-09-02 02:55:58 +02:00
|
|
|
/* ic */
|
|
|
|
struct i2c_client *ic;
|
|
|
|
};
|
|
|
|
|
2013-03-05 10:58:59 +01:00
|
|
|
int nouveau_therm_fan_mode(struct nouveau_therm *therm, int mode);
|
2012-09-02 02:55:58 +02:00
|
|
|
int nouveau_therm_attr_get(struct nouveau_therm *therm,
|
|
|
|
enum nouveau_therm_attr_type type);
|
|
|
|
int nouveau_therm_attr_set(struct nouveau_therm *therm,
|
|
|
|
enum nouveau_therm_attr_type type, int value);
|
|
|
|
|
|
|
|
void nouveau_therm_ic_ctor(struct nouveau_therm *therm);
|
|
|
|
|
|
|
|
int nouveau_therm_sensor_ctor(struct nouveau_therm *therm);
|
|
|
|
|
|
|
|
int nouveau_therm_fan_ctor(struct nouveau_therm *therm);
|
2013-08-11 22:48:52 -04:00
|
|
|
int nouveau_therm_fan_init(struct nouveau_therm *therm);
|
|
|
|
int nouveau_therm_fan_fini(struct nouveau_therm *therm, bool suspend);
|
2012-09-02 02:55:58 +02:00
|
|
|
int nouveau_therm_fan_get(struct nouveau_therm *therm);
|
2012-12-05 19:46:35 +10:00
|
|
|
int nouveau_therm_fan_set(struct nouveau_therm *therm, bool now, int percent);
|
2012-09-04 13:52:00 +02:00
|
|
|
int nouveau_therm_fan_user_get(struct nouveau_therm *therm);
|
|
|
|
int nouveau_therm_fan_user_set(struct nouveau_therm *therm, int percent);
|
|
|
|
|
2012-09-02 02:55:58 +02:00
|
|
|
int nouveau_therm_fan_sense(struct nouveau_therm *therm);
|
2012-12-04 09:50:33 +10:00
|
|
|
|
2012-12-05 16:21:59 +10:00
|
|
|
int nouveau_therm_preinit(struct nouveau_therm *);
|
|
|
|
|
2013-08-11 22:48:52 -04:00
|
|
|
int nouveau_therm_sensor_init(struct nouveau_therm *therm);
|
|
|
|
int nouveau_therm_sensor_fini(struct nouveau_therm *therm, bool suspend);
|
2013-03-15 01:47:16 +01:00
|
|
|
void nouveau_therm_sensor_preinit(struct nouveau_therm *);
|
2012-11-05 00:18:49 +01:00
|
|
|
void nouveau_therm_sensor_set_threshold_state(struct nouveau_therm *therm,
|
|
|
|
enum nouveau_therm_thrs thrs,
|
|
|
|
enum nouveau_therm_thrs_state st);
|
|
|
|
enum nouveau_therm_thrs_state
|
|
|
|
nouveau_therm_sensor_get_threshold_state(struct nouveau_therm *therm,
|
|
|
|
enum nouveau_therm_thrs thrs);
|
|
|
|
void nouveau_therm_sensor_event(struct nouveau_therm *therm,
|
|
|
|
enum nouveau_therm_thrs thrs,
|
|
|
|
enum nouveau_therm_thrs_direction dir);
|
|
|
|
void nouveau_therm_program_alarms_polling(struct nouveau_therm *therm);
|
|
|
|
|
2013-02-23 16:45:51 +01:00
|
|
|
void nv40_therm_intr(struct nouveau_subdev *);
|
2012-12-05 16:21:59 +10:00
|
|
|
int nv50_fan_pwm_ctrl(struct nouveau_therm *, int, bool);
|
2012-12-04 13:25:26 +10:00
|
|
|
int nv50_fan_pwm_get(struct nouveau_therm *, int, u32 *, u32 *);
|
|
|
|
int nv50_fan_pwm_set(struct nouveau_therm *, int, u32, u32);
|
2014-02-18 03:56:11 +01:00
|
|
|
int nv50_fan_pwm_clock(struct nouveau_therm *, int);
|
2013-02-23 16:45:51 +01:00
|
|
|
int nv84_temp_get(struct nouveau_therm *therm);
|
2014-08-24 23:15:10 +02:00
|
|
|
void nv84_sensor_setup(struct nouveau_therm *therm);
|
2013-09-09 00:43:27 +02:00
|
|
|
int nv84_therm_fini(struct nouveau_object *object, bool suspend);
|
2012-12-04 09:50:33 +10:00
|
|
|
|
2012-12-04 12:10:19 +10:00
|
|
|
int nva3_therm_fan_sense(struct nouveau_therm *);
|
|
|
|
|
2014-08-17 17:33:08 +02:00
|
|
|
int nvd0_therm_init(struct nouveau_object *object);
|
|
|
|
|
2012-12-05 16:21:59 +10:00
|
|
|
int nouveau_fanpwm_create(struct nouveau_therm *, struct dcb_gpio_func *);
|
2012-09-03 01:37:02 +02:00
|
|
|
int nouveau_fantog_create(struct nouveau_therm *, struct dcb_gpio_func *);
|
2012-12-05 16:21:59 +10:00
|
|
|
int nouveau_fannil_create(struct nouveau_therm *);
|
|
|
|
|
2012-12-04 09:50:33 +10:00
|
|
|
#endif
|