Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67b671bc authored by Jean Delvare's avatar Jean Delvare Committed by Mark M. Hoffman
Browse files

hwmon: Let the user override the detected Super-I/O device ID



While it is possible to force SMBus-based hardware monitoring chip
drivers to drive a not officially supported device, we do not have this
possibility for Super-I/O-based drivers. That's unfortunate because
sometimes newer chips are fully compatible and just forcing the driver
to load would work. Instead of that we have to tell the users to
recompile the kernel driver, which isn't an easy task for everyone.

So, I propose that we add a module parameter to all Super-I/O based
hardware monitoring drivers, letting advanced users force the driver
to load on their machine. The user has to provide the device ID of a
supposedly compatible device. This requires looking at the source code or
a datasheet, so I am confident that users can't randomly force a driver
without knowing what they are doing. Thus this should be relatively safe.

As you can see from the code, the implementation is pretty simple and
unintrusive.

Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Acked-by: default avatarHans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: default avatarMark M. Hoffman <mhoffman@lightlink.com>
parent b20ff13a
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -44,6 +44,10 @@ static int force_start;
module_param(force_start, bool, 0);
MODULE_PARM_DESC(force_start, "Force the chip to start monitoring inputs");

static unsigned short force_id;
module_param(force_id, ushort, 0);
MODULE_PARM_DESC(force_id, "Override the detected device ID");

/* Addresses to scan */
static unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END};

@@ -2191,7 +2195,7 @@ static int __init dme1737_isa_detect(int sio_cip, unsigned short *addr)
	/* Check device ID
	 * We currently know about SCH3112 (0x7c), SCH3114 (0x7d), and
	 * SCH3116 (0x7f). */
	reg = dme1737_sio_inb(sio_cip, 0x20);
	reg = force_id ? force_id : dme1737_sio_inb(sio_cip, 0x20);
	if (!(reg == 0x7c || reg == 0x7d || reg == 0x7f)) {
		err = -ENODEV;
		goto exit;
+5 −1
Original line number Diff line number Diff line
@@ -41,6 +41,10 @@
#include <linux/ioport.h>
#include <asm/io.h>

static unsigned short force_id;
module_param(force_id, ushort, 0);
MODULE_PARM_DESC(force_id, "Override the detected device ID");

static struct platform_device *pdev;

#define DRVNAME "f71805f"
@@ -1497,7 +1501,7 @@ static int __init f71805f_find(int sioaddr, unsigned short *address,
	if (devid != SIO_FINTEK_ID)
		goto exit;

	devid = superio_inw(sioaddr, SIO_REG_DEVID);
	devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID);
	switch (devid) {
	case SIO_F71805F_ID:
		sio_data->kind = f71805f;
+5 −1
Original line number Diff line number Diff line
@@ -74,6 +74,10 @@

#define FAN_MIN_DETECT			366 /* Lowest detectable fanspeed */

static unsigned short force_id;
module_param(force_id, ushort, 0);
MODULE_PARM_DESC(force_id, "Override the detected device ID");

static struct platform_device *f71882fg_pdev = NULL;

/* Super-I/O Function prototypes */
@@ -843,7 +847,7 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address)
		goto exit;
	}

	devid = superio_inw(sioaddr, SIO_REG_DEVID);
	devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID);
	if (devid != SIO_F71882_ID) {
		printk(KERN_INFO DRVNAME ": Unsupported Fintek device\n");
		goto exit;
+5 −1
Original line number Diff line number Diff line
@@ -52,6 +52,10 @@

enum chips { it87, it8712, it8716, it8718 };

static unsigned short force_id;
module_param(force_id, ushort, 0);
MODULE_PARM_DESC(force_id, "Override the detected device ID");

static struct platform_device *pdev;

#define	REG	0x2e	/* The register to read/write */
@@ -906,7 +910,7 @@ static int __init it87_find(unsigned short *address,
	u16 chip_type;

	superio_enter();
	chip_type = superio_inw(DEVID);
	chip_type = force_id ? force_id : superio_inw(DEVID);

	switch (chip_type) {
	case IT8705F_DEVID:
+5 −1
Original line number Diff line number Diff line
@@ -59,6 +59,10 @@ MODULE_PARM_DESC(init,
 " 2: Forcibly enable all voltage and temperature channels, except in9\n"
 " 3: Forcibly enable all voltage and temperature channels, including in9");

static unsigned short force_id;
module_param(force_id, ushort, 0);
MODULE_PARM_DESC(force_id, "Override the detected device ID");

/*
 * Super-I/O registers and operations
 */
@@ -826,7 +830,7 @@ static int __init pc87360_find(int sioaddr, u8 *devid, unsigned short *addresses
	/* No superio_enter */

	/* Identify device */
	val = superio_inb(sioaddr, DEVID);
	val = force_id ? force_id : superio_inb(sioaddr, DEVID);
	switch (val) {
	case 0xE1: /* PC87360 */
	case 0xE8: /* PC87363 */
Loading