libera/#maemo-leste/ Saturday, 2023-03-25

siceloWizzup: n900 bq27200 charge_full is always 2050560 when no calibration has taken place. this value will also be charge_now if battery reaches 100% full. it only starts becoming 'sane' once you have a full, uninterrupted discharge06:33
sicelotldr; don't mind charge_* until you have calibrated06:33
freemangordontmlind: is it acceptable to have sysfs attribute in cpcap_adc driver that controls single vs multi channels? otherwise I would have to have 8 more channels dedicated to single-channel ADC07:58
freemangordonIOW: when buffer support is implemented, one should enable the channels she would like to read. Having 4x2 single-channel read means 8 additional channels.08:00
freemangordonUnless I a missing something08:00
tmlindfreemangordon: hmm yeah i don't know, best to ask the iio folks.. maybe IIO_CHAN_INFO_AVERAGE_RAW could be used?08:16
freemangordonok08:16
freemangordontmlind: https://pastebin.com/X1jFb5g709:55
freemangordonwhat is the current status of the driver? like, you said you will push changes upstream, but I didn;t follow09:56
freemangordontmlind: do we really need to expose raw adc values to sysfs?11:08
Wizzupsicelo: ok, but I am not sure if my n900 is charging anymore even with empty battery12:13
Wizzupand the usb cable is fine12:13
Wizzupso something is off12:13
WizzupI am wondering if it is maybe the module blacklist we did for pm12:13
freemangordonwhich module?12:16
Wizzupfreemangordon: https://github.com/maemo-leste/leste-config/commit/f0de824b14ccf9070efae90d6dcb97b097ecb32512:21
freemangordonix isp1704 module loaded?12:24
freemangordon*is12:24
Wizzupyes12:26
Wizzup# ls /sys/class/power_supply/12:26
Wizzupbq24150a-0  bq27000-battery  bq27200-0isp1704  twl4030_ac  twl4030_usb12:26
Wizzupbut upower doesn't 'detect' charging12:26
Wizzupand the led doesn't pulsate orange12:26
Wizzupit seems to be charging, but the led doesn't show it, neither does status applet12:27
Wizzupit's kind of weird12:27
Wizzup# cat capacity12:27
Wizzup812:27
Wizzupbetter than 1, I guess12:27
freemangordonsorry, no idea12:27
freemangordonbetter ask Pali or joerg12:27
joerghm?12:27
WizzupI think I might try to unblacklist a few modules first12:28
Wizzupand see if it's related at all12:28
freemangordonok12:28
freemangordonjoerg: something weird on n900, see backscroll if you have some spare time12:28
joergplease provide a anchor quote12:28
freemangordon" sicelo: ok, but I am not sure if my n900 is charging anymore even with empty battery"12:29
Wizzupit is charging now, I can see it, but it's a bit weird12:30
freemangordonok12:30
WizzupI'll have to check upower and our status applet code12:30
joergthe kernel module taking charge about 2translating" bq27200 data into sysnodes, it's... tricky. Pali implemented it for maemo12:32
Wizzupwe had this working for sure12:32
joergtaking care about...12:32
joergyes, it works IFFF12:33
joergand e.g. my and speedevi's bq27k-detail.sh scriopts iirc only work when you unload the kernel module12:34
WizzupI'll report back when I've figured this out, it might be a kernel change or just the module blacklist12:34
joergsomething about I2C device exclusive open()12:34
joergthere are several mutually exclusive kernel midules which may try to access the bq27k stuff12:35
joergand twl4030 iirc only involved regarding some A/D or USB-ID-pin or whatever12:36
joergtwl4030 can not emergency-charge12:36
joergaka bootstrap-charge12:37
Wizzupfreemangordon: battery_bq27200_0 has state charging, battery_bq24150a_0 has state charging (but is meaningless), DisplayDevice is state charging12:38
Wizzupboth the displaydevice and the bq27200_0 seem ok info wise, so somehow our code decides not to use it12:38
Wizzupboth mce and status applet12:38
Wizzupmce for led, status applet for gui12:38
WizzupI'll check the code in a bit and see if I can find anything there12:38
freemangordonok12:39
joergto start with, the bq24150 charger chip needs D+/- short for bootstrap-charging (when the battery voltage is too low to bring up the CPU)12:40
freemangordonjoerg: well, it seems kernel-wise it is fine12:41
joergbasically no USB wallwart charger supports this any more nowadays12:41
freemangordonsome userspace issues12:41
joergok, then I'm probably out :-)12:41
joergpali should know more details12:42
freemangordonyeah, thanks12:42
joergyw12:42
Wizzuparno11: do you ever see the orange led when charging/12:53
Wizzupor the battery charging animation12:54
arno11Never seen the orange led since beowulf in 2021-202212:55
arno11always troubles with battery animation12:55
arno11but charging always works12:55
arno11did you try to charge through fremantle to see any difference ?12:56
arno11i mean with your current battery12:57
Wizzuparno11: yeah fremantle is fine I think13:00
arno11maybe we have new issues if the battery is not already calibrated13:00
Wizzuparno11: in any case that is not normal, I think we had this working ok13:00
Wizzup(status applet and led)13:00
arno11indeed13:00
joergduring early boot, NOLO/uBoot takes care about amber breathing indicator LED. Before even NOLO gets loaded to CPU, on batter_very_low the hardware BQ24150 enables the green and red (=amber) indicator LEDs on a mere hardware level13:02
joergthe latter mode is steady amber, not breathing13:03
WizzupI think the problem here is just mce's upower module not picking up on this13:05
joergif you don't see it on completely depleted battery durning the first fraction of a second on pluggin in USB, extending to a usually max ~20s until battery voltage got boosted up to a level where CPU can load NOLO and take over management of the indicator LED, then either you got no D+/- short in your USB wallwart charger, or your indicator LED and associated hardware is broken13:06
Wizzupyeah upower picks up something else13:09
Wizzupok, I can fix this I think13:09
Wizzuphttps://bpa.st/H4LKC there are all of these, and only some are ignored13:10
Wizzupmce: xup_check_device: accepting device as line power twl4030_ac13:42
Wizzupmce: xup_check_device: accepting device as battery bq27200-013:42
Wizzuphm... I wonder if we simply miss some patch the report sysfs values over udev13:43
Wizzupunplugged cable makes the charging symbol start in battery applet13:43
Wizzups/symbol/pattern/13:43
WizzupI guess it would be better to use isp1704 and not twl4030_ac13:45
Wizzupsame logic in as mce as battery applet13:48
Wizzupwill have a fix soon I hope13:48
joerg>>line power twl4030_ac<< hmmmm13:51
Wizzupthe mce code just iterates over upower devices13:53
Wizzupand it picks the first line power device13:53
Wizzup(there are at least three)13:53
joergafaik in N900 the twl4030 does zilch for power13:54
Wizzupeaxctly, this is the problem13:55
Wizzupit also rarely reports on udevadm monitor13:55
Wizzupyup13:56
Wizzupnow it works again, with blacklist mod13:56
joerg:-D13:57
Wizzupthe 'problem' we have with leste is that we support more than one device, so we need heuristics to find the right devices on a phone that exposes at least line power devices13:57
Wizzupand also several battery devices13:58
Wizzupit's possible the only thing that changed is the way the devices are loadeds or ordered in upower13:58
Wizzupuvos__: I assume you're not opposed to blacklisting two more n900 line power devices in mce's upower blacklist13:59
Wizzupisp1704, twl4030_ac and twl4030_usb are all 'power_supply: yes' and have a line-power property13:59
WizzupI see nothing that we can distinguish them on in code13:59
Wizzupuvos: https://github.com/maemo-leste/mce/pull/5714:15
tmlindfreemangordon: i guess the idea with the raw values is that the data can be processed later on with little overhead during sampling14:18
tmlindfreemangordon: getting the gsm support to mainline needs quite a bit of work, mostly to switch to serdev read and write for the virtual ports14:19
Wizzupfreemangordon: (status-area-applet-battery) I rebased maemo/chimaera-devel and master on maemo/beowulf-devel, since there were some unmerged changes there, and I'm making a new release 1.5.5, with the blacklist added14:23
freemangordontmlind: ok, but do we need in the particular driver?14:37
freemangordonWizzup: yeah14:38
tmlindfreemangordon: sorry care to clarify, not following you14:44
freemangordoncpcap_adc driver exposes both raw and processed values to sysfs. My question is - what is the usecase in exporting raw values from this particular driver and wouldn't it be better to remove  BIT(IIO_CHAN_INFO_RAW) from .info_mask_separate?14:47
freemangordonthus exporting processed values only14:47
freemangordonBTW, I got buffer reads working (with made-up data, but still)14:48
freemangordontmlind: ^^^14:49
Wizzupuvos__: freemangordon: should we treat battery at 100% as full battery? right now n900 says battery-full-charging-symbolic with percentage at 100% but state is 'charging'14:57
Wizzupso the led never turns green14:57
Wizzupwe check for UP_DEVICE_STATE_FULLY_CHARGED14:57
tmlindfreemangordon: yeah maybe doable, the rate of data is very low volume for cpcap. nice that you got the buffer reads going14:57
freemangordonWizzup: I don't think so14:58
freemangordonit is up to the driver/upower to set thta, no?14:58
freemangordontmlind: sure it is doable, just that bit in question removed and we'll halve sysfs entries14:59
freemangordonnot a biggie, but still14:59
Wizzupfreemangordon: well, the icon state seems to imply it's full: battery-full-charging-symbolic15:01
Wizzupas in, charge_now == charge_full in sysfs15:03
Wizzupanyway, it's not important now15:03
Wizzupit just prevents green LED ;)15:03
freemangordontmlind: https://pastebin.com/CW9WwP5F :)15:55
freemangordonthis is real data15:55
tmlindfreemangordon: cool, any idea on the sample rate?16:07
freemangordonno sample rate but sysfs trigger ;)16:07
freemangordontmlind: see https://bootlin.com/blog/the-backbone-of-a-linux-industrial-i-o-driver/16:08
freemangordon"As an example, here is how to create a sysfs trigger:"16:08
freemangordonso it is polled16:09
freemangordon"echo 1 > trigger_now" in /sys/bus/iio/devices/trigger116:10
arno11Wizzup: just have dist-upgraded: working battery applet confirmed ;)16:10
tmlindfreemangordon: oh ok16:10
freemangordondo we need constant sampling?16:11
freemangordonI don;t hink so16:11
tmlindwith polling you need to be careful with the battery life16:12
freemangordonfyi: https://pastebin.com/u7H1Ps7J16:12
tmlindideally you would request the 2x4 samples, then get an interrupt when it's ready16:12
freemangordonno, I think I didn;t explain it correctly16:13
freemangordonby 'polling' I mean - you request 4x2 samples and then wait16:13
freemangordontmlind: see   cpcap_adc_trigger_handler in the ^^^ patch16:14
tmlindyeah ok cool16:14
freemangordonso, when a diver or userspace needs data, it just triggers the trigger16:14
freemangordonand then gets the data when it is ready16:14
freemangordonthe same as if you read from sysfs16:15
tmlindok great16:15
tmlindso how do you now select between single channel and 2x4 data?16:15
freemangordonbuffer is allowed only for single channel16:16
tmlindoh ok, but data shows both voltage and current?16:16
freemangordonbecause the way thje buffer channels are registered16:17
freemangordonyes, both voltage and current16:17
tmlindso what's the /dev/iio name to read the 2x4 voltage + current data?16:17
freemangordon/dev/iio\:device116:18
freemangordon/dev/iio:device116:18
freemangordonbut this is not hard-coded I would say16:18
freemangordonbut you can get that from uevent file16:19
tmlindsorry i mean the name for /sys/bus/iio, not /dev..16:19
freemangordonno, you read from /dev16:19
tmlindok16:19
freemangordonthat's how buffers work16:19
tmlindok makes sense16:19
tmlindso /sys/bus/iio can stay the same more or less16:20
freemangordonright16:20
freemangordonbut I changed it a bit :D16:20
tmlindexcept for the broken channels 16 & 17 that don't show the full data16:20
freemangordonhttps://pastebin.com/Em3qfmCR16:20
freemangordonI removed those16:20
freemangordonalso removed indexes and put 'labels' instead16:21
tmlindyeah makes sense if it's really 2x4 samples16:21
freemangordonnow you know which channel is what16:21
tmlindcool16:21
freemangordonso, one select what to receive by enabling in scan_elements/16:22
tmlinddid you find any new interesting adc sources or names?16:22
freemangordonno, I reused your 'datasheet' ones16:22
tmlindok16:22
tmlindsome of them are still a bit of mystery16:22
freemangordonalso see https://pastebin.com/JwMKsU1H16:22
freemangordonyeah16:23
tmlindok nice16:23
freemangordonshall I split the changes before submitting?16:23
tmlindhmm so what are the *label names describing?16:24
tmlinda description for the channel if you cat it?16:24
freemangordonI was not able to remove those, they auto-appear if you set https://elixir.bootlin.com/linux/v6.3-rc3/source/include/linux/iio/iio.h#L22116:24
freemangordonyes16:24
Wizzuparno11: good, mce will also work once uvos__ merges the pr16:25
tmlindok cool16:25
freemangordonso, shall I split to 2 patches: 1. rename existing channels, 2. add buffer support?16:25
tmlindfreemangordon: yeah makes sense since 16 & 17 are wrong16:26
freemangordonok, will do that and will send them.16:26
tmlindgreat16:26
tmlindneed to go, nice work! ttyl16:27
freemangordonttyl16:27
arno11Wizzup: ok16:27
Wizzupmy phone still says 2040mAh but I guess over time that will settle16:28
arno11calibration is quiete complicated16:28
Wizzupso for the image to work well ootb now we need to check why nokia-modem does not load16:28
Wizzupyeah16:28
arno11several days needed16:29
Wizzupdoes not load automatically I mean16:29
arno11good question16:29
Wizzupand swap16:30
Wizzup:D16:30
arno11for the swap using a basic 1G file works great btw16:31
WizzupI use the emmc swap that fremantle uses16:31
arno11only problem: fragmentation16:31
WizzupI think that might be better16:31
arno11ok maybe16:31
Wizzupsince it's a bit faster and usually present16:32
Wizzuponly reason not to do it is if you fear to kill emmc16:32
arno11yes16:32
arno11definitly !16:32
arno11that's why i prefer basic file16:33
arno11low battery ttyl16:35
Wizzup:)16:36
Wizzupmy battery applet says I have about 22 hours left with wifi and modem on16:36
arno11:)16:37
arno11Wizzup: i found why modem refuse to load on boot...19:30
arno11still blacklisted19:30
Wizzupwhere?19:30
arno11in /etc/modprobe.d/nokia-modem.conf19:31
arno11and /etc/modprobe.d/nokia-modem.conf.leste19:31
Wizzup# cat /etc/modprobe.d/nokia-modem.conf.leste19:32
Wizzupoptions nokia-modem pm=119:32
arno11yep19:32
Wizzupthat's not a blacklist19:32
Wizzupthat's just an option for it I think19:32
arno11sure19:32
Wizzupit has to say 'blacklist' in front of it in /etc/modprobe.d for it to be blacklisted afaik19:32
arno11not sure iirc19:33
arno11anyway i will try remove this option lol and see19:34
arno11back in 10min19:34
arno11Wizzup: apologies that's the opposite19:46
arno11the file is suppose to load the option19:46
arno11but it doesn't work19:47
arno11with or without same result19:47
Wizzuphmm, ok19:52
Wizzupwe could add it to modules-load.g19:53
Wizzupmodules-load.d19:56
Wizzupunless this is systemd-only19:56
arno11back in 20 min19:57
arno11Wizzup: 'options nokia-modem pm' is linked with old issues wth ofono on startup.21:55
arno11setting up the option after boot to load modem seems the safest21:56
arno11according to old leste bug tracker issue21:57
buZzoooo update to battery applet?21:59
arno11yes22:00
Wizzuparno11: I do not understand 'setting up the option after boot to load modem seems the safest'22:27
arno11i mean loading the option manually or with script22:29
arno11after boot22:30
Wizzupit might be worth to see if /etc/modules-load.d works22:31
WizzupI don't know how to debug why udev does or does not load a module22:31
Wizzuplet me try moddep -a22:32
Wizzupdidn't help it seems22:52
arno11and modules-load.d will not be possible22:53
Wizzupwhy is that?22:53
arno11only systemd i think22:54
Wizzupok22:54
Wizzupthere is /etc/modules22:54
Wizzupbut it's not a *.d :)22:54
Wizzuptrying it now22:54
buZzdoes anyone else ever get the battery statusbar icon to 'blink' between 100% full and charging animation?22:57
WizzupI mean, that will happen all the time when you're at full battery22:58
buZzi mean, its displaying -both- at the same time23:02
buZzmaybe at ..2hz?23:03
Wizzupwhen the battery is full, the kernel reporting is nuts23:03
Wizzupso anything can happen23:03
buZzis that whats making upower misbehave?23:03
Wizzupit will switch between charging and discharging many times23:03
buZzyeah, thats what pavels patch was about23:03
Wizzupyes23:03
buZzstill gotta try it :)23:03
Wizzupthe n900 actually used to do this correctly, but I can't get it to do that currently, but maybe that's a calibration problem too23:04
Wizzupas in it would report fully charged and just power itself from the usb only23:04
Wizzuparno11: looks like it works :)23:06
Wizzuparno11: openrc also implements it23:06
arno11really ?23:06
Wizzupyup23:06
arno11well done23:06
Wizzupmy n900 just asked me for a pin23:06
WizzupI'll put it in leste-config for the n900 then23:06
arno11coooooool23:06
arno11;)23:07
Wizzupswap will be harder, as there is no /etc/fstab.d23:08
arno11true23:08
arno11oh i forgot: did you try to use ofono then?23:09
Wizzupif it asks for the pin, it means ofono works23:09
Wizzupthe modem doesn't seem to be online yet atm23:09
arno11i asked because if the modem is loaded too early with pm=1 it could cause ofono troubles23:11
Wizzupwhat kind of trouble?23:11
arno11segmentfault23:12
Wizzupofono is still running23:12
Wizzuponlining the modem usually didn't take this long though23:12
arno11maybe have a look in ofonod.log23:13
Wizzupyeah, looks like something is off, although it's not a segfault23:13
arno11ok23:14
Wizzupso to test this we can have kmod depend on ofono, just as a test of course23:14
Wizzupthen ofono will start before the module is loaded23:14
Wizzupbut really it sounds like a bug we need to fix in ofono23:15
arno11ah good idea23:15
arno11yes but it seems to be an issue from the beginning23:15
WizzupI don't even remember what the pm option does23:15
Wizzupdo we need it still?23:16
buZz'power management' sounds plausible?23:16
WizzupbuZz: .. that much is clear23:16
arno11it was set to zero at the beginning23:16
buZzoh :)23:16
arno11yes according to modinfo it is power management23:19
arno11and per default it is set to 123:20
arno11so why we need this command to start the modem ?23:20
WizzupI imagine we probably set it to 0 in the past and then just changed the config to 123:22
WizzupI suppose it might be able to do go23:22
Wizzupto go away*23:22
arno11i think so23:22
Wizzupit won't change the bug at least23:24
arno11indeed23:25
Wizzupbut yeah, this will require a bit of debugging23:27
Wizzupthere is OFONO_ISI_DEBUG and OFONO_ISI_TRACE for env vars, and indeed we can improve ofono debugging23:27
Wizzupmaybe it is best to make an issue for this, I won't be able to look at this right now...23:27
Wizzupit's plugins/n900.c in ofono23:29
Wizzuparno11: what was the old issue you were looking it?23:29
arno11bugtracker issue 61 i think23:30
arno11with other links23:30
arno11time to sleep. i'll have a look on this tomorrow23:30
Wizzupgn23:31
Wizzupand thanks23:31
Wizzupthere should be a leste-config now btw23:31
arno11:) gn23:32
Wizzuplol the ringtone on the n900 for incoming sms comes like 4 seconds after the vibration :D23:37
Wizzupwhen it's in cache it is better23:37

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