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

Wizzupsicelo: with improved pm it makes much more sense for us to try to see what's up with the calls01:58
Wizzup(audio) on n90001:58
Wizzupfor me the n900 i/o is still slower than I'd expect it to be02:47
Wizzupbut maybe my sd card is poor (I think I got this one for free..)02:47
freemangordonWizzup: yes (one wire change)07:21
freemangordontmlind: according to MC13783 we can read for pairs of battery U/I samples at once, have you ever tried that?08:33
freemangordonhmm, actually this seems to be already supported byt the iio driver08:52
freemangordontmlind: please help, I have hard times understanding what in_voltage16_xxx  and in_current17_xxx are in terms of cpcap iio driver09:43
freemangordonmy gut feeling tells me those shall read 8 samples of battery voltage and 4 pairs of battery voltage/current, but I can't understand how shall I get to those09:44
freemangordonor, maybe this is not implemented?09:44
freemangordonthis https://github.com/maemo-leste/droid4-linux/blob/maemo-6.1.y/drivers/iio/adc/cpcap-adc.c#L14809:45
tmlindfreemangordon: 16 and 17 seem to be some battery related values12:38
tmlindprobably not ocv values though, but maybe some longer term sampling values?12:39
freemangordontmlind: IIUC MC13783 UG correctly, those should provide either 8 samples of voltage in a row or 4 pairs of voltage/current in a row12:40
tmlindsee the driver for "remuxed" for those two channesl12:40
freemangordonyes, but driver seems to read only one value12:40
tmlindoh so is the mc13783 actually saying something about those two extra channels?12:40
freemangordonyes12:40
tmlindinteresting12:40
freemangordonsee 9.5.112:41
tmlindok12:41
freemangordonif we have that in cpcap, then we'll be able to estimate charge without coloumb12:41
tmlindyeah i think they provide multiple samples, no idea for how long period though12:42
freemangordonbecause we'll have correct readings of BATT and BATTISNS12:42
freemangordontmlind: but, I have hard times finding how to return those smaples to userspace12:43
freemangordonseems read_raw_multi() is limited to 4 values12:43
freemangordoniio core that is12:43
tmlindhmm12:44
tmlindi think the driver currently only works in single channel mode though12:44
freemangordonalso, iiuc vendor kernel reads 8 values at once12:45
tmlindok then maybe the mainline kernel can too, we should have it initialized to the same register values12:45
freemangordonsee adc_result() in vendor kernel12:46
freemangordonit does for (i = CPCAP_REG_ADCD0; i <= CPCAP_REG_ADCD7; i++) { ...12:46
freemangordonbut then again, how to return 8 values?12:47
tmlindno idea..12:47
freemangordon:(12:47
freemangordonwould upstream accept if I use low/half words of those 4 inegers to store 16bit signed values?12:48
freemangordonlow/high12:48
freemangordonsounds terrible though12:48
freemangordontmlind: hmm, about single-channel:12:49
freemangordon"In single channel mode, with RAND=1, ADSEL=0, ADA1[2:0]=001, the converted result is available in 4 pairs of battery voltage and current reading"12:49
freemangordonI just cannot find the equivalent BATICON bit in cpcap12:50
tmlindwhat are the four registers to read from?13:01
tmlindor is that 8 registers then?13:01
tmlindmy guess is the stock v3.0.8 kernel is using this mode, so comparing register values should make the mode work13:02
freemangordonthose are 8 channels13:02
freemangordonstill, there is one bit I cannot find13:03
freemangordonBATICON13:04
freemangordonwithout that set we'll have no input current sense readings13:04
tmlindhave you checked v3.0.8 kernel ADC_* defines in include/linux/spi/cpcap-regbits.h?13:09
freemangordonyes13:09
tmlindok13:10
freemangordonmaybe it is CPCAP_BIT_AD4_SELECT13:11
freemangordonthis is nowhere used though13:11
freemangordonwell, I can start setting bits until I get 4x2 similar readings :)13:12
freemangordonbut, lets first verify the theory:13:12
freemangordonif we have correct readings of battery voltage *and* current, samples take at exactly the same moment, that will allow us to correctly calculate Ri and thus OCV, no?13:13
tmlindyup13:14
tmlindwell i know nothing about the OCV part13:14
freemangordonalso, do I get it right that despite that we read one channel actually all 8 channels ard ADC-ed?13:14
freemangordon*are13:14
tmlindyes might be13:15
freemangordonok13:15
tmlindbut these two extra channels are special somehow, they need to be muxed/routed or something to read the saved values13:15
freemangordonI don;t get that part - what do you mean 'mixed'?13:16
freemangordonvalue1 |= CPCAP_BIT_RAND1; ?13:17
tmlindwell those two extra channels seem to be sampling in the back ground, and to read the values you need to partially reconfigure the adc to read those two extra channels or something13:18
freemangordonthis is not clear from the driver code. Or I don;t get it13:18
freemangordonI am still reading through it13:19
freemangordonthe only special thing I can found about it is this https://github.com/maemo-leste/droid4-linux/blob/maemo-6.1.y/drivers/iio/adc/cpcap-adc.c#L55813:19
tmlindyeah i'm totally unsure about this too, might be worth checking the v3.0.8 kernel..13:19
freemangordonthey have this CPCAP_ADC_TYPE_BATT_PI type there13:20
freemangordonwhich does value1 |= CPCAP_BIT_RAND1;13:20
freemangordonhmm:13:21
freemangordonif (req->type == CPCAP_ADC_TYPE_BATT_PI)13:21
freemangordontbl_index = (tbl_index % 2) ? CPCAP_ADC_BATTI_ADC :13:21
freemangordon    CPCAP_ADC_BATTP;13:21
freemangordonlooks like I am on something :)13:21
freemangordonthis looks exactly like even channels being U and odd - I13:22
tmlindok13:23
freemangordonwill put some printks13:23
tmlindyou are aware of REGMAP_ALLOW_WRITE_DEBUGFS, right?13:23
tmlinddefine it in the driver13:23
freemangordonI prefer to patch the driver13:23
tmlindok13:23
freemangordonok, thanks, will let you know if I have any progress :)13:24
tmlindok cool13:24
freemangordonWizzup: is kernel 6.1.y released?13:41
freemangordonI mean maemo-6.1.y branch?13:43
freemangordontmlind: heh https://pastebin.com/6f7ffLQu13:53
freemangordon:)13:53
freemangordonI don;t understand why there is a difference though13:55
Wizzupfreemangordon: I am not sure if I understand your question, do you mean did kernel.org release it?13:59
WizzupI think if we are at 6.1.y then that usually means it is, as I think uvos rebases on stable13:59
freemangordonno, do we released it, like if we have it in the repo14:00
freemangordonat least chimaera is on 6.1.0.9-1+m7.114:00
freemangordonso maybe it is released for beowulf only14:00
freemangordonif at all14:00
Wizzuphuh14:01
WizzupI think it's on the devices?14:01
freemangordon6.1.0.9-1+m7.1 is -rc8 or something14:01
Wizzupmaybe we did not rebase on stable14:01
freemangordonwhat do you mean 'devices'? my d4 is device, no? :p14:01
Wizzupmy device is some 6.1.x14:02
WizzupI don't know if it is rc or stable14:02
Wizzupprobably best to ask uvos, or take my word for it :D14:02
Wizzuphe's been managing it14:02
freemangordonwhat apt-cache policy linux-image-omap says about it?14:02
WizzupI am restarting my d4 since the screen did not want to turn on, even though it was in leste14:02
Wizzupso give me a minute14:03
Wizzupbut I am sure it will show the same as yours14:03
freemangordonmaybe you have -experimental enabled, thas whay14:03
freemangordon*why14:03
tmlindfreemangordon: cool so looks like you have some data :) i don't understand what difference you're talking about though.. do you mean variation in the sampled data?14:03
freemangordonyes14:03
freemangordonbetweeh channel 16 and 1714:03
tmlinddon't you get values both for 16 and 17 the same time?14:04
tmlindif you read 16 separately from 17, then it's a new set of sampled values for 17 already?14:04
freemangordonboth seems to produce U/I pairs, but reading 16 seems to produce slightly high I readings14:05
freemangordonno, values for 16 and 17 are in consecutive reads14:05
freemangordonone read reads 8 channels14:05
freemangordonproducing 4 pairs of values14:06
freemangordonsee the patch14:06
freemangordonso, it seems setting CPCAP_BIT_RAND1 is enough for multi-channel read14:07
tmlindok14:08
Wizzupfreemangordon: it says 6.1.0-rc8 for me14:10
Wizzupbbiab14:10
Wizzup(uname -a)14:10
freemangordonWizzup: does not sound like .y :)14:10
freemangordonsame here though14:10
freemangordon-rc814:10
freemangordonso, we have 6.1.y, but not released it seems14:10
Wizzuphow about this14:11
Wizzupthe branch was called .y as -rc already14:11
Wizzupand we never actually rebased upon release14:11
freemangordonno, because I just built it:14:11
freemangordonLinux devuan-droid4 6.1.9-34584-gf5555be2e326-dirty #2 SMP PREEMPT Sat Mar 18 12:37:36 UTC 2023 armv7l GNU/Linux14:11
Wizzupok, weird...14:11
Wizzupmaybe uvos didn't release14:11
Wizzupbbiab now14:12
freemangordonmhm14:12
freemangordonat least that boots :)14:12
arno11Hi guys. what is controlling apt-worker on startup?14:18
freemangordonHAM14:18
arno11it causes slowness during several minutes14:18
arno11ok14:18
freemangordonwell, it does apt-get update14:19
freemangordonmore or less14:19
arno11more14:19
arno11yes i know14:19
arno11that s the problem14:19
arno11there was a similar issue in fremantle iirc14:20
freemangordonright14:21
sixwheeledbeastis it the same thing that checks repos every 24hour?14:21
freemangordonyes14:21
arno11that's why the 2 first boots with clean chimaerq are complicates14:22
sixwheeledbeastthere was some setting for that14:22
freemangordonyou wanted fremantle experience, no :p14:22
* freemangordon hides14:22
arno11no probs for me14:22
freemangordonit is responsible for the blinking yellow icon "update available" in the status menu14:23
freemangordonyou can set the check timeout though14:23
freemangordondon;t remember where in gconf is the parameter14:23
arno11no probs14:24
arno11i know the parameters14:24
arno11but on clean install it s complicated14:24
arno11because of slowness14:24
arno11that s why i m asking14:25
arno11i think it should be easier if it was complately disable on fresh install14:27
arno11i mean from user POV14:27
freemangordonwhy? like, when will apt-get update happen then?14:29
arno11on first boot with no swap and rootfs not extanded device is really slow14:30
arno11when you try14:30
arno11connecting to wifi14:30
arno11apt-worker start14:30
arno11and device is unresponsive14:30
freemangordonbut that means that we shall enable swap and extend rootfs, no?14:30
arno11yes indeed14:31
arno11but on first boot apt-worker arrive too quickly14:32
arno11with 100% cpu14:32
arno11on n900 it means too much processes at same time14:34
arno11killing it quickly solve issue14:34
arno11but not really user friendly lol14:34
freemangordondid you check the nice value?14:38
arno11?14:40
freemangordonthe process priority14:40
freemangordonapt-worker process14:40
freemangordonit should run with low prio (high nice value)14:41
freemangordonif not, something got broken14:41
arno11ah ok i understand14:41
freemangordonso, if it runs with low prio, 100% cpu usage is not an issue14:42
arno11i ve to check14:42
arno11makes sense14:42
freemangordonand most-probably slowness comes from lack of memory14:42
freemangordonmamory/swap14:42
freemangordon*memory14:42
freemangordonhave to run, ttyl14:43
arno11ok14:43
arno11thx14:43
arno11ttyl14:43
sixwheeledbeastgconftool -g /apps/hildon/update-notifier/check_interval14:54
sixwheeledbeastit's in hours14:54
arno11yes no surprise 24 hours14:57
arno11like fremantle14:57
arno11but do you think setting a big value will be persistent?14:59
arno11anyway set 214748364715:06
arno11let's see if it works15:06
sixwheeledbeastwell I recall 5 years being common mod, but I don't believe it stops the check on boot?15:08
arno11agree15:10
arno11i reboot and we'll have the answer15:12
arno11surprisingly seems deactivated on boot15:22
sixwheeledbeastcheck interval and the orange notification have separate keys15:23
arno11interval has not been reset15:24
arno11cooll15:24
arno11orange notif has never worked in leste with my device15:27
arno11anyway that's fine15:29
Wizzuparno11: I think the i/o load is weird15:44
Wizzupon n90015:44
Wizzupit really slows down a lot15:44
arno11really ?15:44
Wizzupmaybe my card is slow15:45
Wizzupbut that is what I think I see15:45
WizzupI have emmc swap and memory was nowhere near full15:45
Wizzupbut apt indeed slows down device a lot15:45
Wizzupand I think it is i/o related15:45
arno11so probably the sdcard ?15:46
arno11or 125mhz opp15:46
arno11still slow if you use cpufreq performance mode ?15:49
Wizzuparno11: will check in a bit16:25
arno11ok16:28
freemangordontmlind: ok, with proper phase and convert I am getting sane values for U/I pairs16:28
freemangordonwith charger connected16:29
freemangordonhttps://pastebin.com/4myM02CV16:29
tmlindfreemangordon: cool. if you read the values in a loop, do they only update every 250ms?16:32
tmlindi recall that's what the sample rate configure is16:33
freemangordoncould be16:33
freemangordonbut, I am not reading in a loop16:33
freemangordonalso, I think sample rate can be changed16:33
tmlindyeah probably no need to change it, just wondering16:35
freemangordonanyway, now the question is - how to provide that info to battery driver?16:35
tmlindthe battery driver can use the iio api.. how about calculate average for voltage and current and provide only two values?16:37
tmlindor four values of mW?16:38
freemangordonI was thinking abot that16:38
freemangordon*about16:38
freemangordonbut that will not allow me to correctly calculate Ri16:38
tmlindhmm knowing the voltage is important too..16:38
freemangordonanyway, have to run now16:38
tmlindyeah ttyl16:38
freemangordonttyl16:38
freemangordontmlind: I think I got it. First of all - channels 16&17 are not really correct - basically both do ADC on channels 0/1, because   CPCAP_BIT_ADA0..3=000. CPCAP_BIT_ADAx are used for channel selection when doing single channel ADC22:57
freemangordonin general, single-channel adc gets 8 samples of the same channel, besides when BATICON (the mystery bit) is set, then 4 pairs of U/I are taken23:02
freemangordonCPCAP_BIT_RAND1 selects single channel ADC23:03
freemangordonmaybe in cpcap this bit is missing and channel 0 is always read as pairs while the other channels are read normally (8 samples)23:04
freemangordonBTW, there is MC13892 pdf available that has some more info, includein calibration and couloumb counter23:06
maemish_Started to search info cause wanted to understand your finds. Found this but did not help me. https://github.com/analogdevicesinc/linux/blob/master/drivers/iio/adc/cpcap-adc.c#L123:15
freemangordonhmm?23:16
freemangordonyou don;t really want to go into that23:17
freemangordontmlind: sorry, not channel 0 but channel 123:17
freemangordonI will play a bit more with it though23:18
freemangordonbut, maybe doing average of 4 samples and returning as a pair (which iio  read_raw() allows) is the way to go23:19
maemish_https://www.irccloud.com/pastebin/xDenGoO023:24

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