libera/#maemo-leste/ Wednesday, 2022-11-02

freemangordonuvos: do you want to make a new kernel update with cpcap fixes11:22
freemangordonbranch is maemo-5.18.y-cpcap, no tag11:23
uvosfreemangordon: makes sense to build it for devel no?11:24
uvosnot sure what your saying11:24
uvosdo you want me to tag it?11:25
freemangordonyes, tag and build for -devel11:25
uvosok11:25
freemangordonmaybe merge back to maemo-5.18.y and delete maemo-5.18.y-cpcap branch11:26
freemangordonI made it mostly for you and tmlind to review11:26
uvosi get that11:26
uvosi have to review it first11:27
freemangordonI already fixed leste-config to enable hdq, I amd sure it does not increase idle current draw11:27
freemangordonwell, 99.99% sure :)11:27
uvosleste-config-mapphone/etc/modprobe.d/wire.conf.leste lacks ending newline11:28
freemangordonnot really11:28
freemangordonpull again11:29
uvosgh sais so11:29
uvosi havent pulled yet11:29
freemangordonhmm, I am sure I pushed, lemme check11:29
uvoshttps://github.com/maemo-leste/leste-config/commit/8548645e63b81b9911c25674d761bcd500790af111:29
uvosmight be bug idk but its not happy11:29
freemangordonhttps://github.com/maemo-leste/leste-config/commit/e01c0762084ae6d01b3a7ff6d3bc77900f4cd99b11:29
uvosoh you fixed it11:29
uvossorry11:29
freemangordonmaybe I didn;t push to master, lemme check11:30
freemangordonit is there as well11:30
uvosits there11:30
freemangordonhmm, with the new battry thing are looking way batter11:40
freemangordon*things11:40
freemangordonI disconnected from the charger yesterday evening11:40
freemangordonit still reports 50% full, but I think it has more juice actually11:41
uvosjust in: man is suprised new 2200mah battery works better than 10 year old 1750mah cell :P11:43
freemangordon:D12:32
freemangordontmlind: BTW, I have a patch for a panel (simple-panel), I know the model but not the manufacturer, what compatible I shall make for it? All panels are like $manufacturer,$model.13:02
freemangordonin case anybody is curious about how that allwinner tablet I am using behaves with leste: http://46.249.74.23/leste/sunxi/20221102_001.mp413:03
siceloWizzup: any chance that you're not too far from your n900 serial jig? would be great if you could assist Pali with u-boot test that he needs15:23
tmlindfreemangordon: noname,panelxyz or something similar?15:55
freemangordonwill upstream accept it?15:56
freemangordonuvos: "Nov  2 16:25:10 localhost kernel: [73611.267822] cpcap_battery cpcap_battery.0: Battery low at 3393mV!"15:58
freemangordonand immediate shutdown15:58
freemangordonsomething is broken, I guess mce logic15:58
freemangordonbattery capacity is measured to be 1619 mAh, not even close to 225015:59
tmlindfreemangordon: if some mobile device, there are usually multiple providers of components, maybe generic,panelxyz16:00
freemangordonhmm, yeah, generic should do the job16:00
freemangordonit is tablet, but still16:00
freemangordonuvos: this https://github.com/maemo-leste/leste-config/blob/master/leste-config-droid4/etc/mce/mce.ini.d/70-droid4.ini.leste#L4016:05
freemangordonI think it is better to calculate that based on POWER_SUPPLY_VOLTAGE_MIN_DESIGN16:06
freemangordonlike POWER_SUPPLY_VOLTAGE_MIN_DESIGN+50 or something16:07
freemangordonalso, I guess you have some hard values in charge-mode16:20
sicelothat "Battery low at 3393mV" came from kernel. isn't it kernel that initiated the shutdown in this case?16:22
freemangordonno16:22
freemangordonalso, it seems there are 2 types of 'low' one @ 3.3 and other @ 3.1, no idea what are those used for16:23
freemangordontmlind: ^^^ do you remember?16:23
freemangordonah, it seems 'high' low is for low reporting, 'low' low is for shutdown16:24
freemangordoncpcap_battery_low() has some hardcoded values too16:26
freemangordonbut that is not so critical as mce deciding to do power off too early and charge-mode assuming normal li-ion battery no matter what kernel says16:29
siceloiirc it was set to 3350 in mce because d4 can't boot easily once battery is completely depleted16:31
freemangordon*what* battery?16:31
sicelod4 battery :-)16:32
freemangordon10yo one?16:32
freemangordonbecause here I have new polarcell 2250 mAh16:32
sicelo10yo battery and cheap replacements16:32
freemangordonand yes, it can boot the device even @ 315016:32
freemangordonthe point is that genuine moto batteries are 3.1-4.3516:34
freemangordonnot 3.2-4.216:34
freemangordonand that is the difference between 1600 and 220016:34
freemangordon30%16:34
freemangordonor something16:34
freemangordonbut anyway, lets wait for uvos, to see if we will be able to come-up with some idea that will make both (old battery/new battery) parties happy16:35
freemangordonin any case, mce shutdown voltage must be less that 3.3, otherwise you don't have any chance to get a charger16:40
freemangordonhmm, what about:17:06
freemangordon1. mce stores current voltage @ first 'low' signal received17:06
freemangordon2. on every following 'low' received, it subtracts the current voltage from the stored one and if it is more than a threshold or if the current voltage is less that DESIGN_LOW + 100 (for example), then it shuts down17:06
freemangordon3. stored 'first low' is reset on charger connected17:06
freemangordonthat way bad batteries will be guaranteed to have enough charge to boot and good batteries will be used properly and users will have a chance to find a charger17:08
freemangordonhmm?17:08
freemangordonmy old (bad) battery was giving low @ 3636mV, so I think threshold should be calculated based on lowVoltage - 3300, somehow17:15
freemangordonhmm, actually threshold = $device_specific_value + (4200-DESIGN_LOW) should be better17:18
freemangordonoh, I mean 3200-DESIGN_LOW17:21
freemangordonhmm, increasing POWER_SUPPLY_CONSTANT_CHARGE_VOLTAGE doesn't actually work17:49
Wizzupsicelo: I wil be near it on sunday and onwards17:55
uvosmce deicdes to turn off the device early because of the mapphone bootloader booting problem when totaly empty18:00
uvoswe discussed this plenty of times before18:00
uvosyes its early (slightly the amount of engery in a lipo at 3.35 volts is fairly tiny over 3.0V the curve gets really steep down there)18:00
uvosit _needs_ to be early18:00
uvostake a look at https://learn.adafruit.com/li-ion-and-lipoly-batteries/voltages for a referance discharge curve18:08
uvosnote that teh differencein capcaity between a discarge to 3.1 and 3.2 is less than to even worry about18:08
uvos3.35 is slightly early, but note that we do that because the device will die before it reaches a bootstate where it can charge if you do that18:10
uvosbecasue of kexecboot etc18:10
uvosbut even that is in the rage of a couple pecent18:10
uvos2% maybe 5% if the device is heavly loaded at shutdown18:11
uvosso i did the expieraments wrt when to shutdown with my best stock eb41 btw18:13
uvosthat hat about 1250mAh as callibrated by cpcap18:14
uvosalso taking into account that we use quite a large amount of power even when off, if the mainline kernel is the one to turn the device off18:14
uvosso we also needed some extra18:14
freemangordonuvos: I understand and agree that we should have some extra power on shutdown18:20
freemangordonthat's not the issue, the issue is that I was not give any chance to connect a charger18:21
freemangordon*given18:21
freemangordonno warning, nothing, as soon as 'low' was signaled, bang, a shutdown18:21
freemangordonthat's why I think a more complicated logic, like the one ^^^ shall be implemented18:22
freemangordonalso, it is not about d4 only18:22
uvoswell we have a conflict here18:22
freemangordonI know18:22
uvoswe dont want to change the values in kernel18:22
uvosbecause they should be correct18:22
freemangordonwe should not18:22
uvosso we want a workaround in userspace only18:22
freemangordonsee the algo I came up with ^^^18:22
freemangordonthis is all in mce18:23
uvosi dont see why its not about d4 only18:23
uvosany other device should not have this issue18:23
uvosthe kernel should just signal at the appropriate times18:24
freemangordonwe may have similar issues on other devices, in theory18:24
freemangordonbut lets not discuss that now18:24
freemangordonplease comment on the alog18:24
freemangordon*algo18:24
uvosi dont grok it18:26
uvoswhat is your first low?18:26
freemangordon'current_voltage' at the tim e'low' is generated for the first time18:26
uvosthats essentaly a random number generator18:26
uvossince it depends on load18:26
sicelothose 'lows' don't exist in bq27200 iirc18:27
freemangordonnot really, because the worse battery is, the higher the voltage18:27
uvosbut you cant realy on that18:27
uvossince it wont be so when the device is not loaded18:27
uvosi also dont see what is nessecary18:27
uvosbesides rasing the low threshold (for the banner) in userspace18:28
freemangordonto have at least few minutes of "battery low" ranings before a shutdoen18:28
uvossure18:28
freemangordon*warnings18:28
uvosso just raise the tresh in upower18:28
freemangordonthis somes from the kernel18:28
uvosto 3.5 or so18:28
freemangordon*comes18:28
uvosand ignore the kernel18:28
uvosjust need to make this selective like in mce18:28
freemangordonsee, *defaults* should work18:28
uvosthe defaults are what is in kernel18:29
freemangordonno, mce ignores the kernel and makes its own shut-down decision18:29
uvosyes18:29
uvosthe fact that the kernel is "lieing" is a quirk on mapphones only18:29
freemangordonthis is wrong the way it is implemented for d418:29
freemangordonthat quirk makes it so that those with good batteries have absolutely no chance to plug a charger when the battery is low18:30
freemangordonand this has to be fixed18:30
uvossure and i told you how i would do that18:31
uvosjust ignore the low signal from the kernel in upower18:31
freemangordonwhy upower?18:31
uvosand add something based on configureable voltage instead18:31
uvoswhere else would you do it?18:31
uvosupower is the common thing here18:31
freemangordonthat agin depends on the load, no?18:31
uvossure, but its the best we have18:32
freemangordondid you grok what I am proposing?18:32
uvosyes and it cant be reliable18:32
freemangordonI don;t see why?18:32
uvossince it depends on instanainous load18:32
uvoswhile upower dose smoothing18:32
freemangordonno, there are 2 shutdoen conditions18:32
freemangordoneither threshold or low voltage18:33
freemangordonwhichever comes first18:33
uvossure. but should be critical not low18:33
uvosfor the latter18:33
uvoslow is the banner18:33
freemangordonsure18:33
freemangordonI have no issue with too mane 'low' banners18:33
freemangordongiven that I had none before shutdown :)18:34
uvosright so the problem is not the shutdown threshold in mce18:34
freemangordonback then I had my n900 beeping 'low' all day long18:34
freemangordonit is18:34
uvosor the cirtical signal18:34
uvosit is that the low signal dosent follow the thresh in mce18:34
freemangordonno, it is the shutdown threshold in mce18:34
uvosie it isent above the tresh in mce18:34
freemangordonlemme explain:18:34
freemangordonI got kernel low @3393mV18:35
freemangordonmce threshold is 335018:35
sicelofreemangordon: was the N900 battery calibrated? (that beeped low all day)18:35
uvosyes so it shutdown18:35
uvosand you never saw the low banner18:35
freemangordonexactly18:35
uvosthe issue here isent the mce threshold18:35
uvosits that the banner is to late18:36
freemangordonit is18:36
freemangordonbecause it shuts down18:36
uvosmce _has_ to shutdown18:36
freemangordonno, banner is not late18:36
uvosit has no choice18:36
freemangordonyes, but that should depend on the quality of the battery18:36
freemangordonsicelo: this is d418:36
uvosit cant18:36
freemangordonsicelo: oh18:36
freemangordonno, that was bme18:37
uvosthere is no reliable way for mce to know how mutch capacity is below 3.35V18:37
uvoswhat you propose is not a relaible way to mesure it18:37
freemangordonbut is better than current behaviour18:37
uvosno18:37
uvosand as i also explained18:37
uvosif mce thresh is 3.3518:37
freemangordonno, current behaviour is unacceprable18:37
uvosand your special thresh is 3.15V18:37
uvosthe lost extra capacity is <5% in exream cases18:38
uvosprobubly less than 218:38
freemangordonbecause it leeves me without a phone, withoug giving me a warning18:38
freemangordon*leaves18:38
uvosbut thats not a problem with the treshold at all18:38
uvosthe indication of low just needs to come earlier18:38
freemangordonit cannot18:38
freemangordonbecause the battery is good18:38
uvosofc it can18:39
uvoswe need 2-3% extra capcaity to boot again18:39
freemangordonexactly18:39
uvosso we need to move the low signal up 2-3%18:39
uvosaswell18:39
freemangordonno, we should not shutdown @ 335018:40
uvosyes we must18:40
uvosthere is no alternative18:40
freemangordonor at least that should account for the DESIGN_LOW18:40
uvosno18:40
freemangordonaaaaa18:40
freemangordonI give up18:40
uvosDESIGN_LOW should be the real value18:40
uvosnot the value we moved up 2-3%18:40
uvosbecasue of the bootloader issue18:41
uvosso we should absolutly not include it18:41
uvosand we dont have to either18:41
uvosbecuase the differences in design low are immaterial18:41
uvos3.1 vs 3.2 vs 3.0 v are <<1% capcaity18:41
uvoswe cant mesure that accuratly anyhow18:41
uvosso there is no point18:41
freemangordonok, lemme try again:18:45
freemangordonuvos: what is the lowest battery capacity we shall support?18:45
uvosandroid works fine even with really degraded batteies18:45
freemangordonok, so 1000mAh?18:45
uvossure18:45
freemangordonnow, to boot, we need about 50mAh remaning, no?18:46
uvosnot sure about the exact value18:46
uvosbut yes some amount18:46
freemangordonand high enough voltage, like maybe 3.3 if we assume internal resistance to be 1 ohm18:46
freemangordonthis is for bad batteries18:47
uvoshigh enougth voltage at what stage18:47
freemangordonboot18:47
uvoswe need to stay above mbms shutdown threshold18:47
uvosthe android kernels threshold18:47
uvosduring boot18:47
freemangordonso 3.118:47
uvosyes, mbm is a bit higher18:47
freemangordonthreshold I mean18:47
uvosbut it comes first so no matter18:47
freemangordonok18:48
uvoswe also need to say above the mainline kernels emergency shutdown thresh18:48
uvosat least for the second it takes to enable charging18:48
freemangordonyes18:48
freemangordonso, lets assume 3.3 is ok18:48
uvossure at boot time18:48
uvosso we need to issue shutdown slightly before that ofc18:49
freemangordonbut, this is 3.3 with no load18:49
uvossure18:49
uvosbut you need to accound for usage during shutdown18:49
freemangordonsure, but this is about 30 seconds18:50
uvosand the bug that cuases the device to use 1-2mA during off18:50
uvoswe need the device to survive a day or so while off after low battery shutdown18:50
uvos30 quite processing intense seconds18:50
freemangordonalso, we can use the measured capacity to make an estimation of the quality of the battery18:50
uvosdo remember the discarge curve, 3.3v and 3.1 are very close18:50
uvoswell the problem here is18:51
uvosthat we dont know where the charge counter is ususal18:51
sicelouvos: shouldn't that be figured out? "the bug that cuases the device to use 1-2mA during off"18:51
uvossicelo: yes18:51
uvossicelo: but thats very hard18:51
uvossicelo: how do you get hw state when the device is off18:51
uvossicelo: clearly we are not doing something, but what?18:51
freemangordonanyway, we shall either raise the 'low' threshold above 3.3 or lower the mce shutdown threshold18:52
freemangordonwe can;t do former, so we shall make mce smarter18:52
uvoswell we cant lower the mce shutdown threshold as that will softbrick peoples devices18:52
uvosand we must make the low threshold be above whatever mce decides at all times18:52
freemangordonbyt either lowering the threshold or do not do shutdown before warning at least couple of times18:53
uvosso it needs to account for the mce tresh being 3.35v18:53
uvoswe cant just not shutdown before warning a couple of times18:53
freemangordonso, what about ignoring firts couple of "low" signals then?18:53
uvosa bad idea18:54
uvossince if the device is very quiet they wont come18:54
freemangordonwhy?18:54
uvosit will only come once18:54
uvosthere is only one solution:18:54
uvosremove the code from mce, and add it to upower18:54
uvosthe real issue here is18:54
uvosthat the ui and mce take the values from upower18:54
uvosand chaingn something in mce (like how low is determined) dosent affect the ui18:55
freemangordonagain, it is not about the low but about shutdown18:55
freemangordonand this is decided in mce18:55
uvosyes but thats not the root issue18:55
uvosso really mce should just shutdown when upower sais battery is ciritcal18:56
uvosand the ui should notify when upower sais low18:56
freemangordonagree18:56
uvosso we messed with mce to change when critical is18:56
uvosbut thats bad18:56
freemangordonthat's what I am trying to say all the time18:56
uvosbecause it dosent move low and it dosent move critical for other upower clients18:56
uvosthe solution is not to make mce "smarter"18:57
uvosbut to add config options to upower18:57
uvosto define low and critical other than what the kernel sais18:57
freemangordonwhich we have to support, no?18:57
freemangordonupower patches I mean18:57
uvosnot sure what you mean by support18:57
uvoswe have to write upower patches18:57
uvosyes18:57
uvoswe have plenty of those allready.....18:57
freemangordonwell, whatever the solution is, the current behaviour is not ok18:59
freemangordonI'll think about that a bit more19:00
uvoswell the only way to solve it is to change A: kernel, but we dont want to do that or B: upower19:00
uvosand changing upower would involve adding a udev var that it checks for a low voltage threshold for critical19:00
uvosand antoher for low19:00
freemangordonor simply lowering the current mce threshold a bit19:01
uvosno19:01
freemangordonI think current value is too conservative19:01
uvosthat dosent solve the issue at all19:01
uvoseven if the value is too converative ( i strongly dissagree )19:01
freemangordonok19:01
uvosthe issue is that the distance between low and cirictcal is not constant19:02
freemangordonwho is going to implement the code in upower?19:02
uvosugh, im not to bothered by current behavior xD19:02
freemangordonbut your users are19:02
uvosheh19:04
uvoswell idk - not right now make an issue  is what i say to that19:05
norayrfloks, i agree with uvos. even now d4 is problematic. i recently found myself preparing special wires and connecting my phone to my friends' phone in other town because there was no way to charge it. i revived it, luckily, gave it enough charge from my battery so that it would start and charge itself.22:45
norayrit sdould preserve even more charge when shutting down.22:45
norayrnot less.22:45
norayrmany people won't be able to care about the phone rike it is tamagocci.22:45
norayrthe phone should care about itself y shutting itself down earlier and preserving enough charge to boot a le of times.22:46
norayra couple of times.22:47

Generated by irclog2html.py 2.17.0 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!