Jump to content

Enabling PWM in Odroid-C2 using the meta-odroid Kirkstone branch with Yocto.


Recommended Posts

Posted

Hello,

Setup

  • Yocto branch: Kirkstone (honister back-ports disabled)
  • Layers / commits
    • meta-odroid 06f8d2c (last week’s master)
    • poky kirkstone (bitbake 2.2.0)
  • Kernel: linux = v5.15 

 

What I changed so far

Enabled the driver
Added a linux-hardkernel_%.bbappend with:
 

CONFIG_PWM=y
CONFIG_PWM_MESON=y

 

Patched the Device Tree (added a new layer to patch in yocto using devtool):

From 9f296f4b8f636b12ef8c0a4720cf0d25d9eeb810 Mon Sep 17 00:00:00 2001
From: OpenEmbedded <oe.patch@oe>
Date: Thu, 17 Jul 2025 15:50:18 -0400
Subject: [PATCH] some changes to source for pwm

---
 arch/arm64/boot/dts/amlogic/meson-gx.dtsi          |  2 +-
 .../arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
index 32cc9fab4490..f7abfd4746d2 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
@@ -330,7 +330,7 @@ pwm_ab: pwm@8550 {
  compatible = "amlogic,meson-gx-pwm", "amlogic,meson-gxbb-pwm";
  reg = <0x0 0x08550 0x0 0x10>;
  #pwm-cells = <3>;
- status = "disabled";
+ status = "okay";
  };
 
  pwm_cd: pwm@8650 {
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
index 201596247fd9..0f5e52e7096c 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
@@ -416,3 +416,17 @@ &usb0 {
 &usb1 {
  status = "okay";
 };
+
+&pwm_ab {
+  status = "okay";
+  pinctrl-names = "default";
+  pinctrl-0     = <&pwm_a_x_pins>;
+};
+
+&pinctrl {
+   pwm_a_x_pins: pwm_a_x {
+        groups    = "pwm_a_x";
+        functions = "pwm_a_x";
+        bias-pull-disable;
+   };
+};

 

Symptoms

modprobe pwm-meson dosen't loads, nothing in dmesg. But the file are here

root@odroid-c2:~# dmesg | grep pwm                                                                                                   
root@odroid-c2:~# ls /sys/class/pwm*
pwmchip0
root@odroid-c2:~# ls /sys/class/pwm/pwmchip0/
device     export     npwm       power      subsystem  uevent     unexport
root@odroid-c2:~# modprobe pwm-meson 
root@odroid-c2:~# dmesg | grep pwm
root@odroid-c2:~# ls /sys/class/pwm/pwmchip0/
device     export     npwm       power      subsystem  uevent     unexport
root@odroid-c2:~# echo 0 > /sys/class/pwm/pwmchip0/export 
root@odroid-c2:~# ls /sys/class/pwm/pwmchip0/pwm0/
capture     duty_cycle  enable      period      polarity    power       uevent

/sys entries:

/sys/class/pwm/pwmchip0/ 
	├── export 
 	├── npwm
	├── device    
	├── power      
	├── subsystem
	├── uevent     	
	├── unexport
	└── pwm0/ 
		├── freq0 
		├── duty0  
		└── enable0

I run (root):

root@odroid-c2:~# echo 20000000 > /sys/class/pwm/pwmchip0/pwm0/period         
root@odroid-c2:~# echo 1500000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle         
root@odroid-c2:~# echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable

but nothing happen.

Questions

  • Has anyone successfully driven hardware PWM on the C2 with current meta-odroid + Kirkstone?
  • Any known quirks with the pinctrl or the pwm-meson driver on kernels ≥ 5.15?
  • Sample DTS snippet or working .bbappend would be greatly appreciated!

Thanks in advance.

Krum

  • Werner locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines