[Letux-kernel] [PATCH 2/4] pinctrl: ingenic: add x1600 support *** x1600 pwm

H. Nikolaus Schaller hns at goldelico.com
Fri Feb 28 14:23:34 CET 2025


Hi,
just another note:

I have compiled the pinctrl code and fixed some minor bugs.

Then I thought, I should test if PWM pinctrl really works. We have two LEDs which can be pinmuxed
to pwm0 and pwm1. And pwm5 / 6 / 7 can be pinmuxed to RasPi IOs that are not used for
the SPI display but have LEDs on my GPIO STATUS board. So it should be possible to
configure 5 LEDs with brightness control.

This needed some rework/fixes of the LX16.dts but was quite easy.

Then it turned out that we have no ingenic,pwm-x1600 compatible driver as mandated by x1600.dtsi.

Unfortunately we can't use the pwm-jz4740 driver because this is a different building block.
On x1600 it is not part of the TCU timers but a separate unit, even with DMA capabilities.

Fortunately we have a vendor driver in the letux-5.10.y-lx16 tree:
https://git.goldelico.com/?p=letux-kernel.git;a=blob;f=module_drivers/drivers/pwm/pwm-ingenic-v3.c;h=ff7ffe860cba86e76d37eb87617dcc0cb9d68dbf;hb=fe25f0c74ae04b8f402f26bb1f6716537944793f

(BTW: the x2000 also needs a specific driver
https://git.goldelico.com/?p=letux-kernel.git;a=blob;f=module_drivers/drivers/pwm/pwm-ingenic-v2.c;h=d93bc0e91683075c9a2f1c99176aae5f38bb92db;hb=fe25f0c74ae04b8f402f26bb1f6716537944793f)

So I moved the source to drivers/pwm/pwm-ingenic-x1600.c and fixed it to a level that
it compiles with just some warnings.

As one can expect it does not run:

root at letux:~# modprobe pwm_ingenic_x1600
[   24.329856] ingenic-pwm 134c0000.pwm: get pwm clk gate failed -2
[   24.330518] ingenic-pwm 134c0000.pwm: probe with driver ingenic-pwm failed with error -2
root at letux:~# 

It is missing some gate_pwm and div_pwm clock definition in x1600.dtsi. And even worse: I am
not sure if the code structure is correct since there are assumptions of how many channels and
chips are there and that may be turned upside down. Especially I do not know if these clocks
are to be defined for all 8 pwm channels or each one individually since the code seems to have
some channel dependency.

Anyways, the current code (based on letux-6.14-rc4) is here:

https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-x1600%2Bjz4730-pinctrl%2Bpwm-test-v2

I think I will now nevertheless consolidate the pinctrl fixes and post a V2 to LKML.

BR,
Nikolaus


> Am 28.02.2025 um 07:27 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> Hi Paul,
> that is fine!
> 
> So I'll post a V2 and you can perhaps comment there.
> 
> BR and thanks,
> Nikolaus
> 
>> Am 27.02.2025 um 22:24 schrieb Paul Boddie <paul at boddie.org.uk>:
>> 
>> On Wednesday, 26 February 2025 22:23:05 CET H. Nikolaus Schaller wrote:
>>> Hi Paul,
>>> 
>>> here is what I think needs to be changed (not yet compile or runtime
>>> tested):
>> 
>> The suggestion of having two separate groups for PWM5..7 seems reasonable. I 
>> don't have time to look at this right now, but a cursory glance at my notes 
>> suggests that you have the right of it.
>> 
>> Paul
>> 
>> 
> 
> _______________________________________________
> https://projects.goldelico.com/p/gta04-kernel/
> Letux-kernel mailing list
> Letux-kernel at openphoenux.org
> http://lists.goldelico.com/mailman/listinfo.cgi/letux-kernel



More information about the Letux-kernel mailing list