Skip to contentSkip to conversation

mfd: add LP3943 MFD driver

PATCH Superseded Milo Kim 1 participant 1 message Sep 25, 2013

Subsystems (2)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Milo Kim

author
#0 lore raw

PATCH v4 1/4 mfd: add LP3943 MFD driver

LP3943 has 16 output pins which can be used as GPIO expander and PWM generator.

* Regmap I2C interface for R/W LP3943 registers

* Atomic operations for output pin assignment
The driver should check whether requested pin is available or not. If the pin is already used, pin request returns as a failure. A driver data, 'pin_used' is checked when gpio_request() and pwm_request() are called. If the pin is available, then pin_used is set. And it is cleared when gpio_free() and pwm_free().

* Device tree support
Compatible strings for GPIO and PWM driver.
LP3943 platform data is PWM related, so parsing the device tree is implemented in the PWM driver.

---
* Patch v4
Driver description was moved from the documentation in patch v3.

* Patch v3
Now, output pin number is exactly matched with enum value of ' lp3943_pwm_output'.
Use dev_get_platdata() helper function in probe(). Use module_i2c_driver() for initcall.

* Patch v2
Handle atomic operations for output pin assignment.

 drivers/mfd/Kconfig        |   11 ++++
 drivers/mfd/Makefile       |    1 +
 drivers/mfd/lp3943.c       |  148 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/lp3943.h |  114 ++++++++++++++++++++++++++++++++++
 4 files changed, 274 insertions(+)
 create mode 100644 drivers/mfd/lp3943.c
 create mode 100644 include/linux/mfd/lp3943.h
drivers/mfd/Kconfig +11 -0
index e0e46f5..7058358 100644
@@ -715,6 +715,17 @@ config MFD_DM355EVM_MSP
 	  boards.  MSP430 firmware manages resets and power sequencing,
 	  inputs from buttons and the IR remote, LEDs, an RTC, and more.
 
+config MFD_LP3943
+	tristate "TI/National Semiconductor LP3943 MFD Driver"
+	depends on I2C
+	select MFD_CORE
+	select REGMAP_I2C
+	help
+	  Support for the TI/National Semiconductor LP3943.
+	  This driver consists of GPIO and PWM drivers.
+	  With these functionalities, it can be used for LED string control or
+	  general usage such like a GPIO controller and a PWM controller.
+
 drivers/mfd/Kconfig        |   11 +++
 drivers/mfd/Makefile       |    1 +
 drivers/mfd/lp3943.c       |  167 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/lp3943.h |  114 ++++++++++++++++++++++++++++++
 4 files changed, 293 insertions(+)
 create mode 100644 drivers/mfd/lp3943.c
 create mode 100644 include/linux/mfd/lp3943.h
drivers/mfd/Kconfig +11 -0
index e0e46f5..7058358 100644
@@ -715,6 +715,17 @@ config MFD_DM355EVM_MSP
 	  boards.  MSP430 firmware manages resets and power sequencing,
 	  inputs from buttons and the IR remote, LEDs, an RTC, and more.
 
+config MFD_LP3943
+	tristate "TI/National Semiconductor LP3943 MFD Driver"
+	depends on I2C
+	select MFD_CORE
+	select REGMAP_I2C
+	help
+	  Support for the TI/National Semiconductor LP3943.
+	  This driver consists of GPIO and PWM drivers.
+	  With these functionalities, it can be used for LED string control or
+	  general usage such like a GPIO controller and a PWM controller.
+
 config MFD_LP8788
 	bool "TI LP8788 Power Management Unit Driver"
 	depends on I2C=y && GENERIC_HARDIRQS
drivers/mfd/Makefile +1 -0
index 15b905c..a6d2b22 100644
@@ -102,6 +102,7 @@ obj-$(CONFIG_PMIC_DA9052)	+= da9052-core.o
 obj-$(CONFIG_MFD_DA9052_SPI)	+= da9052-spi.o
 obj-$(CONFIG_MFD_DA9052_I2C)	+= da9052-i2c.o
 
+obj-$(CONFIG_MFD_LP3943)	+= lp3943.o
 obj-$(CONFIG_MFD_LP8788)	+= lp8788.o lp8788-irq.o
 
 da9055-objs			:= da9055-core.o da9055-i2c.o
drivers/mfd/lp3943.c new file +167 -0

167 lines not on this page · raw message

include/linux/mfd/lp3943.h new file +114 -0

114 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