Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2878263pxb; Mon, 18 Apr 2022 10:07:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8i6PJaaNU4fvBCaoKetxfWG2pDu7cIx1v5dE6hDLcK5aLeJlAy16uGQjRwcCTQEW4f3zV X-Received: by 2002:a17:902:8210:b0:158:dcf6:7f98 with SMTP id x16-20020a170902821000b00158dcf67f98mr11786927pln.27.1650301651271; Mon, 18 Apr 2022 10:07:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650301651; cv=none; d=google.com; s=arc-20160816; b=BHCmll6C/XGBMN8q7w+hcphnRR3GoL6Pf0e4R2Ngp4LJuSFngJXAoNG696/mD0C7kR zMmdMaiQ8Q7wtyQGGgaNpuyBPwjTs6Ler47bp0pL2I2kXXt7kV0uxoMMsdNC2xy5vXec vvLwl9LotwqkXo4rdqXY2RQf8vmfy/DsUc7yAZE/9c32hHbtPmJMXHFpxYD1svgV21hc AZAla7DKWYxLWTjL/VdEFLLT7InyuiaSt0h56RK9y32mlkaG9FINMfJ0bzkM+KZvKWVS MXE2dX+/I8MYfbmTZJZzC6myqdJfB6BYNcPIrQ/Mllsb9h2m7oiL/k5Tb4OfG57cOYtK Pc+A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YGmnN1dElGhV6q4FPxknbgmnhv7NW/59ChSiNnqteco=; b=h/bZbserAeeG+jD6FB93I22BxuE9lQffI62Q/7mL5Po1/F/IVxwcZK4OAvTPyxj2Ug jLibqMFzvQzjKhcrbIM3zwXEItOskFCjdp9npSJoyfaeUZmZrZ2zw2GxKLDwbiEw92/L 3/ZdAFlZdCQlGJlPwpPs5aCbTg47hTlL2+rsMoEyu65ns5rrgY9KXQ+nEIk5mBoHxxZL xGLXEeisAPWxgd3eN5I3b59MKhgvQxQ2Jbe3lsbB/P3XRQ6xq2kqRYgFcM0cPWXlVP7Z rMzpvuhIc/ZJvyjDPV1xKACwI/9lMJZBgP40YSehl3Rab2Iv0V1yL/XquyaQrQskAdTm SEMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VKlWmfrU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d187-20020a6336c4000000b003a85cf1e1f0si5655324pga.829.2022.04.18.10.07.12; Mon, 18 Apr 2022 10:07:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VKlWmfrU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244230AbiDRNjI (ORCPT + 99 others); Mon, 18 Apr 2022 09:39:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244003AbiDRNKl (ORCPT ); Mon, 18 Apr 2022 09:10:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAE42396B0; Mon, 18 Apr 2022 05:50:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4B3CA6124D; Mon, 18 Apr 2022 12:50:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CDEDC385A1; Mon, 18 Apr 2022 12:50:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286220; bh=orYsiMU+k0qTfJ8VPyrMiFa07oD/Li21kpYPCvQblcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VKlWmfrUebCKzWNTfGeRKvXUZdZG0bgseHjnKM5BJeNb97LGzRJHkNrPmYLyZo2r9 OdHrW0Qow8aQk/L3utKPM7Ojg0jMgzfmEjyu9mlXcU68+1qxZZHp481UoiwChRK1fi Li1iVfc5rRoZk6zuvIo3e/gadQPHX9D8mk3YnZ7U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brandon Wyman , Guenter Roeck , Sasha Levin Subject: [PATCH 4.14 066/284] hwmon: (pmbus) Add Vin unit off handling Date: Mon, 18 Apr 2022 14:10:47 +0200 Message-Id: <20220418121212.567383982@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Brandon Wyman [ Upstream commit a5436af598779219b375c1977555c82def1c35d0 ] If there is an input undervoltage fault, reported in STATUS_INPUT command response, there is quite likely a "Unit Off For Insufficient Input Voltage" condition as well. Add a constant for bit 3 of STATUS_INPUT. Update the Vin limit attributes to include both bits in the mask for clearing faults. If an input undervoltage fault occurs, causing a unit off for insufficient input voltage, but the unit is off bit is not cleared, the STATUS_WORD will not be updated to clear the input fault condition. Including the unit is off bit (bit 3) allows for the input fault condition to completely clear. Signed-off-by: Brandon Wyman Link: https://lore.kernel.org/r/20220317232123.2103592-1-bjwyman@gmail.com Fixes: b4ce237b7f7d3 ("hwmon: (pmbus) Introduce infrastructure to detect sensors and limit registers") [groeck: Dropped unnecessary ()] Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/pmbus/pmbus.h | 1 + drivers/hwmon/pmbus/pmbus_core.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h index fa613bd209e3..1fed8ed36d5e 100644 --- a/drivers/hwmon/pmbus/pmbus.h +++ b/drivers/hwmon/pmbus/pmbus.h @@ -262,6 +262,7 @@ enum pmbus_regs { /* * STATUS_VOUT, STATUS_INPUT */ +#define PB_VOLTAGE_VIN_OFF BIT(3) #define PB_VOLTAGE_UV_FAULT BIT(4) #define PB_VOLTAGE_UV_WARNING BIT(5) #define PB_VOLTAGE_OV_WARNING BIT(6) diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 66c72aedde5e..b736fe1a05b7 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -1162,7 +1162,7 @@ static const struct pmbus_limit_attr vin_limit_attrs[] = { .reg = PMBUS_VIN_UV_FAULT_LIMIT, .attr = "lcrit", .alarm = "lcrit_alarm", - .sbit = PB_VOLTAGE_UV_FAULT, + .sbit = PB_VOLTAGE_UV_FAULT | PB_VOLTAGE_VIN_OFF, }, { .reg = PMBUS_VIN_OV_WARN_LIMIT, .attr = "max", -- 2.34.1