Kernel driver lm90

Supported chips:

Author: Jean Delvare <jdelvare@suse.de>

Description

The LM90 is a digital temperature sensor. It senses its own temperature aswell as the temperature of up to one external diode. It is compatiblewith many other devices, many of which are supported by this driver.

The family of chips supported by this driver is derived from MAX1617.This chip as well as various compatible chips support a local and a remotetemperature sensor with 8 bit accuracy. Later chips provide improved accuracyand other additional features such as hysteresis and temperature offsetregisters.

Note that there is no easy way to differentiate between the MAX6657,MAX6658 and MAX6659 variants. The extra features of the MAX6659 are onlysupported by this driver if the chip is located at address 0x4d or 0x4e,or if the chip type is explicitly selected as max6659.The MAX6680 and MAX6681 only differ in their pinout, therefore they obviouslycan’t (and don’t need to) be distinguished.

The different chipsets of the family are not strictly identical, althoughvery similar. For reference, here comes a non-exhaustive list of specificfeatures:

LM84:
  • 8 bit sensor resolution

ADM1020, ADM1021, GL523SM, MAX1617, NE1617, NE1617A, THMC10:
  • 8 bit sensor resolution

  • Low temperature limits

NCT210, NE1618:
  • 11 bit sensor resolution for remote temperature sensor

  • Low temperature limits

ADM1021A, ADM1023:
  • Temperature offset register for remote temperature sensor

  • 11 bit resolution for remote temperature sensor

  • Low temperature limits

LM90:
  • 11 bit resolution for remote temperature sensor

  • Temperature offset register for remote temperature sensor

  • Low and critical temperature limits

  • Configurable conversion rate

  • Filter and alert configuration register at 0xBF.

  • ALERT is triggered by temperatures over critical limits.

LM86 and LM89:
  • Same as LM90

  • Better external channel accuracy

LM99:
  • Same as LM89

  • External temperature shifted by 16 degrees down

ADM1032:
  • Consecutive alert register at 0x22.

  • Conversion averaging.

  • Up to 64 conversions/s.

  • ALERT is triggered by open remote sensor.

  • SMBus PEC support for Write Byte and Receive Byte transactions.

ADT7461, ADT7461A, NCT1008:
  • Extended temperature range (breaks compatibility)

  • Lower resolution for remote temperature

  • SMBus PEC support for Write Byte and Receive Byte transactions.

  • 10 bit temperature resolution

ADT7481, ADT7482, ADT7483:
  • Temperature offset register

  • SMBus PEC support

  • 10 bit temperature resolution for external sensors

  • Two remote sensors

  • Selectable address (ADT7483)

MAX6642:
  • No critical limit register

  • Conversion rate not configurable

  • Better local resolution (10 bit)

  • 10 bit external sensor resolution

MAX6646, MAX6647, MAX6649:
  • Better local resolution

  • Extended range unsigned external temperature

MAX6648, MAX6692:
  • Better local resolution

  • Unsigned temperature

MAX6654, MAX6690:
  • Better local resolution

  • Selectable address

  • Remote sensor type selection

  • Extended temperature range

  • Extended resolution only available when conversion rate <= 1 Hz

MAX6657 and MAX6658:
  • Better local resolution

  • Remote sensor type selection

MAX6659:
  • Better local resolution

  • Selectable address

  • Second critical temperature limit

  • Remote sensor type selection

MAX6680 and MAX6681:
  • Selectable address

  • Remote sensor type selection

MAX6695 and MAX6696:
  • Better local resolution

  • Selectable address (max6696)

  • Second critical temperature limit

  • Two remote sensors

W83L771W/G
  • The G variant is lead-free, otherwise similar to the W.

  • Filter and alert configuration register at 0xBF

  • Moving average (depending on conversion rate)

W83L771AWG/ASG
  • Successor of the W83L771W/G, same features.

  • The AWG and ASG variants only differ in package format.

  • Diode ideality factor configuration (remote sensor) at 0xE3

NCT7716:
  • 8 bit sensor resolution

  • Selectable address

  • Configurable conversion rate

NCT7717:
  • 8 bit sensor resolution

  • Configurable conversion rate

NCT7718:
  • Temperature offset register for remote temperature sensor

  • 11 bit resolution for remote temperature sensor

  • Low temperature limits

  • Configurable conversion rate

SA56004X:
  • Better local resolution

All temperature values are given in degrees Celsius. Resolutionis 1.0 degree for the local temperature, 0.125 degree for the remotetemperature, except for the MAX6654, MAX6657, MAX6658 and MAX6659 which havea resolution of 0.125 degree for both temperatures.

Each sensor has its own high and low limits, plus a critical limit.Additionally, there is a relative hysteresis value common to both criticalvalues. To make life easier to user-space applications, two absolute valuesare exported, one for each channel, but these values are of course linked.Only the local hysteresis can be set from user-space, and the same deltaapplies to the remote hysteresis.

The lm90 driver will not update its values more frequently than configured withthe update_interval attribute; reading them more often will do no harm, but willreturn ‘old’ values.

SMBus Alert Support

This driver has basic support for SMBus alert. When an alert is received,the status register is read and the faulty temperature channel is logged.

The Analog Devices chips (ADM1032, ADT7461 and ADT7461A) and ONSemiconductor chips (NCT1008) do not implement the SMBus alert protocolproperly so additional care is needed: the ALERT output is disabled whenan alert is received, and is re-enabled only when the alarm is gone.Otherwise the chip would block alerts from other chips in the bus as longas the alarm is active.

PEC Support

The ADM1032 is the only chip of the family which supports PEC. It doesnot support PEC on all transactions though, so some care must be taken.

When reading a register value, the PEC byte is computed and sent by theADM1032 chip. However, in the case of a combined transaction (SMBus ReadByte), the ADM1032 computes the CRC value over only the second half ofthe message rather than its entirety, because it thinks the first halfof the message belongs to a different transaction. As a result, the CRCvalue differs from what the SMBus master expects, and all reads fail.

For this reason, the lm90 driver will enable PEC for the ADM1032 only ifthe bus supports the SMBus Send Byte and Receive Byte transaction types.These transactions will be used to read register values, instead ofSMBus Read Byte, and PEC will work properly.

Additionally, the ADM1032 doesn’t support SMBus Send Byte with PEC.Instead, it will try to write the PEC value to the register (because theSMBus Send Byte transaction with PEC is similar to a Write Byte transactionwithout PEC), which is not what we want. Thus, PEC is explicitly disabledon SMBus Send Byte transactions in the lm90 driver.

PEC on byte data transactions represents a significant increase in bandwidthusage (+33% for writes, +25% for reads) in normal conditions. With the needto use two SMBus transaction for reads, this overhead jumps to +50%. Worse,two transactions will typically mean twice as much delay waiting fortransaction completion, effectively doubling the register cache refresh time.I guess reliability comes at a price, but it’s quite expensive this time.

So, as not everyone might enjoy the slowdown, PEC is disabled by default andcan be enabled through sysfs. Just write 1 to the “pec” file and PEC will beenabled. Write 0 to that file to disable PEC again.