From patchwork Wed Feb 14 01:08:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Lai X-Patchwork-Id: 10217895 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 43D516055C for ; Wed, 14 Feb 2018 01:09:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3362328D0D for ; Wed, 14 Feb 2018 01:09:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2827A28EAB; Wed, 14 Feb 2018 01:09:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4469328D0D for ; Wed, 14 Feb 2018 01:09:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966288AbeBNBJO (ORCPT ); Tue, 13 Feb 2018 20:09:14 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:50611 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966254AbeBNBJN (ORCPT ); Tue, 13 Feb 2018 20:09:13 -0500 Received: by mail-wm0-f67.google.com with SMTP id k87so1589118wmi.0 for ; Tue, 13 Feb 2018 17:09:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=richardman-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Vds4zGAG56yi5Lotq7fK6UH3uCi/u0s/8MgjkdEI5PE=; b=LRE+UhtuKvqaS1r/ayjX/4vWscI87YCi0giipy3obigbBOnzq5eDqdN4G0xy5kc4dv nGIPAAVf44uRvY0B7hyLnxSCc6Rwgnq7zWEwBpWH56Wiu/9AI+HxroiLInTvL0SW9sTJ o/H42QtbndqFQ0cT/d9seqjR8dY8hLGv+/HkAG7/plfqP1vSXSghihDHynDlccmcLZUN gXSEsJlVlhsuH4d0dVKuG8YaefK0kzD3LYb5sUvTVi4/rUmZaBURcSKFz56Lb3YnK8Vl ZzPvdEG/vMcOEJlTGYhJ2TKeSKw54L5WO/YtZHHaR5sKIpga20ob9/bBgNZW4gbRf1ue 35pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Vds4zGAG56yi5Lotq7fK6UH3uCi/u0s/8MgjkdEI5PE=; b=I4ReY04HKUm59hh2y2TcA129JjHFrntAZMSZNtNFi03hpw9xNlZlb2Dwc7GJnGWISe yphK5Q/DrOFImF9sZEJgikvqRpp5Vzn7PtW30+BtLzt3r7Utpab11N77ajYDFNiTHtzy zbDUzR7+w9HHt8dZ437Ns29BNAtu3R8AqGtXcy43XbcyBL4vVXDJ0PIehmeTlgQxZvVu hVfHGUSQrct4Xmgth8meQvFLHfckVJLU5dgBTmj2O58W7fUUKweGNtd7a/4NxL6YTiUR EeZvlGFkrDSBCPVEKBhYQ4yh0g+ZlDhxrRqb9sIR3ePAHrd4iaKqZwvySOWlH+yoM29I fs/A== X-Gm-Message-State: APf1xPA8w6S/V+dJWA1VvsYGSPm8S+XWKfJtPzWK+rpewgfd0azaT+WU cxhhk2ep7AiXmJEcGSIVhMzvDA== X-Google-Smtp-Source: AH8x226tC4HU3790d7oGoVe7rZ2A84JWKkuGzgDgIzf2VKvt/EQhh5A2CtEHshhTnbAlzgh6zS/2ag== X-Received: by 10.28.178.147 with SMTP id b141mr2488117wmf.87.1518570552305; Tue, 13 Feb 2018 17:09:12 -0800 (PST) Received: from RICHARDMAN.localdomain (cpc91232-cmbg18-2-0-cust493.5-4.cable.virginm.net. [82.2.125.238]) by smtp.gmail.com with ESMTPSA id a53sm14414479wrc.52.2018.02.13.17.09.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Feb 2018 17:09:11 -0800 (PST) From: Richard Lai Cc: richard@richardman.com, Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Narcisa Ana Maria Vasile , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iio: chemical: ccs811: Renamed resistance member in ccs811_reading struct Date: Wed, 14 Feb 2018 01:08:35 +0000 Message-Id: <1518570519-1117-1-git-send-email-richard@richardman.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The resistance member in ccs811_reading struct is an unsigned 16-bit integer variable used to store RAW_DATA register bytes read from CCS811. It is kind of misleading to name this struct member as resistance. About the RAW_DATA register bytes, the CCS811 datasheet states that: ----- Two byte read only register which contains the latest readings from the sense resistor. The most significant 6 bits of the Byte 0 contain the value of the current through the sensor (0μA to 63μA). The lower 10 bits contain (as computed from the ADC) the readings of the voltage across the sensor with the selected current (1023 = 1.65V)" ----- Hence, the RAW_DATA register byte contains information about electric current and voltage of the CCS811 sensor. Calling this struct member 'resistance' is kind of misleading, although both electric current and voltage are needed to calculate the electrical resistance of the sensor using Ohm's law, V = I x R, in which a new channel type of IIO_RESISTANCE may be added to the driver in the future. Signed-off-by: Richard Lai Acked-by: as then it is recorded in the record rather than deep in an email --- drivers/iio/chemical/ccs811.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/chemical/ccs811.c b/drivers/iio/chemical/ccs811.c index 8e8beb7..e6f6bc4 100644 --- a/drivers/iio/chemical/ccs811.c +++ b/drivers/iio/chemical/ccs811.c @@ -66,7 +66,7 @@ struct ccs811_reading { __be16 voc; u8 status; u8 error; - __be16 resistance; + __be16 raw_data; } __attribute__((__packed__)); struct ccs811_data { @@ -202,12 +202,12 @@ static int ccs811_read_raw(struct iio_dev *indio_dev, switch (chan->type) { case IIO_VOLTAGE: - *val = be16_to_cpu(data->buffer.resistance) & + *val = be16_to_cpu(data->buffer.raw_data) & CCS811_VOLTAGE_MASK; ret = IIO_VAL_INT; break; case IIO_CURRENT: - *val = be16_to_cpu(data->buffer.resistance) >> 10; + *val = be16_to_cpu(data->buffer.raw_data) >> 10; ret = IIO_VAL_INT; break; case IIO_CONCENTRATION: