Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1886812rdb; Sun, 4 Feb 2024 05:43:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtRD6fSlQP8PN3hQFzE+nCRMX3bkqGeGKWyOOW4f4sFIViyweulXkgt+O3gtbMDhMPF4M8 X-Received: by 2002:a17:90a:cc0a:b0:296:7bc3:7597 with SMTP id b10-20020a17090acc0a00b002967bc37597mr1342546pju.17.1707054184362; Sun, 04 Feb 2024 05:43:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707054184; cv=pass; d=google.com; s=arc-20160816; b=fE7xUHwHk1VpUjYF+ha1YIvuSLVN/TdumDIhsivYLFE/A4huVsC1R8SDS9OZidRCgY v5TmD/q5FQ/l4Bx8lWQ2oxdPgDVuqi1VxrePvtx1GWJUCFLlwf/XD0s7sv3x1SLvUOME apm7SqiPVgDpjwjKQr0eUJyyRb0P3lMr3JNI+URqNKXJTDDcR/7/HFV8c7vmX3ijYbZR N7hG+gubmuPfXTmqDQiahCf4hWAqxiOFjfwJvId6Gk1DQrwnZ0Or4A66qN9kddxkuMOC kYwFY2+/q3l2P8V6RnqEgU915KUsBMYDoSF8Tg1otBk+Q3asOWjKxwb+YON1F0Q9riOR LKiA== ARC-Message-Signature: i=2; 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=MBR+lS1XAr/rhhv9RPYre+xHHqvlfXwCjCvUGzd9rs8=; fh=agstRTv62tPvx/VcnSl0vYiG415ORyolNiDuF4G50cA=; b=DGAgmoquXxaFbwROh9hP773UgDR9a8jw0j4PLShtrWnsbiSW3hfUnt6XorPiSY1iHk CL4sfLzby2kdXVvveRONKrcWLixt1njcxZh1RXcrAmWu4u5RYtis/VgwdoXKJLm4GKG8 a700FcEiotfftSFMpqsVwtHPyMERywhtDaMNRHnR7M4U1+sssVM+mSlIxkOYQmihWROU GSYptfJdJOxKHdf3bCOD3+VI1HOZMKMZtrd+m9BFo3bJW0uipC3iQnr3dgUYS+9H+xt7 LmP38boWL/Cryc6PgGJsTB/S8iT5qp8CzdFU91zePpW4rFurdiFr9kIGI1MI4mhyv0kR j6iQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dd4dy9di; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51676-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51676-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCXyRkU/r+7dvfT49Bt8e/l2kB634joAMOWYKY12l+9bh3G/BOubGqvPl10MR6Tx3A4mLf2PktAECg0aaCs7LjElRVK+W1RwwhNkUtARNg== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h7-20020a17090a470700b00296168c7cdasi2940222pjg.165.2024.02.04.05.43.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 05:43:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51676-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dd4dy9di; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51676-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51676-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 87234B23351 for ; Sun, 4 Feb 2024 13:41:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 20BE3224FA; Sun, 4 Feb 2024 13:41:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dd4dy9di" 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 3617624A0D; Sun, 4 Feb 2024 13:41:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707054071; cv=none; b=o+vZ7Z2lcNQEMJ3asKye/pcuGnjJY4+5bQ+SG403u3/Kmb6vE9yYLpnS2XbfLXEmqS8V1akL2/L0xvdcoRRxhb8eSWQ62vU7mT2oztmbOJsfdr08zokQrPyegZqck9ue1GQx2n5190UH4e5+J/OS93I6H1hMZQ9QTJXgK2MHTiE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707054071; c=relaxed/simple; bh=QQi+L54IHlqVrO+b4uCPKhTLx6aVmrEehR+ugW8qGDg=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SN2oRF/wwlFkHQfajDAFYFKsxvC5IRPg+MUUNmdfgAY+daK/Icp1NyvG/F2Lgk/9DP7ERQYYEi/D0IEqeJVf45ygdzHAlLQ5N6XLBcN5WWeGmfgUUBcu80XjQoCS8HmFhXdqH6jjWstqnoLRL9XIbjx35KnnDtJQDKul+VW3VXo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dd4dy9di; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C70F6C433F1; Sun, 4 Feb 2024 13:41:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707054070; bh=QQi+L54IHlqVrO+b4uCPKhTLx6aVmrEehR+ugW8qGDg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dd4dy9diFtUypiMGrjx6IBME6EqrSvcgT+HcV2VE5xyN8S+ZMWziwfFbrP9DBaiJ4 krvwPlFIPg11U/hrxH9BGzFpDVy9O+fmuzvpVNChWCw/43ye+zh9Quqq5n1/d3fXm2 0ORaKQvD44PziYuccW0YWQjIUA1iutQ3brgh/txSLIa/KZlt5ew8LyUrgSowvs/5gZ 2x+LBTmhRtAm2H76m5cq5sOVhKW/zuivwTQnN+4yibhXN3SeAA5irOmEVLXneQohN6 HJLorwkertRv+gKLvmh/mSjCM4AhIOgPA6nMEw8iprQwoerazg+C8VZQeYTHnmv0Oe q2ZCkdmQ1OwRQ== Date: Sun, 4 Feb 2024 13:40:56 +0000 From: Jonathan Cameron To: Subhajit Ghosh Cc: Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , Andy Shevchenko , Marek Vasut , Anshul Dalal , Javier Carrasco , Matt Ranostay , Stefan Windfeldt-Prytz , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 3/3] iio: light: Add support for APDS9306 Light Sensor Message-ID: <20240204134056.5dc64e8b@jic23-huawei> In-Reply-To: References: <20240121051735.32246-1-subhajit.ghosh@tweaklogic.com> <20240121051735.32246-4-subhajit.ghosh@tweaklogic.com> <20240121152332.6b15666a@jic23-huawei> <757a18b7-94f4-4d72-9917-5d8b1cd677f6@tweaklogic.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; 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=UTF-8 Content-Transfer-Encoding: quoted-printable On Sun, 4 Feb 2024 21:53:55 +1030 Subhajit Ghosh wrote: > Hi Jonathan, > >> =20 > >>> + > >>> +static struct iio_event_spec apds9306_event_spec_als[] =3D { > >>> +=C2=A0=C2=A0=C2=A0 { > >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .type =3D IIO_EV_TYPE_THR= ESH, > >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .dir =3D IIO_EV_DIR_RISIN= G, > >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .mask_shared_by_all =3D B= IT(IIO_EV_INFO_VALUE), > >>> +=C2=A0=C2=A0=C2=A0 }, { > >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .type =3D IIO_EV_TYPE_THR= ESH, > >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .dir =3D IIO_EV_DIR_FALLI= NG, > >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .mask_shared_by_all =3D B= IT(IIO_EV_INFO_VALUE), > >>> +=C2=A0=C2=A0=C2=A0 }, { > >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .type =3D IIO_EV_TYPE_THR= ESH, > >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .mask_shared_by_all =3D B= IT(IIO_EV_INFO_PERIOD), > >>> +=C2=A0=C2=A0=C2=A0 }, { > >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .type =3D IIO_EV_TYPE_THR= ESH_ADAPTIVE, > >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .mask_shared_by_all =3D B= IT(IIO_EV_INFO_VALUE) | > >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 B= IT(IIO_EV_INFO_ENABLE), > >>> +=C2=A0=C2=A0=C2=A0 }, { > >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .mask_separate =3D BIT(II= O_EV_INFO_ENABLE), =20 > >> > >> What's the intent of this final entry? > >> The type will default to IIO_EV_TYPE_THRESH anyway but if that > >> the intent you should specify it.=C2=A0=C2=A0 There isn't an 'obvious' > >> default for type in the same way there sort of is for dir > >> (as it's either direction). =20 > > Understood, let me experiment and see the ABI difference, if any and ge= t back to you. > > =20 > This device has two channels - ALS and CLEAR. One interrupt enable option= and > one Channel selection option (Clear or ALS). According to our previous di= scussions: > https://lore.kernel.org/all/20230415183543.6d5e3392@jic23-huawei/ > the event_spec was updated to have two interrupt enable attributes - one = for CLEAR and > one for ALS. (Intensity channel and Illuminance channel) >=20 > If I remove the final entry I am getting only one enable option (intensit= y channel): > /sys/bus/iio/devices/iio:device0/ > |-- events > | |-- in_intensity_clear_thresh_either_en > | |-- thresh_adaptive_either_en > | |-- thresh_adaptive_either_value > | |-- thresh_adaptive_either_values_available > | |-- thresh_either_period > | |-- thresh_either_period_available > | |-- thresh_falling_value > | `-- thresh_rising_value >=20 > The last entry gives be the following event attributes, enable attributes= for both > intensity and illuminance channels: > /sys/bus/iio/devices/iio:device0/ > |-- events > | |-- in_illuminance_thresh_either_en > | |-- in_intensity_clear_thresh_either_en > | |-- thresh_adaptive_either_en > | |-- thresh_adaptive_either_value > | |-- thresh_adaptive_either_values_available > | |-- thresh_either_period > | |-- thresh_either_period_available > | |-- thresh_falling_value > | `-- thresh_rising_value >=20 > Please let me know if this sounds ok to you. Looks like coincidence of enum values being 0. It's really { .type =3D IIO_EV_TYPE_THRESH, /* Value 0 */ .dir =3D IIO_EV_DIR_EITHER, /* value 0 */ .mask_separate =3D BIT(IIO_EV_INFO_ENABLE), Dropping 'defaults' for these things is fine if they are the obvious default or other parameters mean they aren't used, but that isn't the case here so please be explicit for all the values that are used. You can put this final mask a few lines earlier as the other fields match anyway. { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .type =3D IIO_EV_TYPE_THRESH, .dir =3D IIO_EV_DIR_EITHER, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .mask_shared_by_all =3D BIT(IIO= _EV_INFO_PERIOD), .mask_separate =3D BIT(IIO_EV_INFO_ENABLE), },.. >=20 > Regards, > Subhajit Ghosh