(Kyösti) Cleanups

Copy sysctl enums to chip drivers from sensors.h for now,
   as seen in drivers included in 2.5 tree. File no longer included
   from kernel side.

   Apply i2c-proc change in CVS tagged -km2.

   Partial clean and sort of includes everywhere.

   Add i2c-dev.h, as a partial copy from i2c.
   Add to sensors.h from i2c-proc.h to compile things.
   Remove i2c-isa.h.

   Reflect header file changes to lib/ and prog/.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1705 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Kyosti Malkki committed 2003-01-21 20:01:27 +00:00
1 parent d2e650b473
commit 1cfe63804a
68 files changed
+1609 -879

No files matched your search

+1 -1
View File
@@ -11,8 +11,8 @@
#include <linux/init.h>
#include <linux/apm_bios.h>
#include <linux/slab.h>
#include <asm/io.h>
#include <linux/pm.h>
#include <asm/io.h>
#include <asm/keyboard.h>
#include <asm/system.h>
#include "version.h"
+4 -9
View File
@@ -53,24 +53,18 @@
/* Note: we assume there can only be one ALI1535, with one SMBus interface */
#include <linux/version.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <asm/semaphore.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/i2c.h>
#include "version.h"
#include <linux/init.h>
#include <asm/io.h>
#include <asm/semaphore.h>
#include "version.h"
MODULE_LICENSE("GPL");
#ifndef DECLARE_MUTEX
#define DECLARE_MUTEX(name) struct semaphore name = MUTEX
#endif /* def DECLARE_MUTEX */
/* ALI1535 SMBus address offsets */
#define SMBHSTSTS (0 + ali1535_smba)
@@ -622,6 +616,7 @@ MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, "
"Mark D. Studebaker <mdsxyz123@yahoo.com> and Dan Eaton <dan.eaton@rocketlogix.com>");
MODULE_DESCRIPTION("ALI1535 SMBus driver");
MODULE_LICENSE("GPL");
module_init(i2c_ali1535_init);
module_exit(i2c_ali1535_exit);
+3 -5
View File
@@ -60,19 +60,16 @@
/* Note: we assume there can only be one ALI15X3, with one SMBus interface */
#include <linux/version.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/i2c.h>
#include "version.h"
#include <linux/init.h>
MODULE_LICENSE("GPL");
#include <asm/io.h>
#include "version.h"
/* ALI15X3 SMBus address offsets */
#define SMBHSTSTS (0 + ali15x3_smba)
@@ -586,6 +583,7 @@ static void __exit i2c_ali15x3_exit(void)
MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, and Mark D. Studebaker <mdsxyz123@yahoo.com>");
MODULE_DESCRIPTION("ALI15X3 SMBus driver");
MODULE_LICENSE("GPL");
module_init(i2c_ali15x3_init);
module_exit(i2c_ali15x3_exit);
+1 -2
View File
@@ -35,7 +35,6 @@
Note: we assume there can only be one device, with one SMBus interface.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/kernel.h>
@@ -43,9 +42,9 @@
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/i2c.h>
#include "version.h"
#include <linux/init.h>
#include <asm/io.h>
#include "version.h"
#define DRV_NAME "i2c-amd756"
+1 -2
View File
@@ -8,10 +8,8 @@
* the Free Software Foundation version 2.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/sched.h>
@@ -19,6 +17,7 @@
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <asm/io.h>
#include "version.h"
#ifndef I2C_HW_SMBUS_AMD8111
+2 -3
View File
@@ -24,16 +24,15 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <asm/system.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <linux/init.h>
#include <asm/io.h>
#include <asm/system.h>
MODULE_LICENSE("GPL");
+1 -2
View File
@@ -39,16 +39,15 @@
/* #define DEBUG 1 */
#include <linux/version.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <asm/io.h>
#include "version.h"
MODULE_LICENSE("GPL");
+2 -3
View File
@@ -35,14 +35,13 @@
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include "version.h"
#include <linux/init.h>
#include <asm/io.h>
#include "version.h"
MODULE_LICENSE("GPL");
+3 -15
View File
@@ -24,27 +24,17 @@
the SMBus and the ISA bus very much easier. See lm78.c for an example
of this. */
#include <linux/version.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include "version.h"
MODULE_LICENSE("GPL");
/* We can't do a thing... */
static u32 isa_func(struct i2c_adapter *adapter)
{
return 0;
}
/* This is the actual algorithm we define */
static struct i2c_algorithm isa_algorithm = {
.name = "ISA bus algorithm",
.id = I2C_ALGO_ISA,
.functionality = isa_func,
};
/* There can only be one... */
@@ -61,16 +51,14 @@ static int __init i2c_isa_init(void)
return i2c_add_adapter(&isa_adapter);
}
static void __exit i2c_isa_exit(void)
{
i2c_del_adapter(&isa_adapter);
}
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>");
MODULE_DESCRIPTION("ISA bus access through i2c");
MODULE_LICENSE("GPL");
module_init(i2c_isa_init);
module_exit(i2c_isa_exit);
-1
View File
@@ -45,7 +45,6 @@
#include <linux/module.h>
#include <linux/config.h>
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/pci.h>
+2 -2
View File
@@ -32,15 +32,15 @@
#include <linux/module.h>
#include <linux/config.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/i2c.h>
#include "version.h"
#include <linux/init.h>
#include <linux/apm_bios.h>
#include <asm/io.h>
#include "version.h"
#include "dmi_scan.h"
/* Note: We assume all devices are identical
+2 -3
View File
@@ -31,14 +31,13 @@
it easier to add later.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include "version.h"
#include <linux/init.h>
#include <asm/io.h>
#include "version.h"
/* 3DFX defines */
/* #define PCI_VENDOR_ID_S3 0x5333 */
+2 -3
View File
@@ -49,17 +49,16 @@
* Add adapter resets
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/i2c.h>
#include "version.h"
#include <linux/init.h>
#include <asm/io.h>
#include "version.h"
MODULE_LICENSE("GPL");
+2 -3
View File
@@ -48,17 +48,16 @@
Note: we assume there can only be one device, with one SMBus interface.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <asm/io.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/i2c.h>
#include "version.h"
#include <linux/init.h>
#include <asm/io.h>
#include "version.h"
#ifndef PCI_VENDOR_ID_SI
#define PCI_VENDOR_ID_SI 0x1039
+2 -3
View File
@@ -34,17 +34,16 @@
Note: we assume there can only be one SiS645 with one SMBus interface
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/i2c.h>
#include "version.h"
#include <linux/init.h>
#include <asm/io.h>
#include "version.h"
#define DRV_NAME "i2c-sis645"
+3 -4
View File
@@ -29,15 +29,14 @@
Order Number: DS-0025-TE
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <linux/init.h>
#include <asm/io.h>
#include <asm/hwrpb.h>
#include <asm/core_tsunami.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include "version.h"
#include <linux/init.h>
MODULE_LICENSE("GPL");
+2 -3
View File
@@ -21,17 +21,16 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include "version.h"
#include <linux/init.h>
#include <asm/io.h>
#include "version.h"
MODULE_LICENSE("GPL");
+2 -3
View File
@@ -32,17 +32,16 @@
Note: we assume there can only be one device, with one SMBus interface.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/i2c.h>
#include "version.h"
#include <linux/init.h>
#include <asm/io.h>
#include "version.h"
#ifndef PCI_DEVICE_ID_VIA_82C596_3
#define PCI_DEVICE_ID_VIA_82C596_3 0x3050
+2 -3
View File
@@ -27,14 +27,13 @@
/* This interfaces to the I2C bus of the Voodoo3 to gain access to
the BT869 and possibly other I2C devices. */
#include <linux/version.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include "version.h"
#include <linux/init.h>
#include <asm/io.h>
#include "version.h"
MODULE_LICENSE("GPL");
+20 -21
View File
@@ -19,14 +19,12 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include "version.h"
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -118,8 +116,6 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static void adm1021_init_client(struct i2c_client *client);
static int adm1021_detach_client(struct i2c_client *client);
static int adm1021_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int adm1021_read_value(struct i2c_client *client, u8 reg);
static int adm1021_rd_good(u8 *val, struct i2c_client *client, u8 reg, u8 mask);
static int adm1021_write_value(struct i2c_client *client, u8 reg,
@@ -147,9 +143,23 @@ static struct i2c_driver adm1021_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = adm1021_attach_adapter,
.detach_client = adm1021_detach_client,
.command = adm1021_command,
};
/* -- SENSORS SYSCTL START -- */
#define ADM1021_SYSCTL_TEMP 1200
#define ADM1021_SYSCTL_REMOTE_TEMP 1201
#define ADM1021_SYSCTL_DIE_CODE 1202
#define ADM1021_SYSCTL_ALARMS 1203
#define ADM1021_ALARM_TEMP_HIGH 0x40
#define ADM1021_ALARM_TEMP_LOW 0x20
#define ADM1021_ALARM_RTEMP_HIGH 0x10
#define ADM1021_ALARM_RTEMP_LOW 0x08
#define ADM1021_ALARM_RTEMP_NA 0x04
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected adm1021. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -310,13 +320,9 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address,
goto error3;
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client,
type_name,
data->type ==
adm1021 ?
adm1021_dir_table_template :
adm1021_max_dir_table_template,
THIS_MODULE)) < 0) {
if ((i = i2c_register_entry(new_client, type_name,
data->type == adm1021 ? adm1021_dir_table_template :
adm1021_max_dir_table_template)) < 0) {
err = i;
goto error4;
}
@@ -373,13 +379,6 @@ static int adm1021_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int adm1021_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* All registers are byte-sized */
static int adm1021_read_value(struct i2c_client *client, u8 reg)
{
+38 -17
View File
@@ -23,19 +23,18 @@
/* Supports the Analog Devices ADM1024. See doc/chips/adm1024 for details */
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -231,8 +230,6 @@ static int adm1024_attach_adapter(struct i2c_adapter *adapter);
static int adm1024_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int adm1024_detach_client(struct i2c_client *client);
static int adm1024_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int adm1024_read_value(struct i2c_client *client, u8 register);
static int adm1024_write_value(struct i2c_client *client, u8 register,
@@ -273,10 +270,42 @@ static struct i2c_driver adm1024_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = adm1024_attach_adapter,
.detach_client = adm1024_detach_client,
.command = adm1024_command,
};
/* The /proc/sys entries */
/* -- SENSORS SYSCTL START -- */
#define ADM1024_SYSCTL_IN0 1000 /* Volts * 100 */
#define ADM1024_SYSCTL_IN1 1001
#define ADM1024_SYSCTL_IN2 1002
#define ADM1024_SYSCTL_IN3 1003
#define ADM1024_SYSCTL_IN4 1004
#define ADM1024_SYSCTL_IN5 1005
#define ADM1024_SYSCTL_FAN1 1101 /* Rotations/min */
#define ADM1024_SYSCTL_FAN2 1102
#define ADM1024_SYSCTL_TEMP 1250 /* Degrees Celcius * 100 */
#define ADM1024_SYSCTL_TEMP1 1290 /* Degrees Celcius */
#define ADM1024_SYSCTL_TEMP2 1295 /* Degrees Celcius */
#define ADM1024_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define ADM1024_SYSCTL_ALARMS 2001 /* bitvector */
#define ADM1024_SYSCTL_ANALOG_OUT 2002
#define ADM1024_SYSCTL_VID 2003
#define ADM1024_ALARM_IN0 0x0001
#define ADM1024_ALARM_IN1 0x0002
#define ADM1024_ALARM_IN2 0x0004
#define ADM1024_ALARM_IN3 0x0008
#define ADM1024_ALARM_IN4 0x0100
#define ADM1024_ALARM_IN5 0x0200
#define ADM1024_ALARM_FAN1 0x0040
#define ADM1024_ALARM_FAN2 0x0080
#define ADM1024_ALARM_TEMP 0x0010
#define ADM1024_ALARM_TEMP1 0x0020
#define ADM1024_ALARM_TEMP2 0x0001
#define ADM1024_ALARM_CHAS 0x1000
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected ADM1024. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -410,8 +439,7 @@ static int adm1024_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client,
type_name,
adm1024_dir_table_template,
THIS_MODULE)) < 0) {
adm1024_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -452,13 +480,6 @@ static int adm1024_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int adm1024_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static int adm1024_read_value(struct i2c_client *client, u8 reg)
{
return 0xFF & i2c_smbus_read_byte_data(client, reg);
+32 -18
View File
@@ -22,20 +22,19 @@
/* Supports the Analog Devices ADM1025. See doc/chips/adm1025 for details */
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include "sensors_vid.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
#include "sensors_vid.h"
MODULE_LICENSE("GPL");
@@ -178,8 +177,6 @@ static int adm1025_attach_adapter(struct i2c_adapter *adapter);
static int adm1025_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int adm1025_detach_client(struct i2c_client *client);
static int adm1025_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int adm1025_read_value(struct i2c_client *client, u8 register);
static int adm1025_write_value(struct i2c_client *client, u8 register,
u8 value);
@@ -215,10 +212,35 @@ static struct i2c_driver adm1025_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = adm1025_attach_adapter,
.detach_client = adm1025_detach_client,
.command = adm1025_command,
};
/* The /proc/sys entries */
/* -- SENSORS SYSCTL START -- */
#define ADM1025_SYSCTL_IN0 1000 /* Volts * 100 */
#define ADM1025_SYSCTL_IN1 1001
#define ADM1025_SYSCTL_IN2 1002
#define ADM1025_SYSCTL_IN3 1003
#define ADM1025_SYSCTL_IN4 1004
#define ADM1025_SYSCTL_IN5 1005
#define ADM1025_SYSCTL_RTEMP 1251
#define ADM1025_SYSCTL_TEMP 1250 /* Degrees Celcius * 100 */
#define ADM1025_SYSCTL_ALARMS 2001 /* bitvector */
#define ADM1025_SYSCTL_ANALOG_OUT 2002
#define ADM1025_SYSCTL_VID 2003
#define ADM1025_SYSCTL_VRM 2004
#define ADM1025_ALARM_IN0 0x0001
#define ADM1025_ALARM_IN1 0x0002
#define ADM1025_ALARM_IN2 0x0004
#define ADM1025_ALARM_IN3 0x0008
#define ADM1025_ALARM_IN4 0x0100
#define ADM1025_ALARM_IN5 0x0200
#define ADM1025_ALARM_RTEMP 0x0020
#define ADM1025_ALARM_TEMP 0x0010
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected ADM1025. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -346,8 +368,7 @@ static int adm1025_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client,
type_name,
adm1025_dir_table_template,
THIS_MODULE)) < 0) {
adm1025_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -388,13 +409,6 @@ static int adm1025_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int adm1025_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static int adm1025_read_value(struct i2c_client *client, u8 reg)
{
return 0xFF & i2c_smbus_read_byte_data(client, reg);
+35 -17
View File
@@ -47,20 +47,18 @@
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -241,8 +239,6 @@ static int adm9240_attach_adapter(struct i2c_adapter *adapter);
static int adm9240_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int adm9240_detach_client(struct i2c_client *client);
static int adm9240_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int adm9240_read_value(struct i2c_client *client, u8 register);
static int adm9240_write_value(struct i2c_client *client, u8 register,
@@ -279,10 +275,39 @@ static struct i2c_driver adm9240_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = adm9240_attach_adapter,
.detach_client = adm9240_detach_client,
.command = adm9240_command,
};
/* The /proc/sys entries */
/* -- SENSORS SYSCTL START -- */
#define ADM9240_SYSCTL_IN0 1000 /* Volts * 100 */
#define ADM9240_SYSCTL_IN1 1001
#define ADM9240_SYSCTL_IN2 1002
#define ADM9240_SYSCTL_IN3 1003
#define ADM9240_SYSCTL_IN4 1004
#define ADM9240_SYSCTL_IN5 1005
#define ADM9240_SYSCTL_FAN1 1101 /* Rotations/min */
#define ADM9240_SYSCTL_FAN2 1102
#define ADM9240_SYSCTL_TEMP 1250 /* Degrees Celcius * 100 */
#define ADM9240_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define ADM9240_SYSCTL_ALARMS 2001 /* bitvector */
#define ADM9240_SYSCTL_ANALOG_OUT 2002
#define ADM9240_SYSCTL_VID 2003
#define ADM9240_ALARM_IN0 0x0001
#define ADM9240_ALARM_IN1 0x0002
#define ADM9240_ALARM_IN2 0x0004
#define ADM9240_ALARM_IN3 0x0008
#define ADM9240_ALARM_IN4 0x0100
#define ADM9240_ALARM_IN5 0x0200
#define ADM9240_ALARM_FAN1 0x0040
#define ADM9240_ALARM_FAN2 0x0080
#define ADM9240_ALARM_TEMP 0x0010
#define ADM9240_ALARM_CHAS 0x1000
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected ADM9240. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -427,8 +452,7 @@ static int adm9240_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client,
type_name,
adm9240_dir_table_template,
THIS_MODULE)) < 0) {
adm9240_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -469,12 +493,6 @@ static int adm9240_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int adm9240_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static int adm9240_read_value(struct i2c_client *client, u8 reg)
{
+15 -7
View File
@@ -19,19 +19,18 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include <linux/i2c-proc.h>
#include <linux/ipmi.h>
#include "version.h"
#include "sensors.h"
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
static unsigned short normal_i2c_range[] = { SENSORS_I2C_END };
@@ -131,6 +130,16 @@ struct sdrdata {
static struct sdrdata sdrd[MAX_SDR_ENTRIES];
static int sdrd_count;
/* -- SENSORS SYSCTL START -- */
#define BMC_SYSCTL_IN1 1000
#define BMC_SYSCTL_TEMP1 1100
#define BMC_SYSCTL_CURR1 1200
#define BMC_SYSCTL_FAN1 1300
#define BMC_SYSCTL_ALARMS 5000
/* -- SENSORS SYSCTL END -- */
#define MAX_PROC_ENTRIES (MAX_SDR_ENTRIES + 5)
#define MAX_PROCNAME_SIZE 8
static ctl_table *bmcsensors_dir_table;
@@ -376,8 +385,7 @@ static void bmcsensors_build_proc_table()
bmcsensors_dir_table[sdrd_count].ctl_name = 0;
if ((i = i2c_register_entry(&bmc_client, "bmc",
bmcsensors_dir_table,
THIS_MODULE)) < 0) {
bmcsensors_dir_table) < 0) {
printk(KERN_INFO "bmcsensors.o: i2c registration failed.\n");
kfree(bmcsensors_dir_table);
kfree(bmcsensors_proc_name_pool);
+14 -15
View File
@@ -23,13 +23,12 @@
#define DEBUG 1
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -81,8 +80,6 @@ static int bt869_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static void bt869_init_client(struct i2c_client *client);
static int bt869_detach_client(struct i2c_client *client);
static int bt869_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int bt869_read_value(struct i2c_client *client, u8 reg);
static int bt869_write_value(struct i2c_client *client, u8 reg, u16 value);
static void bt869_write_values(struct i2c_client *client, u16 *values);
@@ -111,9 +108,19 @@ static struct i2c_driver bt869_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = bt869_attach_adapter,
.detach_client = bt869_detach_client,
.command = bt869_command,
};
/* -- SENSORS SYSCTL START -- */
#define BT869_SYSCTL_STATUS 1000
#define BT869_SYSCTL_NTSC 1001
#define BT869_SYSCTL_HALF 1002
#define BT869_SYSCTL_RES 1003
#define BT869_SYSCTL_COLORBARS 1004
#define BT869_SYSCTL_DEPTH 1005
#define BT869_SYSCTL_SVIDEO 1006
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected bt869. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -544,8 +551,7 @@ int bt869_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client, type_name,
bt869_dir_table_template,
THIS_MODULE)) < 0) {
bt869_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -585,13 +591,6 @@ static int bt869_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int bt869_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* All registers are byte-sized.
bt869 uses a high-byte first convention, which is exactly opposite to
the usual practice. */
+12 -14
View File
@@ -21,12 +21,11 @@
*/
#include <linux/module.h>
#include <linux/version.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -73,8 +72,6 @@ static int ddcmon_attach_adapter(struct i2c_adapter *adapter);
static int ddcmon_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int ddcmon_detach_client(struct i2c_client *client);
static int ddcmon_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void ddcmon_idcall(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
@@ -97,9 +94,17 @@ static struct i2c_driver ddcmon_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = ddcmon_attach_adapter,
.detach_client = ddcmon_detach_client,
.command = ddcmon_command,
};
/* -- SENSORS SYSCTL START -- */
#define DDCMON_SYSCTL_ID 1010
#define DDCMON_SYSCTL_SIZE 1011
#define DDCMON_SYSCTL_SYNC 1012
#define DDCMON_SYSCTL_TIMINGS 1013
#define DDCMON_SYSCTL_SERIAL 1014
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected DDCMON. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -188,8 +193,7 @@ int ddcmon_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client, type_name,
ddcmon_dir_table_template,
THIS_MODULE)) < 0) {
ddcmon_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -221,12 +225,6 @@ static int ddcmon_detach_client(struct i2c_client *client)
return 0;
}
/* No commands defined yet */
static int ddcmon_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static void ddcmon_update_client(struct i2c_client *client)
{
struct ddcmon_data *data = client->data;
+1 -4
View File
@@ -17,17 +17,14 @@
*/
#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/i2c-proc.h>
#include <asm/semaphore.h>
#include "ds1307.h"
#define BCD_TO_BIN(x) (((x) & 15) + ((x) >> 4) * 10)
+14 -21
View File
@@ -21,13 +21,12 @@
/* Supports DS1621. See doc/chips/ds1621 for details */
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -103,8 +102,6 @@ static int ds1621_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static void ds1621_init_client(struct i2c_client *client);
static int ds1621_detach_client(struct i2c_client *client);
static int ds1621_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static u16 swap_bytes(u16 val);
static int ds1621_read_value(struct i2c_client *client, u8 reg);
@@ -130,9 +127,19 @@ static struct i2c_driver ds1621_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = ds1621_attach_adapter,
.detach_client = ds1621_detach_client,
.command = ds1621_command,
};
/* -- SENSORS SYSCTL START -- */
#define DS1621_SYSCTL_TEMP 1200 /* Degrees Celcius * 10 */
#define DS1621_SYSCTL_ALARMS 2001 /* bitvector */
#define DS1621_ALARM_TEMP_HIGH 0x40
#define DS1621_ALARM_TEMP_LOW 0x20
#define DS1621_SYSCTL_ENABLE 2002
#define DS1621_SYSCTL_CONTINUOUS 2003
#define DS1621_SYSCTL_POLARITY 2004
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected DS1621. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -237,8 +244,7 @@ int ds1621_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client, type_name,
ds1621_dir_table_template,
THIS_MODULE)) < 0) {
ds1621_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -263,12 +269,6 @@ static int ds1621_detach_client(struct i2c_client *client)
{
int err;
#ifdef MODULE
if (MOD_IN_USE)
return -EBUSY;
#endif
i2c_deregister_entry(((struct ds1621_data *) (client->data))->
sysctl_id);
@@ -284,13 +284,6 @@ static int ds1621_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int ds1621_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static u16 swap_bytes(u16 val)
{
return (val >> 8) | (val << 8);
+24 -15
View File
@@ -20,12 +20,11 @@
*/
#include <linux/module.h>
#include <linux/version.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -79,8 +78,6 @@ static int eeprom_attach_adapter(struct i2c_adapter *adapter);
static int eeprom_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int eeprom_detach_client(struct i2c_client *client);
static int eeprom_command(struct i2c_client *client, unsigned int cmd,
void *arg);
#if 0
static int eeprom_write_value(struct i2c_client *client, u8 reg,
@@ -100,9 +97,29 @@ static struct i2c_driver eeprom_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = eeprom_attach_adapter,
.detach_client = eeprom_detach_client,
.command = eeprom_command,
};
/* -- SENSORS SYSCTL START -- */
#define EEPROM_SYSCTL1 1000
#define EEPROM_SYSCTL2 1001
#define EEPROM_SYSCTL3 1002
#define EEPROM_SYSCTL4 1003
#define EEPROM_SYSCTL5 1004
#define EEPROM_SYSCTL6 1005
#define EEPROM_SYSCTL7 1006
#define EEPROM_SYSCTL8 1007
#define EEPROM_SYSCTL9 1008
#define EEPROM_SYSCTL10 1009
#define EEPROM_SYSCTL11 1010
#define EEPROM_SYSCTL12 1011
#define EEPROM_SYSCTL13 1012
#define EEPROM_SYSCTL14 1013
#define EEPROM_SYSCTL15 1014
#define EEPROM_SYSCTL16 1015
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected EEPROM. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -234,8 +251,7 @@ int eeprom_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client, type_name,
eeprom_dir_table_template,
THIS_MODULE)) < 0) {
eeprom_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -274,13 +290,6 @@ static int eeprom_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int eeprom_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
#if 0
/* No writes yet (PAE) */
static int eeprom_write_value(struct i2c_client *client, u8 reg, u8 value)
+21 -19
View File
@@ -25,20 +25,18 @@
and Philip Edelbrock <phil@netroedge.com>
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
/* Addresses to scan */
static unsigned short normal_i2c[] = { 0x73, SENSORS_I2C_END };
@@ -144,8 +142,6 @@ static int fscpos_attach_adapter(struct i2c_adapter *adapter);
static int fscpos_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int fscpos_detach_client(struct i2c_client *client);
static int fscpos_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int fscpos_read_value(struct i2c_client *client, u8 register);
static int fscpos_write_value(struct i2c_client *client, u8 register,
@@ -177,10 +173,24 @@ static struct i2c_driver fscpos_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = fscpos_attach_adapter,
.detach_client = fscpos_detach_client,
.command = fscpos_command,
};
/* The /proc/sys entries */
/* -- SENSORS SYSCTL START -- */
#define FSCPOS_SYSCTL_VOLT0 1000 /* 12 volt supply */
#define FSCPOS_SYSCTL_VOLT1 1001 /* 5 volt supply */
#define FSCPOS_SYSCTL_VOLT2 1002 /* batterie voltage*/
#define FSCPOS_SYSCTL_FAN0 1101 /* state, min, ripple, actual value fan 0 */
#define FSCPOS_SYSCTL_FAN1 1102 /* state, min, ripple, actual value fan 1 */
#define FSCPOS_SYSCTL_FAN2 1103 /* state, min, ripple, actual value fan 2 */
#define FSCPOS_SYSCTL_TEMP0 1201 /* state and value of sensor 0, cpu die */
#define FSCPOS_SYSCTL_TEMP1 1202 /* state and value of sensor 1, motherboard */
#define FSCPOS_SYSCTL_TEMP2 1203 /* state and value of sensor 2, chassis */
#define FSCPOS_SYSCTL_REV 2000 /* Revision */
#define FSCPOS_SYSCTL_EVENT 2001 /* global event status */
#define FSCPOS_SYSCTL_CONTROL 2002 /* global control byte */
#define FSCPOS_SYSCTL_WDOG 2003 /* state, min, ripple, actual value fan 2 */
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected FSCPOS. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -288,8 +298,7 @@ int fscpos_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client, type_name,
fscpos_dir_table_template,
THIS_MODULE)) < 0) {
fscpos_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -327,13 +336,6 @@ static int fscpos_detach_client(struct i2c_client *client)
return 0;
}
/* No commands defined yet */
static int fscpos_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static int fscpos_read_value(struct i2c_client *client, u8 reg)
{
#ifdef DEBUG
+29 -17
View File
@@ -25,19 +25,18 @@
and Philip Edelbrock <phil@netroedge.com>
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -197,8 +196,6 @@ static int fscscy_attach_adapter(struct i2c_adapter *adapter);
static int fscscy_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int fscscy_detach_client(struct i2c_client *client);
static int fscscy_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int fscscy_read_value(struct i2c_client *client, u8 register);
static int fscscy_write_value(struct i2c_client *client, u8 register,
@@ -234,10 +231,33 @@ static struct i2c_driver fscscy_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = fscscy_attach_adapter,
.detach_client = fscscy_detach_client,
.command = fscscy_command,
};
/* The /proc/sys entries */
/* -- SENSORS SYSCTL START -- */
#define FSCSCY_SYSCTL_VOLT0 1000 /* 12 volt supply */
#define FSCSCY_SYSCTL_VOLT1 1001 /* 5 volt supply */
#define FSCSCY_SYSCTL_VOLT2 1002 /* batterie voltage*/
#define FSCSCY_SYSCTL_FAN0 1101 /* state, min, ripple, actual value fan 0 */
#define FSCSCY_SYSCTL_FAN1 1102 /* state, min, ripple, actual value fan 1 */
#define FSCSCY_SYSCTL_FAN2 1103 /* state, min, ripple, actual value fan 2 */
#define FSCSCY_SYSCTL_FAN3 1104 /* state, min, ripple, actual value fan 3 */
#define FSCSCY_SYSCTL_FAN4 1105 /* state, min, ripple, actual value fan 4 */
#define FSCSCY_SYSCTL_FAN5 1106 /* state, min, ripple, actual value fan 5 */
#define FSCSCY_SYSCTL_TEMP0 1201 /* state and value of sensor 0, cpu die */
#define FSCSCY_SYSCTL_TEMP1 1202 /* state and value of sensor 1, motherboard */
#define FSCSCY_SYSCTL_TEMP2 1203 /* state and value of sensor 2, chassis */
#define FSCSCY_SYSCTL_TEMP3 1204 /* state and value of sensor 3, chassis */
#define FSCSCY_SYSCTL_REV 2000 /* Revision */
#define FSCSCY_SYSCTL_EVENT 2001 /* global event status */
#define FSCSCY_SYSCTL_CONTROL 2002 /* global control byte */
#define FSCSCY_SYSCTL_WDOG 2003 /* state, min, ripple, actual value fan 2 */
#define FSCSCY_SYSCTL_PCILOAD 2004 /* PCILoad value */
#define FSCSCY_SYSCTL_INTRUSION 2005 /* state, control for intrusion sensor */
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected FSCSCY. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -357,8 +377,7 @@ int fscscy_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client, type_name,
fscscy_dir_table_template,
THIS_MODULE)) < 0) {
fscscy_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -396,13 +415,6 @@ static int fscscy_detach_client(struct i2c_client *client)
return 0;
}
/* No commands defined yet */
static int fscscy_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static int fscscy_read_value(struct i2c_client *client, u8 reg)
{
#ifdef DEBUG
+28 -15
View File
@@ -21,15 +21,14 @@
*/
#include <linux/module.h>
#include <linux/version.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#ifdef __SMP__
#include <linux/smp_lock.h>
#endif
#include "version.h"
MODULE_LICENSE("GPL");
@@ -179,8 +178,6 @@ static int gl518_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static void gl518_init_client(struct i2c_client *client);
static int gl518_detach_client(struct i2c_client *client);
static int gl518_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static u16 swap_bytes(u16 val);
static int gl518_read_value(struct i2c_client *client, u8 reg);
@@ -215,9 +212,33 @@ static struct i2c_driver gl518_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = gl518_attach_adapter,
.detach_client = gl518_detach_client,
.command = gl518_command,
};
/* -- SENSORS SYSCTL START -- */
#define GL518_SYSCTL_VDD 1000 /* Volts * 100 */
#define GL518_SYSCTL_VIN1 1001
#define GL518_SYSCTL_VIN2 1002
#define GL518_SYSCTL_VIN3 1003
#define GL518_SYSCTL_FAN1 1101 /* RPM */
#define GL518_SYSCTL_FAN2 1102
#define GL518_SYSCTL_TEMP 1200 /* Degrees Celcius * 10 */
#define GL518_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define GL518_SYSCTL_ALARMS 2001 /* bitvector */
#define GL518_SYSCTL_BEEP 2002 /* bitvector */
#define GL518_SYSCTL_FAN1OFF 2003
#define GL518_SYSCTL_ITERATE 2004
#define GL518_ALARM_VDD 0x01
#define GL518_ALARM_VIN1 0x02
#define GL518_ALARM_VIN2 0x04
#define GL518_ALARM_VIN3 0x08
#define GL518_ALARM_TEMP 0x10
#define GL518_ALARM_FAN1 0x20
#define GL518_ALARM_FAN2 0x40
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected GL518. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -370,8 +391,7 @@ static int gl518_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry((struct i2c_client *) new_client,
type_name,
gl518_dir_table_template,
THIS_MODULE)) < 0) {
gl518_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -481,13 +501,6 @@ static int gl518_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int gl518_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static u16 swap_bytes(u16 val)
{
return (val >> 8) | (val << 8);
+32 -15
View File
@@ -20,13 +20,12 @@
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -179,8 +178,6 @@ static int gl520_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static void gl520_init_client(struct i2c_client *client);
static int gl520_detach_client(struct i2c_client *client);
static int gl520_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static u16 swap_bytes(u16 val);
static int gl520_read_value(struct i2c_client *client, u8 reg);
@@ -214,8 +211,36 @@ static struct i2c_driver gl520_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = gl520_attach_adapter,
.detach_client = gl520_detach_client,
.command = gl520_command,
};
/* -- SENSORS SYSCTL START -- */
#define GL520_SYSCTL_VDD 1000 /* Volts * 100 */
#define GL520_SYSCTL_VIN1 1001
#define GL520_SYSCTL_VIN2 1002
#define GL520_SYSCTL_VIN3 1003
#define GL520_SYSCTL_VIN4 1004
#define GL520_SYSCTL_FAN1 1101 /* RPM */
#define GL520_SYSCTL_FAN2 1102
#define GL520_SYSCTL_TEMP1 1200 /* Degrees Celcius * 10 */
#define GL520_SYSCTL_TEMP2 1201 /* Degrees Celcius * 10 */
#define GL520_SYSCTL_VID 1300
#define GL520_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define GL520_SYSCTL_ALARMS 2001 /* bitvector */
#define GL520_SYSCTL_BEEP 2002 /* bitvector */
#define GL520_SYSCTL_FAN1OFF 2003
#define GL520_SYSCTL_CONFIG 2004
#define GL520_ALARM_VDD 0x01
#define GL520_ALARM_VIN1 0x02
#define GL520_ALARM_VIN2 0x04
#define GL520_ALARM_VIN3 0x08
#define GL520_ALARM_TEMP1 0x10
#define GL520_ALARM_FAN1 0x20
#define GL520_ALARM_FAN2 0x40
#define GL520_ALARM_TEMP2 0x80
#define GL520_ALARM_VIN4 0x80
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected GL520. This is just a template;
though at first sight, you might think we could use a statically
@@ -347,8 +372,7 @@ static int gl520_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client,
type_name,
gl520_dir_table_template,
THIS_MODULE)) < 0) {
gl520_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -440,13 +464,6 @@ static int gl520_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int gl520_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static u16 swap_bytes(u16 val)
{
return (val >> 8) | (val << 8);
+7 -15
View File
@@ -29,13 +29,12 @@
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -64,8 +63,6 @@ struct icspll_data {
static int icspll_attach_adapter(struct i2c_adapter *adapter);
static int icspll_detach_client(struct i2c_client *client);
static int icspll_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int icspll_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
@@ -87,9 +84,12 @@ static struct i2c_driver icspll_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = icspll_attach_adapter,
.detach_client = icspll_detach_client,
.command = icspll_command,
};
/* -- SENSORS SYSCTL START -- */
#define ICSPLL_SYSCTL1 1000
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected ICSPLL. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -169,8 +169,7 @@ int icspll_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((err = i2c_register_entry(new_client, "icspll",
icspll_dir_table_template,
THIS_MODULE)) < 0)
icspll_dir_table_template)) < 0)
goto ERROR3;
data->sysctl_id = err;
err = 0;
@@ -202,13 +201,6 @@ static int icspll_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int icspll_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
#if 0
/* No writes yet (PAE) */
static int icspll_write_value(struct i2c_client *client, u8 reg, u16 value)
+43 -17
View File
@@ -31,19 +31,18 @@
type at module load time.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -224,8 +223,6 @@ static int it87_attach_adapter(struct i2c_adapter *adapter);
static int it87_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int it87_detach_client(struct i2c_client *client);
static int it87_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int it87_read_value(struct i2c_client *client, u8 register);
static int it87_write_value(struct i2c_client *client, u8 register,
@@ -254,12 +251,49 @@ static struct i2c_driver it87_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = it87_attach_adapter,
.detach_client = it87_detach_client,
.command = it87_command,
};
static int it87_id = 0;
/* The /proc/sys entries */
/* -- SENSORS SYSCTL START -- */
#define IT87_SYSCTL_IN0 1000 /* Volts * 100 */
#define IT87_SYSCTL_IN1 1001
#define IT87_SYSCTL_IN2 1002
#define IT87_SYSCTL_IN3 1003
#define IT87_SYSCTL_IN4 1004
#define IT87_SYSCTL_IN5 1005
#define IT87_SYSCTL_IN6 1006
#define IT87_SYSCTL_IN7 1007
#define IT87_SYSCTL_IN8 1008
#define IT87_SYSCTL_FAN1 1101 /* Rotations/min */
#define IT87_SYSCTL_FAN2 1102
#define IT87_SYSCTL_FAN3 1103
#define IT87_SYSCTL_TEMP1 1200 /* Degrees Celcius * 10 */
#define IT87_SYSCTL_TEMP2 1201 /* Degrees Celcius * 10 */
#define IT87_SYSCTL_TEMP3 1202 /* Degrees Celcius * 10 */
#define IT87_SYSCTL_VID 1300 /* Volts * 100 */
#define IT87_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define IT87_SYSCTL_ALARMS 2004 /* bitvector */
#define IT87_ALARM_IN0 0x000100
#define IT87_ALARM_IN1 0x000200
#define IT87_ALARM_IN2 0x000400
#define IT87_ALARM_IN3 0x000800
#define IT87_ALARM_IN4 0x001000
#define IT87_ALARM_IN5 0x002000
#define IT87_ALARM_IN6 0x004000
#define IT87_ALARM_IN7 0x008000
#define IT87_ALARM_FAN1 0x0001
#define IT87_ALARM_FAN2 0x0002
#define IT87_ALARM_FAN3 0x0004
#define IT87_ALARM_TEMP1 0x00010000
#define IT87_ALARM_TEMP2 0x00020000
#define IT87_ALARM_TEMP3 0x00040000
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected IT87. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -443,8 +477,7 @@ int it87_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client,
type_name,
it87_dir_table_template,
THIS_MODULE)) < 0) {
it87_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -488,13 +521,6 @@ static int it87_detach_client(struct i2c_client *client)
return 0;
}
/* No commands defined yet */
static int it87_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* The SMBus locks itself, but ISA access must be locked explicitely!
We don't want to lock the whole ISA bus, so we lock each client
separately.
+9 -16
View File
@@ -18,15 +18,12 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include "version.h"
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -72,8 +69,6 @@ static int lm75_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static void lm75_init_client(struct i2c_client *client);
static int lm75_detach_client(struct i2c_client *client);
static int lm75_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static u16 swap_bytes(u16 val);
static int lm75_read_value(struct i2c_client *client, u8 reg);
@@ -91,9 +86,14 @@ static struct i2c_driver lm75_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = lm75_attach_adapter,
.detach_client = lm75_detach_client,
.command = lm75_command,
};
/* -- SENSORS SYSCTL START -- */
#define LM75_SYSCTL_TEMP 1200 /* Degrees Celcius * 10 */
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected LM75. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -197,8 +197,7 @@ int lm75_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client, type_name,
lm75_dir_table_template,
THIS_MODULE)) < 0) {
lm75_dir_table_template)) < 0) {
err = i;
goto error4;
}
@@ -229,12 +228,6 @@ static int lm75_detach_client(struct i2c_client *client)
return 0;
}
static int lm75_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static u16 swap_bytes(u16 val)
{
return (val >> 8) | (val << 8);
+40 -18
View File
@@ -18,19 +18,18 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -197,8 +196,6 @@ static int lm78_attach_adapter(struct i2c_adapter *adapter);
static int lm78_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int lm78_detach_client(struct i2c_client *client);
static int lm78_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int lm78_read_value(struct i2c_client *client, u8 register);
static int lm78_write_value(struct i2c_client *client, u8 register,
@@ -227,12 +224,46 @@ static struct i2c_driver lm78_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = lm78_attach_adapter,
.detach_client = lm78_detach_client,
.command = lm78_command,
};
static int lm78_id = 0;
/* The /proc/sys entries */
/* -- SENSORS SYSCTL START -- */
#define LM78_SYSCTL_IN0 1000 /* Volts * 100 */
#define LM78_SYSCTL_IN1 1001
#define LM78_SYSCTL_IN2 1002
#define LM78_SYSCTL_IN3 1003
#define LM78_SYSCTL_IN4 1004
#define LM78_SYSCTL_IN5 1005
#define LM78_SYSCTL_IN6 1006
#define LM78_SYSCTL_FAN1 1101 /* Rotations/min */
#define LM78_SYSCTL_FAN2 1102
#define LM78_SYSCTL_FAN3 1103
#define LM78_SYSCTL_TEMP 1200 /* Degrees Celcius * 10 */
#define LM78_SYSCTL_VID 1300 /* Volts * 100 */
#define LM78_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define LM78_SYSCTL_ALARMS 2001 /* bitvector */
#define LM78_ALARM_IN0 0x0001
#define LM78_ALARM_IN1 0x0002
#define LM78_ALARM_IN2 0x0004
#define LM78_ALARM_IN3 0x0008
#define LM78_ALARM_IN4 0x0100
#define LM78_ALARM_IN5 0x0200
#define LM78_ALARM_IN6 0x0400
#define LM78_ALARM_FAN1 0x0040
#define LM78_ALARM_FAN2 0x0080
#define LM78_ALARM_FAN3 0x0800
#define LM78_ALARM_TEMP 0x0010
#define LM78_ALARM_BTI 0x0020
#define LM78_ALARM_CHAS 0x1000
#define LM78_ALARM_FIFO 0x2000
#define LM78_ALARM_SMI_IN 0x4000
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected LM78. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -414,8 +445,7 @@ int lm78_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client,
type_name,
lm78_dir_table_template,
THIS_MODULE)) < 0) {
lm78_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -459,14 +489,6 @@ static int lm78_detach_client(struct i2c_client *client)
return 0;
}
/* No commands defined yet */
static int lm78_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* The SMBus locks itself, but ISA access must be locked explicitely!
We don't want to lock the whole ISA bus, so we lock each client
separately.
+38 -17
View File
@@ -19,19 +19,18 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -195,8 +194,6 @@ static int lm80_attach_adapter(struct i2c_adapter *adapter);
static int lm80_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int lm80_detach_client(struct i2c_client *client);
static int lm80_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int lm80_read_value(struct i2c_client *client, u8 register);
static int lm80_write_value(struct i2c_client *client, u8 register,
@@ -225,10 +222,42 @@ static struct i2c_driver lm80_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = lm80_attach_adapter,
.detach_client = lm80_detach_client,
.command = lm80_command,
};
/* The /proc/sys entries */
/* -- SENSORS SYSCTL START -- */
#define LM80_SYSCTL_IN0 1000 /* Volts * 100 */
#define LM80_SYSCTL_IN1 1001
#define LM80_SYSCTL_IN2 1002
#define LM80_SYSCTL_IN3 1003
#define LM80_SYSCTL_IN4 1004
#define LM80_SYSCTL_IN5 1005
#define LM80_SYSCTL_IN6 1006
#define LM80_SYSCTL_FAN1 1101 /* Rotations/min */
#define LM80_SYSCTL_FAN2 1102
#define LM80_SYSCTL_TEMP 1250 /* Degrees Celcius * 100 */
#define LM80_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define LM80_SYSCTL_ALARMS 2001 /* bitvector */
#define LM80_ALARM_IN0 0x0001
#define LM80_ALARM_IN1 0x0002
#define LM80_ALARM_IN2 0x0004
#define LM80_ALARM_IN3 0x0008
#define LM80_ALARM_IN4 0x0010
#define LM80_ALARM_IN5 0x0020
#define LM80_ALARM_IN6 0x0040
#define LM80_ALARM_FAN1 0x0400
#define LM80_ALARM_FAN2 0x0800
#define LM80_ALARM_TEMP_HOT 0x0100
#define LM80_ALARM_TEMP_OS 0x2000
#define LM80_ALARM_CHAS 0x1000
#define LM80_ALARM_BTI 0x0200
#define LM80_ALARM_INT_IN 0x0080
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected LM80. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -346,8 +375,7 @@ int lm80_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client, type_name,
lm80_dir_table_template,
THIS_MODULE)) < 0) {
lm80_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -385,13 +413,6 @@ static int lm80_detach_client(struct i2c_client *client)
return 0;
}
/* No commands defined yet */
static int lm80_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static int lm80_read_value(struct i2c_client *client, u8 reg)
{
return i2c_smbus_read_byte_data(client, reg);
+46 -18
View File
@@ -22,20 +22,19 @@
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include "sensors_vid.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
#include "sensors_vid.h"
/* Chip configuration settings. These should be set to reflect the
HARDWARE configuration of your chip. By default (read: when all of
@@ -250,8 +249,6 @@ static int lm87_attach_adapter(struct i2c_adapter *adapter);
static int lm87_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int lm87_detach_client(struct i2c_client *client);
static int lm87_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int lm87_read_value(struct i2c_client *client, u8 register);
static int lm87_write_value(struct i2c_client *client, u8 register,
@@ -294,9 +291,48 @@ static struct i2c_driver LM87_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = lm87_attach_adapter,
.detach_client = lm87_detach_client,
.command = lm87_command,
};
/* -- SENSORS SYSCTL START -- */
#define LM87_SYSCTL_IN0 1000 /* Volts * 100 */
#define LM87_SYSCTL_IN1 1001
#define LM87_SYSCTL_IN2 1002
#define LM87_SYSCTL_IN3 1003
#define LM87_SYSCTL_IN4 1004
#define LM87_SYSCTL_IN5 1005
#define LM87_SYSCTL_AIN1 1006
#define LM87_SYSCTL_AIN2 1007
#define LM87_SYSCTL_FAN1 1102
#define LM87_SYSCTL_FAN2 1103
#define LM87_SYSCTL_TEMP1 1250 /* Degrees Celcius * 100 */
#define LM87_SYSCTL_TEMP2 1251 /* Degrees Celcius * 100 */
#define LM87_SYSCTL_TEMP3 1252 /* Degrees Celcius * 100 */
#define LM87_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define LM87_SYSCTL_ALARMS 2001 /* bitvector */
#define LM87_SYSCTL_ANALOG_OUT 2002
#define LM87_SYSCTL_VID 2003
#define LM87_SYSCTL_VRM 2004
#define LM87_ALARM_IN0 0x0001
#define LM87_ALARM_IN1 0x0002
#define LM87_ALARM_IN2 0x0004
#define LM87_ALARM_IN3 0x0008
#define LM87_ALARM_TEMP1 0x0010
#define LM87_ALARM_TEMP2 0x0020
#define LM87_ALARM_TEMP3 0x0020 /* same?? */
#define LM87_ALARM_FAN1 0x0040
#define LM87_ALARM_FAN2 0x0080
#define LM87_ALARM_IN4 0x0100
#define LM87_ALARM_IN5 0x0200
#define LM87_ALARM_RESERVED1 0x0400
#define LM87_ALARM_RESERVED2 0x0800
#define LM87_ALARM_CHAS 0x1000
#define LM87_ALARM_THERM_SIG 0x2000
#define LM87_ALARM_TEMP2_FAULT 0x4000
#define LM87_ALARM_TEMP3_FAULT 0x08000
/* -- SENSORS SYSCTL END -- */
/* The /proc/sys entries */
/* These files are created for each detected LM87. This is just a template;
though at first sight, you might think we could use a statically
@@ -437,8 +473,7 @@ static int lm87_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client,
type_name,
LM87_dir_table_template,
THIS_MODULE)) < 0) {
LM87_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -479,13 +514,6 @@ static int lm87_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int lm87_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static int lm87_read_value(struct i2c_client *client, u8 reg)
{
return 0xFF & i2c_smbus_read_byte_data(client, reg);
+17 -13
View File
@@ -18,9 +18,7 @@
*/
#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/slab.h>
@@ -29,15 +27,12 @@
#include <linux/i2c-proc.h>
#include <linux/proc_fs.h>
#include <linux/sysctl.h>
#include <asm/semaphore.h>
#include "version.h"
/* if defined, 4 faults must occur consecutively to set alarm flags */
/* #define ENABLE_FAULT_QUEUE */
#include "version.h"
#include "sensors.h"
#define LM92_REG_TEMPERATURE 0x00 /* ro, 16-bit */
#define LM92_REG_CONFIGURATION 0x01 /* rw, 8-bit */
#define LM92_REG_TRIP_HYSTERISIS 0x02 /* rw, 16-bit */
@@ -63,6 +58,21 @@
static void lm92_temp (struct i2c_client *client,int operation,int ctl_name,int *nrels_mag,long *results);
static void lm92_alarms (struct i2c_client *client,int operation,int ctl_name,int *nrels_mag,long *results);
/* -- SENSORS SYSCTL START -- */
#define LM92_SYSCTL_ALARMS 2001 /* high, low, critical */
#define LM92_SYSCTL_TEMP 1200 /* high, low, critical, hysterisis, input */
#define LM92_ALARM_TEMP_HIGH 0x01
#define LM92_ALARM_TEMP_LOW 0x02
#define LM92_ALARM_TEMP_CRIT 0x04
#define LM92_TEMP_HIGH 0x08
#define LM92_TEMP_LOW 0x10
#define LM92_TEMP_CRIT 0x20
#define LM92_TEMP_HYST 0x40
#define LM92_TEMP_INPUT 0x80
/* -- SENSORS SYSCTL END -- */
static ctl_table lm92_dir_table[] = {
{LM92_SYSCTL_TEMP, "temp", NULL, 0, 0644, NULL, &i2c_proc_real,
&i2c_sysctl_real, NULL, &lm92_temp, NULL},
@@ -295,7 +305,7 @@ static int lm92_detect (struct i2c_adapter *adapter,int address,unsigned short f
return (result);
}
if ((result = i2c_register_entry (client,client->name,lm92_dir_table,THIS_MODULE)) < 0) {
if ((result = i2c_register_entry (client,client->name,lm92_dir_table)) < 0) {
i2c_detach_client (client);
kfree (client);
up (&mutex);
@@ -351,11 +361,6 @@ static int lm92_detach_client (struct i2c_client *client)
return (0);
}
static int lm92_command (struct i2c_client *client,unsigned int cmd,void *arg)
{
return (0);
}
static struct i2c_driver lm92_driver = {
.owner = THIS_MODULE,
@@ -364,7 +369,6 @@ static struct i2c_driver lm92_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = lm92_attach_adapter,
.detach_client = lm92_detach_client,
.command = lm92_command,
};
static int __init sm_lm92_init(void)
+10 -15
View File
@@ -41,13 +41,12 @@
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -82,8 +81,6 @@ static int ltc1710_attach_adapter(struct i2c_adapter *adapter);
static int ltc1710_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int ltc1710_detach_client(struct i2c_client *client);
static int ltc1710_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void ltc1710_switch1(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
@@ -100,9 +97,15 @@ static struct i2c_driver ltc1710_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = ltc1710_attach_adapter,
.detach_client = ltc1710_detach_client,
.command = ltc1710_command,
};
/* -- SENSORS SYSCTL START -- */
#define LTC1710_SYSCTL_SWITCH_1 1000
#define LTC1710_SYSCTL_SWITCH_2 1001
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected LTC1710. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -197,8 +200,7 @@ int ltc1710_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client, type_name,
ltc1710_dir_table_template,
THIS_MODULE)) < 0) {
ltc1710_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -238,13 +240,6 @@ static int ltc1710_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int ltc1710_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static void ltc1710_update_client(struct i2c_client *client)
{
struct ltc1710_data *data = client->data;
+7 -15
View File
@@ -22,13 +22,12 @@
#define DEBUG 1
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -59,8 +58,6 @@ static int matorb_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static void matorb_init_client(struct i2c_client *client);
static int matorb_detach_client(struct i2c_client *client);
static int matorb_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int matorb_write_value(struct i2c_client *client, u8 reg,
u16 value);
@@ -77,9 +74,12 @@ static struct i2c_driver matorb_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = matorb_attach_adapter,
.detach_client = matorb_detach_client,
.command = matorb_command,
};
/* -- SENSORS SYSCTL START -- */
#define MATORB_SYSCTL_DISP 1000
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected MATORB. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -159,8 +159,7 @@ int matorb_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client, type_name,
matorb_dir_table_template,
THIS_MODULE)) < 0) {
matorb_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -199,13 +198,6 @@ static int matorb_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int matorb_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
#if 0
/* All registers are word-sized, except for the configuration register.
MATORB uses a high-byte first convention, which is exactly opposite to
+48 -16
View File
@@ -51,19 +51,18 @@
static const char *version_str = "2.00 29/2/2000 Fons Rademakers";
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -275,8 +274,6 @@ static int maxi_attach_adapter(struct i2c_adapter *adapter);
static int maxi_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int maxi_detach_client(struct i2c_client *client);
static int maxi_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int maxi_read_value(struct i2c_client *client, u8 register);
static int maxi_read_token(struct i2c_client *client, u16 token);
@@ -320,7 +317,6 @@ static struct i2c_driver maxi_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = maxi_attach_adapter,
.detach_client = maxi_detach_client,
.command = maxi_command,
};
static int maxi_id = 0;
@@ -330,6 +326,49 @@ static int maxi_id = 0;
static int maxi_version = cristal;
/* The /proc/sys entries */
/* -- SENSORS SYSCTL START -- */
#define MAXI_SYSCTL_FAN1 1101 /* Rotations/min */
#define MAXI_SYSCTL_FAN2 1102 /* Rotations/min */
#define MAXI_SYSCTL_FAN3 1103 /* Rotations/min */
#define MAXI_SYSCTL_FAN4 1104 /* Rotations/min */
#define MAXI_SYSCTL_TEMP1 1201 /* Degrees Celcius */
#define MAXI_SYSCTL_TEMP2 1202 /* Degrees Celcius */
#define MAXI_SYSCTL_TEMP3 1203 /* Degrees Celcius */
#define MAXI_SYSCTL_TEMP4 1204 /* Degrees Celcius */
#define MAXI_SYSCTL_TEMP5 1205 /* Degrees Celcius */
#define MAXI_SYSCTL_TEMP6 1206 /* Degrees Celcius */
#define MAXI_SYSCTL_PLL 1301 /* MHz */
#define MAXI_SYSCTL_VID1 1401 /* Volts / 6.337, for nba just Volts */
#define MAXI_SYSCTL_VID2 1402 /* Volts */
#define MAXI_SYSCTL_VID3 1403 /* Volts */
#define MAXI_SYSCTL_VID4 1404 /* Volts */
#define MAXI_SYSCTL_VID5 1405 /* Volts */
#define MAXI_SYSCTL_LCD1 1501 /* Line 1 of LCD */
#define MAXI_SYSCTL_LCD2 1502 /* Line 2 of LCD */
#define MAXI_SYSCTL_LCD3 1503 /* Line 3 of LCD */
#define MAXI_SYSCTL_LCD4 1504 /* Line 4 of LCD */
#define MAXI_SYSCTL_ALARMS 2001 /* Bitvector (see below) */
#define MAXI_ALARM_VID4 0x0001
#define MAXI_ALARM_TEMP2 0x0002
#define MAXI_ALARM_VID1 0x0004
#define MAXI_ALARM_VID2 0x0008
#define MAXI_ALARM_VID3 0x0010
#define MAXI_ALARM_PLL 0x0080
#define MAXI_ALARM_TEMP4 0x0100
#define MAXI_ALARM_TEMP5 0x0200
#define MAXI_ALARM_FAN1 0x1000
#define MAXI_ALARM_FAN2 0x2000
#define MAXI_ALARM_FAN3 0x4000
#define MAXI_ALARM_FAN 0x0100 /* To be used with MaxiLife'99 */
#define MAXI_ALARM_VID 0x0200 /* The MSB specifies which sensor */
#define MAXI_ALARM_TEMP 0x0400 /* in the alarm group failed, i.e.: */
#define MAXI_ALARM_VADD 0x0800 /* 0x0402 = TEMP2 failed = CPU2 temp */
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected MaxiLife processor.
This is just a template; though at first sight, you might think we
could use a statically allocated list, we need some way to get back
@@ -583,8 +622,7 @@ int maxi_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((err = i2c_register_entry(new_client, type_name,
maxi_dir_table_template,
THIS_MODULE)) < 0)
maxi_dir_table_template)) < 0)
goto ERROR4;
data->sysctl_id = err;
@@ -622,12 +660,6 @@ static int maxi_detach_client(struct i2c_client *client)
return 0;
}
/* No commands defined yet */
static int maxi_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Read byte from specified register (-1 in case of error, value otherwise). */
static int maxi_read_value(struct i2c_client *client, u8 reg)
{
+46 -16
View File
@@ -18,19 +18,18 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -275,8 +274,6 @@ static int mtp008_attach_adapter(struct i2c_adapter *adapter);
static int mtp008_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int mtp008_detach_client(struct i2c_client *client);
static int mtp008_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int mtp008_read_value(struct i2c_client *client, u8 register);
static int mtp008_write_value(struct i2c_client *client, u8 register, u8 value);
@@ -315,9 +312,49 @@ static struct i2c_driver mtp008_driver =
.flags = I2C_DF_NOTIFY,
.attach_adapter = mtp008_attach_adapter,
.detach_client = mtp008_detach_client,
.command = mtp008_command,
};
/* -- SENSORS SYSCTL START -- */
#define MTP008_SYSCTL_IN0 1000 /* Volts * 100 */
#define MTP008_SYSCTL_IN1 1001
#define MTP008_SYSCTL_IN2 1002
#define MTP008_SYSCTL_IN3 1003
#define MTP008_SYSCTL_IN4 1004
#define MTP008_SYSCTL_IN5 1005
#define MTP008_SYSCTL_IN6 1006
#define MTP008_SYSCTL_FAN1 1101 /* Rotations/min */
#define MTP008_SYSCTL_FAN2 1102
#define MTP008_SYSCTL_FAN3 1103
#define MTP008_SYSCTL_TEMP1 1200 /* Degrees Celcius * 10 */
#define MTP008_SYSCTL_TEMP2 1201 /* Degrees Celcius * 10 */
#define MTP008_SYSCTL_TEMP3 1202 /* Degrees Celcius * 10 */
#define MTP008_SYSCTL_VID 1300 /* Volts * 100 */
#define MTP008_SYSCTL_PWM1 1401
#define MTP008_SYSCTL_PWM2 1402
#define MTP008_SYSCTL_PWM3 1403
#define MTP008_SYSCTL_SENS1 1501 /* 1, 2, or Beta (3000-5000) */
#define MTP008_SYSCTL_SENS2 1502
#define MTP008_SYSCTL_SENS3 1503
#define MTP008_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define MTP008_SYSCTL_ALARMS 2001 /* bitvector */
#define MTP008_SYSCTL_BEEP 2002 /* bitvector */
#define MTP008_ALARM_IN0 0x0001
#define MTP008_ALARM_IN1 0x0002
#define MTP008_ALARM_IN2 0x0004
#define MTP008_ALARM_IN3 0x0008
#define MTP008_ALARM_IN4 0x0100
#define MTP008_ALARM_IN5 0x0200
#define MTP008_ALARM_IN6 0x0400
#define MTP008_ALARM_FAN1 0x0040
#define MTP008_ALARM_FAN2 0x0080
#define MTP008_ALARM_FAN3 0x0800
#define MTP008_ALARM_TEMP1 0x0010
#define MTP008_ALARM_TEMP2 0x0100
#define MTP008_ALARM_TEMP3 0x0200
/* -- SENSORS SYSCTL END -- */
/* The /proc/sys entries */
/* These files are created for each detected chip. This is just a template;
though at first sight, you might think we could use a statically
@@ -458,8 +495,7 @@ int mtp008_detect(struct i2c_adapter *adapter, int address,
* Register a new directory entry with the sensors module.
*/
if ((sysid = i2c_register_entry(new_client, type_name,
mtp008_dir_table_template,
THIS_MODULE)) < 0) {
mtp008_dir_table_template)) < 0) {
err = sysid;
goto ERROR2;
}
@@ -501,12 +537,6 @@ static int mtp008_detach_client(struct i2c_client *client)
return 0;
}
/* No commands defined yet */
static int mtp008_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static int mtp008_read_value(struct i2c_client *client, u8 reg)
{
+10 -14
View File
@@ -38,13 +38,12 @@
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -79,8 +78,6 @@ static int pcf8574_attach_adapter(struct i2c_adapter *adapter);
static int pcf8574_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int pcf8574_detach_client(struct i2c_client *client);
static int pcf8574_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void pcf8574_read(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
@@ -97,9 +94,15 @@ static struct i2c_driver pcf8574_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = pcf8574_attach_adapter,
.detach_client = pcf8574_detach_client,
.command = pcf8574_command,
};
/* -- SENSORS SYSCTL START -- */
#define PCF8574_SYSCTL_READ 1000
#define PCF8574_SYSCTL_WRITE 1001
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected PCF8574. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -203,8 +206,7 @@ int pcf8574_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client, type_name,
pcf8574_dir_table_template,
THIS_MODULE)) < 0) {
pcf8574_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -246,12 +248,6 @@ static int pcf8574_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int pcf8574_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Called when we have found a new PCF8574. */
static void pcf8574_init_client(struct i2c_client *client)
{
+14 -21
View File
@@ -18,14 +18,12 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include "version.h"
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -89,8 +87,6 @@ static int pcf8591_attach_adapter(struct i2c_adapter *adapter);
static int pcf8591_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int pcf8591_detach_client(struct i2c_client *client);
static int pcf8591_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void pcf8591_update_client(struct i2c_client *client);
static void pcf8591_init_client(struct i2c_client *client);
@@ -113,12 +109,22 @@ static struct i2c_driver pcf8591_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = pcf8591_attach_adapter,
.detach_client = pcf8591_detach_client,
.command = pcf8591_command,
};
static int pcf8591_id = 0;
/* The /proc/sys entries */
/* -- SENSORS SYSCTL START -- */
#define PCF8591_SYSCTL_AIN_CONF 1000 /* Analog input configuration */
#define PCF8591_SYSCTL_CH0 1001 /* Input channel 1 */
#define PCF8591_SYSCTL_CH1 1002 /* Input channel 2 */
#define PCF8591_SYSCTL_CH2 1003 /* Input channel 3 */
#define PCF8591_SYSCTL_CH3 1004 /* Input channel 4 */
#define PCF8591_SYSCTL_AOUT_ENABLE 1005 /* Analog output enable flag */
#define PCF8591_SYSCTL_AOUT 1006 /* Analog output */
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected PCF8591. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -224,8 +230,7 @@ int pcf8591_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client,
type_name,
pcf8591_dir_table_template,
THIS_MODULE)) < 0) {
pcf8591_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -251,11 +256,6 @@ static int pcf8591_detach_client(struct i2c_client *client)
{
int err;
#ifdef MODULE
if (MOD_IN_USE)
return -EBUSY;
#endif
i2c_deregister_entry(((struct pcf8591_data *) (client->data))->
sysctl_id);
@@ -270,13 +270,6 @@ static int pcf8591_detach_client(struct i2c_client *client)
return 0;
}
/* No commands defined yet */
static int pcf8591_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Called when we have found a new PCF8591. */
static void pcf8591_init_client(struct i2c_client *client)
{
+30 -17
View File
@@ -45,20 +45,19 @@
735 0008 0735
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <linux/pci.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -255,8 +254,6 @@ static int sis5595_attach_adapter(struct i2c_adapter *adapter);
static int sis5595_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int sis5595_detach_client(struct i2c_client *client);
static int sis5595_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int sis5595_read_value(struct i2c_client *client, u8 register);
static int sis5595_write_value(struct i2c_client *client, u8 register,
@@ -288,10 +285,34 @@ static struct i2c_driver sis5595_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = sis5595_attach_adapter,
.detach_client = sis5595_detach_client,
.command = sis5595_command,
};
/* The /proc/sys entries */
/* -- SENSORS SYSCTL START -- */
#define SIS5595_SYSCTL_IN0 1000 /* Volts * 100 */
#define SIS5595_SYSCTL_IN1 1001
#define SIS5595_SYSCTL_IN2 1002
#define SIS5595_SYSCTL_IN3 1003
#define SIS5595_SYSCTL_IN4 1004
#define SIS5595_SYSCTL_FAN1 1101 /* Rotations/min */
#define SIS5595_SYSCTL_FAN2 1102
#define SIS5595_SYSCTL_TEMP 1200 /* Degrees Celcius * 10 */
#define SIS5595_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define SIS5595_SYSCTL_ALARMS 2001 /* bitvector */
#define SIS5595_ALARM_IN0 0x01
#define SIS5595_ALARM_IN1 0x02
#define SIS5595_ALARM_IN2 0x04
#define SIS5595_ALARM_IN3 0x08
#define SIS5595_ALARM_BTI 0x20
#define SIS5595_ALARM_FAN1 0x40
#define SIS5595_ALARM_FAN2 0x80
#define SIS5595_ALARM_IN4 0x8000
#define SIS5595_ALARM_TEMP 0x8000
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected SIS5595. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -467,8 +488,7 @@ int sis5595_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry((struct i2c_client *) new_client,
type_name,
sis5595_dir_table_template,
THIS_MODULE)) < 0) {
sis5595_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -505,13 +525,6 @@ static int sis5595_detach_client(struct i2c_client *client)
return 0;
}
/* No commands defined yet */
static int sis5595_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* ISA access must be locked explicitly.
There are some ugly typecasts here, but the good news is - they should
+14 -22
View File
@@ -24,14 +24,12 @@
Copyright (C) 2000 Hypercore Software Design, Ltd.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include "version.h"
/* Addresses to scan */
@@ -96,8 +94,6 @@ static int smartbatt_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static void smartbatt_init_client(struct i2c_client *client);
static int smartbatt_detach_client(struct i2c_client *client);
static int smartbatt_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static u16 swap_bytes(u16 val);
static int sb_read(struct i2c_client *client, u8 reg);
@@ -127,9 +123,19 @@ static struct i2c_driver smartbatt_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = smartbatt_attach_adapter,
.detach_client = smartbatt_detach_client,
.command = smartbatt_command,
};
/* -- SENSORS SYSCTL START -- */
#define SMARTBATT_SYSCTL_I 1001
#define SMARTBATT_SYSCTL_V 1002
#define SMARTBATT_SYSCTL_TEMP 1003
#define SMARTBATT_SYSCTL_TIME 1004
#define SMARTBATT_SYSCTL_ALARMS 1005
#define SMARTBATT_SYSCTL_CHARGE 1006
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected SMARTBATT. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -222,8 +228,7 @@ int smartbatt_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client, type_name,
smartbatt_dir_table_template,
THIS_MODULE)) < 0) {
smartbatt_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -248,12 +253,6 @@ static int smartbatt_detach_client(struct i2c_client *client)
{
int err;
#ifdef MODULE
if (MOD_IN_USE)
return -EBUSY;
#endif
i2c_deregister_entry(((struct smartbatt_data *) (client->data))->
sysctl_id);
@@ -269,13 +268,6 @@ static int smartbatt_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int smartbatt_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static u16 swap_bytes(u16 val)
{
return (val >> 8) | (val << 8);
+15 -14
View File
@@ -19,12 +19,11 @@
*/
#include <linux/module.h>
#include <linux/version.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include "version.h"
#define DEBUG 1
@@ -116,8 +115,6 @@ static int smbusarp_attach_adapter(struct i2c_adapter *adapter);
static int smbusarp_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int smbusarp_detach_client(struct i2c_client *client);
static int smbusarp_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int smbusarp_init_client(struct i2c_client *client);
static void smbusarp_contents(struct i2c_client *client, int operation,
@@ -130,9 +127,20 @@ static struct i2c_driver smbusarp_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = smbusarp_attach_adapter,
.detach_client = smbusarp_detach_client,
.command = smbusarp_command,
};
/* -- SENSORS SYSCTL START -- */
#define ARP_SYSCTL1 1000
#define ARP_SYSCTL2 1001
#define ARP_SYSCTL3 1002
#define ARP_SYSCTL4 1003
#define ARP_SYSCTL5 1004
#define ARP_SYSCTL6 1005
#define ARP_SYSCTL7 1006
#define ARP_SYSCTL8 1007
/* -- SENSORS SYSCTL END -- */
static ctl_table smbusarp_dir_table_template[] = {
{ARP_SYSCTL1, "0", NULL, 0, 0644, NULL, &i2c_proc_real,
&i2c_sysctl_real, NULL, &smbusarp_contents},
@@ -203,8 +211,7 @@ int smbusarp_detect(struct i2c_adapter *adapter, int address,
goto ERROR1;
if ((i = i2c_register_entry(new_client, type_name,
smbusarp_dir_table_template,
THIS_MODULE)) < 0) {
smbusarp_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -238,12 +245,6 @@ static int smbusarp_detach_client(struct i2c_client *client)
}
static int smbusarp_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static u8 choose_addr(u8 * pool)
{
int i;
+18 -16
View File
@@ -19,20 +19,18 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
static int force_addr = 0;
MODULE_PARM(force_addr, "i");
@@ -142,8 +140,6 @@ static int smsc47m1_attach_adapter(struct i2c_adapter *adapter);
static int smsc47m1_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int smsc47m1_detach_client(struct i2c_client *client);
static int smsc47m1_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int smsc47m1_read_value(struct i2c_client *client, u8 register);
static int smsc47m1_write_value(struct i2c_client *client, u8 register,
@@ -171,9 +167,21 @@ static struct i2c_driver smsc47m1_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = smsc47m1_attach_adapter,
.detach_client = smsc47m1_detach_client,
.command = smsc47m1_command,
};
/* -- SENSORS SYSCTL START -- */
#define SMSC47M1_SYSCTL_FAN1 1101 /* Rotations/min */
#define SMSC47M1_SYSCTL_FAN2 1102
#define SMSC47M1_SYSCTL_PWM1 1401
#define SMSC47M1_SYSCTL_PWM2 1402
#define SMSC47M1_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define SMSC47M1_SYSCTL_ALARMS 2004 /* bitvector */
#define SMSC47M1_ALARM_FAN1 0x0001
#define SMSC47M1_ALARM_FAN2 0x0002
/* -- SENSORS SYSCTL END -- */
static ctl_table smsc47m1_dir_table_template[] = {
{SMSC47M1_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real,
&i2c_sysctl_real, NULL, &smsc47m1_fan},
@@ -277,8 +285,7 @@ int smsc47m1_detect(struct i2c_adapter *adapter, int address,
if ((i = i2c_register_entry((struct i2c_client *) new_client,
type_name,
smsc47m1_dir_table_template,
THIS_MODULE)) < 0) {
smsc47m1_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -314,11 +321,6 @@ static int smsc47m1_detach_client(struct i2c_client *client)
return 0;
}
static int smsc47m1_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static int smsc47m1_read_value(struct i2c_client *client, u8 reg)
{
int res;
+14 -15
View File
@@ -21,13 +21,12 @@
#define DEBUG 1
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include "sensors.h"
#include "version.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include "version.h"
MODULE_LICENSE("GPL");
@@ -94,8 +93,6 @@ static int thmc50_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static void thmc50_init_client(struct i2c_client *client);
static int thmc50_detach_client(struct i2c_client *client);
static int thmc50_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int thmc50_read_value(struct i2c_client *client, u8 reg);
static int thmc50_write_value(struct i2c_client *client, u8 reg,
@@ -124,9 +121,19 @@ static struct i2c_driver thmc50_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = thmc50_attach_adapter,
.detach_client = thmc50_detach_client,
.command = thmc50_command,
};
/* -- SENSORS SYSCTL START -- */
#define THMC50_SYSCTL_TEMP 1200 /* Degrees Celcius */
#define THMC50_SYSCTL_REMOTE_TEMP 1201 /* Degrees Celcius */
#define THMC50_SYSCTL_INTER 1202
#define THMC50_SYSCTL_INTER_MASK 1203
#define THMC50_SYSCTL_DIE_CODE 1204
#define THMC50_SYSCTL_ANALOG_OUT 1205
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected THMC50. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -243,8 +250,7 @@ int thmc50_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client, type_name,
thmc50_dir_table_template,
THIS_MODULE)) < 0) {
thmc50_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -284,13 +290,6 @@ static int thmc50_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
static int thmc50_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* All registers are word-sized, except for the configuration register.
THMC50 uses a high-byte first convention, which is exactly opposite to
the usual practice. */
+92 -45
View File
@@ -30,23 +30,16 @@
See doc/chips/via686a for details.
Warning - only supports a single device.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <linux/pci.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
MODULE_LICENSE("GPL");
#include <asm/io.h>
#include "version.h"
#ifndef PCI_DEVICE_ID_VIA_82C686_4
#define PCI_DEVICE_ID_VIA_82C686_4 0x3057
@@ -116,7 +109,7 @@ static const u8 reghyst[] = { 0x3a, 0x3e, 0x1e };
// 10 comparator mode- like 00, but ignores hysteresis
// 11 same as 00
#define VIA686A_REG_TEMP_MODE 0x4b
// We'll just assume that you want to set all 3 simulataneously:
// We'll just assume that you want to set all 3 simultaneously:
#define VIA686A_TEMP_MODE_MASK 0x3F
#define VIA686A_TEMP_MODE_CONTINUOUS (0x00)
@@ -406,15 +399,12 @@ static int via686a_attach_adapter(struct i2c_adapter *adapter);
static int via686a_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int via686a_detach_client(struct i2c_client *client);
static int via686a_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int via686a_read_value(struct i2c_client *client, u8 register);
static void via686a_write_value(struct i2c_client *client, u8 register,
u8 value);
static void via686a_update_client(struct i2c_client *client);
static void via686a_init_client(struct i2c_client *client);
static int via686a_find(int *address);
static void via686a_in(struct i2c_client *client, int operation,
@@ -439,10 +429,40 @@ static struct i2c_driver via686a_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = via686a_attach_adapter,
.detach_client = via686a_detach_client,
.command = via686a_command,
};
/* The /proc/sys entries */
/* -- SENSORS SYSCTL START -- */
#define VIA686A_SYSCTL_IN0 1000
#define VIA686A_SYSCTL_IN1 1001
#define VIA686A_SYSCTL_IN2 1002
#define VIA686A_SYSCTL_IN3 1003
#define VIA686A_SYSCTL_IN4 1004
#define VIA686A_SYSCTL_FAN1 1101
#define VIA686A_SYSCTL_FAN2 1102
#define VIA686A_SYSCTL_TEMP 1200
#define VIA686A_SYSCTL_TEMP2 1201
#define VIA686A_SYSCTL_TEMP3 1202
#define VIA686A_SYSCTL_FAN_DIV 2000
#define VIA686A_SYSCTL_ALARMS 2001
#define VIA686A_ALARM_IN0 0x01
#define VIA686A_ALARM_IN1 0x02
#define VIA686A_ALARM_IN2 0x04
#define VIA686A_ALARM_IN3 0x08
#define VIA686A_ALARM_TEMP 0x10
#define VIA686A_ALARM_FAN1 0x40
#define VIA686A_ALARM_FAN2 0x80
#define VIA686A_ALARM_IN4 0x100
#define VIA686A_ALARM_TEMP2 0x800
#define VIA686A_ALARM_CHAS 0x1000
#define VIA686A_ALARM_TEMP3 0x8000
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected VIA686A. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -595,8 +615,7 @@ int via686a_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry((struct i2c_client *) new_client,
type_name,
via686a_dir_table_template,
THIS_MODULE)) < 0) {
via686a_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -634,13 +653,6 @@ static int via686a_detach_client(struct i2c_client *client)
return 0;
}
/* No commands defined yet */
static int via686a_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Called when we have found a new VIA686A. Set limits, etc. */
static void via686a_init_client(struct i2c_client *client)
{
@@ -703,8 +715,8 @@ static void via686a_update_client(struct i2c_client *client)
down(&data->update_lock);
if ((jiffies - data->last_updated > HZ + HZ / 2) ||
(jiffies < data->last_updated) || !data->valid) {
if (time_after(jiffies - data->last_updated, HZ + HZ / 2) ||
time_before(jiffies, data->last_updated) || !data->valid) {
for (i = 0; i <= 4; i++) {
data->in[i] =
@@ -774,8 +786,8 @@ static void via686a_update_client(struct i2c_client *client)
large enough (by checking the incoming value of *nrels). This is not very
good practice, but as long as you put less than about 5 values in results,
you can assume it is large enough. */
void via686a_in(struct i2c_client *client, int operation, int ctl_name,
int *nrels_mag, long *results)
static void via686a_in(struct i2c_client *client, int operation, int ctl_name,
int *nrels_mag, long *results)
{
struct via686a_data *data = client->data;
int nr = ctl_name - VIA686A_SYSCTL_IN0;
@@ -901,31 +913,66 @@ void via686a_fan_div(struct i2c_client *client, int operation,
}
}
static struct pci_device_id via686a_pci_ids[] __devinitdata = {
{PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ 0, }
};
static int __devinit via686a_pci_probe(struct pci_dev *dev,
const struct pci_device_id *id)
{
u16 val;
int addr = 0;
if (PCIBIOS_SUCCESSFUL !=
pci_read_config_word(dev, VIA686A_BASE_REG, &val))
return -ENODEV;
addr = val & ~(VIA686A_EXTENT - 1);
if (addr == 0 && force_addr == 0) {
printk("via686a.o: base address not set - upgrade BIOS or use force_addr=0xaddr\n");
return -ENODEV;
}
if (force_addr)
addr = force_addr; /* so detect will get called */
if (!addr) {
printk("via686a.o: No Via 686A sensors found.\n");
return -ENODEV;
}
normal_isa[0] = addr;
s_bridge = dev;
return i2c_add_driver(&via686a_driver);
}
static void __devexit via686a_pci_remove(struct pci_dev *dev)
{
i2c_del_driver(&via686a_driver);
}
static struct pci_driver via686a_pci_driver = {
.name = "via686a",
.id_table = via686a_pci_ids,
.probe = via686a_pci_probe,
.remove = __devexit_p(via686a_pci_remove),
};
static int __init sm_via686a_init(void)
{
int res, addr;
printk("via686a.o version %s (%s)\n", LM_VERSION, LM_DATE);
if (via686a_find(&addr)) {
printk("via686a.o: No Via 686A sensors found.\n");
return -ENODEV;
}
normal_isa[0] = addr;
return i2c_add_driver(&via686a_driver);
return pci_module_init(&via686a_pci_driver);
}
static void __exit sm_via686a_exit(void)
{
i2c_del_driver(&via686a_driver);
pci_unregister_driver(&via686a_pci_driver);
}
MODULE_AUTHOR
("Kyösti Mälkki <kmalkki@cc.hut.fi>, Mark Studebaker <mdsxyz123@yahoo.com>, Bob Dougherty <bobd@stanford.edu>");
MODULE_AUTHOR("Kyösti Mälkki <kmalkki@cc.hut.fi>, "
"Mark Studebaker <mdsxyz123@yahoo.com> "
"and Bob Dougherty <bobd@stanford.edu>");
MODULE_DESCRIPTION("VIA 686A Sensor device");
MODULE_LICENSE("GPL");
module_init(sm_via686a_init);
module_exit(sm_via686a_exit);
+52 -18
View File
@@ -21,21 +21,19 @@
/* Supports VIA VT1211 Super I/O sensors via ISA (LPC) accesses only. */
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include "sensors_vid.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
#include "sensors_vid.h"
static int force_addr = 0;
MODULE_PARM(force_addr, "i");
@@ -209,8 +207,6 @@ static int vt1211_attach_adapter(struct i2c_adapter *adapter);
static int vt1211_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int vt1211_detach_client(struct i2c_client *client);
static int vt1211_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static inline int vt_rdval(struct i2c_client *client, u8 register);
static inline void vt1211_write_value(struct i2c_client *client, u8 register,
@@ -248,9 +244,54 @@ static struct i2c_driver vt1211_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = vt1211_attach_adapter,
.detach_client = vt1211_detach_client,
.command = vt1211_command,
};
/* -- SENSORS SYSCTL START -- */
#define VT1211_SYSCTL_IN0 1000
#define VT1211_SYSCTL_IN1 1001
#define VT1211_SYSCTL_IN2 1002
#define VT1211_SYSCTL_IN3 1003
#define VT1211_SYSCTL_IN4 1004
#define VT1211_SYSCTL_IN5 1005
#define VT1211_SYSCTL_IN6 1006
#define VT1211_SYSCTL_FAN1 1101
#define VT1211_SYSCTL_FAN2 1102
#define VT1211_SYSCTL_TEMP 1200
#define VT1211_SYSCTL_TEMP2 1201
#define VT1211_SYSCTL_TEMP3 1202
#define VT1211_SYSCTL_TEMP4 1203
#define VT1211_SYSCTL_TEMP5 1204
#define VT1211_SYSCTL_TEMP6 1205
#define VT1211_SYSCTL_TEMP7 1206
#define VT1211_SYSCTL_VID 1300
#define VT1211_SYSCTL_PWM1 1401
#define VT1211_SYSCTL_PWM2 1402
#define VT1211_SYSCTL_VRM 1600
#define VT1211_SYSCTL_UCH 1700
#define VT1211_SYSCTL_FAN_DIV 2000
#define VT1211_SYSCTL_ALARMS 2001
#define VT1211_ALARM_IN1 0x01
#define VT1211_ALARM_IN2 0x02
#define VT1211_ALARM_IN5 0x04
#define VT1211_ALARM_IN3 0x08
#define VT1211_ALARM_TEMP 0x10
#define VT1211_ALARM_FAN1 0x40
#define VT1211_ALARM_FAN2 0x80
#define VT1211_ALARM_IN4 0x100
#define VT1211_ALARM_IN6 0x200
#define VT1211_ALARM_TEMP2 0x800
#define VT1211_ALARM_CHAS 0x1000
#define VT1211_ALARM_TEMP3 0x8000
/* duplicates */
#define VT1211_ALARM_IN0 VT1211_ALARM_TEMP
#define VT1211_ALARM_TEMP4 VT1211_ALARM_IN1
#define VT1211_ALARM_TEMP5 VT1211_ALARM_IN2
#define VT1211_ALARM_TEMP6 VT1211_ALARM_IN3
#define VT1211_ALARM_TEMP7 VT1211_ALARM_IN4
/* -- SENSORS SYSCTL END -- */
static ctl_table vt1211_dir_table_template[] = {
{VT1211_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real,
&i2c_sysctl_real, NULL, &vt1211_in},
@@ -395,8 +436,7 @@ int vt1211_detect(struct i2c_adapter *adapter, int address,
if ((i = i2c_register_entry((struct i2c_client *) new_client,
type_name,
vt1211_dir_table_template,
THIS_MODULE)) < 0) {
vt1211_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -432,12 +472,6 @@ static int vt1211_detach_client(struct i2c_client *client)
return 0;
}
static int vt1211_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static inline int vt_rdval(struct i2c_client *client, u8 reg)
{
return (inb_p(client->addr + reg));
+52 -16
View File
@@ -21,21 +21,20 @@
/* Supports VIA VT8231 Super I/O embedded sensors */
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <linux/pci.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include "sensors_vid.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
#include "sensors_vid.h"
static int force_addr = 0;
@@ -167,8 +166,6 @@ static int vt8231_attach_adapter(struct i2c_adapter *adapter);
static int vt8231_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int vt8231_detach_client(struct i2c_client *client);
static int vt8231_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static inline int vt_rdval(struct i2c_client *client, u8 register);
static inline void vt8231_write_value(struct i2c_client *client, u8 register,
@@ -206,9 +203,54 @@ static struct i2c_driver vt8231_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = vt8231_attach_adapter,
.detach_client = vt8231_detach_client,
.command = vt8231_command,
};
/* -- SENSORS SYSCTL START -- */
#define VT8231_SYSCTL_IN0 1000
#define VT8231_SYSCTL_IN1 1001
#define VT8231_SYSCTL_IN2 1002
#define VT8231_SYSCTL_IN3 1003
#define VT8231_SYSCTL_IN4 1004
#define VT8231_SYSCTL_IN5 1005
#define VT8231_SYSCTL_IN6 1006
#define VT8231_SYSCTL_FAN1 1101
#define VT8231_SYSCTL_FAN2 1102
#define VT8231_SYSCTL_TEMP 1200
#define VT8231_SYSCTL_TEMP2 1201
#define VT8231_SYSCTL_TEMP3 1202
#define VT8231_SYSCTL_TEMP4 1203
#define VT8231_SYSCTL_TEMP5 1204
#define VT8231_SYSCTL_TEMP6 1205
#define VT8231_SYSCTL_TEMP7 1206
#define VT8231_SYSCTL_VID 1300
#define VT8231_SYSCTL_PWM1 1401
#define VT8231_SYSCTL_PWM2 1402
#define VT8231_SYSCTL_VRM 1600
#define VT8231_SYSCTL_UCH 1700
#define VT8231_SYSCTL_FAN_DIV 2000
#define VT8231_SYSCTL_ALARMS 2001
#define VT8231_ALARM_IN1 0x01
#define VT8231_ALARM_IN2 0x02
#define VT8231_ALARM_IN5 0x04
#define VT8231_ALARM_IN3 0x08
#define VT8231_ALARM_TEMP 0x10
#define VT8231_ALARM_FAN1 0x40
#define VT8231_ALARM_FAN2 0x80
#define VT8231_ALARM_IN4 0x100
#define VT8231_ALARM_IN6 0x200
#define VT8231_ALARM_TEMP2 0x800
#define VT8231_ALARM_CHAS 0x1000
#define VT8231_ALARM_TEMP3 0x8000
/* duplicates */
#define VT8231_ALARM_IN0 VT8231_ALARM_TEMP
#define VT8231_ALARM_TEMP4 VT8231_ALARM_IN1
#define VT8231_ALARM_TEMP5 VT8231_ALARM_IN2
#define VT8231_ALARM_TEMP6 VT8231_ALARM_IN3
#define VT8231_ALARM_TEMP7 VT8231_ALARM_IN4
/* -- SENSORS SYSCTL END -- */
static ctl_table vt8231_dir_table_template[] = {
{VT8231_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real,
&i2c_sysctl_real, NULL, &vt8231_in},
@@ -364,8 +406,7 @@ int vt8231_detect(struct i2c_adapter *adapter, int address,
/* Register a new directory entry with module sensors */
if ((i = i2c_register_entry((struct i2c_client *) new_client,
type_name,
vt8231_dir_table_template,
THIS_MODULE)) < 0) {
vt8231_dir_table_template)) < 0) {
err = i;
goto ERROR4;
}
@@ -402,11 +443,6 @@ static int vt8231_detach_client(struct i2c_client *client)
return 0;
}
static int vt8231_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static inline int vt_rdval(struct i2c_client *client, u8 reg)
{
+60 -17
View File
@@ -31,20 +31,19 @@
use w83627hf.c.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include "sensors_vid.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
#include "sensors_vid.h"
#ifndef I2C_DRIVERID_W83627HF
@@ -411,8 +410,6 @@ static int w83627hf_attach_adapter(struct i2c_adapter *adapter);
static int w83627hf_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int w83627hf_detach_client(struct i2c_client *client);
static int w83627hf_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int w83627hf_read_value(struct i2c_client *client, u16 register);
static int w83627hf_write_value(struct i2c_client *client, u16 register,
@@ -453,10 +450,63 @@ static struct i2c_driver w83627hf_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = w83627hf_attach_adapter,
.detach_client = w83627hf_detach_client,
.command = w83627hf_command,
};
/* The /proc/sys entries */
/* -- SENSORS SYSCTL START -- */
#define W83781D_SYSCTL_IN0 1000 /* Volts * 100 */
#define W83781D_SYSCTL_IN1 1001
#define W83781D_SYSCTL_IN2 1002
#define W83781D_SYSCTL_IN3 1003
#define W83781D_SYSCTL_IN4 1004
#define W83781D_SYSCTL_IN5 1005
#define W83781D_SYSCTL_IN6 1006
#define W83781D_SYSCTL_IN7 1007
#define W83781D_SYSCTL_IN8 1008
#define W83781D_SYSCTL_FAN1 1101 /* Rotations/min */
#define W83781D_SYSCTL_FAN2 1102
#define W83781D_SYSCTL_FAN3 1103
#define W83781D_SYSCTL_TEMP1 1200 /* Degrees Celcius * 10 */
#define W83781D_SYSCTL_TEMP2 1201 /* Degrees Celcius * 10 */
#define W83781D_SYSCTL_TEMP3 1202 /* Degrees Celcius * 10 */
#define W83781D_SYSCTL_VID 1300 /* Volts * 1000 */
#define W83781D_SYSCTL_VRM 1301
#define W83781D_SYSCTL_PWM1 1401
#define W83781D_SYSCTL_PWM2 1402
#define W83781D_SYSCTL_PWM3 1403
#define W83781D_SYSCTL_PWM4 1404
#define W83781D_SYSCTL_SENS1 1501 /* 1, 2, or Beta (3000-5000) */
#define W83781D_SYSCTL_SENS2 1502
#define W83781D_SYSCTL_SENS3 1503
#define W83781D_SYSCTL_RT1 1601 /* 32-entry table */
#define W83781D_SYSCTL_RT2 1602 /* 32-entry table */
#define W83781D_SYSCTL_RT3 1603 /* 32-entry table */
#define W83781D_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define W83781D_SYSCTL_ALARMS 2001 /* bitvector */
#define W83781D_SYSCTL_BEEP 2002 /* bitvector */
#define W83781D_ALARM_IN0 0x0001
#define W83781D_ALARM_IN1 0x0002
#define W83781D_ALARM_IN2 0x0004
#define W83781D_ALARM_IN3 0x0008
#define W83781D_ALARM_IN4 0x0100
#define W83781D_ALARM_IN5 0x0200
#define W83781D_ALARM_IN6 0x0400
#define W83782D_ALARM_IN7 0x10000
#define W83782D_ALARM_IN8 0x20000
#define W83781D_ALARM_FAN1 0x0040
#define W83781D_ALARM_FAN2 0x0080
#define W83781D_ALARM_FAN3 0x0800
#define W83781D_ALARM_TEMP1 0x0010
#define W83781D_ALARM_TEMP23 0x0020 /* 781D only */
#define W83781D_ALARM_TEMP2 0x0020 /* 782D/783S */
#define W83781D_ALARM_TEMP3 0x2000 /* 782D only */
#define W83781D_ALARM_CHAS 0x1000
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected chip. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -690,8 +740,7 @@ int w83627hf_detect(struct i2c_adapter *adapter, int address,
type_name,
(kind == w83697hf) ?
w83697hf_dir_table_template :
w83782d_isa_dir_table_template ,
THIS_MODULE)) < 0) {
w83782d_isa_dir_table_template)) < 0) {
err = i;
goto ERROR7;
}
@@ -733,12 +782,6 @@ static int w83627hf_detach_client(struct i2c_client *client)
return 0;
}
/* No commands defined yet */
static int w83627hf_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/*
ISA access must always be locked explicitly!
+175 -147
View File
@@ -34,20 +34,16 @@
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/sysctl.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include "version.h"
#include "sensors.h"
#include "sensors_vid.h"
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/errno.h>
#include <asm/io.h>
#include "version.h"
#include "sensors_vid.h"
/* RT Table support #defined so we can take it out if it gets bothersome */
#define W83781D_RT 1
@@ -370,8 +366,6 @@ static int w83781d_attach_adapter(struct i2c_adapter *adapter);
static int w83781d_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int w83781d_detach_client(struct i2c_client *client);
static int w83781d_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int w83781d_read_value(struct i2c_client *client, u16 register);
static int w83781d_write_value(struct i2c_client *client, u16 register,
@@ -417,10 +411,62 @@ static struct i2c_driver w83781d_driver = {
.flags = I2C_DF_NOTIFY,
.attach_adapter = w83781d_attach_adapter,
.detach_client = w83781d_detach_client,
.command = w83781d_command,
};
/* The /proc/sys entries */
/* -- SENSORS SYSCTL START -- */
#define W83781D_SYSCTL_IN0 1000 /* Volts * 100 */
#define W83781D_SYSCTL_IN1 1001
#define W83781D_SYSCTL_IN2 1002
#define W83781D_SYSCTL_IN3 1003
#define W83781D_SYSCTL_IN4 1004
#define W83781D_SYSCTL_IN5 1005
#define W83781D_SYSCTL_IN6 1006
#define W83781D_SYSCTL_IN7 1007
#define W83781D_SYSCTL_IN8 1008
#define W83781D_SYSCTL_FAN1 1101 /* Rotations/min */
#define W83781D_SYSCTL_FAN2 1102
#define W83781D_SYSCTL_FAN3 1103
#define W83781D_SYSCTL_TEMP1 1200 /* Degrees Celcius * 10 */
#define W83781D_SYSCTL_TEMP2 1201 /* Degrees Celcius * 10 */
#define W83781D_SYSCTL_TEMP3 1202 /* Degrees Celcius * 10 */
#define W83781D_SYSCTL_VID 1300 /* Volts * 1000 */
#define W83781D_SYSCTL_VRM 1301
#define W83781D_SYSCTL_PWM1 1401
#define W83781D_SYSCTL_PWM2 1402
#define W83781D_SYSCTL_PWM3 1403
#define W83781D_SYSCTL_PWM4 1404
#define W83781D_SYSCTL_SENS1 1501 /* 1, 2, or Beta (3000-5000) */
#define W83781D_SYSCTL_SENS2 1502
#define W83781D_SYSCTL_SENS3 1503
#define W83781D_SYSCTL_RT1 1601 /* 32-entry table */
#define W83781D_SYSCTL_RT2 1602 /* 32-entry table */
#define W83781D_SYSCTL_RT3 1603 /* 32-entry table */
#define W83781D_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define W83781D_SYSCTL_ALARMS 2001 /* bitvector */
#define W83781D_SYSCTL_BEEP 2002 /* bitvector */
#define W83781D_ALARM_IN0 0x0001
#define W83781D_ALARM_IN1 0x0002
#define W83781D_ALARM_IN2 0x0004
#define W83781D_ALARM_IN3 0x0008
#define W83781D_ALARM_IN4 0x0100
#define W83781D_ALARM_IN5 0x0200
#define W83781D_ALARM_IN6 0x0400
#define W83782D_ALARM_IN7 0x10000
#define W83782D_ALARM_IN8 0x20000
#define W83781D_ALARM_FAN1 0x0040
#define W83781D_ALARM_FAN2 0x0080
#define W83781D_ALARM_FAN3 0x0800
#define W83781D_ALARM_TEMP1 0x0010
#define W83781D_ALARM_TEMP23 0x0020 /* 781D only */
#define W83781D_ALARM_TEMP2 0x0020 /* 782D/783S */
#define W83781D_ALARM_TEMP3 0x2000 /* 782D only */
#define W83781D_ALARM_CHAS 0x1000
/* -- SENSORS SYSCTL END -- */
/* These files are created for each detected chip. This is just a template;
though at first sight, you might think we could use a statically
allocated list, we need some way to get back to the parent - which
@@ -733,8 +779,8 @@ static int w83781d_attach_adapter(struct i2c_adapter *adapter)
return i2c_detect(adapter, &addr_data, w83781d_detect);
}
int w83781d_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind)
static int w83781d_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind)
{
int i, val1 = 0, val2, id;
struct i2c_client *new_client;
@@ -750,10 +796,11 @@ int w83781d_detect(struct i2c_adapter *adapter, int address,
I2C_FUNC_SMBUS_BYTE_DATA)) goto
ERROR0;
if (is_isa) {
if (check_region(address, W83781D_EXTENT))
goto ERROR0;
}
if (is_isa) {
if (!request_region(address, W83781D_EXTENT, "w83781d"))
goto ERROR0;
release_region(address, W83781D_EXTENT);
}
/* Probe whether there is anything available on this address. Already
done for SMBus clients */
@@ -997,8 +1044,7 @@ int w83781d_detect(struct i2c_adapter *adapter, int address,
w83697hf_dir_table_template :
(is_isa || kind == w83627hf) ?
w83782d_isa_dir_table_template :
w83782d_i2c_dir_table_template,
THIS_MODULE)) < 0) {
w83782d_i2c_dir_table_template)) < 0) {
err = i;
goto ERROR7;
}
@@ -1069,14 +1115,7 @@ static int w83781d_detach_client(struct i2c_client *client)
return 0;
}
/* No commands defined yet */
static int w83781d_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
static u16 swap_bytes(u16 val)
static inline u16 swap_bytes(u16 val)
{
return (val >> 8) | (val << 8);
}
@@ -1438,125 +1477,114 @@ static void w83781d_init_client(struct i2c_client *client)
static void w83781d_update_client(struct i2c_client *client)
{
struct w83781d_data *data = client->data;
int i, j;
struct w83781d_data *data = client->data;
int i;
down(&data->update_lock);
down(&data->update_lock);
if ((jiffies - data->last_updated > HZ + HZ / 2) ||
(jiffies < data->last_updated) || !data->valid) {
if (time_after(jiffies - data->last_updated, HZ + HZ / 2) ||
time_before(jiffies, data->last_updated) || !data->valid) {
pr_debug(KERN_DEBUG "Starting device update\n");
#ifdef DEBUG
printk(KERN_DEBUG "Starting device update\n");
#endif
for (i = 0; i <= 8; i++) {
if ((data->type == w83783s || data->type == w83697hf)
&& (i == 1))
continue; /* 783S has no in1 */
data->in[i] =
w83781d_read_value(client, W83781D_REG_IN(i));
data->in_min[i] =
w83781d_read_value(client,
W83781D_REG_IN_MIN(i));
data->in_max[i] =
w83781d_read_value(client,
W83781D_REG_IN_MAX(i));
if ((data->type != w83782d) && (data->type != w83697hf)
&& (data->type != w83627hf) && (i == 6))
break;
}
/* PWM2 pin shared with FAN3 */
j = w83781d_read_value(client, W83781D_REG_BEEP_CONFIG) & 0x10;
data->pwmenable[1] = (!j) &&
(w83781d_read_value(client, W83781D_REG_PWMCLK12) & 0x08);
for (i = 1; i <= 3; i++) {
if(i == 3 && !j) {
data->fan[2] = 255;
data->fan_min[2] = 255;
break;
}
data->fan[i - 1] =
w83781d_read_value(client, W83781D_REG_FAN(i));
data->fan_min[i - 1] =
w83781d_read_value(client,
W83781D_REG_FAN_MIN(i));
}
if (data->type != w83781d) {
for (i = 1; i <= 4; i++) {
data->pwm[i - 1] =
w83781d_read_value(client,
W83781D_REG_PWM(i));
if (((data->type == w83783s)
|| (data->type == w83627hf)
|| (data->type == as99127f)
|| (data->type == w83697hf)
|| ((data->type == w83782d)
&& i2c_is_isa_client(client)))
&& i == 2)
break;
}
}
for (i = 0; i <= 8; i++) {
if ((data->type == w83783s || data->type == w83697hf)
&& (i == 1))
continue; /* 783S has no in1 */
data->in[i] =
w83781d_read_value(client, W83781D_REG_IN(i));
data->in_min[i] =
w83781d_read_value(client,
W83781D_REG_IN_MIN(i));
data->in_max[i] =
w83781d_read_value(client,
W83781D_REG_IN_MAX(i));
if ((data->type != w83782d) && (data->type != w83697hf)
&& (data->type != w83627hf) && (i == 6))
break;
}
for (i = 1; i <= 3; i++) {
data->fan[i - 1] =
w83781d_read_value(client, W83781D_REG_FAN(i));
data->fan_min[i - 1] =
w83781d_read_value(client,
W83781D_REG_FAN_MIN(i));
}
if (data->type != w83781d) {
for (i = 1; i <= 4; i++) {
data->pwm[i - 1] =
w83781d_read_value(client,
W83781D_REG_PWM(i));
if (((data->type == w83783s)
|| (data->type == w83627hf)
|| (data->type == as99127f)
|| (data->type == w83697hf)
|| ((data->type == w83782d)
&& i2c_is_isa_client(client)))
&& i == 2)
break;
}
}
data->temp = w83781d_read_value(client, W83781D_REG_TEMP);
data->temp_over =
w83781d_read_value(client, W83781D_REG_TEMP_OVER);
data->temp_hyst =
w83781d_read_value(client, W83781D_REG_TEMP_HYST);
data->temp_add[0] =
w83781d_read_value(client, W83781D_REG_TEMP2);
data->temp_add_over[0] =
w83781d_read_value(client, W83781D_REG_TEMP2_OVER);
data->temp_add_hyst[0] =
w83781d_read_value(client, W83781D_REG_TEMP2_HYST);
if (data->type != w83783s && data->type != w83697hf) {
data->temp_add[1] =
w83781d_read_value(client, W83781D_REG_TEMP3);
data->temp_add_over[1] =
w83781d_read_value(client, W83781D_REG_TEMP3_OVER);
data->temp_add_hyst[1] =
w83781d_read_value(client, W83781D_REG_TEMP3_HYST);
}
i = w83781d_read_value(client, W83781D_REG_VID_FANDIV);
if (data->type != w83697hf) {
data->vid = i & 0x0f;
data->vid |=
(w83781d_read_value(client, W83781D_REG_CHIPID) & 0x01)
<< 4;
}
data->fan_div[0] = (i >> 4) & 0x03;
data->fan_div[1] = (i >> 6) & 0x03;
if (data->type != w83697hf) {
data->fan_div[2] = (w83781d_read_value(client,
W83781D_REG_PIN) >> 6) & 0x03;
}
if ((data->type != w83781d) && (data->type != as99127f)) {
i = w83781d_read_value(client, W83781D_REG_VBAT);
data->fan_div[0] |= (i >> 3) & 0x04;
data->fan_div[1] |= (i >> 4) & 0x04;
if (data->type != w83697hf)
data->fan_div[2] |= (i >> 5) & 0x04;
}
data->alarms =
w83781d_read_value(client,
W83781D_REG_ALARM1) +
(w83781d_read_value(client, W83781D_REG_ALARM2) << 8);
if ((data->type == w83782d) || (data->type == w83627hf)) {
data->alarms |=
w83781d_read_value(client,
W83781D_REG_ALARM3) << 16;
}
i = w83781d_read_value(client, W83781D_REG_BEEP_INTS2);
data->beep_enable = i >> 7;
data->beeps = ((i & 0x7f) << 8) +
w83781d_read_value(client, W83781D_REG_BEEP_INTS1);
if ((data->type != w83781d) && (data->type != as99127f)) {
data->beeps |=
w83781d_read_value(client,
W83781D_REG_BEEP_INTS3) << 16;
}
data->last_updated = jiffies;
data->valid = 1;
}
data->temp = w83781d_read_value(client, W83781D_REG_TEMP);
data->temp_over =
w83781d_read_value(client, W83781D_REG_TEMP_OVER);
data->temp_hyst =
w83781d_read_value(client, W83781D_REG_TEMP_HYST);
data->temp_add[0] =
w83781d_read_value(client, W83781D_REG_TEMP2);
data->temp_add_over[0] =
w83781d_read_value(client, W83781D_REG_TEMP2_OVER);
data->temp_add_hyst[0] =
w83781d_read_value(client, W83781D_REG_TEMP2_HYST);
if (data->type != w83783s && data->type != w83697hf) {
data->temp_add[1] =
w83781d_read_value(client, W83781D_REG_TEMP3);
data->temp_add_over[1] =
w83781d_read_value(client, W83781D_REG_TEMP3_OVER);
data->temp_add_hyst[1] =
w83781d_read_value(client, W83781D_REG_TEMP3_HYST);
}
i = w83781d_read_value(client, W83781D_REG_VID_FANDIV);
if (data->type != w83697hf) {
data->vid = i & 0x0f;
data->vid |=
(w83781d_read_value(client, W83781D_REG_CHIPID) & 0x01)
<< 4;
}
data->fan_div[0] = (i >> 4) & 0x03;
data->fan_div[1] = (i >> 6) & 0x03;
if (data->type != w83697hf) {
data->fan_div[2] = (w83781d_read_value(client,
W83781D_REG_PIN) >> 6) & 0x03;
}
if ((data->type != w83781d) && (data->type != as99127f)) {
i = w83781d_read_value(client, W83781D_REG_VBAT);
data->fan_div[0] |= (i >> 3) & 0x04;
data->fan_div[1] |= (i >> 4) & 0x04;
if (data->type != w83697hf)
data->fan_div[2] |= (i >> 5) & 0x04;
}
data->alarms =
w83781d_read_value(client,
W83781D_REG_ALARM1) +
(w83781d_read_value(client, W83781D_REG_ALARM2) << 8);
if ((data->type == w83782d) || (data->type == w83627hf)) {
data->alarms |=
w83781d_read_value(client,
W83781D_REG_ALARM3) << 16;
}
i = w83781d_read_value(client, W83781D_REG_BEEP_INTS2);
data->beep_enable = i >> 7;
data->beeps = ((i & 0x7f) << 8) +
w83781d_read_value(client, W83781D_REG_BEEP_INTS1);
if ((data->type != w83781d) && (data->type != as99127f)) {
data->beeps |=
w83781d_read_value(client,
W83781D_REG_BEEP_INTS3) << 16;
}
data->last_updated = jiffies;
data->valid = 1;
}
up(&data->update_lock);
}
@@ -1575,8 +1603,8 @@ static void w83781d_update_client(struct i2c_client *client)
large enough (by checking the incoming value of *nrels). This is not very
good practice, but as long as you put less than about 5 values in results,
you can assume it is large enough. */
void w83781d_in(struct i2c_client *client, int operation, int ctl_name,
int *nrels_mag, long *results)
static void w83781d_in(struct i2c_client *client, int operation, int ctl_name,
int *nrels_mag, long *results)
{
struct w83781d_data *data = client->data;
int nr = ctl_name - W83781D_SYSCTL_IN0;
@@ -1974,8 +2002,8 @@ void w83781d_sens(struct i2c_client *client, int operation, int ctl_name,
}
#ifdef W83781D_RT
void w83781d_rt(struct i2c_client *client, int operation, int ctl_name,
int *nrels_mag, long *results)
static void w83781d_rt(struct i2c_client *client, int operation, int ctl_name,
int *nrels_mag, long *results)
{
struct w83781d_data *data = client->data;
int nr = 1 + ctl_name - W83781D_SYSCTL_RT1;
-4
View File
@@ -25,10 +25,6 @@ KERNELINCLUDEFILES :=
ifneq ($(shell if grep -q '^CONFIG_SENSORS=y' $(LINUX)/.config; then echo 1; fi),1)
KERNELINCLUDEFILES += $(MODULE_DIR)/sensors.h
endif
# No longer used, part of <linux/i2c.h>
#ifneq ($(shell if grep -q '^CONFIG_I2C_ISA=y' $(LINUX)/.config; then echo 1; fi),1)
#KERNELINCLUDEFILES += $(MODULE_DIR)/i2c-isa.h
#endif
install-all-kernel-include:
if [ -n "$(KERNELINCLUDEFILES)" ] ; then \
+361
View File
@@ -0,0 +1,361 @@
/*
i2c-dev.h - i2c-bus driver, char device interface
Copyright (C) 1995-97 Simon G. Vogl
Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id$ */
#ifndef LIB_I2CDEV_H
#define LIB_I2CDEV_H
#include <linux/types.h>
#include <sys/ioctl.h>
/* -- i2c.h -- */
/*
* I2C Message - used for pure i2c transaction, also from /dev interface
*/
struct i2c_msg {
__u16 addr; /* slave address */
unsigned short flags;
#define I2C_M_TEN 0x10 /* we have a ten bit chip address */
#define I2C_M_RD 0x01
#define I2C_M_NOSTART 0x4000
#define I2C_M_REV_DIR_ADDR 0x2000
#define I2C_M_IGNORE_NAK 0x1000
#define I2C_M_NO_RD_ACK 0x0800
short len; /* msg length */
char *buf; /* pointer to msg data */
int err;
short done;
};
/* To determine what functionality is present */
#define I2C_FUNC_I2C 0x00000001
#define I2C_FUNC_10BIT_ADDR 0x00000002
#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */
#define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_READ_WORD_DATA_PEC 0x00000800 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_WRITE_WORD_DATA_PEC 0x00001000 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_PROC_CALL_PEC 0x00002000 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL_PEC 0x00004000 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_QUICK 0x00010000
#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000
#define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000
#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000
#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000
#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000
#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000
#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000
#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */
#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */
#define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */
#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2 0x20000000 /* w/ 2-byte reg. addr. */
#define I2C_FUNC_SMBUS_READ_BLOCK_DATA_PEC 0x40000000 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC 0x80000000 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_BYTE I2C_FUNC_SMBUS_READ_BYTE | \
I2C_FUNC_SMBUS_WRITE_BYTE
#define I2C_FUNC_SMBUS_BYTE_DATA I2C_FUNC_SMBUS_READ_BYTE_DATA | \
I2C_FUNC_SMBUS_WRITE_BYTE_DATA
#define I2C_FUNC_SMBUS_WORD_DATA I2C_FUNC_SMBUS_READ_WORD_DATA | \
I2C_FUNC_SMBUS_WRITE_WORD_DATA
#define I2C_FUNC_SMBUS_BLOCK_DATA I2C_FUNC_SMBUS_READ_BLOCK_DATA | \
I2C_FUNC_SMBUS_WRITE_BLOCK_DATA
#define I2C_FUNC_SMBUS_I2C_BLOCK I2C_FUNC_SMBUS_READ_I2C_BLOCK | \
I2C_FUNC_SMBUS_WRITE_I2C_BLOCK
#define I2C_FUNC_SMBUS_I2C_BLOCK_2 I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \
I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2
#define I2C_FUNC_SMBUS_BLOCK_DATA_PEC I2C_FUNC_SMBUS_READ_BLOCK_DATA_PEC | \
I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC
#define I2C_FUNC_SMBUS_WORD_DATA_PEC I2C_FUNC_SMBUS_READ_WORD_DATA_PEC | \
I2C_FUNC_SMBUS_WRITE_WORD_DATA_PEC
#define I2C_FUNC_SMBUS_READ_BYTE_PEC I2C_FUNC_SMBUS_READ_BYTE_DATA
#define I2C_FUNC_SMBUS_WRITE_BYTE_PEC I2C_FUNC_SMBUS_WRITE_BYTE_DATA
#define I2C_FUNC_SMBUS_READ_BYTE_DATA_PEC I2C_FUNC_SMBUS_READ_WORD_DATA
#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA_PEC I2C_FUNC_SMBUS_WRITE_WORD_DATA
#define I2C_FUNC_SMBUS_BYTE_PEC I2C_FUNC_SMBUS_BYTE_DATA
#define I2C_FUNC_SMBUS_BYTE_DATA_PEC I2C_FUNC_SMBUS_WORD_DATA
#define I2C_FUNC_SMBUS_EMUL I2C_FUNC_SMBUS_QUICK | \
I2C_FUNC_SMBUS_BYTE | \
I2C_FUNC_SMBUS_BYTE_DATA | \
I2C_FUNC_SMBUS_WORD_DATA | \
I2C_FUNC_SMBUS_PROC_CALL | \
I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \
I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC | \
I2C_FUNC_SMBUS_I2C_BLOCK
/*
* Data for SMBus Messages
*/
#define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */
#define I2C_SMBUS_I2C_BLOCK_MAX 32 /* Not specified but we use same structure */
union i2c_smbus_data {
__u8 byte;
__u16 word;
__u8 block[I2C_SMBUS_BLOCK_MAX + 3]; /* block[0] is used for length */
/* one more for read length in block process call */
/* and one more for PEC */
};
/* smbus_access read or write markers */
#define I2C_SMBUS_READ 1
#define I2C_SMBUS_WRITE 0
/* SMBus transaction types (size parameter in the above functions)
Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */
#define I2C_SMBUS_QUICK 0
#define I2C_SMBUS_BYTE 1
#define I2C_SMBUS_BYTE_DATA 2
#define I2C_SMBUS_WORD_DATA 3
#define I2C_SMBUS_PROC_CALL 4
#define I2C_SMBUS_BLOCK_DATA 5
#define I2C_SMBUS_I2C_BLOCK_DATA 6
#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */
#define I2C_SMBUS_BLOCK_DATA_PEC 8 /* SMBus 2.0 */
#define I2C_SMBUS_PROC_CALL_PEC 9 /* SMBus 2.0 */
#define I2C_SMBUS_BLOCK_PROC_CALL_PEC 10 /* SMBus 2.0 */
#define I2C_SMBUS_WORD_DATA_PEC 11 /* SMBus 2.0 */
/* ----- commands for the ioctl like i2c_command call:
* note that additional calls are defined in the algorithm and hw
* dependent layers - these can be listed here, or see the
* corresponding header files.
*/
/* -> bit-adapter specific ioctls */
#define I2C_RETRIES 0x0701 /* number of times a device address */
/* should be polled when not */
/* acknowledging */
#define I2C_TIMEOUT 0x0702 /* set timeout - call with int */
/* this is for i2c-dev.c */
#define I2C_SLAVE 0x0703 /* Change slave address */
/* Attn.: Slave address is 7 or 10 bits */
#define I2C_SLAVE_FORCE 0x0706 /* Change slave address */
/* Attn.: Slave address is 7 or 10 bits */
/* This changes the address, even if it */
/* is already taken! */
#define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
#define I2C_FUNCS 0x0705 /* Get the adapter functionality */
#define I2C_RDWR 0x0707 /* Combined R/W transfer (one stop only)*/
#define I2C_PEC 0x0708 /* != 0 for SMBus PEC */
#if 0
#define I2C_ACK_TEST 0x0710 /* See if a slave is at a specific address */
#endif
#define I2C_SMBUS 0x0720 /* SMBus-level access */
/* -- i2c.h -- */
/* Note: 10-bit addresses are NOT supported! */
/* This is the structure as used in the I2C_SMBUS ioctl call */
struct i2c_smbus_ioctl_data {
char read_write;
__u8 command;
int size;
union i2c_smbus_data *data;
};
/* This is the structure as used in the I2C_RDWR ioctl call */
struct i2c_rdwr_ioctl_data {
struct i2c_msg *msgs; /* pointers to i2c_msgs */
int nmsgs; /* number of i2c_msgs */
};
static inline __s32 i2c_smbus_access(int file, char read_write, __u8 command,
int size, union i2c_smbus_data *data)
{
struct i2c_smbus_ioctl_data args;
args.read_write = read_write;
args.command = command;
args.size = size;
args.data = data;
return ioctl(file,I2C_SMBUS,&args);
}
static inline __s32 i2c_smbus_write_quick(int file, __u8 value)
{
return i2c_smbus_access(file,value,0,I2C_SMBUS_QUICK,NULL);
}
static inline __s32 i2c_smbus_read_byte(int file)
{
union i2c_smbus_data data;
if (i2c_smbus_access(file,I2C_SMBUS_READ,0,I2C_SMBUS_BYTE,&data))
return -1;
else
return 0x0FF & data.byte;
}
static inline __s32 i2c_smbus_write_byte(int file, __u8 value)
{
return i2c_smbus_access(file,I2C_SMBUS_WRITE,value,
I2C_SMBUS_BYTE,NULL);
}
static inline __s32 i2c_smbus_read_byte_data(int file, __u8 command)
{
union i2c_smbus_data data;
if (i2c_smbus_access(file,I2C_SMBUS_READ,command,
I2C_SMBUS_BYTE_DATA,&data))
return -1;
else
return 0x0FF & data.byte;
}
static inline __s32 i2c_smbus_write_byte_data(int file, __u8 command,
__u8 value)
{
union i2c_smbus_data data;
data.byte = value;
return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
I2C_SMBUS_BYTE_DATA, &data);
}
static inline __s32 i2c_smbus_read_word_data(int file, __u8 command)
{
union i2c_smbus_data data;
if (i2c_smbus_access(file,I2C_SMBUS_READ,command,
I2C_SMBUS_WORD_DATA,&data))
return -1;
else
return 0x0FFFF & data.word;
}
static inline __s32 i2c_smbus_write_word_data(int file, __u8 command,
__u16 value)
{
union i2c_smbus_data data;
data.word = value;
return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
I2C_SMBUS_WORD_DATA, &data);
}
static inline __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value)
{
union i2c_smbus_data data;
data.word = value;
if (i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
I2C_SMBUS_PROC_CALL,&data))
return -1;
else
return 0x0FFFF & data.word;
}
/* Returns the number of read bytes */
static inline __s32 i2c_smbus_read_block_data(int file, __u8 command,
__u8 *values)
{
union i2c_smbus_data data;
int i;
if (i2c_smbus_access(file,I2C_SMBUS_READ,command,
I2C_SMBUS_BLOCK_DATA,&data))
return -1;
else {
for (i = 1; i <= data.block[0]; i++)
values[i-1] = data.block[i];
return data.block[0];
}
}
static inline __s32 i2c_smbus_write_block_data(int file, __u8 command,
__u8 length, __u8 *values)
{
union i2c_smbus_data data;
int i;
if (length > 32)
length = 32;
for (i = 1; i <= length; i++)
data.block[i] = values[i-1];
data.block[0] = length;
return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
I2C_SMBUS_BLOCK_DATA, &data);
}
/* Returns the number of read bytes */
static inline __s32 i2c_smbus_read_i2c_block_data(int file, __u8 command,
__u8 *values)
{
union i2c_smbus_data data;
int i;
if (i2c_smbus_access(file,I2C_SMBUS_READ,command,
I2C_SMBUS_I2C_BLOCK_DATA,&data))
return -1;
else {
for (i = 1; i <= data.block[0]; i++)
values[i-1] = data.block[i];
return data.block[0];
}
}
static inline __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command,
__u8 length, __u8 *values)
{
union i2c_smbus_data data;
int i;
if (length > 32)
length = 32;
for (i = 1; i <= length; i++)
data.block[i] = values[i-1];
data.block[0] = length;
return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
I2C_SMBUS_I2C_BLOCK_DATA, &data);
}
/* Returns the number of read bytes */
static inline __s32 i2c_smbus_block_process_call(int file, __u8 command,
__u8 length, __u8 *values)
{
union i2c_smbus_data data;
int i;
if (length > 32)
length = 32;
for (i = 1; i <= length; i++)
data.block[i] = values[i-1];
data.block[0] = length;
if (i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
I2C_SMBUS_BLOCK_PROC_CALL,&data))
return -1;
else {
for (i = 1; i <= data.block[0]; i++)
values[i-1] = data.block[i];
return data.block[0];
}
}
#endif /* LIB_I2CDEV_H */
-38
View File
@@ -1,38 +0,0 @@
/*
i2c-isa.h - Part of lm_sensors, Linux kernel modules for hardware
monitoring
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef SENSORS_SENSORS_ISA_H
#define SENSORS_SENSORS_ISA_H
#ifdef __KERNEL__
#include <linux/i2c.h>
/* Detect whether we are on the isa bus. If this returns true, all i2c
access will fail! */
#define i2c_is_isa_client(clientptr) \
((clientptr)->adapter->algo->id == I2C_ALGO_ISA)
#define i2c_is_isa_adapter(adapptr) \
((adapptr)->algo->id == I2C_ALGO_ISA)
#endif /* def __KERNEL__ */
#endif /* ndef SENSORS_ISA_H */
+33 -4
View File
@@ -18,10 +18,39 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef SENSORS_NSENSORS_H
#define SENSORS_NSENSORS_H
#ifndef LIB_SENSORS_H
#define LIB_SENSORS_H
#include <linux/i2c-proc.h>
/* In spite of current location in CVS, this file is intended
to be included from userland utilities only. --km */
/* From linux/i2c-proc.h */
/* Sysctl IDs */
#ifdef DEV_HWMON
#define DEV_SENSORS DEV_HWMON
#else /* ndef DEV_HWMOM */
#define DEV_SENSORS 2 /* The id of the lm_sensors directory within the
dev table */
#endif /* def DEV_HWMON */
/* The maximum length of the prefix */
#define SENSORS_PREFIX_MAX 20
#define SENSORS_CHIPS 1
struct i2c_chips_data {
int sysctl_id;
char name[SENSORS_PREFIX_MAX + 13];
};
/* This file should be automatically generated from the sysctl enumerations
found in chips/*.c. At release time, diff againts previous release to make
sure we maintain binary compatibility of userland utilities that include
this file. --km */
/* I think we should remove the chip prefix on entries below. --km */
#define LM78_SYSCTL_IN0 1000 /* Volts * 100 */
#define LM78_SYSCTL_IN1 1001
@@ -690,4 +719,4 @@
#define BMC_SYSCTL_ALARMS 5000
#endif /* def SENSORS_SENSORS_H */
#endif /* def LIB_SENSORS_H */
+1 -3
View File
@@ -37,9 +37,7 @@
#define DEFAULT_VRM 82
static int vid_from_reg(int val, int vrm);
static int vid_from_reg(int val, int vrm)
static inline int vid_from_reg(int val, int vrm)
{
switch(vrm) {
-1
View File
@@ -21,7 +21,6 @@
#include <stdio.h>
#include <string.h>
#include <sys/sysctl.h>
#include <linux/sysctl.h>
#include "kernel/include/sensors.h"
#include "data.h"
#include "error.h"
-1
View File
@@ -1,4 +1,3 @@
"dmi_scan.h" <linux/dmi_scan.h>
"i2c-isa.h" <linux/i2c-isa.h>
"sensors.h" <linux/sensors.h>
"sensors_vid.h" <linux/sensors_vid.h>
+1 -1
View File
@@ -25,7 +25,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/i2c-dev.h>
#include "i2c-dev.h"
void help(void)
{
+1 -1
View File
@@ -24,7 +24,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/i2c-dev.h>
#include "i2c-dev.h"
/*
We don't use this #define but it was put into i2c.h at the same time as
+1 -1
View File
@@ -24,7 +24,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/i2c-dev.h>
#include "i2c-dev.h"
void help(void)
{
+1 -1
View File
@@ -9,7 +9,7 @@ Of course the program is provided without warranty of any kind.
#include <fcntl.h>
#include <string.h>
#include <time.h>
#include <linux/i2c-dev.h>
#include "i2c-dev.h"
/*
this program can read 24C16 (and probably smaller ones, too)
+1 -1
View File
@@ -4,8 +4,8 @@
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/i2c-dev.h>
#include <time.h>
#include "i2c-dev.h"
#define MAX_BLK_SIZE 64