1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef DRIVERS_I2C_LM96000_H
4 #define DRIVERS_I2C_LM96000_H
8 #define LM96000_CONFIG 0x40
9 #define LM96000_READY (0x1 << 2)
10 #define LM96000_START (0x1 << 0)
12 #define LM96000_VIN(v) (0x20 + (v))
13 #define LM96000_VIN_LOW_LIMIT(v) (0x44 + (v) * 2)
14 #define LM96000_VIN_HIGH_LIMIT(v) (0x45 + (v) * 2)
16 #define LM96000_TEMP_IN(temp) (0x25 + (temp))
17 #define LM96000_TEMP_LOW_LIMIT(temp) (0x4e + (temp) * 2)
18 #define LM96000_TEMP_HIGH_LIMIT(temp) (0x4f + (temp) * 2)
20 /* 2B, little endian, MSB is latched upon LSB read */
21 #define LM96000_FAN_IN(fan) (0x28 + (fan) * 2)
22 #define LM96000_FAN_LOW_LIMIT(fan) (0x54 + (fan) * 2)
24 #define LM96000_FAN_DUTY(fan) (0x30 + (fan))
25 #define LM96000_FAN_CFG(fan) (0x5c + (fan))
26 #define LM96000_FAN_CFG_MODE_SHIFT 5
27 #define LM96000_FAN_CFG_MODE_MASK (0x7 << LM96000_FAN_CFG_MODE_SHIFT)
28 #define LM96000_FAN_CFG_PWM_INVERT (0x1 << 4)
29 #define LM96000_FAN_CFG_SPINUP_MASK (0x7 << 0)
30 #define LM96000_FAN_FREQ(fan) (0x5f + (fan))
31 #define LM96000_FAN_FREQ_MASK (0xf << 0)
32 #define LM96000_FAN_MIN_OFF 0x62
33 #define LM96000_FAN_MIN(fan) (1 << ((fan) + 5))
34 #define LM96000_FAN_MIN_PWM(fan) (0x64 + (fan))
35 #define LM96000_TACH_MONITOR_MODE 0x74
36 #define LM96000_TACH_MODE_FAN_SHIFT(f) ((f) * 2)
37 #define LM96000_TACH_MODE_FAN_MASK(f) (0x3 << LM96000_TACH_MODE_FAN_SHIFT(f))
39 #define LM96000_ZONE_RANGE(zone) (0x5f + (zone))
40 #define LM96000_ZONE_RANGE_SHIFT 4
41 #define LM96000_ZONE_RANGE_MASK (0xf << LM96000_ZONE_RANGE_SHIFT)
42 #define LM96000_ZONE_SMOOTH(zone) (0x62 + ((zone) + 1) / 2)
43 #define LM96000_ZONE_SMOOTH_EN(zone) (1 << (((zone) % 2) * 4 + 3))
44 #define LM96000_ZONE_SMOOTH_SHFT(zone) (((zone) % 2) * 4)
45 #define LM96000_ZONE_SMOOTH_MASK(zone) (0x7 << LM96000_ZONE_SMOOTH_SHFT(zone))
46 #define LM96000_ZONE_TEMP_LOW(zone) (0x67 + (zone))
47 #define LM96000_ZONE_TEMP_PANIC(zone) (0x6a + (zone))
48 #define LM96000_ZONE_HYSTERESIS(zone) (0x6d + (zone) / 2)
49 #define LM96000_ZONE_HYST_SHIFT(zone) (4 - ((zone) % 2) * 4)
50 #define LM96000_ZONE_HYST_MASK(zone) (0xf << LM96000_ZONE_HYST_SHIFT(zone))
52 #endif /* DRIVERS_I2C_LM96000_H */