LM78 insmod parameters and better detection

Supported insmod parameters:
  ignore, ignore_range
  probe, probe_range
  force, force_lm78, force_lm78j, force_lm79

force* overrules ignore* overrules probe*

The *_range parameters need three elements for each specification:
  bus,start_addr,end_addr
The address ranges are inclusive.
The other parameters need two elements for each specification:
  bus,addr
In each case, '-1' stands for 'any I2C bus', and 9191 stands for
'the ISA bus' (Bonus question: who can figure out why I choose 9191?)
In each case, just append if you want several specification, for example:
  insmod lm78 probe=9191,0x2a0,1,0x56

force_* does no detection, not even chip detection; it blindly assumes
you know what you are doing. plain force does the chip detection, but
nothing else; but it can still fail if the register read-out does not
match a chip type.

Detection is done in exactly the same way as sensors-detect, except that
only the range 0x20-0x2f is examined by default. This needs to be
synchronized somehow with the detect script. I would rather scan the whole
I2C address range, but with those clueless PIIX4 hangs when clock chips
are read, that would simply give too much trouble.

The detect script has slightly better ISA detection now, too.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@325 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Frodo Looijaard committed 1999-03-19 06:25:02 +00:00
1 parent 7e8c43e6b6
commit b4b1293b25
4 files changed
+293 -288

No files matched your search

+99 -5
View File
@@ -160,16 +160,110 @@ struct sensors_address_data {
/* The length of the option lists */
#define SENSORS_MAX_OPTS 48
typedef void sensors_found_addr_proc (struct i2c_adapter *adapter,
int addr, int kind);
/* Default fill of many variables */
#define SENSORS_DEFAULTS {SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \
SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \
SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \
SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \
SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \
SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \
SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \
SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \
SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \
SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \
SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \
SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \
SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \
SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \
SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \
SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END}
#define SENSORS_MODPARM_AUX1(x) "1-" #x "h"
#define SENSORS_MODPARM_AUX(x) SENSORS_MODPARM_AUX1(x)
#define SENSORS_MODPARM SENSORS_MODPARM_AUX(SENSORS_MAX_OPTS)
#define SENSORS_CONCAT(x,y) x ## y
#define MODULE_PARM1(x,y) MODULE_PARM(x,y)
/* This defines several insmod variables, and the addr_data structure */
#define SENSORS_INSMOD \
MODULE_PARM(probe,SENSORS_MODPARM); \
static unsigned short probe[SENSORS_MAX_OPTS] = SENSORS_DEFAULTS; \
MODULE_PARM(probe_range,SENSORS_MODPARM); \
static unsigned short probe_range[SENSORS_MAX_OPTS] = SENSORS_DEFAULTS; \
MODULE_PARM(ignore,SENSORS_MODPARM); \
static unsigned short ignore[SENSORS_MAX_OPTS] = SENSORS_DEFAULTS; \
MODULE_PARM(ignore_range,SENSORS_MODPARM); \
static unsigned short ignore_range [SENSORS_MAX_OPTS] = SENSORS_DEFAULTS; \
static struct sensors_address_data addr_data = \
{normal_i2c, normal_i2c_range, \
normal_isa, normal_isa_range, \
probe, probe_range, \
ignore, ignore_range, \
forces}
/* The following functions assume the existence of an enum with the chip
names as elements. The first element of the enum should be any_chip */
#define SENSORS_INSMOD_0 \
enum chips { any_chip }; \
MODULE_PARM(force,SENSORS_MODPARM); \
static unsigned short force[SENSORS_MAX_OPTS] = SENSORS_DEFAULTS; \
static struct sensors_force_data forces[] = {{force,any_chip},{NULL}}; \
SENSORS_INSMOD
#define SENSORS_INSMOD_1(chip1) \
enum chips { any_chip, chip1 }; \
MODULE_PARM(force,SENSORS_MODPARM); \
static unsigned short force[SENSORS_MAX_OPTS] = SENSORS_DEFAULTS; \
MODULE_PARM1(SENSORS_CONCAT(force_,chip1),SENSORS_MODPARM); \
static unsigned short force_ ## chip1 [SENSORS_MAX_OPTS] = SENSORS_DEFAULTS; \
static struct sensors_force_data forces[] = {{force,any_chip},\
{force_ ## chip1,chip1}, \
{NULL}}; \
SENSORS_INSMOD
#define SENSORS_INSMOD_2(chip1,chip2) \
enum chips { any_chip, chip1, chip2 }; \
MODULE_PARM(force,SENSORS_MODPARM); \
static unsigned short force[SENSORS_MAX_OPTS] = SENSORS_DEFAULTS; \
MODULE_PARM1(SENSORS_CONCAT(force_,chip1),SENSORS_MODPARM); \
static unsigned short force_ ## chip1 [SENSORS_MAX_OPTS] = SENSORS_DEFAULTS; \
MODULE_PARM1(SENSORS_CONCAT(force_,chip2),SENSORS_MODPARM); \
static unsigned short force_ ## chip2 [SENSORS_MAX_OPTS] = SENSORS_DEFAULTS; \
static struct sensors_force_data forces[] = {{force,any_chip}, \
{force_ ## chip1,chip2}, \
{force_ ## chip2,nr2}, \
{NULL}}; \
SENSORS_INSMOD
#define SENSORS_INSMOD_3(chip1,chip2,chip3) \
enum chips { any_chip, chip1, chip2, chip3 }; \
MODULE_PARM(force,SENSORS_MODPARM); \
static unsigned short force[SENSORS_MAX_OPTS] = SENSORS_DEFAULTS; \
MODULE_PARM1(SENSORS_CONCAT(force_,chip1),SENSORS_MODPARM); \
static unsigned short force_ ## chip1 [SENSORS_MAX_OPTS] = SENSORS_DEFAULTS; \
MODULE_PARM1(SENSORS_CONCAT(force_,chip2),SENSORS_MODPARM); \
static unsigned short force_ ## chip2 [SENSORS_MAX_OPTS] = SENSORS_DEFAULTS; \
MODULE_PARM1(SENSORS_CONCAT(force_,chip3),SENSORS_MODPARM); \
static unsigned short force_ ## chip3 [SENSORS_MAX_OPTS] = SENSORS_DEFAULTS; \
static struct sensors_force_data forces[] = {{force,any_chip}, \
{force_ ## chip1,chip1}, \
{force_ ## chip2,chip2}, \
{force_ ## chip3,chip3}, \
{NULL}}; \
SENSORS_INSMOD
typedef int sensors_found_addr_proc (struct i2c_adapter *adapter,
int addr, int kind);
/* Detect function. It itterates over all possible addresses itself. For
SMBus addresses, it will only call found_proc if some client is connected
to the SMBus (unless a 'force' matched); for ISA detections, this is not
done. */
extern void sensors_detect(struct i2c_adapter *adapter,
struct sensors_address_data *address_data,
sensors_found_addr_proc *found_proc);
extern int sensors_detect(struct i2c_adapter *adapter,
struct sensors_address_data *address_data,
sensors_found_addr_proc *found_proc);
#endif /* def __KERNEL__ */