Commit 31f67652 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull hwmon changes for v3.4 from Guenter Roeck:
 "Mostly cleanup.  No new drivers this time around, but support for
  several chips added to existing drivers: TPS40400, TPS40422, MTD040,
  MAX34446, ZL9101M, ZL9117M, and LM96080.  Also, added watchdog support
  for SCH56xx, and additional attributes for a couple of drivers."

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (137 commits)
  hwmon: (sch56xx) Add support for the integrated watchdog (v2)
  hwmon: (w83627ehf) Add support for temperature offset registers
  hwmon: (jc42) Remove unnecessary device IDs
  hwmon: (zl6100) Add support for ZL9101M and ZL9117M
  hwmon: (adm1275) Add support for ADM1075
  hwmon: (max34440) Add support for MAX34446
  hwmon: (pmbus) Add more virtual registers
  hwmon: (pmbus) Add support for Lineage Power MDT040
  hwmon: (pmbus) Add support for TI TPS40400 and TPS40422
  hwmon: (max34440) Add support for 'lowest' output voltage attribute
  hwmon: (jc42) Convert to use devm_kzalloc
  hwmon: (max16065) Convert to use devm_kzalloc
  hwmon: (smm665) Convert to use devm_kzalloc
  hwmon: (ltc4261) Convert to use devm_kzalloc
  hwmon: (pmbus) Simplify remove functions
  hwmon: (pmbus) Convert pmbus drivers to use devm_kzalloc
  hwmon: (lineage-pem) Convert to use devm_kzalloc
  hwmon: (hwmon-vid) Fix checkpatch issues
  hwmon: (hwmon-vid) Add new entries to VRM model table
  hwmon: (lm80) Add detection of NatSemi/TI LM96080
  ...
parents d15d7644 312869ec
...@@ -2,6 +2,10 @@ Kernel driver adm1275 ...@@ -2,6 +2,10 @@ Kernel driver adm1275
===================== =====================
Supported chips: Supported chips:
* Analog Devices ADM1075
Prefix: 'adm1075'
Addresses scanned: -
Datasheet: www.analog.com/static/imported-files/data_sheets/ADM1075.pdf
* Analog Devices ADM1275 * Analog Devices ADM1275
Prefix: 'adm1275' Prefix: 'adm1275'
Addresses scanned: - Addresses scanned: -
...@@ -17,13 +21,13 @@ Author: Guenter Roeck <guenter.roeck@ericsson.com> ...@@ -17,13 +21,13 @@ Author: Guenter Roeck <guenter.roeck@ericsson.com>
Description Description
----------- -----------
This driver supports hardware montoring for Analog Devices ADM1275 and ADM1276 This driver supports hardware montoring for Analog Devices ADM1075, ADM1275,
Hot-Swap Controller and Digital Power Monitor. and ADM1276 Hot-Swap Controller and Digital Power Monitor.
ADM1275 and ADM1276 are hot-swap controllers that allow a circuit board to be ADM1075, ADM1275, and ADM1276 are hot-swap controllers that allow a circuit
removed from or inserted into a live backplane. They also feature current and board to be removed from or inserted into a live backplane. They also feature
voltage readback via an integrated 12-bit analog-to-digital converter (ADC), current and voltage readback via an integrated 12-bit analog-to-digital
accessed using a PMBus interface. converter (ADC), accessed using a PMBus interface.
The driver is a client driver to the core PMBus driver. Please see The driver is a client driver to the core PMBus driver. Please see
Documentation/hwmon/pmbus for details on PMBus client drivers. Documentation/hwmon/pmbus for details on PMBus client drivers.
...@@ -36,6 +40,10 @@ This driver does not auto-detect devices. You will have to instantiate the ...@@ -36,6 +40,10 @@ This driver does not auto-detect devices. You will have to instantiate the
devices explicitly. Please see Documentation/i2c/instantiating-devices for devices explicitly. Please see Documentation/i2c/instantiating-devices for
details. details.
The ADM1075, unlike many other PMBus devices, does not support internal voltage
or current scaling. Reported voltages, currents, and power are raw measurements,
and will typically have to be scaled.
Platform data support Platform data support
--------------------- ---------------------
...@@ -51,7 +59,8 @@ The following attributes are supported. Limits are read-write, history reset ...@@ -51,7 +59,8 @@ The following attributes are supported. Limits are read-write, history reset
attributes are write-only, all other attributes are read-only. attributes are write-only, all other attributes are read-only.
in1_label "vin1" or "vout1" depending on chip variant and in1_label "vin1" or "vout1" depending on chip variant and
configuration. configuration. On ADM1075, vout1 reports the voltage on
the VAUX pin.
in1_input Measured voltage. in1_input Measured voltage.
in1_min Minimum Voltage. in1_min Minimum Voltage.
in1_max Maximum voltage. in1_max Maximum voltage.
...@@ -74,3 +83,10 @@ curr1_crit Critical maximum current. Depending on the chip ...@@ -74,3 +83,10 @@ curr1_crit Critical maximum current. Depending on the chip
curr1_crit_alarm Critical current high alarm. curr1_crit_alarm Critical current high alarm.
curr1_highest Historical maximum current. curr1_highest Historical maximum current.
curr1_reset_history Write any value to reset history. curr1_reset_history Write any value to reset history.
power1_label "pin1"
power1_input Input power.
power1_reset_history Write any value to reset history.
Power attributes are supported on ADM1075 and ADM1276
only.
...@@ -3,71 +3,50 @@ Kernel driver jc42 ...@@ -3,71 +3,50 @@ Kernel driver jc42
Supported chips: Supported chips:
* Analog Devices ADT7408 * Analog Devices ADT7408
Prefix: 'adt7408'
Addresses scanned: I2C 0x18 - 0x1f
Datasheets: Datasheets:
http://www.analog.com/static/imported-files/data_sheets/ADT7408.pdf http://www.analog.com/static/imported-files/data_sheets/ADT7408.pdf
* Atmel AT30TS00 * Atmel AT30TS00
Prefix: 'at30ts00'
Addresses scanned: I2C 0x18 - 0x1f
Datasheets: Datasheets:
http://www.atmel.com/Images/doc8585.pdf http://www.atmel.com/Images/doc8585.pdf
* IDT TSE2002B3, TSE2002GB2, TS3000B3, TS3000GB2 * IDT TSE2002B3, TSE2002GB2, TS3000B3, TS3000GB2
Prefix: 'tse2002', 'ts3000'
Addresses scanned: I2C 0x18 - 0x1f
Datasheets: Datasheets:
http://www.idt.com/sites/default/files/documents/IDT_TSE2002B3C_DST_20100512_120303152056.pdf http://www.idt.com/sites/default/files/documents/IDT_TSE2002B3C_DST_20100512_120303152056.pdf
http://www.idt.com/sites/default/files/documents/IDT_TSE2002GB2A1_DST_20111107_120303145914.pdf http://www.idt.com/sites/default/files/documents/IDT_TSE2002GB2A1_DST_20111107_120303145914.pdf
http://www.idt.com/sites/default/files/documents/IDT_TS3000B3A_DST_20101129_120303152013.pdf http://www.idt.com/sites/default/files/documents/IDT_TS3000B3A_DST_20101129_120303152013.pdf
http://www.idt.com/sites/default/files/documents/IDT_TS3000GB2A1_DST_20111104_120303151012.pdf http://www.idt.com/sites/default/files/documents/IDT_TS3000GB2A1_DST_20111104_120303151012.pdf
* Maxim MAX6604 * Maxim MAX6604
Prefix: 'max6604'
Addresses scanned: I2C 0x18 - 0x1f
Datasheets: Datasheets:
http://datasheets.maxim-ic.com/en/ds/MAX6604.pdf http://datasheets.maxim-ic.com/en/ds/MAX6604.pdf
* Microchip MCP9804, MCP9805, MCP98242, MCP98243, MCP9843 * Microchip MCP9804, MCP9805, MCP98242, MCP98243, MCP9843
Prefixes: 'mcp9804', 'mcp9805', 'mcp98242', 'mcp98243', 'mcp9843'
Addresses scanned: I2C 0x18 - 0x1f
Datasheets: Datasheets:
http://ww1.microchip.com/downloads/en/DeviceDoc/22203C.pdf http://ww1.microchip.com/downloads/en/DeviceDoc/22203C.pdf
http://ww1.microchip.com/downloads/en/DeviceDoc/21977b.pdf http://ww1.microchip.com/downloads/en/DeviceDoc/21977b.pdf
http://ww1.microchip.com/downloads/en/DeviceDoc/21996a.pdf http://ww1.microchip.com/downloads/en/DeviceDoc/21996a.pdf
http://ww1.microchip.com/downloads/en/DeviceDoc/22153c.pdf http://ww1.microchip.com/downloads/en/DeviceDoc/22153c.pdf
* NXP Semiconductors SE97, SE97B * NXP Semiconductors SE97, SE97B, SE98, SE98A
Prefix: 'se97'
Addresses scanned: I2C 0x18 - 0x1f
Datasheets: Datasheets:
http://www.nxp.com/documents/data_sheet/SE97.pdf http://www.nxp.com/documents/data_sheet/SE97.pdf
http://www.nxp.com/documents/data_sheet/SE97B.pdf http://www.nxp.com/documents/data_sheet/SE97B.pdf
* NXP Semiconductors SE98
Prefix: 'se98'
Addresses scanned: I2C 0x18 - 0x1f
Datasheets:
http://www.nxp.com/documents/data_sheet/SE98.pdf http://www.nxp.com/documents/data_sheet/SE98.pdf
http://www.nxp.com/documents/data_sheet/SE98A.pdf
* ON Semiconductor CAT34TS02, CAT6095 * ON Semiconductor CAT34TS02, CAT6095
Prefix: 'cat34ts02', 'cat6095'
Addresses scanned: I2C 0x18 - 0x1f
Datasheet: Datasheet:
http://www.onsemi.com/pub_link/Collateral/CAT34TS02-D.PDF http://www.onsemi.com/pub_link/Collateral/CAT34TS02-D.PDF
http://www.onsemi.com/pub/Collateral/CAT6095-D.PDF http://www.onsemi.com/pub/Collateral/CAT6095-D.PDF
* ST Microelectronics STTS424, STTS424E02 * ST Microelectronics STTS424, STTS424E02, STTS2002, STTS3000
Prefix: 'stts424'
Addresses scanned: I2C 0x18 - 0x1f
Datasheets:
http://www.st.com/stonline/products/literature/ds/13447/stts424.pdf
http://www.st.com/stonline/products/literature/ds/13448/stts424e02.pdf
* ST Microelectronics STTS2002, STTS3000
Prefix: 'stts2002', 'stts3000'
Addresses scanned: I2C 0x18 - 0x1f
Datasheets: Datasheets:
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00157556.pdf
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00157558.pdf
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00225278.pdf http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00225278.pdf
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATA_BRIEF/CD00270920.pdf http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATA_BRIEF/CD00270920.pdf
* JEDEC JC 42.4 compliant temperature sensor chips * JEDEC JC 42.4 compliant temperature sensor chips
Prefix: 'jc42'
Addresses scanned: I2C 0x18 - 0x1f
Datasheet: Datasheet:
http://www.jedec.org/sites/default/files/docs/4_01_04R19.pdf http://www.jedec.org/sites/default/files/docs/4_01_04R19.pdf
Common for all chips:
Prefix: 'jc42'
Addresses scanned: I2C 0x18 - 0x1f
Author: Author:
Guenter Roeck <guenter.roeck@ericsson.com> Guenter Roeck <guenter.roeck@ericsson.com>
......
...@@ -7,6 +7,11 @@ Supported chips: ...@@ -7,6 +7,11 @@ Supported chips:
Addresses scanned: I2C 0x28 - 0x2f Addresses scanned: I2C 0x28 - 0x2f
Datasheet: Publicly available at the National Semiconductor website Datasheet: Publicly available at the National Semiconductor website
http://www.national.com/ http://www.national.com/
* National Semiconductor LM96080
Prefix: 'lm96080'
Addresses scanned: I2C 0x28 - 0x2f
Datasheet: Publicly available at the National Semiconductor website
http://www.national.com/
Authors: Authors:
Frodo Looijaard <frodol@dds.nl>, Frodo Looijaard <frodol@dds.nl>,
...@@ -17,7 +22,9 @@ Description ...@@ -17,7 +22,9 @@ Description
This driver implements support for the National Semiconductor LM80. This driver implements support for the National Semiconductor LM80.
It is described as a 'Serial Interface ACPI-Compatible Microprocessor It is described as a 'Serial Interface ACPI-Compatible Microprocessor
System Hardware Monitor'. System Hardware Monitor'. The LM96080 is a more recent incarnation,
it is pin and register compatible, with a few additional features not
yet supported by the driver.
The LM80 implements one temperature sensor, two fan rotation speed sensors, The LM80 implements one temperature sensor, two fan rotation speed sensors,
seven voltage sensors, alarms, and some miscellaneous stuff. seven voltage sensors, alarms, and some miscellaneous stuff.
......
...@@ -11,6 +11,11 @@ Supported chips: ...@@ -11,6 +11,11 @@ Supported chips:
Prefixes: 'max34441' Prefixes: 'max34441'
Addresses scanned: - Addresses scanned: -
Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX34441.pdf Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX34441.pdf
* Maxim MAX34446
PMBus Power-Supply Data Logger
Prefixes: 'max34446'
Addresses scanned: -
Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX34446.pdf
Author: Guenter Roeck <guenter.roeck@ericsson.com> Author: Guenter Roeck <guenter.roeck@ericsson.com>
...@@ -19,8 +24,8 @@ Description ...@@ -19,8 +24,8 @@ Description
----------- -----------
This driver supports hardware montoring for Maxim MAX34440 PMBus 6-Channel This driver supports hardware montoring for Maxim MAX34440 PMBus 6-Channel
Power-Supply Manager and MAX34441 PMBus 5-Channel Power-Supply Manager Power-Supply Manager, MAX34441 PMBus 5-Channel Power-Supply Manager
and Intelligent Fan Controller. and Intelligent Fan Controller, and MAX34446 PMBus Power-Supply Data Logger.
The driver is a client driver to the core PMBus driver. Please see The driver is a client driver to the core PMBus driver. Please see
Documentation/hwmon/pmbus for details on PMBus client drivers. Documentation/hwmon/pmbus for details on PMBus client drivers.
...@@ -33,6 +38,13 @@ This driver does not auto-detect devices. You will have to instantiate the ...@@ -33,6 +38,13 @@ This driver does not auto-detect devices. You will have to instantiate the
devices explicitly. Please see Documentation/i2c/instantiating-devices for devices explicitly. Please see Documentation/i2c/instantiating-devices for
details. details.
For MAX34446, the value of the currX_crit attribute determines if current or
voltage measurement is enabled for a given channel. Voltage measurement is
enabled if currX_crit is set to 0; current measurement is enabled if the
attribute is set to a positive value. Power measurement is only enabled if
channel 1 (3) is configured for voltage measurement, and channel 2 (4) is
configured for current measurement.
Platform data support Platform data support
--------------------- ---------------------
...@@ -56,19 +68,31 @@ in[1-6]_min_alarm Voltage low alarm. From VOLTAGE_UV_WARNING status. ...@@ -56,19 +68,31 @@ in[1-6]_min_alarm Voltage low alarm. From VOLTAGE_UV_WARNING status.
in[1-6]_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status. in[1-6]_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status.
in[1-6]_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status. in[1-6]_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status.
in[1-6]_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status. in[1-6]_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status.
in[1-6]_lowest Historical minimum voltage.
in[1-6]_highest Historical maximum voltage. in[1-6]_highest Historical maximum voltage.
in[1-6]_reset_history Write any value to reset history. in[1-6]_reset_history Write any value to reset history.
MAX34446 only supports in[1-4].
curr[1-6]_label "iout[1-6]". curr[1-6]_label "iout[1-6]".
curr[1-6]_input Measured current. From READ_IOUT register. curr[1-6]_input Measured current. From READ_IOUT register.
curr[1-6]_max Maximum current. From IOUT_OC_WARN_LIMIT register. curr[1-6]_max Maximum current. From IOUT_OC_WARN_LIMIT register.
curr[1-6]_crit Critical maximum current. From IOUT_OC_FAULT_LIMIT register. curr[1-6]_crit Critical maximum current. From IOUT_OC_FAULT_LIMIT register.
curr[1-6]_max_alarm Current high alarm. From IOUT_OC_WARNING status. curr[1-6]_max_alarm Current high alarm. From IOUT_OC_WARNING status.
curr[1-6]_crit_alarm Current critical high alarm. From IOUT_OC_FAULT status. curr[1-6]_crit_alarm Current critical high alarm. From IOUT_OC_FAULT status.
curr[1-4]_average Historical average current (MAX34446 only).
curr[1-6]_highest Historical maximum current. curr[1-6]_highest Historical maximum current.
curr[1-6]_reset_history Write any value to reset history. curr[1-6]_reset_history Write any value to reset history.
in6 and curr6 attributes only exist for MAX34440. in6 and curr6 attributes only exist for MAX34440.
MAX34446 only supports curr[1-4].
power[1,3]_label "pout[1,3]"
power[1,3]_input Measured power.
power[1,3]_average Historical average power.
power[1,3]_highest Historical maximum power.
Power attributes only exist for MAX34446.
temp[1-8]_input Measured temperatures. From READ_TEMPERATURE_1 register. temp[1-8]_input Measured temperatures. From READ_TEMPERATURE_1 register.
temp1 is the chip's internal temperature. temp2..temp5 temp1 is the chip's internal temperature. temp2..temp5
...@@ -79,7 +103,9 @@ temp[1-8]_max Maximum temperature. From OT_WARN_LIMIT register. ...@@ -79,7 +103,9 @@ temp[1-8]_max Maximum temperature. From OT_WARN_LIMIT register.
temp[1-8]_crit Critical high temperature. From OT_FAULT_LIMIT register. temp[1-8]_crit Critical high temperature. From OT_FAULT_LIMIT register.
temp[1-8]_max_alarm Temperature high alarm. temp[1-8]_max_alarm Temperature high alarm.
temp[1-8]_crit_alarm Temperature critical high alarm. temp[1-8]_crit_alarm Temperature critical high alarm.
temp[1-8]_average Historical average temperature (MAX34446 only).
temp[1-8]_highest Historical maximum temperature. temp[1-8]_highest Historical maximum temperature.
temp[1-8]_reset_history Write any value to reset history. temp[1-8]_reset_history Write any value to reset history.
temp7 and temp8 attributes only exist for MAX34440. temp7 and temp8 attributes only exist for MAX34440.
MAX34446 only supports temp[1-3].
...@@ -15,13 +15,20 @@ Supported chips: ...@@ -15,13 +15,20 @@ Supported chips:
http://www.onsemi.com/pub_link/Collateral/NCP4200-D.PDF http://www.onsemi.com/pub_link/Collateral/NCP4200-D.PDF
http://www.onsemi.com/pub_link/Collateral/JUNE%202009-%20REV.%200.PDF http://www.onsemi.com/pub_link/Collateral/JUNE%202009-%20REV.%200.PDF
* Lineage Power * Lineage Power
Prefixes: 'pdt003', 'pdt006', 'pdt012', 'udt020' Prefixes: 'mdt040', 'pdt003', 'pdt006', 'pdt012', 'udt020'
Addresses scanned: - Addresses scanned: -
Datasheets: Datasheets:
http://www.lineagepower.com/oem/pdf/PDT003A0X.pdf http://www.lineagepower.com/oem/pdf/PDT003A0X.pdf
http://www.lineagepower.com/oem/pdf/PDT006A0X.pdf http://www.lineagepower.com/oem/pdf/PDT006A0X.pdf
http://www.lineagepower.com/oem/pdf/PDT012A0X.pdf http://www.lineagepower.com/oem/pdf/PDT012A0X.pdf
http://www.lineagepower.com/oem/pdf/UDT020A0X.pdf http://www.lineagepower.com/oem/pdf/UDT020A0X.pdf
http://www.lineagepower.com/oem/pdf/MDT040A0X.pdf
* Texas Instruments TPS40400, TPS40422
Prefixes: 'tps40400', 'tps40422'
Addresses scanned: -
Datasheets:
http://www.ti.com/lit/gpn/tps40400
http://www.ti.com/lit/gpn/tps40422
* Generic PMBus devices * Generic PMBus devices
Prefix: 'pmbus' Prefix: 'pmbus'
Addresses scanned: - Addresses scanned: -
......
...@@ -16,6 +16,11 @@ Description ...@@ -16,6 +16,11 @@ Description
SMSC SCH5627 Super I/O chips include complete hardware monitoring SMSC SCH5627 Super I/O chips include complete hardware monitoring
capabilities. They can monitor up to 5 voltages, 4 fans and 8 temperatures. capabilities. They can monitor up to 5 voltages, 4 fans and 8 temperatures.
The SMSC SCH5627 hardware monitoring part also contains an integrated
watchdog. In order for this watchdog to function some motherboard specific
initialization most be done by the BIOS, so if the watchdog is not enabled
by the BIOS the sch5627 driver will not register a watchdog device.
The hardware monitoring part of the SMSC SCH5627 is accessed by talking The hardware monitoring part of the SMSC SCH5627 is accessed by talking
through an embedded microcontroller. An application note describing the through an embedded microcontroller. An application note describing the
protocol for communicating with the microcontroller is available upon protocol for communicating with the microcontroller is available upon
......
...@@ -26,6 +26,9 @@ temperatures. Note that the driver detects how many fan headers / ...@@ -26,6 +26,9 @@ temperatures. Note that the driver detects how many fan headers /
temperature sensors are actually implemented on the motherboard, so you will temperature sensors are actually implemented on the motherboard, so you will
likely see fewer temperature and fan inputs. likely see fewer temperature and fan inputs.
The Fujitsu Theseus hwmon solution also contains an integrated watchdog.
This watchdog is fully supported by the sch5636 driver.
An application note describing the Theseus' registers, as well as an An application note describing the Theseus' registers, as well as an
application note describing the protocol for communicating with the application note describing the protocol for communicating with the
microcontroller is available upon request. Please mail me if you want a copy. microcontroller is available upon request. Please mail me if you want a copy.
...@@ -34,6 +34,14 @@ Supported chips: ...@@ -34,6 +34,14 @@ Supported chips:
Prefix: 'zl6105' Prefix: 'zl6105'
Addresses scanned: - Addresses scanned: -
Datasheet: http://www.intersil.com/data/fn/fn6906.pdf Datasheet: http://www.intersil.com/data/fn/fn6906.pdf
* Intersil / Zilker Labs ZL9101M
Prefix: 'zl9101'
Addresses scanned: -
Datasheet: http://www.intersil.com/data/fn/fn7669.pdf
* Intersil / Zilker Labs ZL9117M
Prefix: 'zl9117'
Addresses scanned: -
Datasheet: http://www.intersil.com/data/fn/fn7914.pdf
* Ericsson BMR450, BMR451 * Ericsson BMR450, BMR451
Prefix: 'bmr450', 'bmr451' Prefix: 'bmr450', 'bmr451'
Addresses scanned: - Addresses scanned: -
......
...@@ -598,11 +598,11 @@ config SENSORS_LM78 ...@@ -598,11 +598,11 @@ config SENSORS_LM78
will be called lm78. will be called lm78.
config SENSORS_LM80 config SENSORS_LM80
tristate "National Semiconductor LM80" tristate "National Semiconductor LM80 and LM96080"
depends on I2C depends on I2C
help help
If you say yes here you get support for National Semiconductor If you say yes here you get support for National Semiconductor
LM80 sensor chips. LM80 and LM96080 sensor chips.
This driver can also be built as a module. If so, the module This driver can also be built as a module. If so, the module
will be called lm80. will be called lm80.
...@@ -1028,7 +1028,8 @@ config SENSORS_SCH5627 ...@@ -1028,7 +1028,8 @@ config SENSORS_SCH5627
select SENSORS_SCH56XX_COMMON select SENSORS_SCH56XX_COMMON
help help
If you say yes here you get support for the hardware monitoring If you say yes here you get support for the hardware monitoring
features of the SMSC SCH5627 Super-I/O chip. features of the SMSC SCH5627 Super-I/O chip including support for
the integrated watchdog.
This driver can also be built as a module. If so, the module This driver can also be built as a module. If so, the module
will be called sch5627. will be called sch5627.
...@@ -1044,7 +1045,8 @@ config SENSORS_SCH5636 ...@@ -1044,7 +1045,8 @@ config SENSORS_SCH5636
Currently this driver only supports the Fujitsu Theseus SCH5636 based Currently this driver only supports the Fujitsu Theseus SCH5636 based
hwmon solution. Say yes here if you want support for the Fujitsu hwmon solution. Say yes here if you want support for the Fujitsu
Theseus' hardware monitoring features. Theseus' hardware monitoring features including support for the
integrated watchdog.
This driver can also be built as a module. If so, the module This driver can also be built as a module. If so, the module
will be called sch5636. will be called sch5636.
......
This diff is collapsed.
This diff is collapsed.
...@@ -167,17 +167,7 @@ static struct spi_driver ad7314_driver = { ...@@ -167,17 +167,7 @@ static struct spi_driver ad7314_driver = {
.id_table = ad7314_id, .id_table = ad7314_id,
}; };
static __init int ad7314_init(void) module_spi_driver(ad7314_driver);
{
return spi_register_driver(&ad7314_driver);
}
module_init(ad7314_init);
static __exit void ad7314_exit(void)
{
spi_unregister_driver(&ad7314_driver);
}
module_exit(ad7314_exit);
MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>");
MODULE_DESCRIPTION("Analog Devices AD7314, ADT7301 and ADT7302 digital" MODULE_DESCRIPTION("Analog Devices AD7314, ADT7301 and ADT7302 digital"
......
...@@ -50,7 +50,8 @@ struct ad7414_data { ...@@ -50,7 +50,8 @@ struct ad7414_data {
/* REG: (0.25C/bit, two's complement) << 6 */ /* REG: (0.25C/bit, two's complement) << 6 */
static inline int ad7414_temp_from_reg(s16 reg) static inline int ad7414_temp_from_reg(s16 reg)
{ {
/* use integer division instead of equivalent right shift to /*
* use integer division instead of equivalent right shift to
* guarantee arithmetic shift and preserve the sign * guarantee arithmetic shift and preserve the sign
*/ */
return ((int)reg / 64) * 250; return ((int)reg / 64) * 250;
...@@ -130,7 +131,11 @@ static ssize_t set_max_min(struct device *dev, ...@@ -130,7 +131,11 @@ static ssize_t set_max_min(struct device *dev,
struct ad7414_data *data = i2c_get_clientdata(client); struct ad7414_data *data = i2c_get_clientdata(client);
int index = to_sensor_dev_attr(attr)->index; int index = to_sensor_dev_attr(attr)->index;
u8 reg = AD7414_REG_LIMIT[index]; u8 reg = AD7414_REG_LIMIT[index];
long temp = simple_strtol(buf, NULL, 10); long temp;
int ret = kstrtol(buf, 10, &temp);
if (ret < 0)
return ret;
temp = SENSORS_LIMIT(temp, -40000, 85000); temp = SENSORS_LIMIT(temp, -40000, 85000);
temp = (temp + (temp < 0 ? -500 : 500)) / 1000; temp = (temp + (temp < 0 ? -500 : 500)) / 1000;
...@@ -252,17 +257,7 @@ static struct i2c_driver ad7414_driver = { ...@@ -252,17 +257,7 @@ static struct i2c_driver ad7414_driver = {
.id_table = ad7414_id, .id_table = ad7414_id,
}; };
static int __init ad7414_init(void) module_i2c_driver(ad7414_driver);
{
return i2c_add_driver(&ad7414_driver);
}
module_init(ad7414_init);
static void __exit ad7414_exit(void)
{
i2c_del_driver(&ad7414_driver);
}
module_exit(ad7414_exit);
MODULE_AUTHOR("Stefan Roese <sr at denx.de>, " MODULE_AUTHOR("Stefan Roese <sr at denx.de>, "
"Frank Edelhaeuser <frank.edelhaeuser at spansion.com>"); "Frank Edelhaeuser <frank.edelhaeuser at spansion.com>");
......
...@@ -167,7 +167,11 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *devattr, ...@@ -167,7 +167,11 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *devattr,
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct ad7418_data *data = i2c_get_clientdata(client); struct ad7418_data *data = i2c_get_clientdata(client);
long temp = simple_strtol(buf, NULL, 10); long temp;
int ret = kstrtol(buf, 10, &temp);
if (ret < 0)
return ret;
mutex_lock(&data->lock); mutex_lock(&data->lock);
data->temp[attr->index] = LM75_TEMP_TO_REG(temp); data->temp[attr->index] = LM75_TEMP_TO_REG(temp);
...@@ -228,7 +232,8 @@ static int ad7418_probe(struct i2c_client *client, ...@@ -228,7 +232,8 @@ static int ad7418_probe(struct i2c_client *client,
goto exit; goto exit;
} }
if (!(data = kzalloc(sizeof(struct ad7418_data), GFP_KERNEL))) { data = kzalloc(sizeof(struct ad7418_data), GFP_KERNEL);
if (!data) {
err = -ENOMEM; err = -ENOMEM;
goto exit; goto exit;
} }
...@@ -261,7 +266,8 @@ static int ad7418_probe(struct i2c_client *client, ...@@ -261,7 +266,8 @@ static int ad7418_probe(struct i2c_client *client,
ad7418_init_client(client); ad7418_init_client(client);
/* Register sysfs hooks */ /* Register sysfs hooks */
if ((err = sysfs_create_group(&client->dev.kobj, &data->attrs))) err = sysfs_create_group(&client->dev.kobj, &data->attrs);
if (err)
goto exit_free; goto exit_free;
data->hwmon_dev = hwmon_device_register(&client->dev); data->hwmon_dev = hwmon_device_register(&client->dev);
...@@ -289,20 +295,9 @@ static int ad7418_remove(struct i2c_client *client) ...@@ -289,20 +295,9 @@ static int ad7418_remove(struct i2c_client *client)
return 0; return 0;
} }
static int __init ad7418_init(void) module_i2c_driver(ad7418_driver);
{
return i2c_add_driver(&ad7418_driver);
}
static void __exit ad7418_exit(void)
{
i2c_del_driver(&ad7418_driver);
}
MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
MODULE_DESCRIPTION("AD7416/17/18 driver"); MODULE_DESCRIPTION("AD7416/17/18 driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION); MODULE_VERSION(DRV_VERSION);
module_init(ad7418_init);
module_exit(ad7418_exit);
...@@ -248,18 +248,7 @@ static struct spi_driver adcxx_driver = { ...@@ -248,18 +248,7 @@ static struct spi_driver adcxx_driver = {
.remove = __devexit_p(adcxx_remove), .remove = __devexit_p(adcxx_remove),
}; };
static int __init init_adcxx(void) module_spi_driver(adcxx_driver);
{
return spi_register_driver(&adcxx_driver);
}
static void __exit exit_adcxx(void)
{
spi_unregister_driver(&adcxx_driver);
}
module_init(init_adcxx);
module_exit(exit_adcxx);
MODULE_AUTHOR("Marc Pignat"); MODULE_AUTHOR("Marc Pignat");
MODULE_DESCRIPTION("National Semiconductor adcxx8sxxx Linux driver"); MODULE_DESCRIPTION("National Semiconductor adcxx8sxxx Linux driver");
......
/* /*
adm1021.c - Part of lm_sensors, Linux kernel modules for hardware * adm1021.c - Part of lm_sensors, Linux kernel modules for hardware
monitoring * monitoring
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl> and * Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl> and
Philip Edelbrock <phil@netroedge.com> * Philip Edelbrock <phil@netroedge.com>
*
This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. * (at your option) any later version.
*
This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. * GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -70,10 +70,12 @@ enum chips { ...@@ -70,10 +70,12 @@ enum chips {
/* Initial values */ /* Initial values */
/* Note: Even though I left the low and high limits named os and hyst, /*
they don't quite work like a thermostat the way the LM75 does. I.e., * Note: Even though I left the low and high limits named os and hyst,
a lower temp than THYST actually triggers an alarm instead of * they don't quite work like a thermostat the way the LM75 does. I.e.,
clearing it. Weird, ey? --Phil */ * a lower temp than THYST actually triggers an alarm instead of
* clearing it. Weird, ey? --Phil
*/
/* Each client has this additional data */ /* Each client has this additional data */
struct adm1021_data { struct adm1021_data {
...@@ -182,7 +184,13 @@ static ssize_t set_temp_max(struct device *dev, ...@@ -182,7 +184,13 @@ static ssize_t set_temp_max(struct device *dev,
int index = to_sensor_dev_attr(devattr)->index; int index = to_sensor_dev_attr(devattr)->index;
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1021_data *data = i2c_get_clientdata(client); struct adm1021_data *data = i2c_get_clientdata(client);
long temp = simple_strtol(buf, NULL, 10) / 1000; long temp;
int err;
err = kstrtol(buf, 10, &temp);
if (err)
return err;
temp /= 1000;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
data->temp_max[index] = SENSORS_LIMIT(temp, -128, 127); data->temp_max[index] = SENSORS_LIMIT(temp, -128, 127);
...@@ -201,7 +209,13 @@ static ssize_t set_temp_min(struct device *dev, ...@@ -201,7 +209,13 @@ static ssize_t set_temp_min(struct device *dev,
int index = to_sensor_dev_attr(devattr)->index; int index = to_sensor_dev_attr(devattr)->index;
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1021_data *data = i2c_get_clientdata(client); struct adm1021_data *data = i2c_get_clientdata(client);
long temp = simple_strtol(buf, NULL, 10) / 1000; long temp;
int err;
err = kstrtol(buf, 10, &temp);
if (err)
return err;
temp /= 1000;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
data->temp_min[index] = SENSORS_LIMIT(temp, -128, 127); data->temp_min[index] = SENSORS_LIMIT(temp, -128, 127);
...@@ -226,7 +240,14 @@ static ssize_t set_low_power(struct device *dev, ...@@ -226,7 +240,14 @@ static ssize_t set_low_power(struct device *dev,
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1021_data *data = i2c_get_clientdata(client); struct adm1021_data *data = i2c_get_clientdata(client);
int low_power = simple_strtol(buf, NULL, 10) != 0; char low_power;
unsigned long val;
int err;
err = kstrtoul(buf, 10, &val);
if (err)
return err;
low_power = val != 0;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
if (low_power != data->low_power) { if (low_power != data->low_power) {
...@@ -361,7 +382,8 @@ static int adm1021_probe(struct i2c_client *client, ...@@ -361,7 +382,8 @@ static int adm1021_probe(struct i2c_client *client,
adm1021_init_client(client); adm1021_init_client(client);
/* Register sysfs hooks */ /* Register sysfs hooks */
if ((err = sysfs_create_group(&client->dev.kobj, &adm1021_group))) err = sysfs_create_group(&client->dev.kobj, &adm1021_group);
if (err)
goto error1; goto error1;
data->hwmon_dev = hwmon_device_register(&client->dev); data->hwmon_dev = hwmon_device_register(&client->dev);
...@@ -427,8 +449,10 @@ static struct adm1021_data *adm1021_update_device(struct device *dev) ...@@ -427,8 +449,10 @@ static struct adm1021_data *adm1021_update_device(struct device *dev)
data->alarms = i2c_smbus_read_byte_data(client, data->alarms = i2c_smbus_read_byte_data(client,
ADM1021_REG_STATUS) & 0x7c; ADM1021_REG_STATUS) & 0x7c;
if (data->type == adm1023) { if (data->type == adm1023) {
/* The ADM1023 provides 3 extra bits of precision for /*
* the remote sensor in extra registers. */ * The ADM1023 provides 3 extra bits of precision for
* the remote sensor in extra registers.
*/
data->temp[1] += 125 * (i2c_smbus_read_byte_data( data->temp[1] += 125 * (i2c_smbus_read_byte_data(
client, ADM1023_REG_REM_TEMP_PREC) >> 5); client, ADM1023_REG_REM_TEMP_PREC) >> 5);
data->temp_max[1] += 125 * (i2c_smbus_read_byte_data( data->temp_max[1] += 125 * (i2c_smbus_read_byte_data(
...@@ -451,23 +475,12 @@ static struct adm1021_data *adm1021_update_device(struct device *dev) ...@@ -451,23 +475,12 @@ static struct adm1021_data *adm1021_update_device(struct device *dev)
return data; return data;
} }
static int __init sensors_adm1021_init(void) module_i2c_driver(adm1021_driver);
{
return i2c_add_driver(&adm1021_driver);
}
static void __exit sensors_adm1021_exit(void)
{
i2c_del_driver(&adm1021_driver);
}
MODULE_AUTHOR ("Frodo Looijaard <frodol@dds.nl> and " MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl> and "
"Philip Edelbrock <phil@netroedge.com>"); "Philip Edelbrock <phil@netroedge.com>");
MODULE_DESCRIPTION("adm1021 driver"); MODULE_DESCRIPTION("adm1021 driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_param(read_only, bool, 0); module_param(read_only, bool, 0);
MODULE_PARM_DESC(read_only, "Don't set any values, read only mode"); MODULE_PARM_DESC(read_only, "Don't set any values, read only mode");
module_init(sensors_adm1021_init)
module_exit(sensors_adm1021_exit)
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* resolution of about 0.5% of the nominal value). Temperature values are * resolution of about 0.5% of the nominal value). Temperature values are
* reported with a 1 deg resolution and a 3 deg accuracy. Complete * reported with a 1 deg resolution and a 3 deg accuracy. Complete
* datasheet can be obtained from Analog's website at: * datasheet can be obtained from Analog's website at:
* http://www.onsemi.com/PowerSolutions/product.do?id=ADM1025 * http://www.onsemi.com/PowerSolutions/product.do?id=ADM1025
* *
* This driver also supports the ADM1025A, which differs from the ADM1025 * This driver also supports the ADM1025A, which differs from the ADM1025
* only in that it has "open-drain VID inputs while the ADM1025 has * only in that it has "open-drain VID inputs while the ADM1025 has
...@@ -91,15 +91,16 @@ enum chips { adm1025, ne1619 }; ...@@ -91,15 +91,16 @@ enum chips { adm1025, ne1619 };
static const int in_scale[6] = { 2500, 2250, 3300, 5000, 12000, 3300 }; static const int in_scale[6] = { 2500, 2250, 3300, 5000, 12000, 3300 };
#define IN_FROM_REG(reg,scale) (((reg) * (scale) + 96) / 192) #define IN_FROM_REG(reg, scale) (((reg) * (scale) + 96) / 192)
#define IN_TO_REG(val,scale) ((val) <= 0 ? 0 : \ #define IN_TO_REG(val, scale) ((val) <= 0 ? 0 : \
(val) * 192 >= (scale) * 255 ? 255 : \ (val) * 192 >= (scale) * 255 ? 255 : \
((val) * 192 + (scale)/2) / (scale)) ((val) * 192 + (scale) / 2) / (scale))
#define TEMP_FROM_REG(reg) ((reg) * 1000) #define TEMP_FROM_REG(reg) ((reg) * 1000)
#define TEMP_TO_REG(val) ((val) <= -127500 ? -128 : \ #define TEMP_TO_REG(val) ((val) <= -127500 ? -128 : \
(val) >= 126500 ? 127 : \ (val) >= 126500 ? 127 : \
(((val) < 0 ? (val)-500 : (val)+500) / 1000)) (((val) < 0 ? (val) - 500 : \
(val) + 500) / 1000))
/* /*
* Functions declaration * Functions declaration
...@@ -218,7 +219,12 @@ static ssize_t set_in_min(struct device *dev, struct device_attribute *attr, ...@@ -218,7 +219,12 @@ static ssize_t set_in_min(struct device *dev, struct device_attribute *attr,
int index = to_sensor_dev_attr(attr)->index; int index = to_sensor_dev_attr(attr)->index;
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1025_data *data = i2c_get_clientdata(client); struct adm1025_data *data = i2c_get_clientdata(client);
long val = simple_strtol(buf, NULL, 10); long val;
int err;
err = kstrtol(buf, 10, &val);
if (err)
return err;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
data->in_min[index] = IN_TO_REG(val, in_scale[index]); data->in_min[index] = IN_TO_REG(val, in_scale[index]);
...@@ -234,7 +240,12 @@ static ssize_t set_in_max(struct device *dev, struct device_attribute *attr, ...@@ -234,7 +240,12 @@ static ssize_t set_in_max(struct device *dev, struct device_attribute *attr,
int index = to_sensor_dev_attr(attr)->index; int index = to_sensor_dev_attr(attr)->index;
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1025_data *data = i2c_get_clientdata(client); struct adm1025_data *data = i2c_get_clientdata(client);
long val = simple_strtol(buf, NULL, 10); long val;
int err;
err = kstrtol(buf, 10, &val);
if (err)
return err;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
data->in_max[index] = IN_TO_REG(val, in_scale[index]); data->in_max[index] = IN_TO_REG(val, in_scale[index]);
...@@ -264,7 +275,12 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, ...@@ -264,7 +275,12 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr,
int index = to_sensor_dev_attr(attr)->index; int index = to_sensor_dev_attr(attr)->index;
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1025_data *data = i2c_get_clientdata(client); struct adm1025_data *data = i2c_get_clientdata(client);
long val = simple_strtol(buf, NULL, 10); long val;
int err;
err = kstrtol(buf, 10, &val);
if (err)
return err;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
data->temp_min[index] = TEMP_TO_REG(val); data->temp_min[index] = TEMP_TO_REG(val);
...@@ -280,7 +296,12 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, ...@@ -280,7 +296,12 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
int index = to_sensor_dev_attr(attr)->index; int index = to_sensor_dev_attr(attr)->index;
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1025_data *data = i2c_get_clientdata(client); struct adm1025_data *data = i2c_get_clientdata(client);
long val = simple_strtol(buf, NULL, 10); long val;
int err;
err = kstrtol(buf, 10, &val);
if (err)
return err;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
data->temp_max[index] = TEMP_TO_REG(val); data->temp_max[index] = TEMP_TO_REG(val);
...@@ -343,7 +364,14 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, ...@@ -343,7 +364,14 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct adm1025_data *data = dev_get_drvdata(dev); struct adm1025_data *data = dev_get_drvdata(dev);
data->vrm = simple_strtoul(buf, NULL, 10); unsigned long val;
int err;
err = kstrtoul(buf, 10, &val);
if (err)
return err;
data->vrm = val;
return count; return count;
} }
static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm);
...@@ -462,14 +490,15 @@ static int adm1025_probe(struct i2c_client *client, ...@@ -462,14 +490,15 @@ static int adm1025_probe(struct i2c_client *client,
adm1025_init_client(client); adm1025_init_client(client);
/* Register sysfs hooks */ /* Register sysfs hooks */
if ((err = sysfs_create_group(&client->dev.kobj, &adm1025_group))) err = sysfs_create_group(&client->dev.kobj, &adm1025_group);
if (err)
goto exit_free; goto exit_free;
/* Pin 11 is either in4 (+12V) or VID4 */ /* Pin 11 is either in4 (+12V) or VID4 */
config = i2c_smbus_read_byte_data(client, ADM1025_REG_CONFIG); config = i2c_smbus_read_byte_data(client, ADM1025_REG_CONFIG);
if (!(config & 0x20)) { if (!(config & 0x20)) {
if ((err = sysfs_create_group(&client->dev.kobj, err = sysfs_create_group(&client->dev.kobj, &adm1025_group_in4);
&adm1025_group_in4))) if (err)
goto exit_remove; goto exit_remove;
} }
...@@ -506,7 +535,7 @@ static void adm1025_init_client(struct i2c_client *client) ...@@ -506,7 +535,7 @@ static void adm1025_init_client(struct i2c_client *client)
* setting yet, we better set the high limits to the max so that * setting yet, we better set the high limits to the max so that
* no alarm triggers. * no alarm triggers.
*/ */
for (i=0; i<6; i++) { for (i = 0; i < 6; i++) {
reg = i2c_smbus_read_byte_data(client, reg = i2c_smbus_read_byte_data(client,
ADM1025_REG_IN_MAX(i)); ADM1025_REG_IN_MAX(i));
if (reg == 0) if (reg == 0)
...@@ -514,7 +543,7 @@ static void adm1025_init_client(struct i2c_client *client) ...@@ -514,7 +543,7 @@ static void adm1025_init_client(struct i2c_client *client)
ADM1025_REG_IN_MAX(i), ADM1025_REG_IN_MAX(i),
0xFF); 0xFF);
} }
for (i=0; i<2; i++) { for (i = 0; i < 2; i++) {
reg = i2c_smbus_read_byte_data(client, reg = i2c_smbus_read_byte_data(client,
ADM1025_REG_TEMP_HIGH(i)); ADM1025_REG_TEMP_HIGH(i));
if (reg == 0) if (reg == 0)
...@@ -555,7 +584,7 @@ static struct adm1025_data *adm1025_update_device(struct device *dev) ...@@ -555,7 +584,7 @@ static struct adm1025_data *adm1025_update_device(struct device *dev)
int i; int i;
dev_dbg(&client->dev, "Updating data.\n"); dev_dbg(&client->dev, "Updating data.\n");
for (i=0; i<6; i++) { for (i = 0; i < 6; i++) {
data->in[i] = i2c_smbus_read_byte_data(client, data->in[i] = i2c_smbus_read_byte_data(client,
ADM1025_REG_IN(i)); ADM1025_REG_IN(i));
data->in_min[i] = i2c_smbus_read_byte_data(client, data->in_min[i] = i2c_smbus_read_byte_data(client,
...@@ -563,7 +592,7 @@ static struct adm1025_data *adm1025_update_device(struct device *dev) ...@@ -563,7 +592,7 @@ static struct adm1025_data *adm1025_update_device(struct device *dev)
data->in_max[i] = i2c_smbus_read_byte_data(client, data->in_max[i] = i2c_smbus_read_byte_data(client,
ADM1025_REG_IN_MAX(i)); ADM1025_REG_IN_MAX(i));
} }
for (i=0; i<2; i++) { for (i = 0; i < 2; i++) {
data->temp[i] = i2c_smbus_read_byte_data(client, data->temp[i] = i2c_smbus_read_byte_data(client,
ADM1025_REG_TEMP(i)); ADM1025_REG_TEMP(i));
data->temp_min[i] = i2c_smbus_read_byte_data(client, data->temp_min[i] = i2c_smbus_read_byte_data(client,
...@@ -589,19 +618,8 @@ static struct adm1025_data *adm1025_update_device(struct device *dev) ...@@ -589,19 +618,8 @@ static struct adm1025_data *adm1025_update_device(struct device *dev)
return data; return data;
} }
static int __init sensors_adm1025_init(void) module_i2c_driver(adm1025_driver);
{
return i2c_add_driver(&adm1025_driver);
}
static void __exit sensors_adm1025_exit(void)
{
i2c_del_driver(&adm1025_driver);
}
MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>"); MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>");
MODULE_DESCRIPTION("ADM1025 driver"); MODULE_DESCRIPTION("ADM1025 driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(sensors_adm1025_init);
module_exit(sensors_adm1025_exit);
This diff is collapsed.
...@@ -78,7 +78,7 @@ static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, ...@@ -78,7 +78,7 @@ static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
#define TEMP_FROM_REG(val) ((val) * 1000) #define TEMP_FROM_REG(val) ((val) * 1000)
#define DIV_FROM_REG(val) ( 1 << (((val) >> 6) - 1)) #define DIV_FROM_REG(val) (1 << (((val) >> 6) - 1))
/* Registers to be checked by adm1029_update_device() */ /* Registers to be checked by adm1029_update_device() */
static const u8 ADM1029_REG_TEMP[] = { static const u8 ADM1029_REG_TEMP[] = {
...@@ -200,8 +200,11 @@ static ssize_t set_fan_div(struct device *dev, ...@@ -200,8 +200,11 @@ static ssize_t set_fan_div(struct device *dev,
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1029_data *data = i2c_get_clientdata(client); struct adm1029_data *data = i2c_get_clientdata(client);
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
long val = simple_strtol(buf, NULL, 10);
u8 reg; u8 reg;
long val;
int ret = kstrtol(buf, 10, &val);
if (ret < 0)
return ret;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
...@@ -237,9 +240,9 @@ static ssize_t set_fan_div(struct device *dev, ...@@ -237,9 +240,9 @@ static ssize_t set_fan_div(struct device *dev,
} }
/* /*
Access rights on sysfs, S_IRUGO stand for Is Readable by User, Group and Others * Access rights on sysfs. S_IRUGO: Is Readable by User, Group and Others
S_IWUSR stand for Is Writable by User * S_IWUSR: Is Writable by User.
*/ */
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1); static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1);
static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2); static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2);
...@@ -300,7 +303,8 @@ static int adm1029_detect(struct i2c_client *client, ...@@ -300,7 +303,8 @@ static int adm1029_detect(struct i2c_client *client,
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -ENODEV; return -ENODEV;
/* ADM1029 doesn't have CHIP ID, check just MAN ID /*
* ADM1029 doesn't have CHIP ID, check just MAN ID
* For better detection we check also ADM1029_TEMP_DEVICES_INSTALLED, * For better detection we check also ADM1029_TEMP_DEVICES_INSTALLED,
* ADM1029_REG_NB_FAN_SUPPORT and compare it with possible values * ADM1029_REG_NB_FAN_SUPPORT and compare it with possible values
* documented * documented
...@@ -318,8 +322,10 @@ static int adm1029_detect(struct i2c_client *client, ...@@ -318,8 +322,10 @@ static int adm1029_detect(struct i2c_client *client,
return -ENODEV; return -ENODEV;
if ((chip_id & 0xF0) != 0x00) { if ((chip_id & 0xF0) != 0x00) {
/* There are no "official" CHIP ID, so actually /*
* we use Major/Minor revision for that */ * There are no "official" CHIP ID, so actually
* we use Major/Minor revision for that
*/
pr_info("adm1029: Unknown major revision %x, " pr_info("adm1029: Unknown major revision %x, "
"please let us know\n", chip_id); "please let us know\n", chip_id);
return -ENODEV; return -ENODEV;
...@@ -355,7 +361,8 @@ static int adm1029_probe(struct i2c_client *client, ...@@ -355,7 +361,8 @@ static int adm1029_probe(struct i2c_client *client,
} }
/* Register sysfs hooks */ /* Register sysfs hooks */
if ((err = sysfs_create_group(&client->dev.kobj, &adm1029_group))) err = sysfs_create_group(&client->dev.kobj, &adm1029_group);
if (err)
goto exit_free; goto exit_free;
data->hwmon_dev = hwmon_device_register(&client->dev); data->hwmon_dev = hwmon_device_register(&client->dev);
...@@ -403,8 +410,8 @@ static int adm1029_remove(struct i2c_client *client) ...@@ -403,8 +410,8 @@ static int adm1029_remove(struct i2c_client *client)
} }
/* /*
function that update the status of the chips (temperature for example) * function that update the status of the chips (temperature for example)
*/ */
static struct adm1029_data *adm1029_update_device(struct device *dev) static struct adm1029_data *adm1029_update_device(struct device *dev)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
...@@ -446,24 +453,8 @@ static struct adm1029_data *adm1029_update_device(struct device *dev) ...@@ -446,24 +453,8 @@ static struct adm1029_data *adm1029_update_device(struct device *dev)
return data; return data;
} }
/* module_i2c_driver(adm1029_driver);
Common module stuff
*/
static int __init sensors_adm1029_init(void)
{
return i2c_add_driver(&adm1029_driver);
}
static void __exit sensors_adm1029_exit(void)
{
i2c_del_driver(&adm1029_driver);
}
MODULE_AUTHOR("Corentin LABBE <corentin.labbe@geomatys.fr>"); MODULE_AUTHOR("Corentin LABBE <corentin.labbe@geomatys.fr>");
MODULE_DESCRIPTION("adm1029 driver"); MODULE_DESCRIPTION("adm1029 driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
module_init(sensors_adm1029_init);
module_exit(sensors_adm1029_exit);
/* /*
adm1031.c - Part of lm_sensors, Linux kernel modules for hardware * adm1031.c - Part of lm_sensors, Linux kernel modules for hardware
monitoring * monitoring
Based on lm75.c and lm85.c * Based on lm75.c and lm85.c
Supports adm1030 / adm1031 * Supports adm1030 / adm1031
Copyright (C) 2004 Alexandre d'Alton <alex@alexdalton.org> * Copyright (C) 2004 Alexandre d'Alton <alex@alexdalton.org>
Reworked by Jean Delvare <khali@linux-fr.org> * Reworked by Jean Delvare <khali@linux-fr.org>
*
This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. * (at your option) any later version.
*
This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. * GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -80,7 +80,8 @@ struct adm1031_data { ...@@ -80,7 +80,8 @@ struct adm1031_data {
char valid; /* !=0 if following fields are valid */ char valid; /* !=0 if following fields are valid */
unsigned long last_updated; /* In jiffies */ unsigned long last_updated; /* In jiffies */
unsigned int update_interval; /* In milliseconds */ unsigned int update_interval; /* In milliseconds */
/* The chan_select_table contains the possible configurations for /*
* The chan_select_table contains the possible configurations for
* auto fan control. * auto fan control.
*/ */
const auto_chan_table_t *chan_select_table; const auto_chan_table_t *chan_select_table;
...@@ -205,7 +206,8 @@ static int AUTO_TEMP_MAX_TO_REG(int val, int reg, int pwm) ...@@ -205,7 +206,8 @@ static int AUTO_TEMP_MAX_TO_REG(int val, int reg, int pwm)
#define GET_FAN_AUTO_BITFIELD(data, idx) \ #define GET_FAN_AUTO_BITFIELD(data, idx) \
(*(data)->chan_select_table)[FAN_CHAN_FROM_REG((data)->conf1)][idx % 2] (*(data)->chan_select_table)[FAN_CHAN_FROM_REG((data)->conf1)][idx % 2]
/* The tables below contains the possible values for the auto fan /*
* The tables below contains the possible values for the auto fan
* control bitfields. the index in the table is the register value. * control bitfields. the index in the table is the register value.
* MSb is the auto fan control enable bit, so the four first entries * MSb is the auto fan control enable bit, so the four first entries
* in the table disables auto fan control when both bitfields are zero. * in the table disables auto fan control when both bitfields are zero.
...@@ -226,7 +228,8 @@ static const auto_chan_table_t auto_channel_select_table_adm1030 = { ...@@ -226,7 +228,8 @@ static const auto_chan_table_t auto_channel_select_table_adm1030 = {
{ 3 /* 0b11 */ , 0 }, { 3 /* 0b11 */ , 0 },
}; };
/* That function checks if a bitfield is valid and returns the other bitfield /*
* That function checks if a bitfield is valid and returns the other bitfield
* nearest match if no exact match where found. * nearest match if no exact match where found.
*/ */
static int static int
...@@ -252,7 +255,8 @@ get_fan_auto_nearest(struct adm1031_data *data, ...@@ -252,7 +255,8 @@ get_fan_auto_nearest(struct adm1031_data *data,
break; break;
} else if (val == (*data->chan_select_table)[i][chan] && } else if (val == (*data->chan_select_table)[i][chan] &&
first_match == -1) { first_match == -1) {
/* Save the first match in case of an exact match has /*
* Save the first match in case of an exact match has
* not been found * not been found
*/ */
first_match = i; first_match = i;
...@@ -306,9 +310,11 @@ set_fan_auto_channel(struct device *dev, struct device_attribute *attr, ...@@ -306,9 +310,11 @@ set_fan_auto_channel(struct device *dev, struct device_attribute *attr,
if ((data->conf1 & ADM1031_CONF1_AUTO_MODE) ^ if ((data->conf1 & ADM1031_CONF1_AUTO_MODE) ^
(old_fan_mode & ADM1031_CONF1_AUTO_MODE)) { (old_fan_mode & ADM1031_CONF1_AUTO_MODE)) {
if (data->conf1 & ADM1031_CONF1_AUTO_MODE) { if (data->conf1 & ADM1031_CONF1_AUTO_MODE) {
/* Switch to Auto Fan Mode /*
* Switch to Auto Fan Mode
* Save PWM registers * Save PWM registers
* Set PWM registers to 33% Both */ * Set PWM registers to 33% Both
*/
data->old_pwm[0] = data->pwm[0]; data->old_pwm[0] = data->pwm[0];
data->old_pwm[1] = data->pwm[1]; data->old_pwm[1] = data->pwm[1];
adm1031_write_value(client, ADM1031_REG_PWM, 0x55); adm1031_write_value(client, ADM1031_REG_PWM, 0x55);
...@@ -1131,19 +1137,8 @@ static struct adm1031_data *adm1031_update_device(struct device *dev) ...@@ -1131,19 +1137,8 @@ static struct adm1031_data *adm1031_update_device(struct device *dev)
return data; return data;
} }
static int __init sensors_adm1031_init(void) module_i2c_driver(adm1031_driver);
{
return i2c_add_driver(&adm1031_driver);
}
static void __exit sensors_adm1031_exit(void)
{
i2c_del_driver(&adm1031_driver);
}
MODULE_AUTHOR("Alexandre d'Alton <alex@alexdalton.org>"); MODULE_AUTHOR("Alexandre d'Alton <alex@alexdalton.org>");
MODULE_DESCRIPTION("ADM1031/ADM1030 driver"); MODULE_DESCRIPTION("ADM1031/ADM1030 driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(sensors_adm1031_init);
module_exit(sensors_adm1031_exit);
/* /*
* adm9240.c Part of lm_sensors, Linux kernel modules for hardware * adm9240.c Part of lm_sensors, Linux kernel modules for hardware
* monitoring * monitoring
* *
* Copyright (C) 1999 Frodo Looijaard <frodol@dds.nl> * Copyright (C) 1999 Frodo Looijaard <frodol@dds.nl>
* Philip Edelbrock <phil@netroedge.com> * Philip Edelbrock <phil@netroedge.com>
* Copyright (C) 2003 Michiel Rook <michiel@grendelproject.nl> * Copyright (C) 2003 Michiel Rook <michiel@grendelproject.nl>
* Copyright (C) 2005 Grant Coady <gcoady.lk@gmail.com> with valuable * Copyright (C) 2005 Grant Coady <gcoady.lk@gmail.com> with valuable
* guidance from Jean Delvare * guidance from Jean Delvare
* *
* Driver supports Analog Devices ADM9240 * Driver supports Analog Devices ADM9240
* Dallas Semiconductor DS1780 * Dallas Semiconductor DS1780
...@@ -204,7 +204,12 @@ static ssize_t set_max(struct device *dev, struct device_attribute *devattr, ...@@ -204,7 +204,12 @@ static ssize_t set_max(struct device *dev, struct device_attribute *devattr,
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm9240_data *data = i2c_get_clientdata(client); struct adm9240_data *data = i2c_get_clientdata(client);
long val = simple_strtol(buf, NULL, 10); long val;
int err;
err = kstrtol(buf, 10, &val);
if (err)
return err;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
data->temp_max[attr->index] = TEMP_TO_REG(val); data->temp_max[attr->index] = TEMP_TO_REG(val);
...@@ -255,7 +260,12 @@ static ssize_t set_in_min(struct device *dev, ...@@ -255,7 +260,12 @@ static ssize_t set_in_min(struct device *dev,
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm9240_data *data = i2c_get_clientdata(client); struct adm9240_data *data = i2c_get_clientdata(client);
unsigned long val = simple_strtoul(buf, NULL, 10); unsigned long val;
int err;
err = kstrtoul(buf, 10, &val);
if (err)
return err;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
data->in_min[attr->index] = IN_TO_REG(val, attr->index); data->in_min[attr->index] = IN_TO_REG(val, attr->index);
...@@ -272,7 +282,12 @@ static ssize_t set_in_max(struct device *dev, ...@@ -272,7 +282,12 @@ static ssize_t set_in_max(struct device *dev,
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm9240_data *data = i2c_get_clientdata(client); struct adm9240_data *data = i2c_get_clientdata(client);
unsigned long val = simple_strtoul(buf, NULL, 10); unsigned long val;
int err;
err = kstrtoul(buf, 10, &val);
if (err)
return err;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
data->in_max[attr->index] = IN_TO_REG(val, attr->index); data->in_max[attr->index] = IN_TO_REG(val, attr->index);
...@@ -283,7 +298,7 @@ static ssize_t set_in_max(struct device *dev, ...@@ -283,7 +298,7 @@ static ssize_t set_in_max(struct device *dev,
} }
#define vin(nr) \ #define vin(nr) \
static SENSOR_DEVICE_ATTR(in##nr##_input, S_IRUGO, \ static SENSOR_DEVICE_ATTR(in##nr##_input, S_IRUGO, \
show_in, NULL, nr); \ show_in, NULL, nr); \
static SENSOR_DEVICE_ATTR(in##nr##_min, S_IRUGO | S_IWUSR, \ static SENSOR_DEVICE_ATTR(in##nr##_min, S_IRUGO | S_IWUSR, \
show_in_min, set_in_min, nr); \ show_in_min, set_in_min, nr); \
...@@ -357,9 +372,14 @@ static ssize_t set_fan_min(struct device *dev, ...@@ -357,9 +372,14 @@ static ssize_t set_fan_min(struct device *dev,
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm9240_data *data = i2c_get_clientdata(client); struct adm9240_data *data = i2c_get_clientdata(client);
unsigned long val = simple_strtoul(buf, NULL, 10);
int nr = attr->index; int nr = attr->index;
u8 new_div; u8 new_div;
unsigned long val;
int err;
err = kstrtoul(buf, 10, &val);
if (err)
return err;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
...@@ -465,7 +485,12 @@ static ssize_t set_aout(struct device *dev, ...@@ -465,7 +485,12 @@ static ssize_t set_aout(struct device *dev,
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm9240_data *data = i2c_get_clientdata(client); struct adm9240_data *data = i2c_get_clientdata(client);
unsigned long val = simple_strtol(buf, NULL, 10); long val;
int err;
err = kstrtol(buf, 10, &val);
if (err)
return err;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
data->aout = AOUT_TO_REG(val); data->aout = AOUT_TO_REG(val);
...@@ -481,7 +506,12 @@ static ssize_t chassis_clear_legacy(struct device *dev, ...@@ -481,7 +506,12 @@ static ssize_t chassis_clear_legacy(struct device *dev,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
unsigned long val = simple_strtol(buf, NULL, 10); long val;
int err;
err = kstrtol(buf, 10, &val);
if (err)
return err;
dev_warn(dev, "Attribute chassis_clear is deprecated, " dev_warn(dev, "Attribute chassis_clear is deprecated, "
"use intrusion0_alarm instead\n"); "use intrusion0_alarm instead\n");
...@@ -632,7 +662,8 @@ static int adm9240_probe(struct i2c_client *new_client, ...@@ -632,7 +662,8 @@ static int adm9240_probe(struct i2c_client *new_client,
adm9240_init_client(new_client); adm9240_init_client(new_client);
/* populate sysfs filesystem */ /* populate sysfs filesystem */
if ((err = sysfs_create_group(&new_client->dev.kobj, &adm9240_group))) err = sysfs_create_group(&new_client->dev.kobj, &adm9240_group);
if (err)
goto exit_free; goto exit_free;
data->hwmon_dev = hwmon_device_register(&new_client->dev); data->hwmon_dev = hwmon_device_register(&new_client->dev);
...@@ -681,8 +712,7 @@ static void adm9240_init_client(struct i2c_client *client) ...@@ -681,8 +712,7 @@ static void adm9240_init_client(struct i2c_client *client)
} else { /* cold start: open limits before starting chip */ } else { /* cold start: open limits before starting chip */
int i; int i;
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++) {
{
i2c_smbus_write_byte_data(client, i2c_smbus_write_byte_data(client,
ADM9240_REG_IN_MIN(i), 0); ADM9240_REG_IN_MIN(i), 0);
i2c_smbus_write_byte_data(client, i2c_smbus_write_byte_data(client,
...@@ -717,8 +747,7 @@ static struct adm9240_data *adm9240_update_device(struct device *dev) ...@@ -717,8 +747,7 @@ static struct adm9240_data *adm9240_update_device(struct device *dev)
if (time_after(jiffies, data->last_updated_measure + (HZ * 7 / 4)) if (time_after(jiffies, data->last_updated_measure + (HZ * 7 / 4))
|| !data->valid) { || !data->valid) {
for (i = 0; i < 6; i++) /* read voltages */ for (i = 0; i < 6; i++) { /* read voltages */
{
data->in[i] = i2c_smbus_read_byte_data(client, data->in[i] = i2c_smbus_read_byte_data(client,
ADM9240_REG_IN(i)); ADM9240_REG_IN(i));
} }
...@@ -727,16 +756,17 @@ static struct adm9240_data *adm9240_update_device(struct device *dev) ...@@ -727,16 +756,17 @@ static struct adm9240_data *adm9240_update_device(struct device *dev)
i2c_smbus_read_byte_data(client, i2c_smbus_read_byte_data(client,
ADM9240_REG_INT(1)) << 8; ADM9240_REG_INT(1)) << 8;
/* read temperature: assume temperature changes less than /*
* read temperature: assume temperature changes less than
* 0.5'C per two measurement cycles thus ignore possible * 0.5'C per two measurement cycles thus ignore possible
* but unlikely aliasing error on lsb reading. --Grant */ * but unlikely aliasing error on lsb reading. --Grant
*/
data->temp = ((i2c_smbus_read_byte_data(client, data->temp = ((i2c_smbus_read_byte_data(client,
ADM9240_REG_TEMP) << 8) | ADM9240_REG_TEMP) << 8) |
i2c_smbus_read_byte_data(client, i2c_smbus_read_byte_data(client,
ADM9240_REG_TEMP_CONF)) / 128; ADM9240_REG_TEMP_CONF)) / 128;
for (i = 0; i < 2; i++) /* read fans */ for (i = 0; i < 2; i++) { /* read fans */
{
data->fan[i] = i2c_smbus_read_byte_data(client, data->fan[i] = i2c_smbus_read_byte_data(client,
ADM9240_REG_FAN(i)); ADM9240_REG_FAN(i));
...@@ -760,15 +790,13 @@ static struct adm9240_data *adm9240_update_device(struct device *dev) ...@@ -760,15 +790,13 @@ static struct adm9240_data *adm9240_update_device(struct device *dev)
if (time_after(jiffies, data->last_updated_config + (HZ * 300)) if (time_after(jiffies, data->last_updated_config + (HZ * 300))
|| !data->valid) { || !data->valid) {
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++) {
{
data->in_min[i] = i2c_smbus_read_byte_data(client, data->in_min[i] = i2c_smbus_read_byte_data(client,
ADM9240_REG_IN_MIN(i)); ADM9240_REG_IN_MIN(i));
data->in_max[i] = i2c_smbus_read_byte_data(client, data->in_max[i] = i2c_smbus_read_byte_data(client,
ADM9240_REG_IN_MAX(i)); ADM9240_REG_IN_MAX(i));
} }
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++) {
{
data->fan_min[i] = i2c_smbus_read_byte_data(client, data->fan_min[i] = i2c_smbus_read_byte_data(client,
ADM9240_REG_FAN_MIN(i)); ADM9240_REG_FAN_MIN(i));
} }
...@@ -795,21 +823,9 @@ static struct adm9240_data *adm9240_update_device(struct device *dev) ...@@ -795,21 +823,9 @@ static struct adm9240_data *adm9240_update_device(struct device *dev)
return data; return data;
} }
static int __init sensors_adm9240_init(void) module_i2c_driver(adm9240_driver);
{
return i2c_add_driver(&adm9240_driver);
}
static void __exit sensors_adm9240_exit(void)
{
i2c_del_driver(&adm9240_driver);
}
MODULE_AUTHOR("Michiel Rook <michiel@grendelproject.nl>, " MODULE_AUTHOR("Michiel Rook <michiel@grendelproject.nl>, "
"Grant Coady <gcoady.lk@gmail.com> and others"); "Grant Coady <gcoady.lk@gmail.com> and others");
MODULE_DESCRIPTION("ADM9240/DS1780/LM81 driver"); MODULE_DESCRIPTION("ADM9240/DS1780/LM81 driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(sensors_adm9240_init);
module_exit(sensors_adm9240_exit);
...@@ -305,19 +305,8 @@ static struct i2c_driver ads1015_driver = { ...@@ -305,19 +305,8 @@ static struct i2c_driver ads1015_driver = {
.id_table = ads1015_id, .id_table = ads1015_id,
}; };
static int __init sensors_ads1015_init(void) module_i2c_driver(ads1015_driver);
{
return i2c_add_driver(&ads1015_driver);
}
static void __exit sensors_ads1015_exit(void)
{
i2c_del_driver(&ads1015_driver);
}
MODULE_AUTHOR("Dirk Eibach <eibach@gdsys.de>"); MODULE_AUTHOR("Dirk Eibach <eibach@gdsys.de>");
MODULE_DESCRIPTION("ADS1015 driver"); MODULE_DESCRIPTION("ADS1015 driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(sensors_ads1015_init);
module_exit(sensors_ads1015_exit);
/* /*
ads7828.c - lm_sensors driver for ads7828 12-bit 8-channel ADC * ads7828.c - lm_sensors driver for ads7828 12-bit 8-channel ADC
(C) 2007 EADS Astrium * (C) 2007 EADS Astrium
*
This driver is based on the lm75 and other lm_sensors/hwmon drivers * This driver is based on the lm75 and other lm_sensors/hwmon drivers
*
Written by Steve Hardy <shardy@redhat.com> * Written by Steve Hardy <shardy@redhat.com>
*
Datasheet available at: http://focus.ti.com/lit/ds/symlink/ads7828.pdf * Datasheet available at: http://focus.ti.com/lit/ds/symlink/ads7828.pdf
*
This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. * (at your option) any later version.
*
This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. * GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -188,12 +188,13 @@ static int ads7828_detect(struct i2c_client *client, ...@@ -188,12 +188,13 @@ static int ads7828_detect(struct i2c_client *client,
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_WORD_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_WORD_DATA))
return -ENODEV; return -ENODEV;
/* Now, we do the remaining detection. There is no identification /*
dedicated register so attempt to sanity check using knowledge of * Now, we do the remaining detection. There is no identification
the chip * dedicated register so attempt to sanity check using knowledge of
- Read from the 8 channel addresses * the chip
- Check the top 4 bits of each result are not set (12 data bits) * - Read from the 8 channel addresses
*/ * - Check the top 4 bits of each result are not set (12 data bits)
*/
for (ch = 0; ch < ADS7828_NCH; ch++) { for (ch = 0; ch < ADS7828_NCH; ch++) {
u16 in_data; u16 in_data;
u8 cmd = channel_cmd_byte(ch); u8 cmd = channel_cmd_byte(ch);
......
...@@ -34,9 +34,11 @@ ...@@ -34,9 +34,11 @@
#define REG_SER_CONTROL 24 /*Serial Interface Control Register*/ #define REG_SER_CONTROL 24 /*Serial Interface Control Register*/
#define REG_ID 31 /*ID Register*/ #define REG_ID 31 /*ID Register*/
/*From figure 17 in the datasheet /*
* These bits get ORed with the address to form * From figure 17 in the datasheet
* the instruction byte */ * These bits get ORed with the address to form
* the instruction byte
*/
/*Instruction Bit masks*/ /*Instruction Bit masks*/
#define INST_MODE_bm (1<<7) #define INST_MODE_bm (1<<7)
#define INST_READ_bm (1<<6) #define INST_READ_bm (1<<6)
...@@ -105,8 +107,10 @@ static ssize_t show_voltage(struct device *dev, ...@@ -105,8 +107,10 @@ static ssize_t show_voltage(struct device *dev,
uint8_t channel, mux_cnv; uint8_t channel, mux_cnv;
channel = attr->index; channel = attr->index;
/*TODO: add support for conversions /*
*other than single ended with a gain of 1*/ * TODO: add support for conversions
* other than single ended with a gain of 1
*/
/*MUX_M3_bm forces single ended*/ /*MUX_M3_bm forces single ended*/
/*This is also where the gain of the PGA would be set*/ /*This is also where the gain of the PGA would be set*/
ads7871_write_reg8(spi, REG_GAIN_MUX, ads7871_write_reg8(spi, REG_GAIN_MUX,
...@@ -114,8 +118,10 @@ static ssize_t show_voltage(struct device *dev, ...@@ -114,8 +118,10 @@ static ssize_t show_voltage(struct device *dev,
ret = ads7871_read_reg8(spi, REG_GAIN_MUX); ret = ads7871_read_reg8(spi, REG_GAIN_MUX);
mux_cnv = ((ret & MUX_CNV_bm)>>MUX_CNV_bv); mux_cnv = ((ret & MUX_CNV_bm)>>MUX_CNV_bv);
/*on 400MHz arm9 platform the conversion /*
*is already done when we do this test*/ * on 400MHz arm9 platform the conversion
* is already done when we do this test
*/
while ((i < 2) && mux_cnv) { while ((i < 2) && mux_cnv) {
i++; i++;
ret = ads7871_read_reg8(spi, REG_GAIN_MUX); ret = ads7871_read_reg8(spi, REG_GAIN_MUX);
...@@ -179,8 +185,10 @@ static int __devinit ads7871_probe(struct spi_device *spi) ...@@ -179,8 +185,10 @@ static int __devinit ads7871_probe(struct spi_device *spi)
ret = ads7871_read_reg8(spi, REG_OSC_CONTROL); ret = ads7871_read_reg8(spi, REG_OSC_CONTROL);
dev_dbg(&spi->dev, "REG_OSC_CONTROL write:%x, read:%x\n", val, ret); dev_dbg(&spi->dev, "REG_OSC_CONTROL write:%x, read:%x\n", val, ret);
/*because there is no other error checking on an SPI bus /*
we need to make sure we really have a chip*/ * because there is no other error checking on an SPI bus
* we need to make sure we really have a chip
*/
if (val != ret) { if (val != ret) {
err = -ENODEV; err = -ENODEV;
goto exit; goto exit;
...@@ -234,18 +242,7 @@ static struct spi_driver ads7871_driver = { ...@@ -234,18 +242,7 @@ static struct spi_driver ads7871_driver = {
.remove = __devexit_p(ads7871_remove), .remove = __devexit_p(ads7871_remove),
}; };
static int __init ads7871_init(void) module_spi_driver(ads7871_driver);
{
return spi_register_driver(&ads7871_driver);
}
static void __exit ads7871_exit(void)
{
spi_unregister_driver(&ads7871_driver);
}
module_init(ads7871_init);
module_exit(ads7871_exit);
MODULE_AUTHOR("Paul Thomas <pthomas8589@gmail.com>"); MODULE_AUTHOR("Paul Thomas <pthomas8589@gmail.com>");
MODULE_DESCRIPTION("TI ADS7871 A/D driver"); MODULE_DESCRIPTION("TI ADS7871 A/D driver");
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* TODO: SPI, support for external temperature sensor * TODO: SPI, support for external temperature sensor
* use power-down mode for suspend?, interrupt handling? * use power-down mode for suspend?, interrupt handling?
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -348,17 +348,7 @@ static struct i2c_driver adt7411_driver = { ...@@ -348,17 +348,7 @@ static struct i2c_driver adt7411_driver = {
.class = I2C_CLASS_HWMON, .class = I2C_CLASS_HWMON,
}; };
static int __init sensors_adt7411_init(void) module_i2c_driver(adt7411_driver);
{
return i2c_add_driver(&adt7411_driver);
}
module_init(sensors_adt7411_init)
static void __exit sensors_adt7411_exit(void)
{
i2c_del_driver(&adt7411_driver);
}
module_exit(sensors_adt7411_exit)
MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de> and " MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de> and "
"Wolfram Sang <w.sang@pengutronix.de>"); "Wolfram Sang <w.sang@pengutronix.de>");
......
...@@ -65,8 +65,8 @@ static const unsigned short normal_i2c[] = { 0x58, 0x5C, I2C_CLIENT_END }; ...@@ -65,8 +65,8 @@ static const unsigned short normal_i2c[] = { 0x58, 0x5C, I2C_CLIENT_END };
#define ADT7462_REG_PWM_TEMP_MIN_MAX_ADDR 0x5F #define ADT7462_REG_PWM_TEMP_MIN_MAX_ADDR 0x5F
#define ADT7462_REG_PWM_TEMP_RANGE_BASE_ADDR 0x60 #define ADT7462_REG_PWM_TEMP_RANGE_BASE_ADDR 0x60
#define ADT7462_REG_PWM_TEMP_RANGE_MAX_ADDR 0x63 #define ADT7462_REG_PWM_TEMP_RANGE_MAX_ADDR 0x63
#define ADT7462_PWM_HYST_MASK 0x0F #define ADT7462_PWM_HYST_MASK 0x0F
#define ADT7462_PWM_RANGE_MASK 0xF0 #define ADT7462_PWM_RANGE_MASK 0xF0
#define ADT7462_PWM_RANGE_SHIFT 4 #define ADT7462_PWM_RANGE_SHIFT 4
#define ADT7462_REG_PWM_CFG_BASE_ADDR 0x21 #define ADT7462_REG_PWM_CFG_BASE_ADDR 0x21
#define ADT7462_REG_PWM_CFG_MAX_ADDR 0x24 #define ADT7462_REG_PWM_CFG_MAX_ADDR 0x24
...@@ -85,7 +85,7 @@ static const unsigned short normal_i2c[] = { 0x58, 0x5C, I2C_CLIENT_END }; ...@@ -85,7 +85,7 @@ static const unsigned short normal_i2c[] = { 0x58, 0x5C, I2C_CLIENT_END };
#define ADT7462_PIN15_INPUT 0x20 #define ADT7462_PIN15_INPUT 0x20
#define ADT7462_PIN13_INPUT 0x40 #define ADT7462_PIN13_INPUT 0x40
#define ADT7462_PIN8_INPUT 0x80 #define ADT7462_PIN8_INPUT 0x80
#define ADT7462_PIN23_MASK 0x03 #define ADT7462_PIN23_MASK 0x03
#define ADT7462_PIN23_SHIFT 0 #define ADT7462_PIN23_SHIFT 0
#define ADT7462_PIN26_MASK 0x0C /* cfg2 */ #define ADT7462_PIN26_MASK 0x0C /* cfg2 */
#define ADT7462_PIN26_SHIFT 2 #define ADT7462_PIN26_SHIFT 2
...@@ -99,7 +99,7 @@ static const unsigned short normal_i2c[] = { 0x58, 0x5C, I2C_CLIENT_END }; ...@@ -99,7 +99,7 @@ static const unsigned short normal_i2c[] = { 0x58, 0x5C, I2C_CLIENT_END };
#define ADT7462_PIN28_VOLT 0x5 #define ADT7462_PIN28_VOLT 0x5
#define ADT7462_REG_ALARM1 0xB8 #define ADT7462_REG_ALARM1 0xB8
#define ADT7462_LT_ALARM 0x02 #define ADT7462_LT_ALARM 0x02
#define ADT7462_R1T_ALARM 0x04 #define ADT7462_R1T_ALARM 0x04
#define ADT7462_R2T_ALARM 0x08 #define ADT7462_R2T_ALARM 0x08
#define ADT7462_R3T_ALARM 0x10 #define ADT7462_R3T_ALARM 0x10
...@@ -135,9 +135,9 @@ static const unsigned short normal_i2c[] = { 0x58, 0x5C, I2C_CLIENT_END }; ...@@ -135,9 +135,9 @@ static const unsigned short normal_i2c[] = { 0x58, 0x5C, I2C_CLIENT_END };
#define ADT7462_ALARM_FLAG_MASK 0x0F #define ADT7462_ALARM_FLAG_MASK 0x0F
#define ADT7462_TEMP_COUNT 4 #define ADT7462_TEMP_COUNT 4
#define ADT7462_TEMP_REG(x) (ADT7462_REG_TEMP_BASE_ADDR + (x * 2)) #define ADT7462_TEMP_REG(x) (ADT7462_REG_TEMP_BASE_ADDR + ((x) * 2))
#define ADT7462_TEMP_MIN_REG(x) (ADT7462_REG_MIN_TEMP_BASE_ADDR + (x)) #define ADT7462_TEMP_MIN_REG(x) (ADT7462_REG_MIN_TEMP_BASE_ADDR + (x))
#define ADT7462_TEMP_MAX_REG(x) (ADT7462_REG_MAX_TEMP_BASE_ADDR + (x)) #define ADT7462_TEMP_MAX_REG(x) (ADT7462_REG_MAX_TEMP_BASE_ADDR + (x))
#define TEMP_FRAC_OFFSET 6 #define TEMP_FRAC_OFFSET 6
#define ADT7462_FAN_COUNT 8 #define ADT7462_FAN_COUNT 8
...@@ -1727,8 +1727,7 @@ static SENSOR_DEVICE_ATTR(pwm3_auto_channels_temp, S_IWUSR | S_IRUGO, ...@@ -1727,8 +1727,7 @@ static SENSOR_DEVICE_ATTR(pwm3_auto_channels_temp, S_IWUSR | S_IRUGO,
static SENSOR_DEVICE_ATTR(pwm4_auto_channels_temp, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR(pwm4_auto_channels_temp, S_IWUSR | S_IRUGO,
show_pwm_auto_temp, set_pwm_auto_temp, 3); show_pwm_auto_temp, set_pwm_auto_temp, 3);
static struct attribute *adt7462_attr[] = static struct attribute *adt7462_attr[] = {
{
&sensor_dev_attr_temp1_max.dev_attr.attr, &sensor_dev_attr_temp1_max.dev_attr.attr,
&sensor_dev_attr_temp2_max.dev_attr.attr, &sensor_dev_attr_temp2_max.dev_attr.attr,
&sensor_dev_attr_temp3_max.dev_attr.attr, &sensor_dev_attr_temp3_max.dev_attr.attr,
...@@ -1975,19 +1974,8 @@ static int adt7462_remove(struct i2c_client *client) ...@@ -1975,19 +1974,8 @@ static int adt7462_remove(struct i2c_client *client)
return 0; return 0;
} }
static int __init adt7462_init(void) module_i2c_driver(adt7462_driver);
{
return i2c_add_driver(&adt7462_driver);
}
static void __exit adt7462_exit(void)
{
i2c_del_driver(&adt7462_driver);
}
MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>"); MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>");
MODULE_DESCRIPTION("ADT7462 driver"); MODULE_DESCRIPTION("ADT7462 driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(adt7462_init);
module_exit(adt7462_exit);
...@@ -1131,8 +1131,7 @@ static SENSOR_DEVICE_ATTR(pwm3_auto_channels_temp, S_IWUSR | S_IRUGO, ...@@ -1131,8 +1131,7 @@ static SENSOR_DEVICE_ATTR(pwm3_auto_channels_temp, S_IWUSR | S_IRUGO,
static SENSOR_DEVICE_ATTR(pwm4_auto_channels_temp, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR(pwm4_auto_channels_temp, S_IWUSR | S_IRUGO,
show_pwm_auto_temp, set_pwm_auto_temp, 3); show_pwm_auto_temp, set_pwm_auto_temp, 3);
static struct attribute *adt7470_attr[] = static struct attribute *adt7470_attr[] = {
{
&dev_attr_alarm_mask.attr, &dev_attr_alarm_mask.attr,
&dev_attr_num_temp_sensors.attr, &dev_attr_num_temp_sensors.attr,
&dev_attr_auto_update_interval.attr, &dev_attr_auto_update_interval.attr,
...@@ -1276,7 +1275,8 @@ static int adt7470_probe(struct i2c_client *client, ...@@ -1276,7 +1275,8 @@ static int adt7470_probe(struct i2c_client *client,
/* Register sysfs hooks */ /* Register sysfs hooks */
data->attrs.attrs = adt7470_attr; data->attrs.attrs = adt7470_attr;
if ((err = sysfs_create_group(&client->dev.kobj, &data->attrs))) err = sysfs_create_group(&client->dev.kobj, &data->attrs);
if (err)
goto exit_free; goto exit_free;
data->hwmon_dev = hwmon_device_register(&client->dev); data->hwmon_dev = hwmon_device_register(&client->dev);
...@@ -1317,19 +1317,8 @@ static int adt7470_remove(struct i2c_client *client) ...@@ -1317,19 +1317,8 @@ static int adt7470_remove(struct i2c_client *client)
return 0; return 0;
} }
static int __init adt7470_init(void) module_i2c_driver(adt7470_driver);
{
return i2c_add_driver(&adt7470_driver);
}
static void __exit adt7470_exit(void)
{
i2c_del_driver(&adt7470_driver);
}
MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>"); MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>");
MODULE_DESCRIPTION("ADT7470 driver"); MODULE_DESCRIPTION("ADT7470 driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(adt7470_init);
module_exit(adt7470_exit);
...@@ -32,9 +32,10 @@ ...@@ -32,9 +32,10 @@
#define THERM 5 #define THERM 5
#define HYSTERSIS 6 #define HYSTERSIS 6
/* These are unique identifiers for the sysfs functions - unlike the /*
numbers above, these are not also indexes into an array * These are unique identifiers for the sysfs functions - unlike the
*/ * numbers above, these are not also indexes into an array
*/
#define ALARM 9 #define ALARM 9
#define FAULT 10 #define FAULT 10
...@@ -288,8 +289,10 @@ static void adt7475_write_word(struct i2c_client *client, int reg, u16 val) ...@@ -288,8 +289,10 @@ static void adt7475_write_word(struct i2c_client *client, int reg, u16 val)
i2c_smbus_write_byte_data(client, reg, val & 0xFF); i2c_smbus_write_byte_data(client, reg, val & 0xFF);
} }
/* Find the nearest value in a table - used for pwm frequency and /*
auto temp range */ * Find the nearest value in a table - used for pwm frequency and
* auto temp range
*/
static int find_nearest(long val, const int *array, int size) static int find_nearest(long val, const int *array, int size)
{ {
int i; int i;
...@@ -385,16 +388,20 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *attr, ...@@ -385,16 +388,20 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
out = (out >> 4) & 0xF; out = (out >> 4) & 0xF;
else else
out = (out & 0xF); out = (out & 0xF);
/* Show the value as an absolute number tied to /*
* THERM */ * Show the value as an absolute number tied to
* THERM
*/
out = reg2temp(data, data->temp[THERM][sattr->index]) - out = reg2temp(data, data->temp[THERM][sattr->index]) -
out * 1000; out * 1000;
mutex_unlock(&data->lock); mutex_unlock(&data->lock);
break; break;
case OFFSET: case OFFSET:
/* Offset is always 2's complement, regardless of the /*
* setting in CONFIG5 */ * Offset is always 2's complement, regardless of the
* setting in CONFIG5
*/
mutex_lock(&data->lock); mutex_lock(&data->lock);
out = (s8)data->temp[sattr->nr][sattr->index]; out = (s8)data->temp[sattr->nr][sattr->index];
if (data->config5 & CONFIG5_TEMPOFFSET) if (data->config5 & CONFIG5_TEMPOFFSET)
...@@ -452,8 +459,10 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr, ...@@ -452,8 +459,10 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr,
break; break;
case HYSTERSIS: case HYSTERSIS:
/* The value will be given as an absolute value, turn it /*
into an offset based on THERM */ * The value will be given as an absolute value, turn it
* into an offset based on THERM
*/
/* Read fresh THERM and HYSTERSIS values from the chip */ /* Read fresh THERM and HYSTERSIS values from the chip */
data->temp[THERM][sattr->index] = data->temp[THERM][sattr->index] =
...@@ -478,8 +487,10 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr, ...@@ -478,8 +487,10 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr,
default: default:
data->temp[sattr->nr][sattr->index] = temp2reg(data, val); data->temp[sattr->nr][sattr->index] = temp2reg(data, val);
/* We maintain an extra 2 digits of precision for simplicity /*
* - shift those back off before writing the value */ * We maintain an extra 2 digits of precision for simplicity
* - shift those back off before writing the value
*/
out = (u8) (data->temp[sattr->nr][sattr->index] >> 2); out = (u8) (data->temp[sattr->nr][sattr->index] >> 2);
} }
...@@ -514,8 +525,10 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr, ...@@ -514,8 +525,10 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr,
return count; return count;
} }
/* Table of autorange values - the user will write the value in millidegrees, /*
and we'll convert it */ * Table of autorange values - the user will write the value in millidegrees,
* and we'll convert it
*/
static const int autorange_table[] = { static const int autorange_table[] = {
2000, 2500, 3330, 4000, 5000, 6670, 8000, 2000, 2500, 3330, 4000, 5000, 6670, 8000,
10000, 13330, 16000, 20000, 26670, 32000, 40000, 10000, 13330, 16000, 20000, 26670, 32000, 40000,
...@@ -558,8 +571,10 @@ static ssize_t set_point2(struct device *dev, struct device_attribute *attr, ...@@ -558,8 +571,10 @@ static ssize_t set_point2(struct device *dev, struct device_attribute *attr,
data->range[sattr->index] = data->range[sattr->index] =
adt7475_read(TEMP_TRANGE_REG(sattr->index)); adt7475_read(TEMP_TRANGE_REG(sattr->index));
/* The user will write an absolute value, so subtract the start point /*
to figure the range */ * The user will write an absolute value, so subtract the start point
* to figure the range
*/
temp = reg2temp(data, data->temp[AUTOMIN][sattr->index]); temp = reg2temp(data, data->temp[AUTOMIN][sattr->index]);
val = SENSORS_LIMIT(val, temp + autorange_table[0], val = SENSORS_LIMIT(val, temp + autorange_table[0],
temp + autorange_table[ARRAY_SIZE(autorange_table) - 1]); temp + autorange_table[ARRAY_SIZE(autorange_table) - 1]);
...@@ -664,8 +679,10 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr, ...@@ -664,8 +679,10 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
data->pwm[CONTROL][sattr->index] = data->pwm[CONTROL][sattr->index] =
adt7475_read(PWM_CONFIG_REG(sattr->index)); adt7475_read(PWM_CONFIG_REG(sattr->index));
/* If we are not in manual mode, then we shouldn't allow /*
* the user to set the pwm speed */ * If we are not in manual mode, then we shouldn't allow
* the user to set the pwm speed
*/
if (((data->pwm[CONTROL][sattr->index] >> 5) & 7) != 7) { if (((data->pwm[CONTROL][sattr->index] >> 5) & 7) != 7) {
mutex_unlock(&data->lock); mutex_unlock(&data->lock);
return count; return count;
...@@ -1232,7 +1249,7 @@ static void adt7475_remove_files(struct i2c_client *client, ...@@ -1232,7 +1249,7 @@ static void adt7475_remove_files(struct i2c_client *client,
static int adt7475_probe(struct i2c_client *client, static int adt7475_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
static const char *names[] = { static const char * const names[] = {
[adt7473] = "ADT7473", [adt7473] = "ADT7473",
[adt7475] = "ADT7475", [adt7475] = "ADT7475",
[adt7476] = "ADT7476", [adt7476] = "ADT7476",
...@@ -1280,9 +1297,11 @@ static int adt7475_probe(struct i2c_client *client, ...@@ -1280,9 +1297,11 @@ static int adt7475_probe(struct i2c_client *client,
if ((data->config4 & CONFIG4_PINFUNC) == 0x0) if ((data->config4 & CONFIG4_PINFUNC) == 0x0)
data->has_fan4 = 1; data->has_fan4 = 1;
/* THERM configuration is more complex on the ADT7476 and ADT7490, /*
because 2 different pins (TACH4 and +2.5 Vin) can be used for * THERM configuration is more complex on the ADT7476 and ADT7490,
this function */ * because 2 different pins (TACH4 and +2.5 Vin) can be used for
* this function
*/
if (id->driver_data == adt7490) { if (id->driver_data == adt7490) {
if ((data->config4 & CONFIG4_PINFUNC) == 0x1 && if ((data->config4 & CONFIG4_PINFUNC) == 0x1 &&
!(config3 & CONFIG3_THERM)) !(config3 & CONFIG3_THERM))
...@@ -1294,8 +1313,10 @@ static int adt7475_probe(struct i2c_client *client, ...@@ -1294,8 +1313,10 @@ static int adt7475_probe(struct i2c_client *client,
data->has_voltage |= (1 << 0); /* in0 */ data->has_voltage |= (1 << 0); /* in0 */
} }
/* On the ADT7476, the +12V input pin may instead be used as VID5, /*
and VID pins may alternatively be used as GPIO */ * On the ADT7476, the +12V input pin may instead be used as VID5,
* and VID pins may alternatively be used as GPIO
*/
if (id->driver_data == adt7476) { if (id->driver_data == adt7476) {
u8 vid = adt7475_read(REG_VID); u8 vid = adt7475_read(REG_VID);
if (!(vid & VID_VIDSEL)) if (!(vid & VID_VIDSEL))
...@@ -1314,8 +1335,10 @@ static int adt7475_probe(struct i2c_client *client, ...@@ -1314,8 +1335,10 @@ static int adt7475_probe(struct i2c_client *client,
} }
data->bypass_attn &= data->has_voltage; data->bypass_attn &= data->has_voltage;
/* Call adt7475_read_pwm for all pwm's as this will reprogram any /*
pwm's which are disabled to manual mode with 0% duty cycle */ * Call adt7475_read_pwm for all pwm's as this will reprogram any
* pwm's which are disabled to manual mode with 0% duty cycle
*/
for (i = 0; i < ADT7475_PWM_COUNT; i++) for (i = 0; i < ADT7475_PWM_COUNT; i++)
adt7475_read_pwm(client, i); adt7475_read_pwm(client, i);
...@@ -1431,8 +1454,10 @@ static void adt7475_read_pwm(struct i2c_client *client, int index) ...@@ -1431,8 +1454,10 @@ static void adt7475_read_pwm(struct i2c_client *client, int index)
data->pwm[CONTROL][index] = adt7475_read(PWM_CONFIG_REG(index)); data->pwm[CONTROL][index] = adt7475_read(PWM_CONFIG_REG(index));
/* Figure out the internal value for pwmctrl and pwmchan /*
based on the current settings */ * Figure out the internal value for pwmctrl and pwmchan
* based on the current settings
*/
v = (data->pwm[CONTROL][index] >> 5) & 7; v = (data->pwm[CONTROL][index] >> 5) & 7;
if (v == 3) if (v == 3)
...@@ -1440,10 +1465,11 @@ static void adt7475_read_pwm(struct i2c_client *client, int index) ...@@ -1440,10 +1465,11 @@ static void adt7475_read_pwm(struct i2c_client *client, int index)
else if (v == 7) else if (v == 7)
data->pwmctl[index] = 1; data->pwmctl[index] = 1;
else if (v == 4) { else if (v == 4) {
/* The fan is disabled - we don't want to /*
support that, so change to manual mode and * The fan is disabled - we don't want to
set the duty cycle to 0 instead * support that, so change to manual mode and
*/ * set the duty cycle to 0 instead
*/
data->pwm[INPUT][index] = 0; data->pwm[INPUT][index] = 0;
data->pwm[CONTROL][index] &= ~0xE0; data->pwm[CONTROL][index] &= ~0xE0;
data->pwm[CONTROL][index] |= (7 << 5); data->pwm[CONTROL][index] |= (7 << 5);
...@@ -1600,19 +1626,8 @@ static struct adt7475_data *adt7475_update_device(struct device *dev) ...@@ -1600,19 +1626,8 @@ static struct adt7475_data *adt7475_update_device(struct device *dev)
return data; return data;
} }
static int __init sensors_adt7475_init(void) module_i2c_driver(adt7475_driver);
{
return i2c_add_driver(&adt7475_driver);
}
static void __exit sensors_adt7475_exit(void)
{
i2c_del_driver(&adt7475_driver);
}
MODULE_AUTHOR("Advanced Micro Devices, Inc"); MODULE_AUTHOR("Advanced Micro Devices, Inc");
MODULE_DESCRIPTION("adt7475 driver"); MODULE_DESCRIPTION("adt7475 driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(sensors_adt7475_init);
module_exit(sensors_adt7475_exit);
/* /*
amc6821.c - Part of lm_sensors, Linux kernel modules for hardware * amc6821.c - Part of lm_sensors, Linux kernel modules for hardware
monitoring * monitoring
Copyright (C) 2009 T. Mertelj <tomaz.mertelj@guest.arnes.si> * Copyright (C) 2009 T. Mertelj <tomaz.mertelj@guest.arnes.si>
*
Based on max6650.c: * Based on max6650.c:
Copyright (C) 2007 Hans J. Koch <hjk@hansjkoch.de> * Copyright (C) 2007 Hans J. Koch <hjk@hansjkoch.de>
*
This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. * (at your option) any later version.
*
This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. * GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/kernel.h> /* Needed for KERN_INFO */ #include <linux/kernel.h> /* Needed for KERN_INFO */
...@@ -47,7 +47,7 @@ static const unsigned short normal_i2c[] = {0x18, 0x19, 0x1a, 0x2c, 0x2d, 0x2e, ...@@ -47,7 +47,7 @@ static const unsigned short normal_i2c[] = {0x18, 0x19, 0x1a, 0x2c, 0x2d, 0x2e,
* Insmod parameters * Insmod parameters
*/ */
static int pwminv = 0; /*Inverted PWM output. */ static int pwminv; /*Inverted PWM output. */
module_param(pwminv, int, S_IRUGO); module_param(pwminv, int, S_IRUGO);
static int init = 1; /*Power-on initialization.*/ static int init = 1; /*Power-on initialization.*/
...@@ -188,7 +188,7 @@ static struct i2c_driver amc6821_driver = { ...@@ -188,7 +188,7 @@ static struct i2c_driver amc6821_driver = {
/* /*
* Client data (each client gets its own) * Client data (each client gets its own)
*/ */
struct amc6821_data { struct amc6821_data {
struct device *hwmon_dev; struct device *hwmon_dev;
...@@ -836,8 +836,10 @@ static int amc6821_detect( ...@@ -836,8 +836,10 @@ static int amc6821_detect(
return -ENODEV; return -ENODEV;
} }
/* Bit 7 of the address register is ignored, so we can check the /*
ID registers again */ * Bit 7 of the address register is ignored, so we can check the
* ID registers again
*/
dev_id = i2c_smbus_read_byte_data(client, 0x80 | AMC6821_REG_DEV_ID); dev_id = i2c_smbus_read_byte_data(client, 0x80 | AMC6821_REG_DEV_ID);
comp_id = i2c_smbus_read_byte_data(client, 0x80 | AMC6821_REG_COMP_ID); comp_id = i2c_smbus_read_byte_data(client, 0x80 | AMC6821_REG_COMP_ID);
if (dev_id != 0x21 || comp_id != 0x49) { if (dev_id != 0x21 || comp_id != 0x49) {
...@@ -1080,9 +1082,10 @@ static struct amc6821_data *amc6821_update_device(struct device *dev) ...@@ -1080,9 +1082,10 @@ static struct amc6821_data *amc6821_update_device(struct device *dev)
data->pwm1_auto_channels_temp = 3; data->pwm1_auto_channels_temp = 3;
data->pwm1_enable = 3; data->pwm1_enable = 3;
break; break;
case 1: /*semi-open loop: software sets rpm, chip controls pwm1, case 1: /*
*currently not implemented * semi-open loop: software sets rpm, chip controls
*/ * pwm1, currently not implemented
*/
data->pwm1_auto_channels_temp = 0; data->pwm1_auto_channels_temp = 0;
data->pwm1_enable = 0; data->pwm1_enable = 0;
break; break;
...@@ -1095,20 +1098,7 @@ static struct amc6821_data *amc6821_update_device(struct device *dev) ...@@ -1095,20 +1098,7 @@ static struct amc6821_data *amc6821_update_device(struct device *dev)
return data; return data;
} }
module_i2c_driver(amc6821_driver);
static int __init amc6821_init(void)
{
return i2c_add_driver(&amc6821_driver);
}
static void __exit amc6821_exit(void)
{
i2c_del_driver(&amc6821_driver);
}
module_init(amc6821_init);
module_exit(amc6821_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("T. Mertelj <tomaz.mertelj@guest.arnes.si>"); MODULE_AUTHOR("T. Mertelj <tomaz.mertelj@guest.arnes.si>");
......
...@@ -344,8 +344,10 @@ static int applesmc_get_lower_bound(unsigned int *lo, const char *key) ...@@ -344,8 +344,10 @@ static int applesmc_get_lower_bound(unsigned int *lo, const char *key)
while (begin != end) { while (begin != end) {
int middle = begin + (end - begin) / 2; int middle = begin + (end - begin) / 2;
entry = applesmc_get_entry_by_index(middle); entry = applesmc_get_entry_by_index(middle);
if (IS_ERR(entry)) if (IS_ERR(entry)) {
*lo = 0;
return PTR_ERR(entry); return PTR_ERR(entry);
}
if (strcmp(entry->key, key) < 0) if (strcmp(entry->key, key) < 0)
begin = middle + 1; begin = middle + 1;
else else
...@@ -364,8 +366,10 @@ static int applesmc_get_upper_bound(unsigned int *hi, const char *key) ...@@ -364,8 +366,10 @@ static int applesmc_get_upper_bound(unsigned int *hi, const char *key)
while (begin != end) { while (begin != end) {
int middle = begin + (end - begin) / 2; int middle = begin + (end - begin) / 2;
entry = applesmc_get_entry_by_index(middle); entry = applesmc_get_entry_by_index(middle);
if (IS_ERR(entry)) if (IS_ERR(entry)) {
*hi = smcreg.key_count;
return PTR_ERR(entry); return PTR_ERR(entry);
}
if (strcmp(key, entry->key) < 0) if (strcmp(key, entry->key) < 0)
end = middle; end = middle;
else else
...@@ -1189,8 +1193,10 @@ static int applesmc_dmi_match(const struct dmi_system_id *id) ...@@ -1189,8 +1193,10 @@ static int applesmc_dmi_match(const struct dmi_system_id *id)
return 1; return 1;
} }
/* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". /*
* So we need to put "Apple MacBook Pro" before "Apple MacBook". */ * Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
* So we need to put "Apple MacBook Pro" before "Apple MacBook".
*/
static __initdata struct dmi_system_id applesmc_whitelist[] = { static __initdata struct dmi_system_id applesmc_whitelist[] = {
{ applesmc_dmi_match, "Apple MacBook Air", { { applesmc_dmi_match, "Apple MacBook Air", {
DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
......
This diff is collapsed.
...@@ -268,9 +268,11 @@ static ssize_t store_fan16(struct device *dev, ...@@ -268,9 +268,11 @@ static ssize_t store_fan16(struct device *dev,
if (kstrtol(buf, 10, &reqval)) if (kstrtol(buf, 10, &reqval))
return -EINVAL; return -EINVAL;
/* If a minimum RPM of zero is requested, then we set the register to /*
0xffff. This value allows the fan to be stopped completely without * If a minimum RPM of zero is requested, then we set the register to
generating an alarm. */ * 0xffff. This value allows the fan to be stopped completely without
* generating an alarm.
*/
reqval = reqval =
(reqval <= 0 ? 0xffff : SENSORS_LIMIT(5400000 / reqval, 0, 0xfffe)); (reqval <= 0 ? 0xffff : SENSORS_LIMIT(5400000 / reqval, 0, 0xfffe));
......
...@@ -38,7 +38,8 @@ static const struct dmi_system_id __initconst atk_force_new_if[] = { ...@@ -38,7 +38,8 @@ static const struct dmi_system_id __initconst atk_force_new_if[] = {
{ } { }
}; };
/* Minimum time between readings, enforced in order to avoid /*
* Minimum time between readings, enforced in order to avoid
* hogging the CPU. * hogging the CPU.
*/ */
#define CACHE_TIME HZ #define CACHE_TIME HZ
...@@ -161,7 +162,8 @@ struct atk_sensor_data { ...@@ -161,7 +162,8 @@ struct atk_sensor_data {
char const *acpi_name; char const *acpi_name;
}; };
/* Return buffer format: /*
* Return buffer format:
* [0-3] "value" is valid flag * [0-3] "value" is valid flag
* [4-7] value * [4-7] value
* [8- ] unknown stuff on newer mobos * [8- ] unknown stuff on newer mobos
...@@ -310,7 +312,8 @@ static union acpi_object *atk_get_pack_member(struct atk_data *data, ...@@ -310,7 +312,8 @@ static union acpi_object *atk_get_pack_member(struct atk_data *data,
} }
/* New package format is: /*
* New package format is:
* - flag (int) * - flag (int)
* class - used for de-muxing the request to the correct GITn * class - used for de-muxing the request to the correct GITn
* type (volt, temp, fan) * type (volt, temp, fan)
...@@ -613,7 +616,8 @@ static int atk_read_value_new(struct atk_sensor_data *sensor, u64 *value) ...@@ -613,7 +616,8 @@ static int atk_read_value_new(struct atk_sensor_data *sensor, u64 *value)
buf = (struct atk_acpi_ret_buffer *)obj->buffer.pointer; buf = (struct atk_acpi_ret_buffer *)obj->buffer.pointer;
if (buf->flags == 0) { if (buf->flags == 0) {
/* The reading is not valid, possible causes: /*
* The reading is not valid, possible causes:
* - sensor failure * - sensor failure
* - enumeration was FUBAR (and we didn't notice) * - enumeration was FUBAR (and we didn't notice)
*/ */
...@@ -1311,14 +1315,16 @@ static int atk_probe_if(struct atk_data *data) ...@@ -1311,14 +1315,16 @@ static int atk_probe_if(struct atk_data *data)
dev_dbg(dev, "method " METHOD_WRITE " not found: %s\n", dev_dbg(dev, "method " METHOD_WRITE " not found: %s\n",
acpi_format_exception(status)); acpi_format_exception(status));
/* Check for hwmon methods: first check "old" style methods; note that /*
* Check for hwmon methods: first check "old" style methods; note that
* both may be present: in this case we stick to the old interface; * both may be present: in this case we stick to the old interface;
* analysis of multiple DSDTs indicates that when both interfaces * analysis of multiple DSDTs indicates that when both interfaces
* are present the new one (GGRP/GITM) is not functional. * are present the new one (GGRP/GITM) is not functional.
*/ */
if (new_if) if (new_if)
dev_info(dev, "Overriding interface detection\n"); dev_info(dev, "Overriding interface detection\n");
if (data->rtmp_handle && data->rvlt_handle && data->rfan_handle && !new_if) if (data->rtmp_handle &&
data->rvlt_handle && data->rfan_handle && !new_if)
data->old_interface = true; data->old_interface = true;
else if (data->enumerate_handle && data->read_handle && else if (data->enumerate_handle && data->read_handle &&
data->write_handle) data->write_handle)
......
This diff is collapsed.
...@@ -58,8 +58,8 @@ MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); ...@@ -58,8 +58,8 @@ MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius");
#define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1)
#define MAX_CORE_DATA (NUM_REAL_CORES + BASE_SYSFS_ATTR_NO) #define MAX_CORE_DATA (NUM_REAL_CORES + BASE_SYSFS_ATTR_NO)
#define TO_PHYS_ID(cpu) cpu_data(cpu).phys_proc_id #define TO_PHYS_ID(cpu) (cpu_data(cpu).phys_proc_id)
#define TO_CORE_ID(cpu) cpu_data(cpu).cpu_core_id #define TO_CORE_ID(cpu) (cpu_data(cpu).cpu_core_id)
#define TO_ATTR_NO(cpu) (TO_CORE_ID(cpu) + BASE_SYSFS_ATTR_NO) #define TO_ATTR_NO(cpu) (TO_CORE_ID(cpu) + BASE_SYSFS_ATTR_NO)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
......
This diff is collapsed.
/* /*
ds1621.c - Part of lm_sensors, Linux kernel modules for hardware * ds1621.c - Part of lm_sensors, Linux kernel modules for hardware
monitoring * monitoring
Christian W. Zuckschwerdt <zany@triq.net> 2000-11-23 * Christian W. Zuckschwerdt <zany@triq.net> 2000-11-23
based on lm75.c by Frodo Looijaard <frodol@dds.nl> * based on lm75.c by Frodo Looijaard <frodol@dds.nl>
Ported to Linux 2.6 by Aurelien Jarno <aurelien@aurel32.net> with * Ported to Linux 2.6 by Aurelien Jarno <aurelien@aurel32.net> with
the help of Jean Delvare <khali@linux-fr.org> * the help of Jean Delvare <khali@linux-fr.org>
*
This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. * (at your option) any later version.
*
This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. * GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -67,7 +67,7 @@ static const u8 DS1621_REG_TEMP[3] = { ...@@ -67,7 +67,7 @@ static const u8 DS1621_REG_TEMP[3] = {
/* Conversions */ /* Conversions */
#define ALARMS_FROM_REG(val) ((val) & \ #define ALARMS_FROM_REG(val) ((val) & \
(DS1621_ALARM_TEMP_HIGH | DS1621_ALARM_TEMP_LOW)) (DS1621_ALARM_TEMP_HIGH | DS1621_ALARM_TEMP_LOW))
/* Each client has this additional data */ /* Each client has this additional data */
struct ds1621_data { struct ds1621_data {
...@@ -93,10 +93,10 @@ static void ds1621_init_client(struct i2c_client *client) ...@@ -93,10 +93,10 @@ static void ds1621_init_client(struct i2c_client *client)
new_conf &= ~DS1621_REG_CONFIG_POLARITY; new_conf &= ~DS1621_REG_CONFIG_POLARITY;
else if (polarity == 1) else if (polarity == 1)
new_conf |= DS1621_REG_CONFIG_POLARITY; new_conf |= DS1621_REG_CONFIG_POLARITY;
if (conf != new_conf) if (conf != new_conf)
i2c_smbus_write_byte_data(client, DS1621_REG_CONF, new_conf); i2c_smbus_write_byte_data(client, DS1621_REG_CONF, new_conf);
/* start conversion */ /* start conversion */
i2c_smbus_write_byte(client, DS1621_COM_START); i2c_smbus_write_byte(client, DS1621_COM_START);
} }
...@@ -155,10 +155,15 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da, ...@@ -155,10 +155,15 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct ds1621_data *data = i2c_get_clientdata(client); struct ds1621_data *data = i2c_get_clientdata(client);
u16 val = LM75_TEMP_TO_REG(simple_strtol(buf, NULL, 10)); long val;
int err;
err = kstrtol(buf, 10, &val);
if (err)
return err;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
data->temp[attr->index] = val; data->temp[attr->index] = LM75_TEMP_TO_REG(val);
i2c_smbus_write_word_swapped(client, DS1621_REG_TEMP[attr->index], i2c_smbus_write_word_swapped(client, DS1621_REG_TEMP[attr->index],
data->temp[attr->index]); data->temp[attr->index]);
mutex_unlock(&data->update_lock); mutex_unlock(&data->update_lock);
...@@ -212,14 +217,17 @@ static int ds1621_detect(struct i2c_client *client, ...@@ -212,14 +217,17 @@ static int ds1621_detect(struct i2c_client *client,
int conf, temp; int conf, temp;
int i; int i;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA
| I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_WORD_DATA
| I2C_FUNC_SMBUS_WRITE_BYTE)) | I2C_FUNC_SMBUS_WRITE_BYTE))
return -ENODEV; return -ENODEV;
/* Now, we do the remaining detection. It is lousy. */ /*
/* The NVB bit should be low if no EEPROM write has been requested * Now, we do the remaining detection. It is lousy.
during the latest 10ms, which is highly improbable in our case. */ *
* The NVB bit should be low if no EEPROM write has been requested
* during the latest 10ms, which is highly improbable in our case.
*/
conf = i2c_smbus_read_byte_data(client, DS1621_REG_CONF); conf = i2c_smbus_read_byte_data(client, DS1621_REG_CONF);
if (conf < 0 || conf & DS1621_REG_CONFIG_NVB) if (conf < 0 || conf & DS1621_REG_CONFIG_NVB)
return -ENODEV; return -ENODEV;
...@@ -254,7 +262,8 @@ static int ds1621_probe(struct i2c_client *client, ...@@ -254,7 +262,8 @@ static int ds1621_probe(struct i2c_client *client,
ds1621_init_client(client); ds1621_init_client(client);
/* Register sysfs hooks */ /* Register sysfs hooks */
if ((err = sysfs_create_group(&client->dev.kobj, &ds1621_group))) err = sysfs_create_group(&client->dev.kobj, &ds1621_group);
if (err)
goto exit_free; goto exit_free;
data->hwmon_dev = hwmon_device_register(&client->dev); data->hwmon_dev = hwmon_device_register(&client->dev);
...@@ -265,11 +274,11 @@ static int ds1621_probe(struct i2c_client *client, ...@@ -265,11 +274,11 @@ static int ds1621_probe(struct i2c_client *client,
return 0; return 0;
exit_remove_files: exit_remove_files:
sysfs_remove_group(&client->dev.kobj, &ds1621_group); sysfs_remove_group(&client->dev.kobj, &ds1621_group);
exit_free: exit_free:
kfree(data); kfree(data);
exit: exit:
return err; return err;
} }
...@@ -305,20 +314,8 @@ static struct i2c_driver ds1621_driver = { ...@@ -305,20 +314,8 @@ static struct i2c_driver ds1621_driver = {
.address_list = normal_i2c, .address_list = normal_i2c,
}; };
static int __init ds1621_init(void) module_i2c_driver(ds1621_driver);
{
return i2c_add_driver(&ds1621_driver);
}
static void __exit ds1621_exit(void)
{
i2c_del_driver(&ds1621_driver);
}
MODULE_AUTHOR("Christian W. Zuckschwerdt <zany@triq.net>"); MODULE_AUTHOR("Christian W. Zuckschwerdt <zany@triq.net>");
MODULE_DESCRIPTION("DS1621 driver"); MODULE_DESCRIPTION("DS1621 driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(ds1621_init);
module_exit(ds1621_exit);
...@@ -297,19 +297,8 @@ static struct i2c_driver ds620_driver = { ...@@ -297,19 +297,8 @@ static struct i2c_driver ds620_driver = {
.id_table = ds620_id, .id_table = ds620_id,
}; };
static int __init ds620_init(void) module_i2c_driver(ds620_driver);
{
return i2c_add_driver(&ds620_driver);
}
static void __exit ds620_exit(void)
{
i2c_del_driver(&ds620_driver);
}
MODULE_AUTHOR("Roland Stigge <stigge@antcom.de>"); MODULE_AUTHOR("Roland Stigge <stigge@antcom.de>");
MODULE_DESCRIPTION("DS620 driver"); MODULE_DESCRIPTION("DS620 driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(ds620_init);
module_exit(ds620_exit);
This diff is collapsed.
This diff is collapsed.
...@@ -552,17 +552,7 @@ static struct i2c_driver emc6w201_driver = { ...@@ -552,17 +552,7 @@ static struct i2c_driver emc6w201_driver = {
.address_list = normal_i2c, .address_list = normal_i2c,
}; };
static int __init sensors_emc6w201_init(void) module_i2c_driver(emc6w201_driver);
{
return i2c_add_driver(&emc6w201_driver);
}
module_init(sensors_emc6w201_init);
static void __exit sensors_emc6w201_exit(void)
{
i2c_del_driver(&emc6w201_driver);
}
module_exit(sensors_emc6w201_exit);
MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>"); MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>");
MODULE_DESCRIPTION("SMSC EMC6W201 hardware monitoring driver"); MODULE_DESCRIPTION("SMSC EMC6W201 hardware monitoring driver");
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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