summaryrefslogtreecommitdiff
path: root/drivers/edgetpu/edgetpu-thermal.h
blob: 63fc91cddf2ea551a4e83e0253b317279cb42ece (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * EdgeTPU thermal driver header.
 *
 * Copyright (C) 2020 Google, Inc.
 */
#ifndef __EDGETPU_THERMAL_H__
#define __EDGETPU_THERMAL_H__

#include <linux/debugfs.h>
#include <linux/device.h>
#include <linux/mutex.h>
#include <linux/thermal.h>

#include "edgetpu-internal.h"

#define EDGETPU_COOLING_NAME "tpu_cooling"

struct edgetpu_thermal {
	struct device *dev;
	struct dentry *cooling_root;
	struct thermal_cooling_device *cdev;
	struct mutex lock;
	void *op_data;
	unsigned long cooling_state;
	unsigned int tpu_num_states;
	struct edgetpu_dev *etdev;
};

struct edgetpu_state_pwr {
	unsigned long state;
	u32 power;
};

/*
 * Creates a managed edgetpu_thermal object.
 *
 * Returns -errno on error.
 */
struct edgetpu_thermal *devm_tpu_thermal_create(struct device *dev,
						struct edgetpu_dev *etdev);

#endif /* __EDGETPU_THERMAL_H__ */