Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1701526imm; Thu, 12 Jul 2018 06:31:07 -0700 (PDT) X-Google-Smtp-Source: AAOMgpchoKL5OINqOaFQXRYVNms6fHvumKiYMzSpGxBY3k0IDBrT+tUROsCegNgbp6Skvxwu2eE4 X-Received: by 2002:a62:23d1:: with SMTP id q78-v6mr2422621pfj.179.1531402266948; Thu, 12 Jul 2018 06:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531402266; cv=none; d=google.com; s=arc-20160816; b=NJdpe0P19XE1IaksYBOF/XrT1nK7/UU7n06b+9HcydDCbOJKi1NgB6K8GT5AxEggAv 32t1ns9orhPaXy48kH79aR93Y1S7p3B2/r3gKIrGFE0Fnb2LZq1un5em1d6K28mIzANw Ie/OVwBI+4SQLmNTRLQmRSVd2kqdSUwJkwK8zYashtlIdaaZ9zGcHSe4wLGDz4sKjWcr TLD4OqRhWgUxcNvdLOCOIASW5clX7o8m1slnJRsi9fLCpAFrZD62G0M+IXm2neJ+yxHi HVbDPGDdPRGMlz6KM/cZktxcajibbE4qwic3R+BdBQQVXpZuDlbhKO0Sq+Y3woqk0jqQ oajA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=TVMMs1SUYxia3XJbF7/rSxQPMDipov+bEq48tHrw5MY=; b=TVfcIgQB4RgYl0Y7XHduRxrhflAX2zjI+YKQKzxLzzSCsc8YxKMsW/VriWzGd37Cwu l/A5wG7Ze6ZP9QJRRU3j9vlPSDscrMj8yr4uuiFsupKmsj82zaEHyRSDA7jloNaunkgf DqzEg/ZZ82RHWf+6EJpITETNGfEAGWO3RCH539cTPVp3FS2/jaUgIxjaXR4ZXMZbwQxA 5kWfwUhm8ZJxOcwTqjKR9x7pNCDyd8gO2CL7GvaVqvx7E/830V/JCQxYZOA+S+XE0dFs RQHt2hUazmsa2UGxM3HrU9weeDlcuTZy0RcTBTIlFSNk4SP2rrHeMkaxUuW7x13eNh6W eNbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3-v6si21293852plp.443.2018.07.12.06.30.37; Thu, 12 Jul 2018 06:31:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727667AbeGLNi6 (ORCPT + 99 others); Thu, 12 Jul 2018 09:38:58 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:9176 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727175AbeGLNi6 (ORCPT ); Thu, 12 Jul 2018 09:38:58 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 5A343B83A128D; Thu, 12 Jul 2018 21:29:08 +0800 (CST) Received: from localhost (10.202.226.43) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.382.0; Thu, 12 Jul 2018 21:29:03 +0800 Date: Thu, 12 Jul 2018 14:28:53 +0100 From: Jonathan Cameron To: Matt Ranostay CC: Himanshu Jha , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , , , Daniel Baluta Subject: Re: [PATCH v3] iio: chemical: Add support for Bosch BME680 sensor Message-ID: <20180712142853.00005f64@huawei.com> In-Reply-To: References: <1531311229-3586-1-git-send-email-himanshujha199640@gmail.com> Organization: Huawei X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.43] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 Jul 2018 17:40:07 -0700 Matt Ranostay wrote: > On Wed, Jul 11, 2018 at 5:13 AM, Himanshu Jha > wrote: > > Bosch BME680 is a 4-in-1 sensor with temperature, pressure, humidity > > and gas sensing capability. It supports both I2C and SPI communication > > protocol for effective data communication. > > > > The device supports two modes: > > > > 1. Sleep mode > > 2. Forced mode > > > > The measurements only takes place when forced mode is triggered and a > > single TPHG cycle is performed by the sensor. The sensor automatically > > goes to sleep after afterwards. > > > > The device has various calibration constants/parameters programmed into > > devices' non-volatile memory(NVM) during production and can't be altered > > by the user. These constants are used in the compensation functions to > > get the required compensated readings along with the raw data. The > > compensation functions/algorithms are provided by Bosch Sensortec GmbH > > via their API[1]. As these don't change during the measurement cycle, > > therefore we read and store them at the probe. The default configs > > supplied by Bosch are also set at probe. > > > > 0-day tested with build success. > > > > GSoC-2018: https://summerofcode.withgoogle.com/projects/#6691473790074880 > > Mentor: Daniel Baluta > > [1] https://github.com/BoschSensortec/BME680_driver > > Datasheet: > > https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BME680-DS001-00.pdf > > > > Cc: Daniel Baluta > > Signed-off-by: Himanshu Jha > > --- > > > > v3: > > -moved files to chemical directory instead of a dedicated directory. > > -read calibration parameters serially with endian conversions. > > -drop some return ret. > > -removed few unnecessary casts safely. > > -added 'u' suffix to explicitly specify unsigned for large values > > and thereby fixing comiler warning. > > -left aligned all comments. > > -added a comment explaining heater stability failure. > > > > v2: > > -Used devm_add_action() to add a generic remove method for > > both I2C & SPI driver. > > -Introduction of compensation functions. > > -chip initialisation routines moved to respective I2C and SPI > > driver. > > -Introduction of gas sensing rountines. > > -Simplified Kconfig to reduce various options. > > > > drivers/iio/chemical/Kconfig | 25 + > > drivers/iio/chemical/Makefile | 3 + > > drivers/iio/chemical/bme680.h | 99 ++++ > > drivers/iio/chemical/bme680_core.c | 946 +++++++++++++++++++++++++++++++++++++ > > drivers/iio/chemical/bme680_i2c.c | 83 ++++ > > drivers/iio/chemical/bme680_spi.c | 123 +++++ > > 6 files changed, 1279 insertions(+) > > create mode 100644 drivers/iio/chemical/bme680.h > > create mode 100644 drivers/iio/chemical/bme680_core.c > > create mode 100644 drivers/iio/chemical/bme680_i2c.c > > create mode 100644 drivers/iio/chemical/bme680_spi.c > > > > diff --git a/drivers/iio/chemical/Kconfig b/drivers/iio/chemical/Kconfig > > index 5cb5be7..24790a8 100644 > > --- a/drivers/iio/chemical/Kconfig > > +++ b/drivers/iio/chemical/Kconfig > > @@ -21,6 +21,31 @@ config ATLAS_PH_SENSOR > > To compile this driver as module, choose M here: the > > module will be called atlas-ph-sensor. > > > > +config BME680 > > + tristate "Bosch Sensortec BME680 sensor driver" > > + depends on (I2C || SPI) > > + select REGMAP > > + select BME680_I2C if (I2C) > > + select BME680_SPI if (SPI) > > Don't think you actually need parentheses around any of these, but of > course then again doesn't hurt Nice to tidy this one up, though if it is all there is I can do that whilst applying. So don't bother sending a v4 for this until other reviews are in. > > > + help > > + Say yes here to build support for Bosch Sensortec BME680 sensor with > > + temperature, pressure, humidity and gas sensing capability. > > + > > + This driver can also be built as a module. If so, the module for I2C > > + would be called bme680_i2c and bme680_spi for SPI support. > > + > > +config BME680_I2C > > + tristate > > + depends on BME680 > > + depends on I2C > > Wouldn't "depends on I2C && BME680" be cleaner? Maybe someone else > here can tell me if I'm too nit-picky :) You said it ;) Can't say I care either way on these. > > > + select REGMAP_I2C > > + > > +config BME680_SPI > > + tristate > > + depends on BME680 > > + depends on SPI > > Same only with SPI > > > + select REGMAP_SPI > > + > > config CCS811 > > tristate "AMS CCS811 VOC sensor" > > depends on I2C ... Matt, please give us indication if you don't have anything else to say :) Saves on a lot of scrolling and wondering if we missed something (which of course I might have done!)