Commit d7511ec8 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6

* 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6: (59 commits)
  hwmon: (lm80) Add individual alarm files
  hwmon: (lm80) De-macro the sysfs callbacks
  hwmon: (lm80) Various cleanups
  hwmon: (w83627hf) Refactor beep enable handling
  hwmon: (w83627hf) Add individual alarm and beep files
  hwmon: (w83627hf) Enable VBAT monitoring
  hwmon: (w83627ehf) The W83627DHG has 8 VID pins
  hwmon: (asb100) Add individual alarm files
  hwmon: (asb100) De-macro the sysfs callbacks
  hwmon: (asb100) Various cleanups
  hwmon: VRM is not written to registers
  hwmon: (dme1737) fix Super-IO device ID override
  hwmon: (dme1737) fix divide-by-0
  hwmon: (abituguru3) Add AUX4 fan input for Abit IP35 Pro
  hwmon: Add support for Texas Instruments/Burr-Brown ADS7828
  hwmon: (adm9240) Add individual alarm files
  hwmon: (lm77) Add individual alarm files
  hwmon: Discard useless I2C driver IDs
  hwmon: (lm85) Make the pwmN_enable files writable
  hwmon: (lm85) Return standard values in pwmN_enable
  ...
parents 0b61a2ba e84542f5
Kernel driver ads7828
=====================
Supported chips:
* Texas Instruments/Burr-Brown ADS7828
Prefix: 'ads7828'
Addresses scanned: I2C 0x48, 0x49, 0x4a, 0x4b
Datasheet: Publicly available at the Texas Instruments website :
http://focus.ti.com/lit/ds/symlink/ads7828.pdf
Authors:
Steve Hardy <steve@linuxrealtime.co.uk>
Module Parameters
-----------------
* se_input: bool (default Y)
Single ended operation - set to N for differential mode
* int_vref: bool (default Y)
Operate with the internal 2.5V reference - set to N for external reference
* vref_mv: int (default 2500)
If using an external reference, set this to the reference voltage in mV
Description
-----------
This driver implements support for the Texas Instruments ADS7828.
This device is a 12-bit 8-channel A-D converter.
It can operate in single ended mode (8 +ve inputs) or in differential mode,
where 4 differential pairs can be measured.
The chip also has the facility to use an external voltage reference. This
may be required if your hardware supplies the ADS7828 from a 5V supply, see
the datasheet for more details.
...@@ -30,7 +30,7 @@ Supported chips: ...@@ -30,7 +30,7 @@ Supported chips:
Datasheet: No longer be available Datasheet: No longer be available
Authors: Authors:
Christophe Gauthron <chrisg@0-in.com> Christophe Gauthron
Jean Delvare <khali@linux-fr.org> Jean Delvare <khali@linux-fr.org>
......
...@@ -4,12 +4,12 @@ Kernel driver lm78 ...@@ -4,12 +4,12 @@ Kernel driver lm78
Supported chips: Supported chips:
* National Semiconductor LM78 / LM78-J * National Semiconductor LM78 / LM78-J
Prefix: 'lm78' Prefix: 'lm78'
Addresses scanned: I2C 0x20 - 0x2f, ISA 0x290 (8 I/O ports) Addresses scanned: I2C 0x28 - 0x2f, ISA 0x290 (8 I/O ports)
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 LM79 * National Semiconductor LM79
Prefix: 'lm79' Prefix: 'lm79'
Addresses scanned: I2C 0x20 - 0x2f, ISA 0x290 (8 I/O ports) Addresses scanned: I2C 0x28 - 0x2f, ISA 0x290 (8 I/O ports)
Datasheet: Publicly available at the National Semiconductor website Datasheet: Publicly available at the National Semiconductor website
http://www.national.com/ http://www.national.com/
......
...@@ -4,8 +4,12 @@ Kernel driver lm87 ...@@ -4,8 +4,12 @@ Kernel driver lm87
Supported chips: Supported chips:
* National Semiconductor LM87 * National Semiconductor LM87
Prefix: 'lm87' Prefix: 'lm87'
Addresses scanned: I2C 0x2c - 0x2f Addresses scanned: I2C 0x2c - 0x2e
Datasheet: http://www.national.com/pf/LM/LM87.html Datasheet: http://www.national.com/pf/LM/LM87.html
* Analog Devices ADM1024
Prefix: 'adm1024'
Addresses scanned: I2C 0x2c - 0x2e
Datasheet: http://www.analog.com/en/prod/0,2877,ADM1024,00.html
Authors: Authors:
Frodo Looijaard <frodol@dds.nl>, Frodo Looijaard <frodol@dds.nl>,
...@@ -19,11 +23,12 @@ Authors: ...@@ -19,11 +23,12 @@ Authors:
Description Description
----------- -----------
This driver implements support for the National Semiconductor LM87. This driver implements support for the National Semiconductor LM87
and the Analog Devices ADM1024.
The LM87 implements up to three temperature sensors, up to two fan The LM87 implements up to three temperature sensors, up to two fan
rotation speed sensors, up to seven voltage sensors, alarms, and some rotation speed sensors, up to seven voltage sensors, alarms, and some
miscellaneous stuff. miscellaneous stuff. The ADM1024 is fully compatible.
Temperatures are measured in degrees Celsius. Each input has a high Temperatures are measured in degrees Celsius. Each input has a high
and low alarm settings. A high limit produces an alarm when the value and low alarm settings. A high limit produces an alarm when the value
......
...@@ -14,7 +14,7 @@ Lm-sensors ...@@ -14,7 +14,7 @@ Lm-sensors
Core set of utilities that will allow you to obtain health information, Core set of utilities that will allow you to obtain health information,
setup monitoring limits etc. You can get them on their homepage setup monitoring limits etc. You can get them on their homepage
http://www.lm-sensors.nu/ or as a package from your Linux distribution. http://www.lm-sensors.org/ or as a package from your Linux distribution.
If from website: If from website:
Get lm-sensors from project web site. Please note, you need only userspace Get lm-sensors from project web site. Please note, you need only userspace
......
...@@ -23,8 +23,9 @@ W83627DHG super I/O chips. We will refer to them collectively as Winbond chips. ...@@ -23,8 +23,9 @@ W83627DHG super I/O chips. We will refer to them collectively as Winbond chips.
The chips implement three temperature sensors, five fan rotation The chips implement three temperature sensors, five fan rotation
speed sensors, ten analog voltage sensors (only nine for the 627DHG), one speed sensors, ten analog voltage sensors (only nine for the 627DHG), one
VID (6 pins), alarms with beep warnings (control unimplemented), and VID (6 pins for the 627EHF/EHG, 8 pins for the 627DHG), alarms with beep
some automatic fan regulation strategies (plus manual fan control mode). warnings (control unimplemented), and some automatic fan regulation
strategies (plus manual fan control mode).
Temperatures are measured in degrees Celsius and measurement resolution is 1 Temperatures are measured in degrees Celsius and measurement resolution is 1
degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when
......
...@@ -73,5 +73,4 @@ doesn't help, you may just ignore the bogus VID reading with no harm done. ...@@ -73,5 +73,4 @@ doesn't help, you may just ignore the bogus VID reading with no harm done.
For further information on this driver see the w83781d driver documentation. For further information on this driver see the w83781d driver documentation.
[1] http://www2.lm-sensors.nu/~lm78/cvs/browse.cgi/lm_sensors2/doc/vid [1] http://www.lm-sensors.org/browser/lm-sensors/trunk/doc/vid
...@@ -4,20 +4,16 @@ Kernel driver w83781d ...@@ -4,20 +4,16 @@ Kernel driver w83781d
Supported chips: Supported chips:
* Winbond W83781D * Winbond W83781D
Prefix: 'w83781d' Prefix: 'w83781d'
Addresses scanned: I2C 0x20 - 0x2f, ISA 0x290 (8 I/O ports) Addresses scanned: I2C 0x28 - 0x2f, ISA 0x290 (8 I/O ports)
Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/w83781d.pdf Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/w83781d.pdf
* Winbond W83782D * Winbond W83782D
Prefix: 'w83782d' Prefix: 'w83782d'
Addresses scanned: I2C 0x20 - 0x2f, ISA 0x290 (8 I/O ports) Addresses scanned: I2C 0x28 - 0x2f, ISA 0x290 (8 I/O ports)
Datasheet: http://www.winbond.com/PDF/sheet/w83782d.pdf Datasheet: http://www.winbond.com/PDF/sheet/w83782d.pdf
* Winbond W83783S * Winbond W83783S
Prefix: 'w83783s' Prefix: 'w83783s'
Addresses scanned: I2C 0x2d Addresses scanned: I2C 0x2d
Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/w83783s.pdf Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/w83783s.pdf
* Winbond W83627HF
Prefix: 'w83627hf'
Addresses scanned: I2C 0x20 - 0x2f, ISA 0x290 (8 I/O ports)
Datasheet: http://www.winbond.com/PDF/sheet/w83627hf.pdf
* Asus AS99127F * Asus AS99127F
Prefix: 'as99127f' Prefix: 'as99127f'
Addresses scanned: I2C 0x28 - 0x2f Addresses scanned: I2C 0x28 - 0x2f
...@@ -50,20 +46,18 @@ force_subclients=bus,caddr,saddr,saddr ...@@ -50,20 +46,18 @@ force_subclients=bus,caddr,saddr,saddr
Description Description
----------- -----------
This driver implements support for the Winbond W83781D, W83782D, W83783S, This driver implements support for the Winbond W83781D, W83782D, W83783S
W83627HF chips, and the Asus AS99127F chips. We will refer to them chips, and the Asus AS99127F chips. We will refer to them collectively as
collectively as W8378* chips. W8378* chips.
There is quite some difference between these chips, but they are similar There is quite some difference between these chips, but they are similar
enough that it was sensible to put them together in one driver. enough that it was sensible to put them together in one driver.
The W83627HF chip is assumed to be identical to the ISA W83782D.
The Asus chips are similar to an I2C-only W83782D. The Asus chips are similar to an I2C-only W83782D.
Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
as99127f 7 3 0 3 0x31 0x12c3 yes no as99127f 7 3 0 3 0x31 0x12c3 yes no
as99127f rev.2 (type_name = as99127f) 0x31 0x5ca3 yes no as99127f rev.2 (type_name = as99127f) 0x31 0x5ca3 yes no
w83781d 7 3 0 3 0x10-1 0x5ca3 yes yes w83781d 7 3 0 3 0x10-1 0x5ca3 yes yes
w83627hf 9 3 2 3 0x21 0x5ca3 yes yes(LPC)
w83782d 9 3 2-4 3 0x30 0x5ca3 yes yes w83782d 9 3 2-4 3 0x30 0x5ca3 yes yes
w83783s 5-6 3 2 1-2 0x40 0x5ca3 yes no w83783s 5-6 3 2 1-2 0x40 0x5ca3 yes no
...@@ -143,9 +137,9 @@ Individual alarm and beep bits: ...@@ -143,9 +137,9 @@ Individual alarm and beep bits:
0x000400: in6 0x000400: in6
0x000800: fan3 0x000800: fan3
0x001000: chassis 0x001000: chassis
0x002000: temp3 (W83782D and W83627HF only) 0x002000: temp3 (W83782D only)
0x010000: in7 (W83782D and W83627HF only) 0x010000: in7 (W83782D only)
0x020000: in8 (W83782D and W83627HF only) 0x020000: in8 (W83782D only)
If an alarm triggers, it will remain triggered until the hardware register If an alarm triggers, it will remain triggered until the hardware register
is read at least once. This means that the cause for the alarm may is read at least once. This means that the cause for the alarm may
......
Kernel driver w83l786ng
=====================
Supported chips:
* Winbond W83L786NG/W83L786NR
Prefix: 'w83l786ng'
Addresses scanned: I2C 0x2e - 0x2f
Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/W83L786NRNG09.pdf
Author: Kevin Lo <kevlo@kevlo.org>
Module Parameters
-----------------
* reset boolean
(default 0)
Use 'reset=1' to reset the chip (via index 0x40, bit 7). The default
behavior is no chip reset to preserve BIOS settings
Description
-----------
This driver implements support for Winbond W83L786NG/W83L786NR chips.
The driver implements two temperature sensors, two fan rotation speed
sensors, and three voltage sensors.
Temperatures are measured in degrees Celsius and measurement resolution is 1
degC for temp1 and temp2.
Fan rotation speeds are reported in RPM (rotations per minute). Fan readings
readings can be divided by a programmable divider (1, 2, 4, 8, 16, 32, 64
or 128 for fan 1/2) to give the readings more range or accuracy.
Voltage sensors (also known as IN sensors) report their values in millivolts.
An alarm is triggered if the voltage has crossed a programmable minimum
or maximum limit.
/sys files
----------
pwm[1-2] - this file stores PWM duty cycle or DC value (fan speed) in range:
0 (stop) to 255 (full)
pwm[1-2]_enable - this file controls mode of fan/temperature control:
* 0 Manual Mode
* 1 Thermal Cruise
* 2 Smart Fan II
* 4 FAN_SET
pwm[1-2]_mode - Select PWM of DC mode
* 0 DC
* 1 PWM
tolerance[1-2] - Value in degrees of Celsius (degC) for +- T
...@@ -95,4 +95,4 @@ of all affected systems, so the only safe solution was to prevent access to ...@@ -95,4 +95,4 @@ of all affected systems, so the only safe solution was to prevent access to
the SMBus on all IBM systems (detected using DMI data.) the SMBus on all IBM systems (detected using DMI data.)
For additional information, read: For additional information, read:
http://www2.lm-sensors.nu/~lm78/cvs/lm_sensors2/README.thinkpad http://www.lm-sensors.org/browser/lm-sensors/trunk/README.thinkpad
...@@ -43,18 +43,12 @@ static char * __init dmi_string(const struct dmi_header *dm, u8 s) ...@@ -43,18 +43,12 @@ static char * __init dmi_string(const struct dmi_header *dm, u8 s)
* We have to be cautious here. We have seen BIOSes with DMI pointers * We have to be cautious here. We have seen BIOSes with DMI pointers
* pointing to completely the wrong place for example * pointing to completely the wrong place for example
*/ */
static int __init dmi_table(u32 base, int len, int num, static void dmi_table(u8 *buf, int len, int num,
void (*decode)(const struct dmi_header *)) void (*decode)(const struct dmi_header *))
{ {
u8 *buf, *data; u8 *data = buf;
int i = 0; int i = 0;
buf = dmi_ioremap(base, len);
if (buf == NULL)
return -1;
data = buf;
/* /*
* Stop when we see all the items the table claimed to have * Stop when we see all the items the table claimed to have
* OR we run off the end of the table (also happens) * OR we run off the end of the table (also happens)
...@@ -75,7 +69,23 @@ static int __init dmi_table(u32 base, int len, int num, ...@@ -75,7 +69,23 @@ static int __init dmi_table(u32 base, int len, int num,
data += 2; data += 2;
i++; i++;
} }
dmi_iounmap(buf, len); }
static u32 dmi_base;
static u16 dmi_len;
static u16 dmi_num;
static int __init dmi_walk_early(void (*decode)(const struct dmi_header *))
{
u8 *buf;
buf = dmi_ioremap(dmi_base, dmi_len);
if (buf == NULL)
return -1;
dmi_table(buf, dmi_len, dmi_num, decode);
dmi_iounmap(buf, dmi_len);
return 0; return 0;
} }
...@@ -291,9 +301,9 @@ static int __init dmi_present(const char __iomem *p) ...@@ -291,9 +301,9 @@ static int __init dmi_present(const char __iomem *p)
memcpy_fromio(buf, p, 15); memcpy_fromio(buf, p, 15);
if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) { if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) {
u16 num = (buf[13] << 8) | buf[12]; dmi_num = (buf[13] << 8) | buf[12];
u16 len = (buf[7] << 8) | buf[6]; dmi_len = (buf[7] << 8) | buf[6];
u32 base = (buf[11] << 24) | (buf[10] << 16) | dmi_base = (buf[11] << 24) | (buf[10] << 16) |
(buf[9] << 8) | buf[8]; (buf[9] << 8) | buf[8];
/* /*
...@@ -305,7 +315,7 @@ static int __init dmi_present(const char __iomem *p) ...@@ -305,7 +315,7 @@ static int __init dmi_present(const char __iomem *p)
buf[14] >> 4, buf[14] & 0xF); buf[14] >> 4, buf[14] & 0xF);
else else
printk(KERN_INFO "DMI present.\n"); printk(KERN_INFO "DMI present.\n");
if (dmi_table(base,len, num, dmi_decode) == 0) if (dmi_walk_early(dmi_decode) == 0)
return 0; return 0;
} }
return 1; return 1;
...@@ -489,3 +499,27 @@ int dmi_get_year(int field) ...@@ -489,3 +499,27 @@ int dmi_get_year(int field)
return year; return year;
} }
/**
* dmi_walk - Walk the DMI table and get called back for every record
* @decode: Callback function
*
* Returns -1 when the DMI table can't be reached, 0 on success.
*/
int dmi_walk(void (*decode)(const struct dmi_header *))
{
u8 *buf;
if (!dmi_available)
return -1;
buf = ioremap(dmi_base, dmi_len);
if (buf == NULL)
return -1;
dmi_table(buf, dmi_len, dmi_num, decode);
iounmap(buf);
return 0;
}
EXPORT_SYMBOL_GPL(dmi_walk);
...@@ -433,12 +433,12 @@ config SENSORS_LM85 ...@@ -433,12 +433,12 @@ config SENSORS_LM85
will be called lm85. will be called lm85.
config SENSORS_LM87 config SENSORS_LM87
tristate "National Semiconductor LM87" tristate "National Semiconductor LM87 and compatibles"
depends on I2C depends on I2C
select HWMON_VID select HWMON_VID
help help
If you say yes here you get support for National Semiconductor LM87 If you say yes here you get support for National Semiconductor LM87
sensor chips. and Analog Devices ADM1024 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 lm87. will be called lm87.
...@@ -588,6 +588,16 @@ config SENSORS_SMSC47B397 ...@@ -588,6 +588,16 @@ config SENSORS_SMSC47B397
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 smsc47b397. will be called smsc47b397.
config SENSORS_ADS7828
tristate "Texas Instruments ADS7828"
depends on I2C
help
If you say yes here you get support for Texas Instruments ADS7828
12-bit 8-channel ADC device.
This driver can also be built as a module. If so, the module
will be called ads7828.
config SENSORS_THMC50 config SENSORS_THMC50
tristate "Texas Instruments THMC50 / Analog Devices ADM1022" tristate "Texas Instruments THMC50 / Analog Devices ADM1022"
depends on I2C && EXPERIMENTAL depends on I2C && EXPERIMENTAL
...@@ -631,13 +641,13 @@ config SENSORS_VT8231 ...@@ -631,13 +641,13 @@ config SENSORS_VT8231
will be called vt8231. will be called vt8231.
config SENSORS_W83781D config SENSORS_W83781D
tristate "Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F" tristate "Winbond W83781D, W83782D, W83783S, Asus AS99127F"
depends on I2C depends on I2C
select HWMON_VID select HWMON_VID
help help
If you say yes here you get support for the Winbond W8378x series If you say yes here you get support for the Winbond W8378x series
of sensor chips: the W83781D, W83782D, W83783S and W83627HF, of sensor chips: the W83781D, W83782D and W83783S, and the similar
and the similar Asus AS99127F. Asus AS99127F.
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 w83781d. will be called w83781d.
...@@ -683,6 +693,16 @@ config SENSORS_W83L785TS ...@@ -683,6 +693,16 @@ config SENSORS_W83L785TS
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 w83l785ts. will be called w83l785ts.
config SENSORS_W83L786NG
tristate "Winbond W83L786NG, W83L786NR"
depends on I2C && EXPERIMENTAL
help
If you say yes here you get support for the Winbond W83L786NG
and W83L786NR sensor chips.
This driver can also be built as a module. If so, the module
will be called w83l786ng.
config SENSORS_W83627HF config SENSORS_W83627HF
tristate "Winbond W83627HF, W83627THF, W83637HF, W83687THF, W83697HF" tristate "Winbond W83627HF, W83627THF, W83637HF, W83687THF, W83697HF"
select HWMON_VID select HWMON_VID
......
...@@ -22,6 +22,7 @@ obj-$(CONFIG_SENSORS_ADM1026) += adm1026.o ...@@ -22,6 +22,7 @@ obj-$(CONFIG_SENSORS_ADM1026) += adm1026.o
obj-$(CONFIG_SENSORS_ADM1029) += adm1029.o obj-$(CONFIG_SENSORS_ADM1029) += adm1029.o
obj-$(CONFIG_SENSORS_ADM1031) += adm1031.o obj-$(CONFIG_SENSORS_ADM1031) += adm1031.o
obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o
obj-$(CONFIG_SENSORS_ADS7828) += ads7828.o
obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o
obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o
obj-$(CONFIG_SENSORS_AMS) += ams/ obj-$(CONFIG_SENSORS_AMS) += ams/
...@@ -68,6 +69,7 @@ obj-$(CONFIG_SENSORS_VT1211) += vt1211.o ...@@ -68,6 +69,7 @@ obj-$(CONFIG_SENSORS_VT1211) += vt1211.o
obj-$(CONFIG_SENSORS_VT8231) += vt8231.o obj-$(CONFIG_SENSORS_VT8231) += vt8231.o
obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o
obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o
obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o
ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y) ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
EXTRA_CFLAGS += -DDEBUG EXTRA_CFLAGS += -DDEBUG
......
...@@ -528,6 +528,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { ...@@ -528,6 +528,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
{ "AUX1 Fan", 33, 2, 60, 1, 0 }, { "AUX1 Fan", 33, 2, 60, 1, 0 },
{ "AUX2 Fan", 35, 2, 60, 1, 0 }, { "AUX2 Fan", 35, 2, 60, 1, 0 },
{ "AUX3 Fan", 36, 2, 60, 1, 0 }, { "AUX3 Fan", 36, 2, 60, 1, 0 },
{ "AUX4 Fan", 37, 2, 60, 1, 0 },
{ NULL, 0, 0, 0, 0, 0 } } { NULL, 0, 0, 0, 0, 0 } }
}, },
{ 0x001B, "unknown", { { 0x001B, "unknown", {
......
...@@ -115,7 +115,6 @@ static struct i2c_driver adm1021_driver = { ...@@ -115,7 +115,6 @@ static struct i2c_driver adm1021_driver = {
.driver = { .driver = {
.name = "adm1021", .name = "adm1021",
}, },
.id = I2C_DRIVERID_ADM1021,
.attach_adapter = adm1021_attach_adapter, .attach_adapter = adm1021_attach_adapter,
.detach_client = adm1021_detach_client, .detach_client = adm1021_detach_client,
}; };
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -141,7 +141,6 @@ static struct i2c_driver adm9240_driver = { ...@@ -141,7 +141,6 @@ static struct i2c_driver adm9240_driver = {
.driver = { .driver = {
.name = "adm9240", .name = "adm9240",
}, },
.id = I2C_DRIVERID_ADM9240,
.attach_adapter = adm9240_attach_adapter, .attach_adapter = adm9240_attach_adapter,
.detach_client = adm9240_detach_client, .detach_client = adm9240_detach_client,
}; };
...@@ -415,6 +414,23 @@ static ssize_t show_alarms(struct device *dev, ...@@ -415,6 +414,23 @@ static ssize_t show_alarms(struct device *dev,
} }
static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
static ssize_t show_alarm(struct device *dev,
struct device_attribute *attr, char *buf)
{
int bitnr = to_sensor_dev_attr(attr)->index;
struct adm9240_data *data = adm9240_update_device(dev);
return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
}
static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0);
static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1);
static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2);
static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3);
static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 8);
static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 9);
static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4);
static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6);
static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7);
/* vid */ /* vid */
static ssize_t show_vid(struct device *dev, static ssize_t show_vid(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
...@@ -469,30 +485,39 @@ static struct attribute *adm9240_attributes[] = { ...@@ -469,30 +485,39 @@ static struct attribute *adm9240_attributes[] = {
&sensor_dev_attr_in0_input.dev_attr.attr, &sensor_dev_attr_in0_input.dev_attr.attr,
&sensor_dev_attr_in0_min.dev_attr.attr, &sensor_dev_attr_in0_min.dev_attr.attr,
&sensor_dev_attr_in0_max.dev_attr.attr, &sensor_dev_attr_in0_max.dev_attr.attr,
&sensor_dev_attr_in0_alarm.dev_attr.attr,
&sensor_dev_attr_in1_input.dev_attr.attr, &sensor_dev_attr_in1_input.dev_attr.attr,
&sensor_dev_attr_in1_min.dev_attr.attr, &sensor_dev_attr_in1_min.dev_attr.attr,
&sensor_dev_attr_in1_max.dev_attr.attr, &sensor_dev_attr_in1_max.dev_attr.attr,
&sensor_dev_attr_in1_alarm.dev_attr.attr,
&sensor_dev_attr_in2_input.dev_attr.attr, &sensor_dev_attr_in2_input.dev_attr.attr,
&sensor_dev_attr_in2_min.dev_attr.attr, &sensor_dev_attr_in2_min.dev_attr.attr,
&sensor_dev_attr_in2_max.dev_attr.attr, &sensor_dev_attr_in2_max.dev_attr.attr,
&sensor_dev_attr_in2_alarm.dev_attr.attr,
&sensor_dev_attr_in3_input.dev_attr.attr, &sensor_dev_attr_in3_input.dev_attr.attr,
&sensor_dev_attr_in3_min.dev_attr.attr, &sensor_dev_attr_in3_min.dev_attr.attr,
&sensor_dev_attr_in3_max.dev_attr.attr, &sensor_dev_attr_in3_max.dev_attr.attr,
&sensor_dev_attr_in3_alarm.dev_attr.attr,
&sensor_dev_attr_in4_input.dev_attr.attr, &sensor_dev_attr_in4_input.dev_attr.attr,
&sensor_dev_attr_in4_min.dev_attr.attr, &sensor_dev_attr_in4_min.dev_attr.attr,
&sensor_dev_attr_in4_max.dev_attr.attr, &sensor_dev_attr_in4_max.dev_attr.attr,
&sensor_dev_attr_in4_alarm.dev_attr.attr,
&sensor_dev_attr_in5_input.dev_attr.attr, &sensor_dev_attr_in5_input.dev_attr.attr,
&sensor_dev_attr_in5_min.dev_attr.attr, &sensor_dev_attr_in5_min.dev_attr.attr,
&sensor_dev_attr_in5_max.dev_attr.attr, &sensor_dev_attr_in5_max.dev_attr.attr,
&sensor_dev_attr_in5_alarm.dev_attr.attr,
&dev_attr_temp1_input.attr, &dev_attr_temp1_input.attr,
&sensor_dev_attr_temp1_max.dev_attr.attr, &sensor_dev_attr_temp1_max.dev_attr.attr,
&sensor_dev_attr_temp1_max_hyst.dev_attr.attr, &sensor_dev_attr_temp1_max_hyst.dev_attr.attr,
&sensor_dev_attr_temp1_alarm.dev_attr.attr,
&sensor_dev_attr_fan1_input.dev_attr.attr, &sensor_dev_attr_fan1_input.dev_attr.attr,
&sensor_dev_attr_fan1_div.dev_attr.attr, &sensor_dev_attr_fan1_div.dev_attr.attr,
&sensor_dev_attr_fan1_min.dev_attr.attr, &sensor_dev_attr_fan1_min.dev_attr.attr,
&sensor_dev_attr_fan1_alarm.dev_attr.attr,
&sensor_dev_attr_fan2_input.dev_attr.attr, &sensor_dev_attr_fan2_input.dev_attr.attr,
&sensor_dev_attr_fan2_div.dev_attr.attr, &sensor_dev_attr_fan2_div.dev_attr.attr,
&sensor_dev_attr_fan2_min.dev_attr.attr, &sensor_dev_attr_fan2_min.dev_attr.attr,
&sensor_dev_attr_fan2_alarm.dev_attr.attr,
&dev_attr_alarms.attr, &dev_attr_alarms.attr,
&dev_attr_aout_output.attr, &dev_attr_aout_output.attr,
&dev_attr_chassis_clear.attr, &dev_attr_chassis_clear.attr,
......
/*
ads7828.c - lm_sensors driver for ads7828 12-bit 8-channel ADC
(C) 2007 EADS Astrium
This driver is based on the lm75 and other lm_sensors/hwmon drivers
Written by Steve Hardy <steve@linuxrealtime.co.uk>
Datasheet available at: http://focus.ti.com/lit/ds/symlink/ads7828.pdf
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
/* The ADS7828 registers */
#define ADS7828_NCH 8 /* 8 channels of 12-bit A-D supported */
#define ADS7828_CMD_SD_SE 0x80 /* Single ended inputs */
#define ADS7828_CMD_SD_DIFF 0x00 /* Differential inputs */
#define ADS7828_CMD_PD0 0x0 /* Power Down between A-D conversions */
#define ADS7828_CMD_PD1 0x04 /* Internal ref OFF && A-D ON */
#define ADS7828_CMD_PD2 0x08 /* Internal ref ON && A-D OFF */
#define ADS7828_CMD_PD3 0x0C /* Internal ref ON && A-D ON */
#define ADS7828_INT_VREF_MV 2500 /* Internal vref is 2.5V, 2500mV */
/* Addresses to scan */
static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b,
I2C_CLIENT_END };
/* Insmod parameters */
I2C_CLIENT_INSMOD_1(ads7828);
/* Other module parameters */
static int se_input = 1; /* Default is SE, 0 == diff */
static int int_vref = 1; /* Default is internal ref ON */
static int vref_mv = ADS7828_INT_VREF_MV; /* set if vref != 2.5V */
module_param(se_input, bool, S_IRUGO);
module_param(int_vref, bool, S_IRUGO);
module_param(vref_mv, int, S_IRUGO);
/* Global Variables */
static u8 ads7828_cmd_byte; /* cmd byte without channel bits */
static unsigned int ads7828_lsb_resol; /* resolution of the ADC sample lsb */
/* Each client has this additional data */
struct ads7828_data {
struct i2c_client client;
struct device *hwmon_dev;
struct mutex update_lock; /* mutex protect updates */
char valid; /* !=0 if following fields are valid */
unsigned long last_updated; /* In jiffies */
u16 adc_input[ADS7828_NCH]; /* ADS7828_NCH 12-bit samples */
};
/* Function declaration - necessary due to function dependencies */
static int ads7828_detect(struct i2c_adapter *adapter, int address, int kind);
/* The ADS7828 returns the 12-bit sample in two bytes,
these are read as a word then byte-swapped */
static u16 ads7828_read_value(struct i2c_client *client, u8 reg)
{
return swab16(i2c_smbus_read_word_data(client, reg));
}
static inline u8 channel_cmd_byte(int ch)
{
/* cmd byte C2,C1,C0 - see datasheet */
u8 cmd = (((ch>>1) | (ch&0x01)<<2)<<4);
cmd |= ads7828_cmd_byte;
return cmd;
}
/* Update data for the device (all 8 channels) */
static struct ads7828_data *ads7828_update_device(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct ads7828_data *data = i2c_get_clientdata(client);
mutex_lock(&data->update_lock);
if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
|| !data->valid) {
unsigned int ch;
dev_dbg(&client->dev, "Starting ads7828 update\n");
for (ch = 0; ch < ADS7828_NCH; ch++) {
u8 cmd = channel_cmd_byte(ch);
data->adc_input[ch] = ads7828_read_value(client, cmd);
}
data->last_updated = jiffies;
data->valid = 1;
}
mutex_unlock(&data->update_lock);
return data;
}
/* sysfs callback function */
static ssize_t show_in(struct device *dev, struct device_attribute *da,
char *buf)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct ads7828_data *data = ads7828_update_device(dev);
/* Print value (in mV as specified in sysfs-interface documentation) */
return sprintf(buf, "%d\n", (data->adc_input[attr->index] *
ads7828_lsb_resol)/1000);
}
#define in_reg(offset)\
static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in,\
NULL, offset)
in_reg(0);
in_reg(1);
in_reg(2);
in_reg(3);
in_reg(4);
in_reg(5);
in_reg(6);
in_reg(7);
static struct attribute *ads7828_attributes[] = {
&sensor_dev_attr_in0_input.dev_attr.attr,
&sensor_dev_attr_in1_input.dev_attr.attr,
&sensor_dev_attr_in2_input.dev_attr.attr,
&sensor_dev_attr_in3_input.dev_attr.attr,
&sensor_dev_attr_in4_input.dev_attr.attr,
&sensor_dev_attr_in5_input.dev_attr.attr,
&sensor_dev_attr_in6_input.dev_attr.attr,
&sensor_dev_attr_in7_input.dev_attr.attr,
NULL
};
static const struct attribute_group ads7828_group = {
.attrs = ads7828_attributes,
};
static int ads7828_attach_adapter(struct i2c_adapter *adapter)
{
if (!(adapter->class & I2C_CLASS_HWMON))
return 0;
return i2c_probe(adapter, &addr_data, ads7828_detect);
}
static int ads7828_detach_client(struct i2c_client *client)
{
struct ads7828_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &ads7828_group);
i2c_detach_client(client);
kfree(i2c_get_clientdata(client));
return 0;
}
/* This is the driver that will be inserted */
static struct i2c_driver ads7828_driver = {
.driver = {
.name = "ads7828",
},
.attach_adapter = ads7828_attach_adapter,
.detach_client = ads7828_detach_client,
};
/* This function is called by i2c_probe */
static int ads7828_detect(struct i2c_adapter *adapter, int address, int kind)
{
struct i2c_client *client;
struct ads7828_data *data;
int err = 0;
const char *name = "";
/* Check we have a valid client */
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_WORD_DATA))
goto exit;
/* OK. For now, we presume we have a valid client. We now create the
client structure, even though we cannot fill it completely yet.
But it allows us to access ads7828_read_value. */
data = kzalloc(sizeof(struct ads7828_data), GFP_KERNEL);
if (!data) {
err = -ENOMEM;
goto exit;
}
client = &data->client;
i2c_set_clientdata(client, data);
client->addr = address;
client->adapter = adapter;
client->driver = &ads7828_driver;
/* Now, we do the remaining detection. There is no identification
dedicated register so attempt to sanity check using knowledge of
the chip
- Read from the 8 channel addresses
- Check the top 4 bits of each result are not set (12 data bits)
*/
if (kind < 0) {
int ch;
for (ch = 0; ch < ADS7828_NCH; ch++) {
u16 in_data;
u8 cmd = channel_cmd_byte(ch);
in_data = ads7828_read_value(client, cmd);
if (in_data & 0xF000) {
printk(KERN_DEBUG
"%s : Doesn't look like an ads7828 device\n",
__FUNCTION__);
goto exit_free;
}
}
}
/* Determine the chip type - only one kind supported! */
if (kind <= 0)
kind = ads7828;
if (kind == ads7828)
name = "ads7828";
/* Fill in the remaining client fields, put it into the global list */
strlcpy(client->name, name, I2C_NAME_SIZE);
mutex_init(&data->update_lock);
/* Tell the I2C layer a new client has arrived */
err = i2c_attach_client(client);
if (err)
goto exit_free;
/* Register sysfs hooks */
err = sysfs_create_group(&client->dev.kobj, &ads7828_group);
if (err)
goto exit_detach;
data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
goto exit_remove;
}
return 0;
exit_remove:
sysfs_remove_group(&client->dev.kobj, &ads7828_group);
exit_detach:
i2c_detach_client(client);
exit_free:
kfree(data);
exit:
return err;
}
static int __init sensors_ads7828_init(void)
{
/* Initialize the command byte according to module parameters */
ads7828_cmd_byte = se_input ?
ADS7828_CMD_SD_SE : ADS7828_CMD_SD_DIFF;
ads7828_cmd_byte |= int_vref ?
ADS7828_CMD_PD3 : ADS7828_CMD_PD1;
/* Calculate the LSB resolution */
ads7828_lsb_resol = (vref_mv*1000)/4096;
return i2c_add_driver(&ads7828_driver);
}
static void __exit sensors_ads7828_exit(void)
{
i2c_del_driver(&ads7828_driver);
}
MODULE_AUTHOR("Steve Hardy <steve@linuxrealtime.co.uk>");
MODULE_DESCRIPTION("ADS7828 driver");
MODULE_LICENSE("GPL");
module_init(sensors_ads7828_init);
module_exit(sensors_ads7828_exit);
...@@ -48,7 +48,22 @@ I2C_CLIENT_INSMOD_1(adt7470); ...@@ -48,7 +48,22 @@ I2C_CLIENT_INSMOD_1(adt7470);
#define ADT7470_REG_CFG 0x40 #define ADT7470_REG_CFG 0x40
#define ADT7470_FSPD_MASK 0x04 #define ADT7470_FSPD_MASK 0x04
#define ADT7470_REG_ALARM1 0x41 #define ADT7470_REG_ALARM1 0x41
#define ADT7470_R1T_ALARM 0x01
#define ADT7470_R2T_ALARM 0x02
#define ADT7470_R3T_ALARM 0x04
#define ADT7470_R4T_ALARM 0x08
#define ADT7470_R5T_ALARM 0x10
#define ADT7470_R6T_ALARM 0x20
#define ADT7470_R7T_ALARM 0x40
#define ADT7470_OOL_ALARM 0x80
#define ADT7470_REG_ALARM2 0x42 #define ADT7470_REG_ALARM2 0x42
#define ADT7470_R8T_ALARM 0x01
#define ADT7470_R9T_ALARM 0x02
#define ADT7470_R10T_ALARM 0x04
#define ADT7470_FAN1_ALARM 0x10
#define ADT7470_FAN2_ALARM 0x20
#define ADT7470_FAN3_ALARM 0x40
#define ADT7470_FAN4_ALARM 0x80
#define ADT7470_REG_TEMP_LIMITS_BASE_ADDR 0x44 #define ADT7470_REG_TEMP_LIMITS_BASE_ADDR 0x44
#define ADT7470_REG_TEMP_LIMITS_MAX_ADDR 0x57 #define ADT7470_REG_TEMP_LIMITS_MAX_ADDR 0x57
#define ADT7470_REG_FAN_MIN_BASE_ADDR 0x58 #define ADT7470_REG_FAN_MIN_BASE_ADDR 0x58
...@@ -97,6 +112,8 @@ I2C_CLIENT_INSMOD_1(adt7470); ...@@ -97,6 +112,8 @@ I2C_CLIENT_INSMOD_1(adt7470);
#define ADT7470_REG_PWM_AUTO_TEMP(x) (ADT7470_REG_PWM_AUTO_TEMP_BASE_ADDR + \ #define ADT7470_REG_PWM_AUTO_TEMP(x) (ADT7470_REG_PWM_AUTO_TEMP_BASE_ADDR + \
((x) / 2)) ((x) / 2))
#define ALARM2(x) ((x) << 8)
#define ADT7470_VENDOR 0x41 #define ADT7470_VENDOR 0x41
#define ADT7470_DEVICE 0x70 #define ADT7470_DEVICE 0x70
/* datasheet only mentions a revision 2 */ /* datasheet only mentions a revision 2 */
...@@ -114,8 +131,6 @@ I2C_CLIENT_INSMOD_1(adt7470); ...@@ -114,8 +131,6 @@ I2C_CLIENT_INSMOD_1(adt7470);
/* sleep 1s while gathering temperature data */ /* sleep 1s while gathering temperature data */
#define TEMP_COLLECTION_TIME 1000 #define TEMP_COLLECTION_TIME 1000
#define power_of_2(x) (((x) & ((x) - 1)) == 0)
/* datasheet says to divide this number by the fan reading to get fan rpm */ /* datasheet says to divide this number by the fan reading to get fan rpm */
#define FAN_PERIOD_TO_RPM(x) ((90000 * 60) / (x)) #define FAN_PERIOD_TO_RPM(x) ((90000 * 60) / (x))
#define FAN_RPM_TO_PERIOD FAN_PERIOD_TO_RPM #define FAN_RPM_TO_PERIOD FAN_PERIOD_TO_RPM
...@@ -138,7 +153,8 @@ struct adt7470_data { ...@@ -138,7 +153,8 @@ struct adt7470_data {
u16 fan[ADT7470_FAN_COUNT]; u16 fan[ADT7470_FAN_COUNT];
u16 fan_min[ADT7470_FAN_COUNT]; u16 fan_min[ADT7470_FAN_COUNT];
u16 fan_max[ADT7470_FAN_COUNT]; u16 fan_max[ADT7470_FAN_COUNT];
u16 alarms, alarms_mask; u16 alarm;
u16 alarms_mask;
u8 force_pwm_max; u8 force_pwm_max;
u8 pwm[ADT7470_PWM_COUNT]; u8 pwm[ADT7470_PWM_COUNT];
u8 pwm_max[ADT7470_PWM_COUNT]; u8 pwm_max[ADT7470_PWM_COUNT];
...@@ -262,7 +278,10 @@ static struct adt7470_data *adt7470_update_device(struct device *dev) ...@@ -262,7 +278,10 @@ static struct adt7470_data *adt7470_update_device(struct device *dev)
else else
data->force_pwm_max = 0; data->force_pwm_max = 0;
data->alarms = adt7470_read_word_data(client, ADT7470_REG_ALARM1); data->alarm = i2c_smbus_read_byte_data(client, ADT7470_REG_ALARM1);
if (data->alarm & ADT7470_OOL_ALARM)
data->alarm |= ALARM2(i2c_smbus_read_byte_data(client,
ADT7470_REG_ALARM2));
data->alarms_mask = adt7470_read_word_data(client, data->alarms_mask = adt7470_read_word_data(client,
ADT7470_REG_ALARM1_MASK); ADT7470_REG_ALARM1_MASK);
...@@ -370,17 +389,13 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, ...@@ -370,17 +389,13 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
return sprintf(buf, "%d\n", 1000 * data->temp[attr->index]); return sprintf(buf, "%d\n", 1000 * data->temp[attr->index]);
} }
static ssize_t show_alarms(struct device *dev, static ssize_t show_alarm_mask(struct device *dev,
struct device_attribute *devattr, struct device_attribute *devattr,
char *buf) char *buf)
{ {
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct adt7470_data *data = adt7470_update_device(dev); struct adt7470_data *data = adt7470_update_device(dev);
if (attr->index) return sprintf(buf, "%x\n", data->alarms_mask);
return sprintf(buf, "%x\n", data->alarms);
else
return sprintf(buf, "%x\n", data->alarms_mask);
} }
static ssize_t show_fan_max(struct device *dev, static ssize_t show_fan_max(struct device *dev,
...@@ -677,7 +692,7 @@ static int cvt_auto_temp(int input) ...@@ -677,7 +692,7 @@ static int cvt_auto_temp(int input)
{ {
if (input == ADT7470_PWM_ALL_TEMPS) if (input == ADT7470_PWM_ALL_TEMPS)
return 0; return 0;
if (input < 1 || !power_of_2(input)) if (input < 1 || !is_power_of_2(input))
return -EINVAL; return -EINVAL;
return ilog2(input) + 1; return ilog2(input) + 1;
} }
...@@ -715,8 +730,20 @@ static ssize_t set_pwm_auto_temp(struct device *dev, ...@@ -715,8 +730,20 @@ static ssize_t set_pwm_auto_temp(struct device *dev,
return count; return count;
} }
static SENSOR_DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL, 0); static ssize_t show_alarm(struct device *dev,
static SENSOR_DEVICE_ATTR(alarm_mask, S_IRUGO, show_alarms, NULL, 1); struct device_attribute *devattr,
char *buf)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct adt7470_data *data = adt7470_update_device(dev);
if (data->alarm & attr->index)
return sprintf(buf, "1\n");
else
return sprintf(buf, "0\n");
}
static DEVICE_ATTR(alarm_mask, S_IRUGO, show_alarm_mask, NULL);
static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max, static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max,
set_temp_max, 0); set_temp_max, 0);
...@@ -771,6 +798,27 @@ static SENSOR_DEVICE_ATTR(temp8_input, S_IRUGO, show_temp, NULL, 7); ...@@ -771,6 +798,27 @@ static SENSOR_DEVICE_ATTR(temp8_input, S_IRUGO, show_temp, NULL, 7);
static SENSOR_DEVICE_ATTR(temp9_input, S_IRUGO, show_temp, NULL, 8); static SENSOR_DEVICE_ATTR(temp9_input, S_IRUGO, show_temp, NULL, 8);
static SENSOR_DEVICE_ATTR(temp10_input, S_IRUGO, show_temp, NULL, 9); static SENSOR_DEVICE_ATTR(temp10_input, S_IRUGO, show_temp, NULL, 9);
static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL,
ADT7470_R1T_ALARM);
static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL,
ADT7470_R2T_ALARM);
static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL,
ADT7470_R3T_ALARM);
static SENSOR_DEVICE_ATTR(temp4_alarm, S_IRUGO, show_alarm, NULL,
ADT7470_R4T_ALARM);
static SENSOR_DEVICE_ATTR(temp5_alarm, S_IRUGO, show_alarm, NULL,
ADT7470_R5T_ALARM);
static SENSOR_DEVICE_ATTR(temp6_alarm, S_IRUGO, show_alarm, NULL,
ADT7470_R6T_ALARM);
static SENSOR_DEVICE_ATTR(temp7_alarm, S_IRUGO, show_alarm, NULL,
ADT7470_R7T_ALARM);
static SENSOR_DEVICE_ATTR(temp8_alarm, S_IRUGO, show_alarm, NULL,
ALARM2(ADT7470_R8T_ALARM));
static SENSOR_DEVICE_ATTR(temp9_alarm, S_IRUGO, show_alarm, NULL,
ALARM2(ADT7470_R9T_ALARM));
static SENSOR_DEVICE_ATTR(temp10_alarm, S_IRUGO, show_alarm, NULL,
ALARM2(ADT7470_R10T_ALARM));
static SENSOR_DEVICE_ATTR(fan1_max, S_IWUSR | S_IRUGO, show_fan_max, static SENSOR_DEVICE_ATTR(fan1_max, S_IWUSR | S_IRUGO, show_fan_max,
set_fan_max, 0); set_fan_max, 0);
static SENSOR_DEVICE_ATTR(fan2_max, S_IWUSR | S_IRUGO, show_fan_max, static SENSOR_DEVICE_ATTR(fan2_max, S_IWUSR | S_IRUGO, show_fan_max,
...@@ -794,6 +842,15 @@ static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1); ...@@ -794,6 +842,15 @@ static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1);
static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2); static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2);
static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3); static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3);
static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL,
ALARM2(ADT7470_FAN1_ALARM));
static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL,
ALARM2(ADT7470_FAN2_ALARM));
static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL,
ALARM2(ADT7470_FAN3_ALARM));
static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_alarm, NULL,
ALARM2(ADT7470_FAN4_ALARM));
static SENSOR_DEVICE_ATTR(force_pwm_max, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR(force_pwm_max, S_IWUSR | S_IRUGO,
show_force_pwm_max, set_force_pwm_max, 0); show_force_pwm_max, set_force_pwm_max, 0);
...@@ -858,8 +915,7 @@ static SENSOR_DEVICE_ATTR(pwm4_auto_channels_temp, S_IWUSR | S_IRUGO, ...@@ -858,8 +915,7 @@ static SENSOR_DEVICE_ATTR(pwm4_auto_channels_temp, S_IWUSR | S_IRUGO,
static struct attribute *adt7470_attr[] = static struct attribute *adt7470_attr[] =
{ {
&sensor_dev_attr_alarms.dev_attr.attr, &dev_attr_alarm_mask.attr,
&sensor_dev_attr_alarm_mask.dev_attr.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,
...@@ -890,6 +946,16 @@ static struct attribute *adt7470_attr[] = ...@@ -890,6 +946,16 @@ static struct attribute *adt7470_attr[] =
&sensor_dev_attr_temp8_input.dev_attr.attr, &sensor_dev_attr_temp8_input.dev_attr.attr,
&sensor_dev_attr_temp9_input.dev_attr.attr, &sensor_dev_attr_temp9_input.dev_attr.attr,
&sensor_dev_attr_temp10_input.dev_attr.attr, &sensor_dev_attr_temp10_input.dev_attr.attr,
&sensor_dev_attr_temp1_alarm.dev_attr.attr,
&sensor_dev_attr_temp2_alarm.dev_attr.attr,
&sensor_dev_attr_temp3_alarm.dev_attr.attr,
&sensor_dev_attr_temp4_alarm.dev_attr.attr,
&sensor_dev_attr_temp5_alarm.dev_attr.attr,
&sensor_dev_attr_temp6_alarm.dev_attr.attr,
&sensor_dev_attr_temp7_alarm.dev_attr.attr,
&sensor_dev_attr_temp8_alarm.dev_attr.attr,
&sensor_dev_attr_temp9_alarm.dev_attr.attr,
&sensor_dev_attr_temp10_alarm.dev_attr.attr,
&sensor_dev_attr_fan1_max.dev_attr.attr, &sensor_dev_attr_fan1_max.dev_attr.attr,
&sensor_dev_attr_fan2_max.dev_attr.attr, &sensor_dev_attr_fan2_max.dev_attr.attr,
&sensor_dev_attr_fan3_max.dev_attr.attr, &sensor_dev_attr_fan3_max.dev_attr.attr,
...@@ -902,6 +968,10 @@ static struct attribute *adt7470_attr[] = ...@@ -902,6 +968,10 @@ static struct attribute *adt7470_attr[] =
&sensor_dev_attr_fan2_input.dev_attr.attr, &sensor_dev_attr_fan2_input.dev_attr.attr,
&sensor_dev_attr_fan3_input.dev_attr.attr, &sensor_dev_attr_fan3_input.dev_attr.attr,
&sensor_dev_attr_fan4_input.dev_attr.attr, &sensor_dev_attr_fan4_input.dev_attr.attr,
&sensor_dev_attr_fan1_alarm.dev_attr.attr,
&sensor_dev_attr_fan2_alarm.dev_attr.attr,
&sensor_dev_attr_fan3_alarm.dev_attr.attr,
&sensor_dev_attr_fan4_alarm.dev_attr.attr,
&sensor_dev_attr_force_pwm_max.dev_attr.attr, &sensor_dev_attr_force_pwm_max.dev_attr.attr,
&sensor_dev_attr_pwm1.dev_attr.attr, &sensor_dev_attr_pwm1.dev_attr.attr,
&sensor_dev_attr_pwm2.dev_attr.attr, &sensor_dev_attr_pwm2.dev_attr.attr,
......
This diff is collapsed.
...@@ -44,6 +44,10 @@ static int force_start; ...@@ -44,6 +44,10 @@ static int force_start;
module_param(force_start, bool, 0); module_param(force_start, bool, 0);
MODULE_PARM_DESC(force_start, "Force the chip to start monitoring inputs"); MODULE_PARM_DESC(force_start, "Force the chip to start monitoring inputs");
static unsigned short force_id;
module_param(force_id, ushort, 0);
MODULE_PARM_DESC(force_id, "Override the detected device ID");
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END}; static unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END};
...@@ -279,14 +283,21 @@ static inline int TEMP_HYST_TO_REG(int val, int ix, int reg) ...@@ -279,14 +283,21 @@ static inline int TEMP_HYST_TO_REG(int val, int ix, int reg)
/* Fan input RPM */ /* Fan input RPM */
static inline int FAN_FROM_REG(int reg, int tpc) static inline int FAN_FROM_REG(int reg, int tpc)
{ {
return (reg == 0 || reg == 0xffff) ? 0 : if (tpc) {
(tpc == 0) ? 90000 * 60 / reg : tpc * reg; return tpc * reg;
} else {
return (reg == 0 || reg == 0xffff) ? 0 : 90000 * 60 / reg;
}
} }
static inline int FAN_TO_REG(int val, int tpc) static inline int FAN_TO_REG(int val, int tpc)
{ {
return SENSORS_LIMIT((tpc == 0) ? 90000 * 60 / val : val / tpc, if (tpc) {
0, 0xffff); return SENSORS_LIMIT(val / tpc, 0, 0xffff);
} else {
return (val <= 0) ? 0xffff :
SENSORS_LIMIT(90000 * 60 / val, 0, 0xfffe);
}
} }
/* Fan TPC (tach pulse count) /* Fan TPC (tach pulse count)
...@@ -2019,7 +2030,7 @@ static int dme1737_i2c_get_features(int sio_cip, struct dme1737_data *data) ...@@ -2019,7 +2030,7 @@ static int dme1737_i2c_get_features(int sio_cip, struct dme1737_data *data)
/* Check device ID /* Check device ID
* The DME1737 can return either 0x78 or 0x77 as its device ID. */ * The DME1737 can return either 0x78 or 0x77 as its device ID. */
reg = dme1737_sio_inb(sio_cip, 0x20); reg = force_id ? force_id : dme1737_sio_inb(sio_cip, 0x20);
if (!(reg == 0x77 || reg == 0x78)) { if (!(reg == 0x77 || reg == 0x78)) {
err = -ENODEV; err = -ENODEV;
goto exit; goto exit;
...@@ -2191,7 +2202,7 @@ static int __init dme1737_isa_detect(int sio_cip, unsigned short *addr) ...@@ -2191,7 +2202,7 @@ static int __init dme1737_isa_detect(int sio_cip, unsigned short *addr)
/* Check device ID /* Check device ID
* We currently know about SCH3112 (0x7c), SCH3114 (0x7d), and * We currently know about SCH3112 (0x7c), SCH3114 (0x7d), and
* SCH3116 (0x7f). */ * SCH3116 (0x7f). */
reg = dme1737_sio_inb(sio_cip, 0x20); reg = force_id ? force_id : dme1737_sio_inb(sio_cip, 0x20);
if (!(reg == 0x7c || reg == 0x7d || reg == 0x7f)) { if (!(reg == 0x7c || reg == 0x7d || reg == 0x7f)) {
err = -ENODEV; err = -ENODEV;
goto exit; goto exit;
......
...@@ -94,7 +94,6 @@ static struct i2c_driver ds1621_driver = { ...@@ -94,7 +94,6 @@ static struct i2c_driver ds1621_driver = {
.driver = { .driver = {
.name = "ds1621", .name = "ds1621",
}, },
.id = I2C_DRIVERID_DS1621,
.attach_adapter = ds1621_attach_adapter, .attach_adapter = ds1621_attach_adapter,
.detach_client = ds1621_detach_client, .detach_client = ds1621_detach_client,
}; };
......
...@@ -41,6 +41,10 @@ ...@@ -41,6 +41,10 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <asm/io.h> #include <asm/io.h>
static unsigned short force_id;
module_param(force_id, ushort, 0);
MODULE_PARM_DESC(force_id, "Override the detected device ID");
static struct platform_device *pdev; static struct platform_device *pdev;
#define DRVNAME "f71805f" #define DRVNAME "f71805f"
...@@ -1497,7 +1501,7 @@ static int __init f71805f_find(int sioaddr, unsigned short *address, ...@@ -1497,7 +1501,7 @@ static int __init f71805f_find(int sioaddr, unsigned short *address,
if (devid != SIO_FINTEK_ID) if (devid != SIO_FINTEK_ID)
goto exit; goto exit;
devid = superio_inw(sioaddr, SIO_REG_DEVID); devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID);
switch (devid) { switch (devid) {
case SIO_F71805F_ID: case SIO_F71805F_ID:
sio_data->kind = f71805f; sio_data->kind = f71805f;
......
...@@ -74,6 +74,10 @@ ...@@ -74,6 +74,10 @@
#define FAN_MIN_DETECT 366 /* Lowest detectable fanspeed */ #define FAN_MIN_DETECT 366 /* Lowest detectable fanspeed */
static unsigned short force_id;
module_param(force_id, ushort, 0);
MODULE_PARM_DESC(force_id, "Override the detected device ID");
static struct platform_device *f71882fg_pdev = NULL; static struct platform_device *f71882fg_pdev = NULL;
/* Super-I/O Function prototypes */ /* Super-I/O Function prototypes */
...@@ -843,7 +847,7 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address) ...@@ -843,7 +847,7 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address)
goto exit; goto exit;
} }
devid = superio_inw(sioaddr, SIO_REG_DEVID); devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID);
if (devid != SIO_F71882_ID) { if (devid != SIO_F71882_ID) {
printk(KERN_INFO DRVNAME ": Unsupported Fintek device\n"); printk(KERN_INFO DRVNAME ": Unsupported Fintek device\n");
goto exit; goto exit;
......
...@@ -123,7 +123,6 @@ static struct i2c_driver fscher_driver = { ...@@ -123,7 +123,6 @@ static struct i2c_driver fscher_driver = {
.driver = { .driver = {
.name = "fscher", .name = "fscher",
}, },
.id = I2C_DRIVERID_FSCHER,
.attach_adapter = fscher_attach_adapter, .attach_adapter = fscher_attach_adapter,
.detach_client = fscher_detach_client, .detach_client = fscher_detach_client,
}; };
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
#include <linux/dmi.h>
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; static unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END };
...@@ -133,7 +134,7 @@ static const u8 FSCHMD_REG_TEMP_STATE[5][5] = { ...@@ -133,7 +134,7 @@ static const u8 FSCHMD_REG_TEMP_STATE[5][5] = {
{ 0x71, 0x81, 0x91 }, /* her */ { 0x71, 0x81, 0x91 }, /* her */
{ 0x71, 0xd1, 0x81, 0x91 }, /* scy */ { 0x71, 0xd1, 0x81, 0x91 }, /* scy */
{ 0x71, 0x81, 0x91 }, /* hrc */ { 0x71, 0x81, 0x91 }, /* hrc */
{ 0x71, 0x81, 0x91, 0xd1, 0xe1 }, /* hmd */ { 0x71, 0x81, 0x91, 0xd1, 0xe1 }, /* hmd */
}; };
/* temperature high limit registers, FSC does not document these. Proven to be /* temperature high limit registers, FSC does not document these. Proven to be
...@@ -146,7 +147,7 @@ static const u8 FSCHMD_REG_TEMP_LIMIT[5][5] = { ...@@ -146,7 +147,7 @@ static const u8 FSCHMD_REG_TEMP_LIMIT[5][5] = {
{ 0x76, 0x86, 0x96 }, /* her */ { 0x76, 0x86, 0x96 }, /* her */
{ 0x76, 0xd6, 0x86, 0x96 }, /* scy */ { 0x76, 0xd6, 0x86, 0x96 }, /* scy */
{ 0x76, 0x86, 0x96 }, /* hrc */ { 0x76, 0x86, 0x96 }, /* hrc */
{ 0x76, 0x86, 0x96, 0xd6, 0xe6 }, /* hmd */ { 0x76, 0x86, 0x96, 0xd6, 0xe6 }, /* hmd */
}; };
/* These were found through experimenting with an fscher, currently they are /* These were found through experimenting with an fscher, currently they are
...@@ -210,6 +211,13 @@ struct fschmd_data { ...@@ -210,6 +211,13 @@ struct fschmd_data {
u8 fan_ripple[6]; /* divider for rps */ u8 fan_ripple[6]; /* divider for rps */
}; };
/* Global variables to hold information read from special DMI tables, which are
available on FSC machines with an fscher or later chip. */
static int dmi_mult[3] = { 490, 200, 100 };
static int dmi_offset[3] = { 0, 0, 0 };
static int dmi_vref = -1;
/* /*
* Sysfs attr show / store functions * Sysfs attr show / store functions
*/ */
...@@ -221,8 +229,13 @@ static ssize_t show_in_value(struct device *dev, ...@@ -221,8 +229,13 @@ static ssize_t show_in_value(struct device *dev,
int index = to_sensor_dev_attr(devattr)->index; int index = to_sensor_dev_attr(devattr)->index;
struct fschmd_data *data = fschmd_update_device(dev); struct fschmd_data *data = fschmd_update_device(dev);
return sprintf(buf, "%d\n", (data->volt[index] * /* fscher / fschrc - 1 as data->kind is an array index, not a chips */
max_reading[index] + 128) / 255); if (data->kind == (fscher - 1) || data->kind >= (fschrc - 1))
return sprintf(buf, "%d\n", (data->volt[index] * dmi_vref *
dmi_mult[index]) / 255 + dmi_offset[index]);
else
return sprintf(buf, "%d\n", (data->volt[index] *
max_reading[index] + 128) / 255);
} }
...@@ -525,6 +538,68 @@ static struct sensor_device_attribute fschmd_fan_attr[] = { ...@@ -525,6 +538,68 @@ static struct sensor_device_attribute fschmd_fan_attr[] = {
* Real code * Real code
*/ */
/* DMI decode routine to read voltage scaling factors from special DMI tables,
which are available on FSC machines with an fscher or later chip. */
static void fschmd_dmi_decode(const struct dmi_header *header)
{
int i, mult[3] = { 0 }, offset[3] = { 0 }, vref = 0, found = 0;
/* dmi code ugliness, we get passed the address of the contents of
a complete DMI record, but in the form of a dmi_header pointer, in
reality this address holds header->length bytes of which the header
are the first 4 bytes */
u8 *dmi_data = (u8 *)header;
/* We are looking for OEM-specific type 185 */
if (header->type != 185)
return;
/* we are looking for what Siemens calls "subtype" 19, the subtype
is stored in byte 5 of the dmi block */
if (header->length < 5 || dmi_data[4] != 19)
return;
/* After the subtype comes 1 unknown byte and then blocks of 5 bytes,
consisting of what Siemens calls an "Entity" number, followed by
2 16-bit words in LSB first order */
for (i = 6; (i + 4) < header->length; i += 5) {
/* entity 1 - 3: voltage multiplier and offset */
if (dmi_data[i] >= 1 && dmi_data[i] <= 3) {
/* Our in sensors order and the DMI order differ */
const int shuffle[3] = { 1, 0, 2 };
int in = shuffle[dmi_data[i] - 1];
/* Check for twice the same entity */
if (found & (1 << in))
return;
mult[in] = dmi_data[i + 1] | (dmi_data[i + 2] << 8);
offset[in] = dmi_data[i + 3] | (dmi_data[i + 4] << 8);
found |= 1 << in;
}
/* entity 7: reference voltage */
if (dmi_data[i] == 7) {
/* Check for twice the same entity */
if (found & 0x08)
return;
vref = dmi_data[i + 1] | (dmi_data[i + 2] << 8);
found |= 0x08;
}
}
if (found == 0x0F) {
for (i = 0; i < 3; i++) {
dmi_mult[i] = mult[i] * 10;
dmi_offset[i] = offset[i] * 10;
}
dmi_vref = vref;
}
}
static int fschmd_detect(struct i2c_adapter *adapter, int address, int kind) static int fschmd_detect(struct i2c_adapter *adapter, int address, int kind)
{ {
struct i2c_client *client; struct i2c_client *client;
...@@ -586,6 +661,17 @@ static int fschmd_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -586,6 +661,17 @@ static int fschmd_detect(struct i2c_adapter *adapter, int address, int kind)
data->temp_max[2] = 50 + 128; data->temp_max[2] = 50 + 128;
} }
/* Read the special DMI table for fscher and newer chips */
if (kind == fscher || kind >= fschrc) {
dmi_walk(fschmd_dmi_decode);
if (dmi_vref == -1) {
printk(KERN_WARNING FSCHMD_NAME
": Couldn't get voltage scaling factors from "
"BIOS DMI table, using builtin defaults\n");
dmi_vref = 33;
}
}
/* i2c kind goes from 1-5, we want from 0-4 to address arrays */ /* i2c kind goes from 1-5, we want from 0-4 to address arrays */
data->kind = kind - 1; data->kind = kind - 1;
strlcpy(client->name, client_names[data->kind], I2C_NAME_SIZE); strlcpy(client->name, client_names[data->kind], I2C_NAME_SIZE);
......
...@@ -105,7 +105,6 @@ static struct i2c_driver fscpos_driver = { ...@@ -105,7 +105,6 @@ static struct i2c_driver fscpos_driver = {
.driver = { .driver = {
.name = "fscpos", .name = "fscpos",
}, },
.id = I2C_DRIVERID_FSCPOS,
.attach_adapter = fscpos_attach_adapter, .attach_adapter = fscpos_attach_adapter,
.detach_client = fscpos_detach_client, .detach_client = fscpos_detach_client,
}; };
......
This diff is collapsed.
This diff is collapsed.
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
IT8726F Super I/O chip w/LPC interface IT8726F Super I/O chip w/LPC interface
Sis950 A clone of the IT8705F Sis950 A clone of the IT8705F
Copyright (C) 2001 Chris Gauthron <chrisg@0-in.com> Copyright (C) 2001 Chris Gauthron
Copyright (C) 2005-2006 Jean Delvare <khali@linux-fr.org> Copyright (C) 2005-2007 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
...@@ -52,6 +52,10 @@ ...@@ -52,6 +52,10 @@
enum chips { it87, it8712, it8716, it8718 }; enum chips { it87, it8712, it8716, it8718 };
static unsigned short force_id;
module_param(force_id, ushort, 0);
MODULE_PARM_DESC(force_id, "Override the detected device ID");
static struct platform_device *pdev; static struct platform_device *pdev;
#define REG 0x2e /* The register to read/write */ #define REG 0x2e /* The register to read/write */
...@@ -776,6 +780,30 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch ...@@ -776,6 +780,30 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch
} }
static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
char *buf)
{
int bitnr = to_sensor_dev_attr(attr)->index;
struct it87_data *data = it87_update_device(dev);
return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
}
static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 8);
static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 9);
static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 10);
static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 11);
static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 12);
static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 13);
static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL, 14);
static SENSOR_DEVICE_ATTR(in7_alarm, S_IRUGO, show_alarm, NULL, 15);
static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 0);
static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 1);
static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL, 2);
static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_alarm, NULL, 3);
static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL, 6);
static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 16);
static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 17);
static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 18);
static ssize_t static ssize_t
show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf)
{ {
...@@ -837,6 +865,14 @@ static struct attribute *it87_attributes[] = { ...@@ -837,6 +865,14 @@ static struct attribute *it87_attributes[] = {
&sensor_dev_attr_in5_max.dev_attr.attr, &sensor_dev_attr_in5_max.dev_attr.attr,
&sensor_dev_attr_in6_max.dev_attr.attr, &sensor_dev_attr_in6_max.dev_attr.attr,
&sensor_dev_attr_in7_max.dev_attr.attr, &sensor_dev_attr_in7_max.dev_attr.attr,
&sensor_dev_attr_in0_alarm.dev_attr.attr,
&sensor_dev_attr_in1_alarm.dev_attr.attr,
&sensor_dev_attr_in2_alarm.dev_attr.attr,
&sensor_dev_attr_in3_alarm.dev_attr.attr,
&sensor_dev_attr_in4_alarm.dev_attr.attr,
&sensor_dev_attr_in5_alarm.dev_attr.attr,
&sensor_dev_attr_in6_alarm.dev_attr.attr,
&sensor_dev_attr_in7_alarm.dev_attr.attr,
&sensor_dev_attr_temp1_input.dev_attr.attr, &sensor_dev_attr_temp1_input.dev_attr.attr,
&sensor_dev_attr_temp2_input.dev_attr.attr, &sensor_dev_attr_temp2_input.dev_attr.attr,
...@@ -850,6 +886,9 @@ static struct attribute *it87_attributes[] = { ...@@ -850,6 +886,9 @@ static struct attribute *it87_attributes[] = {
&sensor_dev_attr_temp1_type.dev_attr.attr, &sensor_dev_attr_temp1_type.dev_attr.attr,
&sensor_dev_attr_temp2_type.dev_attr.attr, &sensor_dev_attr_temp2_type.dev_attr.attr,
&sensor_dev_attr_temp3_type.dev_attr.attr, &sensor_dev_attr_temp3_type.dev_attr.attr,
&sensor_dev_attr_temp1_alarm.dev_attr.attr,
&sensor_dev_attr_temp2_alarm.dev_attr.attr,
&sensor_dev_attr_temp3_alarm.dev_attr.attr,
&dev_attr_alarms.attr, &dev_attr_alarms.attr,
&dev_attr_name.attr, &dev_attr_name.attr,
...@@ -882,12 +921,21 @@ static struct attribute *it87_attributes_opt[] = { ...@@ -882,12 +921,21 @@ static struct attribute *it87_attributes_opt[] = {
&sensor_dev_attr_fan3_min.dev_attr.attr, &sensor_dev_attr_fan3_min.dev_attr.attr,
&sensor_dev_attr_fan3_div.dev_attr.attr, &sensor_dev_attr_fan3_div.dev_attr.attr,
&sensor_dev_attr_fan1_alarm.dev_attr.attr,
&sensor_dev_attr_fan2_alarm.dev_attr.attr,
&sensor_dev_attr_fan3_alarm.dev_attr.attr,
&sensor_dev_attr_fan4_alarm.dev_attr.attr,
&sensor_dev_attr_fan5_alarm.dev_attr.attr,
&sensor_dev_attr_pwm1_enable.dev_attr.attr, &sensor_dev_attr_pwm1_enable.dev_attr.attr,
&sensor_dev_attr_pwm2_enable.dev_attr.attr, &sensor_dev_attr_pwm2_enable.dev_attr.attr,
&sensor_dev_attr_pwm3_enable.dev_attr.attr, &sensor_dev_attr_pwm3_enable.dev_attr.attr,
&sensor_dev_attr_pwm1.dev_attr.attr, &sensor_dev_attr_pwm1.dev_attr.attr,
&sensor_dev_attr_pwm2.dev_attr.attr, &sensor_dev_attr_pwm2.dev_attr.attr,
&sensor_dev_attr_pwm3.dev_attr.attr, &sensor_dev_attr_pwm3.dev_attr.attr,
&dev_attr_pwm1_freq.attr,
&dev_attr_pwm2_freq.attr,
&dev_attr_pwm3_freq.attr,
&dev_attr_vrm.attr, &dev_attr_vrm.attr,
&dev_attr_cpu0_vid.attr, &dev_attr_cpu0_vid.attr,
...@@ -906,7 +954,7 @@ static int __init it87_find(unsigned short *address, ...@@ -906,7 +954,7 @@ static int __init it87_find(unsigned short *address,
u16 chip_type; u16 chip_type;
superio_enter(); superio_enter();
chip_type = superio_inw(DEVID); chip_type = force_id ? force_id : superio_inw(DEVID);
switch (chip_type) { switch (chip_type) {
case IT8705F_DEVID: case IT8705F_DEVID:
...@@ -1027,35 +1075,45 @@ static int __devinit it87_probe(struct platform_device *pdev) ...@@ -1027,35 +1075,45 @@ static int __devinit it87_probe(struct platform_device *pdev)
if ((err = device_create_file(dev, if ((err = device_create_file(dev,
&sensor_dev_attr_fan1_input16.dev_attr)) &sensor_dev_attr_fan1_input16.dev_attr))
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_fan1_min16.dev_attr))) &sensor_dev_attr_fan1_min16.dev_attr))
|| (err = device_create_file(dev,
&sensor_dev_attr_fan1_alarm.dev_attr)))
goto ERROR4; goto ERROR4;
} }
if (data->has_fan & (1 << 1)) { if (data->has_fan & (1 << 1)) {
if ((err = device_create_file(dev, if ((err = device_create_file(dev,
&sensor_dev_attr_fan2_input16.dev_attr)) &sensor_dev_attr_fan2_input16.dev_attr))
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_fan2_min16.dev_attr))) &sensor_dev_attr_fan2_min16.dev_attr))
|| (err = device_create_file(dev,
&sensor_dev_attr_fan2_alarm.dev_attr)))
goto ERROR4; goto ERROR4;
} }
if (data->has_fan & (1 << 2)) { if (data->has_fan & (1 << 2)) {
if ((err = device_create_file(dev, if ((err = device_create_file(dev,
&sensor_dev_attr_fan3_input16.dev_attr)) &sensor_dev_attr_fan3_input16.dev_attr))
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_fan3_min16.dev_attr))) &sensor_dev_attr_fan3_min16.dev_attr))
|| (err = device_create_file(dev,
&sensor_dev_attr_fan3_alarm.dev_attr)))
goto ERROR4; goto ERROR4;
} }
if (data->has_fan & (1 << 3)) { if (data->has_fan & (1 << 3)) {
if ((err = device_create_file(dev, if ((err = device_create_file(dev,
&sensor_dev_attr_fan4_input16.dev_attr)) &sensor_dev_attr_fan4_input16.dev_attr))
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_fan4_min16.dev_attr))) &sensor_dev_attr_fan4_min16.dev_attr))
|| (err = device_create_file(dev,
&sensor_dev_attr_fan4_alarm.dev_attr)))
goto ERROR4; goto ERROR4;
} }
if (data->has_fan & (1 << 4)) { if (data->has_fan & (1 << 4)) {
if ((err = device_create_file(dev, if ((err = device_create_file(dev,
&sensor_dev_attr_fan5_input16.dev_attr)) &sensor_dev_attr_fan5_input16.dev_attr))
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_fan5_min16.dev_attr))) &sensor_dev_attr_fan5_min16.dev_attr))
|| (err = device_create_file(dev,
&sensor_dev_attr_fan5_alarm.dev_attr)))
goto ERROR4; goto ERROR4;
} }
} else { } else {
...@@ -1066,7 +1124,9 @@ static int __devinit it87_probe(struct platform_device *pdev) ...@@ -1066,7 +1124,9 @@ static int __devinit it87_probe(struct platform_device *pdev)
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_fan1_min.dev_attr)) &sensor_dev_attr_fan1_min.dev_attr))
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_fan1_div.dev_attr))) &sensor_dev_attr_fan1_div.dev_attr))
|| (err = device_create_file(dev,
&sensor_dev_attr_fan1_alarm.dev_attr)))
goto ERROR4; goto ERROR4;
} }
if (data->has_fan & (1 << 1)) { if (data->has_fan & (1 << 1)) {
...@@ -1075,7 +1135,9 @@ static int __devinit it87_probe(struct platform_device *pdev) ...@@ -1075,7 +1135,9 @@ static int __devinit it87_probe(struct platform_device *pdev)
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_fan2_min.dev_attr)) &sensor_dev_attr_fan2_min.dev_attr))
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_fan2_div.dev_attr))) &sensor_dev_attr_fan2_div.dev_attr))
|| (err = device_create_file(dev,
&sensor_dev_attr_fan2_alarm.dev_attr)))
goto ERROR4; goto ERROR4;
} }
if (data->has_fan & (1 << 2)) { if (data->has_fan & (1 << 2)) {
...@@ -1084,7 +1146,9 @@ static int __devinit it87_probe(struct platform_device *pdev) ...@@ -1084,7 +1146,9 @@ static int __devinit it87_probe(struct platform_device *pdev)
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_fan3_min.dev_attr)) &sensor_dev_attr_fan3_min.dev_attr))
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_fan3_div.dev_attr))) &sensor_dev_attr_fan3_div.dev_attr))
|| (err = device_create_file(dev,
&sensor_dev_attr_fan3_alarm.dev_attr)))
goto ERROR4; goto ERROR4;
} }
} }
...@@ -1488,7 +1552,7 @@ static void __exit sm_it87_exit(void) ...@@ -1488,7 +1552,7 @@ static void __exit sm_it87_exit(void)
} }
MODULE_AUTHOR("Chris Gauthron <chrisg@0-in.com>, " MODULE_AUTHOR("Chris Gauthron, "
"Jean Delvare <khali@linux-fr.org>"); "Jean Delvare <khali@linux-fr.org>");
MODULE_DESCRIPTION("IT8705F/8712F/8716F/8718F/8726F, SiS950 driver"); MODULE_DESCRIPTION("IT8705F/8712F/8716F/8718F/8726F, SiS950 driver");
module_param(update_vbat, bool, 0); module_param(update_vbat, bool, 0);
......
...@@ -74,7 +74,6 @@ static struct i2c_driver lm75_driver = { ...@@ -74,7 +74,6 @@ static struct i2c_driver lm75_driver = {
.driver = { .driver = {
.name = "lm75", .name = "lm75",
}, },
.id = I2C_DRIVERID_LM75,
.attach_adapter = lm75_attach_adapter, .attach_adapter = lm75_attach_adapter,
.detach_client = lm75_detach_client, .detach_client = lm75_detach_client,
}; };
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/hwmon.h> #include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/mutex.h> #include <linux/mutex.h>
...@@ -113,7 +114,6 @@ show(temp_input); ...@@ -113,7 +114,6 @@ show(temp_input);
show(temp_crit); show(temp_crit);
show(temp_min); show(temp_min);
show(temp_max); show(temp_max);
show(alarms);
/* read routines for hysteresis values */ /* read routines for hysteresis values */
static ssize_t show_temp_crit_hyst(struct device *dev, struct device_attribute *attr, char *buf) static ssize_t show_temp_crit_hyst(struct device *dev, struct device_attribute *attr, char *buf)
...@@ -186,6 +186,14 @@ static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr, ...@@ -186,6 +186,14 @@ static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr,
return count; return count;
} }
static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
char *buf)
{
int bitnr = to_sensor_dev_attr(attr)->index;
struct lm77_data *data = lm77_update_device(dev);
return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
}
static DEVICE_ATTR(temp1_input, S_IRUGO, static DEVICE_ATTR(temp1_input, S_IRUGO,
show_temp_input, NULL); show_temp_input, NULL);
static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO,
...@@ -202,8 +210,9 @@ static DEVICE_ATTR(temp1_min_hyst, S_IRUGO, ...@@ -202,8 +210,9 @@ static DEVICE_ATTR(temp1_min_hyst, S_IRUGO,
static DEVICE_ATTR(temp1_max_hyst, S_IRUGO, static DEVICE_ATTR(temp1_max_hyst, S_IRUGO,
show_temp_max_hyst, NULL); show_temp_max_hyst, NULL);
static DEVICE_ATTR(alarms, S_IRUGO, static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 2);
show_alarms, NULL); static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 0);
static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 1);
static int lm77_attach_adapter(struct i2c_adapter *adapter) static int lm77_attach_adapter(struct i2c_adapter *adapter)
{ {
...@@ -220,8 +229,9 @@ static struct attribute *lm77_attributes[] = { ...@@ -220,8 +229,9 @@ static struct attribute *lm77_attributes[] = {
&dev_attr_temp1_crit_hyst.attr, &dev_attr_temp1_crit_hyst.attr,
&dev_attr_temp1_min_hyst.attr, &dev_attr_temp1_min_hyst.attr,
&dev_attr_temp1_max_hyst.attr, &dev_attr_temp1_max_hyst.attr,
&dev_attr_alarms.attr, &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr,
&sensor_dev_attr_temp1_min_alarm.dev_attr.attr,
&sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
NULL NULL
}; };
......
...@@ -37,10 +37,8 @@ ...@@ -37,10 +37,8 @@
static struct platform_device *pdev; static struct platform_device *pdev;
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x20, 0x21, 0x22, 0x23, 0x24, static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
0x25, 0x26, 0x27, 0x28, 0x29, 0x2e, 0x2f, I2C_CLIENT_END };
0x2a, 0x2b, 0x2c, 0x2d, 0x2e,
0x2f, I2C_CLIENT_END };
static unsigned short isa_address = 0x290; static unsigned short isa_address = 0x290;
/* Insmod parameters */ /* Insmod parameters */
...@@ -170,7 +168,6 @@ static struct i2c_driver lm78_driver = { ...@@ -170,7 +168,6 @@ static struct i2c_driver lm78_driver = {
.driver = { .driver = {
.name = "lm78", .name = "lm78",
}, },
.id = I2C_DRIVERID_LM78,
.attach_adapter = lm78_attach_adapter, .attach_adapter = lm78_attach_adapter,
.detach_client = lm78_detach_client, .detach_client = lm78_detach_client,
}; };
......
This diff is collapsed.
...@@ -133,7 +133,6 @@ static struct i2c_driver lm83_driver = { ...@@ -133,7 +133,6 @@ static struct i2c_driver lm83_driver = {
.driver = { .driver = {
.name = "lm83", .name = "lm83",
}, },
.id = I2C_DRIVERID_LM83,
.attach_adapter = lm83_attach_adapter, .attach_adapter = lm83_attach_adapter,
.detach_client = lm83_detach_client, .detach_client = lm83_detach_client,
}; };
......
...@@ -367,7 +367,6 @@ static struct i2c_driver lm85_driver = { ...@@ -367,7 +367,6 @@ static struct i2c_driver lm85_driver = {
.driver = { .driver = {
.name = "lm85", .name = "lm85",
}, },
.id = I2C_DRIVERID_LM85,
.attach_adapter = lm85_attach_adapter, .attach_adapter = lm85_attach_adapter,
.detach_client = lm85_detach_client, .detach_client = lm85_detach_client,
}; };
...@@ -444,12 +443,8 @@ static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, c ...@@ -444,12 +443,8 @@ static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, c
static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ {
struct i2c_client *client = to_i2c_client(dev); struct lm85_data *data = dev_get_drvdata(dev);
struct lm85_data *data = i2c_get_clientdata(client); data->vrm = simple_strtoul(buf, NULL, 10);
u32 val;
val = simple_strtoul(buf, NULL, 10);
data->vrm = val;
return count; return count;
} }
...@@ -519,17 +514,64 @@ static ssize_t show_pwm_enable(struct device *dev, struct device_attribute ...@@ -519,17 +514,64 @@ static ssize_t show_pwm_enable(struct device *dev, struct device_attribute
{ {
int nr = to_sensor_dev_attr(attr)->index; int nr = to_sensor_dev_attr(attr)->index;
struct lm85_data *data = lm85_update_device(dev); struct lm85_data *data = lm85_update_device(dev);
int pwm_zone; int pwm_zone, enable;
pwm_zone = ZONE_FROM_REG(data->autofan[nr].config); pwm_zone = ZONE_FROM_REG(data->autofan[nr].config);
return sprintf(buf,"%d\n", (pwm_zone != 0 && pwm_zone != -1) ); switch (pwm_zone) {
case -1: /* PWM is always at 100% */
enable = 0;
break;
case 0: /* PWM is always at 0% */
case -2: /* PWM responds to manual control */
enable = 1;
break;
default: /* PWM in automatic mode */
enable = 2;
}
return sprintf(buf, "%d\n", enable);
}
static ssize_t set_pwm_enable(struct device *dev, struct device_attribute
*attr, const char *buf, size_t count)
{
int nr = to_sensor_dev_attr(attr)->index;
struct i2c_client *client = to_i2c_client(dev);
struct lm85_data *data = i2c_get_clientdata(client);
long val = simple_strtol(buf, NULL, 10);
u8 config;
switch (val) {
case 0:
config = 3;
break;
case 1:
config = 7;
break;
case 2:
/* Here we have to choose arbitrarily one of the 5 possible
configurations; I go for the safest */
config = 6;
break;
default:
return -EINVAL;
}
mutex_lock(&data->update_lock);
data->autofan[nr].config = lm85_read_value(client,
LM85_REG_AFAN_CONFIG(nr));
data->autofan[nr].config = (data->autofan[nr].config & ~0xe0)
| (config << 5);
lm85_write_value(client, LM85_REG_AFAN_CONFIG(nr),
data->autofan[nr].config);
mutex_unlock(&data->update_lock);
return count;
} }
#define show_pwm_reg(offset) \ #define show_pwm_reg(offset) \
static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \ static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \
show_pwm, set_pwm, offset - 1); \ show_pwm, set_pwm, offset - 1); \
static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO, \ static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO | S_IWUSR, \
show_pwm_enable, NULL, offset - 1) show_pwm_enable, set_pwm_enable, offset - 1)
show_pwm_reg(1); show_pwm_reg(1);
show_pwm_reg(2); show_pwm_reg(2);
......
This diff is collapsed.
This diff is collapsed.
...@@ -428,7 +428,6 @@ static struct i2c_driver lm92_driver = { ...@@ -428,7 +428,6 @@ static struct i2c_driver lm92_driver = {
.driver = { .driver = {
.name = "lm92", .name = "lm92",
}, },
.id = I2C_DRIVERID_LM92,
.attach_adapter = lm92_attach_adapter, .attach_adapter = lm92_attach_adapter,
.detach_client = lm92_detach_client, .detach_client = lm92_detach_client,
}; };
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -341,8 +341,7 @@ static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, ...@@ -341,8 +341,7 @@ static ssize_t show_vrm(struct device *dev, struct device_attribute *attr,
static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, 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 i2c_client *client = to_i2c_client(dev); struct smsc47m192_data *data = dev_get_drvdata(dev);
struct smsc47m192_data *data = i2c_get_clientdata(client);
data->vrm = simple_strtoul(buf, NULL, 10); data->vrm = simple_strtoul(buf, NULL, 10);
return count; return count;
} }
......
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