Odroid-XU4 official Ubuntu 18.04 power issue

Test and fix the Kernel 4.14 features
Post Reply
jaf_kh
Posts: 10
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 2 times
Contact:

Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by jaf_kh » Thu Jul 25, 2019 4:16 pm

I noticed that the official XU4 ubuntu mate 18.04
https://wiki.odroid.com/odroid-xu4/os_i ... 4/20181203

has power consumption issue, consumed current is ~850mA in idle state and the board is hot even under no load.
After upgrade: sudo apt upgrade, the power consumption is reduced to ~580mA with no heat issue.
However, the suspend function is not working yet. :cry:

Jafer

User avatar
odroid
Site Admin
Posts: 31760
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 83 times
Been thanked: 241 times
Contact:

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by odroid » Thu Jul 25, 2019 5:03 pm

My SmartPower LCD shows ~380mA/5.25V in idle state at this moment without any USB devices.

Which CPU governor do you use after system update? Can you check 5 thermal sensors? Mine shows 45~48°C at 28°C of ambient temperature.

Code: Select all

odroid@odroid:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor      
ondemand

odroid@odroid:~$ cat /sys/devices/virtual/thermal/thermal_zone*/temp            
45000                                                                           
48000                                                                           
48000                                                                           
46000                                                                           
46000

odroid@odroid:~$ uname -a                                                       
Linux odroid 4.14.133-165 #1 SMP PREEMPT Mon Jul 15 22:14:09 -03 2019 armv7l armv7l armv7l GNU/Linux
BTW, the suspend feature was not implemented in the current Kernel.

jaf_kh
Posts: 10
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by jaf_kh » Thu Jul 25, 2019 6:12 pm

After upgrade and when removing all USB devices,

Code: Select all

odroid@odroid:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
performance
odroid@odroid:~$ cat /sys/devices/virtual/thermal/thermal_zone*/temp
42000
42000
45000
44000
40000

consumed current is 500mA with no usb device connected

After

Code: Select all

root@odroid:~# echo "ondemand" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
root@odroid:~# echo "ondemand" > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor
consumed current is 300mA with no sub device

jaf_kh
Posts: 10
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by jaf_kh » Thu Jul 25, 2019 6:21 pm

I'm working on suspend / resume and till this moment imported kernel from Krzysztof Kozlowski 5.3rc1 and the suspend/resume is working
during suspend 9mA
resume is done by power button.
However, sound seem not working properly after suspend/resume cycle!

User avatar
odroid
Site Admin
Posts: 31760
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 83 times
Been thanked: 241 times
Contact:

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by odroid » Thu Jul 25, 2019 6:27 pm

Glad to know that Kernel 5.3 has the suspend/resume feature.

Once we have another LTS Kernel (probably 5.4), we will support it officially.
viewtopic.php?f=95&t=33510&start=150#p263008

jaf_kh
Posts: 10
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by jaf_kh » Mon Aug 05, 2019 2:51 pm

Sound issue has been fixed with some workaround inside i2s.c module

User avatar
odroid
Site Admin
Posts: 31760
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 83 times
Been thanked: 241 times
Contact:

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by odroid » Mon Aug 05, 2019 2:57 pm

Thank you for the good news!
Do you mean the HDMI sound output works on Kernel 5.3-rc3? or, did you edit i2s driver source code?

jaf_kh
Posts: 10
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by jaf_kh » Mon Aug 05, 2019 3:36 pm

The HDMI sound is already working out-of-the-box using kernel 5.3-rc1, but when suspend/resume is executed, the sound become choppy and/or slow after resume.
It turns out that the clock supplied to i2s block is halved (some bug in suspend stuff),
as a workaround, the clock value must be divided by two to overcome this problem:
inside hw_params function of i2s.c module (/sound/soc/samsung/i2s.c, the rclk_srcrate must be halved , before return from hw_params I inserted:

Code: Select all

if(mod == 0){	
       priv->rclk_srcrate = priv->rclk_srcrate / 2; //workaround-2, clock is being halved due to unknwon bug
       printk(KERN_EMERG "i2s hw_param rclk_srcrate after resume %lu !\n", priv->rclk_srcrate);
}
return 0;
This clock is used inside config_setup function to calculate proper value of PSR register to generate the audio clock rate.
Also, to force using internal clock of i2s block, I inserted the following code inside i2s_resume function:

Code: Select all

static int i2s_resume(struct snd_soc_dai *dai)
{
struct samsung_i2s_priv *priv = dev_get_drvdata(dai->dev);	
printk(KERN_EMERG "i2s resume of dai !\n");
priv->suspend_i2smod = 0;//workaround-1 , to force using internal codec clock source (CDCLKCON bit = 0)  
//see another workaround inside hw_param  
       
        return pm_runtime_force_resume(dai->dev);

}

User avatar
odroid
Site Admin
Posts: 31760
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 83 times
Been thanked: 241 times
Contact:

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by odroid » Mon Aug 05, 2019 3:49 pm

Ok. Well noted.
When a new LTS Kernel is available and we start a porting process, I think your solution must be useful probably.

jaf_kh
Posts: 10
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by jaf_kh » Mon Aug 05, 2019 3:55 pm

Thank you,
This is not a real fix, I hope you can forward this to samsung Sylwester Nawrocki or Krzysztof Kozlowski to fix it.
I am not expert with hardware of exynos5422 specifically to solve such a problem, plus samsung did not provide Exynos5422 TRM publicly

jaf_kh
Posts: 10
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by jaf_kh » Thu Aug 08, 2019 3:09 am

@odroid

Sylwester Nawrocki submit patches to fix sound problem after suspend/resume cycles and everything is working now. It turned out that EPLL mux loses its configuration before it is saved to suspend area during suspend process.
Patches:
https://patchwork.kernel.org/patch/11082423
https://patchwork.kernel.org/patch/11082427

jaf_kh
Posts: 10
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by jaf_kh » Thu Aug 08, 2019 3:16 am

Also I have ported mali midgard driver to kernel 5.3-rc1 and successfully built mali driver, modified DTs to add mali device node.
Now we have kernel 5.3-rc1 with mali and suspend/resume capability. Current consumption during suspend is ~8mA.
Resume can be done via power button or RTC wakeup:

Code: Select all

sudo hwclock -w
sudo hwclock -r && date
echo 0 | sudo tee /sys/class/rtc/rtc0/wakealarm
echo `date '+%s' -d '+ 1 minutes'` | sudo tee /sys/class/rtc/rtc0/wakealarm
sudo pm-suspend
after 1 minute the board wakes up
These users thanked the author jaf_kh for the post:
rooted (Thu Aug 08, 2019 4:49 am)

User avatar
rooted
Posts: 6585
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 88 times
Been thanked: 17 times
Contact:

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by rooted » Thu Aug 08, 2019 4:49 am

jaf_kh wrote:Also I have ported mali midgard driver to kernel 5.3-rc1 and successfully built mali driver, modified DTs to add mali device node.
Now we have kernel 5.3-rc1 with mali and suspend/resume capability. Current consumption during suspend is ~8mA.
Resume can be done via power button or RTC wakeup:

Code: Select all

sudo hwclock -w
sudo hwclock -r && date
echo 0 | sudo tee /sys/class/rtc/rtc0/wakealarm
echo `date '+%s' -d '+ 1 minutes'` | sudo tee /sys/class/rtc/rtc0/wakealarm
sudo pm-suspend
after 1 minute the board wakes up
I'm glad to see RTC wakeup is working, it's very handy.

User avatar
odroid
Site Admin
Posts: 31760
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 83 times
Been thanked: 241 times
Contact:

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by odroid » Thu Aug 08, 2019 10:25 am

Hi Jaafar,
Thank you for the great news! I've seen your activities via Linux development mailing archive. :)
https://www.mail-archive.com/linux-kern ... 71871.html
Really appreciate your help.

BTW, that power consumption in the sleep mode is quite impressive.

Post Reply

Return to “Linux Kernel 4.14 Debugging Party”

Who is online

Users browsing this forum: No registered users and 1 guest