• Akinobu Mita's avatar
    iio: adc: ti-ads1015: avoid getting stale result after runtime resume · 73e3e3fc
    Akinobu Mita authored
    This driver assumes that the device is operating in the continuous
    conversion mode which performs the conversion continuously.  So this driver
    doesn't insert a wait time before reading the conversion register if the
    configuration is not changed from a previous request.
    
    This assumption is broken if the device is runtime suspended and entered
    a power-down state.  The forthcoming request causes reading a stale result
    from the conversion register as the device is runtime resumed just before.
    
    Fix it by adding a flag to detect that condition and insert a necessary
    wait time.
    
    Cc: Daniel Baluta <daniel.baluta@gmail.com>
    Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    73e3e3fc
ti-ads1015.c 18.5 KB