[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <89569f43-e6ee-452e-91b5-eeee2838f9b5@wanadoo.fr>
Date: Wed, 1 Jan 2025 11:58:02 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Shree Ramamoorthy <s-ramamoorthy@...com>, aaro.koskinen@....fi,
andreas@...nade.info, khilman@...libre.com, rogerq@...nel.org,
tony@...mide.com, lee@...nel.org, linux-omap@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: m-leonard@...com, praneeth@...com
Subject: Re: [PATCH v1 2/2] mfd: tps65215: Add support for TI TPS65215 PMIC
Le 26/12/2024 à 22:49, Shree Ramamoorthy a écrit :
> Use chip ID and chip_data struct to differentiate between devices in
> probe(). Add TPS65215 resource information. Update descriptions and
> copyright information to reflect the driver supports 2 PMIC devices.
>
> Signed-off-by: Shree Ramamoorthy <s-ramamoorthy@...com>
...
> +static struct chip_data chip_info_table[] = {
> + [TPS65219] = {
> + .irq_chip = &tps65219_irq_chip,
> + .cells = tps65219_cells,
> + .n_cells = ARRAY_SIZE(tps65219_cells),
> + },
> + [TPS65215] = {
Maybe keep alphabetical order?
> + .irq_chip = &tps65215_irq_chip,
> + .cells = tps65215_cells,
> + .n_cells = ARRAY_SIZE(tps65215_cells),
> + },
> +};
> +
> static int tps65219_probe(struct i2c_client *client)
> {
> struct tps65219 *tps;
> + struct chip_data *pmic;
> bool pwr_button;
> int ret;
>
> @@ -231,6 +366,8 @@ static int tps65219_probe(struct i2c_client *client)
> i2c_set_clientdata(client, tps);
>
> tps->dev = &client->dev;
> + tps->chip_id = (uintptr_t)i2c_get_match_data(client);
> + pmic = &chip_info_table[tps->chip_id];
>
> tps->regmap = devm_regmap_init_i2c(client, &tps65219_regmap_config);
> if (IS_ERR(tps->regmap)) {
> @@ -239,14 +376,14 @@ static int tps65219_probe(struct i2c_client *client)
> return ret;
> }
>
> - ret = devm_regmap_add_irq_chip(&client->dev, tps->regmap, client->irq,
> - IRQF_ONESHOT, 0, &tps65219_irq_chip,
> + ret = devm_regmap_add_irq_chip(tps->dev, tps->regmap, client->irq,
> + IRQF_ONESHOT, 0, pmic->irq_chip,
> &tps->irq_data);
> if (ret)
> return ret;
>
> ret = devm_mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO,
> - tps65219_cells, ARRAY_SIZE(tps65219_cells),
> + pmic->cells, pmic->n_cells,
> NULL, 0, regmap_irq_get_domain(tps->irq_data));
> if (ret) {
> dev_err(tps->dev, "Failed to add child devices: %d\n", ret);
> @@ -284,7 +421,8 @@ static int tps65219_probe(struct i2c_client *client)
> }
>
> static const struct of_device_id of_tps65219_match_table[] = {
> - { .compatible = "ti,tps65219", },
> + { .compatible = "ti,tps65219", .data = (void *)TPS65219, },
> + { .compatible = "ti,tps65215", .data = (void *)TPS65215, },
Maybe keep alphabetical order?
> {}
> };
> MODULE_DEVICE_TABLE(of, of_tps65219_match_table);
> @@ -299,5 +437,5 @@ static struct i2c_driver tps65219_driver = {
> module_i2c_driver(tps65219_driver);
>
> MODULE_AUTHOR("Jerome Neanne <jneanne@...libre.com>");
> -MODULE_DESCRIPTION("TPS65219 power management IC driver");
> +MODULE_DESCRIPTION("TPS65215/TPS65219 PMIC driver");
> MODULE_LICENSE("GPL");
> diff --git a/include/linux/mfd/tps65219.h b/include/linux/mfd/tps65219.h
> index 6ed2ec4264d9..945ab805fa6d 100644
> --- a/include/linux/mfd/tps65219.h
> +++ b/include/linux/mfd/tps65219.h
> @@ -1,8 +1,10 @@
> /* SPDX-License-Identifier: GPL-2.0 */
> /*
> - * Functions to access TPS65219 Power Management IC.
> + * Functions to access TPS65215/TPS65219 Integrated Power Management
> + * Integrated Chips (PMIC)
> *
> * Copyright (C) 2022 BayLibre Incorporated - https://www.baylibre.com/
> + * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
> */
>
> #ifndef MFD_TPS65219_H
> @@ -13,6 +15,12 @@
> #include <linux/regmap.h>
> #include <linux/regulator/driver.h>
>
> +/* Chip id list*/
> +enum pmic_id {
> + TPS65219,
> + TPS65215,
Maybe keep alphabetical order?
> +};
...
CJ
Powered by blists - more mailing lists