mfd: cpcap: Add minimal support
Subsystems (2)
PATCH v2 1/1 mfd: cpcap: Add minimal support
Many Motorola phones like droid 4 are using a custom PMIC called CPCAP or 6556002. We can support it's core features quite easily with regmap_spi and regmap_irq.
The children of cpcap, such as regulators, ADC and USB, can be just regular device drivers and defined in the dts file. They get probed as we call of_platform_populate() at the end of our probe, and then the children can just call dev_get_regmap(dev.parent, NULL) to get the regmap.
---
Changes from v1:
- Addressed comments from Lee Jones except did not start generalizing bulk adding of IRQ chips. That can be done later as needed.
- Dropped the ranges translation based on comments from Lee Jones and Rob Herring. We are using regmap anyways.
- Changed naming to use motorola-cpcap as this is Motorola custom PMIC manufactured by STE and TI.
- Moved the revision and vendor check to motorola-cpcap.h. This keeps the undocumented register bits limited to these functions and the child device drivers can use them for the related workarounds.
- Checked that motorola-cpcap.h is really aligned despite how the patch looks for some of the lines.
--- .../devicetree/bindings/mfd/motorola-cpcap.txt | 31 +++ drivers/mfd/Kconfig | 11 + drivers/mfd/Makefile | 1 + drivers/mfd/motorola-cpcap.c | 244 +++++++++++++++++ include/linux/mfd/motorola-cpcap.h | 289 +++++++++++++++++++++ 5 files changed, 576 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/motorola-cpcap.txt create mode 100644 drivers/mfd/motorola-cpcap.c create mode 100644 include/linux/mfd/motorola-cpcap.h
Documentation/devicetree/bindings/mfd/motorola-cpcap.txt new file +31 -0
@@ -0,0 +1,31 @@ +Motorola CPCAP PMIC device tree binding + +Required properties: +- compatible : One or both of "motorola,cpcap" or "ste,6556002" +- reg : SPI chip select +- interrupt-parent : The parent interrupt controller +- interrupts : The interrupt line the device is connected to +- interrupt-controller : Marks the device node as an interrupt controller +- #interrupt-cells : The number of cells to describe an IRQ, should be 2 +- #address-cells : Child device offset number of cells, typically 1 +- #size-cells : Child device size number of cells, typically 1 +- spi-max-frequency : Typically set to 3000000 +- spi-cs_high : SPI chip select direction + +Example: + +&mcspi1 { + cpcap: pmic@0 { + compatible = "motorola,cpcap", "ste,6556002"; + reg = <0>; /* cs0 */ + interrupt-parent = <&gpio1>; + interrupts = <7 IRQ_TYPE_EDGE_RISING>; + interrupt-controller; + #interrupt-cells = <2>; + #address-cells = <1>; + #size-cells = <1>; + spi-max-frequency = <3000000>; + spi-cs-high; + }; +}; +
drivers/mfd/Kconfig +11 -0
@@ -713,6 +713,17 @@ config EZX_PCAP This enables the PCAP ASIC present on EZX Phones. This is needed for MMC, TouchScreen, Sound, USB, etc.. +config MFD_CPCAP + tristate "Support for Motorola CPCAP" + depends on SPI + depends on OF || COMPILE_TEST + select REGMAP_SPI + select REGMAP_IRQ + help + Say yes here if you want to include driver for CPCAP. + It is used on many Motorola phones and tablets as a PMIC. + At least Motorola Droid 4 is known to use CPCAP. + config MFD_VIPERBOARD tristate "Nano River Technologies Viperboard" select MFD_CORE
drivers/mfd/Makefile +1 -0
@@ -97,6 +97,7 @@ obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o obj-$(CONFIG_MFD_CORE) += mfd-core.o obj-$(CONFIG_EZX_PCAP) += ezx-pcap.o +obj-$(CONFIG_MFD_CPCAP) += motorola-cpcap.o obj-$(CONFIG_MCP) += mcp-core.o obj-$(CONFIG_MCP_SA11X0) += mcp-sa11x0.o
drivers/mfd/motorola-cpcap.c new file +244 -0
244 lines not on this page · raw message
include/linux/mfd/motorola-cpcap.h new file +289 -0
289 lines not on this page · raw message
Signature · 1 line
2.10.2
Quoted 23 lines · Tony Lindgren
Documentation/devicetree/bindings/mfd/motorola-cpcap.txt new file +20
-0@@ -0,0 +1,31 @@ +Motorola CPCAP PMIC device tree binding + +Required properties: +- compatible : One or both of "motorola,cpcap" or "ste,6556002" +- reg : SPI chip select +- interrupt-parent : The parent interrupt controller +- interrupts : The interrupt line the device is connected to +- interrupt-controller : Marks the device node as an interrupt controller +- #interrupt-cells : The number of cells to describe an IRQ, should be 2 +- #address-cells : Child device offset number of cells, typically 1 +- #size-cells : Child device size number of cells, typically 1 +- spi-max-frequency : Typically set to 3000000 +- spi-cs_high : SPI chip select direction + +Example: + +&mcspi1 { + cpcap: pmic@0 { + compatible = "motorola,cpcap", "ste,6556002"; + reg = <0>; /* cs0 */
Documentation/devicetree/bindings/mfd/motorola-cpcap.txt line 30
Quoted 10 lines
Documentation/devicetree/bindings/mfd/motorola-cpcap.txt new file +10
-0+ interrupt-parent = <&gpio1>; + interrupts = <7 IRQ_TYPE_EDGE_RISING>; + interrupt-controller; + #interrupt-cells = <2>; + #address-cells = <1>; + #size-cells = <1>; + spi-max-frequency = <3000000>; + spi-cs-high; + }; +};
The #address-cells should be 0 instead of 1 above.
Tony
--
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
Quoted 56 lines · Tony Lindgren
Many Motorola phones like droid 4 are using a custom PMIC called CPCAP or 6556002. We can support it's core features quite easily with
regmap_spiandregmap_irq.The children of cpcap, such as regulators, ADC and USB, can be just regular device drivers and defined in the dts file. They get probed as we call
of_platform_populate()at the end of our probe, and then the children can just calldev_get_regmap(dev.parent, NULL)to get the regmap.Cc Marcel Partap <[email protected]>Cc Mark Rutland <[email protected]>Cc Michael Scott <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Tony Lindgren <[email protected]>---
Changes from v1:
- Addressed comments from Lee Jones except did not start generalizing bulk adding of IRQ chips. That can be done later as needed.
- Dropped the ranges translation based on comments from Lee Jones and Rob Herring. We are using regmap anyways.
- Changed naming to use motorola-cpcap as this is Motorola custom PMIC manufactured by STE and TI.
- Moved the revision and vendor check to
motorola-cpcap.h. This keeps the undocumented register bits limited to these functions and the child device drivers can use them for the related workarounds.- Checked that
motorola-cpcap.his really aligned despite how the patch looks for some of the lines.--- .../devicetree/bindings/mfd/motorola-cpcap.txt | 31 +++ drivers/mfd/Kconfig | 11 + drivers/mfd/Makefile | 1 + drivers/mfd/motorola-cpcap.c | 244 +++++++++++++++++ include/linux/mfd/motorola-cpcap.h | 289 +++++++++++++++++++++ 5 files changed, 576 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/motorola-cpcap.txt create mode 100644 drivers/mfd/motorola-cpcap.c create mode 100644 include/linux/mfd/motorola-cpcap.hDocumentation/devicetree/bindings/mfd/motorola-cpcap.txt new file +3
-0@@ -0,0 +1,31 @@ +Motorola CPCAP PMIC device tree binding + +Required properties:
Documentation/devicetree/bindings/mfd/motorola-cpcap.txt line 13
Quoted 10 lines
Documentation/devicetree/bindings/mfd/motorola-cpcap.txt new file +10
-0+- compatible : One or both of "motorola,cpcap" or "ste,6556002" +- reg : SPI chip select +- interrupt-parent : The parent interrupt controller +- interrupts : The interrupt line the device is connected to +- interrupt-controller : Marks the device node as an interrupt controller +- #interrupt-cells : The number of cells to describe an IRQ, should be 2 +- #address-cells : Child device offset number of cells, typically 1 +- #size-cells : Child device size number of cells, typically 1 +- spi-max-frequency : Typically set to 3000000 +- spi-cs_high : SPI chip select direction
Should be spi-cs-high.
With that:
--
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