All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings
@ 2017-04-16 18:07 Marek Vasut
  2017-04-16 18:07 ` [PATCH 2/4] mfd: Add ROHM BD9571MWV-M MFD PMIC driver Marek Vasut
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Marek Vasut @ 2017-04-16 18:07 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Marek Vasut, devicetree, Rob Herring, Geert Uytterhoeven

Add DT bindings for the ROHM BD9571MWV-M PMIC. This PMIC has
the following features:
- multiple voltage monitors for 1V8, 2V5, 3V3 voltage rail
- one voltage regulator for DVFS
- two GPIOs

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: devicetree@vger.kernel.org
Cc: Rob Herring <robh@kernel.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: linux-renesas-soc@vger.kernel.org
---
 .../devicetree/bindings/mfd/bd9571mwv.txt          | 49 ++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/bd9571mwv.txt

diff --git a/Documentation/devicetree/bindings/mfd/bd9571mwv.txt b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt
new file mode 100644
index 000000000000..0952ee3bc30b
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt
@@ -0,0 +1,49 @@
+* ROHM BD9571MWV Power Management Integrated Circuit (PMIC) bindings
+
+Required properties:
+ - compatible		: Should be "rohm,bd9571mwv".
+ - 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:
+			     - vd18
+			     - vd25
+			     - vd33
+			     - dvfs
+			    Each child node is defined using the standard
+			    binding for regulators.
+
+Example:
+
+	pmic: bd9571mwv@30 {
+		compatible = "rohm,bd9571mwv";
+		reg = <0x30>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+		gpio-controller;
+		#gpio-cells = <2>;
+
+		regulators {
+			dvfs: dvfs {
+				compatible = "regulator-fixed";
+				regulator-name = "dvfs";
+				regulator-min-microvolt = <750000>;
+				regulator-max-microvolt = <1030000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+		};
+	};
-- 
2.11.0

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

* [PATCH 2/4] mfd: Add ROHM BD9571MWV-M MFD PMIC driver
  2017-04-16 18:07 [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings Marek Vasut
@ 2017-04-16 18:07 ` Marek Vasut
  2017-04-24 11:38   ` Lee Jones
  2017-04-16 18:08 ` [PATCH 3/4] gpio: Add ROHM BD9571MWV-M PMIC GPIO driver Marek Vasut
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: Marek Vasut @ 2017-04-16 18:07 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Marek Vasut, linux-kernel, Geert Uytterhoeven, Lee Jones

Add the MFD part of the ROHM BD9571MWV-M PMIC driver and MAINTAINERS
entry. The MFD part only specifies the regmap bits for the PMIC and
binds the subdevs together.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
---
 MAINTAINERS                   |  11 ++
 drivers/mfd/Kconfig           |  13 +++
 drivers/mfd/Makefile          |   1 +
 drivers/mfd/bd9571mwv.c       | 226 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/bd9571mwv.h | 120 ++++++++++++++++++++++
 5 files changed, 371 insertions(+)
 create mode 100644 drivers/mfd/bd9571mwv.c
 create mode 100644 include/linux/mfd/bd9571mwv.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 892e958f6e50..90a96ee06ee4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10868,6 +10868,17 @@ L:	linux-serial@vger.kernel.org
 S:	Odd Fixes
 F:	drivers/tty/serial/rp2.*
 
+ROHM MULTIFUNCTION BD9571MWV-M PMIC DEVICE DRIVERS
+M:	Marek Vasut <marek.vasut+renesas@gmail.com>
+L:	linux-kernel@vger.kernel.org
+L:	linux-renesas-soc@vger.kernel.org
+S:	Supported
+F:	drivers/mfd/bd9571mwv.c
+F:	drivers/regulator/bd9571mwv-regulator.c
+F:	drivers/gpio/gpio-bd9571mwv.c
+F:	include/linux/mfd/bd9571mwv.h
+F:	Documentation/devicetree/bindings/mfd/bd9571mwv.txt
+
 ROSE NETWORK LAYER
 M:	Ralf Baechle <ralf@linux-mips.org>
 L:	linux-hams@vger.kernel.org
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index de68b5ba8741..fa1f41ef5332 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -133,6 +133,19 @@ config MFD_BCM590XX
 	help
 	  Support for the BCM590xx PMUs from Broadcom
 
+config MFD_BD9571MWV
+	tristate "ROHM BD9571MWV PMIC"
+	select MFD_CORE
+	select REGMAP_I2C
+	depends on I2C
+	help
+	  Support for the ROHM BD9571MWV PMIC, which contains single
+	  voltage regulator, voltage sampling units, GPIO block and
+	  watchdog block.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called bd9571mwv.
+
 config MFD_AC100
 	tristate "X-Powers AC100"
 	select MFD_CORE
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index fa86dbe65e52..e2c82d2b108d 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_MFD_ACT8945A)	+= act8945a.o
 obj-$(CONFIG_MFD_SM501)		+= sm501.o
 obj-$(CONFIG_MFD_ASIC3)		+= asic3.o tmio_core.o
 obj-$(CONFIG_MFD_BCM590XX)	+= bcm590xx.o
+obj-$(CONFIG_MFD_BD9571MWV)	+= bd9571mwv.o
 cros_ec_core-objs		:= cros_ec.o
 cros_ec_core-$(CONFIG_ACPI)	+= cros_ec_acpi_gpe.o
 obj-$(CONFIG_MFD_CROS_EC)	+= cros_ec_core.o
diff --git a/drivers/mfd/bd9571mwv.c b/drivers/mfd/bd9571mwv.c
new file mode 100644
index 000000000000..7382cdf308e8
--- /dev/null
+++ b/drivers/mfd/bd9571mwv.c
@@ -0,0 +1,226 @@
+/*
+ * ROHM BD9571MWV-M MFD driver
+ *
+ * Copyright (C) 2017 Marek Vasut <marek.vasut+renesas@gmail.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 TPS65086 driver
+ */
+
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/mfd/core.h>
+#include <linux/module.h>
+
+#include <linux/mfd/bd9571mwv.h>
+
+static const struct mfd_cell bd9571mwv_cells[] = {
+	{ .name = "bd9571mwv-regulator", },
+	{ .name = "bd9571mwv-gpio", },
+};
+
+static const struct regmap_range bd9571mwv_readable_yes_ranges[] = {
+	regmap_reg_range(BD9571MWV_VENDOR_CODE, BD9571MWV_PRODUCT_REVISION),
+	regmap_reg_range(BD9571MWV_AVS_SET_MONI, BD9571MWV_AVS_DVFS_VID3),
+	regmap_reg_range(BD9571MWV_VD18_VID, BD9571MWV_VD33_VID),
+	regmap_reg_range(BD9571MWV_DVFS_VINIT, BD9571MWV_DVFS_VINIT),
+	regmap_reg_range(BD9571MWV_DVFS_SETVMAX, BD9571MWV_DVFS_MONIVDAC),
+	regmap_reg_range(BD9571MWV_GPIO_IN, BD9571MWV_GPIO_IN),
+	regmap_reg_range(BD9571MWV_GPIO_INT, BD9571MWV_GPIO_INTMASK),
+	regmap_reg_range(BD9571MWV_INT_INTREQ, BD9571MWV_INT_INTMASK),
+};
+
+static const struct regmap_access_table bd9571mwv_readable_table = {
+	.yes_ranges	= bd9571mwv_readable_yes_ranges,
+	.n_yes_ranges	= ARRAY_SIZE(bd9571mwv_readable_yes_ranges),
+};
+
+static const struct regmap_range bd9571mwv_writable_yes_ranges[] = {
+	regmap_reg_range(BD9571MWV_DVFS_SETVID, BD9571MWV_DVFS_SETVID),
+	regmap_reg_range(BD9571MWV_GPIO_DIR, BD9571MWV_GPIO_OUT),
+	regmap_reg_range(BD9571MWV_GPIO_INT_SET, BD9571MWV_GPIO_INTMASK),
+	regmap_reg_range(BD9571MWV_INT_INTREQ, BD9571MWV_INT_INTMASK),
+};
+
+static const struct regmap_access_table bd9571mwv_writable_table = {
+	.yes_ranges	= bd9571mwv_writable_yes_ranges,
+	.n_yes_ranges	= ARRAY_SIZE(bd9571mwv_writable_yes_ranges),
+};
+
+static const struct regmap_range bd9571mwv_volatile_yes_ranges[] = {
+	regmap_reg_range(BD9571MWV_GPIO_IN, BD9571MWV_GPIO_IN),
+	regmap_reg_range(BD9571MWV_GPIO_INT, BD9571MWV_GPIO_INT),
+	regmap_reg_range(BD9571MWV_INT_INTREQ, BD9571MWV_INT_INTREQ),
+};
+
+static const struct regmap_access_table bd9571mwv_volatile_table = {
+	.yes_ranges	= bd9571mwv_volatile_yes_ranges,
+	.n_yes_ranges	= ARRAY_SIZE(bd9571mwv_volatile_yes_ranges),
+};
+
+static const struct regmap_config bd9571mwv_regmap_config = {
+	.reg_bits	= 8,
+	.val_bits	= 8,
+	.cache_type	= REGCACHE_RBTREE,
+	.rd_table	= &bd9571mwv_readable_table,
+	.wr_table	= &bd9571mwv_writable_table,
+	.volatile_table	= &bd9571mwv_volatile_table,
+	.max_register	= 0xff,
+};
+
+static const struct regmap_irq bd9571mwv_irqs[] = {
+	REGMAP_IRQ_REG(BD9571MWV_IRQ_MD1, 0,
+		       BD9571MWV_INT_INTREQ_MD1_INT),
+	REGMAP_IRQ_REG(BD9571MWV_IRQ_MD2_E1, 0,
+		       BD9571MWV_INT_INTREQ_MD2_E1_INT),
+	REGMAP_IRQ_REG(BD9571MWV_IRQ_MD2_E2, 0,
+		       BD9571MWV_INT_INTREQ_MD2_E2_INT),
+	REGMAP_IRQ_REG(BD9571MWV_IRQ_PROT_ERR, 0,
+		       BD9571MWV_INT_INTREQ_PROT_ERR_INT),
+	REGMAP_IRQ_REG(BD9571MWV_IRQ_GP, 0,
+		       BD9571MWV_INT_INTREQ_GP_INT),
+	REGMAP_IRQ_REG(BD9571MWV_IRQ_128H_OF, 0,
+		       BD9571MWV_INT_INTREQ_128H_OF_INT),
+	REGMAP_IRQ_REG(BD9571MWV_IRQ_WDT_OF, 0,
+		       BD9571MWV_INT_INTREQ_WDT_OF_INT),
+	REGMAP_IRQ_REG(BD9571MWV_IRQ_BKUP_TRG, 0,
+		       BD9571MWV_INT_INTREQ_BKUP_TRG_INT),
+};
+
+static struct regmap_irq_chip bd9571mwv_irq_chip = {
+	.name		= "bd9571mwv",
+	.status_base	= BD9571MWV_INT_INTREQ,
+	.mask_base	= BD9571MWV_INT_INTMASK,
+	.ack_base	= BD9571MWV_INT_INTREQ,
+	.init_ack_masked = true,
+	.num_regs	= 1,
+	.irqs		= bd9571mwv_irqs,
+	.num_irqs	= ARRAY_SIZE(bd9571mwv_irqs),
+};
+
+static int bd9571mwv_identify(struct bd9571mwv *bd)
+{
+	struct device *dev = bd->dev;
+	unsigned int value;
+	int ret;
+
+	ret = regmap_read(bd->regmap, BD9571MWV_VENDOR_CODE, &value);
+	if (ret) {
+		dev_err(dev, "Failed to read vendor code register\n");
+		return ret;
+	}
+
+	if (value != BD9571MWV_VENDOR_CODE_VAL) {
+		dev_err(dev, "Invalid vendor code ID %02x (expected %02x)\n",
+			value, BD9571MWV_VENDOR_CODE_VAL);
+		return -EINVAL;
+	}
+
+	ret = regmap_read(bd->regmap, BD9571MWV_PRODUCT_CODE, &value);
+	if (ret) {
+		dev_err(dev, "Failed to read product code register\n");
+		return ret;
+	}
+
+	if (value != BD9571MWV_PRODUCT_CODE_VAL) {
+		dev_err(dev, "Invalid product code ID %02x (expected %02x)\n",
+			value, BD9571MWV_PRODUCT_CODE_VAL);
+		return -EINVAL;
+	}
+
+	ret = regmap_read(bd->regmap, BD9571MWV_PRODUCT_REVISION, &value);
+	if (ret) {
+		dev_err(dev, "Failed to read revision register\n");
+		return ret;
+	}
+
+	dev_info(dev, "Device: BD9571MWV rev. %d\n", value & 0xff);
+
+	return 0;
+}
+
+static int bd9571mwv_probe(struct i2c_client *client,
+			  const struct i2c_device_id *ids)
+{
+	struct bd9571mwv *bd;
+	int ret;
+
+	bd = devm_kzalloc(&client->dev, sizeof(*bd), GFP_KERNEL);
+	if (!bd)
+		return -ENOMEM;
+
+	i2c_set_clientdata(client, bd);
+	bd->dev = &client->dev;
+	bd->irq = client->irq;
+
+	bd->regmap = devm_regmap_init_i2c(client, &bd9571mwv_regmap_config);
+	if (IS_ERR(bd->regmap)) {
+		dev_err(bd->dev, "Failed to initialize register map\n");
+		return PTR_ERR(bd->regmap);
+	}
+
+	ret = bd9571mwv_identify(bd);
+	if (ret)
+		return ret;
+
+	ret = regmap_add_irq_chip(bd->regmap, bd->irq, IRQF_ONESHOT, 0,
+				  &bd9571mwv_irq_chip, &bd->irq_data);
+	if (ret) {
+		dev_err(bd->dev, "Failed to register IRQ chip\n");
+		return ret;
+	}
+
+	ret = mfd_add_devices(bd->dev, PLATFORM_DEVID_AUTO, bd9571mwv_cells,
+			      ARRAY_SIZE(bd9571mwv_cells), NULL, 0,
+			      regmap_irq_get_domain(bd->irq_data));
+	if (ret) {
+		regmap_del_irq_chip(bd->irq, bd->irq_data);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int bd9571mwv_remove(struct i2c_client *client)
+{
+	struct bd9571mwv *bd = i2c_get_clientdata(client);
+
+	regmap_del_irq_chip(bd->irq, bd->irq_data);
+
+	return 0;
+}
+
+static const struct of_device_id bd9571mwv_of_match_table[] = {
+	{ .compatible = "rohm,bd9571mwv", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, bd9571mwv_of_match_table);
+
+static const struct i2c_device_id bd9571mwv_id_table[] = {
+	{ "bd9571mwv", 0 },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(i2c, bd9571mwv_id_table);
+
+static struct i2c_driver bd9571mwv_driver = {
+	.driver		= {
+		.name	= "bd9571mwv",
+		.of_match_table = bd9571mwv_of_match_table,
+	},
+	.probe		= bd9571mwv_probe,
+	.remove		= bd9571mwv_remove,
+	.id_table       = bd9571mwv_id_table,
+};
+module_i2c_driver(bd9571mwv_driver);
+
+MODULE_AUTHOR("Marek Vasut <marek.vasut+renesas@gmail.com>");
+MODULE_DESCRIPTION("BD9571MWV PMIC Driver");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/mfd/bd9571mwv.h b/include/linux/mfd/bd9571mwv.h
new file mode 100644
index 000000000000..f04f5cccbb1d
--- /dev/null
+++ b/include/linux/mfd/bd9571mwv.h
@@ -0,0 +1,120 @@
+/*
+ * ROHM BD9571MWV-M driver
+ *
+ * Copyright (C) 2017 Marek Vasut <marek.vasut+renesas@gmail.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 TPS65086 driver
+ */
+
+#ifndef __LINUX_MFD_BD9571MWV_H
+#define __LINUX_MFD_BD9571MWV_H
+
+#include <linux/device.h>
+#include <linux/regmap.h>
+
+/* List of registers for BD9571MWV */
+#define BD9571MWV_VENDOR_CODE			0x00
+#define BD9571MWV_VENDOR_CODE_VAL		0xdb
+#define BD9571MWV_PRODUCT_CODE			0x01
+#define BD9571MWV_PRODUCT_CODE_VAL		0x60
+#define BD9571MWV_PRODUCT_REVISION		0x02
+
+#define BD9571MWV_I2C_FUSA_MODE			0x10
+#define BD9571MWV_I2C_MD2_E1_BIT_1		0x11
+#define BD9571MWV_I2C_MD2_E1_BIT_2		0x12
+
+#define BD9571MWV_BKUP_MODE_CNT			0x20
+#define BD9571MWV_BKUP_MODE_STATUS		0x21
+#define BD9571MWV_BKUP_RECOVERY_CNT		0x22
+#define BD9571MWV_BKUP_CTRL_TIM_CNT		0x23
+#define BD9571MWV_WAITBKUP_WDT_CNT		0x24
+#define BD9571MWV_128H_TIM_CNT			0x26
+#define BD9571MWV_QLLM_CNT			0x27
+
+#define BD9571MWV_AVS_SET_MONI			0x31
+#define BD9571MWV_AVS_VD09_VID0			0x32
+#define BD9571MWV_AVS_VD09_VID1			0x33
+#define BD9571MWV_AVS_VD09_VID2			0x34
+#define BD9571MWV_AVS_VD09_VID3			0x35
+#define BD9571MWV_AVS_DVFS_VID0			0x36
+#define BD9571MWV_AVS_DVFS_VID1			0x37
+#define BD9571MWV_AVS_DVFS_VID2			0x38
+#define BD9571MWV_AVS_DVFS_VID3			0x39
+
+#define BD9571MWV_VD18_VID			0x42
+#define BD9571MWV_VD25_VID			0x43
+#define BD9571MWV_VD33_VID			0x44
+
+#define BD9571MWV_DVFS_VINIT			0x50
+#define BD9571MWV_DVFS_SETVMAX			0x52
+#define BD9571MWV_DVFS_BOOSTVID			0x53
+#define BD9571MWV_DVFS_SETVID			0x54
+#define BD9571MWV_DVFS_MONIVDAC			0x55
+#define BD9571MWV_DVFS_PGD_CNT			0x56
+
+#define BD9571MWV_GPIO_DIR			0x60
+#define BD9571MWV_GPIO_OUT			0x61
+#define BD9571MWV_GPIO_IN			0x62
+#define BD9571MWV_GPIO_DEB			0x63
+#define BD9571MWV_GPIO_INT_SET			0x64
+#define BD9571MWV_GPIO_INT			0x65
+#define BD9571MWV_GPIO_INTMASK			0x66
+
+#define BD9571MWV_REG_KEEP(n)			(0x70 + (n))
+
+#define BD9571MWV_PMIC_INTERNAL_STATUS		0x80
+#define BD9571MWV_PROT_ERROR_STATUS0		0x81
+#define BD9571MWV_PROT_ERROR_STATUS1		0x82
+#define BD9571MWV_PROT_ERROR_STATUS2		0x83
+#define BD9571MWV_PROT_ERROR_STATUS3		0x84
+#define BD9571MWV_PROT_ERROR_STATUS4		0x85
+
+#define BD9571MWV_INT_INTREQ			0x90
+#define BD9571MWV_INT_INTREQ_MD1_INT		BIT(0)
+#define BD9571MWV_INT_INTREQ_MD2_E1_INT		BIT(1)
+#define BD9571MWV_INT_INTREQ_MD2_E2_INT		BIT(2)
+#define BD9571MWV_INT_INTREQ_PROT_ERR_INT	BIT(3)
+#define BD9571MWV_INT_INTREQ_GP_INT		BIT(4)
+#define BD9571MWV_INT_INTREQ_128H_OF_INT	BIT(5)
+#define BD9571MWV_INT_INTREQ_WDT_OF_INT		BIT(6)
+#define BD9571MWV_INT_INTREQ_BKUP_TRG_INT	BIT(7)
+#define BD9571MWV_INT_INTMASK			0x91
+
+#define BD9571MWV_ACCESS_KEY			0xff
+
+/* Define the BD9571MWV IRQ numbers */
+enum bd9571mwv_irqs {
+	BD9571MWV_IRQ_MD1,
+	BD9571MWV_IRQ_MD2_E1,
+	BD9571MWV_IRQ_MD2_E2,
+	BD9571MWV_IRQ_PROT_ERR,
+	BD9571MWV_IRQ_GP,
+	BD9571MWV_IRQ_128H_OF,
+	BD9571MWV_IRQ_WDT_OF,
+	BD9571MWV_IRQ_BKUP_TRG,
+};
+
+/**
+ * struct bd9571mwv - state holder for the bd9571mwv driver
+ *
+ * Device data may be used to access the BD9571MWV chip
+ */
+struct bd9571mwv {
+	struct device *dev;
+	struct regmap *regmap;
+
+	/* IRQ Data */
+	int irq;
+	struct regmap_irq_chip_data *irq_data;
+};
+
+#endif /* __LINUX_MFD_BD9571MWV_H */
-- 
2.11.0

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

* [PATCH 3/4] gpio: Add ROHM BD9571MWV-M PMIC GPIO driver
  2017-04-16 18:07 [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings Marek Vasut
  2017-04-16 18:07 ` [PATCH 2/4] mfd: Add ROHM BD9571MWV-M MFD PMIC driver Marek Vasut
@ 2017-04-16 18:08 ` Marek Vasut
  2017-04-24 13:55   ` Linus Walleij
  2017-04-16 18:08 ` [PATCH 4/4] regulator: Add ROHM BD9571MWV-M PMIC regulator driver Marek Vasut
  2017-04-20 12:35 ` [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings Geert Uytterhoeven
  3 siblings, 1 reply; 16+ messages in thread
From: Marek Vasut @ 2017-04-16 18:08 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Marek Vasut, linux-gpio, Geert Uytterhoeven, Linus Walleij

Add driver for the GPIO block in the ROHM BD9571MWV-W MFD PMIC.
This block is pretty trivial and supports setting GPIO direction
as Input/Output and in case of Output, supports setting value.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: linux-gpio@vger.kernel.org
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/Kconfig          |  11 ++++
 drivers/gpio/Makefile         |   1 +
 drivers/gpio/gpio-bd9571mwv.c | 144 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 156 insertions(+)
 create mode 100644 drivers/gpio/gpio-bd9571mwv.c

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 63ceed246b6f..62f810a8663c 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -844,6 +844,17 @@ config GPIO_ARIZONA
 	help
 	  Support for GPIOs on Wolfson Arizona class devices.
 
+config GPIO_BD9571MWV
+	tristate "ROHM BD9571 GPIO support"
+	depends on MFD_BD9571MWV
+	help
+	  Support for GPIOs on ROHM BD9571 PMIC. There are two GPIOs
+	  available on the ROHM PMIC in total, both of which can also
+	  generate interrupts.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called gpio-bd9571mwv.
+
 config GPIO_CRYSTAL_COVE
 	tristate "GPIO support for Crystal Cove PMIC"
 	depends on (X86 || COMPILE_TEST) && INTEL_SOC_PMIC
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 095598e856ca..68b96277d9fa 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_GPIO_ATH79)	+= gpio-ath79.o
 obj-$(CONFIG_GPIO_ASPEED)	+= gpio-aspeed.o
 obj-$(CONFIG_GPIO_AXP209)	+= gpio-axp209.o
 obj-$(CONFIG_GPIO_BCM_KONA)	+= gpio-bcm-kona.o
+obj-$(CONFIG_GPIO_BD9571MWV)	+= gpio-bd9571mwv.o
 obj-$(CONFIG_GPIO_BRCMSTB)	+= gpio-brcmstb.o
 obj-$(CONFIG_GPIO_BT8XX)	+= gpio-bt8xx.o
 obj-$(CONFIG_GPIO_CLPS711X)	+= gpio-clps711x.o
diff --git a/drivers/gpio/gpio-bd9571mwv.c b/drivers/gpio/gpio-bd9571mwv.c
new file mode 100644
index 000000000000..8495f25c735a
--- /dev/null
+++ b/drivers/gpio/gpio-bd9571mwv.c
@@ -0,0 +1,144 @@
+/*
+ * ROHM BD9571MWV-M GPIO driver
+ *
+ * Copyright (C) 2017 Marek Vasut <marek.vasut+renesas@gmail.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 TPS65086 driver
+ *
+ * NOTE: Interrupts are not supported yet.
+ */
+
+#include <linux/gpio.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+#include <linux/mfd/bd9571mwv.h>
+
+struct bd9571mwv_gpio {
+	struct gpio_chip chip;
+	struct bd9571mwv *bd;
+};
+
+static int bd9571mwv_gpio_get_direction(struct gpio_chip *chip,
+				       unsigned int offset)
+{
+	struct bd9571mwv_gpio *gpio = gpiochip_get_data(chip);
+	int ret, val;
+
+	ret = regmap_read(gpio->bd->regmap, BD9571MWV_GPIO_DIR, &val);
+	if (ret < 0)
+		return ret;
+
+	return val & BIT(offset);
+}
+
+static int bd9571mwv_gpio_direction_input(struct gpio_chip *chip,
+					 unsigned int offset)
+{
+	struct bd9571mwv_gpio *gpio = gpiochip_get_data(chip);
+
+	regmap_update_bits(gpio->bd->regmap, BD9571MWV_GPIO_DIR,
+			   BIT(offset), 0);
+
+	return 0;
+}
+
+static int bd9571mwv_gpio_direction_output(struct gpio_chip *chip,
+					  unsigned int offset, int value)
+{
+	struct bd9571mwv_gpio *gpio = gpiochip_get_data(chip);
+
+	/* Set the initial value */
+	regmap_update_bits(gpio->bd->regmap, BD9571MWV_GPIO_OUT,
+			   BIT(offset), value ? BIT(offset) : 0);
+	regmap_update_bits(gpio->bd->regmap, BD9571MWV_GPIO_DIR,
+			   BIT(offset), BIT(offset));
+
+	return 0;
+}
+
+static int bd9571mwv_gpio_get(struct gpio_chip *chip, unsigned int offset)
+{
+	struct bd9571mwv_gpio *gpio = gpiochip_get_data(chip);
+	int ret, val;
+
+	ret = regmap_read(gpio->bd->regmap, BD9571MWV_GPIO_IN, &val);
+	if (ret < 0)
+		return ret;
+
+	return val & BIT(offset);
+}
+
+static void bd9571mwv_gpio_set(struct gpio_chip *chip, unsigned int offset,
+			      int value)
+{
+	struct bd9571mwv_gpio *gpio = gpiochip_get_data(chip);
+
+	regmap_update_bits(gpio->bd->regmap, BD9571MWV_GPIO_OUT,
+			   BIT(offset), value ? BIT(offset) : 0);
+}
+
+static const struct gpio_chip template_chip = {
+	.label			= "bd9571mwv-gpio",
+	.owner			= THIS_MODULE,
+	.get_direction		= bd9571mwv_gpio_get_direction,
+	.direction_input	= bd9571mwv_gpio_direction_input,
+	.direction_output	= bd9571mwv_gpio_direction_output,
+	.get			= bd9571mwv_gpio_get,
+	.set			= bd9571mwv_gpio_set,
+	.base			= -1,
+	.ngpio			= 2,
+	.can_sleep		= true,
+};
+
+static int bd9571mwv_gpio_probe(struct platform_device *pdev)
+{
+	struct bd9571mwv_gpio *gpio;
+	int ret;
+
+	gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
+	if (!gpio)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, gpio);
+
+	gpio->bd = dev_get_drvdata(pdev->dev.parent);
+	gpio->chip = template_chip;
+	gpio->chip.parent = gpio->bd->dev;
+
+	ret = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static const struct platform_device_id bd9571mwv_gpio_id_table[] = {
+	{ "bd9571mwv-gpio", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, bd9571mwv_gpio_id_table);
+
+static struct platform_driver bd9571mwv_gpio_driver = {
+	.driver = {
+		.name = "bd9571mwv-gpio",
+	},
+	.probe = bd9571mwv_gpio_probe,
+	.id_table = bd9571mwv_gpio_id_table,
+};
+module_platform_driver(bd9571mwv_gpio_driver);
+
+MODULE_AUTHOR("Marek Vasut <marek.vasut+renesas@gmail.com>");
+MODULE_DESCRIPTION("BD9571MWV GPIO driver");
+MODULE_LICENSE("GPL v2");
-- 
2.11.0

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

* [PATCH 4/4] regulator: Add ROHM BD9571MWV-M PMIC regulator driver
  2017-04-16 18:07 [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings Marek Vasut
  2017-04-16 18:07 ` [PATCH 2/4] mfd: Add ROHM BD9571MWV-M MFD PMIC driver Marek Vasut
  2017-04-16 18:08 ` [PATCH 3/4] gpio: Add ROHM BD9571MWV-M PMIC GPIO driver Marek Vasut
@ 2017-04-16 18:08 ` Marek Vasut
  2017-04-18 17:57   ` Mark Brown
  2017-04-20 12:35 ` [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings Geert Uytterhoeven
  3 siblings, 1 reply; 16+ messages in thread
From: Marek Vasut @ 2017-04-16 18:08 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Marek Vasut, linux-kernel, Liam Girdwood, Mark Brown, Geert Uytterhoeven

Add driver for the regulator block in the ROHM BD9571MWV-W MFD PMIC.
This block supports three voltage monitors, VD18, VD25, VD33 for the
1V8, 2V5, 3V3 voltage rails and a single voltage regulator for the
DVFS rail.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/regulator/Kconfig               |  11 +++
 drivers/regulator/Makefile              |   1 +
 drivers/regulator/bd9571mwv-regulator.c | 132 ++++++++++++++++++++++++++++++++
 3 files changed, 144 insertions(+)
 create mode 100644 drivers/regulator/bd9571mwv-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 290eeb88832c..b6e512df6df4 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -163,6 +163,17 @@ config REGULATOR_BCM590XX
 	  BCM590xx PMUs. This will enable support for the software
 	  controllable LDO/Switching regulators.
 
+config REGULATOR_BD9571MWV
+	tristate "ROHM BD9571MWV Regulators"
+	depends on MFD_BD9571MWV
+	help
+	  This driver provides support for the voltage regulators on the
+	  ROHM BD9571MWV PMIC. This will enable support for the software
+	  controllable regulator and voltage sampling units.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called bd9571mwv-regulator.
+
 config REGULATOR_CPCAP
 	tristate "Motorola CPCAP regulator"
 	depends on MFD_CPCAP
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index bf5ed7a9df99..c777c8493bf7 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o
 obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o
 obj-$(CONFIG_REGULATOR_AXP20X) += axp20x-regulator.o
 obj-$(CONFIG_REGULATOR_BCM590XX) += bcm590xx-regulator.o
+obj-$(CONFIG_REGULATOR_BD9571MWV) += bd9571mwv-regulator.o
 obj-$(CONFIG_REGULATOR_DA903X)	+= da903x.o
 obj-$(CONFIG_REGULATOR_DA9052)	+= da9052-regulator.o
 obj-$(CONFIG_REGULATOR_DA9055)	+= da9055-regulator.o
diff --git a/drivers/regulator/bd9571mwv-regulator.c b/drivers/regulator/bd9571mwv-regulator.c
new file mode 100644
index 000000000000..7df369ad0b13
--- /dev/null
+++ b/drivers/regulator/bd9571mwv-regulator.c
@@ -0,0 +1,132 @@
+/*
+ * ROHM BD9571MWV-M regulator driver
+ *
+ * Copyright (C) 2017 Marek Vasut <marek.vasut+renesas@gmail.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 TPS65086 driver
+ *
+ * NOTE: VD09 is missing
+ */
+
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regulator/driver.h>
+
+#include <linux/mfd/bd9571mwv.h>
+
+enum bd9571mwv_regulators { VD18, VD25, VD33, DVFS };
+
+#define BD9571MWV_REG(_name, _of, _id, _ops, _vr, _vm, _nv, _min, _step, _lmin)\
+	{							\
+		.name			= _name,		\
+		.of_match		= of_match_ptr(_of),	\
+		.regulators_node	= "regulators",		\
+		.id			= _id,			\
+		.ops			= &_ops,		\
+		.n_voltages		= _nv,			\
+		.type			= REGULATOR_VOLTAGE,	\
+		.owner			= THIS_MODULE,		\
+		.vsel_reg		= _vr,			\
+		.vsel_mask		= _vm,			\
+		.min_uV			= _min,			\
+		.uV_step		= _step,		\
+		.linear_min_sel		= _lmin,		\
+	}
+
+static int bd9571mwv_regulator_is_enabled(struct regulator_dev *reg)
+{
+	/* Always enabled. */
+	return 1;
+}
+
+int bd9571mwv_set_voltage_sel_regmap(struct regulator_dev *rdev,
+				     unsigned int sel)
+{
+	return regmap_write_bits(rdev->regmap, BD9571MWV_DVFS_SETVID,
+				 rdev->desc->vsel_mask, sel);
+}
+
+/* Operations permitted on voltage regulators */
+static struct regulator_ops reg_ops = {
+	.is_enabled		= bd9571mwv_regulator_is_enabled,
+	.set_voltage_sel	= bd9571mwv_set_voltage_sel_regmap,
+	.map_voltage		= regulator_map_voltage_linear,
+	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
+	.list_voltage		= regulator_list_voltage_linear,
+};
+
+/* Operations permitted on voltage monitors */
+static struct regulator_ops vid_ops = {
+	.is_enabled		= bd9571mwv_regulator_is_enabled,
+	.map_voltage		= regulator_map_voltage_linear,
+	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
+	.list_voltage		= regulator_list_voltage_linear,
+};
+
+static struct regulator_desc regulators[] = {
+	BD9571MWV_REG("VD18", "vd18", VD18, vid_ops, BD9571MWV_VD18_VID, 0xf,
+		      16, 1625000, 25000, 0),
+	BD9571MWV_REG("VD25", "vd25", VD25, vid_ops, BD9571MWV_VD25_VID, 0xf,
+		      16, 2150000, 50000, 0),
+	BD9571MWV_REG("VD33", "vd33", VD33, vid_ops, BD9571MWV_VD33_VID, 0xf,
+		      11, 2800000, 100000, 0),
+	BD9571MWV_REG("DVFS", "dvfs", DVFS, reg_ops,
+		      BD9571MWV_DVFS_MONIVDAC, 0x7f,
+		      0x80, 600000, 10000, 0x3c),
+};
+
+static int bd9571mwv_regulator_probe(struct platform_device *pdev)
+{
+	struct bd9571mwv *bd = dev_get_drvdata(pdev->dev.parent);
+	struct regulator_config config = { };
+	struct regulator_dev *rdev;
+	int i;
+
+	platform_set_drvdata(pdev, bd);
+
+	config.dev = &pdev->dev;
+	config.dev->of_node = bd->dev->of_node;
+	config.driver_data = bd;
+	config.regmap = bd->regmap;
+
+	for (i = 0; i < ARRAY_SIZE(regulators); i++) {
+		rdev = devm_regulator_register(&pdev->dev, &regulators[i],
+					       &config);
+		if (IS_ERR(rdev)) {
+			dev_err(bd->dev, "failed to register %s regulator\n",
+				pdev->name);
+			return PTR_ERR(rdev);
+		}
+	}
+
+	return 0;
+}
+
+static const struct platform_device_id bd9571mwv_regulator_id_table[] = {
+	{ "bd9571mwv-regulator", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, bd9571mwv_regulator_id_table);
+
+static struct platform_driver bd9571mwv_regulator_driver = {
+	.driver = {
+		.name = "bd9571mwv-regulator",
+	},
+	.probe = bd9571mwv_regulator_probe,
+	.id_table = bd9571mwv_regulator_id_table,
+};
+module_platform_driver(bd9571mwv_regulator_driver);
+
+MODULE_AUTHOR("Marek Vasut <marek.vasut+renesas@gmail.com>");
+MODULE_DESCRIPTION("BD9571MWV Regulator driver");
+MODULE_LICENSE("GPL v2");
-- 
2.11.0

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

* Re: [PATCH 4/4] regulator: Add ROHM BD9571MWV-M PMIC regulator driver
  2017-04-16 18:08 ` [PATCH 4/4] regulator: Add ROHM BD9571MWV-M PMIC regulator driver Marek Vasut
@ 2017-04-18 17:57   ` Mark Brown
  2017-04-18 18:39     ` Marek Vasut
  0 siblings, 1 reply; 16+ messages in thread
From: Mark Brown @ 2017-04-18 17:57 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-renesas-soc, Marek Vasut, linux-kernel, Liam Girdwood,
	Geert Uytterhoeven

[-- Attachment #1: Type: text/plain, Size: 553 bytes --]

On Sun, Apr 16, 2017 at 08:08:01PM +0200, Marek Vasut wrote:

This looks good, a couple of minor things though:

> +static int bd9571mwv_regulator_is_enabled(struct regulator_dev *reg)
> +{
> +	/* Always enabled. */
> +	return 1;
> +}

This should be the default implementation, no need to open code it.

> +int bd9571mwv_set_voltage_sel_regmap(struct regulator_dev *rdev,
> +				     unsigned int sel)
> +{
> +	return regmap_write_bits(rdev->regmap, BD9571MWV_DVFS_SETVID,
> +				 rdev->desc->vsel_mask, sel);
> +}

regulator_set_voltage_sel_regmap().

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] regulator: Add ROHM BD9571MWV-M PMIC regulator driver
  2017-04-18 17:57   ` Mark Brown
@ 2017-04-18 18:39     ` Marek Vasut
  0 siblings, 0 replies; 16+ messages in thread
From: Marek Vasut @ 2017-04-18 18:39 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-renesas-soc, Marek Vasut, linux-kernel, Liam Girdwood,
	Geert Uytterhoeven

On 04/18/2017 07:57 PM, Mark Brown wrote:
> On Sun, Apr 16, 2017 at 08:08:01PM +0200, Marek Vasut wrote:
> 
> This looks good, a couple of minor things though:
> 
>> +static int bd9571mwv_regulator_is_enabled(struct regulator_dev *reg)
>> +{
>> +	/* Always enabled. */
>> +	return 1;
>> +}
> 
> This should be the default implementation, no need to open code it.

Fixed.

>> +int bd9571mwv_set_voltage_sel_regmap(struct regulator_dev *rdev,
>> +				     unsigned int sel)
>> +{
>> +	return regmap_write_bits(rdev->regmap, BD9571MWV_DVFS_SETVID,
>> +				 rdev->desc->vsel_mask, sel);
>> +}
> 
> regulator_set_voltage_sel_regmap().

I'm using different register for reading and setting the voltage, so
this doesn't work in this case. Plus these two registers have different
format to make it more fun.

-- 
Best regards,
Marek Vasut

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

* Re: [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings
  2017-04-16 18:07 [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings Marek Vasut
                   ` (2 preceding siblings ...)
  2017-04-16 18:08 ` [PATCH 4/4] regulator: Add ROHM BD9571MWV-M PMIC regulator driver Marek Vasut
@ 2017-04-20 12:35 ` Geert Uytterhoeven
       [not found]   ` <CAMuHMdUUkZ_si8DAmvY_KvNF8tO=q2wHzjqRCjxXJD3-XxxJFw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  3 siblings, 1 reply; 16+ messages in thread
From: Geert Uytterhoeven @ 2017-04-20 12:35 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Linux-Renesas, Marek Vasut, devicetree, Rob Herring, Geert Uytterhoeven

Hi Marek,

On Sun, Apr 16, 2017 at 8:07 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> Add DT bindings for the ROHM BD9571MWV-M PMIC. This PMIC has
> the following features:
> - multiple voltage monitors for 1V8, 2V5, 3V3 voltage rail
> - one voltage regulator for DVFS
> - two GPIOs
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: devicetree@vger.kernel.org
> Cc: Rob Herring <robh@kernel.org>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: linux-renesas-soc@vger.kernel.org
> ---
>  .../devicetree/bindings/mfd/bd9571mwv.txt          | 49 ++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/bd9571mwv.txt
>
> diff --git a/Documentation/devicetree/bindings/mfd/bd9571mwv.txt b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt
> new file mode 100644
> index 000000000000..0952ee3bc30b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt
> @@ -0,0 +1,49 @@
> +* ROHM BD9571MWV Power Management Integrated Circuit (PMIC) bindings
> +
> +Required properties:
> + - compatible          : Should be "rohm,bd9571mwv".
> + - 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:
> +                            - vd18
> +                            - vd25
> +                            - vd33
> +                            - dvfs

Missing vd09, which is used for VDD0.8 on Salvator-X.

> +                           Each child node is defined using the standard
> +                           binding for regulators.
> +
> +Example:
> +
> +       pmic: bd9571mwv@30 {
> +               compatible = "rohm,bd9571mwv";
> +               reg = <0x30>;
> +               interrupt-parent = <&gpio2>;
> +               interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> +               interrupt-controller;
> +               #interrupt-cells = <2>;
> +               gpio-controller;
> +               #gpio-cells = <2>;
> +
> +               regulators {
> +                       dvfs: dvfs {
> +                               compatible = "regulator-fixed";

What's the purpose of this compatible value?

> +                               regulator-name = "dvfs";
> +                               regulator-min-microvolt = <750000>;
> +                               regulator-max-microvolt = <1030000>;
> +                               regulator-boot-on;
> +                               regulator-always-on;
> +                       };
> +               };
> +       };

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings
  2017-04-20 12:35 ` [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings Geert Uytterhoeven
@ 2017-04-20 12:51       ` Marek Vasut
  0 siblings, 0 replies; 16+ messages in thread
From: Marek Vasut @ 2017-04-20 12:51 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linux-Renesas, Marek Vasut, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Rob Herring, Geert Uytterhoeven

On 04/20/2017 02:35 PM, Geert Uytterhoeven wrote:
> Hi Marek,

Hi!

> On Sun, Apr 16, 2017 at 8:07 PM, Marek Vasut <marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> Add DT bindings for the ROHM BD9571MWV-M PMIC. This PMIC has
>> the following features:
>> - multiple voltage monitors for 1V8, 2V5, 3V3 voltage rail
>> - one voltage regulator for DVFS
>> - two GPIOs
>>
>> Signed-off-by: Marek Vasut <marek.vasut+renesas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>> Cc: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
>> Cc: linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> ---
>>  .../devicetree/bindings/mfd/bd9571mwv.txt          | 49 ++++++++++++++++++++++
>>  1 file changed, 49 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/mfd/bd9571mwv.txt
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/bd9571mwv.txt b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt
>> new file mode 100644
>> index 000000000000..0952ee3bc30b
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt
>> @@ -0,0 +1,49 @@
>> +* ROHM BD9571MWV Power Management Integrated Circuit (PMIC) bindings
>> +
>> +Required properties:
>> + - compatible          : Should be "rohm,bd9571mwv".
>> + - 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:
>> +                            - vd18
>> +                            - vd25
>> +                            - vd33
>> +                            - dvfs
> 
> Missing vd09, which is used for VDD0.8 on Salvator-X.

This is not supported by the driver, I don't think we should prematurely
add it into the bindings. We can add it later though.

>> +                           Each child node is defined using the standard
>> +                           binding for regulators.
>> +
>> +Example:
>> +
>> +       pmic: bd9571mwv@30 {
>> +               compatible = "rohm,bd9571mwv";
>> +               reg = <0x30>;
>> +               interrupt-parent = <&gpio2>;
>> +               interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
>> +               interrupt-controller;
>> +               #interrupt-cells = <2>;
>> +               gpio-controller;
>> +               #gpio-cells = <2>;
>> +
>> +               regulators {
>> +                       dvfs: dvfs {
>> +                               compatible = "regulator-fixed";
> 
> What's the purpose of this compatible value?

The purpose is for it to be removed in V2 , thanks for catching this one.

>> +                               regulator-name = "dvfs";
>> +                               regulator-min-microvolt = <750000>;
>> +                               regulator-max-microvolt = <1030000>;
>> +                               regulator-boot-on;
>> +                               regulator-always-on;
>> +                       };
>> +               };
>> +       };
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> 


-- 
Best regards,
Marek Vasut
--
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] 16+ messages in thread

* Re: [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings
@ 2017-04-20 12:51       ` Marek Vasut
  0 siblings, 0 replies; 16+ messages in thread
From: Marek Vasut @ 2017-04-20 12:51 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linux-Renesas, Marek Vasut, devicetree, Rob Herring, Geert Uytterhoeven

On 04/20/2017 02:35 PM, Geert Uytterhoeven wrote:
> Hi Marek,

Hi!

> On Sun, Apr 16, 2017 at 8:07 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
>> Add DT bindings for the ROHM BD9571MWV-M PMIC. This PMIC has
>> the following features:
>> - multiple voltage monitors for 1V8, 2V5, 3V3 voltage rail
>> - one voltage regulator for DVFS
>> - two GPIOs
>>
>> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
>> Cc: devicetree@vger.kernel.org
>> Cc: Rob Herring <robh@kernel.org>
>> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
>> Cc: linux-renesas-soc@vger.kernel.org
>> ---
>>  .../devicetree/bindings/mfd/bd9571mwv.txt          | 49 ++++++++++++++++++++++
>>  1 file changed, 49 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/mfd/bd9571mwv.txt
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/bd9571mwv.txt b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt
>> new file mode 100644
>> index 000000000000..0952ee3bc30b
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt
>> @@ -0,0 +1,49 @@
>> +* ROHM BD9571MWV Power Management Integrated Circuit (PMIC) bindings
>> +
>> +Required properties:
>> + - compatible          : Should be "rohm,bd9571mwv".
>> + - 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:
>> +                            - vd18
>> +                            - vd25
>> +                            - vd33
>> +                            - dvfs
> 
> Missing vd09, which is used for VDD0.8 on Salvator-X.

This is not supported by the driver, I don't think we should prematurely
add it into the bindings. We can add it later though.

>> +                           Each child node is defined using the standard
>> +                           binding for regulators.
>> +
>> +Example:
>> +
>> +       pmic: bd9571mwv@30 {
>> +               compatible = "rohm,bd9571mwv";
>> +               reg = <0x30>;
>> +               interrupt-parent = <&gpio2>;
>> +               interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
>> +               interrupt-controller;
>> +               #interrupt-cells = <2>;
>> +               gpio-controller;
>> +               #gpio-cells = <2>;
>> +
>> +               regulators {
>> +                       dvfs: dvfs {
>> +                               compatible = "regulator-fixed";
> 
> What's the purpose of this compatible value?

The purpose is for it to be removed in V2 , thanks for catching this one.

>> +                               regulator-name = "dvfs";
>> +                               regulator-min-microvolt = <750000>;
>> +                               regulator-max-microvolt = <1030000>;
>> +                               regulator-boot-on;
>> +                               regulator-always-on;
>> +                       };
>> +               };
>> +       };
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> 


-- 
Best regards,
Marek Vasut

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

* Re: [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings
  2017-04-20 12:51       ` Marek Vasut
@ 2017-04-20 14:09           ` Rob Herring
  -1 siblings, 0 replies; 16+ messages in thread
From: Rob Herring @ 2017-04-20 14:09 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Geert Uytterhoeven, Linux-Renesas, Marek Vasut,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven

On Thu, Apr 20, 2017 at 02:51:40PM +0200, Marek Vasut wrote:
> On 04/20/2017 02:35 PM, Geert Uytterhoeven wrote:
> > Hi Marek,
> 
> Hi!
> 
> > On Sun, Apr 16, 2017 at 8:07 PM, Marek Vasut <marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >> Add DT bindings for the ROHM BD9571MWV-M PMIC. This PMIC has
> >> the following features:
> >> - multiple voltage monitors for 1V8, 2V5, 3V3 voltage rail
> >> - one voltage regulator for DVFS
> >> - two GPIOs
> >>
> >> Signed-off-by: Marek Vasut <marek.vasut+renesas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> >> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> >> Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> >> Cc: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
> >> Cc: linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> >> ---
> >>  .../devicetree/bindings/mfd/bd9571mwv.txt          | 49 ++++++++++++++++++++++
> >>  1 file changed, 49 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/mfd/bd9571mwv.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/mfd/bd9571mwv.txt b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt
> >> new file mode 100644
> >> index 000000000000..0952ee3bc30b
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt
> >> @@ -0,0 +1,49 @@
> >> +* ROHM BD9571MWV Power Management Integrated Circuit (PMIC) bindings
> >> +
> >> +Required properties:
> >> + - compatible          : Should be "rohm,bd9571mwv".
> >> + - 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:
> >> +                            - vd18
> >> +                            - vd25
> >> +                            - vd33
> >> +                            - dvfs
> > 
> > Missing vd09, which is used for VDD0.8 on Salvator-X.
> 
> This is not supported by the driver, I don't think we should prematurely
> add it into the bindings. We can add it later though.

If it is trivial to add, then do so now. Bindings should be complete, 
not what a driver supports.

Rob
--
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] 16+ messages in thread

* Re: [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings
@ 2017-04-20 14:09           ` Rob Herring
  0 siblings, 0 replies; 16+ messages in thread
From: Rob Herring @ 2017-04-20 14:09 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Geert Uytterhoeven, Linux-Renesas, Marek Vasut, devicetree,
	Geert Uytterhoeven

On Thu, Apr 20, 2017 at 02:51:40PM +0200, Marek Vasut wrote:
> On 04/20/2017 02:35 PM, Geert Uytterhoeven wrote:
> > Hi Marek,
> 
> Hi!
> 
> > On Sun, Apr 16, 2017 at 8:07 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> >> Add DT bindings for the ROHM BD9571MWV-M PMIC. This PMIC has
> >> the following features:
> >> - multiple voltage monitors for 1V8, 2V5, 3V3 voltage rail
> >> - one voltage regulator for DVFS
> >> - two GPIOs
> >>
> >> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> >> Cc: devicetree@vger.kernel.org
> >> Cc: Rob Herring <robh@kernel.org>
> >> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> >> Cc: linux-renesas-soc@vger.kernel.org
> >> ---
> >>  .../devicetree/bindings/mfd/bd9571mwv.txt          | 49 ++++++++++++++++++++++
> >>  1 file changed, 49 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/mfd/bd9571mwv.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/mfd/bd9571mwv.txt b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt
> >> new file mode 100644
> >> index 000000000000..0952ee3bc30b
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt
> >> @@ -0,0 +1,49 @@
> >> +* ROHM BD9571MWV Power Management Integrated Circuit (PMIC) bindings
> >> +
> >> +Required properties:
> >> + - compatible          : Should be "rohm,bd9571mwv".
> >> + - 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:
> >> +                            - vd18
> >> +                            - vd25
> >> +                            - vd33
> >> +                            - dvfs
> > 
> > Missing vd09, which is used for VDD0.8 on Salvator-X.
> 
> This is not supported by the driver, I don't think we should prematurely
> add it into the bindings. We can add it later though.

If it is trivial to add, then do so now. Bindings should be complete, 
not what a driver supports.

Rob

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

* Re: [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings
  2017-04-20 14:09           ` Rob Herring
  (?)
@ 2017-04-20 16:59           ` Marek Vasut
  -1 siblings, 0 replies; 16+ messages in thread
From: Marek Vasut @ 2017-04-20 16:59 UTC (permalink / raw)
  To: Rob Herring
  Cc: Geert Uytterhoeven, Linux-Renesas, Marek Vasut, devicetree,
	Geert Uytterhoeven

On 04/20/2017 04:09 PM, Rob Herring wrote:
> On Thu, Apr 20, 2017 at 02:51:40PM +0200, Marek Vasut wrote:
>> On 04/20/2017 02:35 PM, Geert Uytterhoeven wrote:
>>> Hi Marek,
>>
>> Hi!
>>
>>> On Sun, Apr 16, 2017 at 8:07 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
>>>> Add DT bindings for the ROHM BD9571MWV-M PMIC. This PMIC has
>>>> the following features:
>>>> - multiple voltage monitors for 1V8, 2V5, 3V3 voltage rail
>>>> - one voltage regulator for DVFS
>>>> - two GPIOs
>>>>
>>>> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
>>>> Cc: devicetree@vger.kernel.org
>>>> Cc: Rob Herring <robh@kernel.org>
>>>> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
>>>> Cc: linux-renesas-soc@vger.kernel.org
>>>> ---
>>>>  .../devicetree/bindings/mfd/bd9571mwv.txt          | 49 ++++++++++++++++++++++
>>>>  1 file changed, 49 insertions(+)
>>>>  create mode 100644 Documentation/devicetree/bindings/mfd/bd9571mwv.txt
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/mfd/bd9571mwv.txt b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt
>>>> new file mode 100644
>>>> index 000000000000..0952ee3bc30b
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt
>>>> @@ -0,0 +1,49 @@
>>>> +* ROHM BD9571MWV Power Management Integrated Circuit (PMIC) bindings
>>>> +
>>>> +Required properties:
>>>> + - compatible          : Should be "rohm,bd9571mwv".
>>>> + - 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:
>>>> +                            - vd18
>>>> +                            - vd25
>>>> +                            - vd33
>>>> +                            - dvfs
>>>
>>> Missing vd09, which is used for VDD0.8 on Salvator-X.
>>
>> This is not supported by the driver, I don't think we should prematurely
>> add it into the bindings. We can add it later though.
> 
> If it is trivial to add, then do so now. Bindings should be complete, 
> not what a driver supports.

OK, will be in V2 . I actually figured out how that regulator works and
I can even set voltage.

-- 
Best regards,
Marek Vasut

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

* Re: [PATCH 2/4] mfd: Add ROHM BD9571MWV-M MFD PMIC driver
  2017-04-16 18:07 ` [PATCH 2/4] mfd: Add ROHM BD9571MWV-M MFD PMIC driver Marek Vasut
@ 2017-04-24 11:38   ` Lee Jones
  2017-04-24 15:03     ` Marek Vasut
  0 siblings, 1 reply; 16+ messages in thread
From: Lee Jones @ 2017-04-24 11:38 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-renesas-soc, Marek Vasut, linux-kernel, Geert Uytterhoeven

On Sun, 16 Apr 2017, Marek Vasut wrote:

> Add the MFD part of the ROHM BD9571MWV-M PMIC driver and MAINTAINERS
> entry. The MFD part only specifies the regmap bits for the PMIC and
> binds the subdevs together.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: linux-kernel@vger.kernel.org
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Lee Jones <lee.jones@linaro.org>
> ---
>  MAINTAINERS                   |  11 ++
>  drivers/mfd/Kconfig           |  13 +++
>  drivers/mfd/Makefile          |   1 +
>  drivers/mfd/bd9571mwv.c       | 226 ++++++++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/bd9571mwv.h | 120 ++++++++++++++++++++++
>  5 files changed, 371 insertions(+)
>  create mode 100644 drivers/mfd/bd9571mwv.c
>  create mode 100644 include/linux/mfd/bd9571mwv.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 892e958f6e50..90a96ee06ee4 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -10868,6 +10868,17 @@ L:	linux-serial@vger.kernel.org
>  S:	Odd Fixes
>  F:	drivers/tty/serial/rp2.*
>  
> +ROHM MULTIFUNCTION BD9571MWV-M PMIC DEVICE DRIVERS
> +M:	Marek Vasut <marek.vasut+renesas@gmail.com>
> +L:	linux-kernel@vger.kernel.org
> +L:	linux-renesas-soc@vger.kernel.org
> +S:	Supported
> +F:	drivers/mfd/bd9571mwv.c
> +F:	drivers/regulator/bd9571mwv-regulator.c
> +F:	drivers/gpio/gpio-bd9571mwv.c
> +F:	include/linux/mfd/bd9571mwv.h
> +F:	Documentation/devicetree/bindings/mfd/bd9571mwv.txt
> +
>  ROSE NETWORK LAYER
>  M:	Ralf Baechle <ralf@linux-mips.org>
>  L:	linux-hams@vger.kernel.org
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index de68b5ba8741..fa1f41ef5332 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -133,6 +133,19 @@ config MFD_BCM590XX
>  	help
>  	  Support for the BCM590xx PMUs from Broadcom
>  
> +config MFD_BD9571MWV
> +	tristate "ROHM BD9571MWV PMIC"
> +	select MFD_CORE
> +	select REGMAP_I2C
> +	depends on I2C
> +	help
> +	  Support for the ROHM BD9571MWV PMIC, which contains single
> +	  voltage regulator, voltage sampling units, GPIO block and
> +	  watchdog block.
> +
> +	  This driver can also be built as a module. If so, the module
> +	  will be called bd9571mwv.
> +
>  config MFD_AC100
>  	tristate "X-Powers AC100"
>  	select MFD_CORE
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index fa86dbe65e52..e2c82d2b108d 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -10,6 +10,7 @@ obj-$(CONFIG_MFD_ACT8945A)	+= act8945a.o
>  obj-$(CONFIG_MFD_SM501)		+= sm501.o
>  obj-$(CONFIG_MFD_ASIC3)		+= asic3.o tmio_core.o
>  obj-$(CONFIG_MFD_BCM590XX)	+= bcm590xx.o
> +obj-$(CONFIG_MFD_BD9571MWV)	+= bd9571mwv.o
>  cros_ec_core-objs		:= cros_ec.o
>  cros_ec_core-$(CONFIG_ACPI)	+= cros_ec_acpi_gpe.o
>  obj-$(CONFIG_MFD_CROS_EC)	+= cros_ec_core.o
> diff --git a/drivers/mfd/bd9571mwv.c b/drivers/mfd/bd9571mwv.c
> new file mode 100644
> index 000000000000..7382cdf308e8
> --- /dev/null
> +++ b/drivers/mfd/bd9571mwv.c
> @@ -0,0 +1,226 @@
> +/*
> + * ROHM BD9571MWV-M MFD driver
> + *
> + * Copyright (C) 2017 Marek Vasut <marek.vasut+renesas@gmail.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 TPS65086 driver
> + */
> +
> +#include <linux/i2c.h>
> +#include <linux/interrupt.h>
> +#include <linux/mfd/core.h>
> +#include <linux/module.h>
> +
> +#include <linux/mfd/bd9571mwv.h>
> +
> +static const struct mfd_cell bd9571mwv_cells[] = {
> +	{ .name = "bd9571mwv-regulator", },
> +	{ .name = "bd9571mwv-gpio", },
> +};
> +
> +static const struct regmap_range bd9571mwv_readable_yes_ranges[] = {
> +	regmap_reg_range(BD9571MWV_VENDOR_CODE, BD9571MWV_PRODUCT_REVISION),
> +	regmap_reg_range(BD9571MWV_AVS_SET_MONI, BD9571MWV_AVS_DVFS_VID3),
> +	regmap_reg_range(BD9571MWV_VD18_VID, BD9571MWV_VD33_VID),
> +	regmap_reg_range(BD9571MWV_DVFS_VINIT, BD9571MWV_DVFS_VINIT),
> +	regmap_reg_range(BD9571MWV_DVFS_SETVMAX, BD9571MWV_DVFS_MONIVDAC),
> +	regmap_reg_range(BD9571MWV_GPIO_IN, BD9571MWV_GPIO_IN),
> +	regmap_reg_range(BD9571MWV_GPIO_INT, BD9571MWV_GPIO_INTMASK),
> +	regmap_reg_range(BD9571MWV_INT_INTREQ, BD9571MWV_INT_INTMASK),
> +};
> +
> +static const struct regmap_access_table bd9571mwv_readable_table = {
> +	.yes_ranges	= bd9571mwv_readable_yes_ranges,
> +	.n_yes_ranges	= ARRAY_SIZE(bd9571mwv_readable_yes_ranges),
> +};
> +
> +static const struct regmap_range bd9571mwv_writable_yes_ranges[] = {
> +	regmap_reg_range(BD9571MWV_DVFS_SETVID, BD9571MWV_DVFS_SETVID),
> +	regmap_reg_range(BD9571MWV_GPIO_DIR, BD9571MWV_GPIO_OUT),
> +	regmap_reg_range(BD9571MWV_GPIO_INT_SET, BD9571MWV_GPIO_INTMASK),
> +	regmap_reg_range(BD9571MWV_INT_INTREQ, BD9571MWV_INT_INTMASK),
> +};
> +
> +static const struct regmap_access_table bd9571mwv_writable_table = {
> +	.yes_ranges	= bd9571mwv_writable_yes_ranges,
> +	.n_yes_ranges	= ARRAY_SIZE(bd9571mwv_writable_yes_ranges),
> +};
> +
> +static const struct regmap_range bd9571mwv_volatile_yes_ranges[] = {
> +	regmap_reg_range(BD9571MWV_GPIO_IN, BD9571MWV_GPIO_IN),
> +	regmap_reg_range(BD9571MWV_GPIO_INT, BD9571MWV_GPIO_INT),
> +	regmap_reg_range(BD9571MWV_INT_INTREQ, BD9571MWV_INT_INTREQ),
> +};
> +
> +static const struct regmap_access_table bd9571mwv_volatile_table = {
> +	.yes_ranges	= bd9571mwv_volatile_yes_ranges,
> +	.n_yes_ranges	= ARRAY_SIZE(bd9571mwv_volatile_yes_ranges),
> +};
> +
> +static const struct regmap_config bd9571mwv_regmap_config = {
> +	.reg_bits	= 8,
> +	.val_bits	= 8,
> +	.cache_type	= REGCACHE_RBTREE,
> +	.rd_table	= &bd9571mwv_readable_table,
> +	.wr_table	= &bd9571mwv_writable_table,
> +	.volatile_table	= &bd9571mwv_volatile_table,
> +	.max_register	= 0xff,
> +};
> +
> +static const struct regmap_irq bd9571mwv_irqs[] = {
> +	REGMAP_IRQ_REG(BD9571MWV_IRQ_MD1, 0,
> +		       BD9571MWV_INT_INTREQ_MD1_INT),
> +	REGMAP_IRQ_REG(BD9571MWV_IRQ_MD2_E1, 0,
> +		       BD9571MWV_INT_INTREQ_MD2_E1_INT),
> +	REGMAP_IRQ_REG(BD9571MWV_IRQ_MD2_E2, 0,
> +		       BD9571MWV_INT_INTREQ_MD2_E2_INT),
> +	REGMAP_IRQ_REG(BD9571MWV_IRQ_PROT_ERR, 0,
> +		       BD9571MWV_INT_INTREQ_PROT_ERR_INT),
> +	REGMAP_IRQ_REG(BD9571MWV_IRQ_GP, 0,
> +		       BD9571MWV_INT_INTREQ_GP_INT),
> +	REGMAP_IRQ_REG(BD9571MWV_IRQ_128H_OF, 0,
> +		       BD9571MWV_INT_INTREQ_128H_OF_INT),
> +	REGMAP_IRQ_REG(BD9571MWV_IRQ_WDT_OF, 0,
> +		       BD9571MWV_INT_INTREQ_WDT_OF_INT),
> +	REGMAP_IRQ_REG(BD9571MWV_IRQ_BKUP_TRG, 0,
> +		       BD9571MWV_INT_INTREQ_BKUP_TRG_INT),
> +};
> +
> +static struct regmap_irq_chip bd9571mwv_irq_chip = {
> +	.name		= "bd9571mwv",
> +	.status_base	= BD9571MWV_INT_INTREQ,
> +	.mask_base	= BD9571MWV_INT_INTMASK,
> +	.ack_base	= BD9571MWV_INT_INTREQ,
> +	.init_ack_masked = true,
> +	.num_regs	= 1,
> +	.irqs		= bd9571mwv_irqs,
> +	.num_irqs	= ARRAY_SIZE(bd9571mwv_irqs),
> +};
> +
> +static int bd9571mwv_identify(struct bd9571mwv *bd)
> +{
> +	struct device *dev = bd->dev;
> +	unsigned int value;
> +	int ret;
> +
> +	ret = regmap_read(bd->regmap, BD9571MWV_VENDOR_CODE, &value);
> +	if (ret) {
> +		dev_err(dev, "Failed to read vendor code register\n");

Nit: Don't you care what the return value is?

> +		return ret;
> +	}
> +
> +	if (value != BD9571MWV_VENDOR_CODE_VAL) {
> +		dev_err(dev, "Invalid vendor code ID %02x (expected %02x)\n",
> +			value, BD9571MWV_VENDOR_CODE_VAL);
> +		return -EINVAL;
> +	}
> +
> +	ret = regmap_read(bd->regmap, BD9571MWV_PRODUCT_CODE, &value);
> +	if (ret) {
> +		dev_err(dev, "Failed to read product code register\n");

Same.

> +		return ret;
> +	}
> +
> +	if (value != BD9571MWV_PRODUCT_CODE_VAL) {
> +		dev_err(dev, "Invalid product code ID %02x (expected %02x)\n",
> +			value, BD9571MWV_PRODUCT_CODE_VAL);
> +		return -EINVAL;
> +	}
> +
> +	ret = regmap_read(bd->regmap, BD9571MWV_PRODUCT_REVISION, &value);
> +	if (ret) {
> +		dev_err(dev, "Failed to read revision register\n");

Same.

> +		return ret;
> +	}
> +
> +	dev_info(dev, "Device: BD9571MWV rev. %d\n", value & 0xff);
> +
> +	return 0;
> +}
> +
> +static int bd9571mwv_probe(struct i2c_client *client,
> +			  const struct i2c_device_id *ids)
> +{
> +	struct bd9571mwv *bd;
> +	int ret;
> +
> +	bd = devm_kzalloc(&client->dev, sizeof(*bd), GFP_KERNEL);
> +	if (!bd)
> +		return -ENOMEM;
> +
> +	i2c_set_clientdata(client, bd);
> +	bd->dev = &client->dev;
> +	bd->irq = client->irq;
> +
> +	bd->regmap = devm_regmap_init_i2c(client, &bd9571mwv_regmap_config);
> +	if (IS_ERR(bd->regmap)) {
> +		dev_err(bd->dev, "Failed to initialize register map\n");
> +		return PTR_ERR(bd->regmap);
> +	}
> +
> +	ret = bd9571mwv_identify(bd);
> +	if (ret)
> +		return ret;
> +
> +	ret = regmap_add_irq_chip(bd->regmap, bd->irq, IRQF_ONESHOT, 0,
> +				  &bd9571mwv_irq_chip, &bd->irq_data);
> +	if (ret) {
> +		dev_err(bd->dev, "Failed to register IRQ chip\n");
> +		return ret;
> +	}
> +
> +	ret = mfd_add_devices(bd->dev, PLATFORM_DEVID_AUTO, bd9571mwv_cells,
> +			      ARRAY_SIZE(bd9571mwv_cells), NULL, 0,
> +			      regmap_irq_get_domain(bd->irq_data));
> +	if (ret) {
> +		regmap_del_irq_chip(bd->irq, bd->irq_data);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static int bd9571mwv_remove(struct i2c_client *client)
> +{
> +	struct bd9571mwv *bd = i2c_get_clientdata(client);
> +
> +	regmap_del_irq_chip(bd->irq, bd->irq_data);
> +
> +	return 0;
> +}
> +
> +static const struct of_device_id bd9571mwv_of_match_table[] = {
> +	{ .compatible = "rohm,bd9571mwv", },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, bd9571mwv_of_match_table);
> +
> +static const struct i2c_device_id bd9571mwv_id_table[] = {
> +	{ "bd9571mwv", 0 },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(i2c, bd9571mwv_id_table);
> +
> +static struct i2c_driver bd9571mwv_driver = {
> +	.driver		= {
> +		.name	= "bd9571mwv",
> +		.of_match_table = bd9571mwv_of_match_table,
> +	},
> +	.probe		= bd9571mwv_probe,
> +	.remove		= bd9571mwv_remove,
> +	.id_table       = bd9571mwv_id_table,
> +};
> +module_i2c_driver(bd9571mwv_driver);
> +
> +MODULE_AUTHOR("Marek Vasut <marek.vasut+renesas@gmail.com>");
> +MODULE_DESCRIPTION("BD9571MWV PMIC Driver");
> +MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/mfd/bd9571mwv.h b/include/linux/mfd/bd9571mwv.h
> new file mode 100644
> index 000000000000..f04f5cccbb1d
> --- /dev/null
> +++ b/include/linux/mfd/bd9571mwv.h
> @@ -0,0 +1,120 @@
> +/*
> + * ROHM BD9571MWV-M driver
> + *
> + * Copyright (C) 2017 Marek Vasut <marek.vasut+renesas@gmail.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 TPS65086 driver
> + */
> +
> +#ifndef __LINUX_MFD_BD9571MWV_H
> +#define __LINUX_MFD_BD9571MWV_H
> +
> +#include <linux/device.h>
> +#include <linux/regmap.h>
> +
> +/* List of registers for BD9571MWV */
> +#define BD9571MWV_VENDOR_CODE			0x00
> +#define BD9571MWV_VENDOR_CODE_VAL		0xdb
> +#define BD9571MWV_PRODUCT_CODE			0x01
> +#define BD9571MWV_PRODUCT_CODE_VAL		0x60
> +#define BD9571MWV_PRODUCT_REVISION		0x02
> +
> +#define BD9571MWV_I2C_FUSA_MODE			0x10
> +#define BD9571MWV_I2C_MD2_E1_BIT_1		0x11
> +#define BD9571MWV_I2C_MD2_E1_BIT_2		0x12
> +
> +#define BD9571MWV_BKUP_MODE_CNT			0x20
> +#define BD9571MWV_BKUP_MODE_STATUS		0x21
> +#define BD9571MWV_BKUP_RECOVERY_CNT		0x22
> +#define BD9571MWV_BKUP_CTRL_TIM_CNT		0x23
> +#define BD9571MWV_WAITBKUP_WDT_CNT		0x24
> +#define BD9571MWV_128H_TIM_CNT			0x26
> +#define BD9571MWV_QLLM_CNT			0x27
> +
> +#define BD9571MWV_AVS_SET_MONI			0x31
> +#define BD9571MWV_AVS_VD09_VID0			0x32
> +#define BD9571MWV_AVS_VD09_VID1			0x33
> +#define BD9571MWV_AVS_VD09_VID2			0x34
> +#define BD9571MWV_AVS_VD09_VID3			0x35
> +#define BD9571MWV_AVS_DVFS_VID0			0x36
> +#define BD9571MWV_AVS_DVFS_VID1			0x37
> +#define BD9571MWV_AVS_DVFS_VID2			0x38
> +#define BD9571MWV_AVS_DVFS_VID3			0x39
> +
> +#define BD9571MWV_VD18_VID			0x42
> +#define BD9571MWV_VD25_VID			0x43
> +#define BD9571MWV_VD33_VID			0x44
> +
> +#define BD9571MWV_DVFS_VINIT			0x50
> +#define BD9571MWV_DVFS_SETVMAX			0x52
> +#define BD9571MWV_DVFS_BOOSTVID			0x53
> +#define BD9571MWV_DVFS_SETVID			0x54
> +#define BD9571MWV_DVFS_MONIVDAC			0x55
> +#define BD9571MWV_DVFS_PGD_CNT			0x56
> +
> +#define BD9571MWV_GPIO_DIR			0x60
> +#define BD9571MWV_GPIO_OUT			0x61
> +#define BD9571MWV_GPIO_IN			0x62
> +#define BD9571MWV_GPIO_DEB			0x63
> +#define BD9571MWV_GPIO_INT_SET			0x64
> +#define BD9571MWV_GPIO_INT			0x65
> +#define BD9571MWV_GPIO_INTMASK			0x66
> +
> +#define BD9571MWV_REG_KEEP(n)			(0x70 + (n))
> +
> +#define BD9571MWV_PMIC_INTERNAL_STATUS		0x80
> +#define BD9571MWV_PROT_ERROR_STATUS0		0x81
> +#define BD9571MWV_PROT_ERROR_STATUS1		0x82
> +#define BD9571MWV_PROT_ERROR_STATUS2		0x83
> +#define BD9571MWV_PROT_ERROR_STATUS3		0x84
> +#define BD9571MWV_PROT_ERROR_STATUS4		0x85
> +
> +#define BD9571MWV_INT_INTREQ			0x90
> +#define BD9571MWV_INT_INTREQ_MD1_INT		BIT(0)
> +#define BD9571MWV_INT_INTREQ_MD2_E1_INT		BIT(1)
> +#define BD9571MWV_INT_INTREQ_MD2_E2_INT		BIT(2)
> +#define BD9571MWV_INT_INTREQ_PROT_ERR_INT	BIT(3)
> +#define BD9571MWV_INT_INTREQ_GP_INT		BIT(4)
> +#define BD9571MWV_INT_INTREQ_128H_OF_INT	BIT(5)
> +#define BD9571MWV_INT_INTREQ_WDT_OF_INT		BIT(6)
> +#define BD9571MWV_INT_INTREQ_BKUP_TRG_INT	BIT(7)
> +#define BD9571MWV_INT_INTMASK			0x91
> +
> +#define BD9571MWV_ACCESS_KEY			0xff
> +
> +/* Define the BD9571MWV IRQ numbers */
> +enum bd9571mwv_irqs {
> +	BD9571MWV_IRQ_MD1,
> +	BD9571MWV_IRQ_MD2_E1,
> +	BD9571MWV_IRQ_MD2_E2,
> +	BD9571MWV_IRQ_PROT_ERR,
> +	BD9571MWV_IRQ_GP,
> +	BD9571MWV_IRQ_128H_OF,
> +	BD9571MWV_IRQ_WDT_OF,
> +	BD9571MWV_IRQ_BKUP_TRG,
> +};
> +
> +/**
> + * struct bd9571mwv - state holder for the bd9571mwv driver
> + *
> + * Device data may be used to access the BD9571MWV chip
> + */
> +struct bd9571mwv {
> +	struct device *dev;
> +	struct regmap *regmap;
> +
> +	/* IRQ Data */
> +	int irq;
> +	struct regmap_irq_chip_data *irq_data;
> +};
> +
> +#endif /* __LINUX_MFD_BD9571MWV_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] 16+ messages in thread

* Re: [PATCH 3/4] gpio: Add ROHM BD9571MWV-M PMIC GPIO driver
  2017-04-16 18:08 ` [PATCH 3/4] gpio: Add ROHM BD9571MWV-M PMIC GPIO driver Marek Vasut
@ 2017-04-24 13:55   ` Linus Walleij
  2017-04-24 15:07     ` Marek Vasut
  0 siblings, 1 reply; 16+ messages in thread
From: Linus Walleij @ 2017-04-24 13:55 UTC (permalink / raw)
  To: Marek Vasut; +Cc: Linux-Renesas, Marek Vasut, linux-gpio, Geert Uytterhoeven

On Sun, Apr 16, 2017 at 8:08 PM, Marek Vasut <marek.vasut@gmail.com> wrote:

> Add driver for the GPIO block in the ROHM BD9571MWV-W MFD PMIC.
> This block is pretty trivial and supports setting GPIO direction
> as Input/Output and in case of Output, supports setting value.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: linux-gpio@vger.kernel.org
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Linus Walleij <linus.walleij@linaro.org>

(...)

> +#include <linux/gpio.h>

Only use
#include <linux/gpio/driver.h>

It should be enough.

With that:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

I guess you plan to merge this through MFD?

Yours,
Linus Walleij

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

* Re: [PATCH 2/4] mfd: Add ROHM BD9571MWV-M MFD PMIC driver
  2017-04-24 11:38   ` Lee Jones
@ 2017-04-24 15:03     ` Marek Vasut
  0 siblings, 0 replies; 16+ messages in thread
From: Marek Vasut @ 2017-04-24 15:03 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-renesas-soc, Marek Vasut, linux-kernel, Geert Uytterhoeven

On 04/24/2017 01:38 PM, Lee Jones wrote:
> On Sun, 16 Apr 2017, Marek Vasut wrote:

[...]

>> +static int bd9571mwv_identify(struct bd9571mwv *bd)
>> +{
>> +	struct device *dev = bd->dev;
>> +	unsigned int value;
>> +	int ret;
>> +
>> +	ret = regmap_read(bd->regmap, BD9571MWV_VENDOR_CODE, &value);
>> +	if (ret) {
>> +		dev_err(dev, "Failed to read vendor code register\n");
> 
> Nit: Don't you care what the return value is?

Not really, but I added the reporting. I wonder whether it shouldn't be
the regmap which reports those kinds of failures, just like ie. when
k*alloc() fails.

>> +		return ret;
>> +	}
>> +
>> +	if (value != BD9571MWV_VENDOR_CODE_VAL) {
>> +		dev_err(dev, "Invalid vendor code ID %02x (expected %02x)\n",
>> +			value, BD9571MWV_VENDOR_CODE_VAL);
>> +		return -EINVAL;
>> +	}
>> +
>> +	ret = regmap_read(bd->regmap, BD9571MWV_PRODUCT_CODE, &value);
>> +	if (ret) {
>> +		dev_err(dev, "Failed to read product code register\n");
> 
> Same.

And fixed globally ...

-- 
Best regards,
Marek Vasut

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

* Re: [PATCH 3/4] gpio: Add ROHM BD9571MWV-M PMIC GPIO driver
  2017-04-24 13:55   ` Linus Walleij
@ 2017-04-24 15:07     ` Marek Vasut
  0 siblings, 0 replies; 16+ messages in thread
From: Marek Vasut @ 2017-04-24 15:07 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Linux-Renesas, Marek Vasut, linux-gpio, Geert Uytterhoeven

On 04/24/2017 03:55 PM, Linus Walleij wrote:
> On Sun, Apr 16, 2017 at 8:08 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> 
>> Add driver for the GPIO block in the ROHM BD9571MWV-W MFD PMIC.
>> This block is pretty trivial and supports setting GPIO direction
>> as Input/Output and in case of Output, supports setting value.
>>
>> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
>> Cc: linux-gpio@vger.kernel.org
>> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
>> Cc: Linus Walleij <linus.walleij@linaro.org>
> 
> (...)
> 
>> +#include <linux/gpio.h>
> 
> Only use
> #include <linux/gpio/driver.h>
> 
> It should be enough.
> 
> With that:
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

It is, done, will be in V2, thanks.

> I guess you plan to merge this through MFD?
> 
> Yours,
> Linus Walleij
> 


-- 
Best regards,
Marek Vasut

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

end of thread, other threads:[~2017-04-24 15:08 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-16 18:07 [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings Marek Vasut
2017-04-16 18:07 ` [PATCH 2/4] mfd: Add ROHM BD9571MWV-M MFD PMIC driver Marek Vasut
2017-04-24 11:38   ` Lee Jones
2017-04-24 15:03     ` Marek Vasut
2017-04-16 18:08 ` [PATCH 3/4] gpio: Add ROHM BD9571MWV-M PMIC GPIO driver Marek Vasut
2017-04-24 13:55   ` Linus Walleij
2017-04-24 15:07     ` Marek Vasut
2017-04-16 18:08 ` [PATCH 4/4] regulator: Add ROHM BD9571MWV-M PMIC regulator driver Marek Vasut
2017-04-18 17:57   ` Mark Brown
2017-04-18 18:39     ` Marek Vasut
2017-04-20 12:35 ` [PATCH 1/4] mfd: Add ROHM BD9571MWV-M PMIC DT bindings Geert Uytterhoeven
     [not found]   ` <CAMuHMdUUkZ_si8DAmvY_KvNF8tO=q2wHzjqRCjxXJD3-XxxJFw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-20 12:51     ` Marek Vasut
2017-04-20 12:51       ` Marek Vasut
     [not found]       ` <dbfbadbd-9850-4a8e-581f-abd5ae39e841-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-20 14:09         ` Rob Herring
2017-04-20 14:09           ` Rob Herring
2017-04-20 16:59           ` Marek Vasut

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.