Re: [PATCH 1/5] staging: drivers: mfd: Add MAX77541/MAX77540 PMIC Support
From: Andy Shevchenko
Date: Wed Dec 07 2022 - 06:24:31 EST
On Wed, Dec 07, 2022 at 12:08:40PM +0300, Okan Sahin wrote:
> This patch adds MFD driver for MAX77541/MAX77540 to enable its sub
> devices.
>
> The MAX77541 is a multi-function devices. It includes
> buck converter and ADC.
>
> The MAX77540 is a high-efficiency buck converter
> with two 3A switching phases.
>
> They have same regmap except for ADC part of MAX77541.
Same comment as per patch 2.
...
> + help
> + Say yes here to add support for Analog Devices
> + MAX77541 and MAX77540 Power Management ICs.
> + This driver provides common support for accessing the device;
> + additional drivers must be enabled in order to use the functionality
> + of the device.
Arbitrary line lengths.
...
> + return devm_mfd_add_devices(dev, -1, max77540_devs, ARRAY_SIZE(max77540_devs),
There is a definition for -1, use it.
> + NULL, 0, NULL);
...
> + return devm_mfd_add_devices(dev, -1, max77541_devs, ARRAY_SIZE(max77541_devs),
Ditto.
> + NULL, 0, NULL);
...
> + chip_id = to_i2c_driver(client->dev.driver)->id_table;
> + if (!chip_data) {
> + chip_data = (void *)i2c_match_id(chip_id, client)->driver_data;
> + }
We have a new helper for this.
...
> + return dev_err_probe(me->dev, PTR_ERR(me->regmap),
> + "Failed to allocate register map\n");
Wrong indentation.
...
> +
Redundant blank line.
> +module_i2c_driver(max77541_i2c_driver);
...
> +MODULE_VERSION("1.0");
Why?
...
Missing inclusions:
- bits.h
- types.h
Missing forward declarations for:
struct device
struct regmap
struct regmap_irq_chip_data
...
> +/* REGISTERS */
...
> +#define MAX77541_REGMAP_IRQ_REG(_mask) \
> + { .mask = (_mask), }
When {} are on one line, the trailing comma inside is not needed.
...
> +enum mx_range {
> + LOW_RANGE,
> + MID_RANGE,
> + HIGH_RANGE,
> + RESERVED
Is it terminator?
> +};
...
> +struct max77541_dev {
> + void *pdata;
Why do you need this?
> + struct device *dev;
Isn't it the same as dev inside regmap?
> + struct regmap_irq_chip_data *irq_data;
> + struct regmap_irq_chip_data *irq_buck;
> + struct regmap_irq_chip_data *irq_topsys;
> + struct regmap_irq_chip_data *irq_adc;
> + struct i2c_client *i2c;
Is this is really needed? Perhaps regmap below provides what you need, no?
> + struct regmap *regmap;
> +
> + u8 type;
> +};
--
With Best Regards,
Andy Shevchenko