From patchwork Wed Jan 4 06:09:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Crawford X-Patchwork-Id: 13088191 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5351FC4332F for ; Wed, 4 Jan 2023 06:10:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229655AbjADGKZ (ORCPT ); Wed, 4 Jan 2023 01:10:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233336AbjADGKC (ORCPT ); Wed, 4 Jan 2023 01:10:02 -0500 Received: from ipmail06.adl3.internode.on.net (ipmail06.adl3.internode.on.net [150.101.137.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CD1D018695 for ; Tue, 3 Jan 2023 22:09:58 -0800 (PST) IronPort-SDR: k4hbEVMrstG8bu8qXHfYO2bdeTSys4Sb0p0HjWSW69ymMp9lWKe9WUcu56hzekBrFADnStC5z2 svEDtubj6WbOFIJJQQwGaVmMVBdw1g04uEDirjKOmTMRf4pVVEmPBHpspH8meK2VRjxTOw4Qed AVR3BwmzoFeS3XwWs0biVmRI6g4QWzTITl1kaCbjxJOQDWS0k/HMz5aGRu3OMYw80bpap70lW8 IOWw1RnSYw3EjuEd6H/jG98kj1++7/2H4O5bz160Qu/X/NBW0/BFJCcqCxn1pBdBTQpCEfrwVg FNEx5/gyRQWp4GuN6B086zmv X-SMTP-MATCH: 0 X-IPAS-Result: A2CqBgDfFrVjjPQc8jxaHgEBCxIMSYE7C4Itgl+1Jw8BDwEBRAQBAYUFAoURJjcGDgECBAEBAQEDAgMBAQEBAQEDAQEGAQEBAQEB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LZ4Pd93w eolv8JKuQWzhgBwaYSMjzxPsW+WJ2MOVL8r8JwfHcnqhkwi1wgaM5DbDyb35rCJaslNaxd1e mXO3PeT3LkMlFDfd3cTFGTW2bQPj5o5uCdMkA0IKWOWy4jMifIA1RFM9Sg6E1ZOxRJd3uMtZ mVmax9vKaOV82s6jcRPRTv2SV8ZQUfFoAmrmx5TyDGfVFWhSm3GanElNufL90cctWtBJ2AJ8 LadwWfjcDDrYMCogHRqAxQ99q24QIwj7BDGleCmA9+BQ8swbw3j0/2namc/ohf6Bd882R/cr u5w8ecuNaD2OEb8eUHg51V2CFjIdC25GQ== IronPort-HdrOrdr: A9a23:V/PwtK6ME6buRMBwCgPXwBLXdLJyesId70hD6qkQc3ZomwKj9v xG+85rrCMd6l4qNU3I/OrtBEDuewK+yXcY2+Ys1PKZLW3bUQiTXedfBPXZsl/d8kTFn4Y36U 4jSdkYNDSaNzhHZKjBjjVRnLsbsaG6GdiT9ILjJm9WPH1Xgr9bnnpE49mgYzZLrNgvP+tCKK ah X-IronPort-Anti-Spam-Filtered: true Received: from 60-242-28-244.static.tpgi.com.au (HELO bits.crawford.emu.id.au) ([60.242.28.244]) by ipmail06.adl3.internode.on.net with ESMTP; 04 Jan 2023 16:39:53 +1030 Received: from agc.com.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.1/8.17.1) with ESMTPSA id 30469VlD3124168 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 4 Jan 2023 17:09:46 +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 30469VlD3124168 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crawford.emu.id.au; s=s1; t=1672812586; bh=prUI4jFWh12MC3Qn9mW7eRKQoghRyQjqQIGBqQKol/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cKxtS2O7lS8z/dfXFbyJ7eDbzorM47qD3zVq+FrhdOP5foZ21i/ZO6pHS1ZcLivFx i5Mq+efkgC/3UpJ1G4uHdAVaLooNjbXgGf/Bl9Jv10Owj5CEm6gnprxzaakUoFRpH9 2552+OAe2bHPbAQiWAwz0zDXPB+cLpL79QKChsYZ8oOLv8Pss0fd79rp5G7Q5+KXKK 1yNSytEeb9D8sUs/UkVetAzK+FpFLVZuVP0ENBytV3OoGIo6R4hmKp28WhPuxxal3W bqa5HktxbWIVAzjdYuqB51tL2KqjrB+qrwH3mt3RSoNSAKRUGMt2HzACSh6kkYTxfn InPQXrtL9TupA== From: Frank Crawford To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Frank Crawford Subject: [PATCH v2 1/2] hwmon: (it87) Allow calling __superio_enter outside mux Date: Wed, 4 Jan 2023 17:09:25 +1100 Message-Id: <20230104060926.619686-2-frank@crawford.emu.id.au> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230104060926.619686-1-frank@crawford.emu.id.au> References: <20230104060926.619686-1-frank@crawford.emu.id.au> 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]); Wed, 04 Jan 2023 17:09:46 +1100 (AEDT) X-Virus-Scanned: clamav-milter 0.103.7 at bits.crawford.emu.id.au X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Allow for superio_enter to be called without requesting the muxed memory region, in particular for initialisation of the second chipset, which must be put into configuration mode, but without an associated call to leave configuration mode. Signed-off-by: Frank Crawford --- v2: * Improved description for patch --- drivers/hwmon/it87.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 9997f76b1f4a..4ebce2c661d7 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -87,6 +87,14 @@ static struct platform_device *it87_pdev[2]; #define DEVID 0x20 /* Register: Device ID */ #define DEVREV 0x22 /* Register: Device Revision */ +static inline void __superio_enter(int ioreg) +{ + outb(0x87, ioreg); + outb(0x01, ioreg); + outb(0x55, ioreg); + outb(ioreg == REG_4E ? 0xaa : 0x55, ioreg); +} + static inline int superio_inb(int ioreg, int reg) { outb(reg, ioreg); @@ -124,10 +132,7 @@ static inline int superio_enter(int ioreg) if (!request_muxed_region(ioreg, 2, DRVNAME)) return -EBUSY; - outb(0x87, ioreg); - outb(0x01, ioreg); - outb(0x55, ioreg); - outb(ioreg == REG_4E ? 0xaa : 0x55, ioreg); + __superio_enter(ioreg); return 0; }