From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B97AFC4332F for ; Tue, 31 Oct 2023 08:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235620AbjJaIj1 (ORCPT ); Tue, 31 Oct 2023 04:39:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235449AbjJaIjI (ORCPT ); Tue, 31 Oct 2023 04:39:08 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E511DD5D for ; Tue, 31 Oct 2023 01:38:15 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-5aa7172bafdso3592031a12.1 for ; Tue, 31 Oct 2023 01:38:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tweaklogic.com; s=google; t=1698741495; x=1699346295; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=28DXBAYX1XRtP2wWeR8rEQtVtlzWFlh45fzZ3wUwj5Y=; b=eA9m+CUvm1HqM496Wb7XJXTX8jdqPpS1zzBpe4cZteYx43SrFTfz/uM6oPLZ0u/a63 9ATe395o4autr7RBpEsAXKaeSk6gYROtRg/gK1O5Ba7IvcXf1OiYkI9AQfV6zxGUA3MR E8GzsqXqumCveOn0ZtFo7ij4BmM9VTLpuHA7cqJN3NopCUDRvZENLz7v5EBgPFRFs/kh 129PhNGECELk0BR3BmTcbTm6knTL94mig8IXUg9Zw99TmYLGvlq4yLgIa1SJjy1dMXaW swL0T/UM5gRN68WCr/LJXuzeSQRV6BDRGdyukNuFj3JsD9v39Cf2qUwQNStIUPnqRKSM T9jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698741495; x=1699346295; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=28DXBAYX1XRtP2wWeR8rEQtVtlzWFlh45fzZ3wUwj5Y=; b=BN7IdkvhSHo21Y6Zz2amFEXDPg/vv6RjvIpHQjmwgiURy5BQt6z2W0EjPu8V5PjVCQ XS7IOQDaEuYLTDcZt1gp204iaJljTvjoLgQJBekDGg0sBfWE8xisoKNwipJpCv5pxVbm Cs3mv1KqPk2XTBOmROfGzmP2cacYTdH0LTfGSwwNoEjAD7jT86m/LHogihDbvwAU3PIY cAhDrbFT2ygrFPLQULL1XruB/ZkmAaFSNAAqiVuzKfMIVEykaIm/IgCyYm06KnR8wxww /IPdz1ox/7HOgSa/9OWDYlaP/qQpApmybol8ZmfhzAHDsuJpPpu3K7LcE+fvBdsrxzNz SYAA== X-Gm-Message-State: AOJu0YzVeOA8B5YSpV1c2ST2IRJVrq9ejfSSQjVAUsmR62IiigcGGBks ZONe7HFYI7HmMnWXJCK9xWXisA== X-Google-Smtp-Source: AGHT+IHxkBTG12jtDz6LskO7p7yf/0lY5uSyZBd4OmXP62L9S3rUvHiBXN4T9B04oSxoA88vrWaQJw== X-Received: by 2002:a05:6a20:7f87:b0:15b:c800:48af with SMTP id d7-20020a056a207f8700b0015bc80048afmr12323973pzj.23.1698741495120; Tue, 31 Oct 2023 01:38:15 -0700 (PDT) Received: from ?IPV6:2403:580d:82f4:0:d7db:fc6b:2721:a9be? (2403-580d-82f4-0-d7db-fc6b-2721-a9be.ip6.aussiebb.net. [2403:580d:82f4:0:d7db:fc6b:2721:a9be]) by smtp.gmail.com with ESMTPSA id u10-20020a17090282ca00b001c1f4edfb9csm792534plz.173.2023.10.31.01.38.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 Oct 2023 01:38:14 -0700 (PDT) Message-ID: <2974aa13-796c-49ef-bef7-fd7f3f9b7f49@tweaklogic.com> Date: Tue, 31 Oct 2023 19:08:08 +1030 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/2] iio: light: Add support for APDS9306 Light Sensor Content-Language: en-US To: Jonathan Cameron Cc: Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , Andy Shevchenko , Paul Gazzillo , Matt Ranostay , Stefan Windfeldt-Prytz , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231027074545.6055-1-subhajit.ghosh@tweaklogic.com> <20231027074545.6055-3-subhajit.ghosh@tweaklogic.com> <20231028162025.4259f1cc@jic23-huawei> From: Subhajit Ghosh In-Reply-To: <20231028162025.4259f1cc@jic23-huawei> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org > >> +static struct iio_event_spec apds9306_event_spec_als[] = { >> + { >> + .type = IIO_EV_TYPE_THRESH, >> + .dir = IIO_EV_DIR_RISING, >> + .mask_shared_by_all = BIT(IIO_EV_INFO_VALUE), >> + }, { >> + .type = IIO_EV_TYPE_THRESH, >> + .dir = IIO_EV_DIR_FALLING, >> + .mask_shared_by_all = BIT(IIO_EV_INFO_VALUE), >> + }, { >> + .type = IIO_EV_TYPE_THRESH, >> + .mask_shared_by_all = BIT(IIO_EV_INFO_PERIOD), >> + }, { >> + .type = IIO_EV_TYPE_THRESH_ADAPTIVE, >> + .mask_shared_by_all = BIT(IIO_EV_INFO_VALUE) | >> + BIT(IIO_EV_INFO_ENABLE), >> + }, { >> + .type = IIO_EV_TYPE_THRESH, >> + .mask_separate = BIT(IIO_EV_INFO_ENABLE), > This matches an entry above for type. Don't have separate entries. >> + }, >> +}; >> + >> +static struct iio_event_spec apds9306_event_spec_clear[] = { >> + { >> + .type = IIO_EV_TYPE_THRESH, >> + .mask_separate = BIT(IIO_EV_INFO_ENABLE), >> + }, >> +}; >> + >> +#define APDS9306_CHANNEL(_type) \ >> + .type = _type, \ >> + .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_INT_TIME) | \ >> + BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_SAMP_FREQ), \ >> + .info_mask_shared_by_all_available = BIT(IIO_CHAN_INFO_INT_TIME) | \ >> + BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_SAMP_FREQ), \ > > Scale on the intensity channel is interesting... What are the units? > There tend not to be any well defined units for intensity (as opposed > to illuminance). There may be gain on the signal, but it won't be in untils > that map directly to a scale userspace should apply. This is one of the > rare reasons for using the HARDWARE_GAIN element of the ABI. > > A tricky corner however as relationship between raw value and hardwaregain > is not tightly defined (as it can be really weird!) Hi Jonathan, Thank you for taking time for reviewing and clearing all my tiny doubts and queries especially for the dt and versioning part. Much appreciated. In the above case, should I not expose scale for the "clear" channel? Rather, how should I expose the "clear" channel to userspace? Regards, Subhajit Ghosh > >> + >> +static struct iio_chan_spec apds9306_channels_without_events[] = { >> + { >> + APDS9306_CHANNEL(IIO_LIGHT) >> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), >> + }, { >> + APDS9306_CHANNEL(IIO_INTENSITY) >> + .channel2 = IIO_MOD_LIGHT_CLEAR, >> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), >> + .modified = 1, >> + }, >> +}; >