Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1571813rwb; Thu, 10 Nov 2022 19:10:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf746AuiU9SRJm7X5L5gZSw0c7gzr9EO34i5F6NYvYWMddqERikwJsM9Yq1cOe30rZUfUeVS X-Received: by 2002:a17:902:aa85:b0:186:abc6:38aa with SMTP id d5-20020a170902aa8500b00186abc638aamr511146plr.132.1668136200710; Thu, 10 Nov 2022 19:10:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668136200; cv=none; d=google.com; s=arc-20160816; b=H8VNvEANE5VsuZB7VZP5pkq5cUUXkbWPzNfwEDYR3qSHghUaRBa5376NVeRqwmQKQP aAM2oyv/tVw672UDxqBTwOlRjL0Cl6zxhG1nypcLmDkmfqKz4hnhb156QUVckEBdkD99 gOebPiko5gV8+3EKPFL8oZ+W8jv5E6+zBwfnx9iv0I+qXeA8Hp7JpdG4+Qe506fTzmBi wavSEb5atpTIqYpMMu+QJxhDIBTNs5y8wiZWIpOuHUvxahnICU8AyUMKuD2FGr1K2Ob8 OXwG3xUBn90IbWp73zFBulnMO0fVKYDLWkEcKwXIIB32Gw88Jx1LkmVZxTUrGphwMPS4 0slQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=7/uPLWONB3lHJlrNVd2zxOfGpwQbq25ntkT77/YGDPA=; b=DiUcHybI59UP+HXC8MY9SLU9W128Uj2Rh9PlQEKzX8zmaew6ZWBam8zXnVFS5QNStA cR4Gni7UHzm0acr5YwemkzykAsL2aPnXK3WJSFdjDxyfhydjmJLoVf5NgHH4At/9ElL3 cg4w/I+XelLu5IkFlXmH6WzTQut05UrozjTV7SFX9YvnJEGnIEYWkV93nDYv0pB0TsTZ 1zL38ChuDQNSbTwEq0yMM8iqp0krA4IgPxNGBhhuo4zJ73SPcVya/rsIv4sr6Qj7NjXl QyFMdlchcN8tz+oST3UBttXhbM9Apu7xbR6jXAEvnQtxW2FKVtQbFQlfmXbBqm4ZNinQ ui1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@konsulko.com header.s=google header.b=hINR+06n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=konsulko.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m2-20020a170902768200b001786f5de8f2si1220714pll.95.2022.11.10.19.09.46; Thu, 10 Nov 2022 19:10:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@konsulko.com header.s=google header.b=hINR+06n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=konsulko.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233234AbiKKCwM (ORCPT + 93 others); Thu, 10 Nov 2022 21:52:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231831AbiKKCvx (ORCPT ); Thu, 10 Nov 2022 21:51:53 -0500 Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93A1D4D5FB for ; Thu, 10 Nov 2022 18:50:47 -0800 (PST) Received: by mail-qt1-x82f.google.com with SMTP id a27so2090722qtw.10 for ; Thu, 10 Nov 2022 18:50:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7/uPLWONB3lHJlrNVd2zxOfGpwQbq25ntkT77/YGDPA=; b=hINR+06nMZzkBFh1tHXwshIb2SIXPooUIurmPeY3zE3X7Iaeu2rjwJWdxUJf5QBJSy a/0BSDCvkiT5larzYrZYfXWwB1WyAcofbNQwuwsFJOv2iX9m+j9o4CJhF2pz9/G+TPy+ zxpxNpe6tB8j8p9maSb+zCyDHOe3elm4pNBO4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7/uPLWONB3lHJlrNVd2zxOfGpwQbq25ntkT77/YGDPA=; b=W2GediPKdD84jbcVZAeFdaTHkYDZc8LrSMTdZKUFohyQsE9lViYLzDWW67nwRfQrV+ FgbNr6IiRu7wO4D5Yj6xf7yrez+z0EIqpNlKUivSEeffvVyAs1mrnsHAsPVgnWqs6LZU UF9Gw+duIYLNSx92szWdT6D8shPb6hNobJXnF/s6EGQUgi9iJ2+0hSAUDGIxIKYXf+jW Zsa+GbnjH+FGme6cpar6INR2szMSITSYZ0UK7lm26tp2nzxdDARmkN25kivPqRE7Y32x DwBeEOfxaIsIlrK9EchU7X9N2BB/7tIBr2hIYH3mIE0zu75X/2kmdbVq46RmyHQtJ3Az 8LDw== X-Gm-Message-State: ACrzQf3TG/P1+ZUQVHVEAD9Igj9YqLsHvBBDx1ffLIABMDtR8lWyNhDe 6TrCfVcNJXgzF7TgwgauRvm5Wca8P6XVfXftr9TH+Q== X-Received: by 2002:a05:622a:8a:b0:3a4:f45a:ac1a with SMTP id o10-20020a05622a008a00b003a4f45aac1amr2815797qtw.352.1668135046771; Thu, 10 Nov 2022 18:50:46 -0800 (PST) MIME-Version: 1.0 References: <20221110101241.10576-1-subhajit.ghosh@vixtechnology.com> In-Reply-To: From: Matt Ranostay Date: Fri, 11 Nov 2022 10:50:35 +0800 Message-ID: Subject: Re: [PATCH] iio: light: apds9960: Fix iio_event_spec structures To: Subhajit Ghosh Cc: jic23@kernel.org, lars@metafoo.de, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 On Thu, Nov 10, 2022 at 10:45 PM Subhajit Ghosh wrote: > > > >> .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), > > > > Probably more concise to use the following, and you won't need to add > > an additional item to the structs. > > > > .mask_separate = BIT(IIO_EV_INFO_VALUE), > > .mask_shared_by_type = BIT(IIO_EV_INFO_ENABLE), > > > > Above is the first thing I tried. > > Current implementation: > > root@stm32mp1:~# ls -1 /sys/bus/iio/devices/iio:device0/events/ > in_intensity_clear_thresh_falling_en > in_intensity_clear_thresh_falling_value > in_intensity_clear_thresh_rising_en > in_intensity_clear_thresh_rising_value > > in_proximity_thresh_falling_en > in_proximity_thresh_falling_value > in_proximity_thresh_rising_en > in_proximity_thresh_rising_value > > > First method (Which you are suggesting): > .mask_separate = BIT(IIO_EV_INFO_VALUE), > .mask_shared_by_type = BIT(IIO_EV_INFO_ENABLE), > > root@stm32mp1:~# ls -1 /sys/bus/iio/devices/iio:device0/events/ > in_intensity_clear_thresh_falling_value > in_intensity_clear_thresh_rising_value > in_intensity_thresh_falling_en > in_intensity_thresh_rising_en > > The above says all channels with with the type IIO_INTENSITY has > the same enable but we require this particular channel (in_intensity_clear) > regardless of direction to have the same enable. > Using mask_shared_by_dir and mask_shared_by_all does not provide the logical > attribute name. > > > This patch provides the below: > > root@stm32mp1:~# ls -1 /sys/bus/iio/devices/iio:device0/events/ > in_intensity_clear_thresh_either_en > in_intensity_clear_thresh_falling_value > in_intensity_clear_thresh_rising_value > > in_proximity_thresh_either_en > in_proximity_thresh_falling_value > in_proximity_thresh_rising_value > > Verified using iio_event_monitor: > > root@stm32mp1:~# ./iio_event_monitor /dev/iio:device0 > Event: time: 1647143384807582753, type: proximity, channel: 0, evtype: thresh, direction: either > Hmm maybe Jonathan will have some feedback on this (and if it is okay to break the ABI interface). Been awhile since I've touched this driver and a little rusty on iio events. But I am guessing your method makes sense since the event(s) has direction and a type, and can't just have one of the .mask_shared_by_dir and mask_shared_by_type. In any case: Reviewed-by: Matt Ranostay - Matt > > Regards > Subhajit Ghosh > > -- > This email is confidential. If you have received this email in error please > notify us immediately by return email and delete this email and any > attachments. Vix accepts no liability for any damage caused by this email > or any attachments due to viruses, interference, interception, corruption > or unauthorised access.