Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3363891rdg; Tue, 17 Oct 2023 12:15:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9Ws9CtILNBHBjCBzgGhh6/SFFNlCabUR5eq/9DS4B16WL8E5GFXuzhiOxim4uViwqlgkg X-Received: by 2002:a17:902:da8d:b0:1ca:a07b:36d with SMTP id j13-20020a170902da8d00b001caa07b036dmr1581542plx.48.1697570136805; Tue, 17 Oct 2023 12:15:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697570136; cv=none; d=google.com; s=arc-20160816; b=eGnQjDrXxBNPYOkukbXxGCp/bEo2AVER52x5txlqbzoQrrSLwAOWW+UaAusUUWV5JE KDX5Kdtd9Qdx4Ptul350TApX/dXvYUxj2jRo93kzZN2FeVZqLIFMfCw4swl0gaO3VRLe 9PX5Sj55ERt66S8rkg2Wfo0p3V4wX2uJLZrMvjgB35TwxMLBDsgAGI8sttORLpM/lGZB MLs2PAk8oovUrX3gP2aJnGAFmUet3CfaYIGOyiafpTGL6inMj/3hwvxv9gynphat3LYt mZlmGhUdkrujX9B9YA1puGhWrzGlFR2FkFdFzUPfNnBvbrpSFT3hG9t2FAzQfEnIzXKD z5/Q== 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:subject:cc:to:from:date :dkim-signature; bh=5w9USQsZf7QZEDE89G24DgP3oHECCLzrYifZDL8rKNI=; fh=0i3jKiE8zqKI23NawD8p9j+iOUHpjnGyU3oLOr8FtvI=; b=WahJR/zUKmvEB4fIH0/gVFCAXqNqzgnr2tsv6sEQutkOgnkgxjXKSaxwrqKLZQzNwc UbQ00QHaH7+64O67rqANx5ultXSaKFA6i1Jq0ZL20uyD8U4g/XUcZmTxGcfUjsHjkb0q ba7yD5o6uT+f6XOoxSCKb5I1lWTlmpazWoto4koyKLxY1sbb1MMp5UZQNFiKpjXaAbCh UGY+QcGtSEF9pKgHfFsQYBjWHSBO7mENmQkUAaXwd1FIvxt/PEueEKeCxQvtsxKqOAt/ N99TySsncGUyAuUESAitC2XgR3KUQT5CmdbgRBnwzdhHqZH0XVLftbzIy9voPY84Qz6E t2kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GP6aDR68; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id j8-20020a170903024800b001c62e2ce6a7si2338595plh.445.2023.10.17.12.15.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 12:15:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GP6aDR68; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 3578E806BE06; Tue, 17 Oct 2023 12:15:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343997AbjJQTPT (ORCPT + 99 others); Tue, 17 Oct 2023 15:15:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234966AbjJQTPS (ORCPT ); Tue, 17 Oct 2023 15:15:18 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 363B9ED; Tue, 17 Oct 2023 12:15:16 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67603C433CB; Tue, 17 Oct 2023 19:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697570115; bh=1FH2NiT0/UIAW9o7PfkE2WEJ0KQQ/92RAQnCv8fQwU4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=GP6aDR68d48jUNYRKmDRMWXr5sPPdyOqLEW+eRRXOP4EspT4tJvRHdvqYo2a05LKk w83cFu2uDn+3f3MiB3xgZT6fJEmbYr38RksEcy8/MPlYbQ2k91pdLYWNChkMr55KaV RAVBci/zZS7ToXiZh5Ydphq0gsKZDxXvnnEr3Byg/HNoQeQ4ZrPxegnwcP+kAbSybZ a8rtWGQivfZ6h0lc1H8Mih40VDdqxkaW36nT+g69xcVD7qZAEVlHOd77Q8czePIIju GCR6AJvfasZijj2KwMpZ4SCfTJ0W16yZtjefzYc+CsxKdTfWPHci5zTHw718OCaICl uTVnaRiLHbjig== Date: Tue, 17 Oct 2023 20:15:33 +0100 From: Jonathan Cameron To: Billy Tsai Cc: Jonathan Cameron , "lars@metafoo.de" , "joel@jms.id.au" , "andrew@aj.id.au" , "linux-iio@vger.kernel.org" , linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, Potin.Lai@quantatw.com, patrickw3@meta.com Subject: Re: [PATCH v1] iio: adc: aspeed: Support deglitch feature. Message-ID: <20231017201346.2f4f6b01@jic23-huawei> In-Reply-To: References: <20230925081845.4147424-1-billy_tsai@aspeedtech.com> <20230930174501.039095da@jic23-huawei> <20231002103940.00001dbd@Huawei.com> <20231005150753.38e79c20@jic23-huawei> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Tue, 17 Oct 2023 12:15:34 -0700 (PDT) On Tue, 17 Oct 2023 11:10:54 +0000 Billy Tsai wrote: > > > > > > > Create event sysfs for applying the deglitch condition. When > > > > > > > in_voltageY_thresh_rising_en/in_voltageY_thresh_falling_en is set to true, > > > > > > > the driver will use the in_voltageY_thresh_rising_value and > > > > > > > in_voltageY_thresh_falling_value as threshold values. If the ADC value > > > > > > > falls outside this threshold, the driver will wait for the ADC sampling > > > > > > > period and perform an additional read once to achieve the deglitching > > > > > > > purpose. > > > > > > > > > > > > > > Signed-off-by: Billy Tsai > > > > > > > > > > > Hi Billy > > > > > > > > > > > This is pushing the meaning of the events interface too far. > > > > > > You can't use it to hide a value you don't like from userspace. > > > > > > > > > > > If you can explain what the condition is that you are seeing > > > > > > and what you need to prevent happening if it is seen that would help > > > > > > us figure out if there is another way to do this. > > > > > > > > > > > Jonathan > > > > > > > > > > Hi Jonathan, > > > > > > > > > > Currently, we are experiencing some voltage glitches while reading from our > > > > > controller, but we do not wish to report these false alarms to the user space. > > > > > Instead, we want to retry the operation as soon as possible. This is why the > > > > > driver requires this patch to handle retries internally, rather than relying on user > > > > > space which could introduce unpredictable timing for retrying the reading process. > > > > > This software approach aims to minimize the possibility of false alarms as much as possible. > > > > > > > Thanks for the extra detail. Perhaps share more of that in the cover letter for v2. > > > > > > Okay, I will incorporate more details into my commit message for v2. > > > > > > > > > > > > > If you have any suggestions or recommendations regarding this situation, please feel free to > > > > > share them with me. > > > > > > > Why do you need userspace control for the thresholds? > > > > Perhaps this is something that belongs in DT for a particular board design? > > > > > > If the input voltage remains constant, these settings can be incorporated into the DTS properties for configuring the threshold. However, if the input voltage is subject to change, adding user-space control may offer more flexibility. > > > My concern is that it's an interface userspace probably won't know how to use, or > > will misuse given this seems to be papering over bad hardware. > > > If there is a 'safe' value to put in DT I'd prefer to see that. I guess it might be per > > channel thing to adjust for different expected voltage ranges? > > Yes, the voltage ranges should be adjusted based on each individual channel. > I'm not entirely sure what you mean by the term 'safe' value. > Are you suggesting that a DTS property should be used to constrain the threshold ranges? Or someting else? > From my point of view, I think misusing this feature will only increase the sampling period of the ADC values and decrease the sensitivity. > As the name of this feature , it is primarily used to eliminate or mitigate glitches in readings. > Note a good choice of wording from me. I meant, for a given design (and hence DTS) is there a reasonable value that will work for all instances of that design? If there is it is a characteristic of the board design and should be in DT. If there isn't, how do you calibrate it for individual devices? Jonathan > Thanks > > >