Letux Kernel

Issue 476: readings from twl4030_madc_battery driver are wrong

Reported by Nikolaus Schaller, Aug 12, 2013

I had only applied your patches but not yet tested the driver.
It appears that it does not work completely on the 3.11 kernel and
always reports an empty battery.

I get e.g. these readings:

root@gta04:~# cat /sys/class/power_supply/twl4030_battery/uevent 
POWER_SUPPLY_NAME=twl4030_battery
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_VOLTAGE_NOW=717000
POWER_SUPPLY_CURRENT_NOW=795000
POWER_SUPPLY_CAPACITY=0
POWER_SUPPLY_CHARGE_FULL=1200000
POWER_SUPPLY_CHARGE_NOW=0
POWER_SUPPLY_TEMP=670
POWER_SUPPLY_TIME_TO_EMPTY_NOW=10800
root@gta04:~# 

voltage/current/temp appear to be broken.

But reading the hwmon directly works perfectly:

root@gta04:~# cat /sys/devices/platform/twl4030_madc_hwmon/*_input
481	<- current
0
0
4199	<- vbatt
3
12
12
7
12
14
14
4940	<- vbus
3219	<- vbackup
26	<- temp
root@gta04:~# 

So I think there is something (now) missing with the madc 
initialization.

On the 3.7 kernel it did work.

Comment 1 by Nikolaus Schaller, Aug 12, 2013

Lukas commented in private communication:

I would assume something changed in madc_read(). Compare the drivers 
madc_read with madc_read from drivers/hwmon/twl4030-madc-hwmon.c, 
there are some slight differences (.func_cb VS .type).

Comment 2 by Lukas M, Aug 18, 2013

madc_read was indeed the culprit.

It is now fixed and working again on my 3.11-rc5:

root@gta04:~# cat /sys/class/power_supply/bq27000-battery/uevent 
POWER_SUPPLY_NAME=bq27000-battery
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_VOLTAGE_NOW=3905000
POWER_SUPPLY_CURRENT_NOW=-136731
POWER_SUPPLY_CAPACITY=45
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_TEMP=271
POWER_SUPPLY_TIME_TO_FULL_NOW=18360
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CHARGE_FULL=844305
POWER_SUPPLY_CHARGE_NOW=378063
POWER_SUPPLY_CHARGE_FULL_DESIGN=1233792
POWER_SUPPLY_CYCLE_COUNT=358
POWER_SUPPLY_ENERGY_NOW=1251220
POWER_SUPPLY_POWER_AVG=0
POWER_SUPPLY_HEALTH=Good

root@gta04:~# cat /sys/class/power_supply/twl4030_battery/uevent 
POWER_SUPPLY_NAME=twl4030_battery
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_VOLTAGE_NOW=3900000
POWER_SUPPLY_CURRENT_NOW=720000
POWER_SUPPLY_CAPACITY=25
POWER_SUPPLY_CHARGE_FULL=1200000
POWER_SUPPLY_CHARGE_NOW=324000
POWER_SUPPLY_TEMP=250
POWER_SUPPLY_TIME_TO_EMPTY_NOW=2700

The patch can be pulled from here (and is attached):
  https://github.com/slyon/linux/tree/gta04-3.11-twl4030_battery

Comment 3 by Lukas M, Aug 18, 2013

Here comes the patch.

PS: Attachments are being lost, if Indefero's preview function is 
being used.

Comment 4 by Lukas M, Aug 18, 2013

Now for real :)

Comment 5 by Nikolaus Schaller, Aug 28, 2013

Appears to work now :)
Status: Fixed

Comment 6 by Grace Bradley, Aug 10, 2019

Batery driver were wrong they are not showing us any of the 
important message. That message is not important because we just not 
have any of the https://www.topreviewstars.com/ value this time. I 
know this time we will be taking interest in all of these important 
messages all the time.

Comment 7 by Jones Wilson, Dec 4, 2019

There are specific dissertation web-sites by using the online world 
to build safeguarded web saved with your website online.

Regards, 
https://www.office-help-setup.com
https://www.officecommsetup.com
https://ww-woffice.com/setup

Comment 8 by Jones Wilson, Dec 4, 2019

I found so many interesting stuff in your blog especially its 
discussion. From the tons of comments on your articles, I guess I am 
not the only one having all the enjoyment here! keep up the good 
work…
Regards,
http://www.ms-officesetup.com
https://https-www-norton.com/setup
http://https-www-office.com/setup

Comment 9 by Gerry Criston, Dec 26, 2019

I am extremely intrigued with your article. I adore the manner in 
which you compose this article. Much obliged to you for imparting 
this awesome post to us.

http://officecomsetupms.com/office-com-myaccount/ | 
https://officecomsetupms.com/

Comment 10 by Gerry Criston, Dec 26, 2019

This is extremely useful post, exceptionally instructive.
http://office-office.org/

Comment 11 by Michael Smith, Dec 28, 2019

I just wanted to say that I love every time visiting your wonderful 
post! Great information you shared through this blog. Keep it up and 
best of luck for your future blogs and posts.
http://usetupoffice.com/

Comment 12 by sunil kumar, Dec 28, 2019

if you find the best website for deals and Discount, offers here is 
the best website netrockdeals.com is provided the best Discount and 
cashback offers
http://netrockdeals.com/store/100yellow-coupons/
http://netrockdeals.com/store/1mg-coupons/
http://netrockdeals.com/store/aliexpress-coupons/
http://netrockdeals.com/store/adidas-coupons/
http://netrockdeals.com/store/bookmyshow-coupons/
http://netrockdeals.com/store/amazon-coupons/

Created: 6 years 5 months ago by Nikolaus Schaller

Updated: 21 days 11 hours ago

Status: Fixed

Followed by: 6 persons

Labels:
Type:Defect
Priority:Medium