v16:
- Improve vdd regulator comments
v15:
- Address comments on the patches
v14:
- Merge the thermal driver and hwmon
v13:
- Address comments on thermal driver
- Rebase on master (without other patches)
v12:
- Rebase
v11:
- Address comments on hwmon
- Improve "mfd: simple-mfd-i2c: Add a Kconfig name" commit message
v10:
- Use dev_get_regmap() instead of dev_get_drvdata()
v9:
- Convert to use the simple-mfd-i2c instead
Alistair Francis (8):
dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml
mfd: simple-mfd-i2c: Add a Kconfig name
mfd: simple-mfd-i2c: Enable support for the silergy,sy7636a
regulator: sy7636a: Remove requirement on sy7636a mfd
hwmon: sy7636a: Add temperature driver for sy7636a
ARM: imx_v6_v7_defconfig: Enable silergy,sy7636a
ARM: dts: imx7d: remarkable2: Enable silergy,sy7636a
ARM: dts: imx7d: remarkable2: Enable lcdif
.../bindings/mfd/silergy,sy7636a.yaml | 82 +++++++++++
Documentation/hwmon/index.rst | 1 +
Documentation/hwmon/sy7636a-hwmon.rst | 24 ++++
arch/arm/boot/dts/imx7d-remarkable2.dts | 135 ++++++++++++++++++
arch/arm/configs/imx_v6_v7_defconfig | 3 +
drivers/hwmon/Kconfig | 9 ++
drivers/hwmon/Makefile | 1 +
drivers/hwmon/sy7636a-hwmon.c | 107 ++++++++++++++
drivers/mfd/Kconfig | 2 +-
drivers/mfd/simple-mfd-i2c.c | 11 ++
drivers/regulator/Kconfig | 1 -
drivers/regulator/sy7636a-regulator.c | 7 +-
include/linux/mfd/sy7636a.h | 34 +++++
13 files changed, 413 insertions(+), 4 deletions(-)
create mode 100644 Documentation/devicetree/bindings/mfd/silergy,sy7636a.yaml
create mode 100644 Documentation/hwmon/sy7636a-hwmon.rst
create mode 100644 drivers/hwmon/sy7636a-hwmon.c
create mode 100644 include/linux/mfd/sy7636a.h
--
2.31.1
Initial support for the Silergy SY7636A Power Management chip
and regulator.
Signed-off-by: Alistair Francis <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Acked-for-MFD-by: Lee Jones <[email protected]>
---
.../bindings/mfd/silergy,sy7636a.yaml | 82 +++++++++++++++++++
1 file changed, 82 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..6de74c701635
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/silergy,sy7636a.yaml
@@ -0,0 +1,82 @@
+# 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 <[email protected]>
+
+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#
+ description:
+ The regulator for the compenstation voltage. Enabling/disabling this
+ enables/disables the entire device.
+ 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 {
+ reg_epdpmic: vcom {
+ regulator-name = "vcom";
+ regulator-boot-on;
+ };
+ };
+ };
+ };
+...
--
2.31.1
Add a Kconfig name to the "Simple Multi-Functional Device support (I2C)"
device so that it can be enabled via menuconfig.
Signed-off-by: Alistair Francis <[email protected]>
Acked-for-MFD-by: Lee Jones <[email protected]>
---
drivers/mfd/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 3fb480818599..97976ea83fdf 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1194,7 +1194,7 @@ config MFD_SI476X_CORE
module will be called si476x-core.
config MFD_SIMPLE_MFD_I2C
- tristate
+ tristate "Simple Multi-Functional Device support (I2C)"
depends on I2C
select MFD_CORE
select REGMAP_I2C
--
2.31.1
Signed-off-by: Alistair Francis <[email protected]>
Acked-for-MFD-by: Lee Jones <[email protected]>
---
drivers/mfd/simple-mfd-i2c.c | 11 +++++++++++
include/linux/mfd/sy7636a.h | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+)
create mode 100644 include/linux/mfd/sy7636a.h
diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
index 51536691ad9d..f4c8fc3ee463 100644
--- a/drivers/mfd/simple-mfd-i2c.c
+++ b/drivers/mfd/simple-mfd-i2c.c
@@ -62,8 +62,19 @@ static int simple_mfd_i2c_probe(struct i2c_client *i2c)
return ret;
}
+static const struct mfd_cell sy7636a_cells[] = {
+ { .name = "sy7636a-regulator", },
+ { .name = "sy7636a-temperature", },
+};
+
+static const struct simple_mfd_data silergy_sy7636a = {
+ .mfd_cell = sy7636a_cells,
+ .mfd_cell_size = ARRAY_SIZE(sy7636a_cells),
+};
+
static const struct of_device_id simple_mfd_i2c_of_match[] = {
{ .compatible = "kontron,sl28cpld" },
+ { .compatible = "silergy,sy7636a", .data = &silergy_sy7636a},
{}
};
MODULE_DEVICE_TABLE(of, simple_mfd_i2c_of_match);
diff --git a/include/linux/mfd/sy7636a.h b/include/linux/mfd/sy7636a.h
new file mode 100644
index 000000000000..22f03b2f851e
--- /dev/null
+++ b/include/linux/mfd/sy7636a.h
@@ -0,0 +1,34 @@
+/* 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
+
+#define SY7636A_REG_OPERATION_MODE_CRL 0x00
+/* It is set if a gpio is used to control the regulator */
+#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_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
+
+#endif /* __LINUX_MFD_SY7636A_H */
--
2.31.1
Signed-off-by: Alistair Francis <[email protected]>
Acked-by: Mark Brown <[email protected]>
---
drivers/regulator/Kconfig | 1 -
drivers/regulator/sy7636a-regulator.c | 7 +++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 6be9b1c8a615..3e515a3fae73 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -1199,7 +1199,6 @@ config REGULATOR_STW481X_VMMC
config REGULATOR_SY7636A
tristate "Silergy SY7636A voltage regulator"
- depends on MFD_SY7636A
help
This driver supports Silergy SY3686A voltage regulator.
diff --git a/drivers/regulator/sy7636a-regulator.c b/drivers/regulator/sy7636a-regulator.c
index 22fddf868e4c..29fc27c2cda0 100644
--- a/drivers/regulator/sy7636a-regulator.c
+++ b/drivers/regulator/sy7636a-regulator.c
@@ -7,11 +7,14 @@
// Authors: Lars Ivar Miljeteig <[email protected]>
// Alistair Francis <[email protected]>
+#include <linux/gpio/consumer.h>
+#include <linux/i2c.h>
+#include <linux/mfd/sy7636a.h>
#include <linux/module.h>
#include <linux/platform_device.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/machine.h>
#include <linux/regmap.h>
-#include <linux/gpio/consumer.h>
-#include <linux/mfd/sy7636a.h>
struct sy7636a_data {
struct regmap *regmap;
--
2.31.1
This is a multi-function device to interface with the sy7636a
EPD PMIC chip from Silergy.
Signed-off-by: Alistair Francis <[email protected]>
---
Documentation/hwmon/index.rst | 1 +
Documentation/hwmon/sy7636a-hwmon.rst | 24 ++++++
drivers/hwmon/Kconfig | 9 +++
drivers/hwmon/Makefile | 1 +
drivers/hwmon/sy7636a-hwmon.c | 107 ++++++++++++++++++++++++++
5 files changed, 142 insertions(+)
create mode 100644 Documentation/hwmon/sy7636a-hwmon.rst
create mode 100644 drivers/hwmon/sy7636a-hwmon.c
diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst
index 7046bf1870d9..a887308850cd 100644
--- a/Documentation/hwmon/index.rst
+++ b/Documentation/hwmon/index.rst
@@ -180,6 +180,7 @@ Hardware Monitoring Kernel Drivers
smsc47m1
sparx5-temp
stpddc60
+ sy7636a-hwmon
tc654
tc74
thmc50
diff --git a/Documentation/hwmon/sy7636a-hwmon.rst b/Documentation/hwmon/sy7636a-hwmon.rst
new file mode 100644
index 000000000000..6b3e36d028dd
--- /dev/null
+++ b/Documentation/hwmon/sy7636a-hwmon.rst
@@ -0,0 +1,24 @@
+Kernel driver sy7636a-hwmon
+=========================
+
+Supported chips:
+
+ * Silergy SY7636A PMIC
+
+
+Description
+-----------
+
+This driver adds hardware temperature reading support for
+the Silergy SY7636A PMIC.
+
+The following sensors are supported
+
+ * Temperature
+ - SoC on-die temperature in milli-degree C
+
+sysfs-Interface
+---------------
+
+temp0_input
+ - SoC on-die temperature (milli-degree C)
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 64bd3dfba2c4..3139a286c35a 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1662,6 +1662,15 @@ 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"
+ 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 baee6a8d4dd1..8f8da52098d1 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -182,6 +182,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..3cc3afcdfb2d
--- /dev/null
+++ b/drivers/hwmon/sy7636a-hwmon.c
@@ -0,0 +1,107 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Functions to access SY3686A power management chip temperature
+ *
+ * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/
+ *
+ * Authors: Lars Ivar Miljeteig <[email protected]>
+ * Alistair Francis <[email protected]>
+ */
+
+#include <linux/err.h>
+#include <linux/hwmon.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/regulator/machine.h>
+
+#include <linux/mfd/sy7636a.h>
+
+static int sy7636a_read(struct device *dev, enum hwmon_sensor_types type,
+ u32 attr, int channel, long *temp)
+{
+ struct regmap *regmap = dev_get_drvdata(dev);
+ int ret, reg_val;
+
+ ret = regmap_read(regmap,
+ SY7636A_REG_TERMISTOR_READOUT, ®_val);
+ if (ret)
+ return ret;
+
+ *temp = reg_val * 1000;
+
+ return 0;
+}
+
+static umode_t sy7636a_is_visible(const void *data,
+ enum hwmon_sensor_types type,
+ u32 attr, int channel)
+{
+ if (type != hwmon_temp)
+ return 0;
+
+ if (attr != hwmon_temp_input)
+ return 0;
+
+ return 0444;
+}
+
+static const struct hwmon_ops sy7636a_hwmon_ops = {
+ .is_visible = sy7636a_is_visible,
+ .read = sy7636a_read,
+};
+
+static const struct hwmon_channel_info *sy7636a_info[] = {
+ HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
+ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
+ NULL
+};
+
+static const struct hwmon_chip_info sy7636a_chip_info = {
+ .ops = &sy7636a_hwmon_ops,
+ .info = sy7636a_info,
+};
+
+static int sy7636a_sensor_probe(struct platform_device *pdev)
+{
+ struct regmap *regmap = dev_get_regmap(pdev->dev.parent, NULL);
+ struct regulator *regulator;
+ struct device *hwmon_dev;
+ int err;
+
+ if (!regmap)
+ return -EPROBE_DEFER;
+
+ regulator = devm_regulator_get(&pdev->dev, "vcom");
+ if (IS_ERR(regulator)) {
+ return PTR_ERR(regulator);
+ }
+
+ err = regulator_enable(regulator);
+ if (err) {
+ return err;
+ }
+
+ hwmon_dev = devm_hwmon_device_register_with_info(&pdev->dev,
+ "sy7636a_temperature", regmap, &sy7636a_chip_info, NULL);
+
+ if (IS_ERR(hwmon_dev)) {
+ err = PTR_ERR(hwmon_dev);
+ dev_err(&pdev->dev, "Unable to register hwmon device, returned %d\n", 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
Enable the silergy,sy7636a and silergy,sy7636a-regulator for the
reMarkable2.
Signed-off-by: Alistair Francis <[email protected]>
---
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 1fbb8e45e604..6add186e189e 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -223,6 +223,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
@@ -239,6 +240,7 @@ CONFIG_MFD_DA9063=y
CONFIG_MFD_MC13XXX_SPI=y
CONFIG_MFD_MC13XXX_I2C=y
CONFIG_MFD_RN5T618=y
+CONFIG_MFD_SIMPLE_MFD_I2C=y
CONFIG_MFD_STMPE=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_REGULATOR_ANATOP=y
@@ -251,6 +253,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
Enable the silergy,sy7636a and silergy,sy7636a-regulator on the
reMarkable2.
Signed-off-by: Alistair Francis <[email protected]>
---
arch/arm/boot/dts/imx7d-remarkable2.dts | 62 +++++++++++++++++++++++++
1 file changed, 62 insertions(+)
diff --git a/arch/arm/boot/dts/imx7d-remarkable2.dts b/arch/arm/boot/dts/imx7d-remarkable2.dts
index 89cbf13097a4..b66d28b30d75 100644
--- a/arch/arm/boot/dts/imx7d-remarkable2.dts
+++ b/arch/arm/boot/dts/imx7d-remarkable2.dts
@@ -22,6 +22,27 @@ memory@80000000 {
reg = <0x80000000 0x40000000>;
};
+ thermal-zones {
+ epd-thermal {
+ thermal-sensors = <&epd_pmic>;
+ polling-delay-passive = <30000>;
+ polling-delay = <30000>;
+ trips {
+ trip0 {
+ temperature = <49000>;
+ hysteresis = <2000>;
+ type = "passive";
+ };
+
+ trip1 {
+ temperature = <50000>;
+ hysteresis = <2000>;
+ type = "critical";
+ };
+ };
+ };
+ };
+
reg_brcm: regulator-brcm {
compatible = "regulator-fixed";
regulator-name = "brcm_reg";
@@ -51,6 +72,33 @@ &clks {
assigned-clock-rates = <0>, <32768>;
};
+&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 {
+ reg_epdpmic: vcom {
+ regulator-name = "vcom";
+ regulator-boot-on;
+ };
+ };
+ };
+};
+
&snvs_pwrkey {
status = "okay";
};
@@ -125,6 +173,20 @@ 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_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
Connect the dispaly on the reMarkable2.
Signed-off-by: Alistair Francis <[email protected]>
---
arch/arm/boot/dts/imx7d-remarkable2.dts | 73 +++++++++++++++++++++++++
1 file changed, 73 insertions(+)
diff --git a/arch/arm/boot/dts/imx7d-remarkable2.dts b/arch/arm/boot/dts/imx7d-remarkable2.dts
index b66d28b30d75..bb0c68d24583 100644
--- a/arch/arm/boot/dts/imx7d-remarkable2.dts
+++ b/arch/arm/boot/dts/imx7d-remarkable2.dts
@@ -55,6 +55,16 @@ reg_brcm: regulator-brcm {
startup-delay-us = <150>;
};
+ reg_sdoe: regulator-sdoe {
+ compatible = "regulator-fixed";
+ regulator-name = "SDOE";
+ pinctrl-names = "default", "sleep";
+ pinctrl-0 = <&pinctrl_sdoe_reg>;
+ pinctrl-1 = <&pinctrl_sdoe_reg>;
+ gpio = <&gpio3 27 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ };
+
wifi_pwrseq: wifi_pwrseq {
compatible = "mmc-pwrseq-simple";
pinctrl-names = "default";
@@ -63,6 +73,16 @@ wifi_pwrseq: wifi_pwrseq {
clocks = <&clks IMX7D_CLKO2_ROOT_DIV>;
clock-names = "ext_clock";
};
+
+ panel {
+ compatible = "eink,vb3300-kca";
+
+ port {
+ panel_in: endpoint {
+ remote-endpoint = <&display_out>;
+ };
+ };
+ };
};
&clks {
@@ -99,6 +119,20 @@ reg_epdpmic: vcom {
};
};
+&lcdif {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_lcdif>;
+ lcd-supply = <®_epdpmic>;
+ lcd2-supply = <®_sdoe>;
+ status = "okay";
+
+ port {
+ display_out: endpoint {
+ remote-endpoint = <&panel_in>;
+ };
+ };
+};
+
&snvs_pwrkey {
status = "okay";
};
@@ -187,6 +221,45 @@ MX7D_PAD_I2C4_SCL__I2C4_SCL 0x4000007f
>;
};
+ pinctrl_lcdif: lcdifgrp {
+ fsl,pins = <
+ MX7D_PAD_LCD_DATA00__LCD_DATA0 0x79
+ MX7D_PAD_LCD_DATA01__LCD_DATA1 0x79
+ MX7D_PAD_LCD_DATA02__LCD_DATA2 0x79
+ MX7D_PAD_LCD_DATA03__LCD_DATA3 0x79
+ MX7D_PAD_LCD_DATA04__LCD_DATA4 0x79
+ MX7D_PAD_LCD_DATA05__LCD_DATA5 0x79
+ MX7D_PAD_LCD_DATA06__LCD_DATA6 0x79
+ MX7D_PAD_LCD_DATA07__LCD_DATA7 0x79
+ MX7D_PAD_LCD_DATA08__LCD_DATA8 0x79
+ MX7D_PAD_LCD_DATA09__LCD_DATA9 0x79
+ MX7D_PAD_LCD_DATA10__LCD_DATA10 0x79
+ MX7D_PAD_LCD_DATA11__LCD_DATA11 0x79
+ MX7D_PAD_LCD_DATA12__LCD_DATA12 0x79
+ MX7D_PAD_LCD_DATA13__LCD_DATA13 0x79
+ MX7D_PAD_LCD_DATA14__LCD_DATA14 0x79
+ MX7D_PAD_LCD_DATA15__LCD_DATA15 0x79
+
+ MX7D_PAD_LCD_DATA17__LCD_DATA17 0x79
+ MX7D_PAD_LCD_DATA18__LCD_DATA18 0x79
+ MX7D_PAD_LCD_DATA19__LCD_DATA19 0x79
+ MX7D_PAD_LCD_DATA20__LCD_DATA20 0x79
+ MX7D_PAD_LCD_DATA21__LCD_DATA21 0x79
+
+ MX7D_PAD_LCD_DATA23__LCD_DATA23 0x79
+ MX7D_PAD_LCD_CLK__LCD_CLK 0x79
+ MX7D_PAD_LCD_ENABLE__LCD_ENABLE 0x79
+ MX7D_PAD_LCD_VSYNC__LCD_VSYNC 0x79
+ MX7D_PAD_LCD_HSYNC__LCD_HSYNC 0x79
+ MX7D_PAD_LCD_RESET__LCD_RESET 0x79
+ >;
+ };
+
+ fsl,pins = <
+ MX7D_PAD_LCD_DATA22__GPIO3_IO27 0x74
+ >;
+ };
+
pinctrl_uart1: uart1grp {
fsl,pins = <
MX7D_PAD_UART1_TX_DATA__UART1_DCE_TX 0x79
--
2.31.1
On 12/2/21 4:07 AM, Alistair Francis wrote:
> This is a multi-function device to interface with the sy7636a
> EPD PMIC chip from Silergy.
>
> Signed-off-by: Alistair Francis <[email protected]>
There are still some checkpatch warnings.
WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
#49: FILE: Documentation/hwmon/sy7636a-hwmon.rst:1:
+Kernel driver sy7636a-hwmon
WARNING: braces {} are not necessary for single statement blocks
#187: FILE: drivers/hwmon/sy7636a-hwmon.c:77:
+ if (IS_ERR(regulator)) {
+ return PTR_ERR(regulator);
+ }
WARNING: braces {} are not necessary for single statement blocks
#192: FILE: drivers/hwmon/sy7636a-hwmon.c:82:
+ if (err) {
+ return err;
+ }
Please fix those as well as the trivial CHECK messages reported by
checkpatch --strict. A MAINTAINERS update isn't needed, though,
unless you want to.
Thanks,
Guenter
> ---
> Documentation/hwmon/index.rst | 1 +
> Documentation/hwmon/sy7636a-hwmon.rst | 24 ++++++
> drivers/hwmon/Kconfig | 9 +++
> drivers/hwmon/Makefile | 1 +
> drivers/hwmon/sy7636a-hwmon.c | 107 +++++++++++++++++++++++++
> 5 files changed, 142 insertions(+)
> create mode 100644 Documentation/hwmon/sy7636a-hwmon.rst
> create mode 100644 drivers/hwmon/sy7636a-hwmon.c
>
> diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst
> index 7046bf1870d9..a887308850cd 100644
> --- a/Documentation/hwmon/index.rst
> +++ b/Documentation/hwmon/index.rst
> @@ -180,6 +180,7 @@ Hardware Monitoring Kernel Drivers
> smsc47m1
> sparx5-temp
> stpddc60
> + sy7636a-hwmon
> tc654
> tc74
> thmc50
> diff --git a/Documentation/hwmon/sy7636a-hwmon.rst b/Documentation/hwmon/sy7636a-hwmon.rst
> new file mode 100644
> index 000000000000..6b3e36d028dd
> --- /dev/null
> +++ b/Documentation/hwmon/sy7636a-hwmon.rst
> @@ -0,0 +1,24 @@
> +Kernel driver sy7636a-hwmon
> +=========================
> +
> +Supported chips:
> +
> + * Silergy SY7636A PMIC
> +
> +
> +Description
> +-----------
> +
> +This driver adds hardware temperature reading support for
> +the Silergy SY7636A PMIC.
> +
> +The following sensors are supported
> +
> + * Temperature
> + - SoC on-die temperature in milli-degree C
> +
> +sysfs-Interface
> +---------------
> +
> +temp0_input
> + - SoC on-die temperature (milli-degree C)
> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index 64bd3dfba2c4..3139a286c35a 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -1662,6 +1662,15 @@ 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"
> + 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 baee6a8d4dd1..8f8da52098d1 100644
> --- a/drivers/hwmon/Makefile
> +++ b/drivers/hwmon/Makefile
> @@ -182,6 +182,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..3cc3afcdfb2d
> --- /dev/null
> +++ b/drivers/hwmon/sy7636a-hwmon.c
> @@ -0,0 +1,107 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Functions to access SY3686A power management chip temperature
> + *
> + * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/
> + *
> + * Authors: Lars Ivar Miljeteig <[email protected]>
> + * Alistair Francis <[email protected]>
> + */
> +
> +#include <linux/err.h>
> +#include <linux/hwmon.h>
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +#include <linux/regulator/machine.h>
> +
> +#include <linux/mfd/sy7636a.h>
> +
> +static int sy7636a_read(struct device *dev, enum hwmon_sensor_types type,
> + u32 attr, int channel, long *temp)
> +{
> + struct regmap *regmap = dev_get_drvdata(dev);
> + int ret, reg_val;
> +
> + ret = regmap_read(regmap,
> + SY7636A_REG_TERMISTOR_READOUT, ®_val);
> + if (ret)
> + return ret;
> +
> + *temp = reg_val * 1000;
> +
> + return 0;
> +}
> +
> +static umode_t sy7636a_is_visible(const void *data,
> + enum hwmon_sensor_types type,
> + u32 attr, int channel)
> +{
> + if (type != hwmon_temp)
> + return 0;
> +
> + if (attr != hwmon_temp_input)
> + return 0;
> +
> + return 0444;
> +}
> +
> +static const struct hwmon_ops sy7636a_hwmon_ops = {
> + .is_visible = sy7636a_is_visible,
> + .read = sy7636a_read,
> +};
> +
> +static const struct hwmon_channel_info *sy7636a_info[] = {
> + HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
> + HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
> + NULL
> +};
> +
> +static const struct hwmon_chip_info sy7636a_chip_info = {
> + .ops = &sy7636a_hwmon_ops,
> + .info = sy7636a_info,
> +};
> +
> +static int sy7636a_sensor_probe(struct platform_device *pdev)
> +{
> + struct regmap *regmap = dev_get_regmap(pdev->dev.parent, NULL);
> + struct regulator *regulator;
> + struct device *hwmon_dev;
> + int err;
> +
> + if (!regmap)
> + return -EPROBE_DEFER;
> +
> + regulator = devm_regulator_get(&pdev->dev, "vcom");
> + if (IS_ERR(regulator)) {
> + return PTR_ERR(regulator);
> + }
> +
> + err = regulator_enable(regulator);
> + if (err) {
> + return err;
> + }
> +
> + hwmon_dev = devm_hwmon_device_register_with_info(&pdev->dev,
> + "sy7636a_temperature", regmap, &sy7636a_chip_info, NULL);
> +
> + if (IS_ERR(hwmon_dev)) {
> + err = PTR_ERR(hwmon_dev);
> + dev_err(&pdev->dev, "Unable to register hwmon device, returned %d\n", 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");
>
On Thu, 2 Dec 2021 22:07:58 +1000
Alistair Francis <[email protected]> wrote:
> Connect the dispaly on the reMarkable2.
>
> Signed-off-by: Alistair Francis <[email protected]>
> ---
> arch/arm/boot/dts/imx7d-remarkable2.dts | 73 +++++++++++++++++++++++++
> 1 file changed, 73 insertions(+)
>
> diff --git a/arch/arm/boot/dts/imx7d-remarkable2.dts b/arch/arm/boot/dts/imx7d-remarkable2.dts
> index b66d28b30d75..bb0c68d24583 100644
> --- a/arch/arm/boot/dts/imx7d-remarkable2.dts
> +++ b/arch/arm/boot/dts/imx7d-remarkable2.dts
[...]
> @@ -187,6 +221,45 @@ MX7D_PAD_I2C4_SCL__I2C4_SCL 0x4000007f
> >;
> };
>
> + pinctrl_lcdif: lcdifgrp {
> + fsl,pins = <
> + MX7D_PAD_LCD_DATA00__LCD_DATA0 0x79
> + MX7D_PAD_LCD_DATA01__LCD_DATA1 0x79
> + MX7D_PAD_LCD_DATA02__LCD_DATA2 0x79
> + MX7D_PAD_LCD_DATA03__LCD_DATA3 0x79
> + MX7D_PAD_LCD_DATA04__LCD_DATA4 0x79
> + MX7D_PAD_LCD_DATA05__LCD_DATA5 0x79
> + MX7D_PAD_LCD_DATA06__LCD_DATA6 0x79
> + MX7D_PAD_LCD_DATA07__LCD_DATA7 0x79
> + MX7D_PAD_LCD_DATA08__LCD_DATA8 0x79
> + MX7D_PAD_LCD_DATA09__LCD_DATA9 0x79
> + MX7D_PAD_LCD_DATA10__LCD_DATA10 0x79
> + MX7D_PAD_LCD_DATA11__LCD_DATA11 0x79
> + MX7D_PAD_LCD_DATA12__LCD_DATA12 0x79
> + MX7D_PAD_LCD_DATA13__LCD_DATA13 0x79
> + MX7D_PAD_LCD_DATA14__LCD_DATA14 0x79
> + MX7D_PAD_LCD_DATA15__LCD_DATA15 0x79
> +
> + MX7D_PAD_LCD_DATA17__LCD_DATA17 0x79
> + MX7D_PAD_LCD_DATA18__LCD_DATA18 0x79
> + MX7D_PAD_LCD_DATA19__LCD_DATA19 0x79
> + MX7D_PAD_LCD_DATA20__LCD_DATA20 0x79
> + MX7D_PAD_LCD_DATA21__LCD_DATA21 0x79
> +
> + MX7D_PAD_LCD_DATA23__LCD_DATA23 0x79
> + MX7D_PAD_LCD_CLK__LCD_CLK 0x79
> + MX7D_PAD_LCD_ENABLE__LCD_ENABLE 0x79
> + MX7D_PAD_LCD_VSYNC__LCD_VSYNC 0x79
> + MX7D_PAD_LCD_HSYNC__LCD_HSYNC 0x79
> + MX7D_PAD_LCD_RESET__LCD_RESET 0x79
> + >;
> + };
shouldn't this belong into the upper list:
> +
> + fsl,pins = <
> + MX7D_PAD_LCD_DATA22__GPIO3_IO27 0x74
> + >;
> + };
> +
probably some rebase or merge accident. If I submit non-trivial things,
I usually apply my patches to a separate git tree and do a final
compile, that might help to reduce some trouble.
Regards,
Andreas
On Mon, Dec 6, 2021 at 7:07 AM Andreas Kemnade <[email protected]> wrote:
>
> On Thu, 2 Dec 2021 22:07:58 +1000
> Alistair Francis <[email protected]> wrote:
>
> > Connect the dispaly on the reMarkable2.
> >
> > Signed-off-by: Alistair Francis <[email protected]>
> > ---
> > arch/arm/boot/dts/imx7d-remarkable2.dts | 73 +++++++++++++++++++++++++
> > 1 file changed, 73 insertions(+)
> >
> > diff --git a/arch/arm/boot/dts/imx7d-remarkable2.dts b/arch/arm/boot/dts/imx7d-remarkable2.dts
> > index b66d28b30d75..bb0c68d24583 100644
> > --- a/arch/arm/boot/dts/imx7d-remarkable2.dts
> > +++ b/arch/arm/boot/dts/imx7d-remarkable2.dts
> [...]
>
> > @@ -187,6 +221,45 @@ MX7D_PAD_I2C4_SCL__I2C4_SCL 0x4000007f
> > >;
> > };
> >
> > + pinctrl_lcdif: lcdifgrp {
> > + fsl,pins = <
> > + MX7D_PAD_LCD_DATA00__LCD_DATA0 0x79
> > + MX7D_PAD_LCD_DATA01__LCD_DATA1 0x79
> > + MX7D_PAD_LCD_DATA02__LCD_DATA2 0x79
> > + MX7D_PAD_LCD_DATA03__LCD_DATA3 0x79
> > + MX7D_PAD_LCD_DATA04__LCD_DATA4 0x79
> > + MX7D_PAD_LCD_DATA05__LCD_DATA5 0x79
> > + MX7D_PAD_LCD_DATA06__LCD_DATA6 0x79
> > + MX7D_PAD_LCD_DATA07__LCD_DATA7 0x79
> > + MX7D_PAD_LCD_DATA08__LCD_DATA8 0x79
> > + MX7D_PAD_LCD_DATA09__LCD_DATA9 0x79
> > + MX7D_PAD_LCD_DATA10__LCD_DATA10 0x79
> > + MX7D_PAD_LCD_DATA11__LCD_DATA11 0x79
> > + MX7D_PAD_LCD_DATA12__LCD_DATA12 0x79
> > + MX7D_PAD_LCD_DATA13__LCD_DATA13 0x79
> > + MX7D_PAD_LCD_DATA14__LCD_DATA14 0x79
> > + MX7D_PAD_LCD_DATA15__LCD_DATA15 0x79
> > +
> > + MX7D_PAD_LCD_DATA17__LCD_DATA17 0x79
> > + MX7D_PAD_LCD_DATA18__LCD_DATA18 0x79
> > + MX7D_PAD_LCD_DATA19__LCD_DATA19 0x79
> > + MX7D_PAD_LCD_DATA20__LCD_DATA20 0x79
> > + MX7D_PAD_LCD_DATA21__LCD_DATA21 0x79
> > +
> > + MX7D_PAD_LCD_DATA23__LCD_DATA23 0x79
> > + MX7D_PAD_LCD_CLK__LCD_CLK 0x79
> > + MX7D_PAD_LCD_ENABLE__LCD_ENABLE 0x79
> > + MX7D_PAD_LCD_VSYNC__LCD_VSYNC 0x79
> > + MX7D_PAD_LCD_HSYNC__LCD_HSYNC 0x79
> > + MX7D_PAD_LCD_RESET__LCD_RESET 0x79
> > + >;
> > + };
>
> shouldn't this belong into the upper list:
> > +
> > + fsl,pins = <
> > + MX7D_PAD_LCD_DATA22__GPIO3_IO27 0x74
> > + >;
> > + };
> > +
>
> probably some rebase or merge accident. If I submit non-trivial things,
> I usually apply my patches to a separate git tree and do a final
> compile, that might help to reduce some trouble.
Yeah, it was a rebase error. I split these patches out from my working tree.
Alistair
>
> Regards,
> Andreas