• Richard Lai's avatar
    iio: chemical: ccs811: Corrected firmware boot/application mode transition · f81b0e62
    Richard Lai authored
    commit b91e146c 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: default avatarRichard Lai <richard@richardman.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    f81b0e62
Name
Last commit
Last update
..
accel Loading commit data...
adc Loading commit data...
amplifiers Loading commit data...
buffer Loading commit data...
chemical Loading commit data...
common Loading commit data...
counter Loading commit data...
dac Loading commit data...
dummy Loading commit data...
frequency Loading commit data...
gyro Loading commit data...
health Loading commit data...
humidity Loading commit data...
imu Loading commit data...
light Loading commit data...
magnetometer Loading commit data...
multiplexer Loading commit data...
orientation Loading commit data...
potentiometer Loading commit data...
potentiostat Loading commit data...
pressure Loading commit data...
proximity Loading commit data...
temperature Loading commit data...
trigger Loading commit data...
Kconfig Loading commit data...
Makefile Loading commit data...
iio_core.h Loading commit data...
iio_core_trigger.h Loading commit data...
industrialio-buffer.c Loading commit data...
industrialio-configfs.c Loading commit data...
industrialio-core.c Loading commit data...
industrialio-event.c Loading commit data...
industrialio-sw-device.c Loading commit data...
industrialio-sw-trigger.c Loading commit data...
industrialio-trigger.c Loading commit data...
industrialio-triggered-event.c Loading commit data...
inkern.c Loading commit data...