All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configuration
@ 2012-11-03 16:29 Guenter Roeck
  2012-11-03 20:11 ` [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configura Jean Delvare
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Guenter Roeck @ 2012-11-03 16:29 UTC (permalink / raw)
  To: lm-sensors

Add support to detect and report AMDTSI temperature sensor types.
Only enable PECI and AMDTSI sensor selection if the chip is configured
for it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Applies on top of the previously submitted patches.
Only tested with IT8728F and Intel CPU.

v2: Add AMDTSI support to IT8728F.

 drivers/hwmon/it87.c |   68 +++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 62 insertions(+), 6 deletions(-)

diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 6a1410b..ab5a8c5 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -228,6 +228,8 @@ static const u8 IT87_REG_TEMP_OFFSET[]	= { 0x56, 0x57, 0x59 };
 #define IT87_REG_AUTO_TEMP(nr, i) (0x60 + (nr) * 8 + (i))
 #define IT87_REG_AUTO_PWM(nr, i)  (0x65 + (nr) * 8 + (i))
 
+#define IT87_REG_AMDTSI_HSR    0x98
+
 struct it87_devices {
 	const char *name;
 	u16 features;
@@ -331,6 +333,7 @@ struct it87_data {
 	u16 features;
 	u8 peci_mask;
 	u8 old_peci_mask;
+	u8 ext_temp_type;	/* external temperature sensor type (5 or 6) */
 
 	unsigned short addr;
 	const char *name;
@@ -643,7 +646,7 @@ static ssize_t show_temp_type(struct device *dev, struct device_attribute *attr,
 
 	if ((has_temp_peci(data, nr) && (reg >> 6 = nr + 1))
 	    || (has_temp_old_peci(data, nr) && (extra & 0x80)))
-		return sprintf(buf, "6\n");  /* Intel PECI */
+		return sprintf(buf, "%u\n", data->ext_temp_type);
 	if (reg & (1 << nr))
 		return sprintf(buf, "3\n");  /* thermal diode */
 	if (reg & (8 << nr))
@@ -667,24 +670,26 @@ static ssize_t set_temp_type(struct device *dev, struct device_attribute *attr,
 	reg = it87_read_value(data, IT87_REG_TEMP_ENABLE);
 	reg &= ~(1 << nr);
 	reg &= ~(8 << nr);
-	if (has_temp_peci(data, nr) && (reg >> 6 = nr + 1 || val = 6))
+	if (has_temp_peci(data, nr) && (reg >> 6 = nr + 1 ||
+					val = data->ext_temp_type))
 		reg &= 0x3f;
 	extra = it87_read_value(data, IT87_REG_TEMP_EXTRA);
-	if (has_temp_old_peci(data, nr) && ((extra & 0x80) || val = 6))
+	if (has_temp_old_peci(data, nr) && ((extra & 0x80) ||
+					    val = data->ext_temp_type))
 		extra &= 0x7f;
 	if (val = 2) {	/* backwards compatibility */
 		dev_warn(dev,
 			 "Sensor type 2 is deprecated, please use 4 instead\n");
 		val = 4;
 	}
-	/* 3 = thermal diode; 4 = thermistor; 6 = Intel PECI; 0 = disabled */
+	/* 3 = thermal diode; 4 = thermistor; 5/6 = AMDTSI/PECI; 0 = disabled */
 	if (val = 3)
 		reg |= 1 << nr;
 	else if (val = 4)
 		reg |= 8 << nr;
-	else if (has_temp_peci(data, nr) && val = 6)
+	else if (has_temp_peci(data, nr) && val = data->ext_temp_type)
 		reg |= (nr + 1) << 6;
-	else if (has_temp_old_peci(data, nr) && val = 6)
+	else if (has_temp_old_peci(data, nr) && val = data->ext_temp_type)
 		extra |= 0x80;
 	else if (val != 0)
 		return -EINVAL;
@@ -1988,6 +1993,7 @@ static int __devinit it87_probe(struct platform_device *pdev)
 	int err = 0, i;
 	int enable_pwm_interface;
 	int fan_beep_need_rw;
+	u8 reg;
 
 	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
 	if (!devm_request_region(&pdev->dev, res->start, IT87_EC_EXTENT,
@@ -2030,6 +2036,56 @@ static int __devinit it87_probe(struct platform_device *pdev)
 		break;
 	}
 
+	if (data->features & FEAT_TEMP_OLD_PECI) {
+		reg = it87_read_value(data, IT87_REG_VID);
+		switch ((reg >> 4) & 0x07) {
+		case 0x0:
+		default:
+			data->features &+			  ~(FEAT_TEMP_OLD_PECI | FEAT_TEMP_PECI);
+			break;
+		case 0x3:	/* PCH (IT8721F) */
+			if (data->features & FEAT_TEMP_PECI) {
+				data->features &= ~FEAT_TEMP_PECI;
+				data->ext_temp_type = 6;
+			} else {
+				data->features &= ~FEAT_TEMP_OLD_PECI;
+			}
+			break;
+		case 0x4:	/* AMDTSI */
+			data->ext_temp_type = 5;
+			break;
+		case 0x5:	/* SST slave */
+		case 0x6:	/* PECI */
+		case 0x7:	/* SST host */
+			if (data->features & FEAT_TEMP_PECI)
+				data->features &= ~FEAT_TEMP_OLD_PECI;
+			data->ext_temp_type = 6;
+			break;
+		}
+	} else if (data->features & FEAT_TEMP_PECI) {
+		reg = it87_read_value(data, IT87_REG_VID);
+		switch ((reg >> 4) & 0x03) {
+		case 0x0:	/* disabled */
+			/* Check if AMDTSI is enabled */
+			if (reg & 0x40) {
+				reg = it87_read_value(data,
+						      IT87_REG_AMDTSI_HSR);
+				if (reg & 0x40) {
+					data->ext_temp_type = 5;
+					break;
+				}
+			}
+			data->features &= ~FEAT_TEMP_PECI;
+			break;
+		case 0x1:	/* SST slave */
+		case 0x2:	/* PECI */
+		case 0x3:	/* SST host */
+			data->ext_temp_type = 6;
+			break;
+		}
+	}
+
 	/* Now, we do the remaining detection. */
 	if ((it87_read_value(data, IT87_REG_CONFIG) & 0x80)
 	 || it87_read_value(data, IT87_REG_CHIPID) != 0x90)
-- 
1.7.9.7


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configura
  2012-11-03 16:29 [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configuration Guenter Roeck
@ 2012-11-03 20:11 ` Jean Delvare
  2012-11-03 21:46 ` Guenter Roeck
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Jean Delvare @ 2012-11-03 20:11 UTC (permalink / raw)
  To: lm-sensors

On Sat,  3 Nov 2012 09:29:44 -0700, Guenter Roeck wrote:
> Add support to detect and report AMDTSI temperature sensor types.
> Only enable PECI and AMDTSI sensor selection if the chip is configured
> for it.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Applies on top of the previously submitted patches.
> Only tested with IT8728F and Intel CPU.
> 
> v2: Add AMDTSI support to IT8728F.
> 
>  drivers/hwmon/it87.c |   68 +++++++++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 62 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
> index 6a1410b..ab5a8c5 100644
> --- a/drivers/hwmon/it87.c
> +++ b/drivers/hwmon/it87.c
> (...)
> @@ -2030,6 +2036,56 @@ static int __devinit it87_probe(struct platform_device *pdev)
>  		break;
>  	}
>  
> +	if (data->features & FEAT_TEMP_OLD_PECI) {
> +		reg = it87_read_value(data, IT87_REG_VID);
> +		switch ((reg >> 4) & 0x07) {
> +		case 0x0:
> +		default:
> +			data->features &> +			  ~(FEAT_TEMP_OLD_PECI | FEAT_TEMP_PECI);
> +			break;
> +		case 0x3:	/* PCH (IT8721F) */
> +			if (data->features & FEAT_TEMP_PECI) {
> +				data->features &= ~FEAT_TEMP_PECI;
> +				data->ext_temp_type = 6;
> +			} else {
> +				data->features &= ~FEAT_TEMP_OLD_PECI;
> +			}
> +			break;
> +		case 0x4:	/* AMDTSI */
> +			data->ext_temp_type = 5;
> +			break;
> +		case 0x5:	/* SST slave */
> +		case 0x6:	/* PECI */
> +		case 0x7:	/* SST host */
> +			if (data->features & FEAT_TEMP_PECI)
> +				data->features &= ~FEAT_TEMP_OLD_PECI;
> +			data->ext_temp_type = 6;
> +			break;
> +		}
> +	} else if (data->features & FEAT_TEMP_PECI) {
> +		reg = it87_read_value(data, IT87_REG_VID);
> +		switch ((reg >> 4) & 0x03) {
> +		case 0x0:	/* disabled */
> +			/* Check if AMDTSI is enabled */
> +			if (reg & 0x40) {
> +				reg = it87_read_value(data,
> +						      IT87_REG_AMDTSI_HSR);
> +				if (reg & 0x40) {
> +					data->ext_temp_type = 5;

I admit I don't quite get why ITE made these separate configuration
bits when all it brings is the possibility to select a non-working
combination...

I will also admit I'm kind of lost with the IT8728F. The datasheet
suggests that the PCH temperature can be retrieved but there is no
configuration bit to actually select it? Or if bit 6 of IT87_REG_VID
supposed to do exactly that? And if so, where does the reading go?

BTW maybe we should come up with a different name for register 0x0A for
newer chips, otherwise the code gets a little confusing. IT87_REG_IFSEL
maybe?


> +					break;
> +				}
> +			}
> +			data->features &= ~FEAT_TEMP_PECI;
> +			break;
> +		case 0x1:	/* SST slave */
> +		case 0x2:	/* PECI */
> +		case 0x3:	/* SST host */
> +			data->ext_temp_type = 6;
> +			break;
> +		}
> +	}


-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configura
  2012-11-03 16:29 [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configuration Guenter Roeck
  2012-11-03 20:11 ` [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configura Jean Delvare
@ 2012-11-03 21:46 ` Guenter Roeck
  2012-11-03 21:55 ` [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configur Jean Delvare
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Guenter Roeck @ 2012-11-03 21:46 UTC (permalink / raw)
  To: lm-sensors

On Sat, Nov 03, 2012 at 09:11:52PM +0100, Jean Delvare wrote:
> On Sat,  3 Nov 2012 09:29:44 -0700, Guenter Roeck wrote:
> > Add support to detect and report AMDTSI temperature sensor types.
> > Only enable PECI and AMDTSI sensor selection if the chip is configured
> > for it.
> > 
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > ---
> > Applies on top of the previously submitted patches.
> > Only tested with IT8728F and Intel CPU.
> > 
> > v2: Add AMDTSI support to IT8728F.
> > 
> >  drivers/hwmon/it87.c |   68 +++++++++++++++++++++++++++++++++++++++++++++-----
> >  1 file changed, 62 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
> > index 6a1410b..ab5a8c5 100644
> > --- a/drivers/hwmon/it87.c
> > +++ b/drivers/hwmon/it87.c
> > (...)
> > @@ -2030,6 +2036,56 @@ static int __devinit it87_probe(struct platform_device *pdev)
> >  		break;
> >  	}
> >  
> > +	if (data->features & FEAT_TEMP_OLD_PECI) {
> > +		reg = it87_read_value(data, IT87_REG_VID);
> > +		switch ((reg >> 4) & 0x07) {
> > +		case 0x0:
> > +		default:
> > +			data->features &> > +			  ~(FEAT_TEMP_OLD_PECI | FEAT_TEMP_PECI);
> > +			break;
> > +		case 0x3:	/* PCH (IT8721F) */
> > +			if (data->features & FEAT_TEMP_PECI) {
> > +				data->features &= ~FEAT_TEMP_PECI;
> > +				data->ext_temp_type = 6;
> > +			} else {
> > +				data->features &= ~FEAT_TEMP_OLD_PECI;
> > +			}
> > +			break;
> > +		case 0x4:	/* AMDTSI */
> > +			data->ext_temp_type = 5;
> > +			break;
> > +		case 0x5:	/* SST slave */
> > +		case 0x6:	/* PECI */
> > +		case 0x7:	/* SST host */
> > +			if (data->features & FEAT_TEMP_PECI)
> > +				data->features &= ~FEAT_TEMP_OLD_PECI;
> > +			data->ext_temp_type = 6;
> > +			break;
> > +		}
> > +	} else if (data->features & FEAT_TEMP_PECI) {
> > +		reg = it87_read_value(data, IT87_REG_VID);
> > +		switch ((reg >> 4) & 0x03) {
> > +		case 0x0:	/* disabled */
> > +			/* Check if AMDTSI is enabled */
> > +			if (reg & 0x40) {
> > +				reg = it87_read_value(data,
> > +						      IT87_REG_AMDTSI_HSR);
> > +				if (reg & 0x40) {
> > +					data->ext_temp_type = 5;
> 
> I admit I don't quite get why ITE made these separate configuration
> bits when all it brings is the possibility to select a non-working
> combination...
> 
> I will also admit I'm kind of lost with the IT8728F. The datasheet
> suggests that the PCH temperature can be retrieved but there is no
> configuration bit to actually select it? Or if bit 6 of IT87_REG_VID
> supposed to do exactly that? And if so, where does the reading go?
> 
Oh, there is. Bit 6 of IT87_REG_VID = 1, and bit 6 of register 0x98
(IT87_REG_AMDTSI_HSR) = 0, and then there are a couple additional bits in
register 0x9e (as I just noticed, meaning this patch is incomplete and I'll
have to send you another version for AMDTSI support on IT8728F).
Bit 4/5 of register 0xa are irrelevant for PCH on IT8728F.

Or at least that is how I think it works. I can not test it on my board, 
so I did not even bother trying to add support for it. It gets tricky, since
there are now, at least potentially, two separate "external" temperature
sensors, so we would have to change the code structure for it. Maybe sometime
later, if someone has a board supporting it and we can test if it actually
works.

> BTW maybe we should come up with a different name for register 0x0A for
> newer chips, otherwise the code gets a little confusing. IT87_REG_IFSEL
> maybe?
> 
Ok with me. Since I have to create another version of the patch anyway,
I'll merge that in, unless you want a separate patch for it.

Thanks,
Guenter

> 
> > +					break;
> > +				}
> > +			}
> > +			data->features &= ~FEAT_TEMP_PECI;
> > +			break;
> > +		case 0x1:	/* SST slave */
> > +		case 0x2:	/* PECI */
> > +		case 0x3:	/* SST host */
> > +			data->ext_temp_type = 6;
> > +			break;
> > +		}
> > +	}
> 
> 
> -- 
> Jean Delvare
> 

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict  sensor type configur
  2012-11-03 16:29 [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configuration Guenter Roeck
  2012-11-03 20:11 ` [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configura Jean Delvare
  2012-11-03 21:46 ` Guenter Roeck
@ 2012-11-03 21:55 ` Jean Delvare
  2015-08-04 21:48 ` [lm-sensors] [PATCH v2] hwmon: (it87) Add support for IT8732F Justin Maggard
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Jean Delvare @ 2012-11-03 21:55 UTC (permalink / raw)
  To: lm-sensors

On Sat, 3 Nov 2012 14:46:54 -0700, Guenter Roeck wrote:
> On Sat, Nov 03, 2012 at 09:11:52PM +0100, Jean Delvare wrote:
> > I admit I don't quite get why ITE made these separate configuration
> > bits when all it brings is the possibility to select a non-working
> > combination...
> > 
> > I will also admit I'm kind of lost with the IT8728F. The datasheet
> > suggests that the PCH temperature can be retrieved but there is no
> > configuration bit to actually select it? Or if bit 6 of IT87_REG_VID
> > supposed to do exactly that? And if so, where does the reading go?
> > 
> Oh, there is. Bit 6 of IT87_REG_VID = 1, and bit 6 of register 0x98
> (IT87_REG_AMDTSI_HSR) = 0, and then there are a couple additional bits in
> register 0x9e (as I just noticed, meaning this patch is incomplete and I'll
> have to send you another version for AMDTSI support on IT8728F).
> Bit 4/5 of register 0xa are irrelevant for PCH on IT8728F.
> 
> Or at least that is how I think it works. I can not test it on my board, 
> so I did not even bother trying to add support for it. It gets tricky, since
> there are now, at least potentially, two separate "external" temperature
> sensors, so we would have to change the code structure for it. Maybe sometime
> later, if someone has a board supporting it and we can test if it actually
> works.

Ack.

> > BTW maybe we should come up with a different name for register 0x0A for
> > newer chips, otherwise the code gets a little confusing. IT87_REG_IFSEL
> > maybe?
>
> Ok with me. Since I have to create another version of the patch anyway,
> I'll merge that in, unless you want a separate patch for it.

No, merged is fine.

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [lm-sensors] [PATCH v2] hwmon: (it87) Add support for IT8732F
  2012-11-03 16:29 [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configuration Guenter Roeck
                   ` (2 preceding siblings ...)
  2012-11-03 21:55 ` [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configur Jean Delvare
@ 2015-08-04 21:48 ` Justin Maggard
  2015-08-04 22:05 ` Guenter Roeck
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Justin Maggard @ 2015-08-04 21:48 UTC (permalink / raw)
  To: lm-sensors

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: Justin Maggard <jmaggard@netgear.com>
---
 Documentation/hwmon/it87 | 35 ++++++++++++++++++++++-------------
 drivers/hwmon/it87.c     | 43 ++++++++++++++++++++++++++++++++++++-------
 2 files changed, 58 insertions(+), 20 deletions(-)

diff --git a/Documentation/hwmon/it87 b/Documentation/hwmon/it87
index e872948..733296d 100644
--- a/Documentation/hwmon/it87
+++ b/Documentation/hwmon/it87
@@ -38,6 +38,10 @@ Supported chips:
     Prefix: 'it8728'
     Addresses scanned: from Super I/O config space (8 I/O ports)
     Datasheet: Not publicly available
+  * IT8732F
+    Prefix: 'it8732'
+    Addresses scanned: from Super I/O config space (8 I/O ports)
+    Datasheet: Not publicly available
   * IT8771E
     Prefix: 'it8771'
     Addresses scanned: from Super I/O config space (8 I/O ports)
@@ -111,9 +115,9 @@ Description
 -----------
 
 This driver implements support for the IT8603E, IT8620E, IT8623E, IT8705F,
-IT8712F, IT8716F, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E,
-IT8771E, IT8772E, IT8781F, IT8782F, IT8783E/F, IT8786E, IT8790E, and SiS950
-chips.
+IT8712F, IT8716F, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8732F,
+IT8758E, IT8771E, IT8772E, IT8781F, IT8782F, IT8783E/F, IT8786E, IT8790E, and
+SiS950 chips.
 
 These chips are 'Super I/O chips', supporting floppy disks, infrared ports,
 joysticks and other miscellaneous stuff. For hardware monitoring, they
@@ -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
 driver.
 
-The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E, IT8781F, IT8782F, IT8783E/F,
-and late IT8712F and IT8705F also have optional 16-bit tachometer counters
-for fans 1 to 3. This is better (no more fan clock divider mess) but not
-compatible with the older chips and revisions. The 16-bit tachometer mode
+The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E, IT8732F, IT8781F, IT8782F,
+IT8783E/F, and late IT8712F and IT8705F also have optional 16-bit tachometer
+counters for fans 1 to 3. This is better (no more fan clock divider mess) but
+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.
 
 The IT8726F is just bit enhanced IT8716F with additional hardware
@@ -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 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
 when the Overtemperature Shutdown limit is crossed.
 
@@ -173,12 +180,14 @@ is done.
 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
 maximum limit. Note that minimum in this case always means 'closest to
-zero'; this is important for negative voltage measurements. All voltage
-inputs can measure voltages between 0 and 4.08 volts, with a resolution of
-0.016 volt (except IT8603E, IT8721F/IT8758E and IT8728F: 0.012 volt.) The
-battery voltage in8 does not have limit registers.
-
-On the IT8603E, IT8721F/IT8758E, IT8781F, IT8782F, and IT8783E/F, some
+zero'; this is important for negative voltage measurements. On most chips, all
+voltage inputs can measure voltages between 0 and 4.08 volts, with a resolution
+of 0.016 volt.  IT8603E, IT8721F/IT8758E and IT8728F can measure between 0 and
+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
+have limit registers.
+
+On the IT8603E, IT8721F/IT8758E, IT8732F, IT8781F, IT8782F, and IT8783E/F, some
 voltage inputs are internal and scaled inside the chip:
 * in3 (optional)
 * in7 (optional for IT8781F, IT8782F, and IT8783E/F)
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index d0ee556..3ed6663 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -21,6 +21,7 @@
  *            IT8721F  Super I/O chip w/LPC interface
  *            IT8726F  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
  *            IT8771E  Super I/O chip w/LPC interface
  *            IT8772E  Super I/O chip w/LPC interface
@@ -69,8 +70,9 @@
 
 #define DRVNAME "it87"
 
-enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728, it8771,
-	     it8772, it8781, it8782, it8783, it8786, it8790, it8603, it8620 };
+enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728, it8732,
+	     it8771, it8772, it8781, it8782, it8783, it8786, it8790, it8603,
+	     it8620 };
 
 static unsigned short force_id;
 module_param(force_id, ushort, 0);
@@ -147,6 +149,7 @@ static inline void superio_exit(void)
 #define IT8720F_DEVID 0x8720
 #define IT8721F_DEVID 0x8721
 #define IT8726F_DEVID 0x8726
+#define IT8732F_DEVID 0x8732
 #define IT8728F_DEVID 0x8728
 #define IT8771E_DEVID 0x8771
 #define IT8772E_DEVID 0x8772
@@ -265,6 +268,7 @@ struct it87_devices {
 #define FEAT_VID		(1 << 9)	/* Set if chip supports VID */
 #define FEAT_IN7_INTERNAL	(1 << 10)	/* Set if in7 is internal */
 #define FEAT_SIX_FANS		(1 << 11)	/* Supports six fans */
+#define FEAT_10_9MV_ADC		(1 << 12)
 
 static const struct it87_devices it87_devices[] = {
 	[it87] = {
@@ -315,6 +319,15 @@ static const struct it87_devices it87_devices[] = {
 		  | FEAT_IN7_INTERNAL,
 		.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] = {
 		.name = "it8771",
 		.suffix = "E",
@@ -391,6 +404,7 @@ static const struct it87_devices it87_devices[] = {
 
 #define has_16bit_fans(data)	((data)->features & FEAT_16BIT_FANS)
 #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_old_autopwm(data)	((data)->features & FEAT_OLD_AUTOPWM)
 #define has_temp_offset(data)	((data)->features & FEAT_TEMP_OFFSET)
@@ -475,7 +489,14 @@ struct it87_data {
 
 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))
 		lsb <<= 1;
 	return lsb;
@@ -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)
 {
-	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);
 }
 
 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)
@@ -1515,9 +1536,14 @@ static ssize_t show_label(struct device *dev, struct device_attribute *attr,
 	};
 	struct it87_data *data = dev_get_drvdata(dev);
 	int nr = to_sensor_dev_attr(attr)->index;
+	const char *label;
 
-	return sprintf(buf, "%s\n", has_12mv_adc(data) ? labels_it8721[nr]
-						       : labels[nr]);
+	if (has_12mv_adc(data) || has_10_9mv_adc(data))
+		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(in7_label, S_IRUGO, show_label, NULL, 1);
@@ -1853,6 +1879,9 @@ static int __init it87_find(unsigned short *address,
 	case IT8728F_DEVID:
 		sio_data->type = it8728;
 		break;
+	case IT8732F_DEVID:
+		sio_data->type = it8732;
+		break;
 	case IT8771E_DEVID:
 		sio_data->type = it8771;
 		break;
-- 
2.5.0


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [lm-sensors] [PATCH v2] hwmon: (it87) Add support for IT8732F
  2012-11-03 16:29 [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configuration Guenter Roeck
                   ` (3 preceding siblings ...)
  2015-08-04 21:48 ` [lm-sensors] [PATCH v2] hwmon: (it87) Add support for IT8732F Justin Maggard
@ 2015-08-04 22:05 ` Guenter Roeck
  2015-08-05 19:18 ` Justin Maggard
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Guenter Roeck @ 2015-08-04 22:05 UTC (permalink / raw)
  To: lm-sensors

On 08/04/2015 02:48 PM, Justin Maggard wrote:
> 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: Justin Maggard <jmaggard@netgear.com>

Hi Justin,

> ---
>   Documentation/hwmon/it87 | 35 ++++++++++++++++++++++-------------
>   drivers/hwmon/it87.c     | 43 ++++++++++++++++++++++++++++++++++++-------

I forgot earlier: Please also list the chip in drivers/hwmon/Kconfig.

[ ... ]
>   static const struct it87_devices it87_devices[] = {
>   	[it87] = {
> @@ -315,6 +319,15 @@ static const struct it87_devices it87_devices[] = {
>   		  | FEAT_IN7_INTERNAL,
>   		.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 */

 From the little information we have, I suspect that this may be wrong.
The chip is probably closer to 8771/8772. Please check if the code path
executed if has_temp_old_peci() is true is executed correctly,
and that the registers used in that code path report what is expected.
Most likely FEAT_TEMP_OLD_PECI and old_peci_mask should not be set.

Thanks,
Guenter


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [lm-sensors] [PATCH v2] hwmon: (it87) Add support for IT8732F
  2012-11-03 16:29 [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configuration Guenter Roeck
                   ` (4 preceding siblings ...)
  2015-08-04 22:05 ` Guenter Roeck
@ 2015-08-05 19:18 ` Justin Maggard
  2015-08-05 19:38 ` Guenter Roeck
  2015-08-05 19:52 ` Justin Maggard
  7 siblings, 0 replies; 9+ messages in thread
From: Justin Maggard @ 2015-08-05 19:18 UTC (permalink / raw)
  To: lm-sensors

On Tue, Aug 4, 2015 at 3:05 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> On 08/04/2015 02:48 PM, Justin Maggard wrote:
>>
>> 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: Justin Maggard <jmaggard@netgear.com>
>
>
> Hi Justin,
>
>> ---
>>   Documentation/hwmon/it87 | 35 ++++++++++++++++++++++-------------
>>   drivers/hwmon/it87.c     | 43
>> ++++++++++++++++++++++++++++++++++++-------
>
>
> I forgot earlier: Please also list the chip in drivers/hwmon/Kconfig.
>

OK, it'll be there in v3. :-)

> [ ... ]
>>
>>   static const struct it87_devices it87_devices[] = {
>>         [it87] = {
>> @@ -315,6 +319,15 @@ static const struct it87_devices it87_devices[] = {
>>                   | FEAT_IN7_INTERNAL,
>>                 .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 */
>
>
> From the little information we have, I suspect that this may be wrong.
> The chip is probably closer to 8771/8772. Please check if the code path
> executed if has_temp_old_peci() is true is executed correctly,
> and that the registers used in that code path report what is expected.
> Most likely FEAT_TEMP_OLD_PECI and old_peci_mask should not be set.
>

I think I'm getting a little confused here.  Both IT8721 and IT8732
claim to use IT87_REG_TEMP_EXTRA bit 7 to enable PCH temperature
mapping to 0x2a.   IT87_REG_TEMP_ENABLE bits 7-6 match IT8772, and
bits 5-0 match IT8721.

-Justin

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [lm-sensors] [PATCH v2] hwmon: (it87) Add support for IT8732F
  2012-11-03 16:29 [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configuration Guenter Roeck
                   ` (5 preceding siblings ...)
  2015-08-05 19:18 ` Justin Maggard
@ 2015-08-05 19:38 ` Guenter Roeck
  2015-08-05 19:52 ` Justin Maggard
  7 siblings, 0 replies; 9+ messages in thread
From: Guenter Roeck @ 2015-08-05 19:38 UTC (permalink / raw)
  To: lm-sensors

On 08/05/2015 12:18 PM, Justin Maggard wrote:
> On Tue, Aug 4, 2015 at 3:05 PM, Guenter Roeck <linux@roeck-us.net> wrote:
>> On 08/04/2015 02:48 PM, Justin Maggard wrote:
>>>
>>> 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: Justin Maggard <jmaggard@netgear.com>
>>
>>
>> Hi Justin,
>>
>>> ---
>>>    Documentation/hwmon/it87 | 35 ++++++++++++++++++++++-------------
>>>    drivers/hwmon/it87.c     | 43
>>> ++++++++++++++++++++++++++++++++++++-------
>>
>>
>> I forgot earlier: Please also list the chip in drivers/hwmon/Kconfig.
>>
>
> OK, it'll be there in v3. :-)
>
>> [ ... ]
>>>
>>>    static const struct it87_devices it87_devices[] = {
>>>          [it87] = {
>>> @@ -315,6 +319,15 @@ static const struct it87_devices it87_devices[] = {
>>>                    | FEAT_IN7_INTERNAL,
>>>                  .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 */
>>
>>
>>  From the little information we have, I suspect that this may be wrong.
>> The chip is probably closer to 8771/8772. Please check if the code path
>> executed if has_temp_old_peci() is true is executed correctly,
>> and that the registers used in that code path report what is expected.
>> Most likely FEAT_TEMP_OLD_PECI and old_peci_mask should not be set.
>>
>
> I think I'm getting a little confused here.  Both IT8721 and IT8732
> claim to use IT87_REG_TEMP_EXTRA bit 7 to enable PCH temperature
> mapping to 0x2a.   IT87_REG_TEMP_ENABLE bits 7-6 match IT8772, and
> bits 5-0 match IT8721.
>

Me too ;-), but from your description it sounds like your definitions are
correct.

It is really annoying that ITE is so secretive about their chips.

Thanks,
Guenter


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [lm-sensors] [PATCH v2] hwmon: (it87) Add support for IT8732F
  2012-11-03 16:29 [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configuration Guenter Roeck
                   ` (6 preceding siblings ...)
  2015-08-05 19:38 ` Guenter Roeck
@ 2015-08-05 19:52 ` Justin Maggard
  7 siblings, 0 replies; 9+ messages in thread
From: Justin Maggard @ 2015-08-05 19:52 UTC (permalink / raw)
  To: lm-sensors

On Wed, Aug 5, 2015 at 12:38 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> On 08/05/2015 12:18 PM, Justin Maggard wrote:
>>
>> On Tue, Aug 4, 2015 at 3:05 PM, Guenter Roeck <linux@roeck-us.net> wrote:
>>>
>>> On 08/04/2015 02:48 PM, Justin Maggard wrote:
>>>>
>>>>
>>>> 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: Justin Maggard <jmaggard@netgear.com>
>>>
>>>
>>>
>>> Hi Justin,
>>>
>>>> ---
>>>>    Documentation/hwmon/it87 | 35 ++++++++++++++++++++++-------------
>>>>    drivers/hwmon/it87.c     | 43
>>>> ++++++++++++++++++++++++++++++++++++-------
>>>
>>>
>>>
>>> I forgot earlier: Please also list the chip in drivers/hwmon/Kconfig.
>>>
>>
>> OK, it'll be there in v3. :-)
>>
>>> [ ... ]
>>>>
>>>>
>>>>    static const struct it87_devices it87_devices[] = {
>>>>          [it87] = {
>>>> @@ -315,6 +319,15 @@ static const struct it87_devices it87_devices[] = {
>>>>                    | FEAT_IN7_INTERNAL,
>>>>                  .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 */
>>>
>>>
>>>
>>>  From the little information we have, I suspect that this may be wrong.
>>> The chip is probably closer to 8771/8772. Please check if the code path
>>> executed if has_temp_old_peci() is true is executed correctly,
>>> and that the registers used in that code path report what is expected.
>>> Most likely FEAT_TEMP_OLD_PECI and old_peci_mask should not be set.
>>>
>>
>> I think I'm getting a little confused here.  Both IT8721 and IT8732
>> claim to use IT87_REG_TEMP_EXTRA bit 7 to enable PCH temperature
>> mapping to 0x2a.   IT87_REG_TEMP_ENABLE bits 7-6 match IT8772, and
>> bits 5-0 match IT8721.
>>
>
> Me too ;-), but from your description it sounds like your definitions are
> correct.
>

Cool, then v3 will be coming shortly...

> It is really annoying that ITE is so secretive about their chips.
>

Yes, agreed.  Until I get approval to share the datasheet, feel free
to ping me if you have any particular questions.

-Justin

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-08-05 19:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-03 16:29 [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configuration Guenter Roeck
2012-11-03 20:11 ` [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configura Jean Delvare
2012-11-03 21:46 ` Guenter Roeck
2012-11-03 21:55 ` [lm-sensors] [PATCH v2] hwmon: (it87) Add support for AMDTSI, and restrict sensor type configur Jean Delvare
2015-08-04 21:48 ` [lm-sensors] [PATCH v2] hwmon: (it87) Add support for IT8732F Justin Maggard
2015-08-04 22:05 ` Guenter Roeck
2015-08-05 19:18 ` Justin Maggard
2015-08-05 19:38 ` Guenter Roeck
2015-08-05 19:52 ` Justin Maggard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.