提交 150cd843 编写于 作者: L Linus Torvalds

Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: (68 commits)
  hwmon: (it87) Add support for the IT8721F/IT8758E
  hwmon: (it87) Move conversion functions
  hwmon: Remove many EXPERIMENTAL flags
  hwmon: (lm85) Add support for ADT7468 high-frequency PWM mode
  hwmon: (lm85) Document the ADT7468 as supported
  hwmon: (lm85) Fix ADT7468 frequency table
  hwmon: I2C addresses are constant
  Move ams driver to macintosh
  hwmon: (pcf8591) Don't attempt to detect devices
  hwmon: (pcf8591) Register as a hwmon device
  hwmon: (w83795) Use standard attributes for chassis intrusion
  hwmon: (w83795) Exclude fan control feature by default
  hwmon: (w83795) Add myself as co-author and maintainer
  hwmon: (w83795) More style cleanups
  hwmon: (w83795) Fix LSB reading of voltage limits
  hwmon: (w83795) Use dev_get_drvdata() where possible
  hwmon: (w83795) Delay reading pwm config registers
  hwmon: (w83795) Delay reading limit registers
  hwmon: (w83795) Move register reads to dedicated functions
  hwmon: (w83795) Pack similar register reads
  ...
......@@ -22,6 +22,10 @@ Supported chips:
Prefix: 'it8720'
Addresses scanned: from Super I/O config space (8 I/O ports)
Datasheet: Not publicly available
* IT8721F/IT8758E
Prefix: 'it8721'
Addresses scanned: from Super I/O config space (8 I/O ports)
Datasheet: Not publicly available
* SiS950 [clone of IT8705F]
Prefix: 'it87'
Addresses scanned: from Super I/O config space (8 I/O ports)
......@@ -67,7 +71,7 @@ Description
-----------
This driver implements support for the IT8705F, IT8712F, IT8716F,
IT8718F, IT8720F, IT8726F and SiS950 chips.
IT8718F, IT8720F, IT8721F, IT8726F, IT8758E and SiS950 chips.
These chips are 'Super I/O chips', supporting floppy disks, infrared ports,
joysticks and other miscellaneous stuff. For hardware monitoring, they
......@@ -86,14 +90,15 @@ the driver won't notice and report changes in the VID value. The two
upper VID bits share their pins with voltage inputs (in5 and in6) so you
can't have both on a given board.
The IT8716F, IT8718F, IT8720F and later IT8712F revisions have support for
2 additional fans. The additional fans are supported by the driver.
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 and IT8720F, 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 IT8716F, IT8718F, IT8720F and IT8721F/IT8758E, 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
for AMD power sequencing. Therefore the chip will appear as IT8716F
......@@ -115,7 +120,12 @@ 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. The battery voltage in8 does not have limit registers.
0.016 volt (except IT8721F/IT8758E: 0.012 volt.) The battery voltage in8 does
not have limit registers.
On the IT8721F/IT8758E, some voltage inputs are internal and scaled inside
the chip (in7, in8 and optionally in3). The driver handles this transparently
so user-space doesn't have to care.
The VID lines (IT8712F/IT8716F/IT8718F/IT8720F) encode the core voltage value:
the voltage level your processor should work with. This is hardcoded by
......
......@@ -14,6 +14,10 @@ Supported chips:
Prefix: 'adt7463'
Addresses scanned: I2C 0x2c, 0x2d, 0x2e
Datasheet: http://www.onsemi.com/PowerSolutions/product.do?id=ADT7463
* Analog Devices ADT7468
Prefix: 'adt7468'
Addresses scanned: I2C 0x2c, 0x2d, 0x2e
Datasheet: http://www.onsemi.com/PowerSolutions/product.do?id=ADT7468
* SMSC EMC6D100, SMSC EMC6D101
Prefix: 'emc6d100'
Addresses scanned: I2C 0x2c, 0x2d, 0x2e
......@@ -34,7 +38,7 @@ Description
-----------
This driver implements support for the National Semiconductor LM85 and
compatible chips including the Analog Devices ADM1027, ADT7463 and
compatible chips including the Analog Devices ADM1027, ADT7463, ADT7468 and
SMSC EMC6D10x chips family.
The LM85 uses the 2-wire interface compatible with the SMBUS 2.0
......@@ -87,14 +91,22 @@ To smooth the response of fans to changes in temperature, the LM85 has an
optional filter for smoothing temperatures. The ADM1027 has the same
config option but uses it to rate limit the changes to fan speed instead.
The ADM1027 and ADT7463 have a 10-bit ADC and can therefore measure
temperatures with 0.25 degC resolution. They also provide an offset to the
temperature readings that is automatically applied during measurement.
This offset can be used to zero out any errors due to traces and placement.
The documentation says that the offset is in 0.25 degC steps, but in
initial testing of the ADM1027 it was 1.00 degC steps. Analog Devices has
confirmed this "bug". The ADT7463 is reported to work as described in the
documentation. The current lm85 driver does not show the offset register.
The ADM1027, ADT7463 and ADT7468 have a 10-bit ADC and can therefore
measure temperatures with 0.25 degC resolution. They also provide an offset
to the temperature readings that is automatically applied during
measurement. This offset can be used to zero out any errors due to traces
and placement. The documentation says that the offset is in 0.25 degC
steps, but in initial testing of the ADM1027 it was 1.00 degC steps. Analog
Devices has confirmed this "bug". The ADT7463 is reported to work as
described in the documentation. The current lm85 driver does not show the
offset register.
The ADT7468 has a high-frequency PWM mode, where all PWM outputs are
driven by a 22.5 kHz clock. This is a global mode, not per-PWM output,
which means that setting any PWM frequency above 11.3 kHz will switch
all 3 PWM outputs to a 22.5 kHz frequency. Conversely, setting any PWM
frequency below 11.3 kHz will switch all 3 PWM outputs to a frequency
between 10 and 100 Hz, which can then be tuned separately.
See the vendor datasheets for more information. There is application note
from National (AN-1260) with some additional information about the LM85.
......@@ -125,17 +137,17 @@ datasheet for a complete description of the differences. Other than
identifying the chip, the driver behaves no differently with regard to
these two chips. The LM85B is recommended for new designs.
The ADM1027 and ADT7463 chips have an optional SMBALERT output that can be
used to signal the chipset in case a limit is exceeded or the temperature
sensors fail. Individual sensor interrupts can be masked so they won't
trigger SMBALERT. The SMBALERT output if configured replaces one of the other
functions (PWM2 or IN0). This functionality is not implemented in current
driver.
The ADM1027, ADT7463 and ADT7468 chips have an optional SMBALERT output
that can be used to signal the chipset in case a limit is exceeded or the
temperature sensors fail. Individual sensor interrupts can be masked so
they won't trigger SMBALERT. The SMBALERT output if configured replaces one
of the other functions (PWM2 or IN0). This functionality is not implemented
in current driver.
The ADT7463 also has an optional THERM output/input which can be connected
to the processor PROC_HOT output. If available, the autofan control
dynamic Tmin feature can be enabled to keep the system temperature within
spec (just?!) with the least possible fan noise.
The ADT7463 and ADT7468 also have an optional THERM output/input which can
be connected to the processor PROC_HOT output. If available, the autofan
control dynamic Tmin feature can be enabled to keep the system temperature
within spec (just?!) with the least possible fan noise.
Configuration Notes
-------------------
......@@ -201,8 +213,8 @@ the temperatures to compensate for systemic errors in the
measurements. These features are not currently supported by the lm85
driver.
In addition to the ADM1027 features, the ADT7463 also has Tmin control
and THERM asserted counts. Automatic Tmin control acts to adjust the
Tmin value to maintain the measured temperature sensor at a specified
temperature. There isn't much documentation on this feature in the
ADT7463 data sheet. This is not supported by current driver.
In addition to the ADM1027 features, the ADT7463 and ADT7468 also have
Tmin control and THERM asserted counts. Automatic Tmin control acts to
adjust the Tmin value to maintain the measured temperature sensor at a
specified temperature. There isn't much documentation on this feature in
the ADT7463 data sheet. This is not supported by current driver.
......@@ -63,8 +63,8 @@ Supported chips:
Datasheet: Publicly available at the Maxim website
http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578
* Maxim MAX6659
Prefix: 'max6657'
Addresses scanned: I2C 0x4c, 0x4d (unsupported 0x4e)
Prefix: 'max6659'
Addresses scanned: I2C 0x4c, 0x4d, 0x4e
Datasheet: Publicly available at the Maxim website
http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578
* Maxim MAX6680
......@@ -84,6 +84,21 @@ Supported chips:
Addresses scanned: I2C 0x4c
Datasheet: Publicly available at the Maxim website
http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3500
* Maxim MAX6695
Prefix: 'max6695'
Addresses scanned: I2C 0x18
Datasheet: Publicly available at the Maxim website
http://www.maxim-ic.com/datasheet/index.mvp/id/4199
* Maxim MAX6696
Prefix: 'max6695'
Addresses scanned: I2C 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b,
0x4c, 0x4d and 0x4e
Datasheet: Publicly available at the Maxim website
http://www.maxim-ic.com/datasheet/index.mvp/id/4199
* Winbond/Nuvoton W83L771W/G
Prefix: 'w83l771'
Addresses scanned: I2C 0x4c
Datasheet: No longer available
* Winbond/Nuvoton W83L771AWG/ASG
Prefix: 'w83l771'
Addresses scanned: I2C 0x4c
......@@ -101,10 +116,11 @@ well as the temperature of up to one external diode. It is compatible
with many other devices, many of which are supported by this driver.
Note that there is no easy way to differentiate between the MAX6657,
MAX6658 and MAX6659 variants. The extra address and features of the
MAX6659 are not supported by this driver. The MAX6680 and MAX6681 only
differ in their pinout, therefore they obviously can't (and don't need to)
be distinguished.
MAX6658 and MAX6659 variants. The extra features of the MAX6659 are only
supported 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 obviously
can't (and don't need to) be distinguished.
The specificity of this family of chipsets over the ADM1021/LM84
family is that it features critical limits with hysteresis, and an
......@@ -151,11 +167,21 @@ 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.
* Filter and alert configuration register at 0xBF
* Diode ideality factor configuration (remote sensor) at 0xE3
* Moving average (depending on conversion rate)
All temperature values are given in degrees Celsius. Resolution
is 1.0 degree for the local temperature, 0.125 degree for the remote
......
......@@ -4,7 +4,7 @@ Kernel driver pcf8591
Supported chips:
* Philips/NXP PCF8591
Prefix: 'pcf8591'
Addresses scanned: I2C 0x48 - 0x4f
Addresses scanned: none
Datasheet: Publicly available at the NXP website
http://www.nxp.com/pip/PCF8591_6.html
......@@ -58,18 +58,16 @@ Module parameters
Accessing PCF8591 via /sys interface
-------------------------------------
! Be careful !
The PCF8591 is plainly impossible to detect! Stupid chip.
So every chip with address in the interval [0x48..0x4f] is
detected as PCF8591. If you have other chips in this address
range, the workaround is to load this module after the one
for your others chips.
The PCF8591 is plainly impossible to detect! Thus the driver won't even
try. You have to explicitly instantiate the device at the relevant
address (in the interval [0x48..0x4f]) either through platform data, or
using the sysfs interface. See Documentation/i2c/instantiating-devices
for details.
On detection (i.e. insmod, modprobe et al.), directories are being
created for each detected PCF8591:
Directories are being created for each instantiated PCF8591:
/sys/bus/i2c/devices/<0>-<1>/
where <0> is the bus the chip was detected on (e. g. i2c-0)
where <0> is the bus the chip is connected to (e. g. i2c-0)
and <1> the chip address ([48..4f])
Inside these directories, there are such files:
......
......@@ -309,6 +309,20 @@ temp[1-*]_crit_hyst
from the critical value.
RW
temp[1-*]_emergency
Temperature emergency max value, for chips supporting more than
two upper temperature limits. Must be equal or greater than
corresponding temp_crit values.
Unit: millidegree Celsius
RW
temp[1-*]_emergency_hyst
Temperature hysteresis value for emergency limit.
Unit: millidegree Celsius
Must be reported as an absolute temperature, NOT a delta
from the emergency value.
RW
temp[1-*]_lcrit Temperature critical min value, typically lower than
corresponding temp_min values.
Unit: millidegree Celsius
......@@ -505,6 +519,7 @@ fan[1-*]_max_alarm
temp[1-*]_min_alarm
temp[1-*]_max_alarm
temp[1-*]_crit_alarm
temp[1-*]_emergency_alarm
Limit alarm
0: no alarm
1: alarm
......
......@@ -432,7 +432,7 @@ AMS (Apple Motion Sensor) DRIVER
M: Stelian Pop <stelian@popies.net>
M: Michael Hanselmann <linux-kernel@hansmi.ch>
S: Supported
F: drivers/hwmon/ams/
F: drivers/macintosh/ams/
AMSO1100 RNIC DRIVER
M: Tom Tucker <tom@opengridcomputing.com>
......@@ -6465,6 +6465,12 @@ S: Maintained
F: Documentation/hwmon/w83793
F: drivers/hwmon/w83793.c
W83795 HARDWARE MONITORING DRIVER
M: Jean Delvare <khali@linux-fr.org>
L: lm-sensors@lm-sensors.org
S: Maintained
F: drivers/hwmon/w83795.c
W83L51xD SD/MMC CARD INTERFACE DRIVER
M: Pierre Ossman <pierre@ossman.eu>
S: Maintained
......
......@@ -129,7 +129,7 @@ config SENSORS_ADM1025
config SENSORS_ADM1026
tristate "Analog Devices ADM1026 and compatibles"
depends on I2C && EXPERIMENTAL
depends on I2C
select HWMON_VID
help
If you say yes here you get support for Analog Devices ADM1026
......@@ -140,7 +140,7 @@ config SENSORS_ADM1026
config SENSORS_ADM1029
tristate "Analog Devices ADM1029"
depends on I2C && EXPERIMENTAL
depends on I2C
help
If you say yes here you get support for Analog Devices ADM1029
sensor chip.
......@@ -151,7 +151,7 @@ config SENSORS_ADM1029
config SENSORS_ADM1031
tristate "Analog Devices ADM1031 and compatibles"
depends on I2C && EXPERIMENTAL
depends on I2C
help
If you say yes here you get support for Analog Devices ADM1031
and ADM1030 sensor chips.
......@@ -202,7 +202,7 @@ config SENSORS_ADT7470
config SENSORS_ADT7475
tristate "Analog Devices ADT7473, ADT7475, ADT7476 and ADT7490"
depends on I2C && EXPERIMENTAL
depends on I2C
select HWMON_VID
help
If you say yes here you get support for the Analog Devices
......@@ -249,32 +249,6 @@ config SENSORS_K10TEMP
This driver can also be built as a module. If so, the module
will be called k10temp.
config SENSORS_AMS
tristate "Apple Motion Sensor driver"
depends on PPC_PMAC && !PPC64 && INPUT && ((ADB_PMU && I2C = y) || (ADB_PMU && !I2C) || I2C) && EXPERIMENTAL
select INPUT_POLLDEV
help
Support for the motion sensor included in PowerBooks. Includes
implementations for PMU and I2C.
This driver can also be built as a module. If so, the module
will be called ams.
config SENSORS_AMS_PMU
bool "PMU variant"
depends on SENSORS_AMS && ADB_PMU
default y
help
PMU variant of motion sensor, found in late 2005 PowerBooks.
config SENSORS_AMS_I2C
bool "I2C variant"
depends on SENSORS_AMS && I2C
default y
help
I2C variant of motion sensor, found in early 2005 PowerBooks and
iBooks.
config SENSORS_ASB100
tristate "Asus ASB100 Bach"
depends on X86 && I2C && EXPERIMENTAL
......@@ -322,7 +296,6 @@ config SENSORS_I5K_AMB
config SENSORS_F71805F
tristate "Fintek F71805F/FG, F71806F/FG and F71872F/FG"
depends on EXPERIMENTAL
help
If you say yes here you get support for hardware monitoring
features of the Fintek F71805F/FG, F71806F/FG and F71872F/FG
......@@ -333,7 +306,6 @@ config SENSORS_F71805F
config SENSORS_F71882FG
tristate "Fintek F71858FG, F71862FG, F71882FG, F71889FG and F8000"
depends on EXPERIMENTAL
help
If you say yes here you get support for hardware monitoring
features of the Fintek F71858FG, F71862FG/71863FG, F71882FG/F71883FG,
......@@ -343,8 +315,8 @@ config SENSORS_F71882FG
will be called f71882fg.
config SENSORS_F75375S
tristate "Fintek F75375S/SP and F75373";
depends on I2C && EXPERIMENTAL
tristate "Fintek F75375S/SP and F75373"
depends on I2C
help
If you say yes here you get support for hardware monitoring
features of the Fintek F75375S/SP and F75373
......@@ -456,8 +428,8 @@ config SENSORS_IT87
select HWMON_VID
help
If you say yes here you get support for ITE IT8705F, IT8712F,
IT8716F, IT8718F, IT8720F and IT8726F sensor chips, and the
SiS960 clone.
IT8716F, IT8718F, IT8720F, IT8721F, IT8726F and IT8758E sensor
chips, and the SiS960 clone.
This driver can also be built as a module. If so, the module
will be called it87.
......@@ -499,7 +471,7 @@ config SENSORS_LM63
config SENSORS_LM70
tristate "National Semiconductor LM70 / Texas Instruments TMP121"
depends on SPI_MASTER && EXPERIMENTAL
depends on SPI_MASTER
help
If you say yes here you get support for the National Semiconductor
LM70 and Texas Instruments TMP121/TMP123 digital temperature
......@@ -567,7 +539,7 @@ config SENSORS_LM78
config SENSORS_LM80
tristate "National Semiconductor LM80"
depends on I2C && EXPERIMENTAL
depends on I2C
help
If you say yes here you get support for National Semiconductor
LM80 sensor chips.
......@@ -587,11 +559,12 @@ config SENSORS_LM83
config SENSORS_LM85
tristate "National Semiconductor LM85 and compatibles"
depends on I2C && EXPERIMENTAL
depends on I2C
select HWMON_VID
help
If you say yes here you get support for National Semiconductor LM85
sensor chips and clones: ADT7463, EMC6D100, EMC6D102 and ADM1027.
sensor chips and clones: ADM1027, ADT7463, ADT7468, EMC6D100,
EMC6D101 and EMC6D102.
This driver can also be built as a module. If so, the module
will be called lm85.
......@@ -614,8 +587,8 @@ config SENSORS_LM90
If you say yes here you get support for National Semiconductor LM90,
LM86, LM89 and LM99, Analog Devices ADM1032 and ADT7461, Maxim
MAX6646, MAX6647, MAX6648, MAX6649, MAX6657, MAX6658, MAX6659,
MAX6680, MAX6681 and MAX6692, and Winbond/Nuvoton W83L771AWG/ASG
sensor chips.
MAX6680, MAX6681, MAX6692, MAX6695, MAX6696, and Winbond/Nuvoton
W83L771W/G/AWG/ASG sensor chips.
This driver can also be built as a module. If so, the module
will be called lm90.
......@@ -726,7 +699,6 @@ config SENSORS_PC87360
config SENSORS_PC87427
tristate "National Semiconductor PC87427"
depends on EXPERIMENTAL
help
If you say yes here you get access to the hardware monitoring
functions of the National Semiconductor PC87427 Super-I/O chip.
......@@ -763,14 +735,14 @@ config SENSORS_SHT15
will be called sht15.
config SENSORS_S3C
tristate "S3C24XX/S3C64XX Inbuilt ADC"
depends on ARCH_S3C2410
tristate "Samsung built-in ADC"
depends on S3C_ADC
help
If you say yes here you get support for the on-board ADCs of
the Samsung S3C24XX or S3C64XX series of SoC
the Samsung S3C24XX, S3C64XX and other series of SoC
This driver can also be built as a module. If so, the module
will be called s3c-hwmo.
will be called s3c-hwmon.
config SENSORS_S3C_RAW
bool "Include raw channel attributes in sysfs"
......@@ -854,7 +826,7 @@ config SENSORS_SMSC47M1
config SENSORS_SMSC47M192
tristate "SMSC LPC47M192 and compatibles"
depends on I2C && EXPERIMENTAL
depends on I2C
select HWMON_VID
help
If you say yes here you get support for the temperature and
......@@ -910,7 +882,7 @@ config SENSORS_AMC6821
config SENSORS_THMC50
tristate "Texas Instruments THMC50 / Analog Devices ADM1022"
depends on I2C && EXPERIMENTAL
depends on I2C
help
If you say yes here you get support for Texas Instruments THMC50
sensor chips and clones: the Analog Devices ADM1022.
......@@ -968,7 +940,6 @@ config SENSORS_VIA686A
config SENSORS_VT1211
tristate "VIA VT1211"
depends on EXPERIMENTAL
select HWMON_VID
help
If you say yes here then you get support for hardware monitoring
......@@ -1012,7 +983,7 @@ config SENSORS_W83791D
config SENSORS_W83792D
tristate "Winbond W83792D"
depends on I2C && EXPERIMENTAL
depends on I2C
help
If you say yes here you get support for the Winbond W83792D chip.
......@@ -1031,6 +1002,33 @@ config SENSORS_W83793
This driver can also be built as a module. If so, the module
will be called w83793.
config SENSORS_W83795
tristate "Winbond/Nuvoton W83795G/ADG"
depends on I2C && EXPERIMENTAL
help
If you say yes here you get support for the Winbond W83795G and
W83795ADG hardware monitoring chip.
This driver can also be built as a module. If so, the module
will be called w83795.
config SENSORS_W83795_FANCTRL
boolean "Include fan control support (DANGEROUS)"
depends on SENSORS_W83795 && EXPERIMENTAL
default n
help
If you say yes here, support for the both manual and automatic
fan control features will be included in the driver.
This part of the code wasn't carefully reviewed and tested yet,
so enabling this option is strongly discouraged on production
servers. Only developers and testers should enable it for the
time being.
Please also note that this option will create sysfs attribute
files which may change in the future, so you shouldn't rely
on them being stable.
config SENSORS_W83L785TS
tristate "Winbond W83L785TS-S"
depends on I2C && EXPERIMENTAL
......
......@@ -14,6 +14,7 @@ obj-$(CONFIG_SENSORS_ASB100) += asb100.o
obj-$(CONFIG_SENSORS_W83627HF) += w83627hf.o
obj-$(CONFIG_SENSORS_W83792D) += w83792d.o
obj-$(CONFIG_SENSORS_W83793) += w83793.o
obj-$(CONFIG_SENSORS_W83795) += w83795.o
obj-$(CONFIG_SENSORS_W83781D) += w83781d.o
obj-$(CONFIG_SENSORS_W83791D) += w83791d.o
......@@ -35,7 +36,6 @@ obj-$(CONFIG_SENSORS_ADT7462) += adt7462.o
obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o
obj-$(CONFIG_SENSORS_ADT7475) += adt7475.o
obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o
obj-$(CONFIG_SENSORS_AMS) += ams/
obj-$(CONFIG_SENSORS_ASC7621) += asc7621.o
obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o
obj-$(CONFIG_SENSORS_CORETEMP) += coretemp.o
......
......@@ -146,7 +146,7 @@
#define TEMP_OFFSET_REG(idx) (REG_TEMP_OFFSET_BASE + (idx))
#define TEMP_TRANGE_REG(idx) (REG_TEMP_TRANGE_BASE + (idx))
static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
enum chips { adt7473, adt7475, adt7476, adt7490 };
......
......@@ -28,7 +28,7 @@
#include <linux/mutex.h>
/* Addresses to scan */
static unsigned short normal_i2c[] = {
static const unsigned short normal_i2c[] = {
0x2c, 0x2d, 0x2e, I2C_CLIENT_END
};
......@@ -52,7 +52,7 @@ struct asc7621_chip {
u8 company_id;
u8 verstep_reg;
u8 verstep_id;
unsigned short *addresses;
const unsigned short *addresses;
};
static struct asc7621_chip asc7621_chips[] = {
......
......@@ -15,7 +15,9 @@
* IT8716F Super I/O chip w/LPC interface
* IT8718F Super I/O chip w/LPC interface
* IT8720F Super I/O chip w/LPC interface
* IT8721F Super I/O chip w/LPC interface
* IT8726F Super I/O chip w/LPC interface
* IT8758E Super I/O chip w/LPC interface
* Sis950 A clone of the IT8705F
*
* Copyright (C) 2001 Chris Gauthron
......@@ -54,7 +56,7 @@
#define DRVNAME "it87"
enum chips { it87, it8712, it8716, it8718, it8720 };
enum chips { it87, it8712, it8716, it8718, it8720, it8721 };
static unsigned short force_id;
module_param(force_id, ushort, 0);
......@@ -126,6 +128,7 @@ superio_exit(void)
#define IT8716F_DEVID 0x8716
#define IT8718F_DEVID 0x8718
#define IT8720F_DEVID 0x8720
#define IT8721F_DEVID 0x8721
#define IT8726F_DEVID 0x8726
#define IT87_ACT_REG 0x30
#define IT87_BASE_REG 0x60
......@@ -202,56 +205,6 @@ static const u8 IT87_REG_FANX_MIN[] = { 0x1b, 0x1c, 0x1d, 0x85, 0x87 };
#define IT87_REG_AUTO_TEMP(nr, i) (0x60 + (nr) * 8 + (i))
#define IT87_REG_AUTO_PWM(nr, i) (0x65 + (nr) * 8 + (i))
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) + 8)/16),0,255))
#define IN_FROM_REG(val) ((val) * 16)
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 255;
rpm = SENSORS_LIMIT(rpm, 1, 1000000);
return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1,
254);
}
static inline u16 FAN16_TO_REG(long rpm)
{
if (rpm == 0)
return 0xffff;
return SENSORS_LIMIT((1350000 + rpm) / (rpm * 2), 1, 0xfffe);
}
#define FAN_FROM_REG(val,div) ((val)==0?-1:(val)==255?0:1350000/((val)*(div)))
/* The divider is fixed to 2 in 16-bit mode */
#define FAN16_FROM_REG(val) ((val)==0?-1:(val)==0xffff?0:1350000/((val)*2))
#define TEMP_TO_REG(val) (SENSORS_LIMIT(((val)<0?(((val)-500)/1000):\
((val)+500)/1000),-128,127))
#define TEMP_FROM_REG(val) ((val) * 1000)
#define PWM_TO_REG(val) ((val) >> 1)
#define PWM_FROM_REG(val) (((val)&0x7f) << 1)
static int DIV_TO_REG(int val)
{
int answer = 0;
while (answer < 7 && (val >>= 1))
answer++;
return answer;
}
#define DIV_FROM_REG(val) (1 << (val))
static const unsigned int pwm_freq[8] = {
48000000 / 128,
24000000 / 128,
12000000 / 128,
8000000 / 128,
6000000 / 128,
3000000 / 128,
1500000 / 128,
750000 / 128,
};
struct it87_sio_data {
enum chips type;
......@@ -279,6 +232,7 @@ struct it87_data {
char valid; /* !=0 if following fields are valid */
unsigned long last_updated; /* In jiffies */
u16 in_scaled; /* Internal voltage sensors are scaled */
u8 in[9]; /* Register value */
u8 in_max[8]; /* Register value */
u8 in_min[8]; /* Register value */
......@@ -310,6 +264,96 @@ struct it87_data {
s8 auto_temp[3][5]; /* [nr][0] is point1_temp_hyst */
};
static u8 in_to_reg(const struct it87_data *data, int nr, long val)
{
long lsb;
if (data->type == it8721) {
if (data->in_scaled & (1 << nr))
lsb = 24;
else
lsb = 12;
} else
lsb = 16;
val = DIV_ROUND_CLOSEST(val, lsb);
return SENSORS_LIMIT(val, 0, 255);
}
static int in_from_reg(const struct it87_data *data, int nr, int val)
{
if (data->type == it8721) {
if (data->in_scaled & (1 << nr))
return val * 24;
else
return val * 12;
} else
return val * 16;
}
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 255;
rpm = SENSORS_LIMIT(rpm, 1, 1000000);
return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1,
254);
}
static inline u16 FAN16_TO_REG(long rpm)
{
if (rpm == 0)
return 0xffff;
return SENSORS_LIMIT((1350000 + rpm) / (rpm * 2), 1, 0xfffe);
}
#define FAN_FROM_REG(val, div) ((val) == 0 ? -1 : (val) == 255 ? 0 : \
1350000 / ((val) * (div)))
/* The divider is fixed to 2 in 16-bit mode */
#define FAN16_FROM_REG(val) ((val) == 0 ? -1 : (val) == 0xffff ? 0 : \
1350000 / ((val) * 2))
#define TEMP_TO_REG(val) (SENSORS_LIMIT(((val) < 0 ? (((val) - 500) / 1000) : \
((val) + 500) / 1000), -128, 127))
#define TEMP_FROM_REG(val) ((val) * 1000)
static u8 pwm_to_reg(const struct it87_data *data, long val)
{
if (data->type == it8721)
return val;
else
return val >> 1;
}
static int pwm_from_reg(const struct it87_data *data, u8 reg)
{
if (data->type == it8721)
return reg;
else
return (reg & 0x7f) << 1;
}
static int DIV_TO_REG(int val)
{
int answer = 0;
while (answer < 7 && (val >>= 1))
answer++;
return answer;
}
#define DIV_FROM_REG(val) (1 << (val))
static const unsigned int pwm_freq[8] = {
48000000 / 128,
24000000 / 128,
12000000 / 128,
8000000 / 128,
6000000 / 128,
3000000 / 128,
1500000 / 128,
750000 / 128,
};
static inline int has_16bit_fans(const struct it87_data *data)
{
/* IT8705F Datasheet 0.4.1, 3h == Version G.
......@@ -319,7 +363,8 @@ static inline int has_16bit_fans(const struct it87_data *data)
|| (data->type == it8712 && data->revision >= 0x08)
|| data->type == it8716
|| data->type == it8718
|| data->type == it8720;
|| data->type == it8720
|| data->type == it8721;
}
static inline int has_old_autopwm(const struct it87_data *data)
......@@ -357,7 +402,7 @@ static ssize_t show_in(struct device *dev, struct device_attribute *attr,
int nr = sensor_attr->index;
struct it87_data *data = it87_update_device(dev);
return sprintf(buf, "%d\n", IN_FROM_REG(data->in[nr]));
return sprintf(buf, "%d\n", in_from_reg(data, nr, data->in[nr]));
}
static ssize_t show_in_min(struct device *dev, struct device_attribute *attr,
......@@ -367,7 +412,7 @@ static ssize_t show_in_min(struct device *dev, struct device_attribute *attr,
int nr = sensor_attr->index;
struct it87_data *data = it87_update_device(dev);
return sprintf(buf, "%d\n", IN_FROM_REG(data->in_min[nr]));
return sprintf(buf, "%d\n", in_from_reg(data, nr, data->in_min[nr]));
}
static ssize_t show_in_max(struct device *dev, struct device_attribute *attr,
......@@ -377,7 +422,7 @@ static ssize_t show_in_max(struct device *dev, struct device_attribute *attr,
int nr = sensor_attr->index;
struct it87_data *data = it87_update_device(dev);
return sprintf(buf, "%d\n", IN_FROM_REG(data->in_max[nr]));
return sprintf(buf, "%d\n", in_from_reg(data, nr, data->in_max[nr]));
}
static ssize_t set_in_min(struct device *dev, struct device_attribute *attr,
......@@ -393,7 +438,7 @@ static ssize_t set_in_min(struct device *dev, struct device_attribute *attr,
return -EINVAL;
mutex_lock(&data->update_lock);
data->in_min[nr] = IN_TO_REG(val);
data->in_min[nr] = in_to_reg(data, nr, val);
it87_write_value(data, IT87_REG_VIN_MIN(nr),
data->in_min[nr]);
mutex_unlock(&data->update_lock);
......@@ -412,7 +457,7 @@ static ssize_t set_in_max(struct device *dev, struct device_attribute *attr,
return -EINVAL;
mutex_lock(&data->update_lock);
data->in_max[nr] = IN_TO_REG(val);
data->in_max[nr] = in_to_reg(data, nr, val);
it87_write_value(data, IT87_REG_VIN_MAX(nr),
data->in_max[nr]);
mutex_unlock(&data->update_lock);
......@@ -642,7 +687,8 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute *attr,
int nr = sensor_attr->index;
struct it87_data *data = it87_update_device(dev);
return sprintf(buf, "%d\n", PWM_FROM_REG(data->pwm_duty[nr]));
return sprintf(buf, "%d\n",
pwm_from_reg(data, data->pwm_duty[nr]));
}
static ssize_t show_pwm_freq(struct device *dev, struct device_attribute *attr,
char *buf)
......@@ -812,7 +858,7 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
return -EINVAL;
mutex_lock(&data->update_lock);
data->pwm_duty[nr] = PWM_TO_REG(val);
data->pwm_duty[nr] = pwm_to_reg(data, val);
/* If we are in manual mode, write the duty cycle immediately;
* otherwise, just store it for later use. */
if (!(data->pwm_ctrl[nr] & 0x80)) {
......@@ -916,7 +962,8 @@ static ssize_t show_auto_pwm(struct device *dev,
int nr = sensor_attr->nr;
int point = sensor_attr->index;
return sprintf(buf, "%d\n", PWM_FROM_REG(data->auto_pwm[nr][point]));
return sprintf(buf, "%d\n",
pwm_from_reg(data, data->auto_pwm[nr][point]));
}
static ssize_t set_auto_pwm(struct device *dev,
......@@ -933,7 +980,7 @@ static ssize_t set_auto_pwm(struct device *dev,
return -EINVAL;
mutex_lock(&data->update_lock);
data->auto_pwm[nr][point] = PWM_TO_REG(val);
data->auto_pwm[nr][point] = pwm_to_reg(data, val);
it87_write_value(data, IT87_REG_AUTO_PWM(nr, point),
data->auto_pwm[nr][point]);
mutex_unlock(&data->update_lock);
......@@ -1203,9 +1250,16 @@ static ssize_t show_label(struct device *dev, struct device_attribute *attr,
"5VSB",
"Vbat",
};
static const char *labels_it8721[] = {
"+3.3V",
"3VSB",
"Vbat",
};
struct it87_data *data = dev_get_drvdata(dev);
int nr = to_sensor_dev_attr(attr)->index;
return sprintf(buf, "%s\n", labels[nr]);
return sprintf(buf, "%s\n", data->type == it8721 ? labels_it8721[nr]
: labels[nr]);
}
static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 0);
static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 1);
......@@ -1490,6 +1544,9 @@ static int __init it87_find(unsigned short *address,
case IT8720F_DEVID:
sio_data->type = it8720;
break;
case IT8721F_DEVID:
sio_data->type = it8721;
break;
case 0xffff: /* No device at all */
goto exit;
default:
......@@ -1530,11 +1587,17 @@ static int __init it87_find(unsigned short *address,
int reg;
superio_select(GPIO);
/* We need at least 4 VID pins */
reg = superio_inb(IT87_SIO_GPIO3_REG);
if (reg & 0x0f) {
pr_info("it87: VID is disabled (pins used for GPIO)\n");
if (sio_data->type == it8721) {
/* The IT8721F/IT8758E doesn't have VID pins at all */
sio_data->skip_vid = 1;
} else {
/* We need at least 4 VID pins */
if (reg & 0x0f) {
pr_info("it87: VID is disabled (pins used for GPIO)\n");
sio_data->skip_vid = 1;
}
}
/* Check if fan3 is there or not */
......@@ -1572,7 +1635,7 @@ static int __init it87_find(unsigned short *address,
}
if (reg & (1 << 0))
sio_data->internal |= (1 << 0);
if (reg & (1 << 1))
if ((reg & (1 << 1)) || sio_data->type == it8721)
sio_data->internal |= (1 << 1);
sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
......@@ -1650,6 +1713,7 @@ static int __devinit it87_probe(struct platform_device *pdev)
"it8716",
"it8718",
"it8720",
"it8721",
};
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
......@@ -1686,6 +1750,16 @@ static int __devinit it87_probe(struct platform_device *pdev)
/* Check PWM configuration */
enable_pwm_interface = it87_check_pwm(dev);
/* Starting with IT8721F, we handle scaling of internal voltages */
if (data->type == it8721) {
if (sio_data->internal & (1 << 0))
data->in_scaled |= (1 << 3); /* in3 is AVCC */
if (sio_data->internal & (1 << 1))
data->in_scaled |= (1 << 7); /* in7 is VSB */
if (sio_data->internal & (1 << 2))
data->in_scaled |= (1 << 8); /* in8 is Vbat */
}
/* Initialize the IT87 chip */
it87_init_device(pdev);
......@@ -2051,7 +2125,7 @@ static struct it87_data *it87_update_device(struct device *dev)
data->sensor = it87_read_value(data, IT87_REG_TEMP_ENABLE);
/* The 8705 does not have VID capability.
The 8718 and the 8720 don't use IT87_REG_VID for the
The 8718 and later don't use IT87_REG_VID for the
same purpose. */
if (data->type == it8712 || data->type == it8716) {
data->vid = it87_read_value(data, IT87_REG_VID);
......@@ -2151,7 +2225,7 @@ static void __exit sm_it87_exit(void)
MODULE_AUTHOR("Chris Gauthron, "
"Jean Delvare <khali@linux-fr.org>");
MODULE_DESCRIPTION("IT8705F/8712F/8716F/8718F/8720F/8726F, SiS950 driver");
MODULE_DESCRIPTION("IT8705F/IT871xF/IT872xF hardware monitoring driver");
module_param(update_vbat, bool, 0);
MODULE_PARM_DESC(update_vbat, "Update vbat if set else return powerup value");
module_param(fix_pwm_polarity, bool, 0);
......
......@@ -191,38 +191,31 @@ static int __devinit k8temp_probe(struct pci_dev *pdev,
model = boot_cpu_data.x86_model;
stepping = boot_cpu_data.x86_mask;
switch (boot_cpu_data.x86) {
case 0xf:
/* feature available since SH-C0, exclude older revisions */
if (((model == 4) && (stepping == 0)) ||
((model == 5) && (stepping <= 1))) {
err = -ENODEV;
goto exit_free;
}
/*
* AMD NPT family 0fh, i.e. RevF and RevG:
* meaning of SEL_CORE bit is inverted
*/
if (model >= 0x40) {
data->swap_core_select = 1;
dev_warn(&pdev->dev, "Temperature readouts might be "
"wrong - check erratum #141\n");
}
if (is_rev_g_desktop(model)) {
/*
* RevG desktop CPUs (i.e. no socket S1G1 or
* ASB1 parts) need additional offset,
* otherwise reported temperature is below
* ambient temperature
*/
data->temp_offset = 21000;
}
/* feature available since SH-C0, exclude older revisions */
if (((model == 4) && (stepping == 0)) ||
((model == 5) && (stepping <= 1))) {
err = -ENODEV;
goto exit_free;
}
break;
/*
* AMD NPT family 0fh, i.e. RevF and RevG:
* meaning of SEL_CORE bit is inverted
*/
if (model >= 0x40) {
data->swap_core_select = 1;
dev_warn(&pdev->dev, "Temperature readouts might be wrong - "
"check erratum #141\n");
}
/*
* RevG desktop CPUs (i.e. no socket S1G1 or ASB1 parts) need
* additional offset, otherwise reported temperature is below
* ambient temperature
*/
if (is_rev_g_desktop(model))
data->temp_offset = 21000;
pci_read_config_byte(pdev, REG_TEMP, &scfg);
scfg &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */
pci_write_config_byte(pdev, REG_TEMP, scfg);
......
/*
lm75.c - Part of lm_sensors, Linux kernel modules for hardware
monitoring
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
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; either version 2 of the License, or
(at your option) any later version.
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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
* lm75.c - Part of lm_sensors, Linux kernel modules for hardware
* monitoring
* Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
*
* 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; either version 2 of the License, or
* (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/module.h>
#include <linux/init.h>
......@@ -103,7 +103,12 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
struct i2c_client *client = to_i2c_client(dev);
struct lm75_data *data = i2c_get_clientdata(client);
int nr = attr->index;
long temp = simple_strtol(buf, NULL, 10);
long temp;
int error;
error = strict_strtol(buf, 10, &temp);
if (error)
return error;
mutex_lock(&data->update_lock);
data->temp[nr] = LM75_TEMP_TO_REG(temp);
......@@ -335,9 +340,11 @@ static struct i2c_driver lm75_driver = {
/* register access */
/* All registers are word-sized, except for the configuration register.
LM75 uses a high-byte first convention, which is exactly opposite to
the SMBus standard. */
/*
* All registers are word-sized, except for the configuration register.
* LM75 uses a high-byte first convention, which is exactly opposite to
* the SMBus standard.
*/
static int lm75_read_value(struct i2c_client *client, u8 reg)
{
int value;
......
......@@ -64,9 +64,12 @@ enum chips {
#define LM85_REG_VERSTEP 0x3f
#define ADT7468_REG_CFG5 0x7c
#define ADT7468_OFF64 0x01
#define ADT7468_OFF64 (1 << 0)
#define ADT7468_HFPWM (1 << 1)
#define IS_ADT7468_OFF64(data) \
((data)->type == adt7468 && !((data)->cfg5 & ADT7468_OFF64))
#define IS_ADT7468_HFPWM(data) \
((data)->type == adt7468 && !((data)->cfg5 & ADT7468_HFPWM))
/* These are the recognized values for the above regs */
#define LM85_COMPANY_NATIONAL 0x01
......@@ -567,8 +570,14 @@ static ssize_t show_pwm_freq(struct device *dev,
{
int nr = to_sensor_dev_attr(attr)->index;
struct lm85_data *data = lm85_update_device(dev);
return sprintf(buf, "%d\n", FREQ_FROM_REG(data->freq_map,
data->pwm_freq[nr]));
int freq;
if (IS_ADT7468_HFPWM(data))
freq = 22500;
else
freq = FREQ_FROM_REG(data->freq_map, data->pwm_freq[nr]);
return sprintf(buf, "%d\n", freq);
}
static ssize_t set_pwm_freq(struct device *dev,
......@@ -580,10 +589,22 @@ static ssize_t set_pwm_freq(struct device *dev,
long val = simple_strtol(buf, NULL, 10);
mutex_lock(&data->update_lock);
data->pwm_freq[nr] = FREQ_TO_REG(data->freq_map, val);
lm85_write_value(client, LM85_REG_AFAN_RANGE(nr),
(data->zone[nr].range << 4)
| data->pwm_freq[nr]);
/* The ADT7468 has a special high-frequency PWM output mode,
* where all PWM outputs are driven by a 22.5 kHz clock.
* This might confuse the user, but there's not much we can do. */
if (data->type == adt7468 && val >= 11300) { /* High freq. mode */
data->cfg5 &= ~ADT7468_HFPWM;
lm85_write_value(client, ADT7468_REG_CFG5, data->cfg5);
} else { /* Low freq. mode */
data->pwm_freq[nr] = FREQ_TO_REG(data->freq_map, val);
lm85_write_value(client, LM85_REG_AFAN_RANGE(nr),
(data->zone[nr].range << 4)
| data->pwm_freq[nr]);
if (data->type == adt7468) {
data->cfg5 |= ADT7468_HFPWM;
lm85_write_value(client, ADT7468_REG_CFG5, data->cfg5);
}
}
mutex_unlock(&data->update_lock);
return count;
}
......@@ -1259,6 +1280,7 @@ static int lm85_probe(struct i2c_client *client,
switch (data->type) {
case adm1027:
case adt7463:
case adt7468:
case emc6d100:
case emc6d102:
data->freq_map = adm1027_freq_map;
......
此差异已折叠。
......@@ -23,10 +23,8 @@
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/mutex.h>
/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
#include <linux/err.h>
#include <linux/hwmon.h>
/* Insmod parameters */
......@@ -71,6 +69,7 @@ MODULE_PARM_DESC(input_mode,
#define REG_TO_SIGNED(reg) (((reg) & 0x80)?((reg) - 256):(reg))
struct pcf8591_data {
struct device *hwmon_dev;
struct mutex update_lock;
u8 control;
......@@ -167,24 +166,6 @@ static const struct attribute_group pcf8591_attr_group_opt = {
* Real code
*/
/* Return 0 if detection is successful, -ENODEV otherwise */
static int pcf8591_detect(struct i2c_client *client,
struct i2c_board_info *info)
{
struct i2c_adapter *adapter = client->adapter;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE
| I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
return -ENODEV;
/* Now, we would do the remaining detection. But the PCF8591 is plainly
impossible to detect! Stupid chip. */
strlcpy(info->type, "pcf8591", I2C_NAME_SIZE);
return 0;
}
static int pcf8591_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
......@@ -221,6 +202,12 @@ static int pcf8591_probe(struct i2c_client *client,
goto exit_sysfs_remove;
}
data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
goto exit_sysfs_remove;
}
return 0;
exit_sysfs_remove:
......@@ -234,6 +221,9 @@ static int pcf8591_probe(struct i2c_client *client,
static int pcf8591_remove(struct i2c_client *client)
{
struct pcf8591_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &pcf8591_attr_group_opt);
sysfs_remove_group(&client->dev.kobj, &pcf8591_attr_group);
kfree(i2c_get_clientdata(client));
......@@ -295,10 +285,6 @@ static struct i2c_driver pcf8591_driver = {
.probe = pcf8591_probe,
.remove = pcf8591_remove,
.id_table = pcf8591_id,
.class = I2C_CLASS_HWMON, /* Nearest choice */
.detect = pcf8591_detect,
.address_list = normal_i2c,
};
static int __init pcf8591_init(void)
......
......@@ -51,7 +51,7 @@ struct s3c_hwmon_attr {
* @attr: The holders for the channel attributes.
*/
struct s3c_hwmon {
struct semaphore lock;
struct mutex lock;
struct s3c_adc_client *client;
struct device *hwmon_dev;
......@@ -73,14 +73,14 @@ static int s3c_hwmon_read_ch(struct device *dev,
{
int ret;
ret = down_interruptible(&hwmon->lock);
ret = mutex_lock_interruptible(&hwmon->lock);
if (ret < 0)
return ret;
dev_dbg(dev, "reading channel %d\n", channel);
ret = s3c_adc_read(hwmon->client, channel);
up(&hwmon->lock);
mutex_unlock(&hwmon->lock);
return ret;
}
......@@ -296,7 +296,7 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev)
platform_set_drvdata(dev, hwmon);
init_MUTEX(&hwmon->lock);
mutex_init(&hwmon->lock);
/* Register with the core ADC driver. */
......
......@@ -36,8 +36,8 @@
#include <linux/sysfs.h>
/* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2a, 0x4c, 0x4d, 0x4e, 0x4f,
I2C_CLIENT_END };
static const unsigned short normal_i2c[] = { 0x2a, 0x4c, 0x4d, 0x4e, 0x4f,
I2C_CLIENT_END };
enum chips { tmp421, tmp422, tmp423 };
......
此差异已折叠。
......@@ -256,4 +256,30 @@ config PMAC_RACKMETER
This driver provides some support to control the front panel
blue LEDs "vu-meter" of the XServer macs.
config SENSORS_AMS
tristate "Apple Motion Sensor driver"
depends on PPC_PMAC && !PPC64 && INPUT && ((ADB_PMU && I2C = y) || (ADB_PMU && !I2C) || I2C) && EXPERIMENTAL
select INPUT_POLLDEV
help
Support for the motion sensor included in PowerBooks. Includes
implementations for PMU and I2C.
This driver can also be built as a module. If so, the module
will be called ams.
config SENSORS_AMS_PMU
bool "PMU variant"
depends on SENSORS_AMS && ADB_PMU
default y
help
PMU variant of motion sensor, found in late 2005 PowerBooks.
config SENSORS_AMS_I2C
bool "I2C variant"
depends on SENSORS_AMS && I2C
default y
help
I2C variant of motion sensor, found in early 2005 PowerBooks and
iBooks.
endif # MACINTOSH_DRIVERS
......@@ -48,3 +48,5 @@ obj-$(CONFIG_WINDFARM_PM121) += windfarm_pm121.o windfarm_smu_sat.o \
windfarm_max6690_sensor.o \
windfarm_lm75_sensor.o windfarm_pid.o
obj-$(CONFIG_PMAC_RACKMETER) += rack-meter.o
obj-$(CONFIG_SENSORS_AMS) += ams/
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册