SPEAr320: Add pwm support
Subsystems (3)
cover SPEAr320: Add pwm support
This patchset adds driver for ST Microelectronics PWM and machine support for SPEAr320 Machines.
It was earlier reviewed as part of following patchset:
"[PATCH V6 00/17] Adding devices support for all spear machines"
Changes since earlier patchset:
- Moved driver to drivers/misc/ directory.
Viresh Kumar (3):
misc/st_pwm: Add support for ST's Pulse Width Modulator
SPEAr3xx: Add machine support for ST's PWM IP
SPEAr3xx: Update defconfig for ST's PWM
MAINTAINERS | 5 + arch/arm/configs/spear3xx_defconfig | 2 + arch/arm/mach-spear3xx/include/mach/generic.h | 1 + arch/arm/mach-spear3xx/spear320.c | 16 + arch/arm/mach-spear3xx/spear320_evb.c | 1 + drivers/misc/Kconfig | 7 + drivers/misc/Makefile | 1 + drivers/misc/st_pwm.c | 486 +++++++++++++++++++++++++ 8 files changed, 519 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/st_pwm.c
Signature · 1 line
1.7.2.2
PATCH 1/3 misc/st_pwm: Add support for ST's Pulse Width Modulator
This patch adds support for ST Microelectronics Pulse Width Modulator. This is currently used by ST's SPEAr platform and tested on the same.
--- MAINTAINERS | 5 + drivers/misc/Kconfig | 7 + drivers/misc/Makefile | 1 + drivers/misc/st_pwm.c | 486 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 499 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/st_pwm.c
MAINTAINERS +5 -0
@@ -6031,6 +6031,11 @@ M: Jan-Benedict Glaw <[email protected]> S: Maintained F: arch/alpha/kernel/srm_env.c +ST Microelectronics Pulse Width Modulator Support +M: Viresh Kumar <[email protected]> +S: Maintained +F: drivers/misc/st_pwm.c + STABLE BRANCH M: Greg Kroah-Hartman <[email protected]> L: stable at kernel.org
drivers/misc/Kconfig +7 -0
@@ -425,6 +425,13 @@ config SPEAR13XX_PCIE_GADGET entry will be created for that controller. User can use these sysfs node to configure PCIe EP as per his requirements. +config ST_PWM + tristate "ST Microelectronics Pulse Width Modulator" + default n + help + Support for ST Microelectronics Pulse Width Modulator. Currently it is + present and tested on SPEAr Platform only. + config TI_DAC7512 tristate "Texas Instruments DAC7512" depends on SPI && SYSFS
drivers/misc/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_HMC6352) += hmc6352.o obj-y += eeprom/ obj-y += cb710/ obj-$(CONFIG_SPEAR13XX_PCIE_GADGET) += spear13xx_pcie_gadget.o +obj-$(CONFIG_ST_PWM) += st_pwm.o obj-$(CONFIG_VMWARE_BALLOON) += vmw_balloon.o obj-$(CONFIG_ARM_CHARLCD) += arm-charlcd.o obj-$(CONFIG_PCH_PHUB) += pch_phub.o
drivers/misc/st_pwm.c new file +486 -0
486 lines not on this page · raw message
Signature · 1 line
1.7.2.2
PATCH 2/3 SPEAr3xx: Add machine support for ST's PWM IP
In reply to Viresh Kumar--- arch/arm/mach-spear3xx/include/mach/generic.h | 1 + arch/arm/mach-spear3xx/spear320.c | 16 ++++++++++++++++ arch/arm/mach-spear3xx/spear320_evb.c | 1 + 3 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/mach-spear3xx/include/mach/generic.h +1 -0
@@ -162,6 +162,7 @@ void __init spear310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,#ifdef CONFIG_MACH_SPEAR320 /* Add spear320 machine device structure declarations here */ extern struct platform_device spear320_plgpio_device; +extern struct platform_device spear320_pwm_device;/* pad mux modes */ extern struct pmx_mode spear320_auto_net_smii_mode;
arch/arm/mach-spear3xx/spear320.c +16 -0
@@ -548,6 +548,22 @@ struct platform_device spear320_plgpio_device = { .resource = plgpio_resources, }; +/* pwm device registeration */ +static struct resource pwm_resources[] = { + { + .start =SPEAR320_PWM_BASE , + .end =SPEAR320_PWM_BASE +SZ_4K -1 , + .flags =IORESOURCE_MEM , + }, +}; + +struct platform_device spear320_pwm_device = { + .name ="st_pwm" , + .id =-1 , + .num_resources =ARRAY_SIZE (pwm_resources), + .resource = pwm_resources, +}; +/* spear320 routines */ void __init spear320_init (struct pmx_mode *pmx_mode,struct pmx_dev **pmx_devs,u8 pmx_dev_count)
arch/arm/mach-spear3xx/spear320_evb.c +1 -0
@@ -50,6 +50,7 @@ static struct platform_device *plat_devs[] __initdata = {/* spear320 specific devices */ &spear320_plgpio_device, + &spear320_pwm_device, };static void __init spear320_evb_init (void )
Signature · 1 line
1.7.2.2
PATCH 3/3 SPEAr3xx: Update defconfig for ST's PWM
In reply to Viresh Kumar--- arch/arm/configs/spear3xx_defconfig | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/configs/spear3xx_defconfig +2 -0
@@ -14,6 +14,8 @@ CONFIG_BINFMT_MISC=y CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=16384 +CONFIG_MISC_DEVICES=y +CONFIG_ST_PWM=y CONFIG_INPUT_FF_MEMLESS=y # CONFIG_INPUT_MOUSEDEV_PSAUX is not set # CONFIG_INPUT_KEYBOARD is not set
Signature · 1 line
1.7.2.2
Arnd Bergmann
maintainercover SPEAr320: Add pwm support
In reply to Viresh KumarQuoted 10 lines · On Monday 30 May 2011 09:21:02 Viresh Kumar wrote:
MAINTAINERS | 5 + arch/arm/configs/spear3xx_defconfig | 2 + arch/arm/mach-spear3xx/include/mach/generic.h | 1 + arch/arm/mach-spear3xx/spear320.c | 16 + arch/arm/mach-spear3xx/spear320_evb.c | 1 + drivers/misc/Kconfig | 7 + drivers/misc/Makefile | 1 + drivers/misc/st_pwm.c | 486 +++++++++++++++++++++++++ 8 files changed, 519 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/st_pwm.c
No objection to your patch, but I think we need to have a long-term plan for pwm:
arnd at wuerfel:~/linux-2.6$ git ls-files | grep pwm.c arch/arm/mach-exynos4/include/mach/pwm-clock.h arch/arm/mach-mxs/devices/platform-mxs-pwm.c arch/arm/mach-s3c64xx/include/mach/pwm-clock.h arch/arm/mach-s5p64x0/include/mach/pwm-clock.h arch/arm/mach-s5pc100/include/mach/pwm-clock.h arch/arm/mach-s5pv210/include/mach/pwm-clock.h arch/arm/mach-vt8500/pwm.c arch/arm/plat-mxc/devices/platform-mxc_pwm.c arch/arm/plat-mxc/pwm.c arch/arm/plat-pxa/pwm.c arch/arm/plat-s3c24xx/include/mach/pwm-clock.h arch/arm/plat-samsung/dev-pwm.c arch/arm/plat-samsung/pwm-clock.c arch/arm/plat-samsung/pwm.c arch/mips/jz4740/pwm.c arch/unicore32/kernel/pwm.c drivers/leds/leds-atmel-pwm.c drivers/leds/leds-pwm.c drivers/mfd/twl6030-pwm.c drivers/misc/ab8500-pwm.c drivers/misc/atmel_pwm.c drivers/misc/ep93xx_pwm.c
My rough feeling is that what this should look like is a new subsystem that exports a set of operations and has specific drivers, like:
drivers/pwm/Kconfigdrivers/pwm/pwm_core.cdrivers/pwm/pwm_pxa.cdrivers/pwm/pwm_unicore.cdrivers/pwm/pwm_st.cdrivers/pwm/pwm_...
This is in the spirit of turning code that is organized by platform into code that is organized by subsystem, and factoring out the common bits.
A real problem we are going to hit without this is the fact that each of these drivers exports the same symbols, which prevents you from building a multi-platform kernel. It will need to export the common set of symbols and pass through operations to the individual drivers then:
arnd at wuerfel:~/linux-2.6$ git ls-files | grep pwm.c | xargs grep EXPORT_SYMBOL -h | sort | uniq -c
1 EXPORT_SYMBOL(pwm_channel_alloc);
1 EXPORT_SYMBOL(pwm_channel_free);
1 EXPORT_SYMBOL(pwm_channel_handler);
1 EXPORT_SYMBOL(__pwm_channel_onoff);
1 EXPORT_SYMBOL(pwm_clk_alloc);
1 EXPORT_SYMBOL(pwm_clk_free);
7 EXPORT_SYMBOL(pwm_config);
7 EXPORT_SYMBOL(pwm_disable);
7 EXPORT_SYMBOL(pwm_enable);
7 EXPORT_SYMBOL(pwm_free);
7 EXPORT_SYMBOL(pwm_request);As you can see here, the one driver is the odd one out, it provides a completely different API. This is drivers/misc/atmel_pwm.c, and it should eventually get converted over.
Arnd
cover SPEAr320: Add pwm support
Quoted 31 lines · Arnd Bergmann
No objection to your patch, but I think we need to have a long-term plan for pwm:
arnd at wuerfel:~/linux-2.6$ git ls-files | grep
pwm.carch/arm/mach-exynos4/include/mach/pwm-clock.harch/arm/mach-mxs/devices/platform-mxs-pwm.carch/arm/mach-s3c64xx/include/mach/pwm-clock.harch/arm/mach-s5p64x0/include/mach/pwm-clock.harch/arm/mach-s5pc100/include/mach/pwm-clock.harch/arm/mach-s5pv210/include/mach/pwm-clock.harch/arm/mach-vt8500/pwm.carch/arm/plat-mxc/devices/platform-mxc_pwm.carch/arm/plat-mxc/pwm.carch/arm/plat-pxa/pwm.carch/arm/plat-s3c24xx/include/mach/pwm-clock.harch/arm/plat-samsung/dev-pwm.carch/arm/plat-samsung/pwm-clock.carch/arm/plat-samsung/pwm.carch/mips/jz4740/pwm.carch/unicore32/kernel/pwm.cdrivers/leds/leds-atmel-pwm.cdrivers/leds/leds-pwm.cdrivers/mfd/twl6030-pwm.cdrivers/misc/ab8500-pwm.cdrivers/misc/atmel_pwm.cdrivers/misc/ep93xx_pwm.cMy rough feeling is that what this should look like is a new subsystem that exports a set of operations and has specific drivers, like:
Quoted 7 lines
drivers/pwm/Kconfigdrivers/pwm/pwm_core.cdrivers/pwm/pwm_pxa.cdrivers/pwm/pwm_unicore.cdrivers/pwm/pwm_st.cdrivers/pwm/pwm_...
Sascha sent a patchset for something similar earlier. But don't know what happened to it.
Signature · 1 line
viresh
cover SPEAr320: Add pwm support
Quoted 40 lines · viresh kumar
Quoted 31 lines · Arnd Bergmann
No objection to your patch, but I think we need to have a long-term plan for pwm:
arnd at wuerfel:~/linux-2.6$ git ls-files | grep
pwm.carch/arm/mach-exynos4/include/mach/pwm-clock.harch/arm/mach-mxs/devices/platform-mxs-pwm.carch/arm/mach-s3c64xx/include/mach/pwm-clock.harch/arm/mach-s5p64x0/include/mach/pwm-clock.harch/arm/mach-s5pc100/include/mach/pwm-clock.harch/arm/mach-s5pv210/include/mach/pwm-clock.harch/arm/mach-vt8500/pwm.carch/arm/plat-mxc/devices/platform-mxc_pwm.carch/arm/plat-mxc/pwm.carch/arm/plat-pxa/pwm.carch/arm/plat-s3c24xx/include/mach/pwm-clock.harch/arm/plat-samsung/dev-pwm.carch/arm/plat-samsung/pwm-clock.carch/arm/plat-samsung/pwm.carch/mips/jz4740/pwm.carch/unicore32/kernel/pwm.cdrivers/leds/leds-atmel-pwm.cdrivers/leds/leds-pwm.cdrivers/mfd/twl6030-pwm.cdrivers/misc/ab8500-pwm.cdrivers/misc/atmel_pwm.cdrivers/misc/ep93xx_pwm.cMy rough feeling is that what this should look like is a new subsystem that exports a set of operations and has specific drivers, like:
Quoted 7 lines
drivers/pwm/Kconfigdrivers/pwm/pwm_core.cdrivers/pwm/pwm_pxa.cdrivers/pwm/pwm_unicore.cdrivers/pwm/pwm_st.cdrivers/pwm/pwm_...
Quoted 2 lines
Sascha sent a patchset for something similar earlier. But don't know what happened to it.
Nothing yet, unfortunately. It was a straight forward implementation which basically implements the existing pwm functions and adds register/unregister functions.
Bill Gatliff posts a pwm framework since 2008. I wasn't aware of his patches by the time I wrote my pwm layer. Bills patches target more the motor controller use case and are (in my opinion) too complicated. I can't agree on his approach, but didn't want to go with competing patches either.
As Bills patches still didn't make it into the kernel Maybe it's time to respin my version.
For reference, find my patches here:
https://lkml.org/lkml/2011/1/28/92
Sascha
Signature · 4 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 |
Arnd Bergmann
maintainercover SPEAr320: Add pwm support
Quoted 12 lines · Sascha Hauer
Quoted 2 lines
Sascha sent a patchset for something similar earlier. But don't know what happened to it.
Nothing yet, unfortunately. It was a straight forward implementation which basically implements the existing pwm functions and adds register/unregister functions.
Bill Gatliff posts a pwm framework since 2008. I wasn't aware of his patches by the time I wrote my pwm layer. Bills patches target more the motor controller use case and are (in my opinion) too complicated. I can't agree on his approach, but didn't want to go with competing patches either.
Quoted 2 lines
As Bills patches still didn't make it into the kernel Maybe it's time to respin my version.
Yes, I think that would be good, then we can add the new SPEAr320 pwm driver to the new subsystem as a first example, and move the other drivers over after that.
Arnd
cover SPEAr320: Add pwm support
Quoted 13 lines · Arnd Bergmann
Quoted 12 lines · Sascha Hauer
Quoted 2 lines
Sascha sent a patchset for something similar earlier. But don't know what happened to it.
Nothing yet, unfortunately. It was a straight forward implementation which basically implements the existing pwm functions and adds register/unregister functions.
Bill Gatliff posts a pwm framework since 2008. I wasn't aware of his patches by the time I wrote my pwm layer. Bills patches target more the motor controller use case and are (in my opinion) too complicated. I can't agree on his approach, but didn't want to go with competing patches either.
Quoted 7 lines
Quoted 2 lines
As Bills patches still didn't make it into the kernel Maybe it's time to respin my version.
Yes, I think that would be good, then we can add the new SPEAr320 pwm driver to the new subsystem as a first example, and move the other drivers over after that.
Obviously this can be done, but as it has already taken too long for that framework to get added in mainline, and still we don't know how much more time it will take. I would suggest to push this patchset now. And i will update this accordingly once that framework comes up.
Signature · 1 line
viresh
Arnd Bergmann
maintainercover SPEAr320: Add pwm support
Quoted 8 lines · viresh kumar
Quoted 7 lines
Quoted 2 lines
As Bills patches still didn't make it into the kernel Maybe it's time to respin my version.
Yes, I think that would be good, then we can add the new SPEAr320 pwm driver to the new subsystem as a first example, and move the other drivers over after that.
Quoted 4 lines
Obviously this can be done, but as it has already taken too long for that framework to get added in mainline, and still we don't know how much more time it will take. I would suggest to push this patchset now. And i will update this accordingly once that framework comes up.
Ok, makes sense.
How about starting a drivers/pwm directory though? I think we have broad support for the idea of moving drivers into their subsystems, so even if you don't change the code, I think it would be a better place than drivers/misc.
Arnd
cover SPEAr320: Add pwm support
Quoted 10 lines · Arnd Bergmann
Quoted 4 lines
Quoted 4 lines
Obviously this can be done, but as it has already taken too long for that framework to get added in mainline, and still we don't know how much more time it will take. I would suggest to push this patchset now. And i will update this accordingly once that framework comes up.
Ok, makes sense.
How about starting a
drivers/pwmdirectory though? I think we have broad support for the idea of moving drivers into their subsystems, so even if you don't change the code, I think it would be a better place thandrivers/misc.
Ya, i can easily do it. I didn't do it earlier, because i thought people might ask me to provide framework with it too. New folder with only my driver as part of it might not be accepted. If nobody have any issues with it i can send patch with required changes.
One more thing: Who will push drivers/pwm now?
@Andrew: Will that be you??
Signature · 1 line
viresh
Arnd Bergmann
maintainercover SPEAr320: Add pwm support
Quoted 12 lines · viresh kumar
Quoted 10 lines · Arnd Bergmann
Quoted 4 lines
Quoted 4 lines
Obviously this can be done, but as it has already taken too long for that framework to get added in mainline, and still we don't know how much more time it will take. I would suggest to push this patchset now. And i will update this accordingly once that framework comes up.
Ok, makes sense.
How about starting a
drivers/pwmdirectory though? I think we have broad support for the idea of moving drivers into their subsystems, so even if you don't change the code, I think it would be a better place thandrivers/misc.
Quoted 7 lines
Ya, i can easily do it. I didn't do it earlier, because i thought people might ask me to provide framework with it too. New folder with only my driver as part of it might not be accepted. If nobody have any issues with it i can send patch with required changes.
One more thing: Who will push
drivers/pwmnow?
@Andrew: Will that be you??
I can start a branch once we have a new tree for the subarchitectures, then I'll use the same branch to collect patches that move the other pwm drivers from arch/arm and from drivers/misc, as well as the new framework from Sascha.
Note that this doesn't make me maintainer of pwm, that position is still open ;-)
Arnd
A message that is not in the archive (sent off-list or not yet received): [email protected]
Arnd Bergmann
maintainerQuoted 8 lines · Kurt Van Dijck
I was not aware of such. Me too did a generic PWM implementation (not published yet) but with 2 differences (apart from code quality I guess):
* do pwm input too (pwm measurement) since we have some kind of dedicated PWM in a remote CPU over i2c, that can measure them too.
* /dev interfaceIs this something usefull to try adding?
I'd leave that for later. In particular, user interface design is hard, so let's consolidate the drivers first and then look at possible extensions.
Arnd