From patchwork Mon Apr 1 02:56:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Crawford X-Patchwork-Id: 13612471 Received: from bits.crawford.emu.id.au (bits.crawford.emu.id.au [203.132.92.223]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E19833F6 for ; Mon, 1 Apr 2024 03:01:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.132.92.223 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711940495; cv=none; b=BeozOnSd51CQKvuvpjPtGAnjGyCLnbN4T4dWHPXm0VKZmviERPmFmmiXs8nqvOTcH3lb4DsRtOGrO4QkqSwb+DADUvCj+GfQJJ0mdO1yBIHC0RE9PfiksXqZgSg94v2sTpBL5NGWCWfpjyA7a78AiHIh32flsgd1WJPCbB+nKPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711940495; c=relaxed/simple; bh=x073pIytXcY6puSD7Qj//QsYJ28CrFTDN5jpp5D6vj8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YhHr+/n9MmsIVg/BuArhevp6laIX/zF+HaJNUDS+JUm62F157wMbz0NC356ac2Xm4l4WEs5f3FzYzwxgL8djnA6Lyp4EH3JOw9Kh9ZBSU3K9NMM5dhHS6p4FSvKmhVo/v2GVbaNMyrU5KgCy5YlrxvyYQLOcOzFRwT4oAQAuwbE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crawford.emu.id.au; spf=pass smtp.mailfrom=crawford.emu.id.au; dkim=pass (2048-bit key) header.d=crawford.emu.id.au header.i=@crawford.emu.id.au header.b=nazqFoht; arc=none smtp.client-ip=203.132.92.223 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crawford.emu.id.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=crawford.emu.id.au Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=crawford.emu.id.au header.i=@crawford.emu.id.au header.b="nazqFoht" Received: from agc.crawford.emu.id.au (agc.crawford.emu.id.au [IPv6:fdd2:7aad:d478:1:0:0:cb10:cc07]) (authenticated bits=0) by bits.crawford.emu.id.au (8.17.2/8.17.2) with ESMTPSA id 4312uQwk871729 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 1 Apr 2024 13:56:38 +1100 Authentication-Results: bits.crawford.emu.id.au; arc=none smtp.remote-ip=fdd2:7aad:d478:1::cb10:cc07 DKIM-Filter: OpenDKIM Filter v2.11.0 bits.crawford.emu.id.au 4312uQwk871729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crawford.emu.id.au; s=s1; t=1711940198; bh=a0YV52EsZDUdvg1iL/OPQ/7Xu0bpdkRonT2rAvFRLcg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nazqFohtHYDskluY6/00Qc3DizZhA7cPm6ODJ68+8o3V6gPUzP2eKvePvQBLxJpCr uVmSnlYPGXOc4TvCrY3aYGuoJjr8qDHUUkVOqufDsnjRXKRR7jAG4sUomY24hi5z3p aXGQYcoA3aZurzzxOY94fPKi2+yUxusZTlIcokAa9CQ8Lzlh7ObEeYcRdB6in1qcKl utLf5rl4EP8mrrhUxLZXKXpaAPqBnHyr6jh3geHC1ASrUn1PUQw0tj7WsdKQTtlg1z e034vnUD6pUGFYlACfv7D2HncKbmm/Kt8EMVyIJExX8paQw+psFyQy8bDwbx7Yr5eX a08mrJnow7HPQ== From: Frank Crawford To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Frank Crawford Subject: [PATCH v1 1/4] hwmon (it87): Rename NOEXIT to BIOSOPEN as more descriptive of requirement Date: Mon, 1 Apr 2024 13:56:03 +1100 Message-ID: <20240401025620.205068-2-frank@crawford.emu.id.au> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240401025620.205068-1-frank@crawford.emu.id.au> References: <20240401025620.205068-1-frank@crawford.emu.id.au> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.4 (bits.crawford.emu.id.au [IPv6:fdd2:7aad:d478:1:0:0:cb10:cc01]); Mon, 01 Apr 2024 13:56:38 +1100 (AEDT) X-Virus-Scanned: clamav-milter 1.0.5 at bits.crawford.emu.id.au X-Virus-Status: Clean X-Spam-Level: * Rename previous definitions to match the new information that they are preinitialised by the BIOS and should not receive codes to enter or exit configuration mode. Signed-off-by: Frank Crawford --- drivers/hwmon/it87.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index fbe86cec6055..6eeba3a01e3c 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -320,7 +320,7 @@ struct it87_devices { * second SIO address. Never exit configuration mode on these * chips to avoid the problem. */ -#define FEAT_CONF_NOEXIT BIT(19) /* Chip should not exit conf mode */ +#define FEAT_CONF_BIOSOPEN BIT(19) /* Chip conf mode enabled by BIOS */ #define FEAT_FOUR_FANS BIT(20) /* Supports four fans */ #define FEAT_FOUR_PWM BIT(21) /* Supports four fan controls */ #define FEAT_FOUR_TEMP BIT(22) @@ -452,7 +452,7 @@ static const struct it87_devices it87_devices[] = { .model = "IT8790E", .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI | FEAT_IN7_INTERNAL - | FEAT_PWM_FREQ2 | FEAT_FANCTL_ONOFF | FEAT_CONF_NOEXIT, + | FEAT_PWM_FREQ2 | FEAT_FANCTL_ONOFF | FEAT_CONF_BIOSOPEN, .peci_mask = 0x07, }, [it8792] = { @@ -461,7 +461,7 @@ static const struct it87_devices it87_devices[] = { .features = FEAT_NEWER_AUTOPWM | FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_TEMP_PECI | FEAT_10_9MV_ADC | FEAT_IN7_INTERNAL | FEAT_FANCTL_ONOFF - | FEAT_CONF_NOEXIT, + | FEAT_CONF_BIOSOPEN, .peci_mask = 0x07, .old_peci_mask = 0x02, /* Actually reports PCH */ }, @@ -507,7 +507,7 @@ static const struct it87_devices it87_devices[] = { .features = FEAT_NEWER_AUTOPWM | FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_TEMP_PECI | FEAT_10_9MV_ADC | FEAT_IN7_INTERNAL | FEAT_FANCTL_ONOFF - | FEAT_CONF_NOEXIT, + | FEAT_CONF_BIOSOPEN, .peci_mask = 0x07, .old_peci_mask = 0x02, /* Actually reports PCH */ }, @@ -544,7 +544,7 @@ static const struct it87_devices it87_devices[] = { #define has_four_temp(data) ((data)->features & FEAT_FOUR_TEMP) #define has_six_temp(data) ((data)->features & FEAT_SIX_TEMP) #define has_vin3_5v(data) ((data)->features & FEAT_VIN3_5V) -#define has_conf_noexit(data) ((data)->features & FEAT_CONF_NOEXIT) +#define has_conf_biosopen(data) ((data)->features & FEAT_CONF_BIOSOPEN) #define has_scaling(data) ((data)->features & (FEAT_12MV_ADC | \ FEAT_10_9MV_ADC)) #define has_fanctl_onoff(data) ((data)->features & FEAT_FANCTL_ONOFF) @@ -748,7 +748,7 @@ static int smbus_disable(struct it87_data *data) superio_select(data->sioaddr, PME); superio_outb(data->sioaddr, IT87_SPECIAL_CFG_REG, data->ec_special_config & ~data->smbus_bitmap); - superio_exit(data->sioaddr, has_conf_noexit(data)); + superio_exit(data->sioaddr, has_conf_biosopen(data)); } return 0; } @@ -765,7 +765,7 @@ static int smbus_enable(struct it87_data *data) superio_select(data->sioaddr, PME); superio_outb(data->sioaddr, IT87_SPECIAL_CFG_REG, data->ec_special_config); - superio_exit(data->sioaddr, has_conf_noexit(data)); + superio_exit(data->sioaddr, has_conf_biosopen(data)); } return 0; } @@ -3143,7 +3143,7 @@ static int __init it87_find(int sioaddr, unsigned short *address, } exit: - superio_exit(sioaddr, config ? has_conf_noexit(config) : false); + superio_exit(sioaddr, config ? has_conf_biosopen(config) : false); return err; } @@ -3540,7 +3540,7 @@ static void it87_resume_sio(struct platform_device *pdev) reg2c); } - superio_exit(data->sioaddr, has_conf_noexit(data)); + superio_exit(data->sioaddr, has_conf_biosopen(data)); } static int it87_resume(struct device *dev) From patchwork Mon Apr 1 02:56:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Crawford X-Patchwork-Id: 13612469 Received: from bits.crawford.emu.id.au (bits.crawford.emu.id.au [203.132.92.223]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 454D4C8DE for ; Mon, 1 Apr 2024 03:01:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.132.92.223 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711940489; cv=none; b=f5yKONuX+hrp/j1xAfjGm6IrW5jGjwohG17UyMXcSJCbK4XFmEoh5YWp2mTkXuH9VgAz31fFoAb4L7MIm5VaO37Q0xeRrXzpgpC8t2uD/xHoe3MVa8oM2QKpSH0ftDw5A/c8sxAPnjmz5hd3e3cET3vAw6PTcvNmdOA6JR91Vvk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711940489; c=relaxed/simple; bh=EQriTeQpu48knMMXljLPrgKBn5rc/jRs5Wyk6h3ggfI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FUsc6CA3a+/fw2RhKl/9oCdRV8am4UYkR9BP16ZOMSZARTfwo2BFc68Us8dlNHKSmBjNnnsjftW6fv6xZ+MfWlbEWfkxXRflDCpOP4pm88Pbzel+oLAepf40sFngSzDu+m+PVRQUXgv0Zm4WIMYH3RO8Wu0MpkMDnU/YNxgxNzk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crawford.emu.id.au; spf=pass smtp.mailfrom=crawford.emu.id.au; dkim=pass (2048-bit key) header.d=crawford.emu.id.au header.i=@crawford.emu.id.au header.b=DQy6obEH; arc=none smtp.client-ip=203.132.92.223 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crawford.emu.id.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=crawford.emu.id.au Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=crawford.emu.id.au header.i=@crawford.emu.id.au header.b="DQy6obEH" Received: from agc.crawford.emu.id.au (agc.crawford.emu.id.au [IPv6:fdd2:7aad:d478:1:0:0:cb10:cc07]) (authenticated bits=0) by bits.crawford.emu.id.au (8.17.2/8.17.2) with ESMTPSA id 4312uQwl871729 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 1 Apr 2024 13:56:41 +1100 Authentication-Results: bits.crawford.emu.id.au; arc=none smtp.remote-ip=fdd2:7aad:d478:1::cb10:cc07 DKIM-Filter: OpenDKIM Filter v2.11.0 bits.crawford.emu.id.au 4312uQwl871729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crawford.emu.id.au; s=s1; t=1711940201; bh=Y+ZGKMRg8WEdq4mqw0G+QgyMZYlqgl1pSnPwq3qnklk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DQy6obEHsTGWZHWKsuj443ulwVdLzc90w1tXibnm75yxQzVCy7B6FlYW3gK5gmYCw u+3NEgX2BZw8dWBBmkMHI5PC95Kbg3dRjJJetJBR+l4y+fqchsCUFcZtOX9s+9U7sp Xyj+Eu1dwnyHUzlR64QEgKu2ckg0Vzn8S+KKvwHP34R4iWeaPfmIqcLo12g9PO7EOS IrJK2LzmCP/3vhVEpxqmJ4VYAj+iv6G6gcMyng9PmyK+WWpyFsFqIICDTBYBQ4Yb5l wHvqHwS/5a8HDoLTwEVx/NK0AOy/hHXDCfjZQvvQtSNAxQ+hkaJgG9TyLS08J+bK1u 9WFHdY5C78M2g== From: Frank Crawford To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Frank Crawford Subject: [PATCH v1 2/4] hwmon (it87): Do not enter configuration mode for some chip types Date: Mon, 1 Apr 2024 13:56:04 +1100 Message-ID: <20240401025620.205068-3-frank@crawford.emu.id.au> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240401025620.205068-1-frank@crawford.emu.id.au> References: <20240401025620.205068-1-frank@crawford.emu.id.au> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.4 (bits.crawford.emu.id.au [IPv6:fdd2:7aad:d478:1:0:0:cb10:cc01]); Mon, 01 Apr 2024 13:56:41 +1100 (AEDT) X-Virus-Scanned: clamav-milter 1.0.5 at bits.crawford.emu.id.au X-Virus-Status: Clean X-Spam-Level: * Update the configuration mode entry code to allow conditional entry, and apply to all calls. Signed-off-by: Frank Crawford --- drivers/hwmon/it87.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 6eeba3a01e3c..396c2d3afbf7 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -117,7 +117,7 @@ static inline void superio_select(int ioreg, int ldn) outb(ldn, ioreg + 1); } -static inline int superio_enter(int ioreg) +static inline int superio_enter(int ioreg, bool noentry) { /* * Try to reserve ioreg and ioreg + 1 for exclusive access. @@ -125,7 +125,8 @@ static inline int superio_enter(int ioreg) if (!request_muxed_region(ioreg, 2, DRVNAME)) return -EBUSY; - __superio_enter(ioreg); + if (!noentry) + __superio_enter(ioreg); return 0; } @@ -742,7 +743,7 @@ static int smbus_disable(struct it87_data *data) int err; if (data->smbus_bitmap) { - err = superio_enter(data->sioaddr); + err = superio_enter(data->sioaddr, has_conf_biosopen(data)); if (err) return err; superio_select(data->sioaddr, PME); @@ -758,7 +759,7 @@ static int smbus_enable(struct it87_data *data) int err; if (data->smbus_bitmap) { - err = superio_enter(data->sioaddr); + err = superio_enter(data->sioaddr, has_conf_biosopen(data)); if (err) return err; @@ -2674,7 +2675,7 @@ static int __init it87_find(int sioaddr, unsigned short *address, u16 chip_type; const struct it87_devices *config = NULL; - err = superio_enter(sioaddr); + err = superio_enter(sioaddr, false); if (err) return err; @@ -3520,7 +3521,7 @@ static void it87_resume_sio(struct platform_device *pdev) if (!data->need_in7_reroute) return; - err = superio_enter(data->sioaddr); + err = superio_enter(data->sioaddr, has_conf_biosopen(data)); if (err) { dev_warn(&pdev->dev, "Unable to enter Super I/O to reroute in7 (%d)", From patchwork Mon Apr 1 02:56:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Crawford X-Patchwork-Id: 13612470 Received: from bits.crawford.emu.id.au (bits.crawford.emu.id.au [203.132.92.223]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F34933F6 for ; Mon, 1 Apr 2024 03:01:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.132.92.223 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711940492; cv=none; b=cqpylGNK0e+58sEIrmIIev2cUuTzKiIZP0StYZSn89hxmjxrPQomaiiQlQvcvfeAj3EBnv1695gMFrh+Lmo3zF+wFv25CSdbJBOOLCOUkD5X/Qfap7c/opizSwPpTNrYHTvt/BzxbprhwHG7zFp0oDGv9FI6QAJX1ZxUxJWRaxY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711940492; c=relaxed/simple; bh=kIepjF3sYF+cwbHxxF+HCy6RCP4yenABlSXDAjOCLqY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iTFk3R5MKDsmsmTJQeIDCRqkKqtuhuD+LcRhXS+qvk4sXHE7odgd/CP0GsguuAToLUDpIG/Sw/hZRn44/ikNWdY45CoPxt6/m5++Ytzpz0ZV2/ljnjm1tkGaCOt8DSTdNeuax/2D4boDMrh3dXkyzxeISEelRw1zaCwgptkyvfc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crawford.emu.id.au; spf=pass smtp.mailfrom=crawford.emu.id.au; dkim=pass (2048-bit key) header.d=crawford.emu.id.au header.i=@crawford.emu.id.au header.b=R5glnQq0; arc=none smtp.client-ip=203.132.92.223 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crawford.emu.id.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=crawford.emu.id.au Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=crawford.emu.id.au header.i=@crawford.emu.id.au header.b="R5glnQq0" Received: from agc.crawford.emu.id.au (agc.crawford.emu.id.au [IPv6:fdd2:7aad:d478:1:0:0:cb10:cc07]) (authenticated bits=0) by bits.crawford.emu.id.au (8.17.2/8.17.2) with ESMTPSA id 4312uQwm871729 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 1 Apr 2024 13:56:45 +1100 Authentication-Results: bits.crawford.emu.id.au; arc=none smtp.remote-ip=fdd2:7aad:d478:1::cb10:cc07 DKIM-Filter: OpenDKIM Filter v2.11.0 bits.crawford.emu.id.au 4312uQwm871729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crawford.emu.id.au; s=s1; t=1711940205; bh=vArK97dm3ThszED6Ix3d9QZZQB4vljtBWj+s/Pme1as=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R5glnQq0JMY4iqxGrxS5Jd+MiyQJ4uytqv7i7fsroWLf/XQpOL04grDFLnWzQEwyZ yp+5DpM9BybdD6SB4LL+FbFuhP65uEq3ZE9ly92wEEasqCiU5APBAXelbi3JIAGeXO 3MQxiQqzLmqOLOycoX3/aFE2/gTABpfQFQUmExN0vzuJ07RgP8VZVvYowkGxsw6eea GCNnSRynK5mB4xS+CewIz7va7BBSBrXhlrFxIM+qkBpSzIoK/cTOC6WW8r0ZKewfGx +O5kRej7gFyODFoIKk5qQf1ixf6+11hPikFqJQcrhmn3E4UDZgTIcS2tHCaYDlBs8Y v25YeMfk6zMwg== From: Frank Crawford To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Frank Crawford Subject: [PATCH v1 3/4] hwmon (it87): Test for chipset before entering configuration mode Date: Mon, 1 Apr 2024 13:56:05 +1100 Message-ID: <20240401025620.205068-4-frank@crawford.emu.id.au> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240401025620.205068-1-frank@crawford.emu.id.au> References: <20240401025620.205068-1-frank@crawford.emu.id.au> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.4 (bits.crawford.emu.id.au [IPv6:fdd2:7aad:d478:1:0:0:cb10:cc01]); Mon, 01 Apr 2024 13:56:45 +1100 (AEDT) X-Virus-Scanned: clamav-milter 1.0.5 at bits.crawford.emu.id.au X-Virus-Status: Clean X-Spam-Level: * Major part of the change for the new method to avoid chipset issues. Perform an intial test if the chip ID can be read without entering configuration mode, if so, do not enter configuration mode and continue as is. If chip ID cannot be read, enter configuration mode, and continue with previous code. Also update exit code to take account of if we entered configuration mode or not. Signed-off-by: Frank Crawford --- drivers/hwmon/it87.c | 52 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 396c2d3afbf7..6a77f2f6e1e1 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -2667,6 +2667,27 @@ static const struct attribute_group it87_group_auto_pwm = { .is_visible = it87_auto_pwm_is_visible, }; +/* + * Original explanation: + * On various Gigabyte AM4 boards (AB350, AX370), the second Super-IO chip + * (IT8792E) needs to be in configuration mode before accessing the first + * due to a bug in IT8792E which otherwise results in LPC bus access errors. + * This needs to be done before accessing the first Super-IO chip since + * the second chip may have been accessed prior to loading this driver. + * + * The problem is also reported to affect IT8795E, which is used on X299 boards + * and has the same chip ID as IT8792E (0x8733). It also appears to affect + * systems with IT8790E, which is used on some Z97X-Gaming boards as well as + * Z87X-OC. + * + * From other information supplied: + * ChipIDs 0x8733, 0x8695 (early ID for IT87952E) and 0x8790 are intialised + * by the BIOS and left in configuration mode, and entering and/or exiting + * configuration mode is what causes the crash. + * + * The recommendation is to look up the chipID before doing any mode swap + * and then act accordingly. + */ /* SuperIO detection - will change isa_address if a chip is found */ static int __init it87_find(int sioaddr, unsigned short *address, struct it87_sio_data *sio_data, int chip_cnt) @@ -2674,16 +2695,25 @@ static int __init it87_find(int sioaddr, unsigned short *address, int err; u16 chip_type; const struct it87_devices *config = NULL; + bool opened = false; - err = superio_enter(sioaddr, false); + /* First step, lock memory but don't enter configuration mode */ + err = superio_enter(sioaddr, true); if (err) return err; err = -ENODEV; chip_type = superio_inw(sioaddr, DEVID); - /* check first for a valid chip before forcing chip id */ - if (chip_type == 0xffff) - goto exit; + /* Check for a valid chip before forcing chip id */ + if (chip_type == 0xffff) { + /* Enter configuration mode */ + __superio_enter(sioaddr); + opened = true; + /* and then try again */ + chip_type = superio_inw(sioaddr, DEVID); + if (chip_type == 0xffff) + goto exit; + } if (force_id_cnt == 1) { /* If only one value given use for all chips */ @@ -2767,6 +2797,18 @@ static int __init it87_find(int sioaddr, unsigned short *address, config = &it87_devices[sio_data->type]; + /* + * If previously we didn't enter configuration mode and it isn't a + * chip we know is initialised by the BIOS, then enter configuration + * mode. + * + * I don't know if any such chips can exist but be defensive. + */ + if (!opened && !has_conf_biosopen(config)) { + __superio_enter(sioaddr); + opened = true; + } + superio_select(sioaddr, PME); if (!(superio_inb(sioaddr, IT87_ACT_REG) & 0x01)) { pr_info("Device (chip %s ioreg 0x%x) not activated, skipping\n", @@ -3144,7 +3186,7 @@ static int __init it87_find(int sioaddr, unsigned short *address, } exit: - superio_exit(sioaddr, config ? has_conf_biosopen(config) : false); + superio_exit(sioaddr, opened && config && has_conf_biosopen(config)); return err; } From patchwork Mon Apr 1 02:56:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Crawford X-Patchwork-Id: 13612467 Received: from bits.crawford.emu.id.au (bits.crawford.emu.id.au [203.132.92.223]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAB4A7F for ; Mon, 1 Apr 2024 02:57:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.132.92.223 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711940235; cv=none; b=GDi0MQ0ld5dNIxbgRZE0sSBMGeFjcQes00/uFc7Q8RfgwX1mNJkaZwU1WB1YylPMkGpk3t3XXuXwvhL6mHYNO03oU8R29AwTTR8XI+5M5/7yfpAdQ1Y6W5d3bQHJ+H8T9a9wxYYC6d93K2CmBkJ3QOmNHCWZtKTOTEBbV46fVoM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711940235; c=relaxed/simple; bh=OSSb/O5csrUyqjFr6utKFsOCrRYwe1jZIwjRdt3sWrM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Yd59PI+Mif1ixLvZVjq0XHsDaZqQmn6oro/L3lLEK0jpaV7BfsVf7B+NRPvAebE7asPLalzDDw7zfFNVHGdTbtznZEFjtqWsN9zLPgeN8HntcPeprcqPl6U1Pc2bMcqY6VXHezUGY3aZ9KZTEkCQNwbWlITPUc9E8TQPYitmp6I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crawford.emu.id.au; spf=pass smtp.mailfrom=crawford.emu.id.au; dkim=pass (2048-bit key) header.d=crawford.emu.id.au header.i=@crawford.emu.id.au header.b=sHyuFZV5; arc=none smtp.client-ip=203.132.92.223 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crawford.emu.id.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=crawford.emu.id.au Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=crawford.emu.id.au header.i=@crawford.emu.id.au header.b="sHyuFZV5" Received: from agc.crawford.emu.id.au (agc.crawford.emu.id.au [IPv6:fdd2:7aad:d478:1:0:0:cb10:cc07]) (authenticated bits=0) by bits.crawford.emu.id.au (8.17.2/8.17.2) with ESMTPSA id 4312uQwn871729 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 1 Apr 2024 13:56:48 +1100 Authentication-Results: bits.crawford.emu.id.au; arc=none smtp.remote-ip=fdd2:7aad:d478:1::cb10:cc07 DKIM-Filter: OpenDKIM Filter v2.11.0 bits.crawford.emu.id.au 4312uQwn871729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crawford.emu.id.au; s=s1; t=1711940208; bh=tyiK63EQJyv2V2245oIrzzcXln0HwFK88tDu8y2Umoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sHyuFZV5DsQ3FBMNCCz5h2b13sjnARczn579CedVEi5pIEah0F/E9NB8b1ZhQxj6B WrJ7xXy5Aw9aQCQwrN/dKcveKS0RoHGhSGYJ7WjqcCWyl5gMEt+swsuXCkj5800aK5 t8LL5gnAUsbULZ/UpoJbUzYAMw8LK2ohLSc7xAt6QSceQbCoWkN35IHiSD4P4Hqgw8 vlLPXeKZnu58FWJVmtRK2PEWoESZNkwe7lI+ofQT07APgyxsM2Wz4NTSBkufhU3x/E Bxd/s+h3RC7qdZgtbpi8MYshMrRbotEzT2OqfkAcXUXLNfSrYuVhjzrUdlagr7pANk /IgdN83sAMBjQ== From: Frank Crawford To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Frank Crawford Subject: [PATCH v1 4/4] hwmon (it87): Remove tests no longer required Date: Mon, 1 Apr 2024 13:56:06 +1100 Message-ID: <20240401025620.205068-5-frank@crawford.emu.id.au> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240401025620.205068-1-frank@crawford.emu.id.au> References: <20240401025620.205068-1-frank@crawford.emu.id.au> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.4 (bits.crawford.emu.id.au [IPv6:fdd2:7aad:d478:1:0:0:cb10:cc01]); Mon, 01 Apr 2024 13:56:48 +1100 (AEDT) X-Virus-Scanned: clamav-milter 1.0.5 at bits.crawford.emu.id.au X-Virus-Status: Clean X-Spam-Level: * Remove DMI tests for boards that are known to have issues with entering configuration mode, as now we are testing the chips directly and no longer need to rely on matching the board. Leave the DMI table in place, for the nVIDIA board, and any future expansions. Signed-off-by: Frank Crawford --- drivers/hwmon/it87.c | 48 -------------------------------------------- 1 file changed, 48 deletions(-) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 6a77f2f6e1e1..b850eb3e5907 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -3683,27 +3683,6 @@ static int it87_dmi_cb(const struct dmi_system_id *dmi_entry) return 1; } -/* - * On various Gigabyte AM4 boards (AB350, AX370), the second Super-IO chip - * (IT8792E) needs to be in configuration mode before accessing the first - * due to a bug in IT8792E which otherwise results in LPC bus access errors. - * This needs to be done before accessing the first Super-IO chip since - * the second chip may have been accessed prior to loading this driver. - * - * The problem is also reported to affect IT8795E, which is used on X299 boards - * and has the same chip ID as IT8792E (0x8733). It also appears to affect - * systems with IT8790E, which is used on some Z97X-Gaming boards as well as - * Z87X-OC. - * DMI entries for those systems will be added as they become available and - * as the problem is confirmed to affect those boards. - */ -static int it87_sio_force(const struct dmi_system_id *dmi_entry) -{ - __superio_enter(REG_4E); - - return it87_dmi_cb(dmi_entry); -}; - /* * On the Shuttle SN68PT, FAN_CTL2 is apparently not * connected to a fan, but to something else. One user @@ -3726,34 +3705,7 @@ static struct it87_dmi_data nvidia_fn68pt = { .driver_data = data, \ } -#define IT87_DMI_MATCH_GBT(name, cb, data) \ - IT87_DMI_MATCH_VND("Gigabyte Technology Co., Ltd.", name, cb, data) - static const struct dmi_system_id it87_dmi_table[] __initconst = { - IT87_DMI_MATCH_GBT("AB350", it87_sio_force, NULL), - /* ? + IT8792E/IT8795E */ - IT87_DMI_MATCH_GBT("AX370", it87_sio_force, NULL), - /* ? + IT8792E/IT8795E */ - IT87_DMI_MATCH_GBT("Z97X-Gaming G1", it87_sio_force, NULL), - /* ? + IT8790E */ - IT87_DMI_MATCH_GBT("TRX40 AORUS XTREME", it87_sio_force, NULL), - /* IT8688E + IT8792E/IT8795E */ - IT87_DMI_MATCH_GBT("Z390 AORUS ULTRA-CF", it87_sio_force, NULL), - /* IT8688E + IT8792E/IT8795E */ - IT87_DMI_MATCH_GBT("B550 AORUS PRO AC", it87_sio_force, NULL), - /* IT8688E + IT8792E/IT8795E */ - IT87_DMI_MATCH_GBT("X570 AORUS MASTER", it87_sio_force, NULL), - /* IT8688E + IT8792E/IT8795E */ - IT87_DMI_MATCH_GBT("X570 AORUS PRO", it87_sio_force, NULL), - /* IT8688E + IT8792E/IT8795E */ - IT87_DMI_MATCH_GBT("X570 AORUS PRO WIFI", it87_sio_force, NULL), - /* IT8688E + IT8792E/IT8795E */ - IT87_DMI_MATCH_GBT("X570S AERO G", it87_sio_force, NULL), - /* IT8689E + IT87952E */ - IT87_DMI_MATCH_GBT("Z690 AORUS PRO DDR4", it87_sio_force, NULL), - /* IT8689E + IT87952E */ - IT87_DMI_MATCH_GBT("Z690 AORUS PRO", it87_sio_force, NULL), - /* IT8689E + IT87952E */ IT87_DMI_MATCH_VND("nVIDIA", "FN68PT", it87_dmi_cb, &nvidia_fn68pt), { }