Re: [PATCH v3 19/23] power: supply: s2dos05: Add fuel gauge driver for s2dos05

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18/06/2024 15:59, Dzmitry Sankouski wrote:
> Add fuel gauge driver for s2dos05 PMIC. It uses adc to measure power
> on each power output s2dos05 provides, including regulator outputs
> and AVDD, ELVSS, ELVDD lines. Driver registers power supply for each
> corresponding power line.
> 
> Adc can be disabled and enabled via sysfs.
> 


> +
> +static const struct power_supply_desc s2dos05_avdd_fg_desc = {
> +	.name		= "s2dos05_avdd",
> +	.type		= POWER_SUPPLY_TYPE_UNKNOWN,
> +	.get_property	= s2dos05_fg_get_property_avdd,
> +	.properties	= s2dos05_fg_properties,
> +	.num_properties	= ARRAY_SIZE(s2dos05_fg_properties),
> +};
> +
> +static const struct power_supply_desc s2dos05_buck_fg_desc = {
> +	.name		= "s2dos05_buck",
> +	.type		= POWER_SUPPLY_TYPE_UNKNOWN,
> +	.get_property	= s2dos05_fg_get_property_buck,
> +	.properties	= s2dos05_fg_properties,
> +	.num_properties	= ARRAY_SIZE(s2dos05_fg_properties),
> +};

Buck is a regulator. Not power supply.

Entire driver is something odd. NAK.

> +static int s2dos05_fuelgauge_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct s2dos_core *iodev = dev_get_drvdata(dev->parent);
> +	struct s2dos05_fg	*drv_data;

Drop redundant spaces.

> +	struct power_supply_config pscfg = {};
> +	int ret;
> +
> +	drv_data = devm_kzalloc(dev, sizeof(struct s2dos05_fg),

Drop 2015 code. Use new drivers as template.

> +							GFP_KERNEL);
> +	if (!drv_data)
> +		ret = -ENOMEM;


> +
> +MODULE_DESCRIPTION("s2dos05 power meter");
> +MODULE_AUTHOR("Dzmitry Sankouski <dsankouski@xxxxxxxxx>");
> +MODULE_LICENSE("GPL");
> diff --git a/include/linux/mfd/s2dos05.h b/include/linux/mfd/s2dos05.h
> new file mode 100644
> index 000000000000..8d216064bc78
> --- /dev/null
> +++ b/include/linux/mfd/s2dos05.h

Why this is MFD? Squash the header into C code.

> @@ -0,0 +1,123 @@
> +/* SPDX-License-Identifier: GPL-2.0+
> + * s2dos05.h

Drop

> + *
> + * Copyright (c) 2016 Samsung Electronics Co., Ltd
> + *              http://www.samsung.com
> + *
> + */
> +
> +#ifndef __LINUX_MFD_S2DOS05_H
> +#define __LINUX_MFD_S2DOS05_H
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +
> +#define MFD_DEV_NAME "s2dos05"

Drop

> +
> +struct s2dos05_dev {
> +	struct device *dev;
> +	struct regmap *regmap;
> +};
> +
> +/* S2DOS05 registers */
> +/* Slave Addr : 0xC0 */
> +enum S2DOS05_reg {
> +	S2DOS05_REG_DEV_ID,
> +	S2DOS05_REG_TOPSYS_STAT,
> +	S2DOS05_REG_STAT,
> +	S2DOS05_REG_EN,
> +	S2DOS05_REG_LDO1_CFG,
> +	S2DOS05_REG_LDO2_CFG,
> +	S2DOS05_REG_LDO3_CFG,
> +	S2DOS05_REG_LDO4_CFG,
> +	S2DOS05_REG_BUCK_CFG,
> +	S2DOS05_REG_BUCK_VOUT,
> +	S2DOS05_REG_IRQ_MASK = 0x0D,
> +	S2DOS05_REG_SSD_TSD = 0x0E,
> +	S2DOS05_REG_OCL = 0x10,
> +	S2DOS05_REG_IRQ = 0x11
> +};
> +
> +/* S2DOS05 regulator ids */
> +enum S2DOS05_regulators {

What does it have to do with power supply / fuel gauge?

> +	S2DOS05_LDO1,
> +	S2DOS05_LDO2,
> +	S2DOS05_LDO3,
> +	S2DOS05_LDO4,
> +	S2DOS05_BUCK1,
> +	S2DOS05_REG_MAX,
> +};



Best regards,
Krzysztof





[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux