lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a718233d-1389-93c2-fba2-c6051310febe@linaro.org>
Date:   Mon, 8 May 2023 22:15:08 +0200
From:   Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To:     Zeynep Arslanbenzer <Zeynep.Arslanbenzer@...log.com>,
        lee@...nel.org, robh+dt@...nel.org,
        krzysztof.kozlowski+dt@...aro.org, sre@...nel.org,
        lgirdwood@...il.com, broonie@...nel.org
Cc:     linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
        linux-pm@...r.kernel.org,
        Nurettin Bolucu <Nurettin.Bolucu@...log.com>
Subject: Re: [PATCH v3 5/7] power: supply: max77658: Add ADI MAX77658 Battery
 Support

On 08/05/2023 15:10, Zeynep Arslanbenzer wrote:
> Battery driver for ADI MAX77658.
> 
> The MAX77658 is an ultra-low power fuel gauge which implements the Maxim ModelGauge m5 EZ algorithm.
> 
> Signed-off-by: Nurettin Bolucu <Nurettin.Bolucu@...log.com>
> Signed-off-by: Zeynep Arslanbenzer <Zeynep.Arslanbenzer@...log.com>
> ---
>  drivers/power/supply/Kconfig            |   7 +
>  drivers/power/supply/Makefile           |   1 +
>  drivers/power/supply/max77658-battery.c | 633 ++++++++++++++++++++++++
>  3 files changed, 641 insertions(+)
>  create mode 100644 drivers/power/supply/max77658-battery.c
> 
> diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
> index 4b68bbb1e2a8..f9556f4b9e35 100644
> --- a/drivers/power/supply/Kconfig
> +++ b/drivers/power/supply/Kconfig
> @@ -572,6 +572,13 @@ config CHARGER_MAX77658
>  	  Say Y to enable support for the battery charger control of
>  	  MAX77654/58/59 PMIC.
>  
> +config BATTERY_MAX77658
> +	tristate "Analog Devices MAX77658 battery driver"
> +	depends on MFD_MAX77658
> +	help
> +	  Say Y to enable support for the battery control of
> +	  MAX77658 PMIC.
> +
>  config CHARGER_MAX77693
>  	tristate "Maxim MAX77693 battery charger driver"
>  	depends on MFD_MAX77693
> diff --git a/drivers/power/supply/Makefile b/drivers/power/supply/Makefile
> index af4bd6e5969f..e5a425d333a7 100644
> --- a/drivers/power/supply/Makefile
> +++ b/drivers/power/supply/Makefile
> @@ -77,6 +77,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_MAX77658)	+= max77658-charger.o
> +obj-$(CONFIG_BATTERY_MAX77658)	+= max77658-battery.o
>  obj-$(CONFIG_CHARGER_MAX77693)	+= max77693_charger.o
>  obj-$(CONFIG_CHARGER_MAX77976)	+= max77976_charger.o
>  obj-$(CONFIG_CHARGER_MAX8997)	+= max8997_charger.o
> diff --git a/drivers/power/supply/max77658-battery.c b/drivers/power/supply/max77658-battery.c
> new file mode 100644
> index 000000000000..4948ef227db1
> --- /dev/null
> +++ b/drivers/power/supply/max77658-battery.c
> @@ -0,0 +1,633 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2023 Analog Devices, Inc.
> + * ADI battery driver for the MAX77658
> + */
> +
> +#include <linux/bitfield.h>
> +#include <linux/delay.h>
> +#include <linux/mfd/max77658.h>
> +#include <linux/module.h>
> +#include <linux/of_irq.h>
> +#include <linux/platform_device.h>
> +#include <linux/power_supply.h>
> +#include <linux/regmap.h>
> +
> +/* Default value for SALRT min threshold, in percent */
> +#define MAX77658_SALRT_MIN_DEFAULT	1
> +/* Default value for SALRT max threshold, in percent */
> +#define MAX77658_SALRT_MAX_DEFAULT	99
> +
> +#define MAX77658_IALRTTH_RESOLUTION	8567
> +#define MAX77658_CURRENT_RESOLUTION	33487
> +#define MAX77658_VOLTAGE_RESOLUTION	78125
> +#define MAX77658_FG_DELAY		1000
> +#define MAX77658_BATTERY_FULL		100
> +#define MAX77658_BATTERY_LOW		40
> +#define MAX77658_BATTERY_CRITICAL	10
> +#define MAX77658_MAXMINVOLT_STEP	20000
> +#define MAX77658_VALRTTH_STEP		20000
> +#define MAX77658_VEMPTY_VE_STEP		10000
> +#define MAX77658_POWER_STEP		17100
> +
> +#define MAX77658_REG_STATUS		0x00
> +#define MAX77658_REG_VALRTTH		0x01
> +#define MAX77658_REG_TALRTTH		0x02
> +#define MAX77658_REG_SALRTTH		0x03
> +#define MAX77658_REG_CONFIG		0x1D
> +#define MAX77658_REG_DEVNAME		0x21
> +#define MAX77658_REG_VEMPTY		0x3A
> +#define MAX77658_REG_AVGPOWER		0xB3
> +#define MAX77658_REG_IALRTTH		0xB4
> +#define MAX77658_REG_CONFIG2		0xBB
> +#define MAX77658_REG_TEMP		0x08
> +#define MAX77658_REG_VCELL		0x09
> +#define MAX77658_REG_CURRENT		0x0A
> +#define MAX77658_REG_AVGCURRENT		0x0B
> +#define MAX77658_REG_AVGVCELL		0x19
> +#define MAX77658_REG_MAXMINTEMP		0x1A
> +#define MAX77658_REG_MAXMINVOLT		0x1B
> +#define MAX77658_REG_MAXMINCURR		0x1C
> +#define MAX77658_REG_REPSOC		0x06
> +#define MAX77658_REG_TTE		0x11
> +#define MAX77658_REG_TTF		0x20

This is max17055 or very close one. Don't duplicate drivers. Entire
driver should be merged to existing one, e.g. max17042.

Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ