• Hans de Goede's avatar
    iio: adc: axp288: Drop bogus AXP288_ADC_TS_PIN_CTRL register modifications · fa2849e9
    Hans de Goede authored
    For some reason the axp288_adc driver was modifying the
    AXP288_ADC_TS_PIN_CTRL register, changing bits 0-1 depending on
    whether the GP_ADC channel or another channel was written.
    
    These bits control when a bias current is send to the TS_PIN, the
    GP_ADC has its own pin and a separate bit in another register to
    control the bias current.
    
    Not only does changing when to enable the TS_PIN bias current
    (always or only when sampling) when reading the GP_ADC make no sense
    at all, the code is modifying these bits is writing the entire register,
    assuming that all the other bits have their default value.
    
    So if the firmware has configured a different bias-current for either
    pin, then that change gets clobbered by the write, likewise if the
    firmware has set bit 2 to indicate that the battery has no thermal sensor,
    this will get clobbered by the write.
    
    This commit fixes all this, by simply removing all writes to the
    AXP288_ADC_TS_PIN_CTRL register, they are not needed to read the
    GP_ADC pin, and can actually be harmful.
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Acked-by: default avatarChen-Yu Tsai <wens@csie.org>
    Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
    fa2849e9
axp288_adc.c 5.77 KB