-
Notifications
You must be signed in to change notification settings - Fork 5.2k
No pwmchip2 in /sys/class/pwm after update to kernel 6.12 #6818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
|
I have the same issue on a pi5 8gb. Downgrading to 6.6 fixes it. On 6.12 /sys/class/pwm/ has a pwmchip0; on 6.6 it has pwmchip0 and pwmchip2. As I understand it pwmchip0 is used for fan control, and the user accessible pwm channels are on pwmchip2; at least that's how it works on 6.6 config.txt has this added to the end: |
You've lost nothing useful, but the device numbers may have changed (the kernel doesn't make any attempt to use systematic numbering). With the same config.txt pwm dtoverlay line as you, on 6.6:
And on 6.12:
Although the PWM interface that appeared as pwmchip0 on 6.6 is no longer available, that's because it's not available on user-accessible pins so it now remains disabled. The header pins available for PWM are as follows:
As an example showing how to interpret this information, header pin 32 carries GPIO12, on which channel 0 of PWM0 can appear as function a0 ("pinctrl -p 32 a0" or "pinctrl 12 a0"). Similarly, header pin 35 -> GPIO19, "pinctrl -p 35 a3" or "pinctrl 19 a3". Of the two RP1 PWM interfaces, only PWM0 (at address 0x1f00098000) appears on the 40-pin header, but PWM1 (at address 0x1f0009c000) is used for fan control. If you've been following along, you would may have figured out that the PWM block that used to appear as pwmchip2 on 6.6 is now pwmchip0 on 6.12. However, if other PWM interfaces are created (using the pwm-gpio or pwm-pio overlays, for example) then the numbering could change, since the numbering is determined by the enumeration order and the kernel doesn't guarantee that. However, when I added a pwm-gpio instance on GPIO 7 it appeared as pwmchip2, so it may be safe to assume for now that the interface you want (PWM0) is pwmchip0:
|
Thank you, I switched to using pwmchip0 now and it works as intended. I'll add a check of the device name to be robust against possible future renumbering |
I'm open to the possibility of deriving device numbers from Device Tree aliases, as is done with other subsystems, but it would be yet another downstream patch, in this case to some code which has so far been unaltered. |
I just did something like
which solved my problems and works on both 6.6 and 6.12 |
You did good - I'm just acknowledging that the way the kernel presents PWM chips to userspace could be better. |
After updating from kernel 6.6. to 6.12, pwmchip2 disappeared from
/sys/class/pwm
. I did all possible updates, but the issue still persists.I'm using a Raspberry Pi 5B 2GB, Raspberry Pi OS 64bit.
The text was updated successfully, but these errors were encountered: