diff mbox series

Reading from the MC13892 ADC channels causes shutdown

Message ID CAOMZO5B5CdyGosPduP0uje_wNhiJDcH5NsumENAdQKjLBWFM0g@mail.gmail.com (mailing list archive)
State Not Applicable
Headers show
Series Reading from the MC13892 ADC channels causes shutdown | expand

Commit Message

Fabio Estevam Aug. 27, 2018, 7:08 p.m. UTC
Hi,

Has anyone managed to read ADC values from the MC13892 ADC recently?

I am running 4.19-rc1 on a imx51-babbage board and after trying to
read a channel:

# cat /sys/class/hwmon/hwmon0/device/in7_input

the PMIC shuts down completely, which causes the entire board to die.

I don't know if this is a regression or not. I can try to run a
bisect, but I would be interested to know if anyone knows if MC13892
ADC readings worked at some point in the past.

Also noticed that the shutdow happens after writing to the ADC1 register.

Removing the line below  makes the ADC reading to timeout, but at
least the PMIC does not shut down:


Any ideas are welcome.

Thanks,

Fabio Estevam

Comments

Guenter Roeck Aug. 27, 2018, 7:39 p.m. UTC | #1
On Mon, Aug 27, 2018 at 04:08:47PM -0300, Fabio Estevam wrote:
> Hi,
> 
> Has anyone managed to read ADC values from the MC13892 ADC recently?
> 
> I am running 4.19-rc1 on a imx51-babbage board and after trying to
> read a channel:
> 
> # cat /sys/class/hwmon/hwmon0/device/in7_input
> 
> the PMIC shuts down completely, which causes the entire board to die.
> 
> I don't know if this is a regression or not. I can try to run a
> bisect, but I would be interested to know if anyone knows if MC13892
> ADC readings worked at some point in the past.
> 

If I recall correctly, the most recent change was commit ed645cccc0eb
("hwmon: MC13783: Add uid and die temperature sensor inputs"). It is a
wild shot, but you could try reverting it to see if it makes a difference.

Guenter
Fabio Estevam Aug. 27, 2018, 8 p.m. UTC | #2
Hi Guenter,

On Mon, Aug 27, 2018 at 4:39 PM, Guenter Roeck <linux@roeck-us.net> wrote:

> If I recall correctly, the most recent change was commit ed645cccc0eb
> ("hwmon: MC13783: Add uid and die temperature sensor inputs"). It is a
> wild shot, but you could try reverting it to see if it makes a difference.

Yes, I tried reverting it and it did not help.

I also put the author of this commit, Andrey on Cc in case he has some
insight to this problem.

Thanks
Fabio Estevam Aug. 28, 2018, 3:58 p.m. UTC | #3
On Mon, Aug 27, 2018 at 5:00 PM, Fabio Estevam <festevam@gmail.com> wrote:

> Yes, I tried reverting it and it did not help.
>
> I also put the author of this commit, Andrey on Cc in case he has some
> insight to this problem.

After comparing the MC13892 initialization in the vendor kernel, I
managed to fix this issue inside drivers/mfd/mc13xxx-core.c.

Will submit a fix for the mfd folks.

Thanks
diff mbox series

Patch

--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -327,7 +327,6 @@  int mc13xxx_adc_do_conversion(struct mc13xxx
*mc13xxx, unsigned int mode,
                        mc13xxx_handler_adcdone, __func__, &adcdone_data);

        mc13xxx_reg_write(mc13xxx, MC13XXX_ADC0, adc0);
-       mc13xxx_reg_write(mc13xxx, MC13XXX_ADC1, adc1);

        mc13xxx_unlock(mc13xxx);