Commit 6898c902 authored by Pavel Machek's avatar Pavel Machek Committed by Linus Torvalds

[PATCH] amd756 and amd8111 sensors support

Add support for amd756 and amd8111 sensors
parent 90b8e1ed
......@@ -762,6 +762,15 @@ L: linux-i2c@pelican.tk.uni-linz.ac.at
W: http://www.tk.uni-linz.ac.at/~simon/private/i2c
S: Maintained
SENSORS DRIVERS
P: Frodo Looijaard
M: frodol@dds.nl
P: Philip Edelbrock
M: phil@netroedge.com
L: sensors@stimpy.netroedge.com
W: http://www.lm-sensors.nu/
S: Maintained
i386 BOOT CODE
P: Riley H. Williams
M: Riley@Williams.Name
......
......@@ -38,6 +38,8 @@ obj-$(CONFIG_GAMEPORT) += input/gameport/
obj-$(CONFIG_SERIO) += input/serio/
obj-$(CONFIG_I2O) += message/
obj-$(CONFIG_I2C) += i2c/
obj-$(CONFIG_I2C_MAINBOARD) += i2c/busses/
obj-$(CONFIG_SENSORS) += i2c/chips/
obj-$(CONFIG_PHONE) += telephony/
obj-$(CONFIG_MD) += md/
obj-$(CONFIG_BT) += bluetooth/
......
......@@ -27,6 +27,12 @@
#include <asm/io.h>
#include <asm/pgalloc.h>
#ifdef CONFIG_I2C_MAINBOARD
extern void i2c_mainboard_init_all(void);
#endif
#ifdef CONFIG_SENSORS
extern void sensors_init_all(void);
#endif
#ifdef CONFIG_I2C
extern int i2c_init_all(void);
#endif
......@@ -705,6 +711,9 @@ int __init chr_dev_init(void)
#ifdef CONFIG_I2C
i2c_init_all();
#endif
#ifdef CONFIG_I2C_MAINBOARD
i2c_mainboard_init_all();
#endif
#if defined (CONFIG_FB)
fbmem_init();
#endif
......@@ -719,6 +728,10 @@ int __init chr_dev_init(void)
#if defined(CONFIG_S390_TAPE) && defined(CONFIG_S390_TAPE_CHAR)
tapechar_init();
#endif
#ifdef CONFIG_SENSORS
sensors_init_all();
#endif
return 0;
}
......
......@@ -193,5 +193,8 @@ config I2C_PROC
it as a module, say M here and read <file:Documentation/modules.txt>.
The module will be called i2c-proc.o.
source drivers/i2c/busses/Kconfig
source drivers/i2c/chips/Kconfig
endmenu
#
# Sensor device configuration
# All depend on EXPERIMENTAL, I2C and I2C_PROC.
#
menu "I2C Hardware Sensors Mainboard support"
config I2C_MAINBOARD
bool "Hardware sensors mainboard support"
depends on EXPERIMENTAL && I2C && I2C_PROC
help
Many modern mainboards have some kind of I2C interface integrated. This
is often in the form of a SMBus, or System Management Bus, which is
basically the same as I2C but which uses only a subset of the I2C
protocol.
You will also want the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config I2C_AMD756
tristate " AMD 756/766"
depends on I2C_MAINBOARD
help
If you say yes to this option, support will be included for the AMD
756/766/768 mainboard I2C interfaces.
This can also be built as a module which can be inserted and removed
while the kernel is running. If you want to compile it as a module,
say M here and read <file:Documentation/modules.txt>.
The module will be called i2c-amd756.o.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config I2C_AMD8111
tristate " AMD 8111"
depends on I2C_MAINBOARD
help
If you say yes to this option, support will be included for the AMD
8111 mainboard I2C interfaces.
This can also be built as a module which can be inserted and removed
while the kernel is running. If you want to compile it as a module,
say M here and read <file:Documentation/modules.txt>.
The module will be called i2c-amd8111.o.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
endmenu
#
# Makefile for the kernel hardware sensors bus drivers.
#
obj-$(CONFIG_I2C_MAINBOARD) += i2c-mainboard.o
obj-$(CONFIG_I2C_AMD756) += i2c-amd756.o
obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o
This diff is collapsed.
This diff is collapsed.
/*
i2c-mainboard.c - Part of lm_sensors, Linux kernel modules for hardware
monitoring
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* Not configurable as a module */
#include <linux/init.h>
extern int i2c_amd756_init(void);
int __init i2c_mainboard_init_all(void)
{
#ifdef CONFIG_I2C_AMD756
i2c_amd756_init();
#endif
return 0;
}
#
# Sensor device configuration
# All depend on EXPERIMENTAL, I2C and I2C_PROC.
#
menu "I2C Hardware Sensors Chip support"
config SENSORS
bool "Hardware sensors chip support"
depends on EXPERIMENTAL && I2C && I2C_PROC
help
Many modern mainboards have some kind of I2C interface integrated.
This is often in the form of a SMBus, or System Management Bus, which
is basically the same as I2C but which uses only a subset of the I2C
protocol.
You will also want the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config SENSORS_ADM1021
tristate " Analog Devices ADM1021 and compatibles"
depends on SENSORS
help
If you say yes here you get support for Analog Devices ADM1021
and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A,
Genesys Logic GL523SM, National Semi LM84, TI THMC10,
and the XEON processor built-in sensor. This can also
be built as a module which can be inserted and removed while the
kernel is running.
The module will be called adm1021.o.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config SENSORS_LM75
tristate " National Semiconductors LM75 and compatibles"
depends on SENSORS
help
If you say yes here you get support for National Semiconductor LM75
sensor chips and clones: Dallas Semi DS75 and DS1775, TelCon
TCN75, and National Semi LM77. This can also be built as a module
which can be inserted and removed while the kernel is running.
The module will be called lm75.o.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
endmenu
#
# Makefile for the kernel hardware sensors chip drivers.
#
obj-$(CONFIG_SENSORS) += sensors.o
obj-$(CONFIG_SENSORS_ADM1021) += adm1021.o
obj-$(CONFIG_SENSORS_LM75) += lm75.o
This diff is collapsed.
This diff is collapsed.
/*
sensors.c - Part of lm_sensors, Linux kernel modules for hardware
monitoring
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* Not configurable as a module */
#include <linux/init.h>
extern int sensors_adm1021_init(void);
extern int sensors_lm75_init(void);
int __init sensors_init_all(void)
{
#ifdef CONFIG_SENSORS_ADM1021
sensors_adm1021_init();
#endif
#ifdef CONFIG_SENSORS_LM75
sensors_lm75_init();
#endif
return 0;
}
......@@ -21,7 +21,7 @@
All SMBus-related things are written by Frodo Looijaard <frodol@dds.nl>
SMBus 2.0 support by Mark Studebaker <mdsxyz123@yahoo.com> */
/* $Id: i2c-core.c,v 1.86 2002/09/12 06:47:26 ac9410 Exp $ */
/* $Id: i2c-core.c,v 1.89 2002/11/03 16:47:16 mds Exp $ */
#include <linux/module.h>
#include <linux/kernel.h>
......@@ -77,7 +77,8 @@ static int i2c_debug;
#ifdef CONFIG_PROC_FS
static int i2cproc_init(void);
int __init i2cproc_init(void);
void __exit i2cproc_exit(void);
static int i2cproc_cleanup(void);
static ssize_t i2cproc_bus_read(struct file * file, char * buf,size_t count,
......@@ -1332,15 +1333,15 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
if (read_write == I2C_SMBUS_READ) {
msg[1].len = I2C_SMBUS_I2C_BLOCK_MAX;
} else {
msg[0].len = data->block[0] + 2;
if (msg[0].len > I2C_SMBUS_I2C_BLOCK_MAX + 2) {
msg[0].len = data->block[0] + 1;
if (msg[0].len > I2C_SMBUS_I2C_BLOCK_MAX + 1) {
printk("i2c-core.o: i2c_smbus_xfer_emulated called with "
"invalid block write size (%d)\n",
data->block[0]);
return -1;
}
for (i = 0; i < data->block[0]; i++)
msgbuf0[i] = data->block[i+1];
for (i = 1; i <= data->block[0]; i++)
msgbuf0[i] = data->block[i];
}
break;
default:
......@@ -1456,7 +1457,7 @@ static int __init i2c_init(void)
return 0;
}
static void __exit i2c_exit(void)
void __exit i2c_exit(void)
{
i2cproc_cleanup();
}
......
......@@ -28,7 +28,7 @@
/* The devfs code is contributed by Philipp Matthias Hahn
<pmhahn@titan.lahn.de> */
/* $Id: i2c-dev.c,v 1.46 2002/07/06 02:07:39 mds Exp $ */
/* $Id: i2c-dev.c,v 1.48 2002/10/01 14:10:04 ac9410 Exp $ */
#include <linux/config.h>
#include <linux/kernel.h>
......@@ -48,6 +48,10 @@
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
int __init i2c_dev_init(void);
void __exit i2c_dev_exit(void);
static int dev_cleanup(void);
/* struct file_operations changed too often in the 2.1 series for nice code */
static ssize_t i2cdev_read (struct file *file, char *buf, size_t count,
......@@ -433,7 +437,7 @@ static int i2cdev_command(struct i2c_client *client, unsigned int cmd,
return -1;
}
static void i2cdev_cleanup(void)
static int dev_cleanup(void)
{
int res;
......@@ -467,6 +471,11 @@ int __init i2c_dev_init(void)
return 0;
}
void __exit i2c_dev_exit(void)
{
dev_cleanup();
}
EXPORT_NO_SYMBOLS;
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl> and Simon G. Vogl <simon@tk.uni-linz.ac.at>");
......@@ -474,4 +483,4 @@ MODULE_DESCRIPTION("I2C /dev entries driver");
MODULE_LICENSE("GPL");
module_init(i2c_dev_init);
module_exit(i2cdev_cleanup);
module_exit(i2c_dev_exit);
......@@ -40,6 +40,10 @@
#define THIS_MODULE NULL
#endif
int __init sensors_init(void);
void __exit i2c_proc_exit(void);
static int proc_cleanup(void);
static int i2c_create_name(char **name, const char *prefix,
struct i2c_adapter *adapter, int addr);
static int i2c_parse_reals(int *nrels, void *buffer, int bufsize,
......@@ -56,6 +60,7 @@ static int i2c_sysctl_chips(ctl_table * table, int *name, int nlen,
#define SENSORS_ENTRY_MAX 20
static struct ctl_table_header *i2c_entries[SENSORS_ENTRY_MAX];
static unsigned short i2c_inodes[SENSORS_ENTRY_MAX];
static struct i2c_client *i2c_clients[SENSORS_ENTRY_MAX];
......@@ -186,6 +191,8 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix,
return id;
}
#endif /* DEBUG */
i2c_inodes[id - 256] =
new_header->ctl_table->child->child->de->low_ino;
new_header->ctl_table->child->child->de->owner = controlling_mod;
return id;
......@@ -208,6 +215,49 @@ void i2c_deregister_entry(int id)
}
}
/* Monitor access for /proc/sys/dev/sensors; make unloading i2c-proc.o
impossible if some process still uses it or some file in it */
void i2c_fill_inode(struct inode *inode, int fill)
{
if (fill)
MOD_INC_USE_COUNT;
else
MOD_DEC_USE_COUNT;
}
/* Monitor access for /proc/sys/dev/sensors/ directories; make unloading
the corresponding module impossible if some process still uses it or
some file in it */
void i2c_dir_fill_inode(struct inode *inode, int fill)
{
int i;
struct i2c_client *client;
#ifdef DEBUG
if (!inode) {
printk(KERN_ERR "i2c-proc.o: Warning: inode NULL in fill_inode()\n");
return;
}
#endif /* def DEBUG */
for (i = 0; i < SENSORS_ENTRY_MAX; i++)
if (i2c_clients[i]
&& (i2c_inodes[i] == inode->i_ino)) break;
#ifdef DEBUG
if (i == SENSORS_ENTRY_MAX) {
printk
(KERN_ERR "i2c-proc.o: Warning: inode (%ld) not found in fill_inode()\n",
inode->i_ino);
return;
}
#endif /* def DEBUG */
client = i2c_clients[i];
if (fill)
client->driver->inc_use(client);
else
client->driver->dec_use(client);
}
int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp,
void *buffer, size_t * lenp)
{
......@@ -813,12 +863,18 @@ int __init sensors_init(void)
return 0;
}
static void __exit i2c_cleanup(void)
void __exit i2c_proc_exit(void)
{
proc_cleanup();
}
static int proc_cleanup(void)
{
if (i2c_initialized >= 1) {
unregister_sysctl_table(i2c_proc_header);
i2c_initialized--;
}
return 0;
}
EXPORT_SYMBOL(i2c_deregister_entry);
......@@ -832,4 +888,4 @@ MODULE_DESCRIPTION("i2c-proc driver");
MODULE_LICENSE("GPL");
module_init(sensors_init);
module_exit(i2c_cleanup);
module_exit(i2c_proc_exit);
......@@ -233,6 +233,7 @@
#define I2C_HW_SMBUS_ALI1535 0x07
#define I2C_HW_SMBUS_SIS630 0x08
#define I2C_HW_SMBUS_SIS645 0x09
#define I2C_HW_SMBUS_AMD8111 0x0a
/* --- ISA pseudo-adapter */
#define I2C_HW_ISA 0x00
......
......@@ -348,6 +348,31 @@ struct i2c_address_data {
{NULL}}; \
SENSORS_INSMOD
#define SENSORS_INSMOD_8(chip1,chip2,chip3,chip4,chip5,chip6,chip7,chip8) \
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8 }; \
SENSORS_MODULE_PARM(force, \
"List of adapter,address pairs to boldly assume " \
"to be present"); \
SENSORS_MODULE_PARM_FORCE(chip1); \
SENSORS_MODULE_PARM_FORCE(chip2); \
SENSORS_MODULE_PARM_FORCE(chip3); \
SENSORS_MODULE_PARM_FORCE(chip4); \
SENSORS_MODULE_PARM_FORCE(chip5); \
SENSORS_MODULE_PARM_FORCE(chip6); \
SENSORS_MODULE_PARM_FORCE(chip7); \
SENSORS_MODULE_PARM_FORCE(chip8); \
static struct i2c_force_data forces[] = {{force,any_chip}, \
{force_ ## chip1,chip1}, \
{force_ ## chip2,chip2}, \
{force_ ## chip3,chip3}, \
{force_ ## chip4,chip4}, \
{force_ ## chip5,chip5}, \
{force_ ## chip6,chip6}, \
{force_ ## chip7,chip7}, \
{force_ ## chip8,chip8}, \
{NULL}}; \
SENSORS_INSMOD
typedef int i2c_found_addr_proc(struct i2c_adapter *adapter,
int addr, unsigned short flags,
int kind);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment