Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp96997rdb; Tue, 31 Oct 2023 01:39:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/NDIBdYtcYUrq90PNGRQRBMiEDsiglk9WRVicGsyF8h7rnAjqhqS2POJUTQNKpBGwqxdA X-Received: by 2002:a05:6a20:2447:b0:134:2b31:e2a9 with SMTP id t7-20020a056a20244700b001342b31e2a9mr11315886pzc.0.1698741571157; Tue, 31 Oct 2023 01:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698741571; cv=none; d=google.com; s=arc-20160816; b=et/8l1g4jE5Q8KDcSw28aSxd9ajdGPTJtpKkR1LxIGD6vkh5VwNelytAxe5SiFcbZj FLsPwu0eHJ/icC8J1RwtWBfl9x7dbyV1ji+pcb+I2ZslaQ5ysmtg//EpGlqVNvMUVRi9 +WivvbzLCL5cZpRT2MXnsRBoMB9Bt+UlYxn6D+RrTkWXE2OOr3J9dk/p+Bh298nimU2U HxN4dsvB19dQ/ElH20GUDRBBgmGSzdOO67d1xKrm5mZxM1nLXUlRA5nhRg8CkG8VSB4W GOc96YL5cqw7fEHBTuvPYUbuly5FieUaI67kMevHzmVo46R3zzf091L7LY8zEWGphJpS dgYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=28DXBAYX1XRtP2wWeR8rEQtVtlzWFlh45fzZ3wUwj5Y=; fh=4KQ6gEpZcroPx5lbO32TGpkySfPsQ5BTrJ3Ks57qqKw=; b=YuzknyJBXT82vJftWinGECxK7mnaZhC2P4jttj62f7v9pZfdE6041++XfHKVOSYi9q WPAzkh0knbVMJilaXoVcKzoI08DLmxwLpm1/Fk3NO6iEBtCcYv+d4Y/uTYA1nOADWAEA fICIy/JVkV0vLHB670dvT3xyxz6ADc5CsXycGaA5BB/jCaU33BMIuHRyelYYhyDjm15I Sjx+Nzaaj/GQaHqz6uOuuzpch/kEOtXjSrV7CdwBhyS+DocX0QFuUybboc+NDOKcWob1 Ubx4AFOKAVQIzyYQOxuokw9V+zni8rSwNJaTZOKmmxARzg1YkGh3iafeBnKqaiGgFk4B KSVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tweaklogic.com header.s=google header.b=eA9m+CUv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bv130-20020a632e88000000b005b9377ee20bsi735723pgb.148.2023.10.31.01.39.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 01:39:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@tweaklogic.com header.s=google header.b=eA9m+CUv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D60108090042; Tue, 31 Oct 2023 01:39:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235449AbjJaIj1 (ORCPT + 99 others); Tue, 31 Oct 2023 04:39:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235349AbjJaIjI (ORCPT ); Tue, 31 Oct 2023 04:39:08 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E345918F for ; Tue, 31 Oct 2023 01:38:15 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-5b7f3f470a9so3606659a12.0 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=qsjNETAzbdkXlgld/ZrAaZdfHw/JdJHIbp7QVEbRGHLZ/Sdd9DledD3ye1dYHjWrge k02elEmudGzYPWvhs+KVisnwz8VA2DkNp2KT+nhkt4kWWvXf/KPnv9j0WkUBcvEd6WwR ceKyzt5GCCOwX0V2bipNHF6SOfbMzQm8HspM09Rf03wVMaaoh5HD+A5x6YfCPtUcvxU9 Mq+hAM+U7IOCiE8lYYTKMFVVgOyb3Zcz1kup89JsOtzVVP4V0jFgxcm5ImhFZCQ0Uzbb Xgab0jcrpBVuk9RV9i75QKUe3B5qwDHYjo50Bw+2Sx7ndpn5H8WlHBzZR5YUb0XQpqWU bhhQ== X-Gm-Message-State: AOJu0YxV5wjen8JVV4bITAxOxyPell8EPtgI/hHzNb7nuAbYvI0ttRHf jFTyaOfeYTX0c2aG9c28aOfuRA== 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 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_BLOCKED, SPF_HELO_NONE,SPF_PASS,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]); Tue, 31 Oct 2023 01:39:30 -0700 (PDT) > >> +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, >> + }, >> +}; >