Skip to contentSkip to conversation

pwm: add LP3943 PWM driver

PATCH Superseded Milo Kim 2 participants 2 messages Sep 25, 2013 – Dec 4, 2013 PWM

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Milo Kim

author
#0 lore raw

PATCH v4 3/4 pwm: add LP3943 PWM driver

This is the other of the LP3943 MFD driver. LP3943 can be used as a PWM generator, up to 2 channels.

* Two PWM generators supported

* Supported PWM operations
request, free, config, enable and disable

* Pin assignment
A driver data, 'pin_used' is checked when a PWM is requested. If the output pin is already assigned, then returns as failure. If the pin is available, 'pin_used' is set.
When the PWM is not used anymore, then it is cleared. It is defined as unsigned long type for atomic bit operation APIs, but only LSB 16bits are used because LP3943 has 16 outputs.

Cc Thierry Reding <[email protected]>

---
* Patch v4
No update, same as v3.

* Patch v3
Manual polarity not supported any more.
Add encapsulation functions for accessing internal data structure. Use pwm_set_chip_data() and pwm_get_chip_data().
And other code fixes based on Thierry's feedback.

 drivers/pwm/Kconfig      |   10 ++
 drivers/pwm/Makefile     |    1 +
 drivers/pwm/pwm-lp3943.c |  314 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 325 insertions(+)
 create mode 100644 drivers/pwm/pwm-lp3943.c
drivers/pwm/Kconfig +10 -0
index 75840b5..9cf38bc 100644
@@ -81,6 +81,16 @@ config PWM_JZ4740
 	  To compile this driver as a module, choose M here: the module
 	  will be called pwm-jz4740.
 
+config PWM_LP3943
+	tristate "TI/National Semiconductor LP3943 PWM support"
+	depends on MFD_LP3943
+	help
+	  Generic PWM framework driver for LP3943 which supports two PWM
+	  channels.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called pwm-lp3943.
+
 config PWM_LPC32XX
 	tristate "LPC32XX PWM support"
 	depends on ARCH_LPC32XX
drivers/pwm/Makefile +1 -0
index 77a8c18..db8e349 100644
@@ -5,6 +5,7 @@ obj-$(CONFIG_PWM_ATMEL_TCB)	+= pwm-atmel-tcb.o
 obj-$(CONFIG_PWM_BFIN)		+= pwm-bfin.o
 obj-$(CONFIG_PWM_IMX)		+= pwm-imx.o
 obj-$(CONFIG_PWM_JZ4740)	+= pwm-jz4740.o
+obj-$(CONFIG_PWM_LP3943)	+= pwm-lp3943.o
 obj-$(CONFIG_PWM_LPC32XX)	+= pwm-lpc32xx.o
 obj-$(CONFIG_PWM_MXS)		+= pwm-mxs.o
 obj-$(CONFIG_PWM_PCA9685)	+= pwm-pca9685.o
drivers/pwm/pwm-lp3943.c new file +314 -0

314 lines not on this page · raw message

Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Acked-by on v4 3/4
#1 lore raw
Quoted 28 lines · Milo Kim

This is the other of the LP3943 MFD driver. LP3943 can be used as a PWM generator, up to 2 channels.

* Two PWM generators supported

* Supported PWM operations
request, free, config, enable and disable

* Pin assignment
A driver data, 'pin_used' is checked when a PWM is requested. If the output pin is already assigned, then returns as failure. If the pin is available, 'pin_used' is set.
When the PWM is not used anymore, then it is cleared. It is defined as unsigned long type for atomic bit operation APIs, but only LSB 16bits are used because LP3943 has 16 outputs.

Cc Thierry Reding <[email protected]>

---
* Patch v4
No update, same as v3.

* Patch v3
Manual polarity not supported any more.
Add encapsulation functions for accessing internal data structure. Use pwm_set_chip_data() and pwm_get_chip_data().
And other code fixes based on Thierry's feedback.

Quoted 5 lines
 drivers/pwm/Kconfig      |   10 ++
 drivers/pwm/Makefile     |    1 +
 drivers/pwm/pwm-lp3943.c |  314 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 325 insertions(+)
 create mode 100644 drivers/pwm/pwm-lp3943.c