pwm: add pwm-atmel from Linux kernel 4.14
Subsystems (3)
RFC PATCH 1/1 pwm: add pwm-atmel from Linux kernel 4.14
Following patch is more or less untested.
It is posted to get feedback if this is the right way to implement support for pwms in at91sam9263 & friends.
In the kernel there is also a file named pwm-atmel-tcb. I dunno which is the better starting point.
The patch will recognize pwm0 on the at91sam9263ek board (if status = "okay") so it has seen minimal testing. But I have yet to utilize any of the pwm's.
While working with this I get the impression that the core should know about pwm channels and device_d pointer should be part of the core data.
But I was not prepared to make anything but local changes in this round.
Feedback appreciated!
Sam
From 4868c3d0687bfc3b870c295fe33b021a239c7a6a Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Sat, 30 Dec 2017 08:28:33 +0100
Subject: [PATCH 1/1] pwm: add pwm-atmel from Linux kernel 4.14
This add the pwm-atmel.c file from kernel 4.14,
modified for barebox use.
The code is modelled over pwm-mxs.
pwm-atmel is required to support PWM's used on a board with AT91SAM9263 - controlling backlight and contrast.
--- drivers/pwm/Kconfig | 6 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-atmel.c | 289 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 296 insertions(+) create mode 100644 drivers/pwm/pwm-atmel.c
drivers/pwm/Kconfig +6 -0
@@ -16,6 +16,12 @@ config PWM_PXA This enables PWM support for Intel/Marvell PXA chips, such as the PXA25x, PXA27x. +config PWM_ATMEL + bool "Atmel PWM Support" + depends on ARCH_AT91 + help + This enables PWM support for Ateml AT91 SoCs + config PWM_IMX bool "i.MX PWM Support" depends on ARCH_IMX
drivers/pwm/Makefile +1 -0
@@ -1,4 +1,5 @@ obj-$(CONFIG_PWM) += core.o obj-$(CONFIG_PWM_PXA) += pxa_pwm.o +obj-$(CONFIG_PWM_ATMEL) += pwm-atmel.o obj-$(CONFIG_PWM_IMX) += pwm-imx.o obj-$(CONFIG_PWM_MXS) += pwm-mxs.o
drivers/pwm/pwm-atmel.c new file +289 -0
289 lines not on this page · raw message
Signature · 7 lines
2.12.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 7 lines · Sam Ravnborg
Following patch is more or less untested.
It is posted to get feedback if this is the right way to implement support for pwms in at91sam9263 & friends.
In the kernel there is also a file named pwm-atmel-tcb. I dunno which is the better starting point.
Looks good, but I don't know the hardware and can't say what pwm-atmel-tcb is for.
Quoted 8 lines
The patch will recognize pwm0 on the at91sam9263ek board (if status = "okay") so it has seen minimal testing. But I have yet to utilize any of the pwm's.
While working with this I get the impression that the core should know about pwm channels and
device_dpointer should be part of the core data.
I know it's done like this in Linux. Any good reason to do this in barebox aswell besides of "do it as in Linux"?
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi Sascha.
Quoted 6 lines
Quoted 3 lines
While working with this I get the impression that the core should know about pwm channels and
device_dpointer should be part of the core data.I know it's done like this in Linux. Any good reason to do this in barebox aswell besides of "do it as in Linux"?
The overall structure is something like this:
PWM Controller PWM Channel
+------------+ | | +------------+ | pwm_chip |====>| pwm_device |+ | | +------------+| +------------+ +------------+
And with the current core support each implementation needs to provide their owm implementation of this. And I can see the core has data I think belongs on another level.
So having better core support should simplify the individual implementations a bit - I think.
When I get pwm-atmel working I may try to give it a shot. If things turns out positivie I will post patches.
Sam
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox