brintos

brintos / linux-shallow public Read only

0
0
Text · 5.0 KiB · 54e9605 Raw
138 lines · c
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 community6 *7 * Permission is hereby granted, free of charge, to any person obtaining a8 * copy of this software and associated documentation files (the "Software"),9 * to deal in the Software without restriction, including without limitation10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,11 * and/or sell copies of the Software, and to permit persons to whom the12 * Software is furnished to do so, subject to the following conditions:13 *14 * The above copyright notice and this permission notice shall be included in15 * all copies or substantial portions of the Software.16 *17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL20 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR21 * 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 OR23 * OTHER DEALINGS IN THE SOFTWARE.24 *25 * Authors: Martin Peres26 */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 33int nvkm_therm_new_(const struct nvkm_therm_func *, struct nvkm_device *, enum nvkm_subdev_type,34		    int, struct nvkm_therm **);35void nvkm_therm_ctor(struct nvkm_therm *, struct nvkm_device *, enum nvkm_subdev_type, int,36		     const struct nvkm_therm_func *);37 38struct nvkm_fan {39	struct nvkm_therm *parent;40	const char *type;41 42	struct nvbios_therm_fan bios;43	struct nvbios_perf_fan perf;44 45	struct nvkm_alarm alarm;46	spinlock_t lock;47	int percent;48 49	int (*get)(struct nvkm_therm *);50	int (*set)(struct nvkm_therm *, int percent);51 52	struct dcb_gpio_func tach;53};54 55int nvkm_therm_fan_mode(struct nvkm_therm *, int mode);56int nvkm_therm_attr_get(struct nvkm_therm *, enum nvkm_therm_attr_type);57int nvkm_therm_attr_set(struct nvkm_therm *, enum nvkm_therm_attr_type, int);58 59void nvkm_therm_ic_ctor(struct nvkm_therm *);60 61int nvkm_therm_sensor_ctor(struct nvkm_therm *);62 63int nvkm_therm_fan_ctor(struct nvkm_therm *);64int nvkm_therm_fan_init(struct nvkm_therm *);65int nvkm_therm_fan_fini(struct nvkm_therm *, bool suspend);66int nvkm_therm_fan_get(struct nvkm_therm *);67int nvkm_therm_fan_set(struct nvkm_therm *, bool now, int percent);68int nvkm_therm_fan_user_get(struct nvkm_therm *);69int nvkm_therm_fan_user_set(struct nvkm_therm *, int percent);70 71int  nvkm_therm_sensor_init(struct nvkm_therm *);72int  nvkm_therm_sensor_fini(struct nvkm_therm *, bool suspend);73void nvkm_therm_sensor_preinit(struct nvkm_therm *);74void nvkm_therm_sensor_set_threshold_state(struct nvkm_therm *,75					   enum nvkm_therm_thrs,76					   enum nvkm_therm_thrs_state);77enum nvkm_therm_thrs_state78nvkm_therm_sensor_get_threshold_state(struct nvkm_therm *,79				      enum nvkm_therm_thrs);80void nvkm_therm_sensor_event(struct nvkm_therm *, enum nvkm_therm_thrs,81			     enum nvkm_therm_thrs_direction);82void nvkm_therm_program_alarms_polling(struct nvkm_therm *);83 84struct nvkm_therm_func {85	void (*init)(struct nvkm_therm *);86	void (*fini)(struct nvkm_therm *);87	void (*intr)(struct nvkm_therm *);88 89	int (*pwm_ctrl)(struct nvkm_therm *, int line, bool);90	int (*pwm_get)(struct nvkm_therm *, int line, u32 *, u32 *);91	int (*pwm_set)(struct nvkm_therm *, int line, u32, u32);92	int (*pwm_clock)(struct nvkm_therm *, int line);93 94	int (*temp_get)(struct nvkm_therm *);95 96	int (*fan_sense)(struct nvkm_therm *);97 98	void (*program_alarms)(struct nvkm_therm *);99 100	void (*clkgate_init)(struct nvkm_therm *,101			     const struct nvkm_therm_clkgate_pack *);102	void (*clkgate_enable)(struct nvkm_therm *);103	void (*clkgate_fini)(struct nvkm_therm *, bool);104};105 106void nv40_therm_intr(struct nvkm_therm *);107 108int  nv50_fan_pwm_ctrl(struct nvkm_therm *, int, bool);109int  nv50_fan_pwm_get(struct nvkm_therm *, int, u32 *, u32 *);110int  nv50_fan_pwm_set(struct nvkm_therm *, int, u32, u32);111int  nv50_fan_pwm_clock(struct nvkm_therm *, int);112 113int  g84_temp_get(struct nvkm_therm *);114void g84_sensor_setup(struct nvkm_therm *);115void g84_therm_fini(struct nvkm_therm *);116 117int gt215_therm_fan_sense(struct nvkm_therm *);118 119void gf100_clkgate_init(struct nvkm_therm *,120			const struct nvkm_therm_clkgate_pack *);121 122void g84_therm_init(struct nvkm_therm *);123 124int gf119_fan_pwm_ctrl(struct nvkm_therm *, int, bool);125int gf119_fan_pwm_get(struct nvkm_therm *, int, u32 *, u32 *);126int gf119_fan_pwm_set(struct nvkm_therm *, int, u32, u32);127int gf119_fan_pwm_clock(struct nvkm_therm *, int);128void gf119_therm_init(struct nvkm_therm *);129 130void gk104_therm_init(struct nvkm_therm *);131void gk104_clkgate_enable(struct nvkm_therm *);132void gk104_clkgate_fini(struct nvkm_therm *, bool);133 134int nvkm_fanpwm_create(struct nvkm_therm *, struct dcb_gpio_func *);135int nvkm_fantog_create(struct nvkm_therm *, struct dcb_gpio_func *);136int nvkm_fannil_create(struct nvkm_therm *);137#endif138