From patchwork Thu Jul 8 12:01:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nuno Sa X-Patchwork-Id: 471455 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64953C07E99 for ; Thu, 8 Jul 2021 12:08:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E36A61494 for ; Thu, 8 Jul 2021 12:08:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231414AbhGHMKx (ORCPT ); Thu, 8 Jul 2021 08:10:53 -0400 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:50756 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231347AbhGHMKx (ORCPT ); Thu, 8 Jul 2021 08:10:53 -0400 Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 168Bt2di004728; Thu, 8 Jul 2021 07:58:36 -0400 Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com with ESMTP id 39mehm2qjt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 07:58:36 -0400 Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 168BwZkl042549 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 Jul 2021 07:58:35 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.858.5; Thu, 8 Jul 2021 07:58:34 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.858.5 via Frontend Transport; Thu, 8 Jul 2021 07:58:34 -0400 Received: from nsa.ad.analog.com ([10.44.3.58]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 168BwPts020146; Thu, 8 Jul 2021 07:58:33 -0400 From: =?utf-8?q?Nuno_S=C3=A1?= To: , CC: Guenter Roeck , Rob Herring , Jean Delvare Subject: [RFC PATCH 5/6] hwmon: axi-fan-control: clear the fan fault irq at startup Date: Thu, 8 Jul 2021 14:01:10 +0200 Message-ID: <20210708120111.519444-6-nuno.sa@analog.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210708120111.519444-1-nuno.sa@analog.com> References: <20210708120111.519444-1-nuno.sa@analog.com> MIME-Version: 1.0 X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: Q8ykOz8sdWLmsg0O3Th9RWi2W7PeH1ci X-Proofpoint-GUID: Q8ykOz8sdWLmsg0O3Th9RWi2W7PeH1ci X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-08_06:2021-07-08,2021-07-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 phishscore=0 adultscore=0 clxscore=1015 spamscore=0 suspectscore=0 mlxlogscore=999 impostorscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107080067 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The core might pull itself out of reset automatically which means it can run with invalid tacho evaluation parameters for some time. Thus, it will trigger a FAN FAULT interrupt as soon as we unmask it. Some userland apps might be sensitive to this and act drastically. Hence, we will clear it here and if there's something really wrong with the FAN or the evaluation parameters, we'll get that interrupt again... Signed-off-by: Nuno Sá --- drivers/hwmon/axi-fan-control.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/hwmon/axi-fan-control.c b/drivers/hwmon/axi-fan-control.c index d4b62d54375b..59c9babb3850 100644 --- a/drivers/hwmon/axi-fan-control.c +++ b/drivers/hwmon/axi-fan-control.c @@ -379,6 +379,15 @@ static int axi_fan_control_init(struct axi_fan_control_data *ctl, ADI_IRQ_SRC_PWM_CHANGED | ADI_IRQ_SRC_TEMP_INCREASE), ADI_REG_IRQ_MASK, ctl); + /* + * The core might pull itself out of reset automatically which means it can run with + * invalid tacho evaluation parameters for some time. Thus, it will trigger a FAN + * FAULT interrupt as soon as we unmask it(and some userland apps might be sensitive to + * this). Hence, we will clear it here and if there's something really wrong with the + * FAN or the evaluation parameters, we'll get that interrupt again... + */ + axi_iowrite(ADI_IRQ_SRC_TACH_ERR, ADI_REG_IRQ_PENDING, ctl); + /* bring the device out of reset */ axi_iowrite(0x01, ADI_REG_RSTN, ctl);