Skip to contentSkip to conversation

hwmon: (it87) Add param to ignore ACPI resource

PATCH Applied Ahmad Khalifa 2 participants 5 messages Oct 4, 2022 – Oct 5, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover hwmon: (it87) Add param to ignore ACPI resource

Changes in this patch set:

* Add parameter to ignore ACPI resource conflicts as an alternate to using 'acpi_enforce_resources=lax'.
Some BIOSes reserve resources and don't use them and the system wide parameter may result in failures to certain drivers.

* Check there is a chip before using force_id parameter as there is no value in registering a non-existent chip

Code is inspired by the original it87 patchset dating back to 2017 (around 5 years and 2 weeks since the date of the original ignore_resource_conflict param)

Tested with it8688 on Gigabyte board with id as it8628 and compared against the out of tree module running the it8688 values (which in turn is blindly based off of the it8686 values) and the results are the same for the enabled sensors (i.e. not all 6 fans/temps/in are valid)

v2: updates with comments: [2]
* Add missing patch description, not just cover letter
* split change for the force_id check into separate commit

v3: v2 thread -> [3]
* Fix formatting and switch to 0 for permissions
* Patch descriptions and subject

[1]: https://lore.kernel.org/linux-hwmon/6c8b5fbd514df708af84630544eca6ee12766bbd.camel@crawford.emu.id.au/
[2]: https://lore.kernel.org/linux-hwmon/[email protected]/T/#u
[3]: https://lore.kernel.org/linux-hwmon/[email protected]/

Ahmad Khalifa (2):
hwmon: (it87) Add param to ignore ACPI resource conflicts
hwmon: (it87) Check for a valid chip before using force_id

 drivers/hwmon/it87.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

base-commit: c3e0e1e23c70455916ff3472072437b3605c6cfe

Signature · 1 line
2.30.2
#1 lore raw

PATCH v3 1/2 hwmon: (it87) Add param to ignore ACPI resource conflicts

Add parameter to ignore ACPI resource conflicts as an alternate to using 'acpi_enforce_resources=lax'.

Some BIOSes reserve resources and don't use them and the system wide parameter may result in failures to certain drivers.

---
 drivers/hwmon/it87.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/hwmon/it87.c +8 -2
index 0e543dbe0a6b..c4f5500dcf3c 100644
@@ -69,6 +69,10 @@ static unsigned short force_id;
 module_param(force_id, ushort, 0);
 MODULE_PARM_DESC(force_id, "Override the detected device ID");
 
+static bool ignore_resource_conflict;
+module_param(ignore_resource_conflict, bool, 0);
+MODULE_PARM_DESC(ignore_resource_conflict, "Ignore ACPI resource conflict");
+
 static struct platform_device *it87_pdev[2];
 
 #define	REG_2E	0x2e	/* The register to read/write */
@@ -3261,8 +3265,10 @@ static int __init it87_device_add(int index, unsigned short address,
 	int err;
 
 	err = acpi_check_resource_conflict(&res);
-	if (err)
-		return err;
+	if (err) {
+		if (!ignore_resource_conflict)
+			return err;
+	}
 
 	pdev = platform_device_alloc(DRVNAME, address);
 	if (!pdev)
Signature · 1 line
2.30.2
maintainer Applied
#2 lore raw

Re: [PATCH v3 1/2] hwmon: (it87) Add param to ignore ACPI resource conflicts

Quoted 7 lines · Ahmad Khalifa

Add parameter to ignore ACPI resource conflicts as an alternate to using 'acpi_enforce_resources=lax'.

Some BIOSes reserve resources and don't use them and the system wide parameter may result in failures to certain drivers.

Applied to hwmon-next.

Thanks,
Guenter

Quoted 32 lines
---
 drivers/hwmon/it87.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/hwmon/it87.c +8 -2
index 0e543dbe0a6b..c4f5500dcf3c 100644
@@ -69,6 +69,10 @@ static unsigned short force_id;
 module_param(force_id, ushort, 0);
 MODULE_PARM_DESC(force_id, "Override the detected device ID");
 
+static bool ignore_resource_conflict;
+module_param(ignore_resource_conflict, bool, 0);
+MODULE_PARM_DESC(ignore_resource_conflict, "Ignore ACPI resource conflict");
+
 static struct platform_device *it87_pdev[2];
 
 #define	REG_2E	0x2e	/* The register to read/write */
@@ -3261,8 +3265,10 @@ static int __init it87_device_add(int index, unsigned short address,
 	int err;
 
 	err = acpi_check_resource_conflict(&res);
-	if (err)
-		return err;
+	if (err) {
+		if (!ignore_resource_conflict)
+			return err;
+	}
 
 	pdev = platform_device_alloc(DRVNAME, address);
 	if (!pdev)
#3 lore raw

PATCH v3 2/2 hwmon: (it87) Check for a valid chip before using force_id

In reply to Ahmad Khalifa

Check there is a chip before using force_id parameter as there is no value in registering a non-existent chip

---
 drivers/hwmon/it87.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/hwmon/it87.c +7 -1
index c4f5500dcf3c..bb9870c79ffe 100644
@@ -2401,7 +2401,13 @@ static int __init it87_find(int sioaddr, unsigned short *address,
 		return err;
 
 	err = -ENODEV;
-	chip_type = force_id ? force_id : superio_inw(sioaddr, DEVID);
+	chip_type = superio_inw(sioaddr, DEVID);
+	/* check first for a valid chip before forcing chip id */
+	if (chip_type == 0xffff)
+		goto exit;
+
+	if (force_id)
+		chip_type = force_id;
 
 	switch (chip_type) {
 	case IT8705F_DEVID:
Signature · 1 line
2.30.2
maintainer Applied
#4 lore raw

Re: [PATCH v3 2/2] hwmon: (it87) Check for a valid chip before using force_id

Quoted 4 lines · Ahmad Khalifa

Check there is a chip before using force_id parameter as there is no value in registering a non-existent chip

Applied to hwmon-next.

Thanks,
Guenter

Quoted 23 lines
---
 drivers/hwmon/it87.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/hwmon/it87.c +7 -1
index c4f5500dcf3c..bb9870c79ffe 100644
@@ -2401,7 +2401,13 @@ static int __init it87_find(int sioaddr, unsigned short *address,
 		return err;
 
 	err = -ENODEV;
-	chip_type = force_id ? force_id : superio_inw(sioaddr, DEVID);
+	chip_type = superio_inw(sioaddr, DEVID);
+	/* check first for a valid chip before forcing chip id */
+	if (chip_type == 0xffff)
+		goto exit;
+
+	if (force_id)
+		chip_type = force_id;
 
 	switch (chip_type) {
 	case IT8705F_DEVID: