Received: by 2002:a05:7412:8d08:b0:f9:2d0a:d759 with SMTP id bj8csp196737rdb; Sun, 17 Dec 2023 07:54:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHFJp5M7GPRtzxTASCOFSBxBtDVEP39Vr9o9P47c1Jmb3aegAWBiBO72kvfT6oExR5pW3UY X-Received: by 2002:a05:600c:5115:b0:40c:2d80:6c2a with SMTP id o21-20020a05600c511500b0040c2d806c2amr8407398wms.113.1702828476721; Sun, 17 Dec 2023 07:54:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702828476; cv=none; d=google.com; s=arc-20160816; b=bCJj6PYWReSDbbNFuGuKe8umhNjr5N2uypCCwzxOtEN3TY6XQyHVLxz0tAjgCJd9P9 TSQt5X2owTAImtHGcw1zVi99McBtwD8I2bxmj7bpV7FTGoQU76J5ghMQhnTkSLYMjEiq JVJKp9l+a5aZwa26D5R9FoTPgpOlwz2S5em+xXq8/Sj1xjtjhNmx9fNedrzaBnL+/74/ WDosca2XQvHDAyhg7kwLeI7ICd7ZreavICkQ3ApoOh1ADThOH6qIFtTwxeNMkAqChHW/ XquAHT5Qh8iVwytTenG4cnnLG/PZY+qsZMMgYgPsXQOlQ/u1qYNfHBcfYHls/JcU7DZw dmmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=xmGA8IxyIDxWP9qfy47TIUxzAPJuHv5ls37aQJ1WL2A=; fh=IYtYDItZhYxUobJUE4h/DPNfo4t2DYpfZJxUzFo9Hpw=; b=uhngLx52ts7d8iYihjzAvjye1+uQL8npTgHKJnrVX/XV87aJaSm17itgpOxxoeZeg6 lkWFARIkHc+8H/jpG7DPVjV9taPotZgfdlon7mn+93Drlj/WHvGzGK/w7TGQfeaeOVLS 83e/RfcLEqUWwrEv0Kxi4R+MzoA2PRg1wAHO55Ez+hkY476zLnPvfB7PrI5qA+9+bz70 XW7cZMfeJxKAB8hTHp7AWhVsDzY8K+ZA84xLO7osSbsYFSlT6L55n74A8mCjwOzqqrXf uysJFNSHxyXSrdM1NhYeAPjjWinR2xD21OkhzcLtMlszssWBGMQNkEghaJfVi19fu0AE W0EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QjkEMszE; spf=pass (google.com: domain of linux-kernel+bounces-2673-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2673-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n18-20020a170906119200b00a1f7c52de63si7901614eja.444.2023.12.17.07.54.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 07:54:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2673-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QjkEMszE; spf=pass (google.com: domain of linux-kernel+bounces-2673-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2673-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 78F681F229B6 for ; Sun, 17 Dec 2023 15:54:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B64945BE4; Sun, 17 Dec 2023 15:54:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QjkEMszE" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6377645966; Sun, 17 Dec 2023 15:54:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEBBBC433C8; Sun, 17 Dec 2023 15:54:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702828466; bh=tDPWvMV6+ju7SK93SQJWeIdlKhsA3hrB9iT5eFL+y9I=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QjkEMszE9913b+/17syBSIP02B3s8+kgf2gHXqV9KR6Gm9xHz3YWqsAhcP7NP+iay VbGv9u8LHefcRk4ANJ1BqFgCjvEy9h54Eq/pXqj5XozOQRC4pnYO9FdmBlP9mUuOwk v5WTPC4CTzW71Tw0mXZear6WyYBdgEsLgmtLov5oor/qzhhtzDNl5GQZb1SsboNAIO CAXZXWOdp9ad34Pc233tyn3vFttjYuBWbL+2wQ48LIKZ6zm3rCIit5+XlXIIACMP7t scBTNr4y6edfU3CI9ZfSoHBacHHiqrQpfuonEAhG6QEhu6/JtW8xE4P7dhjUjrii0K 0ysl848agY0tw== Date: Sun, 17 Dec 2023 15:54:09 +0000 From: Jonathan Cameron To: Marcelo Schmitt Cc: , , , , , , , , , , , , , , , Subject: Re: [PATCH v4 15/15] iio: adc: ad7091r: Allow users to configure device events Message-ID: <20231217155409.4da6b795@jic23-huawei> In-Reply-To: <24a9f1bb721e66df65e36797b0c3fd2ca1f95227.1702746240.git.marcelo.schmitt1@gmail.com> References: <24a9f1bb721e66df65e36797b0c3fd2ca1f95227.1702746240.git.marcelo.schmitt1@gmail.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.38; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 16 Dec 2023 14:51:50 -0300 Marcelo Schmitt wrote: > Implement event configuration callbacks allowing users to read/write > event thresholds and enable/disable event generation. > > Signed-off-by: Marcelo Schmitt > --- > This is from a review suggestion David made on v3 [1]. > > Is this the case for a Suggested-by tag? > > [1]: https://lore.kernel.org/linux-iio/CAMknhBFPbAqp4-AQdmbp+VRW-Ksk1PxaLCG+3n=Zk4gyStqhgw@mail.gmail.com/#t > > drivers/iio/adc/ad7091r-base.c | 117 +++++++++++++++++++++++++++++++-- > 1 file changed, 113 insertions(+), 4 deletions(-) > > diff --git a/drivers/iio/adc/ad7091r-base.c b/drivers/iio/adc/ad7091r-base.c > index 57355ca157a1..64e8baeff258 100644 > --- a/drivers/iio/adc/ad7091r-base.c > +++ b/drivers/iio/adc/ad7091r-base.c > @@ -20,19 +20,18 @@ const struct iio_event_spec ad7091r_events[] = { > { > .type = IIO_EV_TYPE_THRESH, > .dir = IIO_EV_DIR_RISING, > - .mask_separate = BIT(IIO_EV_INFO_VALUE) | > - BIT(IIO_EV_INFO_ENABLE), > + .mask_separate = BIT(IIO_EV_INFO_VALUE), This is an ABI change. So would need a really strong reason to make it... mind you - it seems like this has been broken until now anyway so this change may be fine. > }, > { > .type = IIO_EV_TYPE_THRESH, > .dir = IIO_EV_DIR_FALLING, > - .mask_separate = BIT(IIO_EV_INFO_VALUE) | > - BIT(IIO_EV_INFO_ENABLE), > + .mask_separate = BIT(IIO_EV_INFO_VALUE), > }, > { > .type = IIO_EV_TYPE_THRESH, > .dir = IIO_EV_DIR_EITHER, > .mask_separate = BIT(IIO_EV_INFO_HYSTERESIS), > + .mask_shared_by_all = BIT(IIO_EV_INFO_ENABLE), It's relatively unusual that you can't separate the two event directions with careful control of the thresholds. So I think you can implement the existing ABI by just setting the thresholds to the either 0 or 2^12 - 1 as appropriate. The docs seem to say it must exceed the value, or fall below the min so these values should ensure it can't do either. You can then enable the event generate if one of them is set.