1
0
Fork 0
remarkable-linux/drivers/iio/chemical
Richard Lai f81b0e627b iio: chemical: ccs811: Corrected firmware boot/application mode transition
commit b91e146c38 upstream.

CCS811 has different I2C register maps in boot and application mode. When
CCS811 is in boot mode, register APP_START (0xF4) is used to transit the
firmware state from boot to application mode. However, APP_START is not a
valid register location when CCS811 is in application mode (refer to
"CCS811 Bootloader Register Map" and "CCS811 Application Register Map" in
CCS811 datasheet). The driver should not attempt to perform a write to
APP_START while CCS811 is in application mode, as this is not a valid or
documented register location.

When prob function is being called, the driver assumes the CCS811 sensor
is in boot mode, and attempts to perform a write to APP_START. Although
CCS811 powers-up in boot mode, it may have already been transited to
application mode by previous instances, e.g. unload and reload device
driver by the system, or explicitly by user. Depending on the system
design, CCS811 sensor may be permanently connected to system power source
rather than power controlled by GPIO, hence it is possible that the sensor
is never power reset, thus the firmware could be in either boot or
application mode at any given time when driver prob function is being
called.

This patch checks the STATUS register before attempting to send a write to
APP_START. Only if the firmware is not in application mode and has valid
firmware application loaded, then it will continue to start transiting the
firmware boot to application mode.

Signed-off-by: Richard Lai <richard@richardman.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28 18:24:28 +02:00
..
Kconfig iio: chemical: ccs811: Add triggered buffer support 2017-08-18 08:08:02 +01:00
Makefile iio: chemical: ccs811: Add support for AMS CCS811 VOC sensor 2017-07-22 21:16:37 +01:00
ams-iaq-core.c drivers: iio: chemical: replace comma with a semicolon 2017-03-30 19:13:23 +01:00
atlas-ph-sensor.c iio:chemical:atlas-ph-sensor: Fix use of 32 bit int to hold 16 bit big endian value 2016-10-23 22:18:27 +01:00
ccs811.c iio: chemical: ccs811: Corrected firmware boot/application mode transition 2018-03-28 18:24:28 +02:00
vz89x.c drivers: iio: chemical: replace comma with a semicolon 2017-03-30 19:13:23 +01:00