Skip to contentSkip to conversation

This adds a generic PWM framework driver for the PWM controller

PATCH New Jon Smirl 3 participants 8 messages Aug 18, 2014 – Sep 14, 2014

Subsystems (2)
lore
Share & tools
lore

Jon Smirl

author
#0 lore raw

PATCH 1/1 This adds a generic PWM framework driver for the PWM controller

found on Allwinner SoCs.x

---
 drivers/pwm/Kconfig     |   11 +
 drivers/pwm/Makefile    |    1 
 drivers/pwm/pwm-sunxi.c |  517 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 529 insertions(+)
 create mode 100644 drivers/pwm/pwm-sunxi.c
drivers/pwm/Kconfig +11 -0
index 331dfca4..01f9fb2 100644
@@ -226,6 +226,17 @@ config PWM_SPEAR
 	  To compile this driver as a module, choose M here: the module
 	  will be called pwm-spear.
 
+config PWM_SUNXI
+	tristate "Sunxi PWM Driver (pwm-sunxi)" 
+	depends on ARCH_SUNXI
+	help 
+	  Say Y here if you want Hardware PWM Support 
+ 
+	  To compile this driver as a module, choose M here: the 
+	  module will be called pwm-sunxi.  This driver supports 
+	  a sysfs interface at /sys/class/pwm-sunxi as well as the 
+	  kernel pwm interface. 
+ 
 config PWM_TEGRA
 	tristate "NVIDIA Tegra PWM support"
 	depends on ARCH_TEGRA
drivers/pwm/Makefile +1 -0
index 5c86a19..c32f827 100644
@@ -20,6 +20,7 @@ obj-$(CONFIG_PWM_PXA)		+= pwm-pxa.o
 obj-$(CONFIG_PWM_RENESAS_TPU)	+= pwm-renesas-tpu.o
 obj-$(CONFIG_PWM_SAMSUNG)	+= pwm-samsung.o
 obj-$(CONFIG_PWM_SPEAR)		+= pwm-spear.o
+obj-$(CONFIG_PWM_SUNXI)		+= pwm-sunxi.o
 obj-$(CONFIG_PWM_TEGRA)		+= pwm-tegra.o
 obj-$(CONFIG_PWM_TIECAP)	+= pwm-tiecap.o
 obj-$(CONFIG_PWM_TIEHRPWM)	+= pwm-tiehrpwm.o
drivers/pwm/pwm-sunxi.c new file +517 -0

517 lines not on this page · raw message

#1 lore raw

PATCH 1/1 This adds a generic PWM framework driver for the PWM controller

Hi,

Quoted 3 lines · Jon Smirl

found on Allwinner SoCs.x

Is there any notable difference with Alexandre's driver?
https://lkml.org/lkml/2014/5/19/568

If so, why didn't you posted incremental patches on top of his driver?

Thanks,
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140818/2f184a5a/attachment.sig>
#2 lore raw

PATCH 1/1 This adds a generic PWM framework driver for the PWM controller

Quoted 11 lines · Maxime Ripard

Hi,

Quoted 3 lines · Jon Smirl

found on Allwinner SoCs.x

Is there any notable difference with Alexandre's driver?
https://lkml.org/lkml/2014/5/19/568

If so, why didn't you posted incremental patches on top of his driver?

Better A10 support. And I wrote this one without know about his.

Quoted 8 lines

Thanks,
Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Signature · 2 lines
Jon Smirl
jonsmirl at gmail.com
#3 lore raw

PATCH 1/1 This adds a generic PWM framework driver for the PWM controller

Quoted 7 lines · jonsmirl at gmail.com
Quoted 5 lines · Maxime Ripard

Hi,

Quoted 2 lines · Jon Smirl

found on Allwinner SoCs.x

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Is there any notable difference with Alexandre's driver?
https://lkml.org/lkml/2014/5/19/568

If so, why didn't you posted incremental patches on top of his driver?

Better A10 support.

Better how?

Quoted 1 line

And I wrote this one without know about his.

So you're just require us to trash an already extensively reviewed driver and start from scratch again?

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140818/9e6f1894/attachment-0001.sig>
#4 lore raw

PATCH 1/1 This adds a generic PWM framework driver for the PWM controller

Quoted 15 lines · Maxime Ripard
Quoted 14 lines · jonsmirl at gmail.com
Quoted 11 lines · Maxime Ripard

Hi,

Quoted 3 lines · Jon Smirl

found on Allwinner SoCs.x

Is there any notable difference with Alexandre's driver?
https://lkml.org/lkml/2014/5/19/568

If so, why didn't you posted incremental patches on top of his driver?

Quoted 8 lines
Quoted 1 line

Better A10 support.

Better how?

Quoted 1 line

And I wrote this one without know about his.

So you're just require us to trash an already extensively reviewed driver and start from scratch again?

Forget mine then.

Problems in the other one....
1) The math is not right in either patch. Selsinork has been checking mine with a scope and just found another math error in mine. The internal math needs to be done in picoseconds or round off errors mess up the high frequency outputs (24Mhz, 12Mhz, 8Mhz, ...).
3) By-pass mode on the A20 is not implemented.
2) A10 is not correctly handled. Specifically the prescaler is different on the A10 vs A20.

Quoted 5 lines

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Signature · 2 lines
Jon Smirl
jonsmirl at gmail.com
#5 lore raw

PATCH 1/1 This adds a generic PWM framework driver for the PWM controller

Quoted 26 lines · jonsmirl at gmail.com
Quoted 15 lines · Maxime Ripard
Quoted 14 lines · jonsmirl at gmail.com
Quoted 11 lines · Maxime Ripard

Hi,

Quoted 3 lines · Jon Smirl

found on Allwinner SoCs.x

Is there any notable difference with Alexandre's driver?
https://lkml.org/lkml/2014/5/19/568

If so, why didn't you posted incremental patches on top of his driver?

Quoted 8 lines
Quoted 1 line

Better A10 support.

Better how?

Quoted 1 line

And I wrote this one without know about his.

So you're just require us to trash an already extensively reviewed driver and start from scratch again?

Quoted 7 lines

Forget mine then.

Problems in the other one....
1) The math is not right in either patch. Selsinork has been checking mine with a scope and just found another math error in mine. The internal math needs to be done in picoseconds or round off errors mess up the high frequency outputs (24Mhz, 12Mhz, 8Mhz, ...).

Correct output table....
Neither driver has this right.

24Mhz 41.6ns period 1 - 62
12Mhz 83.3ns period 63 - 104
8Mhz 125ns period 105 - 145
6Mhz 167ns period 146 - 187
4.8Mhz 208ns period 188 - 229
4Mhz 250ns period 230 - 270
3.4Mhz 292ns period 271 - 312
3Mhz 333ns period 313 - 345

Quoted 20 lines

3) By-pass mode on the A20 is not implemented.
2) A10 is not correctly handled. Specifically the prescaler is different on the A10 vs A20.

Quoted 5 lines

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

--
Jon Smirl
jonsmirl at gmail.com

Signature · 2 lines
Jon Smirl
jonsmirl at gmail.com
#6 lore raw

PATCH 1/1 This adds a generic PWM framework driver for the PWM controller

In reply to jonsmirl at gmail.com
Quoted 26 lines · jonsmirl at gmail.com
Quoted 15 lines · Maxime Ripard
Quoted 14 lines · jonsmirl at gmail.com
Quoted 11 lines · Maxime Ripard

Hi,

Quoted 3 lines · Jon Smirl

found on Allwinner SoCs.x

Is there any notable difference with Alexandre's driver?
https://lkml.org/lkml/2014/5/19/568

If so, why didn't you posted incremental patches on top of his driver?

Quoted 8 lines
Quoted 1 line

Better A10 support.

Better how?

Quoted 1 line

And I wrote this one without know about his.

So you're just require us to trash an already extensively reviewed driver and start from scratch again?

Quoted 7 lines

Forget mine then.

Problems in the other one....
1) The math is not right in either patch. Selsinork has been checking mine with a scope and just found another math error in mine. The internal math needs to be done in picoseconds or round off errors mess up the high frequency outputs (24Mhz, 12Mhz, 8Mhz, ...).

Feel free to report this to Alexandre so he fixes it then.

Quoted 3 lines

3) By-pass mode on the A20 is not implemented.
2) A10 is not correctly handled. Specifically the prescaler is different on the A10 vs A20.

And these can be sent as patches on top of Alexandre's driver, and they would be very much welcome.

Remember to run scripts/checkpatch.pl before sending them though, and by a quick look at your driver, you should also read Documentation/CodingStyle.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140823/b7c48a9f/attachment.sig>
#7 lore raw

PATCH 1/1 This adds a generic PWM framework driver for the PWM controller

In reply to jonsmirl at gmail.com
Quoted 26 lines · jonsmirl at gmail.com
Quoted 15 lines · Maxime Ripard
Quoted 14 lines · jonsmirl at gmail.com
Quoted 11 lines · Maxime Ripard

Hi,

Quoted 3 lines · Jon Smirl

found on Allwinner SoCs.x

Is there any notable difference with Alexandre's driver?
https://lkml.org/lkml/2014/5/19/568

If so, why didn't you posted incremental patches on top of his driver?

Quoted 8 lines
Quoted 1 line

Better A10 support.

Better how?

Quoted 1 line

And I wrote this one without know about his.

So you're just require us to trash an already extensively reviewed driver and start from scratch again?

Quoted 7 lines

Forget mine then.

Problems in the other one....
1) The math is not right in either patch. Selsinork has been checking mine with a scope and just found another math error in mine. The internal math needs to be done in picoseconds or round off errors mess up the high frequency outputs (24Mhz, 12Mhz, 8Mhz, ...).

I don't have an oscilloscope so I can't check the exact output but I4ll try to think about it.

Quoted 1 line

3) By-pass mode on the A20 is not implemented.

I'm not sure there is a real use case here, using the bypass only allows for one duty cycle of 50% with a period of 41.6ns so I think it is preferable to get an error instead of a bogus output.

Quoted 3 lines

2) A10 is not correctly handled. Specifically the prescaler is different on the A10 vs A20.

I'll change that.

Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com