Add support for Maxim Integrated MAX77705 PMIC
Subsystems (7)
v8 cover Add support for Maxim Integrated MAX77705 PMIC
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 v8:
- Fix comment style
- join line where possible to fit in 100 chars
- Link to v7: https://lore.kernel.org/r/20241023-starqltechn_integration_upstream-v7-0-9bfaa3f4a1a0@gmail.com
Changes in v7:
- Fix review comments
- Link to v6: https://lore.kernel.org/r/20241007-starqltechn_integration_upstream-v6-0-0d38b5090c57@gmail.com
Changes in v6:
- fix binding review comments
- update trailers
- Link to v5: https://lore.kernel.org/r/20240617-starqltechn_integration_upstream-v5-0-e0033f141d17@gmail.com
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 | 174 ++++++++++++++++++++++++++++++++++++ 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 | 167 ++++++++++++++++++++++++++++++++++ drivers/mfd/Kconfig | 12 +++ drivers/mfd/Makefile | 2 + drivers/mfd/max77705.c | 222 +++++++++++++++++++++++++++++++++++++++++++++ drivers/power/supply/Kconfig | 13 +++ drivers/power/supply/Makefile | 2 + drivers/power/supply/max77705_charger.c | 598 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/power/supply/max77705_fuel_gauge.c | 363 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/power/supply/power_supply_sysfs.c | 1 + include/linux/mfd/max77693-common.h | 5 +- include/linux/mfd/max77705-private.h | 199 +++++++++++++++++++++++++++++++++++++++++ include/linux/power/max77705_charger.h | 216 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/power/max77705_fuelgauge.h | 71 +++++++++++++++ include/linux/power_supply.h | 1 + 22 files changed, 2074 insertions(+), 5 deletions(-)
---
base-commit: 86e3904dcdc7e70e3257fc1de294a1b75f3d8d04
change-id: 20240617-starqltechn_integration_upstream-bc86850b2fe3
Best regards,
Signature · 1 line
Dzmitry Sankouski <[email protected]>
PATCH v8 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
@@ -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
@@ -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
@@ -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
PATCH v8 2/7 dt-bindings: mfd: add maxim,max77705
In reply to Dzmitry SankouskiAdd maxim,max77705 core binding part.
---
Changes in v8:
- fix leds compatible
Changes in v6:
- unevaluatedProperties must be false
- drop excessive sentence from description,
just describe the device
- change leds compatible to maxim,max77705-rgb
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 | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 175 insertions(+)
Documentation/devicetree/bindings/mfd/maxim,max77705.yaml new file +174 -0
@@ -0,0 +1,174 @@ +# 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: | + 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: false + properties: + compatible: + const: maxim,max77705-charger + + required: + - compatible + - monitored-battery + + fuel-gauge: + $ref: /schemas/power/supply/power-supply.yaml + type: object + unevaluatedProperties: false + 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-rgb + + "#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-rgb"; + #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
@@ -14131,6 +14131,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
PATCH v8 3/7 mfd: Add new driver for MAX77705 PMIC
In reply to Dzmitry SankouskiAdd the core MFD driver for max77705 PMIC. We define five sub-devices for which the drivers will be added in subsequent patches.
---
Changes for v8:
- fix comment style C++ -> C
- remove unused pmic_ver
Changes for v6:
- add PMIC suffix in Kconfig
- remove filename from file header
- reorder headers alphabetically
- move out fg and chg adresses definitions
- rename led name and compatible
- remove overbracketing
- move charger and fuel gauge i2c initialization to their drivers
- fix max77705_i2c_driver tabbing
- formatting fixes
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 | 222 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/max77693-common.h | 5 +++- include/linux/mfd/max77705-private.h | 181 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 423 insertions(+), 1 deletion(-)
MAINTAINERS +2 -0
@@ -14138,6 +14138,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
@@ -14145,6 +14146,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
@@ -916,6 +916,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 PMIC. + 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
@@ -168,6 +168,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
@@ -233,6 +234,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 +222 -0
222 lines not on this page · raw message
include/linux/mfd/max77693-common.h +4 -1
@@ -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,7 @@ struct max77693_dev {struct regmap *regmap_muic;struct regmap *regmap_haptic;/* Only MAX77693 */ struct regmap *regmap_chg;/* Only MAX77843 */ +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 +181 -0
181 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v8 4/7 input: max77693: add max77705 haptic support
In reply to Dzmitry SankouskiAdd 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
@@ -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
@@ -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
@@ -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
PATCH v8 5/7 power: supply: max77705: Add charger driver for Maxim 77705
In reply to Dzmitry SankouskiAdd 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 v8:
- join lines, where fits 100 chars
- change comment style C++ -> C
- remove author from 'based on' file header statement Changes for v6:
- add i2c init in driver
- replace remove_new back on remove
- handle IS_ERR(i2c_chg)
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 | 598 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/power/max77705_charger.h | 216 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 821 insertions(+)
drivers/power/supply/Kconfig +6 -0
@@ -583,6 +583,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
@@ -80,6 +80,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 +598 -0
598 lines not on this page · raw message
include/linux/power/max77705_charger.h new file +216 -0
216 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v8 6/7 power: supply: max77705: Add fuel gauge driver for Maxim 77705
In reply to Dzmitry SankouskiAdd driver for Maxim 77705 fuel gauge (part of max77705 PMIC) providing power supply class information to userspace.
The driver is configured through DTS (battery and system related settings).
---
Changes for v8:
- join line where possible to fit in 100 chars
- change comment style C++ -> C
- fix kernel-doc comments
Changes for v6:
- add i2c init in driver
- initialize unintialized ret value with 0
- remove unused CAPACITY_SCALE_* constants
- max77705_*_convert: replace multiplication and divison with
mult_frac helper to fix https://lore.kernel.org/oe-kbuild-all/[email protected]/
- max77705_battery_settings: move out battery settings gathering and rename function
- probe: do regmap setup last, because if power_supply_get_battery_info
fails, we're going to probe again and fail with i2c bus busy error
- remove MFD from commit message
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 | 363 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/power/max77705_fuelgauge.h | 71 +++++++++++++++++++++++++++ 4 files changed, 442 insertions(+)
drivers/power/supply/Kconfig +7 -0
@@ -589,6 +589,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
@@ -81,6 +81,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 +363 -0
363 lines not on this page · raw message
include/linux/power/max77705_fuelgauge.h new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v8 7/7 leds: max77705: Add LEDs support
In reply to Dzmitry SankouskiThis adds basic support for LEDs for the max77705 PMIC.
---
Changes for v8:
- join line where possible to fit in 100 chars
- change comment style C++ -> C
Changes for v6:
- change compatible suffix to 'rgb'
- remove I2C dependency in Kconfig
- remove copyright and author from 'based on' header statement
- replace MFD abbreviation with PMIC
- MAINTAINERS: alphabetic order
- max77705_rgb_blink: replace ternary operators with if..else if sequence
- max77705_rgb_blink: move hardcoded numbers to constants
- max77705_led_brightness_set: move ret to the bottom
- s/map/regmap
- replace device_for_each_child_node with scoped version
- s/rv/ret
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 | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/max77705-private.h | 18 ++++++++++++++++ 5 files changed, 193 insertions(+)
MAINTAINERS +1 -0
@@ -14134,6 +14134,7 @@ 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/leds/leds-max77705.c F: drivers/*/*max77843.c F: drivers/*/max14577*.c F: drivers/*/max77686*.c
drivers/leds/Kconfig +6 -0
@@ -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 + help + LED driver for MAX77705 PMIC from Maxim Integrated. + config LEDS_MAX8997 tristate "LED support for MAX8997 PMIC" depends on LEDS_CLASS && MFD_MAX8997
drivers/leds/Makefile +1 -0
@@ -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 +167 -0
167 lines not on this page · raw message
include/linux/mfd/max77705-private.h +18 -0
@@ -35,6 +35,24 @@#define MAX77705_SYSTEM_IRQ_SYSOVLO_INT BIT(5)#define MAX77705_SYSTEM_IRQ_TSHDN_INT BIT(6)#define MAX77705_SYSTEM_IRQ_TM_INT BIT(7) +/* MAX77705_RGBLED_REG_LEDEN register */ +#define MAX77705_RGBLED_EN_WIDTH 2 +/* MAX77705_RGBLED_REG_LEDBLNK register */ +#define MAX77705_RGB_DELAY_100_STEP_LIM 500 +#define MAX77705_RGB_DELAY_100_STEP_COUNT 4 +#define MAX77705_RGB_DELAY_100_STEP 100 +#define MAX77705_RGB_DELAY_250_STEP_LIM 3250 +#define MAX77705_RGB_DELAY_250_STEP 250 +#define MAX77705_RGB_DELAY_500_STEP 500 +#define MAX77705_RGB_DELAY_500_STEP_COUNT 10 +#define MAX77705_RGB_DELAY_500_STEP_LIM 5000 +#define MAX77705_RGB_DELAY_1000_STEP_LIM 8000 +#define MAX77705_RGB_DELAY_1000_STEP_COUNT 13 +#define MAX77705_RGB_DELAY_1000_STEP 1000 +#define MAX77705_RGB_DELAY_2000_STEP 2000 +#define MAX77705_RGB_DELAY_2000_STEP_COUNT 13 +#define MAX77705_RGB_DELAY_2000_STEP_LIM 12000 +enum max77705_hw_rev {MAX77705_PASS1 =1 ,
Signature · 1 line
2.39.2
kernel test robot
build botRe: [PATCH v8 3/7] mfd: Add new driver for MAX77705 PMIC
In reply to Dzmitry Sankouskikernel test robot noticed the following build warnings:
Hi Dzmitry,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 86e3904dcdc7e70e3257fc1de294a1b75f3d8d04]
url: https://github.com/intel-lab-lkp/linux/commits/Dzmitry-Sankouski/power-supply-add-undervoltage-health-status-property/20241031-053513 base: 86e3904dcdc7e70e3257fc1de294a1b75f3d8d04 patch link: https://lore.kernel.org/r/20241031-starqltechn_integration_upstream-v8-3-2fa666c2330e%40gmail.com patch subject: [PATCH v8 3/7] mfd: Add new driver for MAX77705 PMIC config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20241103/[email protected]/config) compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241103/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from drivers/mfd/max77705.c:8:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:21:
In file included from include/linux/mm.h:2223:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mfd/max77705.c:129:6: warning: variable 'pmic_rev' is uninitialized when used here [-Wuninitialized]
129 | if (pmic_rev != MAX77705_PASS3) {
| ^~~~~~~~
drivers/mfd/max77705.c:108:13: note: initialize the variable 'pmic_rev' to silence this warning
108 | u8 pmic_rev;
| ^
| = '\0'5 warnings generated.
vim +/pmic_rev +129 drivers/mfd/max77705.c
100
101 static int max77705_i2c_probe(struct i2c_client *i2c)
102 {
103 struct max77693_dev *max77705;
104 struct regmap_irq_chip_data *irq_data;
105 struct irq_domain *domain;
106 int ret;
107 unsigned int pmic_rev_value;
108 u8 pmic_rev;
109
110
111 max77705 = devm_kzalloc(&i2c->dev, sizeof(*max77705), GFP_KERNEL);
112 if (!max77705)
113 return -ENOMEM;
114
115 max77705->i2c = i2c;
116 max77705->dev = &i2c->dev;
117 max77705->irq = i2c->irq;
118 max77705->type = TYPE_MAX77705;
119 i2c_set_clientdata(i2c, max77705);
120
121 max77705->regmap = devm_regmap_init_i2c(i2c, &max77705_regmap_config);
122
123 if (IS_ERR(max77705->regmap))
124 return PTR_ERR(max77705->regmap);
125
126 if (regmap_read(max77705->regmap, MAX77705_PMIC_REG_PMICREV, &pmic_rev_value) < 0)
127 return -ENODEV;
128
> 129 if (pmic_rev != MAX77705_PASS3) { 130 dev_err(max77705->dev, "rev.0x%x is not tested",
131 pmic_rev);
132 return -ENODEV;
133 }
134
135 max77705->regmap_leds = devm_regmap_init_i2c(i2c, &max77705_leds_regmap_config);
136
137 if (IS_ERR(max77705->regmap_leds))
138 return PTR_ERR(max77705->regmap_leds);
139
140 ret = devm_regmap_add_irq_chip(max77705->dev, max77705->regmap,
141 max77705->irq,
142 IRQF_ONESHOT | IRQF_SHARED, 0,
143 &max77705_topsys_irq_chip,
144 &irq_data);
145
146 if (ret)
147 dev_err(max77705->dev, "failed to add irq chip: %d\n", ret);
148
149 /* Unmask interrupts from all blocks in interrupt source register */
150 ret = regmap_update_bits(max77705->regmap,
151 MAX77705_PMIC_REG_INTSRC_MASK,
152 MAX77705_SRC_IRQ_ALL, (unsigned int)~MAX77705_SRC_IRQ_ALL);
153
154 if (ret < 0) {
155 dev_err(max77705->dev,
156 "Could not unmask interrupts in INTSRC: %d\n", ret);
157 return ret;
158 }
159
160 domain = regmap_irq_get_domain(irq_data);
161
162 ret = devm_mfd_add_devices(max77705->dev, PLATFORM_DEVID_NONE,
163 max77705_devs, ARRAY_SIZE(max77705_devs),
164 NULL, 0, domain);
165
166 if (ret) {
167 dev_err(max77705->dev, "Failed to register child devices: %d\n", ret);
168 return ret;
169 }
170
171 device_init_wakeup(max77705->dev, true);
172
173 return 0;
174 }
175
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki