Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp686150rdf; Tue, 21 Nov 2023 13:35:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IE2DNyQylw9QfCW08ZdRdUxqpRHtWN9TRe8/j2PNbyb1xqtonIAihDxRUdTdHNeeSxpauNI X-Received: by 2002:a17:903:22c4:b0:1cc:3c2d:1299 with SMTP id y4-20020a17090322c400b001cc3c2d1299mr476307plg.37.1700602532562; Tue, 21 Nov 2023 13:35:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700602532; cv=none; d=google.com; s=arc-20160816; b=ddpF4YnHCBOYVq9HbUSdUltwWxTI0LhbLTyAPCxx02lyjCLlRL2jL2pdpcHKCyow2b cu1Vd0xZKaQ8MFMIbBlXf8wduoKjGCub28Y7i7DorVv3ovmWpeETlEW1XMTLRRetLWnq bcI0XEkOmi8UpqMAf+dukLpTK8Qk1rS+t1sqI95oG+1ElKQikuqahGcaHMF1QQc3elDd fF+gPkdQFST+aJ8XpsWZFAskPNcEMhFCuMSfnBtfxZF24G2SFk5goKnxyB0BIte8ENZB eYVIMn2guwn4UGoRQo3DLjUip5ZbT6jYuVRGWeZKG7Qepv18ULhAjS1GXxIJt6ZQGcSq kltA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5+NF7o7uf7+kf0e7QUpPhNC6IDByXBMuxBobs2uLyoQ=; fh=J+BJeGmCs/QI29EfE94qnO1PQPf7qAtMFxMYQgDcFXk=; b=xC84A50s8K+sO7VUymyZigoiZ4HanzhRpHK8nbcTIodup4zuU3U4dhLnGQq0iYem6B lIXm7G2g7QhEbq9zUvvw9mZ2WkwxigRp5SKozHcpKx+jc8BGYzVpoUgJAE0lyo5AXSoH KFcainpW/WB2KNcoGsN4BOvwMqZtUze2wesHetlwcbFnEpptj5srF/loNfVKymgbo+ja W5sT+sE9CKkmcpi9Iafje3ocE3/zPt21jYvtnkNALCk3G04sCotDx/aBTnfAzGYlTzm+ 1q+ZA1thADRfbmZGci6hB24JMTbh2tV3d0CBD+yFzxWQ8a7oOsCcJS222uKRStyBhbi8 ZYWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=analog.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id o13-20020a170902d4cd00b001cc76bea514si11865218plg.442.2023.11.21.13.35.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 13:35:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=analog.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id F305A807C5C8; Tue, 21 Nov 2023 13:35:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234476AbjKUVfT (ORCPT + 99 others); Tue, 21 Nov 2023 16:35:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229514AbjKUVfS (ORCPT ); Tue, 21 Nov 2023 16:35:18 -0500 Received: from mx0b-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27858F4; Tue, 21 Nov 2023 13:35:15 -0800 (PST) Received: from pps.filterd (m0375855.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3ALIokTR013720; Tue, 21 Nov 2023 16:35:02 -0500 Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0b-00128a01.pphosted.com (PPS) with ESMTPS id 3uh26h0htd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Nov 2023 16:35:01 -0500 (EST) 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 3ALLYvi8056941 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 21 Nov 2023 16:34:57 -0500 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) 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.986.14; Tue, 21 Nov 2023 16:34:56 -0500 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Tue, 21 Nov 2023 16:34:56 -0500 Received: from work.ad.analog.com (HYB-hERzalRezfV.ad.analog.com [10.65.205.129]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 3ALLYjH1019804; Tue, 21 Nov 2023 16:34:47 -0500 From: To: , , , , , CC: Marcelo Schmitt , , Subject: [PATCH 1/7] iio: adc: ad7091r-base: Set alert config and drvdata Date: Tue, 21 Nov 2023 18:34:45 -0300 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: 1gOjFPJyWy5OsUdd5U-hk2rLpsH2Lh7y X-Proofpoint-GUID: 1gOjFPJyWy5OsUdd5U-hk2rLpsH2Lh7y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-21_11,2023-11-21_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 impostorscore=0 phishscore=0 bulkscore=0 mlxscore=0 malwarescore=0 clxscore=1015 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311060001 definitions=main-2311210169 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 21 Nov 2023 13:35:29 -0800 (PST) From: Marcelo Schmitt Write 1 to bit 4 in the configuration register to set ALERT/BUSY/GPO pin to be used as ALERT. Set device driver data so it can be retrieved when handling alert events, avoiding null pointer dereference. Fixes: (iio: adc: Add support for AD7091R5 ADC) Signed-off-by: Marcelo Schmitt --- drivers/iio/adc/ad7091r-base.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ad7091r-base.c b/drivers/iio/adc/ad7091r-base.c index 8e252cde735b..3ecac3164446 100644 --- a/drivers/iio/adc/ad7091r-base.c +++ b/drivers/iio/adc/ad7091r-base.c @@ -28,6 +28,7 @@ #define AD7091R_REG_RESULT_CONV_RESULT(x) ((x) & 0xfff) /* AD7091R_REG_CONF */ +#define AD7091R_REG_CONF_ALERT_EN BIT(4) #define AD7091R_REG_CONF_AUTO BIT(8) #define AD7091R_REG_CONF_CMD BIT(10) @@ -232,9 +233,16 @@ int ad7091r_probe(struct device *dev, const char *name, iio_dev->channels = chip_info->channels; if (irq) { + ret = regmap_update_bits(st->map, AD7091R_REG_CONF, + AD7091R_REG_CONF_ALERT_EN, BIT(4)); + if (ret) + return ret; + + dev_set_drvdata(st->dev, iio_dev); ret = devm_request_threaded_irq(dev, irq, NULL, - ad7091r_event_handler, - IRQF_TRIGGER_FALLING | IRQF_ONESHOT, name, st); + ad7091r_event_handler, + IRQF_TRIGGER_FALLING | + IRQF_ONESHOT, name, st); if (ret) return ret; } -- 2.42.0