linux/drivers/iio
Richard Lai b91e146c38 iio: chemical: ccs811: Corrected firmware boot/application mode transition
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>
2018-02-24 12:12:19 +00:00
..
accel iio: mma8452: replace license description with SPDX specifier 2018-01-08 16:03:41 +01:00
adc First round of IIO fixes for the 4.16 cycle. 2018-02-20 10:03:22 +01:00
amplifiers iio:amplifiers:ad8366 drop assign iio_info.driver_module and iio_trigger_ops.owner 2017-08-22 21:24:50 +01:00
buffer vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
chemical iio: chemical: ccs811: Corrected firmware boot/application mode transition 2018-02-24 12:12:19 +00:00
common iio: common: ssp_sensors: account for const type of of_device_id.data 2018-01-08 16:03:43 +01:00
counter iio: stm32: Adopt SPDX identifier 2018-01-08 16:03:41 +01:00
dac iio: dac: mcp4725: Remove unneeded conversions to bool 2018-01-08 16:03:41 +01:00
dummy iio: dummy_evgen: modify the return value check for irq_sim_init() 2018-01-08 16:03:41 +01:00
frequency iio:frequency: drop assign iio_info.driver_module 2017-08-22 21:28:20 +01:00
gyro gyro:adis16136: fix debugfs_simple_attr.cocci warnings 2018-01-08 16:03:44 +01:00
health Merge Linus's staging merge point into staging-next 2017-12-06 15:27:17 +01:00
humidity iio: humidity: hts221: move common code in hts221_core 2018-01-08 16:03:43 +01:00
imu iio: adis_lib: Initialize trigger before requesting interrupt 2018-02-17 14:16:35 +00:00
light iio: light: make a couple of config structures static 2018-01-08 16:03:41 +01:00
magnetometer iio: magnetometer: ak8975: Add another ACPI ID 2017-12-02 10:40:02 +00:00
multiplexer iio: multiplexer: add NULL check on devm_kzalloc() and devm_kmemdup() return values 2017-09-03 18:10:29 +01:00
orientation iio:orientation: drop assign iio_info.driver_module 2017-08-22 21:33:36 +01:00
potentiometer Staging/IIO patches for 4.15-rc1 2017-11-13 20:53:28 -08:00
potentiostat iio:potentiostat:lmp91000 drop assign iio_info.driver_module and iio_trigger_ops.owner 2017-08-22 21:34:48 +01:00
pressure iio:pressure:bmp280: Read calibration data in probe 2018-01-08 16:03:43 +01:00
proximity iio: srf08: fix link error "devm_iio_triggered_buffer_setup" undefined 2018-02-04 11:13:00 +00:00
temperature Staging/IIO patches for 4.15-rc1 2017-11-13 20:53:28 -08:00
trigger iio: stm32: Adopt SPDX identifier 2018-01-08 16:03:41 +01:00
iio_core.h the rest of drivers/*: annotate ->poll() instances 2017-11-28 11:06:58 -05:00
iio_core_trigger.h
industrialio-buffer.c First round of IIO fixes for the 4.16 cycle. 2018-02-20 10:03:22 +01:00
industrialio-configfs.c iio: make function argument and some structures const 2017-10-19 16:15:24 +02:00
industrialio-core.c Merge Linus's staging merge point into staging-next 2017-12-06 15:27:17 +01:00
industrialio-event.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
industrialio-sw-device.c iio: make function argument and some structures const 2017-10-19 16:15:24 +02:00
industrialio-sw-trigger.c iio: make function argument and some structures const 2017-10-19 16:15:24 +02:00
industrialio-trigger.c iio:trigger: Remove necessity to have a trig->ops structure. 2017-08-22 21:20:28 +01:00
industrialio-triggered-event.c iio: Support triggered events 2015-08-27 20:47:09 +01:00
inkern.c IIO: inkern: API for manipulating channel attributes 2018-01-10 10:30:08 +00:00
Kconfig iio: multiplexer: new iio category and iio-mux driver 2017-06-03 19:29:26 +09:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00