Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2332588pxk; Mon, 14 Sep 2020 10:26:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqXQzDh8ZgrO2QHzfuyOTCjw2MgEgzhRHafcn78DqVKIE6CpZywrS2Np1VdyE/VdCco4bC X-Received: by 2002:a05:6402:b68:: with SMTP id cb8mr18567180edb.350.1600104369991; Mon, 14 Sep 2020 10:26:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600104369; cv=none; d=google.com; s=arc-20160816; b=JS9aP8FH1ud9KFoeZdcZeSIerQ6y6pqngZjH9sqIfsTCaQI9bcbAluNpefeOsCpXdp LZXOjHA237nbuYRZcCMH0f1siY7/2HqJUR7UPGLf2Q0rUmtIP2IxrpPjAnnsLcPO4b3A 4vdI7nlE+D15/lReiircVklCKIIwVkoRXBux0H2LSgol2ScrW+/mBWN1Bxqwibaev4za aYM/wY5sMcgvxMJRS5VaNlJmWyCSq405pFinC+Y4hT7dPEwbXutdEBi9heI7EbFvUnhm Mjkb5To7c2trxoCmHFx9ftHlVAyfF2UAOETjCq+fEa/PJKeGMEV4dpTRdTEcRvX7PlLX gARQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=yREPY9pTTI4hxqsqJj7QajLwVXGtjBqDjp9qr2mdgcY=; b=RUxd3m8TtI3QYvIJ+AOzZCGXUJm348yowz/264dDx3WVTKvsWnWlSYDdpE5hdn9sNs MShqmcBSFP6pCfZdAy51KrdN0q2u6nw0rEd4h33HoU4r5T1S5vp6bm8aLl/Zps8dlwcL zWt6dwshcLkeexfCswqKXrhnmhS2VnSCxwcfTrYHzeEHg1CCfjrCIflIkHS2rklF8Q/L Eot7uXi0JdO9izxl2MPbQsPAvAAV0wdT+qC79GJlXfx91/az7uUF4XA6QheafVXXlpMl +Hpyv4ZLnMxm25Vg6BpgnlqBX+9d4bwC6yjisrI7f87O/jPpL/bteAn2GXpgbE9mM0/8 02yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aj.id.au header.s=fm3 header.b=iza1dbjS; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=YBcniPL8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w6si7778762ejz.365.2020.09.14.10.25.47; Mon, 14 Sep 2020 10:26:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@aj.id.au header.s=fm3 header.b=iza1dbjS; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=YBcniPL8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726269AbgINRYS (ORCPT + 99 others); Mon, 14 Sep 2020 13:24:18 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:46521 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726459AbgINM2w (ORCPT ); Mon, 14 Sep 2020 08:28:52 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 9EA355C0144; Mon, 14 Sep 2020 08:28:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 14 Sep 2020 08:28:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=yREPY9pTTI4hx qsqJj7QajLwVXGtjBqDjp9qr2mdgcY=; b=iza1dbjSNbn5h+pmrN7lZMWMQ9XB6 PdcF+/1YiAuzYkmknN1ibvE0leS9vz3ayM1NaHt5RCknMkyWOe2WlbfnMpB2PHJr tmoYiC7adpZi9WXJ76UfEw05UineoQQsVJZW/BKdbX7qojGH+pX4YryQ9wlJ926l Rq2S73Xxqy01tuMuEcQJ7nGckcAiODyRlUmdbbp6KjZM8uX2M206DKh2QudLntE2 HkwLSkstGYieJ4udFufw54cLmE6PwI8ycEps+S9kPxt5QX4rkL41Meaiylr+Joej mGRizB5rpDFdNTa112MGBqrISPns27AvsQRlayEYGL+p+XN6dV08L2ZOg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=yREPY9pTTI4hxqsqJj7QajLwVXGtjBqDjp9qr2mdgcY=; b=YBcniPL8 JBh8IoGsQg5cPEd3XPWM7GVMb+SkwomsBjwIpO3aOAgtQJw57wMoGkUrMPRPdeeT KV/fvnbX09+aeGnqv1fsFXH9v6aEFhgMsdxZvuUOxWYw/XACUJZCEoYevrTM0gi8 sCb8f8kf3HZUxXR/E7QbEx/6QpmmAn8lsddBz4Df1eDwPeVPOlH6CezkWhVotDfy 1WhmmSVhac4buCWXsmXctg7eM1hxbqdnJFoMouBy95H17jWY81sWeux2bD3MP3NS r5WhE/giElhwg/Y6cx7m00HlQSyDatpQrwEL0i+McA+lYum1XM0tPMhjt8ixNYOx a9cll6SLvXtsBA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudeiiedgheefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehnughrvgifucflvghffhgvrhihuceorghnughrvgifsegr jhdrihgurdgruheqnecuggftrfgrthhtvghrnhepjefgvdevheetkeevgeegleelgfelte etjeffleffvdduudevieffgeetleevhfetnecukfhppedugedrvddruddtledrkeehnecu vehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomheprghnughrvg ifsegrjhdrihgurdgruh X-ME-Proxy: Received: from localhost.localdomain (ppp14-2-109-85.adl-apt-pir-bras32.tpg.internode.on.net [14.2.109.85]) by mail.messagingengine.com (Postfix) with ESMTPA id EF3173064690; Mon, 14 Sep 2020 08:28:48 -0400 (EDT) From: Andrew Jeffery To: linux-hwmon@vger.kernel.org, linux-i2c@vger.kernel.org Cc: linux@roeck-us.net, jdelvare@suse.com, wsa@kernel.org, joel@jms.id.au, linux-kernel@vger.kernel.org Subject: [RFC PATCH 2/2] hwmon: (pmbus/ucd9000) Throttle SMBus transfers to avoid poor behaviour Date: Mon, 14 Sep 2020 21:58:11 +0930 Message-Id: <20200914122811.3295678-3-andrew@aj.id.au> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200914122811.3295678-1-andrew@aj.id.au> References: <20200914122811.3295678-1-andrew@aj.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Short turn-around times between transfers to e.g. the UCD90320 can lead to problematic behaviour, including excessive clock stretching, bus lockups and potential corruption of the device's volatile state. Introduce transfer throttling for the device with a minimum access delay of 1ms. Signed-off-by: Andrew Jeffery --- drivers/hwmon/pmbus/ucd9000.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/hwmon/pmbus/ucd9000.c b/drivers/hwmon/pmbus/ucd9000.c index 81f4c4f166cd..a0b97d035326 100644 --- a/drivers/hwmon/pmbus/ucd9000.c +++ b/drivers/hwmon/pmbus/ucd9000.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -18,6 +19,9 @@ #include #include "pmbus.h" +static unsigned long smbus_delay_us = 1000; +module_param(smbus_delay_us, ulong, 0664); + enum chips { ucd9000, ucd90120, ucd90124, ucd90160, ucd90320, ucd9090, ucd90910 }; @@ -502,6 +506,8 @@ static int ucd9000_probe(struct i2c_client *client, I2C_FUNC_SMBUS_BLOCK_DATA)) return -ENODEV; + i2c_smbus_throttle_client(client, smbus_delay_us); + ret = i2c_smbus_read_block_data(client, UCD9000_DEVICE_ID, block_buffer); if (ret < 0) { -- 2.25.1