Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp468621rdh; Thu, 23 Nov 2023 08:43:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IH4ckU4xv/aZgS06MqimJo4nHz3V8qgNJ3WlRLfxmc9lyk7fdR80m350s7191RnPjtasNWG X-Received: by 2002:a17:90b:3b89:b0:274:7db1:f50f with SMTP id pc9-20020a17090b3b8900b002747db1f50fmr4272886pjb.15.1700757793953; Thu, 23 Nov 2023 08:43:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700757793; cv=none; d=google.com; s=arc-20160816; b=Dzh+dLglEmQMx67udIDa+S2wcK6qwVnn3PcMgR6MAE4M7O6eC2srVav4I3/32FBVGs 3s4Qq5DZwvkfjvDa6ayaRePKJYchTbqx1GIr5ezeVfT0Ylg80KANy4Wu39OCJUDC33YW qLK9s7pNnQBsApBz5JS1zqa2XPeOFtRx0RAe+MLbusrmRWL3eUMUfIumIguVqZ7Fkm8Z fWWUt2raUZeTfaPxViTADNdOhSY+ucAgZfkXcDcoEKQPzmz3p7ePZ1fCMNrla2xUewIk t0A5gYzQtn6kmze3EiaFl0ZZkBYy62FsuFNLzd8u4bKZI2ZoQ+VarFROcwWFhPLcBUGq EFtw== 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=MyBFrz9ptk7rsTNRxtrNBNBUvjm47uPxADD+uAgtL54=; fh=C1mm7Zdw5E3tpJwxAr0qRdS6+NMDWRETCLn3M7OkZ9E=; b=dbinl9qht9zw8pvdOm9ddyJkI+BmFUpmkXKeBEVs1sTB0mf91b1gN1jhgZa0UYaBhM oPCTq/S875qYFTUVcWt2rsLSitJ1zyl4Nlxu8tY/xdNfvZnut26qq+dfTzX+VXKShkZ3 Eha0EVHQS1RdICTOjoUEjvK4cJv5ZvEpiI+ftr1oZuVXHXEwdce02N8KxqA5VI1Oudyg FXp9kXCooOnrfUP/tt775lh/Zcy6GvV17vEBDyZ/qoh0Vb1+in3PBWbxJIeM7BWfjAxg wTITGNtybID02UhikXjwm8j9WxLqhKU9OYe5Io4ykgUPlSaJv9V/qf2OzJ7BCnCWrKo+ k0nw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id mm20-20020a17090b359400b002800f26bfdasi2102075pjb.12.2023.11.23.08.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 08:43:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id AB41F80792F3; Thu, 23 Nov 2023 08:41:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229944AbjKWQks (ORCPT + 99 others); Thu, 23 Nov 2023 11:40:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbjKWQkq (ORCPT ); Thu, 23 Nov 2023 11:40:46 -0500 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AC0E9E; Thu, 23 Nov 2023 08:40:49 -0800 (PST) Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3ANG3c34030687; Thu, 23 Nov 2023 11:40:34 -0500 Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3uhxk5th5k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 11:40:34 -0500 (EST) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 3ANGeXlA054156 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 23 Nov 2023 11:40:33 -0500 Received: from ASHBCASHYB5.ad.analog.com (10.64.17.133) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Thu, 23 Nov 2023 11:40:32 -0500 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBCASHYB5.ad.analog.com (10.64.17.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Thu, 23 Nov 2023 11:40:32 -0500 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.986.14 via Frontend Transport; Thu, 23 Nov 2023 11:40:32 -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 3ANGeHrp019795; Thu, 23 Nov 2023 11:40:19 -0500 From: Marcelo Schmitt To: , , , , , , , CC: Marcelo Schmitt , , , Subject: [PATCH v2 1/7] iio: adc: ad7091r-base: Set alert config and drvdata Date: Thu, 23 Nov 2023 13:40:16 -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-GUID: tMV_NfkCYfUQUWC2e0eqRdhy9nEZz62Z X-Proofpoint-ORIG-GUID: tMV_NfkCYfUQUWC2e0eqRdhy9nEZz62Z 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-23_12,2023-11-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 priorityscore=1501 malwarescore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311060001 definitions=main-2311230122 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 23 Nov 2023 08:41:00 -0800 (PST) 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