Commit 2a64e9d4 authored by Frank Crawford's avatar Frank Crawford Committed by Guenter Roeck

hwmon: (it87) Allow multiple chip IDs for force_id

Extend the force_id module parameter to allow specifying one or both
chip IDs separately.  If only a single parameter is given it defaults
to using that value for all chips, similar to previous usage.
Signed-off-by: default avatarFrank Crawford <frank@crawford.emu.id.au>
Link: https://lore.kernel.org/r/20230128060308.1549707-6-frank@crawford.emu.id.auSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent f09c7965
...@@ -175,8 +175,9 @@ static inline void superio_exit(int ioreg, bool noexit) ...@@ -175,8 +175,9 @@ static inline void superio_exit(int ioreg, bool noexit)
#define IT87_SIO_VID_REG 0xfc /* VID value */ #define IT87_SIO_VID_REG 0xfc /* VID value */
#define IT87_SIO_BEEP_PIN_REG 0xf6 /* Beep pin mapping */ #define IT87_SIO_BEEP_PIN_REG 0xf6 /* Beep pin mapping */
/* Force chip ID to specified value. Should only be used for testing */ /* Force chip IDs to specified values. Should only be used for testing */
static unsigned short force_id; static unsigned short force_id[2];
static unsigned int force_id_cnt;
/* ACPI resource conflicts are ignored if this parameter is set to 1 */ /* ACPI resource conflicts are ignored if this parameter is set to 1 */
static bool ignore_resource_conflict; static bool ignore_resource_conflict;
...@@ -2410,7 +2411,7 @@ static const struct attribute_group it87_group_auto_pwm = { ...@@ -2410,7 +2411,7 @@ static const struct attribute_group it87_group_auto_pwm = {
/* SuperIO detection - will change isa_address if a chip is found */ /* SuperIO detection - will change isa_address if a chip is found */
static int __init it87_find(int sioaddr, unsigned short *address, static int __init it87_find(int sioaddr, unsigned short *address,
struct it87_sio_data *sio_data) struct it87_sio_data *sio_data, int chip_cnt)
{ {
int err; int err;
u16 chip_type; u16 chip_type;
...@@ -2426,8 +2427,12 @@ static int __init it87_find(int sioaddr, unsigned short *address, ...@@ -2426,8 +2427,12 @@ static int __init it87_find(int sioaddr, unsigned short *address,
if (chip_type == 0xffff) if (chip_type == 0xffff)
goto exit; goto exit;
if (force_id) if (force_id_cnt == 1) {
chip_type = force_id; /* If only one value given use for all chips */
if (force_id[0])
chip_type = force_id[0];
} else if (force_id[chip_cnt])
chip_type = force_id[chip_cnt];
switch (chip_type) { switch (chip_type) {
case IT8705F_DEVID: case IT8705F_DEVID:
...@@ -3419,7 +3424,7 @@ static int __init sm_it87_init(void) ...@@ -3419,7 +3424,7 @@ static int __init sm_it87_init(void)
for (i = 0; i < ARRAY_SIZE(sioaddr); i++) { for (i = 0; i < ARRAY_SIZE(sioaddr); i++) {
memset(&sio_data, 0, sizeof(struct it87_sio_data)); memset(&sio_data, 0, sizeof(struct it87_sio_data));
isa_address[i] = 0; isa_address[i] = 0;
err = it87_find(sioaddr[i], &isa_address[i], &sio_data); err = it87_find(sioaddr[i], &isa_address[i], &sio_data, i);
if (err || isa_address[i] == 0) if (err || isa_address[i] == 0)
continue; continue;
/* /*
...@@ -3468,8 +3473,8 @@ static void __exit sm_it87_exit(void) ...@@ -3468,8 +3473,8 @@ static void __exit sm_it87_exit(void)
MODULE_AUTHOR("Chris Gauthron, Jean Delvare <jdelvare@suse.de>"); MODULE_AUTHOR("Chris Gauthron, Jean Delvare <jdelvare@suse.de>");
MODULE_DESCRIPTION("IT8705F/IT871xF/IT872xF hardware monitoring driver"); MODULE_DESCRIPTION("IT8705F/IT871xF/IT872xF hardware monitoring driver");
module_param(force_id, ushort, 0); module_param_array(force_id, ushort, &force_id_cnt, 0);
MODULE_PARM_DESC(force_id, "Override the detected device ID"); MODULE_PARM_DESC(force_id, "Override one or more detected device ID(s)");
module_param(ignore_resource_conflict, bool, 0); module_param(ignore_resource_conflict, bool, 0);
MODULE_PARM_DESC(ignore_resource_conflict, "Ignore ACPI resource conflict"); MODULE_PARM_DESC(ignore_resource_conflict, "Ignore ACPI resource conflict");
......
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