Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: mc13xxx-core: Fix PMIC shutdown when reading ADC values

When trying to read any MC13892 ADC channel on a imx51-babbage board:

The MC13892 PMIC shutdowns completely.

After debugging this issue and comparing the MC13892 and MC13783
initializations done in the vendor kernel, it was noticed that the
CHRGRAWDIV bit of the ADC0 register was not being set.

This bit is set by default after power on, but the driver was
clearing it.

After setting this bit it is possible to read the ADC values correctly.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Tested-by: Chris Healy <cphealy@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Fabio Estevam and committed by
Lee Jones
55143439 6360e40f

+3 -1
+2 -1
drivers/mfd/mc13xxx-core.c
··· 276 276 277 277 mc13xxx_reg_read(mc13xxx, MC13XXX_ADC0, &old_adc0); 278 278 279 - adc0 = MC13XXX_ADC0_ADINC1 | MC13XXX_ADC0_ADINC2; 279 + adc0 = MC13XXX_ADC0_ADINC1 | MC13XXX_ADC0_ADINC2 | 280 + MC13XXX_ADC0_CHRGRAWDIV; 280 281 adc1 = MC13XXX_ADC1_ADEN | MC13XXX_ADC1_ADTRIGIGN | MC13XXX_ADC1_ASC; 281 282 282 283 /*
+1
include/linux/mfd/mc13xxx.h
··· 249 249 #define MC13XXX_ADC0_TSMOD0 (1 << 12) 250 250 #define MC13XXX_ADC0_TSMOD1 (1 << 13) 251 251 #define MC13XXX_ADC0_TSMOD2 (1 << 14) 252 + #define MC13XXX_ADC0_CHRGRAWDIV (1 << 15) 252 253 #define MC13XXX_ADC0_ADINC1 (1 << 16) 253 254 #define MC13XXX_ADC0_ADINC2 (1 << 17) 254 255