Odroid-XU4 official Ubuntu 18.04 power issue

Test and fix the Kernel 4.14 features
Post Reply
jaf_kh
Posts: 14
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 6 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: 32130
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 119 times
Been thanked: 292 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: 14
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 6 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: 14
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 6 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: 32130
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 119 times
Been thanked: 292 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: 14
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 6 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: 32130
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 119 times
Been thanked: 292 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: 14
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 6 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: 32130
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 119 times
Been thanked: 292 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: 14
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 6 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: 14
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 6 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: 14
Joined: Thu Jul 25, 2019 4:09 pm
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 6 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: 6610
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 104 times
Been thanked: 20 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: 32130
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 119 times
Been thanked: 292 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.

escalade
Posts: 91
Joined: Thu Mar 14, 2019 8:34 pm
languages_spoken: english and norwegian
Has thanked: 3 times
Been thanked: 13 times
Contact:

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by escalade » Tue Aug 20, 2019 6:10 pm

jaf_kh wrote:
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.
Can you share your kernel patch please?
Maintainer of RetroELEC (XU4 support!)

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

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by jaf_kh » Thu Aug 22, 2019 6:27 am

Enable Mali GPU driver

Assuming you have already cloned kernel 5.3 to ~/linux53

steps are:
1. Clone mihail kernel 5.0 for odroid-xu4 from:
git clone https://github.com/mihailescu2m/linux.git -b odroidxu4-5.0.y

2. Copy midgard directory from ~/linux/drivers/gpu/arm/ to ~/linux53/drivers/gpu/arm/
3. Edit file ~/linux53/drivers/gpu/arm/Kconfig, add the followin lines:

Code: Select all

menu "ARM GPU Configuration"
source "drivers/gpu/arm/midgard/Kconfig"
endmenu

4. Edit file ~/linux53/drivers/Kconfig, add the following line

Code: Select all

source "drivers/gpu/arm/midgard/Kconfig
My config is: http://paste.ubuntu.com/p/KKjmXNGC5q/

The above steps will include mali gpu driver in the kernel
However you will need to add mali node in dts,

5. Replace arch/arm/boot/dts/exynos5420.dtsi with the attached file
6. add the following lines to arch/arm/boot/dts/exynos5422-odroid-core_odroid.dtsi

Code: Select all

&mali {	
    mali-supply = <&buck4_reg>;	
    status = "okay";
};
Attachments
exynos5420.zip
(5.56 KiB) Downloaded 8 times
These users thanked the author jaf_kh for the post:
odroid (Thu Aug 22, 2019 9:09 am)

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

Re: Odroid-XU4 official Ubuntu 18.04 power issue

Unread post by jaf_kh » Sat Aug 24, 2019 5:11 am

Also, after step (3) , Edit file ~/linux53/drivers/gpu/Makefile
add

Code: Select all

obj-y 			+= arm/midgard/

just after the line: obj-y += drm/ vga/
These users thanked the author jaf_kh for the post (total 2):
odroid (Mon Aug 26, 2019 10:40 am) • escalade (Thu Aug 29, 2019 8:04 pm)

Post Reply

Return to “Linux Kernel 4.14 Debugging Party”

Who is online

Users browsing this forum: No registered users and 1 guest