Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4435394ioa; Wed, 27 Apr 2022 03:57:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6TR6TISOdNj0znkiIgUGbnXQ95YGkbk6u3uDn408EYiLQkamRx894A08G251DY3xyxvYj X-Received: by 2002:a17:90a:1602:b0:1d9:9ddd:1f8b with SMTP id n2-20020a17090a160200b001d99ddd1f8bmr12528306pja.130.1651057044224; Wed, 27 Apr 2022 03:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651057044; cv=none; d=google.com; s=arc-20160816; b=ncK1uleRzepugUX9nEReIb0QIaNRrmIKy2z0a5QOcN9cZIQpdVV+PD7PGxzH98yryw VCeLKvkmzTOwYFi5X3Z20bxwg4Su3n/BLguWPZJe+/AMWyM4DWBsYfxKA2VfVzaJpPx3 GQf2m7pFN60JN0Jr51AGktyoI3pz3NrxjSSDpsSkzzA7bHHfxwXxYTmJDb78tn4mXGOH OQLiQem4aUPrM5LytNvxd3/hIzEtzMnvehK3+lrc9f2GmG8m3Gmuczr45utTirh4lWMb NFe8r5cLoRX9UquX/xjo4fOR0sduH/sNzc3eNY/rv0K5RGOa+rj9VLD5JdkwP9OoAbwr Sk6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=fiHBh/Fh5zEGAH6yN71KI47zEv55JXWMRQICkzrdU2Q=; b=InLqd0nJdAqYvMRqCi+mAVRPVqTTomihXGNs8pHWmb+O8cpzHIfRlh9+1TeHpFZfoC CKQNtmzyNkEhkcopomV+3TBYNJ0zlGJjo8OmB2RK4BY4lFRpgtVEckzd7JCqeCUfzSar Z5tVHZMU+mWdnXYzs8d3BHS6C7TzsUV5D2GgNWN4F/11Vg0N1UdveW+kdZVs7aqf2Uig NaXUW8oqHBjg+Z8EKDI3j71M79XjWKSsh1pOAOHlWJK3j7afoTLWz/J+Nx5+3cmX5hcC o2jwsG6Bz9k3GEr/H5spNPfZad7pl8IGLyY1Kyzzys1yPf46YdIqq4GCNXUSUKyF25YK P1/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b=JJlNVM5S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=bewilderbeest.net Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id pc10-20020a17090b3b8a00b001cbab71ec7fsi1500816pjb.188.2022.04.27.03.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 03:57:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b=JJlNVM5S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=bewilderbeest.net Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8F2713EA880; Wed, 27 Apr 2022 03:04:17 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357576AbiD0Dyt (ORCPT + 99 others); Tue, 26 Apr 2022 23:54:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357483AbiD0Dyq (ORCPT ); Tue, 26 Apr 2022 23:54:46 -0400 Received: from thorn.bewilderbeest.net (thorn.bewilderbeest.net [IPv6:2605:2700:0:5::4713:9cab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 335483C49F; Tue, 26 Apr 2022 20:51:34 -0700 (PDT) Received: from hatter.bewilderbeest.net (174-21-163-222.tukw.qwest.net [174.21.163.222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id 4AD74137; Tue, 26 Apr 2022 20:51:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1651031494; bh=fiHBh/Fh5zEGAH6yN71KI47zEv55JXWMRQICkzrdU2Q=; h=From:To:Cc:Subject:Date:From; b=JJlNVM5S2ycrHAuvWGNKCO+mC+eSG/qH5Awg4cMw8+4eeMZT3ECtCKsI/ovXbPBGo Vg5TRiNzlq+t0KMUAL7GQWvn4TyqFRkcZ9RBOtNPAlWJU27ol0HfUtw2YQBlyVORYz fGUY4P62bEwjyACYYnycdeBHjLGrlIxugI3lD7ig= From: Zev Weiss To: Guenter Roeck , Jean Delvare , linux-hwmon@vger.kernel.org Cc: linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, Zev Weiss , stable@vger.kernel.org Subject: [PATCH] hwmon: (pmbus) delta-ahe50dc-fan: work around hardware quirk Date: Tue, 26 Apr 2022 20:51:09 -0700 Message-Id: <20220427035109.3819-1-zev@bewilderbeest.net> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CLEAR_FAULTS commands can apparently sometimes trigger catastrophic power output glitches on the ahe-50dc, so block them from being sent at all. Signed-off-by: Zev Weiss Cc: stable@vger.kernel.org --- drivers/hwmon/pmbus/delta-ahe50dc-fan.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/hwmon/pmbus/delta-ahe50dc-fan.c b/drivers/hwmon/pmbus/delta-ahe50dc-fan.c index 40dffd9c4cbf..f546f0c12497 100644 --- a/drivers/hwmon/pmbus/delta-ahe50dc-fan.c +++ b/drivers/hwmon/pmbus/delta-ahe50dc-fan.c @@ -14,6 +14,21 @@ #define AHE50DC_PMBUS_READ_TEMP4 0xd0 +static int ahe50dc_fan_write_byte(struct i2c_client *client, int page, u8 value) +{ + /* + * The CLEAR_FAULTS operation seems to sometimes (unpredictably, perhaps + * 5% of the time or so) trigger a problematic phenomenon in which the + * fan speeds surge momentarily and at least some (perhaps all?) of the + * system's power outputs experience a glitch. + * + * However, according to Delta it should be OK to simply not send any + * CLEAR_FAULTS commands (the device doesn't seem to be capable of + * reporting any faults anyway), so just blackhole them unconditionally. + */ + return value == PMBUS_CLEAR_FAULTS ? -EOPNOTSUPP : -ENODATA; +} + static int ahe50dc_fan_read_word_data(struct i2c_client *client, int page, int phase, int reg) { /* temp1 in (virtual) page 1 is remapped to mfr-specific temp4 */ @@ -68,6 +83,7 @@ static struct pmbus_driver_info ahe50dc_fan_info = { PMBUS_HAVE_VIN | PMBUS_HAVE_FAN12 | PMBUS_HAVE_FAN34 | PMBUS_HAVE_STATUS_FAN12 | PMBUS_HAVE_STATUS_FAN34 | PMBUS_PAGE_VIRTUAL, .func[1] = PMBUS_HAVE_TEMP | PMBUS_PAGE_VIRTUAL, + .write_byte = ahe50dc_fan_write_byte, .read_word_data = ahe50dc_fan_read_word_data, }; -- 2.36.0