Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa1b9b48 authored by Martin Peres's avatar Martin Peres Committed by Ben Skeggs
Browse files

drm/nouveau/therm: move thermal-related functions to the therm subdev



It looks scary because of the size, but I tried to keep the differences minimal.
Further patches will fix the actual "driver" code and add new features.

v2: change filenames, split to submodules

v3: add a missing include

v4: Ben Skeggs <bskeggs@redhat.com>
- fixed set_defaults() to allow min_duty < 30 (thermal table will
  override this if it's actually necessary)
- fixed set_defaults() to not provide pwm_freq so nv4x (which only has
  pwm_div) can actually work.  the boards using pwm_freq will have a
  thermal table entry to provide us the value.
- removed unused files

Signed-off-by: default avatarMartin Peres <martin.peres@labri.fr>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent d46497dc
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -91,6 +91,12 @@ nouveau-y += core/subdev/mc/nvc0.o
nouveau-y += core/subdev/mxm/base.o
nouveau-y += core/subdev/mxm/mxms.o
nouveau-y += core/subdev/mxm/nv50.o
nouveau-y += core/subdev/therm/base.o
nouveau-y += core/subdev/therm/fan.o
nouveau-y += core/subdev/therm/ic.o
nouveau-y += core/subdev/therm/nv40.o
nouveau-y += core/subdev/therm/nv50.o
nouveau-y += core/subdev/therm/temp.o
nouveau-y += core/subdev/timer/base.o
nouveau-y += core/subdev/timer/nv04.o
nouveau-y += core/subdev/vm/base.o
@@ -173,7 +179,7 @@ nouveau-y += nv50_crtc.o nv50_dac.o nv50_sor.o nv50_cursor.o
nouveau-y += nv50_evo.o

# drm/pm
nouveau-y += nouveau_pm.o nouveau_volt.o nouveau_perf.o nouveau_temp.o
nouveau-y += nouveau_pm.o nouveau_volt.o nouveau_perf.o
nouveau-y += nv04_pm.o nv40_pm.o nv50_pm.o nva3_pm.o nvc0_pm.o
nouveau-y += nouveau_mem.o

+0 −1
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ enum nv_subdev_type {
	NVDEV_SUBDEV_VM,
	NVDEV_SUBDEV_BAR,
	NVDEV_SUBDEV_VOLT,
	NVDEV_SUBDEV_FAN0,
	NVDEV_SUBDEV_THERM,
	NVDEV_ENGINE_DMAOBJ,
	NVDEV_ENGINE_FIFO,
+58 −0
Original line number Diff line number Diff line
#ifndef __NOUVEAU_THERM_H__
#define __NOUVEAU_THERM_H__

#include <core/device.h>
#include <core/subdev.h>

enum nouveau_therm_fan_mode {
	FAN_CONTROL_NONE = 0,
	FAN_CONTROL_MANUAL = 1,
	FAN_CONTROL_NR,
};

enum nouveau_therm_attr_type {
	NOUVEAU_THERM_ATTR_FAN_MIN_DUTY = 0,
	NOUVEAU_THERM_ATTR_FAN_MAX_DUTY = 1,
	NOUVEAU_THERM_ATTR_FAN_MODE = 2,

	NOUVEAU_THERM_ATTR_THRS_FAN_BOOST = 10,
	NOUVEAU_THERM_ATTR_THRS_FAN_BOOST_HYST = 11,
	NOUVEAU_THERM_ATTR_THRS_DOWN_CLK = 12,
	NOUVEAU_THERM_ATTR_THRS_DOWN_CLK_HYST = 13,
	NOUVEAU_THERM_ATTR_THRS_CRITICAL = 14,
	NOUVEAU_THERM_ATTR_THRS_CRITICAL_HYST = 15,
	NOUVEAU_THERM_ATTR_THRS_SHUTDOWN = 16,
	NOUVEAU_THERM_ATTR_THRS_SHUTDOWN_HYST = 17,
};

struct nouveau_therm {
	struct nouveau_subdev base;

	int (*fan_get)(struct nouveau_therm *);
	int (*fan_set)(struct nouveau_therm *, int);
	int (*fan_sense)(struct nouveau_therm *);

	int (*temp_get)(struct nouveau_therm *);

	int (*attr_get)(struct nouveau_therm *, enum nouveau_therm_attr_type);
	int (*attr_set)(struct nouveau_therm *,
			enum nouveau_therm_attr_type, int);
};

static inline struct nouveau_therm *
nouveau_therm(void *obj)
{
	return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_THERM];
}

#define nouveau_therm_create(p,e,o,d)                                          \
	nouveau_subdev_create((p), (e), (o), 0, "THERM", "therm", d)
#define nouveau_therm_destroy(p)                                               \
	nouveau_subdev_destroy(&(p)->base)

#define _nouveau_therm_dtor _nouveau_subdev_dtor

extern struct nouveau_oclass nv40_therm_oclass;
extern struct nouveau_oclass nv50_therm_oclass;

#endif
+0 −1
Original line number Diff line number Diff line
@@ -71,7 +71,6 @@ static const u64 disable_map[] = {
	[NVDEV_SUBDEV_INSTMEM]	= NV_DEVICE_DISABLE_CORE,
	[NVDEV_SUBDEV_BAR]	= NV_DEVICE_DISABLE_CORE,
	[NVDEV_SUBDEV_VOLT]	= NV_DEVICE_DISABLE_CORE,
	[NVDEV_SUBDEV_FAN0]	= NV_DEVICE_DISABLE_CORE,
	[NVDEV_SUBDEV_CLOCK]	= NV_DEVICE_DISABLE_CORE,
	[NVDEV_SUBDEV_THERM]	= NV_DEVICE_DISABLE_CORE,
	[NVDEV_ENGINE_DMAOBJ]	= NV_DEVICE_DISABLE_CORE,
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#include <subdev/gpio.h>
#include <subdev/i2c.h>
#include <subdev/clock.h>
#include <subdev/therm.h>
#include <subdev/devinit.h>
#include <subdev/mc.h>
#include <subdev/timer.h>
Loading