summaryrefslogtreecommitdiff
path: root/src/drivers/i2c/lm96000/lm96000.h
blob: a24d8fe68eca0aae68d92d0a1190d60c0e8883e9 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * This file is part of the coreboot project.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef DRIVERS_I2C_LM96000_H
#define DRIVERS_I2C_LM96000_H

#include "chip.h"

#define LM96000_CONFIG			0x40
#define  LM96000_READY			(0x1 << 2)
#define  LM96000_START			(0x1 << 0)

#define LM96000_VIN(v)			(0x20 + (v))
#define LM96000_VIN_LOW_LIMIT(v)	(0x44 + (v) * 2)
#define LM96000_VIN_HIGH_LIMIT(v)	(0x45 + (v) * 2)

#define LM96000_TEMP_IN(temp)		(0x25 + (temp))
#define LM96000_TEMP_LOW_LIMIT(temp)	(0x4e + (temp) * 2)
#define LM96000_TEMP_HIGH_LIMIT(temp)	(0x4f + (temp) * 2)

/* 2B, little endian, MSB is latched upon LSB read */
#define LM96000_FAN_IN(fan)		(0x28 + (fan) * 2)
#define LM96000_FAN_LOW_LIMIT(fan)	(0x54 + (fan) * 2)

#define LM96000_FAN_DUTY(fan)		(0x30 + (fan))
#define LM96000_FAN_CFG(fan)		(0x5c + (fan))
#define  LM96000_FAN_CFG_MODE_SHIFT	5
#define  LM96000_FAN_CFG_MODE_MASK	(0x7 << LM96000_FAN_CFG_MODE_SHIFT)
#define  LM96000_FAN_CFG_PWM_INVERT	(0x1 << 4)
#define  LM96000_FAN_CFG_SPINUP_MASK	(0x7 << 0)
#define LM96000_FAN_FREQ(fan)		(0x5f + (fan))
#define  LM96000_FAN_FREQ_MASK		(0xf << 0)
#define LM96000_FAN_MIN_OFF		0x62
#define  LM96000_FAN_MIN(fan)		(1 << ((fan) + 5))
#define LM96000_FAN_MIN_PWM(fan)	(0x64 + (fan))
#define LM96000_TACH_MONITOR_MODE	0x74
#define  LM96000_TACH_MODE_FAN_SHIFT(f)	((f) * 2)
#define  LM96000_TACH_MODE_FAN_MASK(f)	(0x3 << LM96000_TACH_MODE_FAN_SHIFT(f))

#define LM96000_ZONE_RANGE(zone)	(0x5f + (zone))
#define  LM96000_ZONE_RANGE_SHIFT	4
#define  LM96000_ZONE_RANGE_MASK	(0xf << LM96000_ZONE_RANGE_SHIFT)
#define LM96000_ZONE_SMOOTH(zone)	(0x62 + ((zone) + 1) / 2)
#define  LM96000_ZONE_SMOOTH_EN(zone)	(1 << (((zone) % 2) * 4 + 3))
#define  LM96000_ZONE_SMOOTH_SHFT(zone)	(((zone) % 2) * 4)
#define  LM96000_ZONE_SMOOTH_MASK(zone)	(0x7 << LM96000_ZONE_SMOOTH_SHFT(zone))
#define LM96000_ZONE_TEMP_LOW(zone)	(0x67 + (zone))
#define LM96000_ZONE_TEMP_PANIC(zone)	(0x6a + (zone))
#define LM96000_ZONE_HYSTERESIS(zone)	(0x6d + (zone) / 2)
#define  LM96000_ZONE_HYST_SHIFT(zone)	(4 - ((zone) % 2) * 4)
#define  LM96000_ZONE_HYST_MASK(zone)	(0xf << LM96000_ZONE_HYST_SHIFT(zone))

#endif /* DRIVERS_I2C_LM96000_H */