Commit ead80803 authored by Justin Maggard's avatar Justin Maggard Committed by Guenter Roeck

hwmon: (it87) Add support for IT8732F

Add support for the IT8732F.  This chip is pretty similar to IT8721F,
with the main difference being that the ADC LSB is 10.9 mV instead of
12 mV.
Signed-off-by: default avatarJustin Maggard <jmaggard@netgear.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 1c6e8f6b
...@@ -38,6 +38,10 @@ Supported chips: ...@@ -38,6 +38,10 @@ Supported chips:
Prefix: 'it8728' Prefix: 'it8728'
Addresses scanned: from Super I/O config space (8 I/O ports) Addresses scanned: from Super I/O config space (8 I/O ports)
Datasheet: Not publicly available Datasheet: Not publicly available
* IT8732F
Prefix: 'it8732'
Addresses scanned: from Super I/O config space (8 I/O ports)
Datasheet: Not publicly available
* IT8771E * IT8771E
Prefix: 'it8771' Prefix: 'it8771'
Addresses scanned: from Super I/O config space (8 I/O ports) Addresses scanned: from Super I/O config space (8 I/O ports)
...@@ -111,9 +115,9 @@ Description ...@@ -111,9 +115,9 @@ Description
----------- -----------
This driver implements support for the IT8603E, IT8620E, IT8623E, IT8705F, This driver implements support for the IT8603E, IT8620E, IT8623E, IT8705F,
IT8712F, IT8716F, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E, IT8712F, IT8716F, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8732F,
IT8771E, IT8772E, IT8781F, IT8782F, IT8783E/F, IT8786E, IT8790E, and SiS950 IT8758E, IT8771E, IT8772E, IT8781F, IT8782F, IT8783E/F, IT8786E, IT8790E, and
chips. SiS950 chips.
These chips are 'Super I/O chips', supporting floppy disks, infrared ports, These chips are 'Super I/O chips', supporting floppy disks, infrared ports,
joysticks and other miscellaneous stuff. For hardware monitoring, they joysticks and other miscellaneous stuff. For hardware monitoring, they
...@@ -137,10 +141,10 @@ The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E and later IT8712F revisions ...@@ -137,10 +141,10 @@ The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E and later IT8712F revisions
have support for 2 additional fans. The additional fans are supported by the have support for 2 additional fans. The additional fans are supported by the
driver. driver.
The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E, IT8781F, IT8782F, IT8783E/F, The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E, IT8732F, IT8781F, IT8782F,
and late IT8712F and IT8705F also have optional 16-bit tachometer counters IT8783E/F, and late IT8712F and IT8705F also have optional 16-bit tachometer
for fans 1 to 3. This is better (no more fan clock divider mess) but not counters for fans 1 to 3. This is better (no more fan clock divider mess) but
compatible with the older chips and revisions. The 16-bit tachometer mode not compatible with the older chips and revisions. The 16-bit tachometer mode
is enabled by the driver when one of the above chips is detected. is enabled by the driver when one of the above chips is detected.
The IT8726F is just bit enhanced IT8716F with additional hardware The IT8726F is just bit enhanced IT8716F with additional hardware
...@@ -159,6 +163,9 @@ IT8728F. It only supports 16-bit fan mode. ...@@ -159,6 +163,9 @@ IT8728F. It only supports 16-bit fan mode.
The IT8790E supports up to 3 fans. 16-bit fan mode is always enabled. The IT8790E supports up to 3 fans. 16-bit fan mode is always enabled.
The IT8732F supports a closed-loop mode for fan control, but this is not
currently implemented by the driver.
Temperatures are measured in degrees Celsius. An alarm is triggered once Temperatures are measured in degrees Celsius. An alarm is triggered once
when the Overtemperature Shutdown limit is crossed. when the Overtemperature Shutdown limit is crossed.
...@@ -173,12 +180,14 @@ is done. ...@@ -173,12 +180,14 @@ is done.
Voltage sensors (also known as IN sensors) report their values in volts. An Voltage sensors (also known as IN sensors) report their values in volts. An
alarm is triggered if the voltage has crossed a programmable minimum or alarm is triggered if the voltage has crossed a programmable minimum or
maximum limit. Note that minimum in this case always means 'closest to maximum limit. Note that minimum in this case always means 'closest to
zero'; this is important for negative voltage measurements. All voltage zero'; this is important for negative voltage measurements. On most chips, all
inputs can measure voltages between 0 and 4.08 volts, with a resolution of voltage inputs can measure voltages between 0 and 4.08 volts, with a resolution
0.016 volt (except IT8603E, IT8721F/IT8758E and IT8728F: 0.012 volt.) The of 0.016 volt. IT8603E, IT8721F/IT8758E and IT8728F can measure between 0 and
battery voltage in8 does not have limit registers. 3.06 volts, with a resolution of 0.012 volt. IT8732F can measure between 0 and
2.8 volts with a resolution of 0.0109 volt. The battery voltage in8 does not
On the IT8603E, IT8721F/IT8758E, IT8781F, IT8782F, and IT8783E/F, some have limit registers.
On the IT8603E, IT8721F/IT8758E, IT8732F, IT8781F, IT8782F, and IT8783E/F, some
voltage inputs are internal and scaled inside the chip: voltage inputs are internal and scaled inside the chip:
* in3 (optional) * in3 (optional)
* in7 (optional for IT8781F, IT8782F, and IT8783E/F) * in7 (optional for IT8781F, IT8782F, and IT8783E/F)
......
...@@ -609,8 +609,8 @@ config SENSORS_IT87 ...@@ -609,8 +609,8 @@ config SENSORS_IT87
depends on !PPC depends on !PPC
select HWMON_VID select HWMON_VID
help help
If you say yes here you get support for ITE IT8705F, IT8712F, If you say yes here you get support for ITE IT8705F, IT8712F, IT8716F,
IT8716F, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8732F, IT8758E,
IT8771E, IT8772E, IT8781F, IT8782F, IT8783E/F, IT8786E, IT8790E, IT8771E, IT8772E, IT8781F, IT8782F, IT8783E/F, IT8786E, IT8790E,
IT8603E, IT8620E, and IT8623E sensor chips, and the SiS950 clone. IT8603E, IT8620E, and IT8623E sensor chips, and the SiS950 clone.
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* IT8721F Super I/O chip w/LPC interface * IT8721F Super I/O chip w/LPC interface
* IT8726F Super I/O chip w/LPC interface * IT8726F Super I/O chip w/LPC interface
* IT8728F Super I/O chip w/LPC interface * IT8728F Super I/O chip w/LPC interface
* IT8732F Super I/O chip w/LPC interface
* IT8758E Super I/O chip w/LPC interface * IT8758E Super I/O chip w/LPC interface
* IT8771E Super I/O chip w/LPC interface * IT8771E Super I/O chip w/LPC interface
* IT8772E Super I/O chip w/LPC interface * IT8772E Super I/O chip w/LPC interface
...@@ -69,8 +70,9 @@ ...@@ -69,8 +70,9 @@
#define DRVNAME "it87" #define DRVNAME "it87"
enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728, it8771, enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728, it8732,
it8772, it8781, it8782, it8783, it8786, it8790, it8603, it8620 }; it8771, it8772, it8781, it8782, it8783, it8786, it8790, it8603,
it8620 };
static unsigned short force_id; static unsigned short force_id;
module_param(force_id, ushort, 0); module_param(force_id, ushort, 0);
...@@ -148,6 +150,7 @@ static inline void superio_exit(void) ...@@ -148,6 +150,7 @@ static inline void superio_exit(void)
#define IT8721F_DEVID 0x8721 #define IT8721F_DEVID 0x8721
#define IT8726F_DEVID 0x8726 #define IT8726F_DEVID 0x8726
#define IT8728F_DEVID 0x8728 #define IT8728F_DEVID 0x8728
#define IT8732F_DEVID 0x8732
#define IT8771E_DEVID 0x8771 #define IT8771E_DEVID 0x8771
#define IT8772E_DEVID 0x8772 #define IT8772E_DEVID 0x8772
#define IT8781F_DEVID 0x8781 #define IT8781F_DEVID 0x8781
...@@ -265,6 +268,7 @@ struct it87_devices { ...@@ -265,6 +268,7 @@ struct it87_devices {
#define FEAT_VID (1 << 9) /* Set if chip supports VID */ #define FEAT_VID (1 << 9) /* Set if chip supports VID */
#define FEAT_IN7_INTERNAL (1 << 10) /* Set if in7 is internal */ #define FEAT_IN7_INTERNAL (1 << 10) /* Set if in7 is internal */
#define FEAT_SIX_FANS (1 << 11) /* Supports six fans */ #define FEAT_SIX_FANS (1 << 11) /* Supports six fans */
#define FEAT_10_9MV_ADC (1 << 12)
static const struct it87_devices it87_devices[] = { static const struct it87_devices it87_devices[] = {
[it87] = { [it87] = {
...@@ -315,6 +319,15 @@ static const struct it87_devices it87_devices[] = { ...@@ -315,6 +319,15 @@ static const struct it87_devices it87_devices[] = {
| FEAT_IN7_INTERNAL, | FEAT_IN7_INTERNAL,
.peci_mask = 0x07, .peci_mask = 0x07,
}, },
[it8732] = {
.name = "it8732",
.suffix = "F",
.features = FEAT_NEWER_AUTOPWM | FEAT_16BIT_FANS
| FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_TEMP_PECI
| FEAT_10_9MV_ADC | FEAT_IN7_INTERNAL,
.peci_mask = 0x07,
.old_peci_mask = 0x02, /* Actually reports PCH */
},
[it8771] = { [it8771] = {
.name = "it8771", .name = "it8771",
.suffix = "E", .suffix = "E",
...@@ -391,6 +404,7 @@ static const struct it87_devices it87_devices[] = { ...@@ -391,6 +404,7 @@ static const struct it87_devices it87_devices[] = {
#define has_16bit_fans(data) ((data)->features & FEAT_16BIT_FANS) #define has_16bit_fans(data) ((data)->features & FEAT_16BIT_FANS)
#define has_12mv_adc(data) ((data)->features & FEAT_12MV_ADC) #define has_12mv_adc(data) ((data)->features & FEAT_12MV_ADC)
#define has_10_9mv_adc(data) ((data)->features & FEAT_10_9MV_ADC)
#define has_newer_autopwm(data) ((data)->features & FEAT_NEWER_AUTOPWM) #define has_newer_autopwm(data) ((data)->features & FEAT_NEWER_AUTOPWM)
#define has_old_autopwm(data) ((data)->features & FEAT_OLD_AUTOPWM) #define has_old_autopwm(data) ((data)->features & FEAT_OLD_AUTOPWM)
#define has_temp_offset(data) ((data)->features & FEAT_TEMP_OFFSET) #define has_temp_offset(data) ((data)->features & FEAT_TEMP_OFFSET)
...@@ -475,7 +489,14 @@ struct it87_data { ...@@ -475,7 +489,14 @@ struct it87_data {
static int adc_lsb(const struct it87_data *data, int nr) static int adc_lsb(const struct it87_data *data, int nr)
{ {
int lsb = has_12mv_adc(data) ? 12 : 16; int lsb;
if (has_12mv_adc(data))
lsb = 120;
else if (has_10_9mv_adc(data))
lsb = 109;
else
lsb = 160;
if (data->in_scaled & (1 << nr)) if (data->in_scaled & (1 << nr))
lsb <<= 1; lsb <<= 1;
return lsb; return lsb;
...@@ -483,13 +504,13 @@ static int adc_lsb(const struct it87_data *data, int nr) ...@@ -483,13 +504,13 @@ static int adc_lsb(const struct it87_data *data, int nr)
static u8 in_to_reg(const struct it87_data *data, int nr, long val) static u8 in_to_reg(const struct it87_data *data, int nr, long val)
{ {
val = DIV_ROUND_CLOSEST(val, adc_lsb(data, nr)); val = DIV_ROUND_CLOSEST(val * 10, adc_lsb(data, nr));
return clamp_val(val, 0, 255); return clamp_val(val, 0, 255);
} }
static int in_from_reg(const struct it87_data *data, int nr, int val) static int in_from_reg(const struct it87_data *data, int nr, int val)
{ {
return val * adc_lsb(data, nr); return DIV_ROUND_CLOSEST(val * adc_lsb(data, nr), 10);
} }
static inline u8 FAN_TO_REG(long rpm, int div) static inline u8 FAN_TO_REG(long rpm, int div)
...@@ -1515,9 +1536,14 @@ static ssize_t show_label(struct device *dev, struct device_attribute *attr, ...@@ -1515,9 +1536,14 @@ static ssize_t show_label(struct device *dev, struct device_attribute *attr,
}; };
struct it87_data *data = dev_get_drvdata(dev); struct it87_data *data = dev_get_drvdata(dev);
int nr = to_sensor_dev_attr(attr)->index; int nr = to_sensor_dev_attr(attr)->index;
const char *label;
return sprintf(buf, "%s\n", has_12mv_adc(data) ? labels_it8721[nr] if (has_12mv_adc(data) || has_10_9mv_adc(data))
: labels[nr]); label = labels_it8721[nr];
else
label = labels[nr];
return sprintf(buf, "%s\n", label);
} }
static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 0); static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 0);
static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 1); static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 1);
...@@ -1853,6 +1879,9 @@ static int __init it87_find(unsigned short *address, ...@@ -1853,6 +1879,9 @@ static int __init it87_find(unsigned short *address,
case IT8728F_DEVID: case IT8728F_DEVID:
sio_data->type = it8728; sio_data->type = it8728;
break; break;
case IT8732F_DEVID:
sio_data->type = it8732;
break;
case IT8771E_DEVID: case IT8771E_DEVID:
sio_data->type = it8771; sio_data->type = it8771;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment