Linux Hardware Monitor development
 help / color / mirror / Atom feed
* [PATCH 0/1] it87: Add param to ignore ACPI resource conflicts
@ 2022-09-30 14:46 Ahmad Khalifa
  2022-09-30 14:46 ` [PATCH 1/1] " Ahmad Khalifa
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmad Khalifa @ 2022-09-30 14:46 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, linux-hwmon; +Cc: Ahmad Khalifa


Add in the parameter to ignore ACPI resource conflicts so that modprobe
can use the force_id parameter when ACPI has the same address mapped.

This is useful for those who don't compile their own modules from github
code and just want to configure modprobe with a /force_id/ value that
gives them coverage of the first 3-4 fans/temp/in values.

Code is inspired by the github it87 module floating out there, but didn't
merge in support for additional devices as there were objections to
that approach in past threads [1].

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)


[1]: https://lore.kernel.org/linux-hwmon/6c8b5fbd514df708af84630544eca6ee12766bbd.camel@crawford.emu.id.au/


Ahmad Khalifa (1):
  it87: Add param to ignore ACPI resource conflicts

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


base-commit: c3e0e1e23c70455916ff3472072437b3605c6cfe
-- 
2.30.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] it87: Add param to ignore ACPI resource conflicts
  2022-09-30 14:46 [PATCH 0/1] it87: Add param to ignore ACPI resource conflicts Ahmad Khalifa
@ 2022-09-30 14:46 ` Ahmad Khalifa
  2022-10-02 15:11   ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmad Khalifa @ 2022-09-30 14:46 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, linux-hwmon; +Cc: Ahmad Khalifa

Signed-off-by: Ahmad Khalifa <ahmad@khalifa.ws>
---
 drivers/hwmon/it87.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 0e543dbe0a6b..6d71f6c481c8 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -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, false);
+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 */
@@ -2397,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 so force_id doesn't register a second empty device */
+	if (chip_type == 0xffff)
+		goto exit;
+
+	if (force_id)
+		chip_type = force_id;
 
 	switch (chip_type) {
 	case IT8705F_DEVID:
@@ -3261,8 +3271,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)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] it87: Add param to ignore ACPI resource conflicts
  2022-09-30 14:46 ` [PATCH 1/1] " Ahmad Khalifa
@ 2022-10-02 15:11   ` Guenter Roeck
  0 siblings, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2022-10-02 15:11 UTC (permalink / raw)
  To: Ahmad Khalifa; +Cc: Jean Delvare, linux-hwmon

On Fri, Sep 30, 2022 at 03:46:37PM +0100, Ahmad Khalifa wrote:
> Signed-off-by: Ahmad Khalifa <ahmad@khalifa.ws>

Patch description missing. What are you doing, and why ?

> ---
>  drivers/hwmon/it87.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
> index 0e543dbe0a6b..6d71f6c481c8 100644
> --- a/drivers/hwmon/it87.c
> +++ b/drivers/hwmon/it87.c
> @@ -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, false);
> +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 */
> @@ -2397,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 so force_id doesn't register a second empty device */
> +	if (chip_type == 0xffff)
> +		goto exit;
> +
> +	if (force_id)
> +		chip_type = force_id;

Undocumented change, violating "one logical change per patch" rule.

>  
>  	switch (chip_type) {
>  	case IT8705F_DEVID:
> @@ -3261,8 +3271,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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-02 15:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-30 14:46 [PATCH 0/1] it87: Add param to ignore ACPI resource conflicts Ahmad Khalifa
2022-09-30 14:46 ` [PATCH 1/1] " Ahmad Khalifa
2022-10-02 15:11   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox