Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp945434rwl; Thu, 5 Jan 2023 06:47:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXs9K2V4vCVwmme0/uCGftdlKQpAFZJlhIBOklS2ohvOX6o6/mLg78OzYqwicP7CS4vrHnnZ X-Received: by 2002:a50:ee86:0:b0:493:1a5e:f617 with SMTP id f6-20020a50ee86000000b004931a5ef617mr1733092edr.18.1672930043954; Thu, 05 Jan 2023 06:47:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672930043; cv=none; d=google.com; s=arc-20160816; b=NZo65Ps7XjAQX5YhPJoLSwzfjbjWFzbr6rcyzll4NOVjhOA0ZkJ+47CPW0MlVSb/eq O926SB7l85tcK2CKbwr56o09PWKfZHpj88wrNzIM2D4O4fUBqVrqtl7zUswjmHKEXThk a9FBo5Rd49XSJpXe/Du8CNU1U9DsCoiaeLyfNbhpeaE41tVXTKHncOeRZEsiftNggyG+ kODTykFoMOJOnCiHNIv0YS5TusIAPLYq+hRWQP2TtFTO3xlEu2EhOWPnjJ14w1cyKsg6 /gC0P6isty17S41tUggEM/3VZtNnfZ+DiVQZj6JvswiuE22dThUKaWCZ5ZLnpp1ygAyz ICWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ReKwYiVMmlTd3p8LykovhdxYPBU4E1dGEfu5rb1D3B8=; b=p1yy5SZIWU5MPGjLf8wIlc9+QbBNWz7YETfpCR2I3Zy26pnqu1KPAaN6+VRewmr6C1 FFd4LS1ZpptehhssYgva7If9FP6EeNTDWG2Hi2p3ABMRSnmcxm0QZwW73EAN+jfB9QB9 FYl5h8iEv3V9diHBCcR1Jl7yCqJanbEii65LGfwypRUzqzZvzNe42WQUJQU7XxAjMizb zGns5t4625k9j526+gR6q/x73C6caDixF8rdRObe3hN+2AXYUt40dkpA7acfku1coL/6 I1zIrpbD2YBa3AHDn8r1taxD1MLRfz9nSUcxK+m7fAPCVeG8RtLx4BhpgxDebDWhkJsw KLvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=aWJVKi4k; 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=gmx.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h8-20020a056402280800b004678fd66f41si40997193ede.71.2023.01.05.06.47.10; Thu, 05 Jan 2023 06:47:23 -0800 (PST) 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=@gmx.de header.s=s31663417 header.b=aWJVKi4k; 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=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232670AbjAEOTt (ORCPT + 55 others); Thu, 5 Jan 2023 09:19:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231644AbjAEOTj (ORCPT ); Thu, 5 Jan 2023 09:19:39 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB55159309; Thu, 5 Jan 2023 06:19:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1672928363; bh=jGqmtBpJFhDWl3+/3Q4iGUyNOyvE0pOn9VoLM3cxvNw=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=aWJVKi4kKq3+bkujuqlXXDtH7qS4s3vkkFJEWa9769Jkh5Cf2ypqHSTrq/Pl6pJBl atVy7ORdW45o2dl+uSRizAjHeoj7JlPKYcslC3XdyE8VY+Rwrm6BB0csraFjJLegbG 4RbwWSq/kEl2BnAMv1h27+2SuCVkpG34zHwscQYJjvbvV7CqbZVhF+agn7Ob+jmMr/ od29xWBwuxH2rgBdsTJIiTxr9xJ8UqvoRk/vb5puVxY+RA2t+Z7paGoJ55sajSxtAD q465h8yKJstcaG0CvOV51DJWnWXm/Y9UXLxr+Sd92Til7sXtmqA05zAo0TzTcdtifJ LoPDh1olt4s8Q== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from esprimo-mx.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MiacH-1oYJBN3kzn-00fjNy; Thu, 05 Jan 2023 15:19:22 +0100 From: Armin Wolf To: jdelvare@suse.com, linux@roeck-us.net Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] hwmon: (ftsteutates) Add support for fanX_fault attributes Date: Thu, 5 Jan 2023 15:19:11 +0100 Message-Id: <20230105141911.8040-4-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230105141911.8040-1-W_Armin@gmx.de> References: <20230105141911.8040-1-W_Armin@gmx.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Wr0zOroG7LIq3kzpUYWfHXGxFxEa/RaUBdqfrpGwrccgs0UGXXt HDhhPIXJEACq3foul9FLFSqXgc9ValFo4665jsijaQrhIQbAxzhrVmEV4HetlcKIQJ6IMG7 G+6YJBULJ16KHXVvBZGdSNLRU2oZY3oYHVd7d/S4i6Wg2Rfj+JgMsC3m3GMWute19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t6e9XgQXcxA= X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS 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 The driver knows internally when a fan is not connected, but does not export this knowledge to userspace. Use the standard fanX_fault attributes to notify userspace if a fan is not connected. Tested on a Fujitsu DS3401-B1. Signed-off-by: Armin Wolf =2D-- drivers/hwmon/ftsteutates.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/hwmon/ftsteutates.c b/drivers/hwmon/ftsteutates.c index 0d8ab94250a9..25afd9167a34 100644 =2D-- a/drivers/hwmon/ftsteutates.c +++ b/drivers/hwmon/ftsteutates.c @@ -356,6 +356,7 @@ static umode_t fts_is_visible(const void *devdata, enu= m hwmon_sensor_types type, case hwmon_fan: switch (attr) { case hwmon_fan_input: + case hwmon_fan_fault: return 0444; case hwmon_fan_alarm: return 0644; @@ -411,6 +412,10 @@ static int fts_read(struct device *dev, enum hwmon_se= nsor_types type, u32 attr, case hwmon_fan_alarm: *val =3D !!(data->fan_alarm & BIT(channel)); + return 0; + case hwmon_fan_fault: + *val =3D !(data->fan_present & BIT(channel)); + return 0; default: break; @@ -536,14 +541,14 @@ static const struct hwmon_channel_info *fts_info[] = =3D { HWMON_T_INPUT | HWMON_T_ALARM | HWMON_T_FAULT ), HWMON_CHANNEL_INFO(fan, - HWMON_F_INPUT | HWMON_F_ALARM, - HWMON_F_INPUT | HWMON_F_ALARM, - HWMON_F_INPUT | HWMON_F_ALARM, - HWMON_F_INPUT | HWMON_F_ALARM, - HWMON_F_INPUT | HWMON_F_ALARM, - HWMON_F_INPUT | HWMON_F_ALARM, - HWMON_F_INPUT | HWMON_F_ALARM, - HWMON_F_INPUT | HWMON_F_ALARM + HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT, + HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT, + HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT, + HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT, + HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT, + HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT, + HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT, + HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT ), HWMON_CHANNEL_INFO(pwm, HWMON_PWM_AUTO_CHANNELS_TEMP, =2D- 2.30.2