All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/3] Add support for the TI TPS65086 PMIC
@ 2016-01-25 15:50 ` Andrew F. Davis
  0 siblings, 0 replies; 22+ messages in thread
From: Andrew F. Davis @ 2016-01-25 15:50 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown
  Cc: devicetree, linux-gpio, linux-kernel, Andrew F. Davis

This series adds support for the TPS65086 PMIC. It is a MFD with an I2C
interface, several regulators and load switches, and a GPO controller.

v1 can be found here: [1] v2: [2] v3: [3] v4: [4] v5: [5]

Changes from v5:
 - Now complies with gpiolib changes
 - Rebase on v4.5-rc1

Changes from v4:
 - Typo fixes in bindings
 - Regulator driver is now just an update stub
 - Use .parent in GPIO driver

Changes from v3:
 - Removed compatible strings from DT sub-nodes
 - Rearranged DT bindings
 - Small fixes

Changes from v2:
 - Use DT match callback in regulator
 - Typo fixes

Changes from v1:
 - Split up DT Docs into separate patches
 - Use mfd core to instantiate sub-devices
 - Several small fixes as discussed in v1 thread

[1] http://www.spinics.net/lists/devicetree/msg98403.html
[2] http://www.spinics.net/lists/kernel/msg2111345.html
[3] https://lkml.org/lkml/2015/11/4/393
[4] http://www.spinics.net/lists/devicetree/msg103186.html
[5] https://lkml.org/lkml/2015/12/1/576

Andrew F. Davis (3):
  Documentation: tps65086: Add DT bindings for the TPS65086 PMIC
  mfd: tps65086: Add driver for the TPS65086 PMIC
  gpio: tps65086: Add GPO driver for the TPS65086 PMIC

 Documentation/devicetree/bindings/mfd/tps65086.txt |  55 ++++++++
 drivers/gpio/Kconfig                               |   6 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-tps65086.c                       | 144 ++++++++++++++++++++
 drivers/mfd/Kconfig                                |  13 ++
 drivers/mfd/Makefile                               |   1 +
 drivers/mfd/tps65086.c                             | 149 +++++++++++++++++++++
 include/linux/mfd/tps65086.h                       | 117 ++++++++++++++++
 8 files changed, 486 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/tps65086.txt
 create mode 100644 drivers/gpio/gpio-tps65086.c
 create mode 100644 drivers/mfd/tps65086.c
 create mode 100644 include/linux/mfd/tps65086.h

-- 
2.7.0

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v6 0/3] Add support for the TI TPS65086 PMIC
@ 2016-01-25 15:50 ` Andrew F. Davis
  0 siblings, 0 replies; 22+ messages in thread
From: Andrew F. Davis @ 2016-01-25 15:50 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown
  Cc: devicetree, linux-gpio, linux-kernel, Andrew F. Davis

This series adds support for the TPS65086 PMIC. It is a MFD with an I2C
interface, several regulators and load switches, and a GPO controller.

v1 can be found here: [1] v2: [2] v3: [3] v4: [4] v5: [5]

Changes from v5:
 - Now complies with gpiolib changes
 - Rebase on v4.5-rc1

Changes from v4:
 - Typo fixes in bindings
 - Regulator driver is now just an update stub
 - Use .parent in GPIO driver

Changes from v3:
 - Removed compatible strings from DT sub-nodes
 - Rearranged DT bindings
 - Small fixes

Changes from v2:
 - Use DT match callback in regulator
 - Typo fixes

Changes from v1:
 - Split up DT Docs into separate patches
 - Use mfd core to instantiate sub-devices
 - Several small fixes as discussed in v1 thread

[1] http://www.spinics.net/lists/devicetree/msg98403.html
[2] http://www.spinics.net/lists/kernel/msg2111345.html
[3] https://lkml.org/lkml/2015/11/4/393
[4] http://www.spinics.net/lists/devicetree/msg103186.html
[5] https://lkml.org/lkml/2015/12/1/576

Andrew F. Davis (3):
  Documentation: tps65086: Add DT bindings for the TPS65086 PMIC
  mfd: tps65086: Add driver for the TPS65086 PMIC
  gpio: tps65086: Add GPO driver for the TPS65086 PMIC

 Documentation/devicetree/bindings/mfd/tps65086.txt |  55 ++++++++
 drivers/gpio/Kconfig                               |   6 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-tps65086.c                       | 144 ++++++++++++++++++++
 drivers/mfd/Kconfig                                |  13 ++
 drivers/mfd/Makefile                               |   1 +
 drivers/mfd/tps65086.c                             | 149 +++++++++++++++++++++
 include/linux/mfd/tps65086.h                       | 117 ++++++++++++++++
 8 files changed, 486 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/tps65086.txt
 create mode 100644 drivers/gpio/gpio-tps65086.c
 create mode 100644 drivers/mfd/tps65086.c
 create mode 100644 include/linux/mfd/tps65086.h

-- 
2.7.0

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v6 1/3] Documentation: tps65086: Add DT bindings for the TPS65086 PMIC
  2016-01-25 15:50 ` Andrew F. Davis
@ 2016-01-25 15:50   ` Andrew F. Davis
  -1 siblings, 0 replies; 22+ messages in thread
From: Andrew F. Davis @ 2016-01-25 15:50 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown
  Cc: devicetree, linux-gpio, linux-kernel, Andrew F. Davis

The TPS65086 PMIC contains several regulators and a GPO controller.
Add bindings for the TPS65086 PMIC.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/mfd/tps65086.txt | 55 ++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/tps65086.txt

diff --git a/Documentation/devicetree/bindings/mfd/tps65086.txt b/Documentation/devicetree/bindings/mfd/tps65086.txt
new file mode 100644
index 0000000..d370561
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/tps65086.txt
@@ -0,0 +1,55 @@
+* TPS65086 Power Management Integrated Circuit (PMIC) bindings
+
+Required properties:
+ - compatible		: Should be "ti,tps65086".
+ - reg			: I2C slave address.
+ - interrupt-parent	: Phandle to 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.
+			    The first cell is the IRQ number.
+			    The second cell is the flags, encoded as trigger
+			    masks from ../interrupt-controller/interrupts.txt.
+ - gpio-controller      : Marks the device node as a GPIO Controller.
+ - #gpio-cells          : Should be two.  The first cell is the pin number and
+                            the second cell is used to specify flags.
+                            See ../gpio/gpio.txt for more information.
+ - regulators:          : List of child nodes that specify the regulator
+                            initialization data. Child nodes must be named
+                            after their hardware counterparts: buck[1-6],
+                            ldoa[1-3], swa1, swb[1-2], and vtt. Each child
+                            node is defined using the standard binding for
+                            regulators and the optional regulator properties
+                            defined below.
+
+Optional regulator properties:
+ - ti,regulator-step-size-25mv	: This is applicable for buck[1,2,6], set this
+				    if the regulator is factory set with a 25mv
+				    step voltage mapping.
+ - ti,regulator-decay		: This is applicable for buck[1-6], set this if
+				    the output needs to decay, default is for
+				    the output to slew down.
+
+Example:
+
+	pmic: tps65086@5e {
+		compatible = "ti,tps65086";
+		reg = <0x5e>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <28 IRQ_TYPE_LEVEL_LOW>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+		gpio-controller;
+		#gpio-cells = <2>;
+
+		regulators {
+			buck1 {
+				regulator-name = "vcc1";
+				regulator-min-microvolt = <1600000>;
+				regulator-max-microvolt = <1600000>;
+				regulator-boot-on;
+				ti,regulator-decay;
+				ti,regulator-step-size-25mv;
+			};
+		};
+	};
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v6 1/3] Documentation: tps65086: Add DT bindings for the TPS65086 PMIC
@ 2016-01-25 15:50   ` Andrew F. Davis
  0 siblings, 0 replies; 22+ messages in thread
From: Andrew F. Davis @ 2016-01-25 15:50 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown
  Cc: devicetree, linux-gpio, linux-kernel, Andrew F. Davis

The TPS65086 PMIC contains several regulators and a GPO controller.
Add bindings for the TPS65086 PMIC.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/mfd/tps65086.txt | 55 ++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/tps65086.txt

diff --git a/Documentation/devicetree/bindings/mfd/tps65086.txt b/Documentation/devicetree/bindings/mfd/tps65086.txt
new file mode 100644
index 0000000..d370561
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/tps65086.txt
@@ -0,0 +1,55 @@
+* TPS65086 Power Management Integrated Circuit (PMIC) bindings
+
+Required properties:
+ - compatible		: Should be "ti,tps65086".
+ - reg			: I2C slave address.
+ - interrupt-parent	: Phandle to 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.
+			    The first cell is the IRQ number.
+			    The second cell is the flags, encoded as trigger
+			    masks from ../interrupt-controller/interrupts.txt.
+ - gpio-controller      : Marks the device node as a GPIO Controller.
+ - #gpio-cells          : Should be two.  The first cell is the pin number and
+                            the second cell is used to specify flags.
+                            See ../gpio/gpio.txt for more information.
+ - regulators:          : List of child nodes that specify the regulator
+                            initialization data. Child nodes must be named
+                            after their hardware counterparts: buck[1-6],
+                            ldoa[1-3], swa1, swb[1-2], and vtt. Each child
+                            node is defined using the standard binding for
+                            regulators and the optional regulator properties
+                            defined below.
+
+Optional regulator properties:
+ - ti,regulator-step-size-25mv	: This is applicable for buck[1,2,6], set this
+				    if the regulator is factory set with a 25mv
+				    step voltage mapping.
+ - ti,regulator-decay		: This is applicable for buck[1-6], set this if
+				    the output needs to decay, default is for
+				    the output to slew down.
+
+Example:
+
+	pmic: tps65086@5e {
+		compatible = "ti,tps65086";
+		reg = <0x5e>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <28 IRQ_TYPE_LEVEL_LOW>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+		gpio-controller;
+		#gpio-cells = <2>;
+
+		regulators {
+			buck1 {
+				regulator-name = "vcc1";
+				regulator-min-microvolt = <1600000>;
+				regulator-max-microvolt = <1600000>;
+				regulator-boot-on;
+				ti,regulator-decay;
+				ti,regulator-step-size-25mv;
+			};
+		};
+	};
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v6 2/3] mfd: tps65086: Add driver for the TPS65086 PMIC
  2016-01-25 15:50 ` Andrew F. Davis
@ 2016-01-25 15:50   ` Andrew F. Davis
  -1 siblings, 0 replies; 22+ messages in thread
From: Andrew F. Davis @ 2016-01-25 15:50 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown
  Cc: devicetree, linux-gpio, linux-kernel, Andrew F. Davis

Add support for the TPS65912 device. It provides communication
through I2C and contains the following components:

 - Regulators
 - Load switches
 - GPO controller

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/Kconfig          |  13 ++++
 drivers/mfd/Makefile         |   1 +
 drivers/mfd/tps65086.c       | 149 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/tps65086.h | 117 +++++++++++++++++++++++++++++++++
 4 files changed, 280 insertions(+)
 create mode 100644 drivers/mfd/tps65086.c
 create mode 100644 include/linux/mfd/tps65086.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 9ca66de..fe6d62b 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1106,6 +1106,19 @@ config TPS6507X
 	  This driver can also be built as a module.  If so, the module
 	  will be called tps6507x.
 
+config MFD_TPS65086
+	tristate "TI TPS65086 Power Management Integrated Chips (PMICs)"
+	select REGMAP
+	select REGMAP_IRQ
+	select REGMAP_I2C
+	depends on I2C
+	help
+	  If you say yes here you get support for the TPS65086 series of
+	  Power Management chips.
+	  This driver provides common support for accessing the device,
+	  additional drivers must be enabled in order to use the
+	  functionality of the device.
+
 config TPS65911_COMPARATOR
 	tristate
 
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 0f230a6..06801aa 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -70,6 +70,7 @@ obj-$(CONFIG_MFD_WM8994)	+= wm8994.o
 obj-$(CONFIG_TPS6105X)		+= tps6105x.o
 obj-$(CONFIG_TPS65010)		+= tps65010.o
 obj-$(CONFIG_TPS6507X)		+= tps6507x.o
+obj-$(CONFIG_MFD_TPS65086)	+= tps65086.o
 obj-$(CONFIG_MFD_TPS65217)	+= tps65217.o
 obj-$(CONFIG_MFD_TPS65218)	+= tps65218.o
 obj-$(CONFIG_MFD_TPS65910)	+= tps65910.o
diff --git a/drivers/mfd/tps65086.c b/drivers/mfd/tps65086.c
new file mode 100644
index 0000000..43119a6
--- /dev/null
+++ b/drivers/mfd/tps65086.c
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ *	Andrew F. Davis <afd@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether expressed or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License version 2 for more details.
+ *
+ * Based on the TPS65912 driver
+ */
+
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/mfd/core.h>
+#include <linux/module.h>
+
+#include <linux/mfd/tps65086.h>
+
+static const struct mfd_cell tps65086_cells[] = {
+	{ .name = "tps65086-regulator", },
+	{ .name = "tps65086-gpio", },
+};
+
+static const struct regmap_range tps65086_yes_ranges[] = {
+	regmap_reg_range(TPS65086_IRQ, TPS65086_IRQ),
+	regmap_reg_range(TPS65086_PMICSTAT, TPS65086_SHUTDNSRC),
+	regmap_reg_range(TPS65086_GPOCTRL, TPS65086_GPOCTRL),
+	regmap_reg_range(TPS65086_PG_STATUS1, TPS65086_OC_STATUS),
+};
+
+static const struct regmap_access_table tps65086_volatile_table = {
+	.yes_ranges = tps65086_yes_ranges,
+	.n_yes_ranges = ARRAY_SIZE(tps65086_yes_ranges),
+};
+
+static const struct regmap_config tps65086_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+	.cache_type = REGCACHE_RBTREE,
+	.volatile_table = &tps65086_volatile_table,
+};
+
+static const struct regmap_irq tps65086_irqs[] = {
+	REGMAP_IRQ_REG(TPS65086_IRQ_DIETEMP, 0, TPS65086_IRQ_DIETEMP_MASK),
+	REGMAP_IRQ_REG(TPS65086_IRQ_SHUTDN, 0, TPS65086_IRQ_SHUTDN_MASK),
+	REGMAP_IRQ_REG(TPS65086_IRQ_FAULT, 0, TPS65086_IRQ_FAULT_MASK),
+};
+
+static struct regmap_irq_chip tps65086_irq_chip = {
+	.name = "tps65086",
+	.status_base = TPS65086_IRQ,
+	.mask_base = TPS65086_IRQ_MASK,
+	.ack_base = TPS65086_IRQ,
+	.init_ack_masked = true,
+	.num_regs = 1,
+	.irqs = tps65086_irqs,
+	.num_irqs = ARRAY_SIZE(tps65086_irqs),
+};
+
+static const struct of_device_id tps65086_of_match_table[] = {
+	{ .compatible = "ti,tps65086", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, tps65086_of_match_table);
+
+static int tps65086_probe(struct i2c_client *client,
+			  const struct i2c_device_id *ids)
+{
+	struct tps65086 *tps;
+	unsigned int version;
+	int ret;
+
+	tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
+	if (!tps)
+		return -ENOMEM;
+
+	i2c_set_clientdata(client, tps);
+	tps->dev = &client->dev;
+	tps->irq = client->irq;
+
+	tps->regmap = devm_regmap_init_i2c(client, &tps65086_regmap_config);
+	if (IS_ERR(tps->regmap)) {
+		dev_err(tps->dev, "Failed to initialize register map\n");
+		return PTR_ERR(tps->regmap);
+	}
+
+	ret = regmap_read(tps->regmap, TPS65086_DEVICEID, &version);
+	if (ret) {
+		dev_err(tps->dev, "Failed to read revision register\n");
+		return ret;
+	}
+
+	dev_info(tps->dev, "Device: TPS65086%01lX, OTP: %c, Rev: %ld\n",
+		 (version & TPS65086_DEVICEID_PART_MASK),
+		 (char)((version & TPS65086_DEVICEID_OTP_MASK) >> 4) + 'A',
+		 (version & TPS65086_DEVICEID_REV_MASK) >> 6);
+
+	ret = regmap_add_irq_chip(tps->regmap, tps->irq, IRQF_ONESHOT, 0,
+				  &tps65086_irq_chip, &tps->irq_data);
+	if (ret) {
+		dev_err(tps->dev, "Failed to register IRQ chip\n");
+		return ret;
+	}
+
+	ret = mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65086_cells,
+			      ARRAY_SIZE(tps65086_cells), NULL, 0,
+			      regmap_irq_get_domain(tps->irq_data));
+	if (ret) {
+		regmap_del_irq_chip(tps->irq, tps->irq_data);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int tps65086_remove(struct i2c_client *client)
+{
+	struct tps65086 *tps = i2c_get_clientdata(client);
+
+	regmap_del_irq_chip(tps->irq, tps->irq_data);
+
+	return 0;
+}
+
+static const struct i2c_device_id tps65086_id_table[] = {
+	{ "tps65086", 0 },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(i2c, tps65086_id_table);
+
+static struct i2c_driver tps65086_driver = {
+	.driver		= {
+		.name	= "tps65086",
+		.of_match_table = tps65086_of_match_table,
+	},
+	.probe		= tps65086_probe,
+	.remove		= tps65086_remove,
+	.id_table       = tps65086_id_table,
+};
+module_i2c_driver(tps65086_driver);
+
+MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
+MODULE_DESCRIPTION("TPS65086 PMIC Driver");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/mfd/tps65086.h b/include/linux/mfd/tps65086.h
new file mode 100644
index 0000000..a228ae4
--- /dev/null
+++ b/include/linux/mfd/tps65086.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ *	Andrew F. Davis <afd@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether expressed or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License version 2 for more details.
+ *
+ * Based on the TPS65912 driver
+ */
+
+#ifndef __LINUX_MFD_TPS65086_H
+#define __LINUX_MFD_TPS65086_H
+
+#include <linux/device.h>
+#include <linux/regmap.h>
+
+/* List of registers for TPS65086 */
+#define TPS65086_DEVICEID		0x01
+#define TPS65086_IRQ			0x02
+#define TPS65086_IRQ_MASK		0x03
+#define TPS65086_PMICSTAT		0x04
+#define TPS65086_SHUTDNSRC		0x05
+#define TPS65086_BUCK1CTRL		0x20
+#define TPS65086_BUCK2CTRL		0x21
+#define TPS65086_BUCK3DECAY		0x22
+#define TPS65086_BUCK3VID		0x23
+#define TPS65086_BUCK3SLPCTRL		0x24
+#define TPS65086_BUCK4CTRL		0x25
+#define TPS65086_BUCK5CTRL		0x26
+#define TPS65086_BUCK6CTRL		0x27
+#define TPS65086_LDOA2CTRL		0x28
+#define TPS65086_LDOA3CTRL		0x29
+#define TPS65086_DISCHCTRL1		0x40
+#define TPS65086_DISCHCTRL2		0x41
+#define TPS65086_DISCHCTRL3		0x42
+#define TPS65086_PG_DELAY1		0x43
+#define TPS65086_FORCESHUTDN		0x91
+#define TPS65086_BUCK1SLPCTRL		0x92
+#define TPS65086_BUCK2SLPCTRL		0x93
+#define TPS65086_BUCK4VID		0x94
+#define TPS65086_BUCK4SLPVID		0x95
+#define TPS65086_BUCK5VID		0x96
+#define TPS65086_BUCK5SLPVID		0x97
+#define TPS65086_BUCK6VID		0x98
+#define TPS65086_BUCK6SLPVID		0x99
+#define TPS65086_LDOA2VID		0x9A
+#define TPS65086_LDOA3VID		0x9B
+#define TPS65086_BUCK123CTRL		0x9C
+#define TPS65086_PG_DELAY2		0x9D
+#define TPS65086_PIN_EN_MASK1		0x9E
+#define TPS65086_PIN_EN_MASK2		0x9F
+#define TPS65086_SWVTT_EN		0x9F
+#define TPS65086_PIN_EN_OVR1		0xA0
+#define TPS65086_PIN_EN_OVR2		0xA1
+#define TPS65086_GPOCTRL		0xA1
+#define TPS65086_PWR_FAULT_MASK1	0xA2
+#define TPS65086_PWR_FAULT_MASK2	0xA3
+#define TPS65086_GPO1PG_CTRL1		0xA4
+#define TPS65086_GPO1PG_CTRL2		0xA5
+#define TPS65086_GPO4PG_CTRL1		0xA6
+#define TPS65086_GPO4PG_CTRL2		0xA7
+#define TPS65086_GPO2PG_CTRL1		0xA8
+#define TPS65086_GPO2PG_CTRL2		0xA9
+#define TPS65086_GPO3PG_CTRL1		0xAA
+#define TPS65086_GPO3PG_CTRL2		0xAB
+#define TPS65086_LDOA1CTRL		0xAE
+#define TPS65086_PG_STATUS1		0xB0
+#define TPS65086_PG_STATUS2		0xB1
+#define TPS65086_PWR_FAULT_STATUS1	0xB2
+#define TPS65086_PWR_FAULT_STATUS2	0xB3
+#define TPS65086_TEMPCRIT		0xB4
+#define TPS65086_TEMPHOT		0xB5
+#define TPS65086_OC_STATUS		0xB6
+
+/* IRQ Register field definitions */
+#define TPS65086_IRQ_DIETEMP_MASK	BIT(0)
+#define TPS65086_IRQ_SHUTDN_MASK	BIT(3)
+#define TPS65086_IRQ_FAULT_MASK		BIT(7)
+
+/* DEVICEID Register field definitions */
+#define TPS65086_DEVICEID_PART_MASK	GENMASK(3, 0)
+#define TPS65086_DEVICEID_OTP_MASK	GENMASK(5, 4)
+#define TPS65086_DEVICEID_REV_MASK	GENMASK(7, 6)
+
+/* VID Masks */
+#define BUCK_VID_MASK			GENMASK(7, 1)
+#define VDOA1_VID_MASK			GENMASK(4, 1)
+#define VDOA23_VID_MASK			GENMASK(3, 0)
+
+/* Define the TPS65086 IRQ numbers */
+enum tps65086_irqs {
+	TPS65086_IRQ_DIETEMP,
+	TPS65086_IRQ_SHUTDN,
+	TPS65086_IRQ_FAULT,
+};
+
+/**
+ * struct tps65086 - state holder for the tps65086 driver
+ *
+ * Device data may be used to access the TPS65086 chip
+ */
+struct tps65086 {
+	struct device *dev;
+	struct regmap *regmap;
+
+	/* IRQ Data */
+	int irq;
+	struct regmap_irq_chip_data *irq_data;
+};
+
+#endif /* __LINUX_MFD_TPS65086_H */
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v6 2/3] mfd: tps65086: Add driver for the TPS65086 PMIC
@ 2016-01-25 15:50   ` Andrew F. Davis
  0 siblings, 0 replies; 22+ messages in thread
From: Andrew F. Davis @ 2016-01-25 15:50 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown
  Cc: devicetree, linux-gpio, linux-kernel, Andrew F. Davis

Add support for the TPS65912 device. It provides communication
through I2C and contains the following components:

 - Regulators
 - Load switches
 - GPO controller

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/Kconfig          |  13 ++++
 drivers/mfd/Makefile         |   1 +
 drivers/mfd/tps65086.c       | 149 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/tps65086.h | 117 +++++++++++++++++++++++++++++++++
 4 files changed, 280 insertions(+)
 create mode 100644 drivers/mfd/tps65086.c
 create mode 100644 include/linux/mfd/tps65086.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 9ca66de..fe6d62b 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1106,6 +1106,19 @@ config TPS6507X
 	  This driver can also be built as a module.  If so, the module
 	  will be called tps6507x.
 
+config MFD_TPS65086
+	tristate "TI TPS65086 Power Management Integrated Chips (PMICs)"
+	select REGMAP
+	select REGMAP_IRQ
+	select REGMAP_I2C
+	depends on I2C
+	help
+	  If you say yes here you get support for the TPS65086 series of
+	  Power Management chips.
+	  This driver provides common support for accessing the device,
+	  additional drivers must be enabled in order to use the
+	  functionality of the device.
+
 config TPS65911_COMPARATOR
 	tristate
 
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 0f230a6..06801aa 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -70,6 +70,7 @@ obj-$(CONFIG_MFD_WM8994)	+= wm8994.o
 obj-$(CONFIG_TPS6105X)		+= tps6105x.o
 obj-$(CONFIG_TPS65010)		+= tps65010.o
 obj-$(CONFIG_TPS6507X)		+= tps6507x.o
+obj-$(CONFIG_MFD_TPS65086)	+= tps65086.o
 obj-$(CONFIG_MFD_TPS65217)	+= tps65217.o
 obj-$(CONFIG_MFD_TPS65218)	+= tps65218.o
 obj-$(CONFIG_MFD_TPS65910)	+= tps65910.o
diff --git a/drivers/mfd/tps65086.c b/drivers/mfd/tps65086.c
new file mode 100644
index 0000000..43119a6
--- /dev/null
+++ b/drivers/mfd/tps65086.c
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ *	Andrew F. Davis <afd@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether expressed or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License version 2 for more details.
+ *
+ * Based on the TPS65912 driver
+ */
+
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/mfd/core.h>
+#include <linux/module.h>
+
+#include <linux/mfd/tps65086.h>
+
+static const struct mfd_cell tps65086_cells[] = {
+	{ .name = "tps65086-regulator", },
+	{ .name = "tps65086-gpio", },
+};
+
+static const struct regmap_range tps65086_yes_ranges[] = {
+	regmap_reg_range(TPS65086_IRQ, TPS65086_IRQ),
+	regmap_reg_range(TPS65086_PMICSTAT, TPS65086_SHUTDNSRC),
+	regmap_reg_range(TPS65086_GPOCTRL, TPS65086_GPOCTRL),
+	regmap_reg_range(TPS65086_PG_STATUS1, TPS65086_OC_STATUS),
+};
+
+static const struct regmap_access_table tps65086_volatile_table = {
+	.yes_ranges = tps65086_yes_ranges,
+	.n_yes_ranges = ARRAY_SIZE(tps65086_yes_ranges),
+};
+
+static const struct regmap_config tps65086_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+	.cache_type = REGCACHE_RBTREE,
+	.volatile_table = &tps65086_volatile_table,
+};
+
+static const struct regmap_irq tps65086_irqs[] = {
+	REGMAP_IRQ_REG(TPS65086_IRQ_DIETEMP, 0, TPS65086_IRQ_DIETEMP_MASK),
+	REGMAP_IRQ_REG(TPS65086_IRQ_SHUTDN, 0, TPS65086_IRQ_SHUTDN_MASK),
+	REGMAP_IRQ_REG(TPS65086_IRQ_FAULT, 0, TPS65086_IRQ_FAULT_MASK),
+};
+
+static struct regmap_irq_chip tps65086_irq_chip = {
+	.name = "tps65086",
+	.status_base = TPS65086_IRQ,
+	.mask_base = TPS65086_IRQ_MASK,
+	.ack_base = TPS65086_IRQ,
+	.init_ack_masked = true,
+	.num_regs = 1,
+	.irqs = tps65086_irqs,
+	.num_irqs = ARRAY_SIZE(tps65086_irqs),
+};
+
+static const struct of_device_id tps65086_of_match_table[] = {
+	{ .compatible = "ti,tps65086", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, tps65086_of_match_table);
+
+static int tps65086_probe(struct i2c_client *client,
+			  const struct i2c_device_id *ids)
+{
+	struct tps65086 *tps;
+	unsigned int version;
+	int ret;
+
+	tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
+	if (!tps)
+		return -ENOMEM;
+
+	i2c_set_clientdata(client, tps);
+	tps->dev = &client->dev;
+	tps->irq = client->irq;
+
+	tps->regmap = devm_regmap_init_i2c(client, &tps65086_regmap_config);
+	if (IS_ERR(tps->regmap)) {
+		dev_err(tps->dev, "Failed to initialize register map\n");
+		return PTR_ERR(tps->regmap);
+	}
+
+	ret = regmap_read(tps->regmap, TPS65086_DEVICEID, &version);
+	if (ret) {
+		dev_err(tps->dev, "Failed to read revision register\n");
+		return ret;
+	}
+
+	dev_info(tps->dev, "Device: TPS65086%01lX, OTP: %c, Rev: %ld\n",
+		 (version & TPS65086_DEVICEID_PART_MASK),
+		 (char)((version & TPS65086_DEVICEID_OTP_MASK) >> 4) + 'A',
+		 (version & TPS65086_DEVICEID_REV_MASK) >> 6);
+
+	ret = regmap_add_irq_chip(tps->regmap, tps->irq, IRQF_ONESHOT, 0,
+				  &tps65086_irq_chip, &tps->irq_data);
+	if (ret) {
+		dev_err(tps->dev, "Failed to register IRQ chip\n");
+		return ret;
+	}
+
+	ret = mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65086_cells,
+			      ARRAY_SIZE(tps65086_cells), NULL, 0,
+			      regmap_irq_get_domain(tps->irq_data));
+	if (ret) {
+		regmap_del_irq_chip(tps->irq, tps->irq_data);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int tps65086_remove(struct i2c_client *client)
+{
+	struct tps65086 *tps = i2c_get_clientdata(client);
+
+	regmap_del_irq_chip(tps->irq, tps->irq_data);
+
+	return 0;
+}
+
+static const struct i2c_device_id tps65086_id_table[] = {
+	{ "tps65086", 0 },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(i2c, tps65086_id_table);
+
+static struct i2c_driver tps65086_driver = {
+	.driver		= {
+		.name	= "tps65086",
+		.of_match_table = tps65086_of_match_table,
+	},
+	.probe		= tps65086_probe,
+	.remove		= tps65086_remove,
+	.id_table       = tps65086_id_table,
+};
+module_i2c_driver(tps65086_driver);
+
+MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
+MODULE_DESCRIPTION("TPS65086 PMIC Driver");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/mfd/tps65086.h b/include/linux/mfd/tps65086.h
new file mode 100644
index 0000000..a228ae4
--- /dev/null
+++ b/include/linux/mfd/tps65086.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ *	Andrew F. Davis <afd@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether expressed or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License version 2 for more details.
+ *
+ * Based on the TPS65912 driver
+ */
+
+#ifndef __LINUX_MFD_TPS65086_H
+#define __LINUX_MFD_TPS65086_H
+
+#include <linux/device.h>
+#include <linux/regmap.h>
+
+/* List of registers for TPS65086 */
+#define TPS65086_DEVICEID		0x01
+#define TPS65086_IRQ			0x02
+#define TPS65086_IRQ_MASK		0x03
+#define TPS65086_PMICSTAT		0x04
+#define TPS65086_SHUTDNSRC		0x05
+#define TPS65086_BUCK1CTRL		0x20
+#define TPS65086_BUCK2CTRL		0x21
+#define TPS65086_BUCK3DECAY		0x22
+#define TPS65086_BUCK3VID		0x23
+#define TPS65086_BUCK3SLPCTRL		0x24
+#define TPS65086_BUCK4CTRL		0x25
+#define TPS65086_BUCK5CTRL		0x26
+#define TPS65086_BUCK6CTRL		0x27
+#define TPS65086_LDOA2CTRL		0x28
+#define TPS65086_LDOA3CTRL		0x29
+#define TPS65086_DISCHCTRL1		0x40
+#define TPS65086_DISCHCTRL2		0x41
+#define TPS65086_DISCHCTRL3		0x42
+#define TPS65086_PG_DELAY1		0x43
+#define TPS65086_FORCESHUTDN		0x91
+#define TPS65086_BUCK1SLPCTRL		0x92
+#define TPS65086_BUCK2SLPCTRL		0x93
+#define TPS65086_BUCK4VID		0x94
+#define TPS65086_BUCK4SLPVID		0x95
+#define TPS65086_BUCK5VID		0x96
+#define TPS65086_BUCK5SLPVID		0x97
+#define TPS65086_BUCK6VID		0x98
+#define TPS65086_BUCK6SLPVID		0x99
+#define TPS65086_LDOA2VID		0x9A
+#define TPS65086_LDOA3VID		0x9B
+#define TPS65086_BUCK123CTRL		0x9C
+#define TPS65086_PG_DELAY2		0x9D
+#define TPS65086_PIN_EN_MASK1		0x9E
+#define TPS65086_PIN_EN_MASK2		0x9F
+#define TPS65086_SWVTT_EN		0x9F
+#define TPS65086_PIN_EN_OVR1		0xA0
+#define TPS65086_PIN_EN_OVR2		0xA1
+#define TPS65086_GPOCTRL		0xA1
+#define TPS65086_PWR_FAULT_MASK1	0xA2
+#define TPS65086_PWR_FAULT_MASK2	0xA3
+#define TPS65086_GPO1PG_CTRL1		0xA4
+#define TPS65086_GPO1PG_CTRL2		0xA5
+#define TPS65086_GPO4PG_CTRL1		0xA6
+#define TPS65086_GPO4PG_CTRL2		0xA7
+#define TPS65086_GPO2PG_CTRL1		0xA8
+#define TPS65086_GPO2PG_CTRL2		0xA9
+#define TPS65086_GPO3PG_CTRL1		0xAA
+#define TPS65086_GPO3PG_CTRL2		0xAB
+#define TPS65086_LDOA1CTRL		0xAE
+#define TPS65086_PG_STATUS1		0xB0
+#define TPS65086_PG_STATUS2		0xB1
+#define TPS65086_PWR_FAULT_STATUS1	0xB2
+#define TPS65086_PWR_FAULT_STATUS2	0xB3
+#define TPS65086_TEMPCRIT		0xB4
+#define TPS65086_TEMPHOT		0xB5
+#define TPS65086_OC_STATUS		0xB6
+
+/* IRQ Register field definitions */
+#define TPS65086_IRQ_DIETEMP_MASK	BIT(0)
+#define TPS65086_IRQ_SHUTDN_MASK	BIT(3)
+#define TPS65086_IRQ_FAULT_MASK		BIT(7)
+
+/* DEVICEID Register field definitions */
+#define TPS65086_DEVICEID_PART_MASK	GENMASK(3, 0)
+#define TPS65086_DEVICEID_OTP_MASK	GENMASK(5, 4)
+#define TPS65086_DEVICEID_REV_MASK	GENMASK(7, 6)
+
+/* VID Masks */
+#define BUCK_VID_MASK			GENMASK(7, 1)
+#define VDOA1_VID_MASK			GENMASK(4, 1)
+#define VDOA23_VID_MASK			GENMASK(3, 0)
+
+/* Define the TPS65086 IRQ numbers */
+enum tps65086_irqs {
+	TPS65086_IRQ_DIETEMP,
+	TPS65086_IRQ_SHUTDN,
+	TPS65086_IRQ_FAULT,
+};
+
+/**
+ * struct tps65086 - state holder for the tps65086 driver
+ *
+ * Device data may be used to access the TPS65086 chip
+ */
+struct tps65086 {
+	struct device *dev;
+	struct regmap *regmap;
+
+	/* IRQ Data */
+	int irq;
+	struct regmap_irq_chip_data *irq_data;
+};
+
+#endif /* __LINUX_MFD_TPS65086_H */
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v6 3/3] gpio: tps65086: Add GPO driver for the TPS65086 PMIC
  2016-01-25 15:50 ` Andrew F. Davis
@ 2016-01-25 15:50   ` Andrew F. Davis
  -1 siblings, 0 replies; 22+ messages in thread
From: Andrew F. Davis @ 2016-01-25 15:50 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown
  Cc: devicetree, linux-gpio, linux-kernel, Andrew F. Davis

Add support for the TPS65086 PMIC GPOs.

TPS65086 has four configurable GPOs that can be used for several
purposes. These are output only.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 drivers/gpio/Kconfig         |   6 ++
 drivers/gpio/Makefile        |   1 +
 drivers/gpio/gpio-tps65086.c | 144 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 151 insertions(+)
 create mode 100644 drivers/gpio/gpio-tps65086.c

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index c88dd24..e35e120 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -844,6 +844,12 @@ config GPIO_TIMBERDALE
 	---help---
 	Add support for the GPIO IP in the timberdale FPGA.
 
+config GPIO_TPS65086
+	tristate "TI TPS65086 GPO"
+	depends on MFD_TPS65086
+	help
+	  This driver supports the GPO on TI TPS65086x PMICs.
+
 config GPIO_TPS6586X
 	bool "TPS6586X GPIO"
 	depends on MFD_TPS6586X
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index ece7d7c..c759190 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -95,6 +95,7 @@ obj-$(CONFIG_GPIO_TC3589X)	+= gpio-tc3589x.o
 obj-$(CONFIG_ARCH_TEGRA)	+= gpio-tegra.o
 obj-$(CONFIG_GPIO_TIMBERDALE)	+= gpio-timberdale.o
 obj-$(CONFIG_GPIO_PALMAS)	+= gpio-palmas.o
+obj-$(CONFIG_GPIO_TPS65086)	+= gpio-tps65086.o
 obj-$(CONFIG_GPIO_TPS6586X)	+= gpio-tps6586x.o
 obj-$(CONFIG_GPIO_TPS65910)	+= gpio-tps65910.o
 obj-$(CONFIG_GPIO_TPS65912)	+= gpio-tps65912.o
diff --git a/drivers/gpio/gpio-tps65086.c b/drivers/gpio/gpio-tps65086.c
new file mode 100644
index 0000000..d5d9e47
--- /dev/null
+++ b/drivers/gpio/gpio-tps65086.c
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ *	Andrew F. Davis <afd@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether expressed or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License version 2 for more details.
+ *
+ * Based on the TPS65912 driver
+ */
+
+#include <linux/gpio.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+#include <linux/mfd/tps65086.h>
+
+struct tps65086_gpio {
+	struct gpio_chip chip;
+	struct tps65086 *tps;
+};
+
+static inline struct tps65086_gpio *to_tps65086_gpio(struct gpio_chip *chip)
+{
+	return container_of(chip, struct tps65086_gpio, chip);
+}
+
+static int tps65086_gpio_get_direction(struct gpio_chip *chip,
+				       unsigned offset)
+{
+	/* This device is output only */
+	return 0;
+}
+
+static int tps65086_gpio_direction_input(struct gpio_chip *chip,
+					 unsigned offset)
+{
+	/* This device is output only */
+	return -EINVAL;
+}
+
+static int tps65086_gpio_direction_output(struct gpio_chip *chip,
+					  unsigned offset, int value)
+{
+	struct tps65086_gpio *gpio = to_tps65086_gpio(chip);
+
+	/* Set the initial value */
+	regmap_update_bits(gpio->tps->regmap, TPS65086_GPOCTRL,
+			   BIT(4 + offset), value ? BIT(4 + offset) : 0);
+
+	return 0;
+}
+
+static int tps65086_gpio_get(struct gpio_chip *chip, unsigned offset)
+{
+	struct tps65086_gpio *gpio = to_tps65086_gpio(chip);
+	int ret, val;
+
+	ret = regmap_read(gpio->tps->regmap, TPS65086_GPOCTRL, &val);
+	if (ret < 0)
+		return ret;
+
+	return val & BIT(4 + offset);
+}
+
+static void tps65086_gpio_set(struct gpio_chip *chip, unsigned offset,
+			      int value)
+{
+	struct tps65086_gpio *gpio = to_tps65086_gpio(chip);
+
+	regmap_update_bits(gpio->tps->regmap, TPS65086_GPOCTRL,
+			   BIT(4 + offset), value ? BIT(4 + offset) : 0);
+}
+
+static struct gpio_chip template_chip = {
+	.label			= "tps65086-gpio",
+	.owner			= THIS_MODULE,
+	.get_direction		= tps65086_gpio_get_direction,
+	.direction_input	= tps65086_gpio_direction_input,
+	.direction_output	= tps65086_gpio_direction_output,
+	.get			= tps65086_gpio_get,
+	.set			= tps65086_gpio_set,
+	.base			= -1,
+	.ngpio			= 4,
+	.can_sleep		= true,
+};
+
+static int tps65086_gpio_probe(struct platform_device *pdev)
+{
+	struct tps65086_gpio *gpio;
+	int ret;
+
+	gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
+	if (!gpio)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, gpio);
+
+	gpio->tps = dev_get_drvdata(pdev->dev.parent);
+	gpio->chip = template_chip;
+	gpio->chip.parent = gpio->tps->dev;
+
+	ret = gpiochip_add(&gpio->chip);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int tps65086_gpio_remove(struct platform_device *pdev)
+{
+	struct tps65086_gpio *gpio = platform_get_drvdata(pdev);
+
+	gpiochip_remove(&gpio->chip);
+
+	return 0;
+}
+
+static const struct platform_device_id tps65086_gpio_id_table[] = {
+	{ "tps65086-gpio", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, tps65086_gpio_id_table);
+
+static struct platform_driver tps65086_gpio_driver = {
+	.driver = {
+		.name = "tps65086-gpio",
+	},
+	.probe = tps65086_gpio_probe,
+	.remove = tps65086_gpio_remove,
+	.id_table = tps65086_gpio_id_table,
+};
+module_platform_driver(tps65086_gpio_driver);
+
+MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
+MODULE_DESCRIPTION("TPS65086 GPIO driver");
+MODULE_LICENSE("GPL v2");
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v6 3/3] gpio: tps65086: Add GPO driver for the TPS65086 PMIC
@ 2016-01-25 15:50   ` Andrew F. Davis
  0 siblings, 0 replies; 22+ messages in thread
From: Andrew F. Davis @ 2016-01-25 15:50 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown
  Cc: devicetree, linux-gpio, linux-kernel, Andrew F. Davis

Add support for the TPS65086 PMIC GPOs.

TPS65086 has four configurable GPOs that can be used for several
purposes. These are output only.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 drivers/gpio/Kconfig         |   6 ++
 drivers/gpio/Makefile        |   1 +
 drivers/gpio/gpio-tps65086.c | 144 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 151 insertions(+)
 create mode 100644 drivers/gpio/gpio-tps65086.c

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index c88dd24..e35e120 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -844,6 +844,12 @@ config GPIO_TIMBERDALE
 	---help---
 	Add support for the GPIO IP in the timberdale FPGA.
 
+config GPIO_TPS65086
+	tristate "TI TPS65086 GPO"
+	depends on MFD_TPS65086
+	help
+	  This driver supports the GPO on TI TPS65086x PMICs.
+
 config GPIO_TPS6586X
 	bool "TPS6586X GPIO"
 	depends on MFD_TPS6586X
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index ece7d7c..c759190 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -95,6 +95,7 @@ obj-$(CONFIG_GPIO_TC3589X)	+= gpio-tc3589x.o
 obj-$(CONFIG_ARCH_TEGRA)	+= gpio-tegra.o
 obj-$(CONFIG_GPIO_TIMBERDALE)	+= gpio-timberdale.o
 obj-$(CONFIG_GPIO_PALMAS)	+= gpio-palmas.o
+obj-$(CONFIG_GPIO_TPS65086)	+= gpio-tps65086.o
 obj-$(CONFIG_GPIO_TPS6586X)	+= gpio-tps6586x.o
 obj-$(CONFIG_GPIO_TPS65910)	+= gpio-tps65910.o
 obj-$(CONFIG_GPIO_TPS65912)	+= gpio-tps65912.o
diff --git a/drivers/gpio/gpio-tps65086.c b/drivers/gpio/gpio-tps65086.c
new file mode 100644
index 0000000..d5d9e47
--- /dev/null
+++ b/drivers/gpio/gpio-tps65086.c
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ *	Andrew F. Davis <afd@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether expressed or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License version 2 for more details.
+ *
+ * Based on the TPS65912 driver
+ */
+
+#include <linux/gpio.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+#include <linux/mfd/tps65086.h>
+
+struct tps65086_gpio {
+	struct gpio_chip chip;
+	struct tps65086 *tps;
+};
+
+static inline struct tps65086_gpio *to_tps65086_gpio(struct gpio_chip *chip)
+{
+	return container_of(chip, struct tps65086_gpio, chip);
+}
+
+static int tps65086_gpio_get_direction(struct gpio_chip *chip,
+				       unsigned offset)
+{
+	/* This device is output only */
+	return 0;
+}
+
+static int tps65086_gpio_direction_input(struct gpio_chip *chip,
+					 unsigned offset)
+{
+	/* This device is output only */
+	return -EINVAL;
+}
+
+static int tps65086_gpio_direction_output(struct gpio_chip *chip,
+					  unsigned offset, int value)
+{
+	struct tps65086_gpio *gpio = to_tps65086_gpio(chip);
+
+	/* Set the initial value */
+	regmap_update_bits(gpio->tps->regmap, TPS65086_GPOCTRL,
+			   BIT(4 + offset), value ? BIT(4 + offset) : 0);
+
+	return 0;
+}
+
+static int tps65086_gpio_get(struct gpio_chip *chip, unsigned offset)
+{
+	struct tps65086_gpio *gpio = to_tps65086_gpio(chip);
+	int ret, val;
+
+	ret = regmap_read(gpio->tps->regmap, TPS65086_GPOCTRL, &val);
+	if (ret < 0)
+		return ret;
+
+	return val & BIT(4 + offset);
+}
+
+static void tps65086_gpio_set(struct gpio_chip *chip, unsigned offset,
+			      int value)
+{
+	struct tps65086_gpio *gpio = to_tps65086_gpio(chip);
+
+	regmap_update_bits(gpio->tps->regmap, TPS65086_GPOCTRL,
+			   BIT(4 + offset), value ? BIT(4 + offset) : 0);
+}
+
+static struct gpio_chip template_chip = {
+	.label			= "tps65086-gpio",
+	.owner			= THIS_MODULE,
+	.get_direction		= tps65086_gpio_get_direction,
+	.direction_input	= tps65086_gpio_direction_input,
+	.direction_output	= tps65086_gpio_direction_output,
+	.get			= tps65086_gpio_get,
+	.set			= tps65086_gpio_set,
+	.base			= -1,
+	.ngpio			= 4,
+	.can_sleep		= true,
+};
+
+static int tps65086_gpio_probe(struct platform_device *pdev)
+{
+	struct tps65086_gpio *gpio;
+	int ret;
+
+	gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
+	if (!gpio)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, gpio);
+
+	gpio->tps = dev_get_drvdata(pdev->dev.parent);
+	gpio->chip = template_chip;
+	gpio->chip.parent = gpio->tps->dev;
+
+	ret = gpiochip_add(&gpio->chip);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int tps65086_gpio_remove(struct platform_device *pdev)
+{
+	struct tps65086_gpio *gpio = platform_get_drvdata(pdev);
+
+	gpiochip_remove(&gpio->chip);
+
+	return 0;
+}
+
+static const struct platform_device_id tps65086_gpio_id_table[] = {
+	{ "tps65086-gpio", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, tps65086_gpio_id_table);
+
+static struct platform_driver tps65086_gpio_driver = {
+	.driver = {
+		.name = "tps65086-gpio",
+	},
+	.probe = tps65086_gpio_probe,
+	.remove = tps65086_gpio_remove,
+	.id_table = tps65086_gpio_id_table,
+};
+module_platform_driver(tps65086_gpio_driver);
+
+MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
+MODULE_DESCRIPTION("TPS65086 GPIO driver");
+MODULE_LICENSE("GPL v2");
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v6 1/3] Documentation: tps65086: Add DT bindings for the TPS65086 PMIC
  2016-01-25 15:50   ` Andrew F. Davis
@ 2016-01-26 14:02       ` Lee Jones
  -1 siblings, 0 replies; 22+ messages in thread
From: Lee Jones @ 2016-01-26 14:02 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Liam Girdwood,
	Mark Brown, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Mon, 25 Jan 2016, Andrew F. Davis wrote:

> The TPS65086 PMIC contains several regulators and a GPO controller.
> Add bindings for the TPS65086 PMIC.
> 
> Signed-off-by: Andrew F. Davis <afd-l0cyMroinI0@public.gmane.org>
> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/mfd/tps65086.txt | 55 ++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/tps65086.txt

Acked-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

> diff --git a/Documentation/devicetree/bindings/mfd/tps65086.txt b/Documentation/devicetree/bindings/mfd/tps65086.txt
> new file mode 100644
> index 0000000..d370561
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/tps65086.txt
> @@ -0,0 +1,55 @@
> +* TPS65086 Power Management Integrated Circuit (PMIC) bindings
> +
> +Required properties:
> + - compatible		: Should be "ti,tps65086".
> + - reg			: I2C slave address.
> + - interrupt-parent	: Phandle to 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.
> +			    The first cell is the IRQ number.
> +			    The second cell is the flags, encoded as trigger
> +			    masks from ../interrupt-controller/interrupts.txt.
> + - gpio-controller      : Marks the device node as a GPIO Controller.
> + - #gpio-cells          : Should be two.  The first cell is the pin number and
> +                            the second cell is used to specify flags.
> +                            See ../gpio/gpio.txt for more information.
> + - regulators:          : List of child nodes that specify the regulator
> +                            initialization data. Child nodes must be named
> +                            after their hardware counterparts: buck[1-6],
> +                            ldoa[1-3], swa1, swb[1-2], and vtt. Each child
> +                            node is defined using the standard binding for
> +                            regulators and the optional regulator properties
> +                            defined below.
> +
> +Optional regulator properties:
> + - ti,regulator-step-size-25mv	: This is applicable for buck[1,2,6], set this
> +				    if the regulator is factory set with a 25mv
> +				    step voltage mapping.
> + - ti,regulator-decay		: This is applicable for buck[1-6], set this if
> +				    the output needs to decay, default is for
> +				    the output to slew down.
> +
> +Example:
> +
> +	pmic: tps65086@5e {
> +		compatible = "ti,tps65086";
> +		reg = <0x5e>;
> +		interrupt-parent = <&gpio1>;
> +		interrupts = <28 IRQ_TYPE_LEVEL_LOW>;
> +		interrupt-controller;
> +		#interrupt-cells = <2>;
> +		gpio-controller;
> +		#gpio-cells = <2>;
> +
> +		regulators {
> +			buck1 {
> +				regulator-name = "vcc1";
> +				regulator-min-microvolt = <1600000>;
> +				regulator-max-microvolt = <1600000>;
> +				regulator-boot-on;
> +				ti,regulator-decay;
> +				ti,regulator-step-size-25mv;
> +			};
> +		};
> +	};

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v6 1/3] Documentation: tps65086: Add DT bindings for the TPS65086 PMIC
@ 2016-01-26 14:02       ` Lee Jones
  0 siblings, 0 replies; 22+ messages in thread
From: Lee Jones @ 2016-01-26 14:02 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Liam Girdwood,
	Mark Brown, devicetree, linux-gpio, linux-kernel

On Mon, 25 Jan 2016, Andrew F. Davis wrote:

> The TPS65086 PMIC contains several regulators and a GPO controller.
> Add bindings for the TPS65086 PMIC.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> Acked-by: Rob Herring <robh@kernel.org>
> ---
>  Documentation/devicetree/bindings/mfd/tps65086.txt | 55 ++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/tps65086.txt

Acked-by: Lee Jones <lee.jones@linaro.org>

> diff --git a/Documentation/devicetree/bindings/mfd/tps65086.txt b/Documentation/devicetree/bindings/mfd/tps65086.txt
> new file mode 100644
> index 0000000..d370561
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/tps65086.txt
> @@ -0,0 +1,55 @@
> +* TPS65086 Power Management Integrated Circuit (PMIC) bindings
> +
> +Required properties:
> + - compatible		: Should be "ti,tps65086".
> + - reg			: I2C slave address.
> + - interrupt-parent	: Phandle to 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.
> +			    The first cell is the IRQ number.
> +			    The second cell is the flags, encoded as trigger
> +			    masks from ../interrupt-controller/interrupts.txt.
> + - gpio-controller      : Marks the device node as a GPIO Controller.
> + - #gpio-cells          : Should be two.  The first cell is the pin number and
> +                            the second cell is used to specify flags.
> +                            See ../gpio/gpio.txt for more information.
> + - regulators:          : List of child nodes that specify the regulator
> +                            initialization data. Child nodes must be named
> +                            after their hardware counterparts: buck[1-6],
> +                            ldoa[1-3], swa1, swb[1-2], and vtt. Each child
> +                            node is defined using the standard binding for
> +                            regulators and the optional regulator properties
> +                            defined below.
> +
> +Optional regulator properties:
> + - ti,regulator-step-size-25mv	: This is applicable for buck[1,2,6], set this
> +				    if the regulator is factory set with a 25mv
> +				    step voltage mapping.
> + - ti,regulator-decay		: This is applicable for buck[1-6], set this if
> +				    the output needs to decay, default is for
> +				    the output to slew down.
> +
> +Example:
> +
> +	pmic: tps65086@5e {
> +		compatible = "ti,tps65086";
> +		reg = <0x5e>;
> +		interrupt-parent = <&gpio1>;
> +		interrupts = <28 IRQ_TYPE_LEVEL_LOW>;
> +		interrupt-controller;
> +		#interrupt-cells = <2>;
> +		gpio-controller;
> +		#gpio-cells = <2>;
> +
> +		regulators {
> +			buck1 {
> +				regulator-name = "vcc1";
> +				regulator-min-microvolt = <1600000>;
> +				regulator-max-microvolt = <1600000>;
> +				regulator-boot-on;
> +				ti,regulator-decay;
> +				ti,regulator-step-size-25mv;
> +			};
> +		};
> +	};

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v6 3/3] gpio: tps65086: Add GPO driver for the TPS65086 PMIC
  2016-01-25 15:50   ` Andrew F. Davis
@ 2016-01-26 14:03     ` Lee Jones
  -1 siblings, 0 replies; 22+ messages in thread
From: Lee Jones @ 2016-01-26 14:03 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Liam Girdwood,
	Mark Brown, devicetree, linux-gpio, linux-kernel

On Mon, 25 Jan 2016, Andrew F. Davis wrote:

> Add support for the TPS65086 PMIC GPOs.
> 
> TPS65086 has four configurable GPOs that can be used for several
> purposes. These are output only.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
>  drivers/gpio/Kconfig         |   6 ++
>  drivers/gpio/Makefile        |   1 +
>  drivers/gpio/gpio-tps65086.c | 144 +++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 151 insertions(+)
>  create mode 100644 drivers/gpio/gpio-tps65086.c

Is this patch orthogonal to the other two in the set, or do they all
need to go in together?

> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index c88dd24..e35e120 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -844,6 +844,12 @@ config GPIO_TIMBERDALE
>  	---help---
>  	Add support for the GPIO IP in the timberdale FPGA.
>  
> +config GPIO_TPS65086
> +	tristate "TI TPS65086 GPO"
> +	depends on MFD_TPS65086
> +	help
> +	  This driver supports the GPO on TI TPS65086x PMICs.
> +
>  config GPIO_TPS6586X
>  	bool "TPS6586X GPIO"
>  	depends on MFD_TPS6586X
> diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
> index ece7d7c..c759190 100644
> --- a/drivers/gpio/Makefile
> +++ b/drivers/gpio/Makefile
> @@ -95,6 +95,7 @@ obj-$(CONFIG_GPIO_TC3589X)	+= gpio-tc3589x.o
>  obj-$(CONFIG_ARCH_TEGRA)	+= gpio-tegra.o
>  obj-$(CONFIG_GPIO_TIMBERDALE)	+= gpio-timberdale.o
>  obj-$(CONFIG_GPIO_PALMAS)	+= gpio-palmas.o
> +obj-$(CONFIG_GPIO_TPS65086)	+= gpio-tps65086.o
>  obj-$(CONFIG_GPIO_TPS6586X)	+= gpio-tps6586x.o
>  obj-$(CONFIG_GPIO_TPS65910)	+= gpio-tps65910.o
>  obj-$(CONFIG_GPIO_TPS65912)	+= gpio-tps65912.o
> diff --git a/drivers/gpio/gpio-tps65086.c b/drivers/gpio/gpio-tps65086.c
> new file mode 100644
> index 0000000..d5d9e47
> --- /dev/null
> +++ b/drivers/gpio/gpio-tps65086.c
> @@ -0,0 +1,144 @@
> +/*
> + * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
> + *	Andrew F. Davis <afd@ti.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> + * kind, whether expressed or implied; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License version 2 for more details.
> + *
> + * Based on the TPS65912 driver
> + */
> +
> +#include <linux/gpio.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +
> +#include <linux/mfd/tps65086.h>
> +
> +struct tps65086_gpio {
> +	struct gpio_chip chip;
> +	struct tps65086 *tps;
> +};
> +
> +static inline struct tps65086_gpio *to_tps65086_gpio(struct gpio_chip *chip)
> +{
> +	return container_of(chip, struct tps65086_gpio, chip);
> +}
> +
> +static int tps65086_gpio_get_direction(struct gpio_chip *chip,
> +				       unsigned offset)
> +{
> +	/* This device is output only */
> +	return 0;
> +}
> +
> +static int tps65086_gpio_direction_input(struct gpio_chip *chip,
> +					 unsigned offset)
> +{
> +	/* This device is output only */
> +	return -EINVAL;
> +}
> +
> +static int tps65086_gpio_direction_output(struct gpio_chip *chip,
> +					  unsigned offset, int value)
> +{
> +	struct tps65086_gpio *gpio = to_tps65086_gpio(chip);
> +
> +	/* Set the initial value */
> +	regmap_update_bits(gpio->tps->regmap, TPS65086_GPOCTRL,
> +			   BIT(4 + offset), value ? BIT(4 + offset) : 0);
> +
> +	return 0;
> +}
> +
> +static int tps65086_gpio_get(struct gpio_chip *chip, unsigned offset)
> +{
> +	struct tps65086_gpio *gpio = to_tps65086_gpio(chip);
> +	int ret, val;
> +
> +	ret = regmap_read(gpio->tps->regmap, TPS65086_GPOCTRL, &val);
> +	if (ret < 0)
> +		return ret;
> +
> +	return val & BIT(4 + offset);
> +}
> +
> +static void tps65086_gpio_set(struct gpio_chip *chip, unsigned offset,
> +			      int value)
> +{
> +	struct tps65086_gpio *gpio = to_tps65086_gpio(chip);
> +
> +	regmap_update_bits(gpio->tps->regmap, TPS65086_GPOCTRL,
> +			   BIT(4 + offset), value ? BIT(4 + offset) : 0);
> +}
> +
> +static struct gpio_chip template_chip = {
> +	.label			= "tps65086-gpio",
> +	.owner			= THIS_MODULE,
> +	.get_direction		= tps65086_gpio_get_direction,
> +	.direction_input	= tps65086_gpio_direction_input,
> +	.direction_output	= tps65086_gpio_direction_output,
> +	.get			= tps65086_gpio_get,
> +	.set			= tps65086_gpio_set,
> +	.base			= -1,
> +	.ngpio			= 4,
> +	.can_sleep		= true,
> +};
> +
> +static int tps65086_gpio_probe(struct platform_device *pdev)
> +{
> +	struct tps65086_gpio *gpio;
> +	int ret;
> +
> +	gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
> +	if (!gpio)
> +		return -ENOMEM;
> +
> +	platform_set_drvdata(pdev, gpio);
> +
> +	gpio->tps = dev_get_drvdata(pdev->dev.parent);
> +	gpio->chip = template_chip;
> +	gpio->chip.parent = gpio->tps->dev;
> +
> +	ret = gpiochip_add(&gpio->chip);
> +	if (ret < 0) {
> +		dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static int tps65086_gpio_remove(struct platform_device *pdev)
> +{
> +	struct tps65086_gpio *gpio = platform_get_drvdata(pdev);
> +
> +	gpiochip_remove(&gpio->chip);
> +
> +	return 0;
> +}
> +
> +static const struct platform_device_id tps65086_gpio_id_table[] = {
> +	{ "tps65086-gpio", },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(platform, tps65086_gpio_id_table);
> +
> +static struct platform_driver tps65086_gpio_driver = {
> +	.driver = {
> +		.name = "tps65086-gpio",
> +	},
> +	.probe = tps65086_gpio_probe,
> +	.remove = tps65086_gpio_remove,
> +	.id_table = tps65086_gpio_id_table,
> +};
> +module_platform_driver(tps65086_gpio_driver);
> +
> +MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
> +MODULE_DESCRIPTION("TPS65086 GPIO driver");
> +MODULE_LICENSE("GPL v2");

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v6 3/3] gpio: tps65086: Add GPO driver for the TPS65086 PMIC
@ 2016-01-26 14:03     ` Lee Jones
  0 siblings, 0 replies; 22+ messages in thread
From: Lee Jones @ 2016-01-26 14:03 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Liam Girdwood,
	Mark Brown, devicetree, linux-gpio, linux-kernel

On Mon, 25 Jan 2016, Andrew F. Davis wrote:

> Add support for the TPS65086 PMIC GPOs.
> 
> TPS65086 has four configurable GPOs that can be used for several
> purposes. These are output only.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
>  drivers/gpio/Kconfig         |   6 ++
>  drivers/gpio/Makefile        |   1 +
>  drivers/gpio/gpio-tps65086.c | 144 +++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 151 insertions(+)
>  create mode 100644 drivers/gpio/gpio-tps65086.c

Is this patch orthogonal to the other two in the set, or do they all
need to go in together?

> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index c88dd24..e35e120 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -844,6 +844,12 @@ config GPIO_TIMBERDALE
>  	---help---
>  	Add support for the GPIO IP in the timberdale FPGA.
>  
> +config GPIO_TPS65086
> +	tristate "TI TPS65086 GPO"
> +	depends on MFD_TPS65086
> +	help
> +	  This driver supports the GPO on TI TPS65086x PMICs.
> +
>  config GPIO_TPS6586X
>  	bool "TPS6586X GPIO"
>  	depends on MFD_TPS6586X
> diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
> index ece7d7c..c759190 100644
> --- a/drivers/gpio/Makefile
> +++ b/drivers/gpio/Makefile
> @@ -95,6 +95,7 @@ obj-$(CONFIG_GPIO_TC3589X)	+= gpio-tc3589x.o
>  obj-$(CONFIG_ARCH_TEGRA)	+= gpio-tegra.o
>  obj-$(CONFIG_GPIO_TIMBERDALE)	+= gpio-timberdale.o
>  obj-$(CONFIG_GPIO_PALMAS)	+= gpio-palmas.o
> +obj-$(CONFIG_GPIO_TPS65086)	+= gpio-tps65086.o
>  obj-$(CONFIG_GPIO_TPS6586X)	+= gpio-tps6586x.o
>  obj-$(CONFIG_GPIO_TPS65910)	+= gpio-tps65910.o
>  obj-$(CONFIG_GPIO_TPS65912)	+= gpio-tps65912.o
> diff --git a/drivers/gpio/gpio-tps65086.c b/drivers/gpio/gpio-tps65086.c
> new file mode 100644
> index 0000000..d5d9e47
> --- /dev/null
> +++ b/drivers/gpio/gpio-tps65086.c
> @@ -0,0 +1,144 @@
> +/*
> + * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
> + *	Andrew F. Davis <afd@ti.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> + * kind, whether expressed or implied; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License version 2 for more details.
> + *
> + * Based on the TPS65912 driver
> + */
> +
> +#include <linux/gpio.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +
> +#include <linux/mfd/tps65086.h>
> +
> +struct tps65086_gpio {
> +	struct gpio_chip chip;
> +	struct tps65086 *tps;
> +};
> +
> +static inline struct tps65086_gpio *to_tps65086_gpio(struct gpio_chip *chip)
> +{
> +	return container_of(chip, struct tps65086_gpio, chip);
> +}
> +
> +static int tps65086_gpio_get_direction(struct gpio_chip *chip,
> +				       unsigned offset)
> +{
> +	/* This device is output only */
> +	return 0;
> +}
> +
> +static int tps65086_gpio_direction_input(struct gpio_chip *chip,
> +					 unsigned offset)
> +{
> +	/* This device is output only */
> +	return -EINVAL;
> +}
> +
> +static int tps65086_gpio_direction_output(struct gpio_chip *chip,
> +					  unsigned offset, int value)
> +{
> +	struct tps65086_gpio *gpio = to_tps65086_gpio(chip);
> +
> +	/* Set the initial value */
> +	regmap_update_bits(gpio->tps->regmap, TPS65086_GPOCTRL,
> +			   BIT(4 + offset), value ? BIT(4 + offset) : 0);
> +
> +	return 0;
> +}
> +
> +static int tps65086_gpio_get(struct gpio_chip *chip, unsigned offset)
> +{
> +	struct tps65086_gpio *gpio = to_tps65086_gpio(chip);
> +	int ret, val;
> +
> +	ret = regmap_read(gpio->tps->regmap, TPS65086_GPOCTRL, &val);
> +	if (ret < 0)
> +		return ret;
> +
> +	return val & BIT(4 + offset);
> +}
> +
> +static void tps65086_gpio_set(struct gpio_chip *chip, unsigned offset,
> +			      int value)
> +{
> +	struct tps65086_gpio *gpio = to_tps65086_gpio(chip);
> +
> +	regmap_update_bits(gpio->tps->regmap, TPS65086_GPOCTRL,
> +			   BIT(4 + offset), value ? BIT(4 + offset) : 0);
> +}
> +
> +static struct gpio_chip template_chip = {
> +	.label			= "tps65086-gpio",
> +	.owner			= THIS_MODULE,
> +	.get_direction		= tps65086_gpio_get_direction,
> +	.direction_input	= tps65086_gpio_direction_input,
> +	.direction_output	= tps65086_gpio_direction_output,
> +	.get			= tps65086_gpio_get,
> +	.set			= tps65086_gpio_set,
> +	.base			= -1,
> +	.ngpio			= 4,
> +	.can_sleep		= true,
> +};
> +
> +static int tps65086_gpio_probe(struct platform_device *pdev)
> +{
> +	struct tps65086_gpio *gpio;
> +	int ret;
> +
> +	gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
> +	if (!gpio)
> +		return -ENOMEM;
> +
> +	platform_set_drvdata(pdev, gpio);
> +
> +	gpio->tps = dev_get_drvdata(pdev->dev.parent);
> +	gpio->chip = template_chip;
> +	gpio->chip.parent = gpio->tps->dev;
> +
> +	ret = gpiochip_add(&gpio->chip);
> +	if (ret < 0) {
> +		dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static int tps65086_gpio_remove(struct platform_device *pdev)
> +{
> +	struct tps65086_gpio *gpio = platform_get_drvdata(pdev);
> +
> +	gpiochip_remove(&gpio->chip);
> +
> +	return 0;
> +}
> +
> +static const struct platform_device_id tps65086_gpio_id_table[] = {
> +	{ "tps65086-gpio", },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(platform, tps65086_gpio_id_table);
> +
> +static struct platform_driver tps65086_gpio_driver = {
> +	.driver = {
> +		.name = "tps65086-gpio",
> +	},
> +	.probe = tps65086_gpio_probe,
> +	.remove = tps65086_gpio_remove,
> +	.id_table = tps65086_gpio_id_table,
> +};
> +module_platform_driver(tps65086_gpio_driver);
> +
> +MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
> +MODULE_DESCRIPTION("TPS65086 GPIO driver");
> +MODULE_LICENSE("GPL v2");

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v6 3/3] gpio: tps65086: Add GPO driver for the TPS65086 PMIC
  2016-01-26 14:03     ` Lee Jones
@ 2016-01-26 14:38       ` Andrew F. Davis
  -1 siblings, 0 replies; 22+ messages in thread
From: Andrew F. Davis @ 2016-01-26 14:38 UTC (permalink / raw)
  To: Lee Jones
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Liam Girdwood,
	Mark Brown, devicetree, linux-gpio, linux-kernel

On 01/26/2016 08:03 AM, Lee Jones wrote:
> On Mon, 25 Jan 2016, Andrew F. Davis wrote:
>
>> Add support for the TPS65086 PMIC GPOs.
>>
>> TPS65086 has four configurable GPOs that can be used for several
>> purposes. These are output only.
>>
>> Signed-off-by: Andrew F. Davis <afd@ti.com>
>> ---
>>   drivers/gpio/Kconfig         |   6 ++
>>   drivers/gpio/Makefile        |   1 +
>>   drivers/gpio/gpio-tps65086.c | 144 +++++++++++++++++++++++++++++++++++++++++++
>>   3 files changed, 151 insertions(+)
>>   create mode 100644 drivers/gpio/gpio-tps65086.c
>
> Is this patch orthogonal to the other two in the set, or do they all
> need to go in together?
>

These can all go in separately, in fact Mark has already taken the regulator
component from a previous push of this series. It is only the TPS65912
driver I'm pushing that will need to go all at once due to conflicts with
the driver it is replacing.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v6 3/3] gpio: tps65086: Add GPO driver for the TPS65086 PMIC
@ 2016-01-26 14:38       ` Andrew F. Davis
  0 siblings, 0 replies; 22+ messages in thread
From: Andrew F. Davis @ 2016-01-26 14:38 UTC (permalink / raw)
  To: Lee Jones
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Liam Girdwood,
	Mark Brown, devicetree, linux-gpio, linux-kernel

On 01/26/2016 08:03 AM, Lee Jones wrote:
> On Mon, 25 Jan 2016, Andrew F. Davis wrote:
>
>> Add support for the TPS65086 PMIC GPOs.
>>
>> TPS65086 has four configurable GPOs that can be used for several
>> purposes. These are output only.
>>
>> Signed-off-by: Andrew F. Davis <afd@ti.com>
>> ---
>>   drivers/gpio/Kconfig         |   6 ++
>>   drivers/gpio/Makefile        |   1 +
>>   drivers/gpio/gpio-tps65086.c | 144 +++++++++++++++++++++++++++++++++++++++++++
>>   3 files changed, 151 insertions(+)
>>   create mode 100644 drivers/gpio/gpio-tps65086.c
>
> Is this patch orthogonal to the other two in the set, or do they all
> need to go in together?
>

These can all go in separately, in fact Mark has already taken the regulator
component from a previous push of this series. It is only the TPS65912
driver I'm pushing that will need to go all at once due to conflicts with
the driver it is replacing.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v6 1/3] Documentation: tps65086: Add DT bindings for the TPS65086 PMIC
  2016-01-25 15:50   ` Andrew F. Davis
@ 2016-01-27  7:28     ` Lee Jones
  -1 siblings, 0 replies; 22+ messages in thread
From: Lee Jones @ 2016-01-27  7:28 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Liam Girdwood,
	Mark Brown, devicetree, linux-gpio, linux-kernel

On Mon, 25 Jan 2016, Andrew F. Davis wrote:

> The TPS65086 PMIC contains several regulators and a GPO controller.
> Add bindings for the TPS65086 PMIC.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> Acked-by: Rob Herring <robh@kernel.org>
> ---
>  Documentation/devicetree/bindings/mfd/tps65086.txt | 55 ++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/tps65086.txt

Applied, thanks.

> diff --git a/Documentation/devicetree/bindings/mfd/tps65086.txt b/Documentation/devicetree/bindings/mfd/tps65086.txt
> new file mode 100644
> index 0000000..d370561
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/tps65086.txt
> @@ -0,0 +1,55 @@
> +* TPS65086 Power Management Integrated Circuit (PMIC) bindings
> +
> +Required properties:
> + - compatible		: Should be "ti,tps65086".
> + - reg			: I2C slave address.
> + - interrupt-parent	: Phandle to 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.
> +			    The first cell is the IRQ number.
> +			    The second cell is the flags, encoded as trigger
> +			    masks from ../interrupt-controller/interrupts.txt.
> + - gpio-controller      : Marks the device node as a GPIO Controller.
> + - #gpio-cells          : Should be two.  The first cell is the pin number and
> +                            the second cell is used to specify flags.
> +                            See ../gpio/gpio.txt for more information.
> + - regulators:          : List of child nodes that specify the regulator
> +                            initialization data. Child nodes must be named
> +                            after their hardware counterparts: buck[1-6],
> +                            ldoa[1-3], swa1, swb[1-2], and vtt. Each child
> +                            node is defined using the standard binding for
> +                            regulators and the optional regulator properties
> +                            defined below.
> +
> +Optional regulator properties:
> + - ti,regulator-step-size-25mv	: This is applicable for buck[1,2,6], set this
> +				    if the regulator is factory set with a 25mv
> +				    step voltage mapping.
> + - ti,regulator-decay		: This is applicable for buck[1-6], set this if
> +				    the output needs to decay, default is for
> +				    the output to slew down.
> +
> +Example:
> +
> +	pmic: tps65086@5e {
> +		compatible = "ti,tps65086";
> +		reg = <0x5e>;
> +		interrupt-parent = <&gpio1>;
> +		interrupts = <28 IRQ_TYPE_LEVEL_LOW>;
> +		interrupt-controller;
> +		#interrupt-cells = <2>;
> +		gpio-controller;
> +		#gpio-cells = <2>;
> +
> +		regulators {
> +			buck1 {
> +				regulator-name = "vcc1";
> +				regulator-min-microvolt = <1600000>;
> +				regulator-max-microvolt = <1600000>;
> +				regulator-boot-on;
> +				ti,regulator-decay;
> +				ti,regulator-step-size-25mv;
> +			};
> +		};
> +	};

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v6 1/3] Documentation: tps65086: Add DT bindings for the TPS65086 PMIC
@ 2016-01-27  7:28     ` Lee Jones
  0 siblings, 0 replies; 22+ messages in thread
From: Lee Jones @ 2016-01-27  7:28 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Liam Girdwood,
	Mark Brown, devicetree, linux-gpio, linux-kernel

On Mon, 25 Jan 2016, Andrew F. Davis wrote:

> The TPS65086 PMIC contains several regulators and a GPO controller.
> Add bindings for the TPS65086 PMIC.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> Acked-by: Rob Herring <robh@kernel.org>
> ---
>  Documentation/devicetree/bindings/mfd/tps65086.txt | 55 ++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/tps65086.txt

Applied, thanks.

> diff --git a/Documentation/devicetree/bindings/mfd/tps65086.txt b/Documentation/devicetree/bindings/mfd/tps65086.txt
> new file mode 100644
> index 0000000..d370561
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/tps65086.txt
> @@ -0,0 +1,55 @@
> +* TPS65086 Power Management Integrated Circuit (PMIC) bindings
> +
> +Required properties:
> + - compatible		: Should be "ti,tps65086".
> + - reg			: I2C slave address.
> + - interrupt-parent	: Phandle to 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.
> +			    The first cell is the IRQ number.
> +			    The second cell is the flags, encoded as trigger
> +			    masks from ../interrupt-controller/interrupts.txt.
> + - gpio-controller      : Marks the device node as a GPIO Controller.
> + - #gpio-cells          : Should be two.  The first cell is the pin number and
> +                            the second cell is used to specify flags.
> +                            See ../gpio/gpio.txt for more information.
> + - regulators:          : List of child nodes that specify the regulator
> +                            initialization data. Child nodes must be named
> +                            after their hardware counterparts: buck[1-6],
> +                            ldoa[1-3], swa1, swb[1-2], and vtt. Each child
> +                            node is defined using the standard binding for
> +                            regulators and the optional regulator properties
> +                            defined below.
> +
> +Optional regulator properties:
> + - ti,regulator-step-size-25mv	: This is applicable for buck[1,2,6], set this
> +				    if the regulator is factory set with a 25mv
> +				    step voltage mapping.
> + - ti,regulator-decay		: This is applicable for buck[1-6], set this if
> +				    the output needs to decay, default is for
> +				    the output to slew down.
> +
> +Example:
> +
> +	pmic: tps65086@5e {
> +		compatible = "ti,tps65086";
> +		reg = <0x5e>;
> +		interrupt-parent = <&gpio1>;
> +		interrupts = <28 IRQ_TYPE_LEVEL_LOW>;
> +		interrupt-controller;
> +		#interrupt-cells = <2>;
> +		gpio-controller;
> +		#gpio-cells = <2>;
> +
> +		regulators {
> +			buck1 {
> +				regulator-name = "vcc1";
> +				regulator-min-microvolt = <1600000>;
> +				regulator-max-microvolt = <1600000>;
> +				regulator-boot-on;
> +				ti,regulator-decay;
> +				ti,regulator-step-size-25mv;
> +			};
> +		};
> +	};

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v6 2/3] mfd: tps65086: Add driver for the TPS65086 PMIC
  2016-01-25 15:50   ` Andrew F. Davis
@ 2016-01-27  7:29     ` Lee Jones
  -1 siblings, 0 replies; 22+ messages in thread
From: Lee Jones @ 2016-01-27  7:29 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Liam Girdwood,
	Mark Brown, devicetree, linux-gpio, linux-kernel

On Mon, 25 Jan 2016, Andrew F. Davis wrote:

> Add support for the TPS65912 device. It provides communication
> through I2C and contains the following components:
> 
>  - Regulators
>  - Load switches
>  - GPO controller
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> Acked-by: Lee Jones <lee.jones@linaro.org>
> ---
>  drivers/mfd/Kconfig          |  13 ++++
>  drivers/mfd/Makefile         |   1 +
>  drivers/mfd/tps65086.c       | 149 +++++++++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/tps65086.h | 117 +++++++++++++++++++++++++++++++++
>  4 files changed, 280 insertions(+)
>  create mode 100644 drivers/mfd/tps65086.c
>  create mode 100644 include/linux/mfd/tps65086.h

Applied, thanks.

> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 9ca66de..fe6d62b 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1106,6 +1106,19 @@ config TPS6507X
>  	  This driver can also be built as a module.  If so, the module
>  	  will be called tps6507x.
>  
> +config MFD_TPS65086
> +	tristate "TI TPS65086 Power Management Integrated Chips (PMICs)"
> +	select REGMAP
> +	select REGMAP_IRQ
> +	select REGMAP_I2C
> +	depends on I2C
> +	help
> +	  If you say yes here you get support for the TPS65086 series of
> +	  Power Management chips.
> +	  This driver provides common support for accessing the device,
> +	  additional drivers must be enabled in order to use the
> +	  functionality of the device.
> +
>  config TPS65911_COMPARATOR
>  	tristate
>  
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 0f230a6..06801aa 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -70,6 +70,7 @@ obj-$(CONFIG_MFD_WM8994)	+= wm8994.o
>  obj-$(CONFIG_TPS6105X)		+= tps6105x.o
>  obj-$(CONFIG_TPS65010)		+= tps65010.o
>  obj-$(CONFIG_TPS6507X)		+= tps6507x.o
> +obj-$(CONFIG_MFD_TPS65086)	+= tps65086.o
>  obj-$(CONFIG_MFD_TPS65217)	+= tps65217.o
>  obj-$(CONFIG_MFD_TPS65218)	+= tps65218.o
>  obj-$(CONFIG_MFD_TPS65910)	+= tps65910.o
> diff --git a/drivers/mfd/tps65086.c b/drivers/mfd/tps65086.c
> new file mode 100644
> index 0000000..43119a6
> --- /dev/null
> +++ b/drivers/mfd/tps65086.c
> @@ -0,0 +1,149 @@
> +/*
> + * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
> + *	Andrew F. Davis <afd@ti.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> + * kind, whether expressed or implied; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License version 2 for more details.
> + *
> + * Based on the TPS65912 driver
> + */
> +
> +#include <linux/i2c.h>
> +#include <linux/interrupt.h>
> +#include <linux/mfd/core.h>
> +#include <linux/module.h>
> +
> +#include <linux/mfd/tps65086.h>
> +
> +static const struct mfd_cell tps65086_cells[] = {
> +	{ .name = "tps65086-regulator", },
> +	{ .name = "tps65086-gpio", },
> +};
> +
> +static const struct regmap_range tps65086_yes_ranges[] = {
> +	regmap_reg_range(TPS65086_IRQ, TPS65086_IRQ),
> +	regmap_reg_range(TPS65086_PMICSTAT, TPS65086_SHUTDNSRC),
> +	regmap_reg_range(TPS65086_GPOCTRL, TPS65086_GPOCTRL),
> +	regmap_reg_range(TPS65086_PG_STATUS1, TPS65086_OC_STATUS),
> +};
> +
> +static const struct regmap_access_table tps65086_volatile_table = {
> +	.yes_ranges = tps65086_yes_ranges,
> +	.n_yes_ranges = ARRAY_SIZE(tps65086_yes_ranges),
> +};
> +
> +static const struct regmap_config tps65086_regmap_config = {
> +	.reg_bits = 8,
> +	.val_bits = 8,
> +	.cache_type = REGCACHE_RBTREE,
> +	.volatile_table = &tps65086_volatile_table,
> +};
> +
> +static const struct regmap_irq tps65086_irqs[] = {
> +	REGMAP_IRQ_REG(TPS65086_IRQ_DIETEMP, 0, TPS65086_IRQ_DIETEMP_MASK),
> +	REGMAP_IRQ_REG(TPS65086_IRQ_SHUTDN, 0, TPS65086_IRQ_SHUTDN_MASK),
> +	REGMAP_IRQ_REG(TPS65086_IRQ_FAULT, 0, TPS65086_IRQ_FAULT_MASK),
> +};
> +
> +static struct regmap_irq_chip tps65086_irq_chip = {
> +	.name = "tps65086",
> +	.status_base = TPS65086_IRQ,
> +	.mask_base = TPS65086_IRQ_MASK,
> +	.ack_base = TPS65086_IRQ,
> +	.init_ack_masked = true,
> +	.num_regs = 1,
> +	.irqs = tps65086_irqs,
> +	.num_irqs = ARRAY_SIZE(tps65086_irqs),
> +};
> +
> +static const struct of_device_id tps65086_of_match_table[] = {
> +	{ .compatible = "ti,tps65086", },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, tps65086_of_match_table);
> +
> +static int tps65086_probe(struct i2c_client *client,
> +			  const struct i2c_device_id *ids)
> +{
> +	struct tps65086 *tps;
> +	unsigned int version;
> +	int ret;
> +
> +	tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
> +	if (!tps)
> +		return -ENOMEM;
> +
> +	i2c_set_clientdata(client, tps);
> +	tps->dev = &client->dev;
> +	tps->irq = client->irq;
> +
> +	tps->regmap = devm_regmap_init_i2c(client, &tps65086_regmap_config);
> +	if (IS_ERR(tps->regmap)) {
> +		dev_err(tps->dev, "Failed to initialize register map\n");
> +		return PTR_ERR(tps->regmap);
> +	}
> +
> +	ret = regmap_read(tps->regmap, TPS65086_DEVICEID, &version);
> +	if (ret) {
> +		dev_err(tps->dev, "Failed to read revision register\n");
> +		return ret;
> +	}
> +
> +	dev_info(tps->dev, "Device: TPS65086%01lX, OTP: %c, Rev: %ld\n",
> +		 (version & TPS65086_DEVICEID_PART_MASK),
> +		 (char)((version & TPS65086_DEVICEID_OTP_MASK) >> 4) + 'A',
> +		 (version & TPS65086_DEVICEID_REV_MASK) >> 6);
> +
> +	ret = regmap_add_irq_chip(tps->regmap, tps->irq, IRQF_ONESHOT, 0,
> +				  &tps65086_irq_chip, &tps->irq_data);
> +	if (ret) {
> +		dev_err(tps->dev, "Failed to register IRQ chip\n");
> +		return ret;
> +	}
> +
> +	ret = mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65086_cells,
> +			      ARRAY_SIZE(tps65086_cells), NULL, 0,
> +			      regmap_irq_get_domain(tps->irq_data));
> +	if (ret) {
> +		regmap_del_irq_chip(tps->irq, tps->irq_data);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static int tps65086_remove(struct i2c_client *client)
> +{
> +	struct tps65086 *tps = i2c_get_clientdata(client);
> +
> +	regmap_del_irq_chip(tps->irq, tps->irq_data);
> +
> +	return 0;
> +}
> +
> +static const struct i2c_device_id tps65086_id_table[] = {
> +	{ "tps65086", 0 },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(i2c, tps65086_id_table);
> +
> +static struct i2c_driver tps65086_driver = {
> +	.driver		= {
> +		.name	= "tps65086",
> +		.of_match_table = tps65086_of_match_table,
> +	},
> +	.probe		= tps65086_probe,
> +	.remove		= tps65086_remove,
> +	.id_table       = tps65086_id_table,
> +};
> +module_i2c_driver(tps65086_driver);
> +
> +MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
> +MODULE_DESCRIPTION("TPS65086 PMIC Driver");
> +MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/mfd/tps65086.h b/include/linux/mfd/tps65086.h
> new file mode 100644
> index 0000000..a228ae4
> --- /dev/null
> +++ b/include/linux/mfd/tps65086.h
> @@ -0,0 +1,117 @@
> +/*
> + * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
> + *	Andrew F. Davis <afd@ti.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> + * kind, whether expressed or implied; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License version 2 for more details.
> + *
> + * Based on the TPS65912 driver
> + */
> +
> +#ifndef __LINUX_MFD_TPS65086_H
> +#define __LINUX_MFD_TPS65086_H
> +
> +#include <linux/device.h>
> +#include <linux/regmap.h>
> +
> +/* List of registers for TPS65086 */
> +#define TPS65086_DEVICEID		0x01
> +#define TPS65086_IRQ			0x02
> +#define TPS65086_IRQ_MASK		0x03
> +#define TPS65086_PMICSTAT		0x04
> +#define TPS65086_SHUTDNSRC		0x05
> +#define TPS65086_BUCK1CTRL		0x20
> +#define TPS65086_BUCK2CTRL		0x21
> +#define TPS65086_BUCK3DECAY		0x22
> +#define TPS65086_BUCK3VID		0x23
> +#define TPS65086_BUCK3SLPCTRL		0x24
> +#define TPS65086_BUCK4CTRL		0x25
> +#define TPS65086_BUCK5CTRL		0x26
> +#define TPS65086_BUCK6CTRL		0x27
> +#define TPS65086_LDOA2CTRL		0x28
> +#define TPS65086_LDOA3CTRL		0x29
> +#define TPS65086_DISCHCTRL1		0x40
> +#define TPS65086_DISCHCTRL2		0x41
> +#define TPS65086_DISCHCTRL3		0x42
> +#define TPS65086_PG_DELAY1		0x43
> +#define TPS65086_FORCESHUTDN		0x91
> +#define TPS65086_BUCK1SLPCTRL		0x92
> +#define TPS65086_BUCK2SLPCTRL		0x93
> +#define TPS65086_BUCK4VID		0x94
> +#define TPS65086_BUCK4SLPVID		0x95
> +#define TPS65086_BUCK5VID		0x96
> +#define TPS65086_BUCK5SLPVID		0x97
> +#define TPS65086_BUCK6VID		0x98
> +#define TPS65086_BUCK6SLPVID		0x99
> +#define TPS65086_LDOA2VID		0x9A
> +#define TPS65086_LDOA3VID		0x9B
> +#define TPS65086_BUCK123CTRL		0x9C
> +#define TPS65086_PG_DELAY2		0x9D
> +#define TPS65086_PIN_EN_MASK1		0x9E
> +#define TPS65086_PIN_EN_MASK2		0x9F
> +#define TPS65086_SWVTT_EN		0x9F
> +#define TPS65086_PIN_EN_OVR1		0xA0
> +#define TPS65086_PIN_EN_OVR2		0xA1
> +#define TPS65086_GPOCTRL		0xA1
> +#define TPS65086_PWR_FAULT_MASK1	0xA2
> +#define TPS65086_PWR_FAULT_MASK2	0xA3
> +#define TPS65086_GPO1PG_CTRL1		0xA4
> +#define TPS65086_GPO1PG_CTRL2		0xA5
> +#define TPS65086_GPO4PG_CTRL1		0xA6
> +#define TPS65086_GPO4PG_CTRL2		0xA7
> +#define TPS65086_GPO2PG_CTRL1		0xA8
> +#define TPS65086_GPO2PG_CTRL2		0xA9
> +#define TPS65086_GPO3PG_CTRL1		0xAA
> +#define TPS65086_GPO3PG_CTRL2		0xAB
> +#define TPS65086_LDOA1CTRL		0xAE
> +#define TPS65086_PG_STATUS1		0xB0
> +#define TPS65086_PG_STATUS2		0xB1
> +#define TPS65086_PWR_FAULT_STATUS1	0xB2
> +#define TPS65086_PWR_FAULT_STATUS2	0xB3
> +#define TPS65086_TEMPCRIT		0xB4
> +#define TPS65086_TEMPHOT		0xB5
> +#define TPS65086_OC_STATUS		0xB6
> +
> +/* IRQ Register field definitions */
> +#define TPS65086_IRQ_DIETEMP_MASK	BIT(0)
> +#define TPS65086_IRQ_SHUTDN_MASK	BIT(3)
> +#define TPS65086_IRQ_FAULT_MASK		BIT(7)
> +
> +/* DEVICEID Register field definitions */
> +#define TPS65086_DEVICEID_PART_MASK	GENMASK(3, 0)
> +#define TPS65086_DEVICEID_OTP_MASK	GENMASK(5, 4)
> +#define TPS65086_DEVICEID_REV_MASK	GENMASK(7, 6)
> +
> +/* VID Masks */
> +#define BUCK_VID_MASK			GENMASK(7, 1)
> +#define VDOA1_VID_MASK			GENMASK(4, 1)
> +#define VDOA23_VID_MASK			GENMASK(3, 0)
> +
> +/* Define the TPS65086 IRQ numbers */
> +enum tps65086_irqs {
> +	TPS65086_IRQ_DIETEMP,
> +	TPS65086_IRQ_SHUTDN,
> +	TPS65086_IRQ_FAULT,
> +};
> +
> +/**
> + * struct tps65086 - state holder for the tps65086 driver
> + *
> + * Device data may be used to access the TPS65086 chip
> + */
> +struct tps65086 {
> +	struct device *dev;
> +	struct regmap *regmap;
> +
> +	/* IRQ Data */
> +	int irq;
> +	struct regmap_irq_chip_data *irq_data;
> +};
> +
> +#endif /* __LINUX_MFD_TPS65086_H */

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v6 2/3] mfd: tps65086: Add driver for the TPS65086 PMIC
@ 2016-01-27  7:29     ` Lee Jones
  0 siblings, 0 replies; 22+ messages in thread
From: Lee Jones @ 2016-01-27  7:29 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Liam Girdwood,
	Mark Brown, devicetree, linux-gpio, linux-kernel

On Mon, 25 Jan 2016, Andrew F. Davis wrote:

> Add support for the TPS65912 device. It provides communication
> through I2C and contains the following components:
> 
>  - Regulators
>  - Load switches
>  - GPO controller
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> Acked-by: Lee Jones <lee.jones@linaro.org>
> ---
>  drivers/mfd/Kconfig          |  13 ++++
>  drivers/mfd/Makefile         |   1 +
>  drivers/mfd/tps65086.c       | 149 +++++++++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/tps65086.h | 117 +++++++++++++++++++++++++++++++++
>  4 files changed, 280 insertions(+)
>  create mode 100644 drivers/mfd/tps65086.c
>  create mode 100644 include/linux/mfd/tps65086.h

Applied, thanks.

> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 9ca66de..fe6d62b 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1106,6 +1106,19 @@ config TPS6507X
>  	  This driver can also be built as a module.  If so, the module
>  	  will be called tps6507x.
>  
> +config MFD_TPS65086
> +	tristate "TI TPS65086 Power Management Integrated Chips (PMICs)"
> +	select REGMAP
> +	select REGMAP_IRQ
> +	select REGMAP_I2C
> +	depends on I2C
> +	help
> +	  If you say yes here you get support for the TPS65086 series of
> +	  Power Management chips.
> +	  This driver provides common support for accessing the device,
> +	  additional drivers must be enabled in order to use the
> +	  functionality of the device.
> +
>  config TPS65911_COMPARATOR
>  	tristate
>  
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 0f230a6..06801aa 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -70,6 +70,7 @@ obj-$(CONFIG_MFD_WM8994)	+= wm8994.o
>  obj-$(CONFIG_TPS6105X)		+= tps6105x.o
>  obj-$(CONFIG_TPS65010)		+= tps65010.o
>  obj-$(CONFIG_TPS6507X)		+= tps6507x.o
> +obj-$(CONFIG_MFD_TPS65086)	+= tps65086.o
>  obj-$(CONFIG_MFD_TPS65217)	+= tps65217.o
>  obj-$(CONFIG_MFD_TPS65218)	+= tps65218.o
>  obj-$(CONFIG_MFD_TPS65910)	+= tps65910.o
> diff --git a/drivers/mfd/tps65086.c b/drivers/mfd/tps65086.c
> new file mode 100644
> index 0000000..43119a6
> --- /dev/null
> +++ b/drivers/mfd/tps65086.c
> @@ -0,0 +1,149 @@
> +/*
> + * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
> + *	Andrew F. Davis <afd@ti.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> + * kind, whether expressed or implied; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License version 2 for more details.
> + *
> + * Based on the TPS65912 driver
> + */
> +
> +#include <linux/i2c.h>
> +#include <linux/interrupt.h>
> +#include <linux/mfd/core.h>
> +#include <linux/module.h>
> +
> +#include <linux/mfd/tps65086.h>
> +
> +static const struct mfd_cell tps65086_cells[] = {
> +	{ .name = "tps65086-regulator", },
> +	{ .name = "tps65086-gpio", },
> +};
> +
> +static const struct regmap_range tps65086_yes_ranges[] = {
> +	regmap_reg_range(TPS65086_IRQ, TPS65086_IRQ),
> +	regmap_reg_range(TPS65086_PMICSTAT, TPS65086_SHUTDNSRC),
> +	regmap_reg_range(TPS65086_GPOCTRL, TPS65086_GPOCTRL),
> +	regmap_reg_range(TPS65086_PG_STATUS1, TPS65086_OC_STATUS),
> +};
> +
> +static const struct regmap_access_table tps65086_volatile_table = {
> +	.yes_ranges = tps65086_yes_ranges,
> +	.n_yes_ranges = ARRAY_SIZE(tps65086_yes_ranges),
> +};
> +
> +static const struct regmap_config tps65086_regmap_config = {
> +	.reg_bits = 8,
> +	.val_bits = 8,
> +	.cache_type = REGCACHE_RBTREE,
> +	.volatile_table = &tps65086_volatile_table,
> +};
> +
> +static const struct regmap_irq tps65086_irqs[] = {
> +	REGMAP_IRQ_REG(TPS65086_IRQ_DIETEMP, 0, TPS65086_IRQ_DIETEMP_MASK),
> +	REGMAP_IRQ_REG(TPS65086_IRQ_SHUTDN, 0, TPS65086_IRQ_SHUTDN_MASK),
> +	REGMAP_IRQ_REG(TPS65086_IRQ_FAULT, 0, TPS65086_IRQ_FAULT_MASK),
> +};
> +
> +static struct regmap_irq_chip tps65086_irq_chip = {
> +	.name = "tps65086",
> +	.status_base = TPS65086_IRQ,
> +	.mask_base = TPS65086_IRQ_MASK,
> +	.ack_base = TPS65086_IRQ,
> +	.init_ack_masked = true,
> +	.num_regs = 1,
> +	.irqs = tps65086_irqs,
> +	.num_irqs = ARRAY_SIZE(tps65086_irqs),
> +};
> +
> +static const struct of_device_id tps65086_of_match_table[] = {
> +	{ .compatible = "ti,tps65086", },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, tps65086_of_match_table);
> +
> +static int tps65086_probe(struct i2c_client *client,
> +			  const struct i2c_device_id *ids)
> +{
> +	struct tps65086 *tps;
> +	unsigned int version;
> +	int ret;
> +
> +	tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
> +	if (!tps)
> +		return -ENOMEM;
> +
> +	i2c_set_clientdata(client, tps);
> +	tps->dev = &client->dev;
> +	tps->irq = client->irq;
> +
> +	tps->regmap = devm_regmap_init_i2c(client, &tps65086_regmap_config);
> +	if (IS_ERR(tps->regmap)) {
> +		dev_err(tps->dev, "Failed to initialize register map\n");
> +		return PTR_ERR(tps->regmap);
> +	}
> +
> +	ret = regmap_read(tps->regmap, TPS65086_DEVICEID, &version);
> +	if (ret) {
> +		dev_err(tps->dev, "Failed to read revision register\n");
> +		return ret;
> +	}
> +
> +	dev_info(tps->dev, "Device: TPS65086%01lX, OTP: %c, Rev: %ld\n",
> +		 (version & TPS65086_DEVICEID_PART_MASK),
> +		 (char)((version & TPS65086_DEVICEID_OTP_MASK) >> 4) + 'A',
> +		 (version & TPS65086_DEVICEID_REV_MASK) >> 6);
> +
> +	ret = regmap_add_irq_chip(tps->regmap, tps->irq, IRQF_ONESHOT, 0,
> +				  &tps65086_irq_chip, &tps->irq_data);
> +	if (ret) {
> +		dev_err(tps->dev, "Failed to register IRQ chip\n");
> +		return ret;
> +	}
> +
> +	ret = mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65086_cells,
> +			      ARRAY_SIZE(tps65086_cells), NULL, 0,
> +			      regmap_irq_get_domain(tps->irq_data));
> +	if (ret) {
> +		regmap_del_irq_chip(tps->irq, tps->irq_data);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static int tps65086_remove(struct i2c_client *client)
> +{
> +	struct tps65086 *tps = i2c_get_clientdata(client);
> +
> +	regmap_del_irq_chip(tps->irq, tps->irq_data);
> +
> +	return 0;
> +}
> +
> +static const struct i2c_device_id tps65086_id_table[] = {
> +	{ "tps65086", 0 },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(i2c, tps65086_id_table);
> +
> +static struct i2c_driver tps65086_driver = {
> +	.driver		= {
> +		.name	= "tps65086",
> +		.of_match_table = tps65086_of_match_table,
> +	},
> +	.probe		= tps65086_probe,
> +	.remove		= tps65086_remove,
> +	.id_table       = tps65086_id_table,
> +};
> +module_i2c_driver(tps65086_driver);
> +
> +MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
> +MODULE_DESCRIPTION("TPS65086 PMIC Driver");
> +MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/mfd/tps65086.h b/include/linux/mfd/tps65086.h
> new file mode 100644
> index 0000000..a228ae4
> --- /dev/null
> +++ b/include/linux/mfd/tps65086.h
> @@ -0,0 +1,117 @@
> +/*
> + * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
> + *	Andrew F. Davis <afd@ti.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> + * kind, whether expressed or implied; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License version 2 for more details.
> + *
> + * Based on the TPS65912 driver
> + */
> +
> +#ifndef __LINUX_MFD_TPS65086_H
> +#define __LINUX_MFD_TPS65086_H
> +
> +#include <linux/device.h>
> +#include <linux/regmap.h>
> +
> +/* List of registers for TPS65086 */
> +#define TPS65086_DEVICEID		0x01
> +#define TPS65086_IRQ			0x02
> +#define TPS65086_IRQ_MASK		0x03
> +#define TPS65086_PMICSTAT		0x04
> +#define TPS65086_SHUTDNSRC		0x05
> +#define TPS65086_BUCK1CTRL		0x20
> +#define TPS65086_BUCK2CTRL		0x21
> +#define TPS65086_BUCK3DECAY		0x22
> +#define TPS65086_BUCK3VID		0x23
> +#define TPS65086_BUCK3SLPCTRL		0x24
> +#define TPS65086_BUCK4CTRL		0x25
> +#define TPS65086_BUCK5CTRL		0x26
> +#define TPS65086_BUCK6CTRL		0x27
> +#define TPS65086_LDOA2CTRL		0x28
> +#define TPS65086_LDOA3CTRL		0x29
> +#define TPS65086_DISCHCTRL1		0x40
> +#define TPS65086_DISCHCTRL2		0x41
> +#define TPS65086_DISCHCTRL3		0x42
> +#define TPS65086_PG_DELAY1		0x43
> +#define TPS65086_FORCESHUTDN		0x91
> +#define TPS65086_BUCK1SLPCTRL		0x92
> +#define TPS65086_BUCK2SLPCTRL		0x93
> +#define TPS65086_BUCK4VID		0x94
> +#define TPS65086_BUCK4SLPVID		0x95
> +#define TPS65086_BUCK5VID		0x96
> +#define TPS65086_BUCK5SLPVID		0x97
> +#define TPS65086_BUCK6VID		0x98
> +#define TPS65086_BUCK6SLPVID		0x99
> +#define TPS65086_LDOA2VID		0x9A
> +#define TPS65086_LDOA3VID		0x9B
> +#define TPS65086_BUCK123CTRL		0x9C
> +#define TPS65086_PG_DELAY2		0x9D
> +#define TPS65086_PIN_EN_MASK1		0x9E
> +#define TPS65086_PIN_EN_MASK2		0x9F
> +#define TPS65086_SWVTT_EN		0x9F
> +#define TPS65086_PIN_EN_OVR1		0xA0
> +#define TPS65086_PIN_EN_OVR2		0xA1
> +#define TPS65086_GPOCTRL		0xA1
> +#define TPS65086_PWR_FAULT_MASK1	0xA2
> +#define TPS65086_PWR_FAULT_MASK2	0xA3
> +#define TPS65086_GPO1PG_CTRL1		0xA4
> +#define TPS65086_GPO1PG_CTRL2		0xA5
> +#define TPS65086_GPO4PG_CTRL1		0xA6
> +#define TPS65086_GPO4PG_CTRL2		0xA7
> +#define TPS65086_GPO2PG_CTRL1		0xA8
> +#define TPS65086_GPO2PG_CTRL2		0xA9
> +#define TPS65086_GPO3PG_CTRL1		0xAA
> +#define TPS65086_GPO3PG_CTRL2		0xAB
> +#define TPS65086_LDOA1CTRL		0xAE
> +#define TPS65086_PG_STATUS1		0xB0
> +#define TPS65086_PG_STATUS2		0xB1
> +#define TPS65086_PWR_FAULT_STATUS1	0xB2
> +#define TPS65086_PWR_FAULT_STATUS2	0xB3
> +#define TPS65086_TEMPCRIT		0xB4
> +#define TPS65086_TEMPHOT		0xB5
> +#define TPS65086_OC_STATUS		0xB6
> +
> +/* IRQ Register field definitions */
> +#define TPS65086_IRQ_DIETEMP_MASK	BIT(0)
> +#define TPS65086_IRQ_SHUTDN_MASK	BIT(3)
> +#define TPS65086_IRQ_FAULT_MASK		BIT(7)
> +
> +/* DEVICEID Register field definitions */
> +#define TPS65086_DEVICEID_PART_MASK	GENMASK(3, 0)
> +#define TPS65086_DEVICEID_OTP_MASK	GENMASK(5, 4)
> +#define TPS65086_DEVICEID_REV_MASK	GENMASK(7, 6)
> +
> +/* VID Masks */
> +#define BUCK_VID_MASK			GENMASK(7, 1)
> +#define VDOA1_VID_MASK			GENMASK(4, 1)
> +#define VDOA23_VID_MASK			GENMASK(3, 0)
> +
> +/* Define the TPS65086 IRQ numbers */
> +enum tps65086_irqs {
> +	TPS65086_IRQ_DIETEMP,
> +	TPS65086_IRQ_SHUTDN,
> +	TPS65086_IRQ_FAULT,
> +};
> +
> +/**
> + * struct tps65086 - state holder for the tps65086 driver
> + *
> + * Device data may be used to access the TPS65086 chip
> + */
> +struct tps65086 {
> +	struct device *dev;
> +	struct regmap *regmap;
> +
> +	/* IRQ Data */
> +	int irq;
> +	struct regmap_irq_chip_data *irq_data;
> +};
> +
> +#endif /* __LINUX_MFD_TPS65086_H */

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v6 3/3] gpio: tps65086: Add GPO driver for the TPS65086 PMIC
  2016-01-26 14:38       ` Andrew F. Davis
@ 2016-01-27  7:29           ` Lee Jones
  -1 siblings, 0 replies; 22+ messages in thread
From: Lee Jones @ 2016-01-27  7:29 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Liam Girdwood,
	Mark Brown, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Tue, 26 Jan 2016, Andrew F. Davis wrote:

> On 01/26/2016 08:03 AM, Lee Jones wrote:
> >On Mon, 25 Jan 2016, Andrew F. Davis wrote:
> >
> >>Add support for the TPS65086 PMIC GPOs.
> >>
> >>TPS65086 has four configurable GPOs that can be used for several
> >>purposes. These are output only.
> >>
> >>Signed-off-by: Andrew F. Davis <afd-l0cyMroinI0@public.gmane.org>
> >>---
> >>  drivers/gpio/Kconfig         |   6 ++
> >>  drivers/gpio/Makefile        |   1 +
> >>  drivers/gpio/gpio-tps65086.c | 144 +++++++++++++++++++++++++++++++++++++++++++
> >>  3 files changed, 151 insertions(+)
> >>  create mode 100644 drivers/gpio/gpio-tps65086.c
> >
> >Is this patch orthogonal to the other two in the set, or do they all
> >need to go in together?
> 
> These can all go in separately, in fact Mark has already taken the regulator
> component from a previous push of this series. It is only the TPS65912
> driver I'm pushing that will need to go all at once due to conflicts with
> the driver it is replacing.

Very well.  MFD patches taken.

Linus should take this through his tree.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v6 3/3] gpio: tps65086: Add GPO driver for the TPS65086 PMIC
@ 2016-01-27  7:29           ` Lee Jones
  0 siblings, 0 replies; 22+ messages in thread
From: Lee Jones @ 2016-01-27  7:29 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Linus Walleij, Alexandre Courbot, Samuel Ortiz, Liam Girdwood,
	Mark Brown, devicetree, linux-gpio, linux-kernel

On Tue, 26 Jan 2016, Andrew F. Davis wrote:

> On 01/26/2016 08:03 AM, Lee Jones wrote:
> >On Mon, 25 Jan 2016, Andrew F. Davis wrote:
> >
> >>Add support for the TPS65086 PMIC GPOs.
> >>
> >>TPS65086 has four configurable GPOs that can be used for several
> >>purposes. These are output only.
> >>
> >>Signed-off-by: Andrew F. Davis <afd@ti.com>
> >>---
> >>  drivers/gpio/Kconfig         |   6 ++
> >>  drivers/gpio/Makefile        |   1 +
> >>  drivers/gpio/gpio-tps65086.c | 144 +++++++++++++++++++++++++++++++++++++++++++
> >>  3 files changed, 151 insertions(+)
> >>  create mode 100644 drivers/gpio/gpio-tps65086.c
> >
> >Is this patch orthogonal to the other two in the set, or do they all
> >need to go in together?
> 
> These can all go in separately, in fact Mark has already taken the regulator
> component from a previous push of this series. It is only the TPS65912
> driver I'm pushing that will need to go all at once due to conflicts with
> the driver it is replacing.

Very well.  MFD patches taken.

Linus should take this through his tree.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v6 3/3] gpio: tps65086: Add GPO driver for the TPS65086 PMIC
  2016-01-25 15:50   ` Andrew F. Davis
  (?)
  (?)
@ 2016-02-05 14:43   ` Linus Walleij
  2016-02-06 16:11     ` Andrew F. Davis
  -1 siblings, 1 reply; 22+ messages in thread
From: Linus Walleij @ 2016-02-05 14:43 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Alexandre Courbot, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, devicetree, linux-gpio, linux-kernel

On Mon, Jan 25, 2016 at 4:50 PM, Andrew F. Davis <afd@ti.com> wrote:

> Add support for the TPS65086 PMIC GPOs.
>
> TPS65086 has four configurable GPOs that can be used for several
> purposes. These are output only.
>
> Signed-off-by: Andrew F. Davis <afd@ti.com>
(...)
> +static inline struct tps65086_gpio *to_tps65086_gpio(struct gpio_chip *chip)
> +{
> +       return container_of(chip, struct tps65086_gpio, chip);
> +}

Remove this and use gpiochip_get_data() instead.

> +       ret = gpiochip_add(&gpio->chip);

And use gpiochip_add_data() to pass what gpiochip_get_data()
will return.

Apart from that no strong opinions.

If there is a header file dependency this either has to go to
Lee's tree with my ACK, or wait until the next kernel cycle.
But first change the above.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v6 3/3] gpio: tps65086: Add GPO driver for the TPS65086 PMIC
  2016-02-05 14:43   ` Linus Walleij
@ 2016-02-06 16:11     ` Andrew F. Davis
  0 siblings, 0 replies; 22+ messages in thread
From: Andrew F. Davis @ 2016-02-06 16:11 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Alexandre Courbot, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, devicetree, linux-gpio, linux-kernel

On 02/05/2016 08:43 AM, Linus Walleij wrote:
> On Mon, Jan 25, 2016 at 4:50 PM, Andrew F. Davis <afd@ti.com> wrote:
>
>> Add support for the TPS65086 PMIC GPOs.
>>
>> TPS65086 has four configurable GPOs that can be used for several
>> purposes. These are output only.
>>
>> Signed-off-by: Andrew F. Davis <afd@ti.com>
> (...)
>> +static inline struct tps65086_gpio *to_tps65086_gpio(struct gpio_chip *chip)
>> +{
>> +       return container_of(chip, struct tps65086_gpio, chip);
>> +}
>
> Remove this and use gpiochip_get_data() instead.
>
>> +       ret = gpiochip_add(&gpio->chip);
>
> And use gpiochip_add_data() to pass what gpiochip_get_data()
> will return.
>
> Apart from that no strong opinions.
>
> If there is a header file dependency this either has to go to
> Lee's tree with my ACK, or wait until the next kernel cycle.
> But first change the above.
>
> Yours,
> Linus Walleij
>

Changes made, I will resend this part as its own patch as the other components
have been taken.

Thanks,
Andrew

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2016-02-06 16:11 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-25 15:50 [PATCH v6 0/3] Add support for the TI TPS65086 PMIC Andrew F. Davis
2016-01-25 15:50 ` Andrew F. Davis
2016-01-25 15:50 ` [PATCH v6 1/3] Documentation: tps65086: Add DT bindings for the " Andrew F. Davis
2016-01-25 15:50   ` Andrew F. Davis
     [not found]   ` <1453737012-3130-2-git-send-email-afd-l0cyMroinI0@public.gmane.org>
2016-01-26 14:02     ` Lee Jones
2016-01-26 14:02       ` Lee Jones
2016-01-27  7:28   ` Lee Jones
2016-01-27  7:28     ` Lee Jones
2016-01-25 15:50 ` [PATCH v6 2/3] mfd: tps65086: Add driver " Andrew F. Davis
2016-01-25 15:50   ` Andrew F. Davis
2016-01-27  7:29   ` Lee Jones
2016-01-27  7:29     ` Lee Jones
2016-01-25 15:50 ` [PATCH v6 3/3] gpio: tps65086: Add GPO " Andrew F. Davis
2016-01-25 15:50   ` Andrew F. Davis
2016-01-26 14:03   ` Lee Jones
2016-01-26 14:03     ` Lee Jones
2016-01-26 14:38     ` Andrew F. Davis
2016-01-26 14:38       ` Andrew F. Davis
     [not found]       ` <56A784CC.4090902-l0cyMroinI0@public.gmane.org>
2016-01-27  7:29         ` Lee Jones
2016-01-27  7:29           ` Lee Jones
2016-02-05 14:43   ` Linus Walleij
2016-02-06 16:11     ` Andrew F. Davis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.