[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f4d588e1-18e1-e7e1-e862-e87f9c7d7b9e@wanadoo.fr>
Date: Wed, 26 Jul 2023 22:13:55 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: like@...nic.com
Cc: broonie@...nel.org, conor+dt@...nel.org,
devicetree@...r.kernel.org, krzysztof.kozlowski+dt@...aro.org,
lgirdwood@...il.com, liangdong@...nic.com,
linux-kernel@...r.kernel.org, liweilei@...nic.com,
robh+dt@...nel.org, wangweidong.a@...nic.com
Subject: Re: [PATCH V1 1/2] regulator: aw37503: add regulator driver for
AWINIC AW37503
Le 26/07/2023 à 10:16, like-tUEr1MkLeujQT0dZR+AlfA@...lic.gmane.org a
écrit :
> From: Alec Li <like-tUEr1MkLeujQT0dZR+AlfA@...lic.gmane.org>
>
> Add regulator driver for the device AWINIC AW37503 which is single
> inductor - dual output power supply device. AW37503 device is
> designed to support general positive/negative driven applications
> like TFT display panels.
>
> AW37503 regulator driver supports to enable/disable and set voltage
> on its output.
>
> Signed-off-by: Alec Li <like-tUEr1MkLeujQT0dZR+AlfA@...lic.gmane.org>
[...]
> +static int aw37503_probe(struct i2c_client *client)
> +{
> + struct device *dev = &client->dev;
> + struct aw37503_regulator *chip;
> + struct regulator_dev *rdev;
> + struct regmap *regmap;
> + struct regulator_config config = { };
> + int id;
> + int ret;
> +
> + chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
> + if (!chip)
> + return -ENOMEM;
> +
> + regmap = devm_regmap_init_i2c(client, &aw37503_regmap_config);
> + if (IS_ERR(regmap)) {
> + ret = PTR_ERR(regmap);
> + dev_err(dev, "regmap init failed: %d\n", ret);
> + return ret;
> + }
> +
> + i2c_set_clientdata(client, chip);
> + chip->dev = dev;
> +
> + for (id = 0; id < AW37503_MAX_REGULATORS; ++id) {
> + config.regmap = regmap;
> + config.dev = dev;
> + config.driver_data = chip;
I think that these 3 lines could be outside of the loop.
> +
> + rdev = devm_regulator_register(dev, &aw_regs_desc[id],
> + &config);
> + if (IS_ERR(rdev)) {
> + ret = PTR_ERR(rdev);
> + dev_err(dev, "regulator %s register failed: %d\n",
> + aw_regs_desc[id].name, ret);
> + return ret;
> + }
> + }
> + return 0;
> +}
[...]
Powered by blists - more mailing lists