Re: [PATCH v4] mfd: mt6360: add pmic mt6360 driver

From: Lee Jones
Date: Thu Oct 24 2019 - 04:26:30 EST


Wolfram,

Would you be kind enough to see below please?

I'd like to know if it looks sane to you.

On Tue, 22 Oct 2019, Gene Chen wrote:

> From: Gene Chen <gene_chen@xxxxxxxxxxx>
>
> Add mfd driver for mt6360 pmic chip include
> Battery Charger/USB_PD/Flash LED/RGB LED/LDO/Buck
>
> Signed-off-by: Gene Chen <gene_chen@xxxxxxxxxxx
> ---
> drivers/mfd/Kconfig | 12 +
> drivers/mfd/Makefile | 1 +
> drivers/mfd/mt6360-core.c | 457 +++++++++++++++++++++++++++++++++++++
> include/linux/mfd/mt6360-private.h | 279 ++++++++++++++++++++++
> include/linux/mfd/mt6360.h | 32 +++
> 5 files changed, 781 insertions(+)
> create mode 100644 drivers/mfd/mt6360-core.c
> create mode 100644 include/linux/mfd/mt6360-private.h
> create mode 100644 include/linux/mfd/mt6360.h
>
> changelogs between v1 & v2
> - include missing header file
>
> changelogs between v2 & v3
> - add changelogs
>
> changelogs between v3 & v4
> - fix Kconfig description
> - replace mt6360_pmu_info with mt6360_pmu_data
> - replace probe with probe_new
> - remove unnecessary irq_chip variable
> - remove annotation
> - replace MT6360_MFD_CELL with OF_MFD_CELL

[...]

> + for (i = 0; i < MT6360_SLAVE_MAX; i++) {
> + if (mt6360_slave_addr[i] == client->addr) {
> + mpd->i2c[i] = client;
> + continue;
> + }
> + mpd->i2c[i] = i2c_new_dummy(client->adapter,
> + mt6360_slave_addr[i]);
> + if (!mpd->i2c[i]) {
> + dev_err(&client->dev, "new i2c dev [%d] fail\n", i);
> + ret = -ENODEV;
> + goto out;
> + }
> + i2c_set_clientdata(mpd->i2c[i], mpd);
> + }
> +
> + ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_AUTO,
> + mt6360_devs, ARRAY_SIZE(mt6360_devs), NULL,
> + 0, regmap_irq_get_domain(mpd->irq_data));
> + if (ret < 0) {
> + dev_err(&client->dev, "mfd add cells fail\n");
> + goto out;
> + }
> +
> + return 0;
> +out:
> + while (--i >= 0) {
> + if (mpd->i2c[i]->addr == client->addr)
> + continue;
> + i2c_unregister_device(mpd->i2c[i]);
> + }
> +
> + return ret;
> +}
> +
> +static int mt6360_pmu_remove(struct i2c_client *client)
> +{
> + struct mt6360_pmu_data *mpd = i2c_get_clientdata(client);
> + int i;
> +
> + for (i = 0; i < MT6360_SLAVE_MAX; i++) {
> + if (mpd->i2c[i]->addr == client->addr)
> + continue;
> + i2c_unregister_device(mpd->i2c[i]);
> + }
> +
> + return 0;
> +}

--
Lee Jones [æçæ]
Linaro Services Technical Lead
Linaro.org â Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog