Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp563443rwb; Thu, 11 Aug 2022 06:29:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR5rGzI9n5NB+4ybiWPR8dVC2Ehwp7ugK7EwnJLx56XTUGW7ilp97X8fwLHkstdJJOBUTJPM X-Received: by 2002:a17:90b:3141:b0:1f7:75cf:a449 with SMTP id ip1-20020a17090b314100b001f775cfa449mr8783958pjb.18.1660224565887; Thu, 11 Aug 2022 06:29:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660224565; cv=none; d=google.com; s=arc-20160816; b=b+CK921JxCNWR8p3LRYyvP6wynosgKjiyn8uolxBya+Wu/eCKSZYThRgbEY7+1R7wX HVpq+5vTkrNcJdk13jx4e0aao/8DXPbn3u8+bJxdMORnVRZW0mZaOKDevjLz3rMWrZG1 VDJffRmDYQVOrY78TaoFOAYaPovXpLiGZBT940Hc8CZzrUhMtCyzggeUqY4A8DIg0Hil L5dwlEwKHq6szspWoMQbTGKIiVGXcVz4iIw+2OJcfpo/4ROKSTaOlsanTMKoCLdA294v 7SDgVV1lXE2aKw9dTj5YXdpICdPYR6q98BjTZVIjiErJ+e8ZbXYehDA01Cop7yPrnUNy eUCA== 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; bh=Lk9frMdEObyXdAGW+vC5MAu2SbReFZiP9mURRBgHdZ0=; b=eGRc1N9ndyi65qiZQH7Yl96cLMqa3Mc5D25ePGIMtXy5zMTsKK2mJQzufw1F/+Y2Lb ml1eHQDcqKVjoPLSIDi1SPwjNrRUJsz8fsbtdYxybxBpRkyS+rAYnUsXs/5iHwW0a+np M9A7hEEvu0e20BmjqDmw4SQrY5TMiApNzv7yoFDRBKwyDKMkRqA/0ntwrRHf/YsnWqlj 0lLFHrdwlT089uMy8ZZ4AUYk70JbZl936iv9BnfpA/vRIzFo8ycy069FUzjKY9NKf1UW dN2UVfMtBdzJuHlECj699HDdrOSCcFT6yRYyPh9IcYU+58MPXMmcM7VUg+eLsBiIaMM1 teLA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i3-20020a170902cf0300b0015ebfbc1a42si2625352plg.533.2022.08.11.06.29.10; Thu, 11 Aug 2022 06:29:25 -0700 (PDT) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235519AbiHKNZZ (ORCPT + 99 others); Thu, 11 Aug 2022 09:25:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234066AbiHKNZX (ORCPT ); Thu, 11 Aug 2022 09:25:23 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C118D45F4D; Thu, 11 Aug 2022 06:25:22 -0700 (PDT) Received: from fraeml742-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4M3S9T0T85z67MDp; Thu, 11 Aug 2022 21:20:45 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by fraeml742-chm.china.huawei.com (10.206.15.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 11 Aug 2022 15:25:20 +0200 Received: from localhost (10.202.226.42) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 11 Aug 2022 14:25:19 +0100 Date: Thu, 11 Aug 2022 14:25:18 +0100 From: Jonathan Cameron To: Shreeya Patel CC: , , , , , , Subject: Re: [PATCH] iio: light: Add raw attribute Message-ID: <20220811142518.00000256@huawei.com> In-Reply-To: <20220811101443.499761-1-shreeya.patel@collabora.com> References: <20220811101443.499761-1-shreeya.patel@collabora.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.42] X-ClientProxiedBy: lhrpeml500004.china.huawei.com (7.191.163.9) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,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 On Thu, 11 Aug 2022 15:44:43 +0530 Shreeya Patel wrote: > Add IIO_CHAN_INFO_RAW to the mask to be able to read raw values > from the light sensor. Why is this useful? It's rare to support _PROCESSED and _RAW for the same channel. Normally occurred to avoid breaking ABI. Jonathan > > Signed-off-by: Shreeya Patel > --- > drivers/iio/light/ltrf216a.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/iio/light/ltrf216a.c b/drivers/iio/light/ltrf216a.c > index e6e24e70d2b9..a717bf99bd2a 100644 > --- a/drivers/iio/light/ltrf216a.c > +++ b/drivers/iio/light/ltrf216a.c > @@ -93,6 +93,7 @@ static const struct iio_chan_spec ltrf216a_channels[] = { > { > .type = IIO_LIGHT, > .info_mask_separate = > + BIT(IIO_CHAN_INFO_RAW) | > BIT(IIO_CHAN_INFO_PROCESSED) | > BIT(IIO_CHAN_INFO_INT_TIME), > .info_mask_separate_available = > @@ -259,6 +260,18 @@ static int ltrf216a_read_raw(struct iio_dev *indio_dev, > int ret; > > switch (mask) { > + case IIO_CHAN_INFO_RAW: > + ret = ltrf216a_set_power_state(data, true); > + if (ret) > + return ret; > + mutex_lock(&data->lock); > + ret = ltrf216a_read_data(data, LTRF216A_ALS_DATA_0); > + mutex_unlock(&data->lock); > + if (ret < 0) > + return ret; > + *val = ret; > + ltrf216a_set_power_state(data, false); > + return IIO_VAL_INT; > case IIO_CHAN_INFO_PROCESSED: > mutex_lock(&data->lock); > ret = ltrf216a_get_lux(data);