Skip to contentSkip to conversation

Add support for Maxim Integrated MAX77705 MFD

PATCH Superseded Dzmitry Sankouski 3 participants 10 messages Sep 26, 2024 – Sep 27, 2024

Subsystems (7)

v5 of 17 Superseded Latest is v17 →

lore
Share & tools
lore
#0 lore raw

v5 cover Add support for Maxim Integrated MAX77705 MFD

The Maxim MAX77705 is a Companion Power Management and Type-C interface IC which includes charger, fuelgauge, LED, haptic motor driver and Type-C management IC. It's used in Samsung S series smart phones starting from S9 model.

Add features:
  - charger
  - fuelgauge
  - haptic
  - led

---
Changes in v5:
- Split patchset per subsystem
- Link to v4: https://lore.kernel.org/r/20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com

Changes in v4:
- Rewrite max77705, max77705_charger, max77705_fuel_gauge from scratch
- Reorder patches:
- squash max77705 subdevice bindings in core file because
no resources there
- split device tree changes
- Use _ as space for filenames in power/supply like the majority
- Link to v3: https://lore.kernel.org/r/20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com

---
Dzmitry Sankouski (7):
power: supply: add undervoltage health status property
dt-bindings: mfd: add maxim,max77705
mfd: Add new driver for MAX77705 PMIC
input: max77693: add max77705 haptic support
power: supply: max77705: Add charger driver for Maxim 77705
power: supply: max77705: Add fuel gauge driver for Maxim 77705
leds: max77705: Add LEDs support

 Documentation/ABI/testing/sysfs-class-power               |   2 +-
 Documentation/devicetree/bindings/mfd/maxim,max77705.yaml | 177 +++++++++++++++++++++
 MAINTAINERS                                               |   4 +
 drivers/input/misc/Kconfig                                |   4 +-
 drivers/input/misc/Makefile                               |   1 +
 drivers/input/misc/max77693-haptic.c                      |  15 +-
 drivers/leds/Kconfig                                      |   6 +
 drivers/leds/Makefile                                     |   1 +
 drivers/leds/leds-max77705.c                              | 157 ++++++++++++++++++
 drivers/mfd/Kconfig                                       |  12 ++
 drivers/mfd/Makefile                                      |   2 +
 drivers/mfd/max77705.c                                    | 248 +++++++++++++++++++++++++++++
 drivers/power/supply/Kconfig                              |  13 ++
 drivers/power/supply/Makefile                             |   2 +
 drivers/power/supply/max77705_charger.c                   | 585 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/power/supply/max77705_fuel_gauge.c                | 348 ++++++++++++++++++++++++++++++++++++++++
 drivers/power/supply/power_supply_sysfs.c                 |   1 +
 include/linux/mfd/max77693-common.h                       |   6 +-
 include/linux/mfd/max77705-private.h                      | 180 +++++++++++++++++++++
 include/linux/power/max77705_charger.h                    | 215 +++++++++++++++++++++++++
 include/linux/power/max77705_fuelgauge.h                  |  65 ++++++++
 include/linux/power_supply.h                              |   1 +
 22 files changed, 2040 insertions(+), 5 deletions(-)

---
base-commit: 3469b89bd13f10d679d1b1f5b47fb71953e96349
change-id: 20240617-starqltechn_integration_upstream-bc86850b2fe3

Best regards,

Signature · 1 line
Dzmitry Sankouski <[email protected]>
#1 lore raw

PATCH v5 1/7 power: supply: add undervoltage health status property

Add POWER_SUPPLY_HEALTH_UNDERVOLTAGE status for power supply to report under voltage lockout failures.

---
Changes for v5:
- update Documentation/ABI/testing/sysfs-class-power and drivers/power/supply/power_supply_sysfs.c

---
 Documentation/ABI/testing/sysfs-class-power | 2 +-
 drivers/power/supply/power_supply_sysfs.c   | 1 +
 include/linux/power_supply.h                | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)
Documentation/ABI/testing/sysfs-class-power +1 -1
index 45180b62d426..32c018c5d088 100644
@@ -433,7 +433,7 @@ Description:
 
 		Valid values:
 			      "Unknown", "Good", "Overheat", "Dead",
-			      "Over voltage", "Unspecified failure", "Cold",
+			      "Over voltage", "Under voltage", "Unspecified failure", "Cold",
 			      "Watchdog timer expire", "Safety timer expire",
 			      "Over current", "Calibration required", "Warm",
 			      "Cool", "Hot", "No battery"
drivers/power/supply/power_supply_sysfs.c +1 -0
index 16b3c5880cd8..82b2275de465 100644
@@ -99,6 +99,7 @@ static const char * const POWER_SUPPLY_HEALTH_TEXT[] = {
 	[POWER_SUPPLY_HEALTH_OVERHEAT]		    = "Overheat",
 	[POWER_SUPPLY_HEALTH_DEAD]		    = "Dead",
 	[POWER_SUPPLY_HEALTH_OVERVOLTAGE]	    = "Over voltage",
+	[POWER_SUPPLY_HEALTH_UNDERVOLTAGE]	    = "Under voltage",
 	[POWER_SUPPLY_HEALTH_UNSPEC_FAILURE]	    = "Unspecified failure",
 	[POWER_SUPPLY_HEALTH_COLD]		    = "Cold",
 	[POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE] = "Watchdog timer expire",
include/linux/power_supply.h +1 -0
index 910d407ebe63..8682e6466544 100644
@@ -58,6 +58,7 @@ enum {
 	POWER_SUPPLY_HEALTH_OVERHEAT,
 	POWER_SUPPLY_HEALTH_DEAD,
 	POWER_SUPPLY_HEALTH_OVERVOLTAGE,
+	POWER_SUPPLY_HEALTH_UNDERVOLTAGE,
 	POWER_SUPPLY_HEALTH_UNSPEC_FAILURE,
 	POWER_SUPPLY_HEALTH_COLD,
 	POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE,
Signature · 1 line
2.39.2
#2 lore raw

PATCH v5 2/7 dt-bindings: mfd: add maxim,max77705

In reply to Dzmitry Sankouski

Add maxim,max77705 core binding part.

---
Changes in v5:
- formatting changes
- add unevaluatedProperties: false for nodes referencing common schemas
- remove additionalProperties on nodes with
unevaluatedProperties: false
- add min and max to led index
Changes in v4:
- change dts example intendation from tabs
to spaces
- remove interrupt-names property
- remove obvious reg description
- split long(>80) lines

---
 Documentation/devicetree/bindings/mfd/maxim,max77705.yaml | 177 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 MAINTAINERS                                               |   1 +
 2 files changed, 178 insertions(+)
Documentation/devicetree/bindings/mfd/maxim,max77705.yaml new file +177 -0
new file mode 100644
index 000000000000..214515f84c85
@@ -0,0 +1,177 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/maxim,max77705.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim MAX77705 Companion Power Management IC and USB Type-C interface IC
+
+maintainers:
+  - Dzmitry Sankouski <[email protected]>
+
+description: |
+  This is a part of device tree bindings for Maxim MAX77705 multi functional
+  device.
+
+  The Maxim MAX77705 is a Companion Power Management and Type-C
+  interface IC which includes charger, fuelgauge, LED, haptic motor driver and
+  Type-C management IC.
+
+properties:
+  compatible:
+    const: maxim,max77705
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  charger:
+    $ref: /schemas/power/supply/power-supply.yaml
+    unevaluatedProperties: true
+    properties:
+      compatible:
+        const: maxim,max77705-charger
+
+    required:
+      - compatible
+      - monitored-battery
+
+  fuel-gauge:
+    $ref: /schemas/power/supply/power-supply.yaml
+    type: object
+    unevaluatedProperties: true
+    description: MAX77705 fuel gauge with ModelGauge m5 EZ algorithm support.
+
+    properties:
+      compatible:
+        const: maxim,max77705-fuel-gauge
+
+      shunt-resistor-micro-ohms:
+        description:
+          The value of current sense resistor in microohms.
+
+    required:
+      - compatible
+      - shunt-resistor-micro-ohms
+      - monitored-battery
+      - power-supplies
+
+  haptic:
+    type: object
+    additionalProperties: false
+
+    properties:
+      compatible:
+        const: maxim,max77705-haptic
+
+      haptic-supply: true
+
+      pwms:
+        maxItems: 1
+
+    required:
+      - compatible
+      - haptic-supply
+      - pwms
+
+  leds:
+    type: object
+    additionalProperties: false
+    description:
+      Up to 4 LEDs supported. One LED is represented by one child node.
+
+    properties:
+      compatible:
+        const: maxim,max77705-led
+
+      "#address-cells":
+        const: 1
+
+      "#size-cells":
+        const: 0
+
+    patternProperties:
+      "^led@[0-3]$":
+        $ref: /schemas/leds/common.yaml#
+        type: object
+        unevaluatedProperties: false
+
+        properties:
+          reg:
+            description: LED index.
+            minimum: 0
+            maximum: 3
+
+        required:
+          - reg
+
+    required:
+      - compatible
+      - "#address-cells"
+      - "#size-cells"
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/leds/common.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        pmic@66 {
+            compatible = "maxim,max77705";
+            reg = <0x66>;
+            interrupt-parent = <&pm8998_gpios>;
+            interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
+            pinctrl-0 = <&chg_int_default>;
+            pinctrl-names = "default";
+
+            leds {
+                compatible = "maxim,max77705-led";
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                led@1 {
+                    reg = <1>;
+                    label = "red:usr1";
+                };
+
+                led@2 {
+                    reg = <2>;
+                    label = "green:usr2";
+                };
+
+                led@3 {
+                    reg = <3>;
+                    label = "blue:usr3";
+                };
+            };
+
+            max77705_charger: charger {
+                compatible = "maxim,max77705-charger";
+                monitored-battery = <&battery>;
+            };
+
+            fuel-gauge {
+                compatible = "maxim,max77705-fuel-gauge";
+                monitored-battery = <&battery>;
+                power-supplies = <&max77705_charger>;
+                shunt-resistor-micro-ohms = <5000>;
+            };
+
+
+            haptic {
+                compatible = "maxim,max77705-haptic";
+                haptic-supply = <&vib_regulator>;
+                pwms = <&vib_pwm 0 50000>;
+            };
+        };
+    };
MAINTAINERS +1 -0
index 5e467ba71e3b..5e5829f28631 100644
@@ -14069,6 +14069,7 @@ B:	mailto:[email protected]
 F:	Documentation/devicetree/bindings/*/maxim,max14577.yaml
 F:	Documentation/devicetree/bindings/*/maxim,max77686.yaml
 F:	Documentation/devicetree/bindings/*/maxim,max77693.yaml
+F:	Documentation/devicetree/bindings/*/maxim,max77705*.yaml
 F:	Documentation/devicetree/bindings/*/maxim,max77843.yaml
 F:	Documentation/devicetree/bindings/clock/maxim,max77686.txt
 F:	drivers/*/*max77843.c
Signature · 1 line
2.39.2
#4 lore raw

PATCH v5 3/7 mfd: Add new driver for MAX77705 PMIC

In reply to Dzmitry Sankouski

Add the core MFD driver for max77705 PMIC. We define five sub-devices for which the drivers will be added in subsequent patches.

---
Changes for v5:
- license change to 2.0
- use same hardware name in Kconfig and module descriptions Changes for v4:
- rework driver from scratch
- migrate to regmap_add_irq_chip, remove max77705-irq.c, rename max77705-core.c to max77705.c
- cleanup headers
- remove debugfs code
- migrate to use max77693_dev structure
- remove max77705.h

---
 MAINTAINERS                          |   2 +
 drivers/mfd/Kconfig                  |  12 +++++
 drivers/mfd/Makefile                 |   2 +
 drivers/mfd/max77705.c               | 248 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/max77693-common.h  |   6 ++-
 include/linux/mfd/max77705-private.h | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 449 insertions(+), 1 deletion(-)
MAINTAINERS +2 -0
index 5e5829f28631..e45bbafbb938 100644
@@ -14076,6 +14076,7 @@ F:	drivers/*/*max77843.c
 F:	drivers/*/max14577*.c
 F:	drivers/*/max77686*.c
 F:	drivers/*/max77693*.c
+F:	drivers/*/max77705*.c
 F:	drivers/clk/clk-max77686.c
 F:	drivers/extcon/extcon-max14577.c
 F:	drivers/extcon/extcon-max77693.c
@@ -14083,6 +14084,7 @@ F:	drivers/rtc/rtc-max77686.c
 F:	include/linux/mfd/max14577*.h
 F:	include/linux/mfd/max77686*.h
 F:	include/linux/mfd/max77693*.h
+F:	include/linux/mfd/max77705*.h
 
 MAXIRADIO FM RADIO RECEIVER DRIVER
 M:	Hans Verkuil <[email protected]>
drivers/mfd/Kconfig +12 -0
index f9325bcce1b9..090eb3fb3d67 100644
@@ -904,6 +904,18 @@ config MFD_MAX77693
 	  additional drivers must be enabled in order to use the functionality
 	  of the device.
 
+config MFD_MAX77705
+	tristate "Maxim MAX77705 PMIC Support"
+	depends on I2C
+	select MFD_CORE
+	help
+	  Say yes here to add support for Maxim Integrated MAX77705.
+	  This is a Power Management IC with Charger, safe LDOs, Flash, Haptic
+	  and MUIC controls on chip.
+	  This driver provides common support for accessing the device;
+	  additional drivers must be enabled in order to use the functionality
+	  of the device.
+
 config MFD_MAX77714
 	tristate "Maxim Semiconductor MAX77714 PMIC Support"
 	depends on I2C
drivers/mfd/Makefile +2 -0
index 2a9f91e81af8..3dc5742c6aeb 100644
@@ -167,6 +167,7 @@ obj-$(CONFIG_MFD_MAX77620)	+= max77620.o
 obj-$(CONFIG_MFD_MAX77650)	+= max77650.o
 obj-$(CONFIG_MFD_MAX77686)	+= max77686.o
 obj-$(CONFIG_MFD_MAX77693)	+= max77693.o
+obj-$(CONFIG_MFD_MAX77705)	+= max77705.o
 obj-$(CONFIG_MFD_MAX77714)	+= max77714.o
 obj-$(CONFIG_MFD_MAX77843)	+= max77843.o
 obj-$(CONFIG_MFD_MAX8907)	+= max8907.o
@@ -232,6 +233,7 @@ obj-$(CONFIG_MFD_RK8XX_I2C)	+= rk8xx-i2c.o
 obj-$(CONFIG_MFD_RK8XX_SPI)	+= rk8xx-spi.o
 obj-$(CONFIG_MFD_RN5T618)	+= rn5t618.o
 obj-$(CONFIG_MFD_SEC_CORE)	+= sec-core.o sec-irq.o
+obj-$(CONFIG_MFD_S2DOS05)	+= s2dos05.o
 obj-$(CONFIG_MFD_SYSCON)	+= syscon.o
 obj-$(CONFIG_MFD_LM3533)	+= lm3533-core.o lm3533-ctrlbank.o
 obj-$(CONFIG_MFD_VEXPRESS_SYSREG)	+= vexpress-sysreg.o
drivers/mfd/max77705.c new file +248 -0

248 lines not on this page · raw message

include/linux/mfd/max77693-common.h +5 -1
index a5bce099f1ed..1b87b1ada21c 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Common data shared between Maxim 77693 and 77843 drivers
+ * Common data shared between Maxim 77693, 77705 and 77843 drivers
  *
  * Copyright (C) 2015 Samsung Electronics
  */
@@ -11,6 +11,7 @@
 enum max77693_types {
 	TYPE_MAX77693_UNKNOWN,
 	TYPE_MAX77693,
+	TYPE_MAX77705,
 	TYPE_MAX77843,
 
 	TYPE_MAX77693_NUM,
@@ -25,6 +26,7 @@ struct max77693_dev {
 	struct i2c_client *i2c_muic;	/* 0x4A , MUIC */
 	struct i2c_client *i2c_haptic;	/* MAX77693: 0x90 , Haptic */
 	struct i2c_client *i2c_chg;	/* MAX77843: 0xD2, Charger */
+	struct i2c_client *i2c_fg;	/* MAX77843: 0xD2, Charger */
 
 	enum max77693_types type;
 
@@ -32,6 +34,8 @@ struct max77693_dev {
 	struct regmap *regmap_muic;
 	struct regmap *regmap_haptic;	/* Only MAX77693 */
 	struct regmap *regmap_chg;	/* Only MAX77843 */
+	struct regmap *regmap_fg;	/* Only MAX77705 */
+	struct regmap *regmap_leds;	/* Only MAX77705 */
 
 	struct regmap_irq_chip_data *irq_data_led;
 	struct regmap_irq_chip_data *irq_data_topsys;
include/linux/mfd/max77705-private.h new file +180 -0

180 lines not on this page · raw message

Signature · 1 line
2.39.2
#5 lore raw

PATCH v5 4/7 input: max77693: add max77705 haptic support

In reply to Dzmitry Sankouski

Add support for haptic controller on MAX77705 Multifunction device.

This driver supports external pwm and LRA (Linear Resonant Actuator) motor. User can control the haptic device via force feedback framework.

---
Changes in v4:
- add max77705 haptic support to max77693 driver
- delete max77705-haptic

---
 drivers/input/misc/Kconfig           |  4 ++--
 drivers/input/misc/Makefile          |  1 +
 drivers/input/misc/max77693-haptic.c | 15 ++++++++++++++-
 3 files changed, 17 insertions(+), 3 deletions(-)
drivers/input/misc/Kconfig +2 -2
index 6a852c76331b..b4515c4e5cf6 100644
@@ -241,11 +241,11 @@ config INPUT_MAX77650_ONKEY
 
 config INPUT_MAX77693_HAPTIC
 	tristate "MAXIM MAX77693/MAX77843 haptic controller support"
-	depends on (MFD_MAX77693 || MFD_MAX77843) && PWM
+	depends on (MFD_MAX77693 || MFD_MAX77705 || MFD_MAX77843) && PWM
 	select INPUT_FF_MEMLESS
 	help
 	  This option enables support for the haptic controller on
-	  MAXIM MAX77693 and MAX77843 chips.
+	  MAXIM MAX77693, MAX77705 and MAX77843 chips.
 
 	  To compile this driver as module, choose M here: the
 	  module will be called max77693-haptic.
drivers/input/misc/Makefile +1 -0
index 4f7f736831ba..3e3532b27990 100644
@@ -53,6 +53,7 @@ obj-$(CONFIG_INPUT_KXTJ9)		+= kxtj9.o
 obj-$(CONFIG_INPUT_M68K_BEEP)		+= m68kspkr.o
 obj-$(CONFIG_INPUT_MAX77650_ONKEY)	+= max77650-onkey.o
 obj-$(CONFIG_INPUT_MAX77693_HAPTIC)	+= max77693-haptic.o
+obj-$(CONFIG_INPUT_MAX77705_HAPTIC)	+= max77705-haptic.o
 obj-$(CONFIG_INPUT_MAX8925_ONKEY)	+= max8925_onkey.o
 obj-$(CONFIG_INPUT_MAX8997_HAPTIC)	+= max8997_haptic.o
 obj-$(CONFIG_INPUT_MC13783_PWRBUTTON)	+= mc13783-pwrbutton.o
drivers/input/misc/max77693-haptic.c +14 -1
index 0e646f1b257b..c3b9d33608d7 100644
@@ -23,6 +23,7 @@
 #include <linux/mfd/max77693.h>
 #include <linux/mfd/max77693-common.h>
 #include <linux/mfd/max77693-private.h>
+#include <linux/mfd/max77705-private.h>
 #include <linux/mfd/max77843-private.h>
 
 #define MAX_MAGNITUDE_SHIFT	16
@@ -115,6 +116,13 @@ static int max77693_haptic_configure(struct max77693_haptic *haptic,
 			MAX77693_HAPTIC_PWM_DIVISOR_128);
 		config_reg = MAX77693_HAPTIC_REG_CONFIG2;
 		break;
+	case TYPE_MAX77705:
+		value = ((haptic->type << MAX77693_CONFIG2_MODE) |
+			(enable << MAX77693_CONFIG2_MEN) |
+			(haptic->mode << MAX77693_CONFIG2_HTYP) |
+			MAX77693_HAPTIC_PWM_DIVISOR_128);
+		config_reg = MAX77705_PMIC_REG_MCONFIG;
+		break;
 	case TYPE_MAX77843:
 		value = (haptic->type << MCONFIG_MODE_SHIFT) |
 			(enable << MCONFIG_MEN_SHIFT) |
@@ -312,6 +320,9 @@ static int max77693_haptic_probe(struct platform_device *pdev)
 	case TYPE_MAX77693:
 		haptic->regmap_haptic = max77693->regmap_haptic;
 		break;
+	case TYPE_MAX77705:
+		haptic->regmap_haptic = max77693->regmap;
+		break;
 	case TYPE_MAX77843:
 		haptic->regmap_haptic = max77693->regmap;
 		break;
@@ -407,6 +418,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(max77693_haptic_pm_ops,
 
 static const struct platform_device_id max77693_haptic_id[] = {
 	{ "max77693-haptic", },
+	{ "max77705-haptic", },
 	{ "max77843-haptic", },
 	{},
 };
@@ -414,6 +426,7 @@ MODULE_DEVICE_TABLE(platform, max77693_haptic_id);
 
 static const struct of_device_id of_max77693_haptic_dt_match[] = {
 	{ .compatible = "maxim,max77693-haptic", },
+	{ .compatible = "maxim,max77705-haptic", },
 	{ .compatible = "maxim,max77843-haptic", },
 	{ /* sentinel */ },
 };
@@ -432,5 +445,5 @@ module_platform_driver(max77693_haptic_driver);
 
 MODULE_AUTHOR("Jaewon Kim <[email protected]>");
 MODULE_AUTHOR("Krzysztof Kozlowski <[email protected]>");
-MODULE_DESCRIPTION("MAXIM 77693/77843 Haptic driver");
+MODULE_DESCRIPTION("MAXIM 77693/77705/77843 Haptic driver");
 MODULE_LICENSE("GPL");
Signature · 1 line
2.39.2
#7 lore raw

PATCH v5 5/7 power: supply: max77705: Add charger driver for Maxim 77705

In reply to Dzmitry Sankouski

Add driver for Maxim 77705 switch-mode charger (part of max77705 MFD driver) providing power supply class information to userspace.

The driver is configured through DTS (battery and system related settings).

---
Changes for v5:
- remove const modifier from max77705_charger_irq_chip because it's modified with irq_drv_data in probe function
- fix license to GPL 2.0 only, where old vendor code used GPL 2.0 only
- move power header to power include dir
- use same hardware name in Kconfig and module descriptions

Changes for v4:
- start from scratch
- change word delimiters in filenames to '_'
- use GENMASK in header
- remove debugfs code
- migrate to regmap_add_irq_chip
- fix property getters to follow the same style

---
 drivers/power/supply/Kconfig            |   6 +
 drivers/power/supply/Makefile           |   1 +
 drivers/power/supply/max77705_charger.c | 585 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/power/max77705_charger.h  | 215 ++++++++++++++++++++++++++++++++
 4 files changed, 807 insertions(+)
drivers/power/supply/Kconfig +6 -0
index bcfa63fb9f1e..fe84d2004f57 100644
@@ -573,6 +573,12 @@ config CHARGER_MAX77693
 	help
 	  Say Y to enable support for the Maxim MAX77693 battery charger.
 
+config CHARGER_MAX77705
+	tristate "Maxim MAX77705 battery charger driver"
+	depends on MFD_MAX77705
+	help
+	  Say Y to enable support for the Maxim MAX77705 battery charger.
+
 config CHARGER_MAX77976
 	tristate "Maxim MAX77976 battery charger driver"
 	depends on I2C
drivers/power/supply/Makefile +1 -0
index 8dcb41545317..daa9228fa04b 100644
@@ -79,6 +79,7 @@ obj-$(CONFIG_CHARGER_MAX14577)	+= max14577_charger.o
 obj-$(CONFIG_CHARGER_DETECTOR_MAX14656)	+= max14656_charger_detector.o
 obj-$(CONFIG_CHARGER_MAX77650)	+= max77650-charger.o
 obj-$(CONFIG_CHARGER_MAX77693)	+= max77693_charger.o
+obj-$(CONFIG_CHARGER_MAX77705)	+= max77705_charger.o
 obj-$(CONFIG_CHARGER_MAX77976)	+= max77976_charger.o
 obj-$(CONFIG_CHARGER_MAX8997)	+= max8997_charger.o
 obj-$(CONFIG_CHARGER_MAX8998)	+= max8998_charger.o
drivers/power/supply/max77705_charger.c new file +585 -0

585 lines not on this page · raw message

include/linux/power/max77705_charger.h new file +215 -0

215 lines not on this page · raw message

Signature · 1 line
2.39.2
#8 lore raw

PATCH v5 6/7 power: supply: max77705: Add fuel gauge driver for Maxim 77705

In reply to Dzmitry Sankouski

Add driver for Maxim 77705 fuel gauge (part of max77705 MFD driver) providing power supply class information to userspace.

The driver is configured through DTS (battery and system related settings).

---
Changes for v5:
- fix license
- use same hardware name in Kconfig and module descriptions
- fix email, and module author

Changes for v4:
- rework driver from scratch
- change word delimiters in filenames to "_"
- remove debugfs code
- cleanup header

---
 drivers/power/supply/Kconfig               |   7 ++
 drivers/power/supply/Makefile              |   1 +
 drivers/power/supply/max77705_fuel_gauge.c | 348 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/power/max77705_fuelgauge.h   |  65 ++++++++++++++++
 4 files changed, 421 insertions(+)
drivers/power/supply/Kconfig +7 -0
index fe84d2004f57..7c16403c263d 100644
@@ -579,6 +579,13 @@ config CHARGER_MAX77705
 	help
 	  Say Y to enable support for the Maxim MAX77705 battery charger.
 
+config FUEL_GAUGE_MAX77705
+	tristate "Maxim MAX77705 fuel gauge driver"
+	depends on MFD_MAX77705
+	default n
+	help
+	  Say Y to enable support for MAXIM MAX77705 fuel gauge driver.
+
 config CHARGER_MAX77976
 	tristate "Maxim MAX77976 battery charger driver"
 	depends on I2C
drivers/power/supply/Makefile +1 -0
index daa9228fa04b..b949600a6207 100644
@@ -80,6 +80,7 @@ obj-$(CONFIG_CHARGER_DETECTOR_MAX14656)	+= max14656_charger_detector.o
 obj-$(CONFIG_CHARGER_MAX77650)	+= max77650-charger.o
 obj-$(CONFIG_CHARGER_MAX77693)	+= max77693_charger.o
 obj-$(CONFIG_CHARGER_MAX77705)	+= max77705_charger.o
+obj-$(CONFIG_FUEL_GAUGE_MAX77705)	+= max77705_fuel_gauge.o
 obj-$(CONFIG_CHARGER_MAX77976)	+= max77976_charger.o
 obj-$(CONFIG_CHARGER_MAX8997)	+= max8997_charger.o
 obj-$(CONFIG_CHARGER_MAX8998)	+= max8998_charger.o
drivers/power/supply/max77705_fuel_gauge.c new file +348 -0

348 lines not on this page · raw message

include/linux/power/max77705_fuelgauge.h new file +65 -0

65 lines not on this page · raw message

Signature · 1 line
2.39.2
#9 lore raw

PATCH v5 7/7 leds: max77705: Add LEDs support

In reply to Dzmitry Sankouski

This adds basic support for LEDs for the max77705 PMIC.

---
Changes for v5:
- use same hardware name in Kconfig and module descriptions
- remove copyrighter owner from module authors

Changes in v4:
- inline BLINK_(ON|OFF) macro
- remove camel case
- drop backwards compatibility(new driver)
- drop module alias

---
 MAINTAINERS                  |   1 +
 drivers/leds/Kconfig         |   6 ++++
 drivers/leds/Makefile        |   1 +
 drivers/leds/leds-max77705.c | 157 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 165 insertions(+)
MAINTAINERS +1 -0
index e45bbafbb938..8f26416617a4 100644
@@ -14077,6 +14077,7 @@ F:	drivers/*/max14577*.c
 F:	drivers/*/max77686*.c
 F:	drivers/*/max77693*.c
 F:	drivers/*/max77705*.c
+F:	drivers/leds/leds-max77705.c
 F:	drivers/clk/clk-max77686.c
 F:	drivers/extcon/extcon-max14577.c
 F:	drivers/extcon/extcon-max77693.c
drivers/leds/Kconfig +6 -0
index b784bb74a837..a8492623caa4 100644
@@ -753,6 +753,12 @@ config LEDS_MAX77650
 	help
 	  LEDs driver for MAX77650 family of PMICs from Maxim Integrated.
 
+config LEDS_MAX77705
+	tristate "LED support for Maxim MAX77705 PMIC"
+	depends on MFD_MAX77705 && LEDS_CLASS && I2C
+	help
+	  LED driver for MAX77705 MFD chip from Maxim Integrated.
+
 config LEDS_MAX8997
 	tristate "LED support for MAX8997 PMIC"
 	depends on LEDS_CLASS && MFD_MAX8997
drivers/leds/Makefile +1 -0
index 18afbb5a23ee..096bf244527d 100644
@@ -60,6 +60,7 @@ obj-$(CONFIG_LEDS_LP8860)		+= leds-lp8860.o
 obj-$(CONFIG_LEDS_LT3593)		+= leds-lt3593.o
 obj-$(CONFIG_LEDS_MAX5970)		+= leds-max5970.o
 obj-$(CONFIG_LEDS_MAX77650)		+= leds-max77650.o
+obj-$(CONFIG_LEDS_MAX77705)		+= leds-max77705.o
 obj-$(CONFIG_LEDS_MAX8997)		+= leds-max8997.o
 obj-$(CONFIG_LEDS_MC13783)		+= leds-mc13783.o
 obj-$(CONFIG_LEDS_MENF21BMC)		+= leds-menf21bmc.o
drivers/leds/leds-max77705.c new file +157 -0

157 lines not on this page · raw message

Signature · 1 line
2.39.2
maintainer
#3 lore raw

Re: [PATCH v5 2/7] dt-bindings: mfd: add maxim,max77705

In reply to Dzmitry Sankouski
Quoted 33 lines · Dzmitry Sankouski

Add maxim,max77705 core binding part.

---
Changes in v5:
- formatting changes
- add unevaluatedProperties: false for nodes referencing common schemas
- remove additionalProperties on nodes with
unevaluatedProperties: false
- add min and max to led index
Changes in v4:
- change dts example intendation from tabs
to spaces
- remove interrupt-names property
- remove obvious reg description
- split long(>80) lines

---
 Documentation/devicetree/bindings/mfd/maxim,max77705.yaml | 177 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 MAINTAINERS                                               |   1 +
 2 files changed, 178 insertions(+)
Documentation/devicetree/bindings/mfd/maxim,max77705.yaml new file +4 -0
new file mode 100644
index 000000000000..214515f84c85
@@ -0,0 +1,177 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/maxim,max77705.yaml#

Documentation/devicetree/bindings/mfd/maxim,max77705.yaml line 14

Quoted 10 lines
Documentation/devicetree/bindings/mfd/maxim,max77705.yaml new file +10 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim MAX77705 Companion Power Management IC and USB Type-C interface IC
+
+maintainers:
+  - Dzmitry Sankouski <[email protected]>
+
+description: |
+  This is a part of device tree bindings for Maxim MAX77705 multi functional
+  device.

Drop this sentence. Just describe the device.

Quoted 8 lines
Documentation/devicetree/bindings/mfd/maxim,max77705.yaml new file +8 -0
+
+  The Maxim MAX77705 is a Companion Power Management and Type-C
+  interface IC which includes charger, fuelgauge, LED, haptic motor driver and
+  Type-C management IC.
+
+properties:
+  compatible:
+    const: maxim,max77705

Documentation/devicetree/bindings/mfd/maxim,max77705.yaml line 32

Quoted 10 lines
Documentation/devicetree/bindings/mfd/maxim,max77705.yaml new file +10 -0
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  charger:
+    $ref: /schemas/power/supply/power-supply.yaml
+    unevaluatedProperties: true

Must be false.

Documentation/devicetree/bindings/mfd/maxim,max77705.yaml line 44

Quoted 12 lines
Documentation/devicetree/bindings/mfd/maxim,max77705.yaml new file +12 -0
+    properties:
+      compatible:
+        const: maxim,max77705-charger
+
+    required:
+      - compatible
+      - monitored-battery
+
+  fuel-gauge:
+    $ref: /schemas/power/supply/power-supply.yaml
+    type: object
+    unevaluatedProperties: true

Must be false.

Rob

maintainer Acked-by on v5 4/7
#6 lore raw

Re: [PATCH v5 4/7] input: max77693: add max77705 haptic support

In reply to Dzmitry Sankouski
Quoted 7 lines · Dzmitry Sankouski

Add support for haptic controller on MAX77705 Multifunction device.

This driver supports external pwm and LRA (Linear Resonant Actuator) motor. User can control the haptic device via force feedback framework.

Quoted 104 lines

---
Changes in v4:
- add max77705 haptic support to max77693 driver
- delete max77705-haptic

---
 drivers/input/misc/Kconfig           |  4 ++--
 drivers/input/misc/Makefile          |  1 +
 drivers/input/misc/max77693-haptic.c | 15 ++++++++++++++-
 3 files changed, 17 insertions(+), 3 deletions(-)
drivers/input/misc/Kconfig +2 -2
index 6a852c76331b..b4515c4e5cf6 100644
@@ -241,11 +241,11 @@ config INPUT_MAX77650_ONKEY
 
 config INPUT_MAX77693_HAPTIC
 	tristate "MAXIM MAX77693/MAX77843 haptic controller support"
-	depends on (MFD_MAX77693 || MFD_MAX77843) && PWM
+	depends on (MFD_MAX77693 || MFD_MAX77705 || MFD_MAX77843) && PWM
 	select INPUT_FF_MEMLESS
 	help
 	  This option enables support for the haptic controller on
-	  MAXIM MAX77693 and MAX77843 chips.
+	  MAXIM MAX77693, MAX77705 and MAX77843 chips.
 
 	  To compile this driver as module, choose M here: the
 	  module will be called max77693-haptic.
drivers/input/misc/Makefile +1 -0
index 4f7f736831ba..3e3532b27990 100644
@@ -53,6 +53,7 @@ obj-$(CONFIG_INPUT_KXTJ9)		+= kxtj9.o
 obj-$(CONFIG_INPUT_M68K_BEEP)		+= m68kspkr.o
 obj-$(CONFIG_INPUT_MAX77650_ONKEY)	+= max77650-onkey.o
 obj-$(CONFIG_INPUT_MAX77693_HAPTIC)	+= max77693-haptic.o
+obj-$(CONFIG_INPUT_MAX77705_HAPTIC)	+= max77705-haptic.o
 obj-$(CONFIG_INPUT_MAX8925_ONKEY)	+= max8925_onkey.o
 obj-$(CONFIG_INPUT_MAX8997_HAPTIC)	+= max8997_haptic.o
 obj-$(CONFIG_INPUT_MC13783_PWRBUTTON)	+= mc13783-pwrbutton.o
drivers/input/misc/max77693-haptic.c +14 -1
index 0e646f1b257b..c3b9d33608d7 100644
@@ -23,6 +23,7 @@
 #include <linux/mfd/max77693.h>
 #include <linux/mfd/max77693-common.h>
 #include <linux/mfd/max77693-private.h>
+#include <linux/mfd/max77705-private.h>
 #include <linux/mfd/max77843-private.h>
 
 #define MAX_MAGNITUDE_SHIFT	16
@@ -115,6 +116,13 @@ static int max77693_haptic_configure(struct max77693_haptic *haptic,
 			MAX77693_HAPTIC_PWM_DIVISOR_128);
 		config_reg = MAX77693_HAPTIC_REG_CONFIG2;
 		break;
+	case TYPE_MAX77705:
+		value = ((haptic->type << MAX77693_CONFIG2_MODE) |
+			(enable << MAX77693_CONFIG2_MEN) |
+			(haptic->mode << MAX77693_CONFIG2_HTYP) |
+			MAX77693_HAPTIC_PWM_DIVISOR_128);
+		config_reg = MAX77705_PMIC_REG_MCONFIG;
+		break;
 	case TYPE_MAX77843:
 		value = (haptic->type << MCONFIG_MODE_SHIFT) |
 			(enable << MCONFIG_MEN_SHIFT) |
@@ -312,6 +320,9 @@ static int max77693_haptic_probe(struct platform_device *pdev)
 	case TYPE_MAX77693:
 		haptic->regmap_haptic = max77693->regmap_haptic;
 		break;
+	case TYPE_MAX77705:
+		haptic->regmap_haptic = max77693->regmap;
+		break;
 	case TYPE_MAX77843:
 		haptic->regmap_haptic = max77693->regmap;
 		break;
@@ -407,6 +418,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(max77693_haptic_pm_ops,
 
 static const struct platform_device_id max77693_haptic_id[] = {
 	{ "max77693-haptic", },
+	{ "max77705-haptic", },
 	{ "max77843-haptic", },
 	{},
 };
@@ -414,6 +426,7 @@ MODULE_DEVICE_TABLE(platform, max77693_haptic_id);
 
 static const struct of_device_id of_max77693_haptic_dt_match[] = {
 	{ .compatible = "maxim,max77693-haptic", },
+	{ .compatible = "maxim,max77705-haptic", },
 	{ .compatible = "maxim,max77843-haptic", },
 	{ /* sentinel */ },
 };
@@ -432,5 +445,5 @@ module_platform_driver(max77693_haptic_driver);
 
 MODULE_AUTHOR("Jaewon Kim <[email protected]>");
 MODULE_AUTHOR("Krzysztof Kozlowski <[email protected]>");
-MODULE_DESCRIPTION("MAXIM 77693/77843 Haptic driver");
+MODULE_DESCRIPTION("MAXIM 77693/77705/77843 Haptic driver");
 MODULE_LICENSE("GPL");
Signature · 2 lines
-- 
2.39.2
Signature · 1 line
Dmitry