linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v8 01/11] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml
@ 2021-08-03  8:44 Alistair Francis
  2021-08-03  8:44 ` [PATCH v8 02/11] mfd: sy7636a: Initial commit Alistair Francis
                   ` (8 more replies)
  0 siblings, 9 replies; 20+ messages in thread
From: Alistair Francis @ 2021-08-03  8:44 UTC (permalink / raw)
  To: lee.jones, robh+dt, lgirdwood, broonie, linux-imx, kernel
  Cc: devicetree, linux-kernel, alistair23, Alistair Francis

Initial support for the Silergy SY7636A Power Management chip
and regulator.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
 .../bindings/mfd/silergy,sy7636a.yaml         | 80 +++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/silergy,sy7636a.yaml

diff --git a/Documentation/devicetree/bindings/mfd/silergy,sy7636a.yaml b/Documentation/devicetree/bindings/mfd/silergy,sy7636a.yaml
new file mode 100644
index 000000000000..2726c17b7f4e
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/silergy,sy7636a.yaml
@@ -0,0 +1,80 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/silergy,sy7636a.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: silergy sy7636a PMIC
+
+maintainers:
+  - Alistair Francis <alistair@alistair23.me>
+
+properties:
+  compatible:
+    const: silergy,sy7636a
+
+  reg:
+    description:
+      I2C device address.
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  '#thermal-sensor-cells':
+    const: 0
+
+  epd-pwr-good-gpios:
+    description:
+      Specifying the power good GPIOs.
+    maxItems: 1
+
+  regulators:
+    type: object
+
+    properties:
+      compatible:
+        const: silergy,sy7636a-regulator
+
+      vcom:
+        type: object
+        $ref: /schemas/regulator/regulator.yaml#
+        properties:
+          regulator-name:
+            const: vcom
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - '#thermal-sensor-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      pmic@62 {
+        compatible = "silergy,sy7636a";
+        reg = <0x62>;
+        pinctrl-names = "default";
+        pinctrl-0 = <&pinctrl_epdpmic>;
+        #thermal-sensor-cells = <0>;
+
+        regulators {
+          compatible = "silergy,sy7636a-regulator";
+          reg_epdpmic: vcom {
+            regulator-name = "vcom";
+            regulator-boot-on;
+          };
+        };
+      };
+    };
+...
-- 
2.31.1


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

* [PATCH v8 02/11] mfd: sy7636a: Initial commit
  2021-08-03  8:44 [PATCH v8 01/11] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml Alistair Francis
@ 2021-08-03  8:44 ` Alistair Francis
  2021-08-03 13:16   ` Lee Jones
  2021-08-03  8:44 ` [PATCH v8 03/11] thermal: sy7636a: Add thermal driver for sy7636a Alistair Francis
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Alistair Francis @ 2021-08-03  8:44 UTC (permalink / raw)
  To: lee.jones, robh+dt, lgirdwood, broonie, linux-imx, kernel
  Cc: devicetree, linux-kernel, alistair23, Alistair Francis

Initial support for the Silergy SY7636A Power Management chip.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
 drivers/mfd/Kconfig         |  9 +++++
 drivers/mfd/Makefile        |  1 +
 drivers/mfd/sy7636a.c       | 72 +++++++++++++++++++++++++++++++++++++
 include/linux/mfd/sy7636a.h | 45 +++++++++++++++++++++++
 4 files changed, 127 insertions(+)
 create mode 100644 drivers/mfd/sy7636a.c
 create mode 100644 include/linux/mfd/sy7636a.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 6a3fd2d75f96..b82208f0c79c 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1352,6 +1352,15 @@ config MFD_SYSCON
 	  Select this option to enable accessing system control registers
 	  via regmap.
 
+config MFD_SY7636A
+	tristate "Silergy SY7636A Power Management IC"
+	select MFD_CORE
+	select REGMAP_I2C
+	depends on I2C
+	help
+	  Select this option to enable support for the Silergy SY7636A
+	  Power Management IC.
+
 config MFD_DAVINCI_VOICECODEC
 	tristate
 	select MFD_CORE
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 8116c19d5fd4..cbe581e87fa9 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -266,6 +266,7 @@ obj-$(CONFIG_MFD_KHADAS_MCU) 	+= khadas-mcu.o
 obj-$(CONFIG_MFD_ACER_A500_EC)	+= acer-ec-a500.o
 obj-$(CONFIG_MFD_QCOM_PM8008)	+= qcom-pm8008.o
 
+obj-$(CONFIG_MFD_SY7636A)	+= sy7636a.o
 obj-$(CONFIG_SGI_MFD_IOC3)	+= ioc3.o
 obj-$(CONFIG_MFD_SIMPLE_MFD_I2C)	+= simple-mfd-i2c.o
 obj-$(CONFIG_MFD_INTEL_M10_BMC)   += intel-m10-bmc.o
diff --git a/drivers/mfd/sy7636a.c b/drivers/mfd/sy7636a.c
new file mode 100644
index 000000000000..f3ff93c7395d
--- /dev/null
+++ b/drivers/mfd/sy7636a.c
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * MFD parent driver for SY7636A chip
+ *
+ * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/
+ *
+ * Authors: Lars Ivar Miljeteig <lars.ivar.miljeteig@remarkable.com>
+ *          Alistair Francis <alistair@alistair23.me>
+ *
+ * Based on the lp87565 driver by Keerthy <j-keerthy@ti.com>
+ */
+
+#include <linux/interrupt.h>
+#include <linux/mfd/core.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+
+#include <linux/mfd/sy7636a.h>
+
+static const struct regmap_config sy7636a_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+};
+
+static const struct mfd_cell sy7636a_cells[] = {
+	{ .name = "sy7636a-regulator", },
+	{ .name = "sy7636a-temperature", },
+	{ .name = "sy7636a-thermal", },
+};
+
+static int sy7636a_probe(struct i2c_client *client)
+{
+	struct sy7636a *ddata;
+	int ret;
+
+	ddata = devm_kzalloc(&client->dev, sizeof(*ddata), GFP_KERNEL);
+	if (!ddata)
+		return -ENOMEM;
+
+	ddata->regmap = devm_regmap_init_i2c(client, &sy7636a_regmap_config);
+	if (IS_ERR(ddata->regmap)) {
+		ret = PTR_ERR(ddata->regmap);
+		dev_err(&client->dev,
+			"Failed to initialize register map: %d\n", ret);
+		return ret;
+	}
+
+	i2c_set_clientdata(client, ddata);
+
+	return devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_AUTO,
+				    sy7636a_cells, ARRAY_SIZE(sy7636a_cells),
+				    NULL, 0, NULL);
+}
+
+static const struct of_device_id of_sy7636a_match_table[] = {
+	{ .compatible = "silergy,sy7636a", },
+	{}
+};
+MODULE_DEVICE_TABLE(of, of_sy7636a_match_table);
+
+static struct i2c_driver sy7636a_driver = {
+	.driver	= {
+		.name	= "sy7636a",
+		.of_match_table = of_sy7636a_match_table,
+	},
+	.probe_new = sy7636a_probe,
+};
+module_i2c_driver(sy7636a_driver);
+
+MODULE_AUTHOR("Lars Ivar Miljeteig <lars.ivar.miljeteig@remarkable.com>");
+MODULE_DESCRIPTION("Silergy SY7636A Multi-Function Device Driver");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/mfd/sy7636a.h b/include/linux/mfd/sy7636a.h
new file mode 100644
index 000000000000..5e9c537fee45
--- /dev/null
+++ b/include/linux/mfd/sy7636a.h
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Functions to access SY3686A power management chip.
+ *
+ * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/
+ */
+
+#ifndef __MFD_SY7636A_H
+#define __MFD_SY7636A_H
+
+#include <linux/i2c.h>
+#include <linux/regmap.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/machine.h>
+
+#define SY7636A_REG_OPERATION_MODE_CRL		0x00
+#define SY7636A_OPERATION_MODE_CRL_VCOMCTL	BIT(6)
+#define SY7636A_OPERATION_MODE_CRL_ONOFF	BIT(7)
+#define SY7636A_REG_VCOM_ADJUST_CTRL_L		0x01
+#define SY7636A_REG_VCOM_ADJUST_CTRL_H		0x02
+#define SY7636A_REG_VCOM_ADJUST_CTRL_MASK	0x01ff
+#define SY7636A_REG_VLDO_VOLTAGE_ADJULST_CTRL	0x03
+#define SY7636A_REG_POWER_ON_DELAY_TIME		0x06
+#define SY7636A_REG_FAULT_FLAG			0x07
+#define SY7636A_FAULT_FLAG_PG			BIT(0)
+#define SY7636A_REG_TERMISTOR_READOUT		0x08
+
+#define SY7636A_REG_MAX				0x08
+
+#define VCOM_MIN		0
+#define VCOM_MAX		5000
+
+#define VCOM_ADJUST_CTRL_MASK	0x1ff
+// Used to shift the high byte
+#define VCOM_ADJUST_CTRL_SHIFT	8
+// Used to scale from VCOM_ADJUST_CTRL to mv
+#define VCOM_ADJUST_CTRL_SCAL	10000
+
+#define FAULT_FLAG_SHIFT	1
+
+struct sy7636a {
+	struct regmap *regmap;
+};
+
+#endif /* __LINUX_MFD_SY7636A_H */
-- 
2.31.1


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

* [PATCH v8 03/11] thermal: sy7636a: Add thermal driver for sy7636a
  2021-08-03  8:44 [PATCH v8 01/11] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml Alistair Francis
  2021-08-03  8:44 ` [PATCH v8 02/11] mfd: sy7636a: Initial commit Alistair Francis
@ 2021-08-03  8:44 ` Alistair Francis
  2021-08-03  8:44 ` [PATCH v8 04/11] hwmon: sy7636a: Add temperature " Alistair Francis
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 20+ messages in thread
From: Alistair Francis @ 2021-08-03  8:44 UTC (permalink / raw)
  To: lee.jones, robh+dt, lgirdwood, broonie, linux-imx, kernel
  Cc: devicetree, linux-kernel, alistair23, Lars Ivar Miljeteig,
	Alistair Francis

From: Lars Ivar Miljeteig <lars.ivar.miljeteig@remarkable.no>

Add thermal driver to enable kernel based polling
and shutdown of device for temperatures out of spec

Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
 drivers/thermal/Kconfig           |  7 +++
 drivers/thermal/Makefile          |  1 +
 drivers/thermal/sy7636a_thermal.c | 91 +++++++++++++++++++++++++++++++
 3 files changed, 99 insertions(+)
 create mode 100644 drivers/thermal/sy7636a_thermal.c

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index d7f44deab5b1..b383064a0ad7 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -450,6 +450,13 @@ depends on (ARCH_STI || ARCH_STM32) && OF
 source "drivers/thermal/st/Kconfig"
 endmenu
 
+config SY7636A_THERMAL
+	tristate "SY7636A thermal management"
+	depends on MFD_SY7636A
+	help
+	  Enable the sy7636a thermal driver, which supports the
+	  temperature sensor embedded in Silabs SY7636A IC.
+
 source "drivers/thermal/tegra/Kconfig"
 
 config GENERIC_ADC_THERMAL
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 82fc3e616e54..2e1aca8a0a09 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -51,6 +51,7 @@ obj-$(CONFIG_DA9062_THERMAL)	+= da9062-thermal.o
 obj-y				+= intel/
 obj-$(CONFIG_TI_SOC_THERMAL)	+= ti-soc-thermal/
 obj-y				+= st/
+obj-$(CONFIG_SY7636A_THERMAL)	+= sy7636a_thermal.o
 obj-$(CONFIG_QCOM_TSENS)	+= qcom/
 obj-y				+= tegra/
 obj-$(CONFIG_HISI_THERMAL)     += hisi_thermal.o
diff --git a/drivers/thermal/sy7636a_thermal.c b/drivers/thermal/sy7636a_thermal.c
new file mode 100644
index 000000000000..1112108ad972
--- /dev/null
+++ b/drivers/thermal/sy7636a_thermal.c
@@ -0,0 +1,91 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Functions to access SY3686A power management chip temperature
+//
+// Copyright (C) 2019 reMarkable AS - http://www.remarkable.com/
+//
+// Authors: Lars Ivar Miljeteig <lars.ivar.miljeteig@remarkable.com>
+//          Alistair Francis <alistair@alistair23.me>
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/thermal.h>
+
+#include <linux/mfd/sy7636a.h>
+
+static int sy7636a_get_temp(void *arg, int *res)
+{
+	unsigned int reg_val, mode_ctr;
+	int ret;
+	struct sy7636a *data = arg;
+	bool isVoltageActive;
+
+	ret = regmap_read(data->regmap,
+			SY7636A_REG_OPERATION_MODE_CRL, &mode_ctr);
+	if (ret)
+		return ret;
+
+	isVoltageActive = mode_ctr & SY7636A_OPERATION_MODE_CRL_ONOFF;
+
+	if (!isVoltageActive) {
+		ret = regmap_write(data->regmap,
+				SY7636A_REG_OPERATION_MODE_CRL,
+				mode_ctr | SY7636A_OPERATION_MODE_CRL_ONOFF);
+		if (ret)
+			return ret;
+	}
+
+	ret = regmap_read(data->regmap,
+			SY7636A_REG_TERMISTOR_READOUT, &reg_val);
+	if (ret)
+		return ret;
+
+	if (!isVoltageActive) {
+		ret = regmap_write(data->regmap,
+				SY7636A_REG_OPERATION_MODE_CRL,
+				mode_ctr);
+		if (ret)
+			return ret;
+	}
+
+	*res = reg_val * 1000;
+
+	return ret;
+}
+
+static const struct thermal_zone_of_device_ops ops = {
+	.get_temp	= sy7636a_get_temp,
+};
+
+static int sy7636a_thermal_probe(struct platform_device *pdev)
+{
+	struct sy7636a *sy7636a = dev_get_drvdata(pdev->dev.parent);
+	struct thermal_zone_device *thermal_zone_dev;
+
+	thermal_zone_dev = devm_thermal_zone_of_sensor_register(
+			pdev->dev.parent,
+			0,
+			sy7636a,
+			&ops);
+
+	return PTR_ERR_OR_ZERO(thermal_zone_dev);
+}
+
+static const struct platform_device_id sy7636a_thermal_id_table[] = {
+	{ "sy7636a-thermal", },
+	{ }
+};
+MODULE_DEVICE_TABLE(platform, sy7636a_thermal_id_table);
+
+static struct platform_driver sy7636a_thermal_driver = {
+	.driver = {
+		.name = "sy7636a-thermal",
+	},
+	.probe = sy7636a_thermal_probe,
+	.id_table = sy7636a_thermal_id_table,
+};
+module_platform_driver(sy7636a_thermal_driver);
+
+MODULE_AUTHOR("Lars Ivar Miljeteig <lars.ivar.miljeteig@remarkable.com>");
+MODULE_DESCRIPTION("SY7636A thermal driver");
+MODULE_LICENSE("GPL v2");
-- 
2.31.1


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

* [PATCH v8 04/11] hwmon: sy7636a: Add temperature driver for sy7636a
  2021-08-03  8:44 [PATCH v8 01/11] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml Alistair Francis
  2021-08-03  8:44 ` [PATCH v8 02/11] mfd: sy7636a: Initial commit Alistair Francis
  2021-08-03  8:44 ` [PATCH v8 03/11] thermal: sy7636a: Add thermal driver for sy7636a Alistair Francis
@ 2021-08-03  8:44 ` Alistair Francis
  2021-08-03  8:44 ` [PATCH v8 05/11] regulator: sy7636a: Remove the poll_enable_time Alistair Francis
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 20+ messages in thread
From: Alistair Francis @ 2021-08-03  8:44 UTC (permalink / raw)
  To: lee.jones, robh+dt, lgirdwood, broonie, linux-imx, kernel
  Cc: devicetree, linux-kernel, alistair23, Alistair Francis

This is a multi-function device to interface with the sy7636a
EPD PMIC chip from Silergy.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
 arch/arm/configs/imx_v6_v7_defconfig |  1 +
 drivers/hwmon/Kconfig                | 10 ++++
 drivers/hwmon/Makefile               |  1 +
 drivers/hwmon/sy7636a-hwmon.c        | 77 ++++++++++++++++++++++++++++
 4 files changed, 89 insertions(+)
 create mode 100644 drivers/hwmon/sy7636a-hwmon.c

diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 477dac1edc75..ef8c6dca1277 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -229,6 +229,7 @@ CONFIG_RN5T618_POWER=m
 CONFIG_SENSORS_MC13783_ADC=y
 CONFIG_SENSORS_GPIO_FAN=y
 CONFIG_SENSORS_IIO_HWMON=y
+CONFIG_SENSORS_SY7636A=y
 CONFIG_THERMAL_STATISTICS=y
 CONFIG_THERMAL_WRITABLE_TRIPS=y
 CONFIG_CPU_THERMAL=y
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index e3675377bc5d..6cae12de59cd 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1631,6 +1631,16 @@ config SENSORS_SIS5595
 	  This driver can also be built as a module. If so, the module
 	  will be called sis5595.
 
+config SENSORS_SY7636A
+	tristate "Silergy SY7636A"
+	depends on I2C
+	help
+	  If you say yes here you get support for the thermistor readout of
+	  the Silergy SY7636A PMIC.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called sy7636a-hwmon.
+
 config SENSORS_DME1737
 	tristate "SMSC DME1737, SCH311x and compatibles"
 	depends on I2C && !PPC
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index d712c61c1f5e..8b2e09e25b24 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -180,6 +180,7 @@ obj-$(CONFIG_SENSORS_SMSC47M1)	+= smsc47m1.o
 obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o
 obj-$(CONFIG_SENSORS_SPARX5)	+= sparx5-temp.o
 obj-$(CONFIG_SENSORS_STTS751)	+= stts751.o
+obj-$(CONFIG_SENSORS_SY7636A)	+= sy7636a-hwmon.o
 obj-$(CONFIG_SENSORS_AMC6821)	+= amc6821.o
 obj-$(CONFIG_SENSORS_TC74)	+= tc74.o
 obj-$(CONFIG_SENSORS_THMC50)	+= thmc50.o
diff --git a/drivers/hwmon/sy7636a-hwmon.c b/drivers/hwmon/sy7636a-hwmon.c
new file mode 100644
index 000000000000..f5c6b5dca81b
--- /dev/null
+++ b/drivers/hwmon/sy7636a-hwmon.c
@@ -0,0 +1,77 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Functions to access SY3686A power management chip temperature
+ *
+ * Copyright (C) 2019 reMarkable AS - http://www.remarkable.com/
+ *
+ * Authors: Lars Ivar Miljeteig <lars.ivar.miljeteig@remarkable.com>
+ *          Alistair Francis <alistair@alistair23.me>
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/jiffies.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+#include <linux/err.h>
+#include <linux/sysfs.h>
+#include <linux/platform_device.h>
+
+#include <linux/mfd/sy7636a.h>
+
+static ssize_t show_temp(struct device *dev,
+	struct device_attribute *attr, char *buf)
+{
+	unsigned int reg_val;
+	int ret;
+	struct sy7636a *data = dev_get_drvdata(dev);
+
+	ret = regmap_read(data->regmap,
+			SY7636A_REG_TERMISTOR_READOUT, &reg_val);
+	if (ret)
+		return ret;
+
+	return snprintf(buf, PAGE_SIZE, "%d\n", reg_val);
+}
+
+static SENSOR_DEVICE_ATTR(temp0, 0444, show_temp, NULL, 0);
+
+static struct attribute *sy7636a_attrs[] = {
+	&sensor_dev_attr_temp0.dev_attr.attr,
+	NULL
+};
+
+ATTRIBUTE_GROUPS(sy7636a);
+
+static int sy7636a_sensor_probe(struct platform_device *pdev)
+{
+	struct sy7636a *sy7636a = dev_get_drvdata(pdev->dev.parent);
+	struct device *hwmon_dev;
+	int err;
+
+	if (!sy7636a)
+		return -EPROBE_DEFER;
+
+	hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev,
+			"sy7636a_temperature", sy7636a, sy7636a_groups);
+
+	if (IS_ERR(hwmon_dev)) {
+		err = PTR_ERR(hwmon_dev);
+		dev_err(&pdev->dev, "Unable to register hwmon device, returned %d", err);
+		return err;
+	}
+
+	return 0;
+}
+
+static struct platform_driver sy7636a_sensor_driver = {
+	.probe = sy7636a_sensor_probe,
+	.driver = {
+		.name = "sy7636a-temperature",
+	},
+};
+module_platform_driver(sy7636a_sensor_driver);
+
+MODULE_DESCRIPTION("SY7636A sensor driver");
+MODULE_LICENSE("GPL");
-- 
2.31.1


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

* [PATCH v8 05/11] regulator: sy7636a: Remove the poll_enable_time
  2021-08-03  8:44 [PATCH v8 01/11] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml Alistair Francis
                   ` (2 preceding siblings ...)
  2021-08-03  8:44 ` [PATCH v8 04/11] hwmon: sy7636a: Add temperature " Alistair Francis
@ 2021-08-03  8:44 ` Alistair Francis
  2021-08-03  8:44 ` [PATCH v8 06/11] regulator: sy7636a: Use the parent driver data Alistair Francis
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 20+ messages in thread
From: Alistair Francis @ 2021-08-03  8:44 UTC (permalink / raw)
  To: lee.jones, robh+dt, lgirdwood, broonie, linux-imx, kernel
  Cc: devicetree, linux-kernel, alistair23, Alistair Francis

From testing on hardware the poll_enable_time isn't required and
sometimes causes the driver probe to fail so let's remove it.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
 drivers/regulator/sy7636a-regulator.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/regulator/sy7636a-regulator.c b/drivers/regulator/sy7636a-regulator.c
index e021ae08cbaa..c3b34cac8c7f 100644
--- a/drivers/regulator/sy7636a-regulator.c
+++ b/drivers/regulator/sy7636a-regulator.c
@@ -13,8 +13,6 @@
 #include <linux/gpio/consumer.h>
 #include <linux/mfd/sy7636a.h>
 
-#define SY7636A_POLL_ENABLED_TIME 500
-
 static int sy7636a_get_vcom_voltage_op(struct regulator_dev *rdev)
 {
 	int ret;
@@ -61,7 +59,6 @@ static const struct regulator_desc desc = {
 	.owner = THIS_MODULE,
 	.enable_reg = SY7636A_REG_OPERATION_MODE_CRL,
 	.enable_mask = SY7636A_OPERATION_MODE_CRL_ONOFF,
-	.poll_enabled_time = SY7636A_POLL_ENABLED_TIME,
 	.regulators_node = of_match_ptr("regulators"),
 	.of_match = of_match_ptr("vcom"),
 };
-- 
2.31.1


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

* [PATCH v8 06/11] regulator: sy7636a: Use the parent driver data
  2021-08-03  8:44 [PATCH v8 01/11] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml Alistair Francis
                   ` (3 preceding siblings ...)
  2021-08-03  8:44 ` [PATCH v8 05/11] regulator: sy7636a: Remove the poll_enable_time Alistair Francis
@ 2021-08-03  8:44 ` Alistair Francis
  2021-08-03  8:44 ` [PATCH v8 07/11] regulator: sy7636a: Store the epd-pwr-good GPIO locally Alistair Francis
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 20+ messages in thread
From: Alistair Francis @ 2021-08-03  8:44 UTC (permalink / raw)
  To: lee.jones, robh+dt, lgirdwood, broonie, linux-imx, kernel
  Cc: devicetree, linux-kernel, alistair23, Alistair Francis

Use the parent's MFD data instead of our data.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
 drivers/regulator/sy7636a-regulator.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/sy7636a-regulator.c b/drivers/regulator/sy7636a-regulator.c
index c3b34cac8c7f..0bd21c3ea24a 100644
--- a/drivers/regulator/sy7636a-regulator.c
+++ b/drivers/regulator/sy7636a-regulator.c
@@ -33,7 +33,7 @@ static int sy7636a_get_vcom_voltage_op(struct regulator_dev *rdev)
 
 static int sy7636a_get_status(struct regulator_dev *rdev)
 {
-	struct sy7636a *sy7636a = rdev_get_drvdata(rdev);
+	struct sy7636a *sy7636a = dev_get_drvdata(rdev->dev.parent);
 	int ret = 0;
 
 	ret = gpiod_get_value_cansleep(sy7636a->pgood_gpio);
@@ -76,9 +76,9 @@ static int sy7636a_regulator_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, sy7636a);
 
-	gdp = devm_gpiod_get(sy7636a->dev, "epd-pwr-good", GPIOD_IN);
+	gdp = devm_gpiod_get(pdev->dev.parent, "epd-pwr-good", GPIOD_IN);
 	if (IS_ERR(gdp)) {
-		dev_err(sy7636a->dev, "Power good GPIO fault %ld\n", PTR_ERR(gdp));
+		dev_err(pdev->dev.parent, "Power good GPIO fault %ld\n", PTR_ERR(gdp));
 		return PTR_ERR(gdp);
 	}
 
@@ -86,18 +86,18 @@ static int sy7636a_regulator_probe(struct platform_device *pdev)
 
 	ret = regmap_write(sy7636a->regmap, SY7636A_REG_POWER_ON_DELAY_TIME, 0x0);
 	if (ret) {
-		dev_err(sy7636a->dev, "Failed to initialize regulator: %d\n", ret);
+		dev_err(pdev->dev.parent, "Failed to initialize regulator: %d\n", ret);
 		return ret;
 	}
 
 	config.dev = &pdev->dev;
-	config.dev->of_node = sy7636a->dev->of_node;
+	config.dev->of_node = pdev->dev.parent->of_node;
 	config.driver_data = sy7636a;
 	config.regmap = sy7636a->regmap;
 
 	rdev = devm_regulator_register(&pdev->dev, &desc, &config);
 	if (IS_ERR(rdev)) {
-		dev_err(sy7636a->dev, "Failed to register %s regulator\n",
+		dev_err(pdev->dev.parent, "Failed to register %s regulator\n",
 			pdev->name);
 		return PTR_ERR(rdev);
 	}
-- 
2.31.1


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

* [PATCH v8 07/11] regulator: sy7636a: Store the epd-pwr-good GPIO locally
  2021-08-03  8:44 [PATCH v8 01/11] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml Alistair Francis
                   ` (4 preceding siblings ...)
  2021-08-03  8:44 ` [PATCH v8 06/11] regulator: sy7636a: Use the parent driver data Alistair Francis
@ 2021-08-03  8:44 ` Alistair Francis
  2021-08-03  8:44 ` [PATCH v8 08/11] ARM: imx_v6_v7_defconfig: Enable silergy,sy7636a Alistair Francis
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 20+ messages in thread
From: Alistair Francis @ 2021-08-03  8:44 UTC (permalink / raw)
  To: lee.jones, robh+dt, lgirdwood, broonie, linux-imx, kernel
  Cc: devicetree, linux-kernel, alistair23, Alistair Francis

Instead of storing the GPIO state in the mfd (where it isn't used) store
it in the regulator.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
 drivers/regulator/sy7636a-regulator.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/regulator/sy7636a-regulator.c b/drivers/regulator/sy7636a-regulator.c
index 0bd21c3ea24a..37bf2a3c06b7 100644
--- a/drivers/regulator/sy7636a-regulator.c
+++ b/drivers/regulator/sy7636a-regulator.c
@@ -13,6 +13,11 @@
 #include <linux/gpio/consumer.h>
 #include <linux/mfd/sy7636a.h>
 
+struct sy7636a_data {
+	struct sy7636a *sy7636a;
+	struct gpio_desc *pgood_gpio;
+};
+
 static int sy7636a_get_vcom_voltage_op(struct regulator_dev *rdev)
 {
 	int ret;
@@ -33,10 +38,10 @@ static int sy7636a_get_vcom_voltage_op(struct regulator_dev *rdev)
 
 static int sy7636a_get_status(struct regulator_dev *rdev)
 {
-	struct sy7636a *sy7636a = dev_get_drvdata(rdev->dev.parent);
+	struct sy7636a_data *data = dev_get_drvdata(rdev->dev.parent);
 	int ret = 0;
 
-	ret = gpiod_get_value_cansleep(sy7636a->pgood_gpio);
+	ret = gpiod_get_value_cansleep(data->pgood_gpio);
 	if (ret < 0)
 		dev_err(&rdev->dev, "Failed to read pgood gpio: %d\n", ret);
 
@@ -69,20 +74,26 @@ static int sy7636a_regulator_probe(struct platform_device *pdev)
 	struct regulator_config config = { };
 	struct regulator_dev *rdev;
 	struct gpio_desc *gdp;
+	struct sy7636a_data *data;
 	int ret;
 
 	if (!sy7636a)
 		return -EPROBE_DEFER;
 
-	platform_set_drvdata(pdev, sy7636a);
-
 	gdp = devm_gpiod_get(pdev->dev.parent, "epd-pwr-good", GPIOD_IN);
 	if (IS_ERR(gdp)) {
 		dev_err(pdev->dev.parent, "Power good GPIO fault %ld\n", PTR_ERR(gdp));
 		return PTR_ERR(gdp);
 	}
 
-	sy7636a->pgood_gpio = gdp;
+	data = devm_kzalloc(&pdev->dev, sizeof(struct sy7636a_data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	data->sy7636a = sy7636a;
+	data->pgood_gpio = gdp;
+
+	platform_set_drvdata(pdev, data);
 
 	ret = regmap_write(sy7636a->regmap, SY7636A_REG_POWER_ON_DELAY_TIME, 0x0);
 	if (ret) {
-- 
2.31.1


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

* [PATCH v8 08/11] ARM: imx_v6_v7_defconfig: Enable silergy,sy7636a
  2021-08-03  8:44 [PATCH v8 01/11] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml Alistair Francis
                   ` (5 preceding siblings ...)
  2021-08-03  8:44 ` [PATCH v8 07/11] regulator: sy7636a: Store the epd-pwr-good GPIO locally Alistair Francis
@ 2021-08-03  8:44 ` Alistair Francis
  2021-08-03  8:44 ` [PATCH v8 09/11] ARM: dts: imx7d: remarkable2: " Alistair Francis
  2021-08-03 22:35 ` (subset) [PATCH v8 01/11] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml Mark Brown
  8 siblings, 0 replies; 20+ messages in thread
From: Alistair Francis @ 2021-08-03  8:44 UTC (permalink / raw)
  To: lee.jones, robh+dt, lgirdwood, broonie, linux-imx, kernel
  Cc: devicetree, linux-kernel, alistair23, Alistair Francis

Enable the silergy,sy7636a and silergy,sy7636a-regulator for the
reMarkable2.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
 arch/arm/configs/imx_v6_v7_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index ef8c6dca1277..ff3eddb62c1d 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -234,6 +234,7 @@ CONFIG_THERMAL_STATISTICS=y
 CONFIG_THERMAL_WRITABLE_TRIPS=y
 CONFIG_CPU_THERMAL=y
 CONFIG_IMX_THERMAL=y
+CONFIG_SY7636A_THERMAL=y
 CONFIG_WATCHDOG=y
 CONFIG_DA9062_WATCHDOG=y
 CONFIG_DA9063_WATCHDOG=m
@@ -248,6 +249,7 @@ CONFIG_MFD_MC13XXX_I2C=y
 CONFIG_MFD_RN5T618=y
 CONFIG_MFD_STMPE=y
 CONFIG_REGULATOR=y
+CONFIG_MFD_SY7636A=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_REGULATOR_ANATOP=y
 CONFIG_REGULATOR_DA9052=y
@@ -258,6 +260,7 @@ CONFIG_REGULATOR_MC13783=y
 CONFIG_REGULATOR_MC13892=y
 CONFIG_REGULATOR_PFUZE100=y
 CONFIG_REGULATOR_RN5T618=y
+CONFIG_REGULATOR_SY7636A=y
 CONFIG_RC_CORE=y
 CONFIG_RC_DEVICES=y
 CONFIG_IR_GPIO_CIR=y
-- 
2.31.1


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

* [PATCH v8 09/11] ARM: dts: imx7d: remarkable2: Enable silergy,sy7636a
  2021-08-03  8:44 [PATCH v8 01/11] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml Alistair Francis
                   ` (6 preceding siblings ...)
  2021-08-03  8:44 ` [PATCH v8 08/11] ARM: imx_v6_v7_defconfig: Enable silergy,sy7636a Alistair Francis
@ 2021-08-03  8:44 ` Alistair Francis
  2021-08-04 12:43   ` Lee Jones
  2021-08-03 22:35 ` (subset) [PATCH v8 01/11] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml Mark Brown
  8 siblings, 1 reply; 20+ messages in thread
From: Alistair Francis @ 2021-08-03  8:44 UTC (permalink / raw)
  To: lee.jones, robh+dt, lgirdwood, broonie, linux-imx, kernel
  Cc: devicetree, linux-kernel, alistair23, Alistair Francis

Enable the silergy,sy7636a and silergy,sy7636a-regulator on the
reMarkable2.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
 arch/arm/boot/dts/imx7d-remarkable2.dts | 42 +++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/arch/arm/boot/dts/imx7d-remarkable2.dts b/arch/arm/boot/dts/imx7d-remarkable2.dts
index cc33b53ae6ba..9bdae1c1236e 100644
--- a/arch/arm/boot/dts/imx7d-remarkable2.dts
+++ b/arch/arm/boot/dts/imx7d-remarkable2.dts
@@ -86,6 +86,34 @@ wacom_digitizer: digitizer@9 {
 	};
 };
 
+&i2c4 {
+	clock-frequency = <100000>;
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&pinctrl_i2c4>;
+	pinctrl-1 = <&pinctrl_i2c4>;
+	status = "okay";
+
+	epd_pmic: sy7636a@62 {
+		compatible = "silergy,sy7636a";
+		reg = <0x62>;
+		status = "okay";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_epdpmic>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		#thermal-sensor-cells = <0>;
+
+		epd-pwr-good-gpios = <&gpio6 21 GPIO_ACTIVE_HIGH>;
+		regulators {
+			compatible = "silergy,sy7636a-regulator";
+			reg_epdpmic: vcom {
+				regulator-name = "vcom";
+				regulator-boot-on;
+			};
+		};
+	};
+};
+
 &snvs_pwrkey {
 	status = "okay";
 };
@@ -179,6 +207,13 @@ MX7D_PAD_SAI1_TX_BCLK__GPIO6_IO13	0x14
 		>;
 	};
 
+	pinctrl_epdpmic: epdpmicgrp {
+		fsl,pins = <
+			MX7D_PAD_SAI2_RX_DATA__GPIO6_IO21 0x00000074
+			MX7D_PAD_ENET1_RGMII_TXC__GPIO7_IO11 0x00000014
+		>;
+	};
+
 	pinctrl_i2c1: i2c1grp {
 		fsl,pins = <
 			MX7D_PAD_I2C1_SDA__I2C1_SDA		0x4000007f
@@ -186,6 +221,13 @@ MX7D_PAD_I2C1_SCL__I2C1_SCL		0x4000007f
 		>;
 	};
 
+	pinctrl_i2c4: i2c4grp {
+		fsl,pins = <
+			MX7D_PAD_I2C4_SDA__I2C4_SDA		0x4000007f
+			MX7D_PAD_I2C4_SCL__I2C4_SCL		0x4000007f
+		>;
+	};
+
 	pinctrl_uart1: uart1grp {
 		fsl,pins = <
 			MX7D_PAD_UART1_TX_DATA__UART1_DCE_TX	0x79
-- 
2.31.1


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

* Re: [PATCH v8 02/11] mfd: sy7636a: Initial commit
  2021-08-03  8:44 ` [PATCH v8 02/11] mfd: sy7636a: Initial commit Alistair Francis
@ 2021-08-03 13:16   ` Lee Jones
  2021-08-04  8:22     ` Alistair Francis
  0 siblings, 1 reply; 20+ messages in thread
From: Lee Jones @ 2021-08-03 13:16 UTC (permalink / raw)
  To: Alistair Francis
  Cc: robh+dt, lgirdwood, broonie, linux-imx, kernel, devicetree,
	linux-kernel, alistair23

On Tue, 03 Aug 2021, Alistair Francis wrote:

> Initial support for the Silergy SY7636A Power Management chip.
> 
> Signed-off-by: Alistair Francis <alistair@alistair23.me>
> ---
>  drivers/mfd/Kconfig         |  9 +++++
>  drivers/mfd/Makefile        |  1 +
>  drivers/mfd/sy7636a.c       | 72 +++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/sy7636a.h | 45 +++++++++++++++++++++++
>  4 files changed, 127 insertions(+)
>  create mode 100644 drivers/mfd/sy7636a.c
>  create mode 100644 include/linux/mfd/sy7636a.h
> 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 6a3fd2d75f96..b82208f0c79c 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1352,6 +1352,15 @@ config MFD_SYSCON
>  	  Select this option to enable accessing system control registers
>  	  via regmap.
>  
> +config MFD_SY7636A
> +	tristate "Silergy SY7636A Power Management IC"
> +	select MFD_CORE
> +	select REGMAP_I2C
> +	depends on I2C
> +	help
> +	  Select this option to enable support for the Silergy SY7636A
> +	  Power Management IC.
> +
>  config MFD_DAVINCI_VOICECODEC
>  	tristate
>  	select MFD_CORE
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 8116c19d5fd4..cbe581e87fa9 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -266,6 +266,7 @@ obj-$(CONFIG_MFD_KHADAS_MCU) 	+= khadas-mcu.o
>  obj-$(CONFIG_MFD_ACER_A500_EC)	+= acer-ec-a500.o
>  obj-$(CONFIG_MFD_QCOM_PM8008)	+= qcom-pm8008.o
>  
> +obj-$(CONFIG_MFD_SY7636A)	+= sy7636a.o
>  obj-$(CONFIG_SGI_MFD_IOC3)	+= ioc3.o
>  obj-$(CONFIG_MFD_SIMPLE_MFD_I2C)	+= simple-mfd-i2c.o
>  obj-$(CONFIG_MFD_INTEL_M10_BMC)   += intel-m10-bmc.o
> diff --git a/drivers/mfd/sy7636a.c b/drivers/mfd/sy7636a.c
> new file mode 100644
> index 000000000000..f3ff93c7395d
> --- /dev/null
> +++ b/drivers/mfd/sy7636a.c
> @@ -0,0 +1,72 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * MFD parent driver for SY7636A chip
> + *
> + * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/
> + *
> + * Authors: Lars Ivar Miljeteig <lars.ivar.miljeteig@remarkable.com>
> + *          Alistair Francis <alistair@alistair23.me>
> + *
> + * Based on the lp87565 driver by Keerthy <j-keerthy@ti.com>
> + */
> +
> +#include <linux/interrupt.h>
> +#include <linux/mfd/core.h>
> +#include <linux/module.h>
> +#include <linux/of_device.h>
> +
> +#include <linux/mfd/sy7636a.h>
> +
> +static const struct regmap_config sy7636a_regmap_config = {
> +	.reg_bits = 8,
> +	.val_bits = 8,
> +};
> +
> +static const struct mfd_cell sy7636a_cells[] = {
> +	{ .name = "sy7636a-regulator", },

What kind of regulator is 'vcom'? LDO? DCDC?

> +	{ .name = "sy7636a-temperature", },
> +	{ .name = "sy7636a-thermal", },
> +};

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: (subset) [PATCH v8 01/11] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml
  2021-08-03  8:44 [PATCH v8 01/11] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml Alistair Francis
                   ` (7 preceding siblings ...)
  2021-08-03  8:44 ` [PATCH v8 09/11] ARM: dts: imx7d: remarkable2: " Alistair Francis
@ 2021-08-03 22:35 ` Mark Brown
  8 siblings, 0 replies; 20+ messages in thread
From: Mark Brown @ 2021-08-03 22:35 UTC (permalink / raw)
  To: kernel, lee.jones, robh+dt, lgirdwood, Alistair Francis, linux-imx
  Cc: Mark Brown, alistair23, devicetree, linux-kernel

On Tue, 3 Aug 2021 18:44:48 +1000, Alistair Francis wrote:
> Initial support for the Silergy SY7636A Power Management chip
> and regulator.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[05/11] regulator: sy7636a: Remove the poll_enable_time
        commit: e5dad32d90e0e9b006f5c330e92fa0ec9042ae79
[06/11] regulator: sy7636a: Use the parent driver data
        commit: 4cafe1aeb5fb4eb1778d5e1b91d50a078369dbe1
[07/11] regulator: sy7636a: Store the epd-pwr-good GPIO locally
        commit: d38d49b140043bba3ea27b89cca5fefaf08e2034

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

* Re: [PATCH v8 02/11] mfd: sy7636a: Initial commit
  2021-08-03 13:16   ` Lee Jones
@ 2021-08-04  8:22     ` Alistair Francis
  2021-08-04  9:06       ` Lee Jones
  0 siblings, 1 reply; 20+ messages in thread
From: Alistair Francis @ 2021-08-04  8:22 UTC (permalink / raw)
  To: Lee Jones
  Cc: Alistair Francis, Rob Herring, lgirdwood, Mark Brown,
	dl-linux-imx, Sascha Hauer, devicetree,
	Linux Kernel Mailing List

On Tue, Aug 3, 2021 at 11:16 PM Lee Jones <lee.jones@linaro.org> wrote:
>
> On Tue, 03 Aug 2021, Alistair Francis wrote:
>
> > Initial support for the Silergy SY7636A Power Management chip.
> >
> > Signed-off-by: Alistair Francis <alistair@alistair23.me>
> > ---
> >  drivers/mfd/Kconfig         |  9 +++++
> >  drivers/mfd/Makefile        |  1 +
> >  drivers/mfd/sy7636a.c       | 72 +++++++++++++++++++++++++++++++++++++
> >  include/linux/mfd/sy7636a.h | 45 +++++++++++++++++++++++
> >  4 files changed, 127 insertions(+)
> >  create mode 100644 drivers/mfd/sy7636a.c
> >  create mode 100644 include/linux/mfd/sy7636a.h
> >
> > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > index 6a3fd2d75f96..b82208f0c79c 100644
> > --- a/drivers/mfd/Kconfig
> > +++ b/drivers/mfd/Kconfig
> > @@ -1352,6 +1352,15 @@ config MFD_SYSCON
> >         Select this option to enable accessing system control registers
> >         via regmap.
> >
> > +config MFD_SY7636A
> > +     tristate "Silergy SY7636A Power Management IC"
> > +     select MFD_CORE
> > +     select REGMAP_I2C
> > +     depends on I2C
> > +     help
> > +       Select this option to enable support for the Silergy SY7636A
> > +       Power Management IC.
> > +
> >  config MFD_DAVINCI_VOICECODEC
> >       tristate
> >       select MFD_CORE
> > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> > index 8116c19d5fd4..cbe581e87fa9 100644
> > --- a/drivers/mfd/Makefile
> > +++ b/drivers/mfd/Makefile
> > @@ -266,6 +266,7 @@ obj-$(CONFIG_MFD_KHADAS_MCU)      += khadas-mcu.o
> >  obj-$(CONFIG_MFD_ACER_A500_EC)       += acer-ec-a500.o
> >  obj-$(CONFIG_MFD_QCOM_PM8008)        += qcom-pm8008.o
> >
> > +obj-$(CONFIG_MFD_SY7636A)    += sy7636a.o
> >  obj-$(CONFIG_SGI_MFD_IOC3)   += ioc3.o
> >  obj-$(CONFIG_MFD_SIMPLE_MFD_I2C)     += simple-mfd-i2c.o
> >  obj-$(CONFIG_MFD_INTEL_M10_BMC)   += intel-m10-bmc.o
> > diff --git a/drivers/mfd/sy7636a.c b/drivers/mfd/sy7636a.c
> > new file mode 100644
> > index 000000000000..f3ff93c7395d
> > --- /dev/null
> > +++ b/drivers/mfd/sy7636a.c
> > @@ -0,0 +1,72 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * MFD parent driver for SY7636A chip
> > + *
> > + * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/
> > + *
> > + * Authors: Lars Ivar Miljeteig <lars.ivar.miljeteig@remarkable.com>
> > + *          Alistair Francis <alistair@alistair23.me>
> > + *
> > + * Based on the lp87565 driver by Keerthy <j-keerthy@ti.com>
> > + */
> > +
> > +#include <linux/interrupt.h>
> > +#include <linux/mfd/core.h>
> > +#include <linux/module.h>
> > +#include <linux/of_device.h>
> > +
> > +#include <linux/mfd/sy7636a.h>
> > +
> > +static const struct regmap_config sy7636a_regmap_config = {
> > +     .reg_bits = 8,
> > +     .val_bits = 8,
> > +};
> > +
> > +static const struct mfd_cell sy7636a_cells[] = {
> > +     { .name = "sy7636a-regulator", },
>
> What kind of regulator is 'vcom'? LDO? DCDC?

Both I guess:

"SY7636A is a single-chip power management IC (PMIC) designed for
electronic paper display (EPD) applications. The device supports panel
sizes up to 9.7 inches and larger. The device integrates two
high-efficiency DC-DC boost converters, which are boosted to 25V and
-20V by two charge pumps to provide gate driver power for the panel.
Two tracking LDOs create a ±15V source driver power supply that
supports output currents up to 200mA. SY7636A also provides I2C
interface control for specific panel requirements"

Alistair

>
> > +     { .name = "sy7636a-temperature", },
> > +     { .name = "sy7636a-thermal", },
> > +};
>
> --
> Lee Jones [李琼斯]
> Senior Technical Lead - Developer Services
> Linaro.org │ Open source software for Arm SoCs
> Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v8 02/11] mfd: sy7636a: Initial commit
  2021-08-04  8:22     ` Alistair Francis
@ 2021-08-04  9:06       ` Lee Jones
  2021-08-04  9:37         ` Alistair Francis
  0 siblings, 1 reply; 20+ messages in thread
From: Lee Jones @ 2021-08-04  9:06 UTC (permalink / raw)
  To: Alistair Francis
  Cc: Alistair Francis, Rob Herring, lgirdwood, Mark Brown,
	dl-linux-imx, Sascha Hauer, devicetree,
	Linux Kernel Mailing List

On Wed, 04 Aug 2021, Alistair Francis wrote:

> On Tue, Aug 3, 2021 at 11:16 PM Lee Jones <lee.jones@linaro.org> wrote:
> >
> > On Tue, 03 Aug 2021, Alistair Francis wrote:
> >
> > > Initial support for the Silergy SY7636A Power Management chip.
> > >
> > > Signed-off-by: Alistair Francis <alistair@alistair23.me>
> > > ---
> > >  drivers/mfd/Kconfig         |  9 +++++
> > >  drivers/mfd/Makefile        |  1 +
> > >  drivers/mfd/sy7636a.c       | 72 +++++++++++++++++++++++++++++++++++++
> > >  include/linux/mfd/sy7636a.h | 45 +++++++++++++++++++++++
> > >  4 files changed, 127 insertions(+)
> > >  create mode 100644 drivers/mfd/sy7636a.c
> > >  create mode 100644 include/linux/mfd/sy7636a.h
> > >
> > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > > index 6a3fd2d75f96..b82208f0c79c 100644
> > > --- a/drivers/mfd/Kconfig
> > > +++ b/drivers/mfd/Kconfig
> > > @@ -1352,6 +1352,15 @@ config MFD_SYSCON
> > >         Select this option to enable accessing system control registers
> > >         via regmap.
> > >
> > > +config MFD_SY7636A
> > > +     tristate "Silergy SY7636A Power Management IC"
> > > +     select MFD_CORE
> > > +     select REGMAP_I2C
> > > +     depends on I2C
> > > +     help
> > > +       Select this option to enable support for the Silergy SY7636A
> > > +       Power Management IC.
> > > +
> > >  config MFD_DAVINCI_VOICECODEC
> > >       tristate
> > >       select MFD_CORE
> > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> > > index 8116c19d5fd4..cbe581e87fa9 100644
> > > --- a/drivers/mfd/Makefile
> > > +++ b/drivers/mfd/Makefile
> > > @@ -266,6 +266,7 @@ obj-$(CONFIG_MFD_KHADAS_MCU)      += khadas-mcu.o
> > >  obj-$(CONFIG_MFD_ACER_A500_EC)       += acer-ec-a500.o
> > >  obj-$(CONFIG_MFD_QCOM_PM8008)        += qcom-pm8008.o
> > >
> > > +obj-$(CONFIG_MFD_SY7636A)    += sy7636a.o
> > >  obj-$(CONFIG_SGI_MFD_IOC3)   += ioc3.o
> > >  obj-$(CONFIG_MFD_SIMPLE_MFD_I2C)     += simple-mfd-i2c.o
> > >  obj-$(CONFIG_MFD_INTEL_M10_BMC)   += intel-m10-bmc.o
> > > diff --git a/drivers/mfd/sy7636a.c b/drivers/mfd/sy7636a.c
> > > new file mode 100644
> > > index 000000000000..f3ff93c7395d
> > > --- /dev/null
> > > +++ b/drivers/mfd/sy7636a.c
> > > @@ -0,0 +1,72 @@
> > > +// SPDX-License-Identifier: GPL-2.0+
> > > +/*
> > > + * MFD parent driver for SY7636A chip
> > > + *
> > > + * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/
> > > + *
> > > + * Authors: Lars Ivar Miljeteig <lars.ivar.miljeteig@remarkable.com>
> > > + *          Alistair Francis <alistair@alistair23.me>
> > > + *
> > > + * Based on the lp87565 driver by Keerthy <j-keerthy@ti.com>
> > > + */
> > > +
> > > +#include <linux/interrupt.h>
> > > +#include <linux/mfd/core.h>
> > > +#include <linux/module.h>
> > > +#include <linux/of_device.h>
> > > +
> > > +#include <linux/mfd/sy7636a.h>
> > > +
> > > +static const struct regmap_config sy7636a_regmap_config = {
> > > +     .reg_bits = 8,
> > > +     .val_bits = 8,
> > > +};
> > > +
> > > +static const struct mfd_cell sy7636a_cells[] = {
> > > +     { .name = "sy7636a-regulator", },
> >
> > What kind of regulator is 'vcom'? LDO? DCDC?
> 
> Both I guess:
> 
> "SY7636A is a single-chip power management IC (PMIC) designed for
> electronic paper display (EPD) applications. The device supports panel
> sizes up to 9.7 inches and larger. The device integrates two
> high-efficiency DC-DC boost converters, which are boosted to 25V and
> -20V by two charge pumps to provide gate driver power for the panel.
> Two tracking LDOs create a ±15V source driver power supply that
> supports output currents up to 200mA. SY7636A also provides I2C
> interface control for specific panel requirements"

Is there a datasheet I could look at?

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v8 02/11] mfd: sy7636a: Initial commit
  2021-08-04  9:06       ` Lee Jones
@ 2021-08-04  9:37         ` Alistair Francis
  2021-08-04 10:28           ` Lee Jones
  0 siblings, 1 reply; 20+ messages in thread
From: Alistair Francis @ 2021-08-04  9:37 UTC (permalink / raw)
  To: Lee Jones
  Cc: Alistair Francis, Rob Herring, lgirdwood, Mark Brown,
	dl-linux-imx, Sascha Hauer, devicetree,
	Linux Kernel Mailing List

On Wed, Aug 4, 2021 at 7:06 PM Lee Jones <lee.jones@linaro.org> wrote:
>
> On Wed, 04 Aug 2021, Alistair Francis wrote:
>
> > On Tue, Aug 3, 2021 at 11:16 PM Lee Jones <lee.jones@linaro.org> wrote:
> > >
> > > On Tue, 03 Aug 2021, Alistair Francis wrote:
> > >
> > > > Initial support for the Silergy SY7636A Power Management chip.
> > > >
> > > > Signed-off-by: Alistair Francis <alistair@alistair23.me>
> > > > ---
> > > >  drivers/mfd/Kconfig         |  9 +++++
> > > >  drivers/mfd/Makefile        |  1 +
> > > >  drivers/mfd/sy7636a.c       | 72 +++++++++++++++++++++++++++++++++++++
> > > >  include/linux/mfd/sy7636a.h | 45 +++++++++++++++++++++++
> > > >  4 files changed, 127 insertions(+)
> > > >  create mode 100644 drivers/mfd/sy7636a.c
> > > >  create mode 100644 include/linux/mfd/sy7636a.h
> > > >
> > > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > > > index 6a3fd2d75f96..b82208f0c79c 100644
> > > > --- a/drivers/mfd/Kconfig
> > > > +++ b/drivers/mfd/Kconfig
> > > > @@ -1352,6 +1352,15 @@ config MFD_SYSCON
> > > >         Select this option to enable accessing system control registers
> > > >         via regmap.
> > > >
> > > > +config MFD_SY7636A
> > > > +     tristate "Silergy SY7636A Power Management IC"
> > > > +     select MFD_CORE
> > > > +     select REGMAP_I2C
> > > > +     depends on I2C
> > > > +     help
> > > > +       Select this option to enable support for the Silergy SY7636A
> > > > +       Power Management IC.
> > > > +
> > > >  config MFD_DAVINCI_VOICECODEC
> > > >       tristate
> > > >       select MFD_CORE
> > > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> > > > index 8116c19d5fd4..cbe581e87fa9 100644
> > > > --- a/drivers/mfd/Makefile
> > > > +++ b/drivers/mfd/Makefile
> > > > @@ -266,6 +266,7 @@ obj-$(CONFIG_MFD_KHADAS_MCU)      += khadas-mcu.o
> > > >  obj-$(CONFIG_MFD_ACER_A500_EC)       += acer-ec-a500.o
> > > >  obj-$(CONFIG_MFD_QCOM_PM8008)        += qcom-pm8008.o
> > > >
> > > > +obj-$(CONFIG_MFD_SY7636A)    += sy7636a.o
> > > >  obj-$(CONFIG_SGI_MFD_IOC3)   += ioc3.o
> > > >  obj-$(CONFIG_MFD_SIMPLE_MFD_I2C)     += simple-mfd-i2c.o
> > > >  obj-$(CONFIG_MFD_INTEL_M10_BMC)   += intel-m10-bmc.o
> > > > diff --git a/drivers/mfd/sy7636a.c b/drivers/mfd/sy7636a.c
> > > > new file mode 100644
> > > > index 000000000000..f3ff93c7395d
> > > > --- /dev/null
> > > > +++ b/drivers/mfd/sy7636a.c
> > > > @@ -0,0 +1,72 @@
> > > > +// SPDX-License-Identifier: GPL-2.0+
> > > > +/*
> > > > + * MFD parent driver for SY7636A chip
> > > > + *
> > > > + * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/
> > > > + *
> > > > + * Authors: Lars Ivar Miljeteig <lars.ivar.miljeteig@remarkable.com>
> > > > + *          Alistair Francis <alistair@alistair23.me>
> > > > + *
> > > > + * Based on the lp87565 driver by Keerthy <j-keerthy@ti.com>
> > > > + */
> > > > +
> > > > +#include <linux/interrupt.h>
> > > > +#include <linux/mfd/core.h>
> > > > +#include <linux/module.h>
> > > > +#include <linux/of_device.h>
> > > > +
> > > > +#include <linux/mfd/sy7636a.h>
> > > > +
> > > > +static const struct regmap_config sy7636a_regmap_config = {
> > > > +     .reg_bits = 8,
> > > > +     .val_bits = 8,
> > > > +};
> > > > +
> > > > +static const struct mfd_cell sy7636a_cells[] = {
> > > > +     { .name = "sy7636a-regulator", },
> > >
> > > What kind of regulator is 'vcom'? LDO? DCDC?
> >
> > Both I guess:
> >
> > "SY7636A is a single-chip power management IC (PMIC) designed for
> > electronic paper display (EPD) applications. The device supports panel
> > sizes up to 9.7 inches and larger. The device integrates two
> > high-efficiency DC-DC boost converters, which are boosted to 25V and
> > -20V by two charge pumps to provide gate driver power for the panel.
> > Two tracking LDOs create a ±15V source driver power supply that
> > supports output currents up to 200mA. SY7636A also provides I2C
> > interface control for specific panel requirements"
>
> Is there a datasheet I could look at?

I have managed to find this:

https://www.silergy.com/cn/productsview/SY7636ARMC

which is in Chinese. The datasheet is behind a login page unfortunately.

Alistair

>
> --
> Lee Jones [李琼斯]
> Senior Technical Lead - Developer Services
> Linaro.org │ Open source software for Arm SoCs
> Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v8 02/11] mfd: sy7636a: Initial commit
  2021-08-04  9:37         ` Alistair Francis
@ 2021-08-04 10:28           ` Lee Jones
  2021-08-04 10:35             ` Alistair Francis
  0 siblings, 1 reply; 20+ messages in thread
From: Lee Jones @ 2021-08-04 10:28 UTC (permalink / raw)
  To: Alistair Francis
  Cc: Alistair Francis, Rob Herring, lgirdwood, Mark Brown,
	dl-linux-imx, Sascha Hauer, devicetree,
	Linux Kernel Mailing List

On Wed, 04 Aug 2021, Alistair Francis wrote:

> On Wed, Aug 4, 2021 at 7:06 PM Lee Jones <lee.jones@linaro.org> wrote:
> >
> > On Wed, 04 Aug 2021, Alistair Francis wrote:
> >
> > > On Tue, Aug 3, 2021 at 11:16 PM Lee Jones <lee.jones@linaro.org> wrote:
> > > >
> > > > On Tue, 03 Aug 2021, Alistair Francis wrote:
> > > >
> > > > > Initial support for the Silergy SY7636A Power Management chip.
> > > > >
> > > > > Signed-off-by: Alistair Francis <alistair@alistair23.me>
> > > > > ---
> > > > >  drivers/mfd/Kconfig         |  9 +++++
> > > > >  drivers/mfd/Makefile        |  1 +
> > > > >  drivers/mfd/sy7636a.c       | 72 +++++++++++++++++++++++++++++++++++++
> > > > >  include/linux/mfd/sy7636a.h | 45 +++++++++++++++++++++++
> > > > >  4 files changed, 127 insertions(+)
> > > > >  create mode 100644 drivers/mfd/sy7636a.c
> > > > >  create mode 100644 include/linux/mfd/sy7636a.h
> > > > >
> > > > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > > > > index 6a3fd2d75f96..b82208f0c79c 100644
> > > > > --- a/drivers/mfd/Kconfig
> > > > > +++ b/drivers/mfd/Kconfig
> > > > > @@ -1352,6 +1352,15 @@ config MFD_SYSCON
> > > > >         Select this option to enable accessing system control registers
> > > > >         via regmap.
> > > > >
> > > > > +config MFD_SY7636A
> > > > > +     tristate "Silergy SY7636A Power Management IC"
> > > > > +     select MFD_CORE
> > > > > +     select REGMAP_I2C
> > > > > +     depends on I2C
> > > > > +     help
> > > > > +       Select this option to enable support for the Silergy SY7636A
> > > > > +       Power Management IC.
> > > > > +
> > > > >  config MFD_DAVINCI_VOICECODEC
> > > > >       tristate
> > > > >       select MFD_CORE
> > > > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> > > > > index 8116c19d5fd4..cbe581e87fa9 100644
> > > > > --- a/drivers/mfd/Makefile
> > > > > +++ b/drivers/mfd/Makefile
> > > > > @@ -266,6 +266,7 @@ obj-$(CONFIG_MFD_KHADAS_MCU)      += khadas-mcu.o
> > > > >  obj-$(CONFIG_MFD_ACER_A500_EC)       += acer-ec-a500.o
> > > > >  obj-$(CONFIG_MFD_QCOM_PM8008)        += qcom-pm8008.o
> > > > >
> > > > > +obj-$(CONFIG_MFD_SY7636A)    += sy7636a.o
> > > > >  obj-$(CONFIG_SGI_MFD_IOC3)   += ioc3.o
> > > > >  obj-$(CONFIG_MFD_SIMPLE_MFD_I2C)     += simple-mfd-i2c.o
> > > > >  obj-$(CONFIG_MFD_INTEL_M10_BMC)   += intel-m10-bmc.o
> > > > > diff --git a/drivers/mfd/sy7636a.c b/drivers/mfd/sy7636a.c
> > > > > new file mode 100644
> > > > > index 000000000000..f3ff93c7395d
> > > > > --- /dev/null
> > > > > +++ b/drivers/mfd/sy7636a.c
> > > > > @@ -0,0 +1,72 @@
> > > > > +// SPDX-License-Identifier: GPL-2.0+
> > > > > +/*
> > > > > + * MFD parent driver for SY7636A chip
> > > > > + *
> > > > > + * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/
> > > > > + *
> > > > > + * Authors: Lars Ivar Miljeteig <lars.ivar.miljeteig@remarkable.com>
> > > > > + *          Alistair Francis <alistair@alistair23.me>
> > > > > + *
> > > > > + * Based on the lp87565 driver by Keerthy <j-keerthy@ti.com>
> > > > > + */
> > > > > +
> > > > > +#include <linux/interrupt.h>
> > > > > +#include <linux/mfd/core.h>
> > > > > +#include <linux/module.h>
> > > > > +#include <linux/of_device.h>
> > > > > +
> > > > > +#include <linux/mfd/sy7636a.h>
> > > > > +
> > > > > +static const struct regmap_config sy7636a_regmap_config = {
> > > > > +     .reg_bits = 8,
> > > > > +     .val_bits = 8,
> > > > > +};
> > > > > +
> > > > > +static const struct mfd_cell sy7636a_cells[] = {
> > > > > +     { .name = "sy7636a-regulator", },
> > > >
> > > > What kind of regulator is 'vcom'? LDO? DCDC?
> > >
> > > Both I guess:
> > >
> > > "SY7636A is a single-chip power management IC (PMIC) designed for
> > > electronic paper display (EPD) applications. The device supports panel
> > > sizes up to 9.7 inches and larger. The device integrates two
> > > high-efficiency DC-DC boost converters, which are boosted to 25V and
> > > -20V by two charge pumps to provide gate driver power for the panel.
> > > Two tracking LDOs create a ±15V source driver power supply that
> > > supports output currents up to 200mA. SY7636A also provides I2C
> > > interface control for specific panel requirements"
> >
> > Is there a datasheet I could look at?
> 
> I have managed to find this:
> 
> https://www.silergy.com/cn/productsview/SY7636ARMC
> 
> which is in Chinese. The datasheet is behind a login page unfortunately.

Where did the snippet above come from then?

What documentation are you working to?

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v8 02/11] mfd: sy7636a: Initial commit
  2021-08-04 10:28           ` Lee Jones
@ 2021-08-04 10:35             ` Alistair Francis
  0 siblings, 0 replies; 20+ messages in thread
From: Alistair Francis @ 2021-08-04 10:35 UTC (permalink / raw)
  To: Lee Jones
  Cc: Alistair Francis, Rob Herring, lgirdwood, Mark Brown,
	dl-linux-imx, Sascha Hauer, devicetree,
	Linux Kernel Mailing List

On Wed, Aug 4, 2021 at 8:28 PM Lee Jones <lee.jones@linaro.org> wrote:
>
> On Wed, 04 Aug 2021, Alistair Francis wrote:
>
> > On Wed, Aug 4, 2021 at 7:06 PM Lee Jones <lee.jones@linaro.org> wrote:
> > >
> > > On Wed, 04 Aug 2021, Alistair Francis wrote:
> > >
> > > > On Tue, Aug 3, 2021 at 11:16 PM Lee Jones <lee.jones@linaro.org> wrote:
> > > > >
> > > > > On Tue, 03 Aug 2021, Alistair Francis wrote:
> > > > >
> > > > > > Initial support for the Silergy SY7636A Power Management chip.
> > > > > >
> > > > > > Signed-off-by: Alistair Francis <alistair@alistair23.me>
> > > > > > ---
> > > > > >  drivers/mfd/Kconfig         |  9 +++++
> > > > > >  drivers/mfd/Makefile        |  1 +
> > > > > >  drivers/mfd/sy7636a.c       | 72 +++++++++++++++++++++++++++++++++++++
> > > > > >  include/linux/mfd/sy7636a.h | 45 +++++++++++++++++++++++
> > > > > >  4 files changed, 127 insertions(+)
> > > > > >  create mode 100644 drivers/mfd/sy7636a.c
> > > > > >  create mode 100644 include/linux/mfd/sy7636a.h
> > > > > >
> > > > > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > > > > > index 6a3fd2d75f96..b82208f0c79c 100644
> > > > > > --- a/drivers/mfd/Kconfig
> > > > > > +++ b/drivers/mfd/Kconfig
> > > > > > @@ -1352,6 +1352,15 @@ config MFD_SYSCON
> > > > > >         Select this option to enable accessing system control registers
> > > > > >         via regmap.
> > > > > >
> > > > > > +config MFD_SY7636A
> > > > > > +     tristate "Silergy SY7636A Power Management IC"
> > > > > > +     select MFD_CORE
> > > > > > +     select REGMAP_I2C
> > > > > > +     depends on I2C
> > > > > > +     help
> > > > > > +       Select this option to enable support for the Silergy SY7636A
> > > > > > +       Power Management IC.
> > > > > > +
> > > > > >  config MFD_DAVINCI_VOICECODEC
> > > > > >       tristate
> > > > > >       select MFD_CORE
> > > > > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> > > > > > index 8116c19d5fd4..cbe581e87fa9 100644
> > > > > > --- a/drivers/mfd/Makefile
> > > > > > +++ b/drivers/mfd/Makefile
> > > > > > @@ -266,6 +266,7 @@ obj-$(CONFIG_MFD_KHADAS_MCU)      += khadas-mcu.o
> > > > > >  obj-$(CONFIG_MFD_ACER_A500_EC)       += acer-ec-a500.o
> > > > > >  obj-$(CONFIG_MFD_QCOM_PM8008)        += qcom-pm8008.o
> > > > > >
> > > > > > +obj-$(CONFIG_MFD_SY7636A)    += sy7636a.o
> > > > > >  obj-$(CONFIG_SGI_MFD_IOC3)   += ioc3.o
> > > > > >  obj-$(CONFIG_MFD_SIMPLE_MFD_I2C)     += simple-mfd-i2c.o
> > > > > >  obj-$(CONFIG_MFD_INTEL_M10_BMC)   += intel-m10-bmc.o
> > > > > > diff --git a/drivers/mfd/sy7636a.c b/drivers/mfd/sy7636a.c
> > > > > > new file mode 100644
> > > > > > index 000000000000..f3ff93c7395d
> > > > > > --- /dev/null
> > > > > > +++ b/drivers/mfd/sy7636a.c
> > > > > > @@ -0,0 +1,72 @@
> > > > > > +// SPDX-License-Identifier: GPL-2.0+
> > > > > > +/*
> > > > > > + * MFD parent driver for SY7636A chip
> > > > > > + *
> > > > > > + * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/
> > > > > > + *
> > > > > > + * Authors: Lars Ivar Miljeteig <lars.ivar.miljeteig@remarkable.com>
> > > > > > + *          Alistair Francis <alistair@alistair23.me>
> > > > > > + *
> > > > > > + * Based on the lp87565 driver by Keerthy <j-keerthy@ti.com>
> > > > > > + */
> > > > > > +
> > > > > > +#include <linux/interrupt.h>
> > > > > > +#include <linux/mfd/core.h>
> > > > > > +#include <linux/module.h>
> > > > > > +#include <linux/of_device.h>
> > > > > > +
> > > > > > +#include <linux/mfd/sy7636a.h>
> > > > > > +
> > > > > > +static const struct regmap_config sy7636a_regmap_config = {
> > > > > > +     .reg_bits = 8,
> > > > > > +     .val_bits = 8,
> > > > > > +};
> > > > > > +
> > > > > > +static const struct mfd_cell sy7636a_cells[] = {
> > > > > > +     { .name = "sy7636a-regulator", },
> > > > >
> > > > > What kind of regulator is 'vcom'? LDO? DCDC?
> > > >
> > > > Both I guess:
> > > >
> > > > "SY7636A is a single-chip power management IC (PMIC) designed for
> > > > electronic paper display (EPD) applications. The device supports panel
> > > > sizes up to 9.7 inches and larger. The device integrates two
> > > > high-efficiency DC-DC boost converters, which are boosted to 25V and
> > > > -20V by two charge pumps to provide gate driver power for the panel.
> > > > Two tracking LDOs create a ±15V source driver power supply that
> > > > supports output currents up to 200mA. SY7636A also provides I2C
> > > > interface control for specific panel requirements"
> > >
> > > Is there a datasheet I could look at?
> >
> > I have managed to find this:
> >
> > https://www.silergy.com/cn/productsview/SY7636ARMC
> >
> > which is in Chinese. The datasheet is behind a login page unfortunately.
>
> Where did the snippet above come from then?

It's the translation of the above link.

>
> What documentation are you working to?

It's based on the vendor driver and then testing on hardware.

Alistair

>
> --
> Lee Jones [李琼斯]
> Senior Technical Lead - Developer Services
> Linaro.org │ Open source software for Arm SoCs
> Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v8 09/11] ARM: dts: imx7d: remarkable2: Enable silergy,sy7636a
  2021-08-03  8:44 ` [PATCH v8 09/11] ARM: dts: imx7d: remarkable2: " Alistair Francis
@ 2021-08-04 12:43   ` Lee Jones
  2021-08-05  8:05     ` Alistair Francis
  0 siblings, 1 reply; 20+ messages in thread
From: Lee Jones @ 2021-08-04 12:43 UTC (permalink / raw)
  To: Alistair Francis
  Cc: robh+dt, lgirdwood, broonie, linux-imx, kernel, devicetree,
	linux-kernel, alistair23

On Tue, 03 Aug 2021, Alistair Francis wrote:

> Enable the silergy,sy7636a and silergy,sy7636a-regulator on the
> reMarkable2.
> 
> Signed-off-by: Alistair Francis <alistair@alistair23.me>
> ---
>  arch/arm/boot/dts/imx7d-remarkable2.dts | 42 +++++++++++++++++++++++++
>  1 file changed, 42 insertions(+)

I don't see the DT documentation for this device.

Has it been accepted/merged already?

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v8 09/11] ARM: dts: imx7d: remarkable2: Enable silergy,sy7636a
  2021-08-04 12:43   ` Lee Jones
@ 2021-08-05  8:05     ` Alistair Francis
  2021-08-05  8:26       ` Lee Jones
  0 siblings, 1 reply; 20+ messages in thread
From: Alistair Francis @ 2021-08-05  8:05 UTC (permalink / raw)
  To: Lee Jones
  Cc: Alistair Francis, Rob Herring, lgirdwood, Mark Brown,
	dl-linux-imx, Sascha Hauer, devicetree,
	Linux Kernel Mailing List

On Wed, Aug 4, 2021 at 10:43 PM Lee Jones <lee.jones@linaro.org> wrote:
>
> On Tue, 03 Aug 2021, Alistair Francis wrote:
>
> > Enable the silergy,sy7636a and silergy,sy7636a-regulator on the
> > reMarkable2.
> >
> > Signed-off-by: Alistair Francis <alistair@alistair23.me>
> > ---
> >  arch/arm/boot/dts/imx7d-remarkable2.dts | 42 +++++++++++++++++++++++++
> >  1 file changed, 42 insertions(+)
>
> I don't see the DT documentation for this device.

Which device?

The imx7d-remarkable2 is in current master and there is a single line
at `Documentation/devicetree/bindings/arm/fsl.yaml`

The silergy,sy7636a-regulator is also already in master, but it isn't
exposed to device tree and the compatible string shouldn't be included
in this patch. I'll fix that.

Alistair

>
> Has it been accepted/merged already?
>
> --
> Lee Jones [李琼斯]
> Senior Technical Lead - Developer Services
> Linaro.org │ Open source software for Arm SoCs
> Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v8 09/11] ARM: dts: imx7d: remarkable2: Enable silergy,sy7636a
  2021-08-05  8:05     ` Alistair Francis
@ 2021-08-05  8:26       ` Lee Jones
  2021-08-05  8:37         ` Alistair Francis
  0 siblings, 1 reply; 20+ messages in thread
From: Lee Jones @ 2021-08-05  8:26 UTC (permalink / raw)
  To: Alistair Francis
  Cc: Alistair Francis, Rob Herring, lgirdwood, Mark Brown,
	dl-linux-imx, Sascha Hauer, devicetree,
	Linux Kernel Mailing List

On Thu, 05 Aug 2021, Alistair Francis wrote:

> On Wed, Aug 4, 2021 at 10:43 PM Lee Jones <lee.jones@linaro.org> wrote:
> >
> > On Tue, 03 Aug 2021, Alistair Francis wrote:
> >
> > > Enable the silergy,sy7636a and silergy,sy7636a-regulator on the
> > > reMarkable2.
> > >
> > > Signed-off-by: Alistair Francis <alistair@alistair23.me>
> > > ---
> > >  arch/arm/boot/dts/imx7d-remarkable2.dts | 42 +++++++++++++++++++++++++
> > >  1 file changed, 42 insertions(+)
> >
> > I don't see the DT documentation for this device.
> 
> Which device?
> 
> The imx7d-remarkable2 is in current master and there is a single line
> at `Documentation/devicetree/bindings/arm/fsl.yaml`
> 
> The silergy,sy7636a-regulator is also already in master, but it isn't

I think this is currently in -next.

It won't land in Mainline (what I believe you're calling "master")
until the next merge window, which is about a month.

> exposed to device tree and the compatible string shouldn't be included
> in this patch. I'll fix that.

Okay, this is essentially what I was getting at.

The node should really be documented and Acked by the DT guys.

..

Anyway, I have a new toy for you to play with.

I'll Cc you on the patch.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v8 09/11] ARM: dts: imx7d: remarkable2: Enable silergy,sy7636a
  2021-08-05  8:26       ` Lee Jones
@ 2021-08-05  8:37         ` Alistair Francis
  0 siblings, 0 replies; 20+ messages in thread
From: Alistair Francis @ 2021-08-05  8:37 UTC (permalink / raw)
  To: Lee Jones
  Cc: Alistair Francis, Rob Herring, lgirdwood, Mark Brown,
	dl-linux-imx, Sascha Hauer, devicetree,
	Linux Kernel Mailing List

On Thu, Aug 5, 2021 at 6:26 PM Lee Jones <lee.jones@linaro.org> wrote:
>
> On Thu, 05 Aug 2021, Alistair Francis wrote:
>
> > On Wed, Aug 4, 2021 at 10:43 PM Lee Jones <lee.jones@linaro.org> wrote:
> > >
> > > On Tue, 03 Aug 2021, Alistair Francis wrote:
> > >
> > > > Enable the silergy,sy7636a and silergy,sy7636a-regulator on the
> > > > reMarkable2.
> > > >
> > > > Signed-off-by: Alistair Francis <alistair@alistair23.me>
> > > > ---
> > > >  arch/arm/boot/dts/imx7d-remarkable2.dts | 42 +++++++++++++++++++++++++
> > > >  1 file changed, 42 insertions(+)
> > >
> > > I don't see the DT documentation for this device.
> >
> > Which device?
> >
> > The imx7d-remarkable2 is in current master and there is a single line
> > at `Documentation/devicetree/bindings/arm/fsl.yaml`
> >
> > The silergy,sy7636a-regulator is also already in master, but it isn't
>
> I think this is currently in -next.

Sorry, I thought it was in mainline at this point.

>
> It won't land in Mainline (what I believe you're calling "master")
> until the next merge window, which is about a month.

Ah, yep. I meant to say mainline. Every project has different terminology.

>
> > exposed to device tree and the compatible string shouldn't be included
> > in this patch. I'll fix that.
>
> Okay, this is essentially what I was getting at.
>
> The node should really be documented and Acked by the DT guys.

Should the regulator have it's own DT binding documentation? From what
I could tell just including it in mfd bindings was enough.

>
> ..
>
> Anyway, I have a new toy for you to play with.
>
> I'll Cc you on the patch.

I'll keep a look out!

Alistair

>
> --
> Lee Jones [李琼斯]
> Senior Technical Lead - Developer Services
> Linaro.org │ Open source software for Arm SoCs
> Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2021-08-05  8:37 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03  8:44 [PATCH v8 01/11] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml Alistair Francis
2021-08-03  8:44 ` [PATCH v8 02/11] mfd: sy7636a: Initial commit Alistair Francis
2021-08-03 13:16   ` Lee Jones
2021-08-04  8:22     ` Alistair Francis
2021-08-04  9:06       ` Lee Jones
2021-08-04  9:37         ` Alistair Francis
2021-08-04 10:28           ` Lee Jones
2021-08-04 10:35             ` Alistair Francis
2021-08-03  8:44 ` [PATCH v8 03/11] thermal: sy7636a: Add thermal driver for sy7636a Alistair Francis
2021-08-03  8:44 ` [PATCH v8 04/11] hwmon: sy7636a: Add temperature " Alistair Francis
2021-08-03  8:44 ` [PATCH v8 05/11] regulator: sy7636a: Remove the poll_enable_time Alistair Francis
2021-08-03  8:44 ` [PATCH v8 06/11] regulator: sy7636a: Use the parent driver data Alistair Francis
2021-08-03  8:44 ` [PATCH v8 07/11] regulator: sy7636a: Store the epd-pwr-good GPIO locally Alistair Francis
2021-08-03  8:44 ` [PATCH v8 08/11] ARM: imx_v6_v7_defconfig: Enable silergy,sy7636a Alistair Francis
2021-08-03  8:44 ` [PATCH v8 09/11] ARM: dts: imx7d: remarkable2: " Alistair Francis
2021-08-04 12:43   ` Lee Jones
2021-08-05  8:05     ` Alistair Francis
2021-08-05  8:26       ` Lee Jones
2021-08-05  8:37         ` Alistair Francis
2021-08-03 22:35 ` (subset) [PATCH v8 01/11] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).