regulator: Add Maxim MAX17135 E-paper PMIC driver
Subsystems (4)
cover regulator: Add Maxim MAX17135 E-paper PMIC driver
This series adds support for the Maxim MAX17135, a power management IC for E-paper displays. It provides the source and gate driver rails, a VCOM amplifier and a temperature sensor. My use case is the Onyx Boox Leaf e-reader (SDM636). The board devicetree is not upstream yet.
The layout follows the TPS65185, FP9931 and SY7636A drivers. Patch 1 adds the binding, patch 2 the regulator driver and patch 3 the hwmon driver, which needs the header that patch 2 adds.
The chip keeps VCOM and the sequencing delays in a non-volatile memory that survives only a few writes. The driver never writes it; both are only set through the volatile registers.
Testing:
- Onyx Boox Leaf, 7.2.y kernel (sdm660-mainline) with this series and two local patches: devm_kzalloc() instead of devm_kzalloc_obj(), which 7.2 lacks, and a board specific supply and preset check. 14 display updates, one of them after a suspend to idle and resume, all drew correctly. The die temperature reads 22.5 to 25.5 degrees C.
- dt_binding_check, arm64 build with W=1 and sparse, x86_64 build with W=1 and CONFIG_OF disabled, htmldocs: no warnings.
Not tested, as this board does not use them: switching with the EN and CEN GPIOs, and setting VCOM and the delays from the devicetree. The power good timeout and fault paths did not trigger.
AI disclosure: I prepared this series with Claude Code (Anthropic, Claude Fable 5.2). It drafted the binding, the drivers and the commit messages from the datasheet and my requirements. The builds and tests above were run under my supervision; I checked the display in the hardware tests, reviewed every line, and take responsibility for the patches.
---
Michiel van Beers (3):
regulator: dt-bindings: Add Maxim MAX17135
regulator: Add Maxim MAX17135 driver
hwmon: Add Maxim MAX17135 temperature sensor driver
.../bindings/regulator/maxim,max17135.yaml | 155 +++++ Documentation/hwmon/index.rst | 1 + Documentation/hwmon/max17135.rst | 37 ++ MAINTAINERS | 10 + drivers/hwmon/Kconfig | 11 + drivers/hwmon/Makefile | 1 + drivers/hwmon/max17135-hwmon.c | 135 +++++ drivers/regulator/Kconfig | 14 + drivers/regulator/Makefile | 1 + drivers/regulator/max17135.c | 643 +++++++++++++++++++++ include/linux/regulator/max17135.h | 18 + 11 files changed, 1026 insertions(+)
---
base-commit: b042f5dd8365861242946476b0e298bb95a32927
change-id: 20261202-max17135-0e9cb4752f8f
Best regards,
Signature · 1 line
Michiel van Beers <[email protected]>
PATCH 1/3 regulator: dt-bindings: Add Maxim MAX17135
The MAX17135 is a power management IC for E-paper displays. It provides the source and gate driver rails, a VCOM amplifier with a non-volatile preset and a temperature sensor.
Describe the whole chip, including the pins and settings that a first driver does not use yet.
--- .../bindings/regulator/maxim,max17135.yaml | 155 +++++++++++++++++++++ 1 file changed, 155 insertions(+)
Documentation/devicetree/bindings/regulator/maxim,max17135.yaml new file +155 -0
@@ -0,0 +1,155 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/maxim,max17135.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Maxim MAX17135 Power Management IC for E-Paper Displays + +maintainers: + - Michiel van Beers <[email protected]> + +description: | + The MAX17135 powers an electrophoretic (E-paper) display. It provides the + source driver rails POS and NEG (+15 V and -15 V), the gate driver rails + GVDD and GVEE, a VCOM amplifier with a non-volatile preset, and a + temperature sensor with an internal and an external diode channel. + + POS, NEG, GVDD and GVEE are sequenced together and are described as one + regulator, vposneg. VCOM is a second regulator supplied by the first. + + Datasheet: + https://www.analog.com/media/en/technical-documentation/data-sheets/MAX17135.pdf + +properties: + compatible: + const: maxim,max17135 + + reg: + maxItems: 1 + + enable-gpios: + description: + EN pin. Starts the power-up sequence of the display rails. If absent, + the rails are switched through the Enable register and the pin must be + low or unconnected. + maxItems: 1 + + vcom-ctrl-gpios: + description: + CEN pin. Enables the VCOM output. If absent, VCOM is switched through + the Enable register and the pin must be low or unconnected. + maxItems: 1 + + pwr-good-gpios: + description: + POK pin. High when all display rails are in regulation. + maxItems: 1 + + interrupts: + description: + FLT pin. Open drain, low while a fault is latched. + maxItems: 1 + + vin-supply: + description: + Supply of the IN and INN pins (2.7 V to 5.5 V). + + vdd-supply: + description: + Supply of the VDD pin, the logic and I2C supply (1.6 V to 5.5 V). + + maxim,power-up-delays-ms: + description: + Delays t1 to t4 of the power-up sequence, for GVEE, NEG, POS and GVDD + in that order. If absent, the values preset in the non-volatile memory + are used. + minItems: 4 + maxItems: 4 + items: + maximum: 255 + + maxim,power-down-delays-ms: + description: + Delays t5 to t8 of the power-down sequence, for GVDD, POS, NEG and + GVEE in that order. If absent, the values preset in the non-volatile + memory are used. + minItems: 4 + maxItems: 4 + items: + maximum: 255 + + regulators: + type: object + additionalProperties: false + + properties: + vposneg: + type: object + $ref: /schemas/regulator/regulator.yaml# + unevaluatedProperties: false + description: + The display rails POS, NEG, GVDD and GVEE. + + vcom: + type: object + $ref: /schemas/regulator/regulator.yaml# + unevaluatedProperties: false + description: + The VCOM output. The voltage is negative; it is given as a + positive magnitude from 500000 to 3050000 microvolts. If no + voltage is given, the value preset in the non-volatile memory is + used. + + properties: + vposneg-supply: + description: + The vposneg regulator of this chip. + + required: + - vposneg-supply + +required: + - compatible + - reg + - pwr-good-gpios + - vin-supply + - regulators + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + #include <dt-bindings/interrupt-controller/irq.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pmic@48 { + compatible = "maxim,max17135"; + reg = <0x48>; + pwr-good-gpios = <&gpio2 7 GPIO_ACTIVE_HIGH>; + enable-gpios = <&gpio2 8 GPIO_ACTIVE_HIGH>; + vcom-ctrl-gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; + interrupts-extended = <&gpio2 0 IRQ_TYPE_LEVEL_LOW>; + vin-supply = <®_epd_3v3>; + vdd-supply = <®_1v8>; + maxim,power-up-delays-ms = <30 60 90 120>; + maxim,power-down-delays-ms = <30 60 90 120>; + + regulators { + epd_vposneg: vposneg { + regulator-name = "epd-vposneg"; + }; + + vcom { + regulator-name = "epd-vcom"; + regulator-min-microvolt = <1250000>; + regulator-max-microvolt = <1250000>; + vposneg-supply = <&epd_vposneg>; + }; + }; + }; + };
Signature · 1 line
2.43.0
PATCH 2/3 regulator: Add Maxim MAX17135 driver
In reply to Michiel van BeersAdd a driver for the MAX17135 E-paper display PMIC.
The display rails POS, NEG, GVDD and GVEE share one enable and one power good signal, so implement them as a single regulator, vposneg. VCOM is a second regulator, supplied by vposneg.
VCOM is only set through the volatile DVR register; the non-volatile memory is never written. As VCOM is panel specific, refuse to enable it while the chip holds a default value and the device tree gives no voltage.
The temperature sensor is exposed to a hwmon driver through an auxiliary device.
--- MAINTAINERS | 8 + drivers/regulator/Kconfig | 14 + drivers/regulator/Makefile | 1 + drivers/regulator/max17135.c | 643 +++++++++++++++++++++++++++++++++++++ include/linux/regulator/max17135.h | 18 ++ 5 files changed, 684 insertions(+)
MAINTAINERS +8 -0
@@ -16491,6 +16491,14 @@ S: Maintained F: Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml F: drivers/power/supply/max17042_battery.c +MAXIM MAX17135 E-PAPER DISPLAY PMIC DRIVER +M: Michiel van Beers <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/regulator/maxim,max17135.yaml +F: drivers/regulator/max17135.c +F: include/linux/regulator/max17135.h + MAXIM MAX20086 CAMERA POWER PROTECTOR DRIVER M: Laurent Pinchart <[email protected]> L: [email protected]
drivers/regulator/Kconfig +14 -0
@@ -622,6 +622,20 @@ config REGULATOR_MAX1586 regulator via I2C bus. The provided regulator is suitable for PXA27x chips to control VCC_CORE and VCC_USIM voltages. +config REGULATOR_MAX17135 + tristate "Maxim MAX17135 E-paper display PMIC" + depends on I2C + select REGMAP_I2C + select AUXILIARY_BUS + help + This driver supports the Maxim MAX17135 power management IC for + E-paper displays. It provides the display rails and the VCOM + output as regulators. The temperature sensor of the chip is + supported by a separate hardware monitoring driver. + + This driver can also be built as a module. If so, the module + will be called max17135. + config REGULATOR_MAX5970 tristate "Maxim 5970/5978 power switch and monitor" depends on I2C
drivers/regulator/Makefile +1 -0
@@ -75,6 +75,7 @@ obj-$(CONFIG_REGULATOR_LTC3589) += ltc3589.o obj-$(CONFIG_REGULATOR_LTC3676) += ltc3676.o obj-$(CONFIG_REGULATOR_MAX14577) += max14577-regulator.o obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o +obj-$(CONFIG_REGULATOR_MAX17135) += max17135.o obj-$(CONFIG_REGULATOR_MAX5970) += max5970-regulator.o obj-$(CONFIG_REGULATOR_MAX77503) += max77503-regulator.o obj-$(CONFIG_REGULATOR_MAX77541) += max77541-regulator.o
drivers/regulator/max17135.c new file +643 -0
643 lines not on this page · raw message
include/linux/regulator/max17135.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Maxim MAX17135 E-paper display PMIC */ + +#ifndef __LINUX_REGULATOR_MAX17135_H +#define __LINUX_REGULATOR_MAX17135_H + +struct device ; + +enum max17135_temp_channel { +MAX17135_TEMP_INTERNAL , +MAX17135_TEMP_EXTERNAL , +}; + +int max17135_read_temp (struct device *dev, +enum max17135_temp_channel channel, +long *millicelsius); + +#endif
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH 2/3] regulator: Add Maxim MAX17135 driver
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] regulator: max17135: range clamping marks VCOM programmed in max17135_probe() --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] regulator: max17135: range clamping marks VCOM programmed in max17135_probe()
--
commit 35331644fea93af4e5f64e9e127a8eda105b1887
Author: Michiel van Beers <[email protected]>
regulator: Add Maxim MAX17135 driver
This commit adds a regulator driver for the Maxim MAX17135 E-paper display PMIC, exposing the vposneg and vcom regulators and creating an auxiliary device for the temperature sensor.
Quoted 5 lines
drivers/regulator/max17135.c new file +0
-0
[ ... ]
Quoted 31 lines
drivers/regulator/max17135.c new file +31
-0+static int max17135_vcom_set_voltage_sel (struct regulator_dev *rdev, +unsigned int selector) +{ +struct max17135 *ddata =rdev_get_drvdata (rdev); +int ret; + + ret =regulator_set_voltage_sel_regmap (rdev, selector); +if (ret) +return ret; + + ddata->vcom_sel = selector; + ddata->vcom_programmed = true; + +return 0 ; +} + +static const struct regulator_ops max17135_vcom_ops = { + .list_voltage = regulator_list_voltage_linear, + .map_voltage = regulator_map_voltage_linear, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + .set_voltage_sel = max17135_vcom_set_voltage_sel, + .enable = max17135_vcom_enable, + .disable = max17135_vcom_disable, + .is_enabled = max17135_vcom_is_enabled, +}; + +static int max17135_vcom_of_parse (struct device_node *np, +const struct regulator_desc *desc, +struct regulator_config *config) +{ +struct max17135 *ddata = config->driver_data;
drivers/regulator/max17135.c line 359
Quoted 10 lines
drivers/regulator/max17135.c new file +10
-0+u32 min, max; + +/* A single voltage in the DT is the calibration of this panel. */ +if (!of_property_read_u32 (np,"regulator-min-microvolt" , &min) && + !of_property_read_u32 (np,"regulator-max-microvolt" , &max) && + min == max) + ddata->vcom_programmed = true; + +return 0 ; +}
[Severity: Medium]
Can constraint clamping during devm_regulator_register() prematurely mark ddata->vcom_programmed true when the device tree defines a voltage range (min < max)?
When both regulator-min-microvolt and regulator-max-microvolt are specified, of_get_regulation_constraints() sets constraints->apply_uV = true. If the chip's default MAX17135_REG_DVR value (such as MAX17135_DVR_POR at 3.05 V or MAX17135_DVR_FACTORY at 1.77 V) falls outside [min, max], machine_constraints_voltage() clamps the voltage into range by calling max17135_vcom_set_voltage_sel() before devm_regulator_register() returns.
That writes the uncalibrated range boundary into MAX17135_REG_DVR and sets ddata->vcom_programmed = true, which suppresses the uncalibrated VCOM warning in max17135_probe() and allows max17135_vcom_enable() to enable VCOM at the boundary voltage before a consumer sets a calibrated value.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH 2/3] regulator: Add Maxim MAX17135 driver
Quoted 3 lines · On Wed, Dec 2, 2026 at 5:54 PM <[email protected]> wrote:
Can constraint clamping during
devm_regulator_register()prematurely markddata->vcom_programmedtrue when the device tree defines a voltage range (min < max)?
I have a fix ready for this and will include it in v2, together with any other feedback. The driver then reads DVR once in probe, before the VCOM regulator is registered, and remembers whether the chip is calibrated. A voltage that the core applies during registration no longer sets vcom_programmed, so an uncalibrated chip keeps VCOM off until a consumer sets a voltage.
Warm regards,
Michiel
PATCH 3/3 hwmon: Add Maxim MAX17135 temperature sensor driver
In reply to Michiel van BeersThe MAX17135 E-paper display PMIC has a temperature sensor that measures the die and an external diode. Add a driver for it. The driver binds to the auxiliary device that the regulator driver creates.
Reading the external channel fails with -ENODATA while the chip reports the diode as open or shorted.
--- Documentation/hwmon/index.rst | 1 + Documentation/hwmon/max17135.rst | 37 +++++++++++ MAINTAINERS | 2 + drivers/hwmon/Kconfig | 11 ++++ drivers/hwmon/Makefile | 1 + drivers/hwmon/max17135-hwmon.c | 135 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 187 insertions(+)
Documentation/hwmon/index.rst +1 -0
@@ -164,6 +164,7 @@ Hardware Monitoring Kernel Drivers max1619 max16601 max1668 + max17135 max17616 max197 max20730
Documentation/hwmon/max17135.rst new file +37 -0
@@ -0,0 +1,37 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +Kernel driver max17135-hwmon +============================ + +Supported chips: + + * Maxim MAX17135 + + Prefix: 'max17135' + + Datasheet: + + https://www.analog.com/media/en/technical-documentation/data-sheets/MAX17135.pdf + +Author: Michiel van Beers <[email protected]> + +Description +----------- + +The MAX17135 is a power management IC for E-paper displays. This driver +supports its temperature sensor, which measures the temperature of the die and +of an external diode. + +Both channels have a resolution of 0.5 degrees Celsius. The chip converts once +per second by default. + +Sysfs entries +------------- + +=============== ============================================================== +temp1_input Die temperature +temp2_input Temperature of the external diode. Reading it fails with + ENODATA while temp2_fault is set. +temp2_fault 1 if the external diode is open or shorted, for example + because the board has none +=============== ==============================================================
MAINTAINERS +2 -0
@@ -16496,6 +16496,8 @@ M: Michiel van Beers <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/regulator/maxim,max17135.yaml +F: Documentation/hwmon/max17135.rst +F: drivers/hwmon/max17135-hwmon.c F: drivers/regulator/max17135.c F: include/linux/regulator/max17135.h
drivers/hwmon/Kconfig +11 -0
@@ -1311,6 +1311,17 @@ config SENSORS_MAX1668 This driver can also be built as a module. If so, the module will be called max1668. +config SENSORS_MAX17135 + tristate "Maxim MAX17135 temperature sensor" + depends on REGULATOR_MAX17135 + help + If you say yes here you get support for the temperature sensor + of the Maxim MAX17135 E-paper display PMIC: the die temperature + and an external diode. + + This driver can also be built as a module. If so, the module + will be called max17135-hwmon. + config SENSORS_MAX197 tristate "Maxim MAX197 and compatibles" help
drivers/hwmon/Makefile +1 -0
@@ -162,6 +162,7 @@ obj-$(CONFIG_SENSORS_MAX127) += max127.o obj-$(CONFIG_SENSORS_MAX16065) += max16065.o obj-$(CONFIG_SENSORS_MAX1619) += max1619.o obj-$(CONFIG_SENSORS_MAX1668) += max1668.o +obj-$(CONFIG_SENSORS_MAX17135) += max17135-hwmon.o obj-$(CONFIG_SENSORS_MAX197) += max197.o obj-$(CONFIG_SENSORS_MAX31722) += max31722.o obj-$(CONFIG_SENSORS_MAX31730) += max31730.o
drivers/hwmon/max17135-hwmon.c new file +135 -0
135 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH 3/3] hwmon: Add Maxim MAX17135 temperature sensor driver
Quoted 9 lines · On Wed, 02 Dec 2026 17:43:40 +0100 Michiel van Beers via B4 Relay…
From: Michiel van Beers <[email protected]>
The MAX17135 E-paper display PMIC has a temperature sensor that measures the die and an external diode. Add a driver for it. The driver binds to the auxiliary device that the regulator driver creates.
Reading the external channel fails with
-ENODATAwhile the chip reports the diode as open or shorted.
just in general: do have something cooking to use temperature you graphics driver? Pinebook folks use an non-mainline iio driver instead and use the iio in-kernel driver.
bindings/display/repaper.txt
defines a separate thermal-zone and the corresponding the drm driver uses thermal zone api to get temperature. For Kobos (display is not in mainline) I currntly do the same. Another dirty way of doing things...
It is on my todo list to provide a clean interface.
Regards,
Andreas
Quoted 254 lines
Signed-off-by Michiel van Beers <[email protected]>--- Documentation/hwmon/index.rst | 1 + Documentation/hwmon/max17135.rst | 37 +++++++++++ MAINTAINERS | 2 + drivers/hwmon/Kconfig | 11 ++++ drivers/hwmon/Makefile | 1 + drivers/hwmon/max17135-hwmon.c | 135 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 187 insertions(+)Documentation/hwmon/index.rst +1
-0@@ -164,6 +164,7 @@ Hardware Monitoring Kernel Drivers max1619 max16601 max1668 + max17135 max17616 max197 max20730Documentation/hwmon/max17135.rst new file +37
-0@@ -0,0 +1,37 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +Kernel driver max17135-hwmon +============================ + +Supported chips: + + * Maxim MAX17135 + + Prefix: 'max17135' + + Datasheet: + + https://www.analog.com/media/en/technical-documentation/data-sheets/MAX17135.pdf + +Author: Michiel van Beers <[email protected]> + +Description +----------- + +The MAX17135 is a power management IC for E-paper displays. This driver +supports its temperature sensor, which measures the temperature of the die and +of an external diode. + +Both channels have a resolution of 0.5 degrees Celsius. The chip converts once +per second by default. + +Sysfs entries +------------- + +=============== ============================================================== +temp1_input Die temperature +temp2_input Temperature of the external diode. Reading it fails with + ENODATA while temp2_fault is set. +temp2_fault 1 if the external diode is open or shorted, for example + because the board has none +=============== ==============================================================MAINTAINERS +2
-0@@ -16496,6 +16496,8 @@ M: Michiel van Beers <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/regulator/maxim,max17135.yaml +F: Documentation/hwmon/max17135.rst +F: drivers/hwmon/max17135-hwmon.c F: drivers/regulator/max17135.c F: include/linux/regulator/max17135.hdrivers/hwmon/Kconfig +11
-0@@ -1311,6 +1311,17 @@ config SENSORS_MAX1668 This driver can also be built as a module. If so, the module will be called max1668. +config SENSORS_MAX17135 + tristate "Maxim MAX17135 temperature sensor" + depends on REGULATOR_MAX17135 + help + If you say yes here you get support for the temperature sensor + of the Maxim MAX17135 E-paper display PMIC: the die temperature + and an external diode. + + This driver can also be built as a module. If so, the module + will be called max17135-hwmon. + config SENSORS_MAX197 tristate "Maxim MAX197 and compatibles" helpdrivers/hwmon/Makefile +1
-0@@ -162,6 +162,7 @@ obj-$(CONFIG_SENSORS_MAX127) += max127.o obj-$(CONFIG_SENSORS_MAX16065) += max16065.o obj-$(CONFIG_SENSORS_MAX1619) += max1619.o obj-$(CONFIG_SENSORS_MAX1668) += max1668.o +obj-$(CONFIG_SENSORS_MAX17135) += max17135-hwmon.o obj-$(CONFIG_SENSORS_MAX197) += max197.o obj-$(CONFIG_SENSORS_MAX31722) += max31722.o obj-$(CONFIG_SENSORS_MAX31730) += max31730.odrivers/hwmon/max17135-hwmon.c new file +135
-0@@ -0,0 +1,135 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Temperature sensor of the Maxim MAX17135 E-paper display PMIC +* +* Copyright (C) 2026 Michiel van Beers +*/ + +#include <linux/auxiliary_bus.h> +#include <linux/bits.h> +#include <linux/device.h> +#include <linux/device/devres.h> +#include <linux/err.h> +#include <linux/errno.h> +#include <linux/hwmon.h> +#include <linux/module.h> +#include <linux/regmap.h> +#include <linux/regulator/max17135.h> +#include <linux/types.h> + +#define MAX17135_REG_STATUS 0x05 +#define MAX17135_STATUS_OPEN BIT(1) +#define MAX17135_STATUS_SHORT BIT(2) + +struct max17135_hwmon { +struct device *chip; +struct regmap *regmap; +}; + +static int max17135_hwmon_diode_fault (struct max17135_hwmon *hwmon,long *val) +{ +unsigned int status; +int ret; + + ret =regmap_read (hwmon->regmap,MAX17135_REG_STATUS , &status); +if (ret) +return ret; + + *val = !!(status & (MAX17135_STATUS_OPEN |MAX17135_STATUS_SHORT )); + +return 0 ; +} + +static int max17135_hwmon_read_input (struct max17135_hwmon *hwmon,int channel, +long *val) +{ +long fault; +int ret; + +if (channel ==0 ) +return max17135_read_temp (hwmon->chip,MAX17135_TEMP_INTERNAL , + val); + +/* Without a working diode the register holds a dummy value. */ + ret =max17135_hwmon_diode_fault (hwmon, &fault); +if (ret) +return ret; +if (fault) +return -ENODATA ; + +return max17135_read_temp (hwmon->chip,MAX17135_TEMP_EXTERNAL , val); +} + +static int max17135_hwmon_read (struct device *dev, +enum hwmon_sensor_types type,u32 attr, +int channel,long *val) +{ +struct max17135_hwmon *hwmon =dev_get_drvdata (dev); + +switch (attr) { +case hwmon_temp_input: +return max17135_hwmon_read_input (hwmon, channel, val); +case hwmon_temp_fault: +return max17135_hwmon_diode_fault (hwmon, val); +default : +return -EOPNOTSUPP ; + } +} + +static const struct hwmon_channel_info *const max17135_hwmon_info[] = { +HWMON_CHANNEL_INFO (temp, +HWMON_T_INPUT , +HWMON_T_INPUT |HWMON_T_FAULT ), +NULL +}; + +static const struct hwmon_ops max17135_hwmon_ops = { + .visible =0444 , + .read = max17135_hwmon_read, +}; + +static const struct hwmon_chip_info max17135_hwmon_chip_info = { + .ops = &max17135_hwmon_ops, + .info = max17135_hwmon_info, +}; + +static int max17135_hwmon_probe (struct auxiliary_device *adev, +const struct auxiliary_device_id *id) +{ +struct device *dev = &adev->dev; +struct max17135_hwmon *hwmon; +struct device *hwmon_dev; + + hwmon =devm_kzalloc_obj (dev, *hwmon); +if (!hwmon) +return -ENOMEM ; + + hwmon->chip = dev->parent; + hwmon->regmap =dev_get_regmap (dev->parent,NULL ); +if (!hwmon->regmap) +return -ENODEV ; + + hwmon_dev =devm_hwmon_device_register_with_info (dev,"max17135" , + hwmon, + &max17135_hwmon_chip_info, +NULL ); + +return PTR_ERR_OR_ZERO (hwmon_dev); +} + +static const struct auxiliary_device_id max17135_hwmon_ids[] = { + { .name ="max17135.hwmon" }, + { } +}; +MODULE_DEVICE_TABLE (auxiliary, max17135_hwmon_ids); + +static struct auxiliary_driver max17135_hwmon_driver = { + .probe = max17135_hwmon_probe, + .id_table = max17135_hwmon_ids, +}; +module_auxiliary_driver (max17135_hwmon_driver); + +MODULE_AUTHOR ("Michiel van Beers <[email protected]>" ); +MODULE_DESCRIPTION ("Maxim MAX17135 temperature sensor driver" ); +MODULE_IMPORT_NS ("MAX17135" ); +MODULE_LICENSE ("GPL" );
Re: [PATCH 3/3] hwmon: Add Maxim MAX17135 temperature sensor driver
Quoted 2 lines · Andreas Kemnade
just in general: do have something cooking to use temperature you graphics driver?
No, unfortunately not. On the Leaf the panel is driven from user space for now, which reads the temperature through sysfs and picks the waveform.
The vendor kernel does it the repaper way: its display driver averages two thermal zones, the battery and a thermistor near the eMMC.
Regards,
Michiel
Re: [PATCH 3/3] hwmon: Add Maxim MAX17135 temperature sensor driver
In reply to Michiel van BeersQuoted 11 lines · On 12/2/26 08:43, Michiel van Beers via B4 Relay wrote:
From: Michiel van Beers <[email protected]>
The MAX17135 E-paper display PMIC has a temperature sensor that measures the die and an external diode. Add a driver for it. The driver binds to the auxiliary device that the regulator driver creates.
Reading the external channel fails with
-ENODATAwhile the chip reports the diode as open or shorted.Signed-off-by Michiel van Beers <[email protected]>---
...
Review
Quoted 2 lines
(quoted diff) +2
-0+ +static const struct hwmon_channel_info * const max17135_hwmon_info[] = {
If this driver isn't dropped (there seems to be a request to implement it as iio driver), you might want to consider adding
HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
here if there is interest to support thermal zones for this chip.
No preference from my side, so
from my side.
Thanks,
Guenter
Quoted 5 lines
drivers/hwmon/max17135-hwmon.c new file +5
-0+HWMON_CHANNEL_INFO (temp, +HWMON_T_INPUT , +HWMON_T_INPUT |HWMON_T_FAULT ), + NULL +};
Re: [PATCH 3/3] hwmon: Add Maxim MAX17135 temperature sensor driver
Quoted 12 lines · On Wed, 2 Dec 2026 11:55:31 -0800 Guenter Roeck <[email protected]> wrote:
Quoted 11 lines · On 12/2/26 08:43, Michiel van Beers via B4 Relay wrote:
From: Michiel van Beers <[email protected]>
The MAX17135 E-paper display PMIC has a temperature sensor that measures the die and an external diode. Add a driver for it. The driver binds to the auxiliary device that the regulator driver creates.
Reading the external channel fails with
-ENODATAwhile the chip reports the diode as open or shorted.Signed-off-by Michiel van Beers <[email protected]>---
Quoted 9 lines
...
Review
Quoted 2 lines
(quoted diff) +2
-0+ +static const struct hwmon_channel_info * const max17135_hwmon_info[] = {If this driver isn't dropped (there seems to be a request to implement it as iio driver), you might want to consider adding
HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
here if there is interest to support thermal zones for this chip.
I think the decision is taken: comparable chips (FP9931, TPS65185, SY7636) provide hwmon interface. It would be a mess with any consumer to deal with different interfaces. TPS65185 (which the Pinenote has) is also hwmon in mainline, but they have their independently developed driver.
MAX17135 is also used in some i.MX epaper evalboards, so the same EPDC as the Kobo readers.
So just the in-kernel interface has to be added. It moves up on my todo list.
Regards,
Andreas
[email protected]
AI reviewSashiko has finished reviewing this 3-patch series:
Sashiko has finished reviewing this 3-patch series:
- Patches 1 and 3: no issues found.
- Patch 2 ("regulator: Add Maxim MAX17135 driver"): 1 potential issue (1 Medium)
A detailed review has been sent as a separate reply to patch 2.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]