Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp380336rwb; Thu, 11 Aug 2022 03:18:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Z0N6F2m9kD+2NecddvdRMsQ26aiIQ+KtpxnvhlsBkGlvRAqUnyEctWoRi8oqrXJ+52qki X-Received: by 2002:a05:6402:3546:b0:43e:466c:d4ed with SMTP id f6-20020a056402354600b0043e466cd4edmr30555382edd.48.1660213136929; Thu, 11 Aug 2022 03:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660213136; cv=none; d=google.com; s=arc-20160816; b=loVWQ9tzeU5tYPPlsKWEqTKiibRi3xQYY5MXuY4mzPjSCvNO8trT0ct7t+lnhTmg2R ltq3sD3IPJtrreKZgcPTqdFntNkABlJ1CR5VviNDbrEoPp8DK/bV9qeLkqh4FoX3M7ht moLMukNjN8L9XiFge0pXEpUpjvw0CScsbDKaTatNf803/YhXDlws0JManAkzMuWbPC2L xCcUgiEDlGt2kevMFLsetKGj4ECqNpIClr7RukBIetgaKeoS2bh6eFqqwS0+IiZb+XGj dOBxuykhbeapFeWiZ1S385SH7R2GPHDl9Ufu4XVBoMGhC83HNjpbP6M21HSEZg7L3+n6 ynNw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=qq8IqJjMAjadCIWpAsESfMboLAV1n/Yvbnxvo/9mljk=; b=xC0pwPQq7/yBdi8Vm9pOkvyQK/dAE3v1bABKaGPT6iVX/RcTQhfFbKbybk0WeG6Ut4 sWM05+IeWnN7VJnqRPBfPMT4ETIOTzfG/iAbziIzeXAxTrglcDDzb3KMWNN6UI6rbhX/ UmeXa2CNxPWeEEGXl65YFyrZ+4kHH+FjnzLafJ06NtGYlwcmcAJ/wSXUwGB6ftE3y6Xn c6VuC4TYeBsGZ1PtlM8dBLgHhfsYSZjMQrrfjVpdqffNOSRoDOJOG/pqMfkTgjeCJq6D xr2HuGz50Tb0r2qXGUEEGjLoVIjIesV0iNjLoihZYtEDePH4EDF/uW0hxoaVACtxLB46 BkVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=KLLHM19v; 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=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd40-20020a17090796a800b00733067cfd8asi5298642ejc.288.2022.08.11.03.18.31; Thu, 11 Aug 2022 03:18:56 -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; dkim=pass header.i=@collabora.com header.s=mail header.b=KLLHM19v; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234498AbiHKKPe (ORCPT + 99 others); Thu, 11 Aug 2022 06:15:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234477AbiHKKPb (ORCPT ); Thu, 11 Aug 2022 06:15:31 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF8DC1900C; Thu, 11 Aug 2022 03:15:30 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2405:201:10:389d:42df:ae4c:c047:294c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: shreeya) by madras.collabora.co.uk (Postfix) with ESMTPSA id BBEAF6601CE2; Thu, 11 Aug 2022 11:15:27 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1660212929; bh=zKeoj5xNpf9SpJXxagsMyA/3VCmfRNytMGTc1lfMEqQ=; h=From:To:Cc:Subject:Date:From; b=KLLHM19vgXRVv5ngGvek04gSMK60da91pwuHP5UnRlci9lBenNN2wZ7JyV588lvdw bIG5UhQN+dmzJaTGAC6UUahXmsN1yM5B+XPVL3juXhEjCmY3zm71og/w5g3HojTwsK Lb0lNzzr6UsAwn/3sZ5LtrXV2YC/aKr4ePf7A5503k65+KF70CqJNYB3g8NVAewp1A 2dwkoUi7dGlu8Tj1GWAg4o21BWcR84dBRfLkH2/bhM/3slkyPWGCeVBT0aaL33zI2L hRINel3ykOoKTjskdinFavxtbP1HW9Eft9unAvmCF2u3jhfulFQS9aTxf9xnTQzGbe h2lrLOxnmtikw== From: Shreeya Patel To: jic23@kernel.org, lars@metafoo.de Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, krisman@collabora.com, kernel@collabora.com, alvaro.soliverez@collabora.com, Shreeya Patel Subject: [PATCH] iio: light: Add raw attribute Date: Thu, 11 Aug 2022 15:44:43 +0530 Message-Id: <20220811101443.499761-1-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Add IIO_CHAN_INFO_RAW to the mask to be able to read raw values from the light sensor. 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); -- 2.30.2