From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Okan Sahin <okan.sahin@analog.com>
Cc: Lee Jones <lee@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Marcelo Schmitt <marcelo.schmitt1@gmail.com>,
ChiYuan Huang <cy_huang@richtek.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Marcus Folkesson <marcus.folkesson@gmail.com>,
William Breathitt Gray <william.gray@linaro.org>,
Ramona Bolboaca <ramona.bolboaca@analog.com>,
Caleb Connolly <caleb.connolly@linaro.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-iio@vger.kernel.org
Subject: Re: [PATCH v5 2/5] regulator: max77541: Add ADI MAX77541/MAX77540 Regulator Support
Date: Tue, 21 Feb 2023 14:18:45 +0200 [thread overview]
Message-ID: <Y/S2pTZzzHCQzNY3@smile.fi.intel.com> (raw)
In-Reply-To: <20230221103926.49597-3-okan.sahin@analog.com>
On Tue, Feb 21, 2023 at 01:39:10PM +0300, Okan Sahin wrote:
> Regulator driver for both MAX77541 and MAX77540.
> The MAX77541 is a high-efficiency step-down converter
> with two 3A switching phases for single-cell Li+ battery
> and 5VDC systems.
>
> The MAX77540 is a high-efficiency step-down converter
> with two 3A switching phases.
...
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2022 Analog Devices, Inc.
> + * ADI Regulator driver for the MAX77540 and MAX77541
> + */
Dunno if Mark requires // comments for regulator new code.
...
> +#include <linux/i2c.h>
Is there any user of this?
...
> +static int max77541_regulator_probe(struct platform_device *pdev)
> +{
> + struct regulator_config config = {};
> + const struct regulator_desc *desc;
> + struct device *dev = &pdev->dev;
> + struct regulator_dev *rdev;
> + struct max77541 *max77541;
> + int i;
unsigned ?
> + max77541 = dev_get_drvdata(dev->parent);
Can be done in definition block (but it's up to you):
struct regulator_config config = {};
const struct regulator_desc *desc;
struct device *dev = &pdev->dev;
struct max77541 *max77541 = dev_get_drvdata(dev->parent);
struct regulator_dev *rdev;
unsigned int i;
> + config.dev = dev->parent;
> +
> + switch (max77541->chip->id) {
> + case MAX77540:
> + desc = max77540_regulators_desc;
> + break;
> + case MAX77541:
> + desc = max77541_regulators_desc;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + for (i = 0; i < MAX77541_MAX_REGULATORS; i++) {
> + rdev = devm_regulator_register(dev, &desc[i], &config);
> + if (IS_ERR(rdev))
> + return dev_err_probe(dev, PTR_ERR(rdev),
> + "Failed to register regulator\n");
> + }
> +
> + return 0;
> +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-02-21 12:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-21 10:39 [PATCH v5 0/5] Add MAX77541/MAX77540 PMIC Support Okan Sahin
2023-02-21 10:39 ` [PATCH v5 1/5] dt-bindings: regulator: max77541: Add ADI MAX77541/MAX77540 Regulator Okan Sahin
2023-02-21 10:39 ` [PATCH v5 2/5] regulator: max77541: Add ADI MAX77541/MAX77540 Regulator Support Okan Sahin
2023-02-21 12:18 ` Andy Shevchenko [this message]
2023-02-21 10:39 ` [PATCH v5 3/5] iio: adc: max77541: Add ADI MAX77541 ADC Support Okan Sahin
2023-02-21 11:59 ` Andy Shevchenko
2023-02-21 10:39 ` [PATCH v5 4/5] dt-bindings: mfd: max77541: Add ADI MAX77541/MAX77540 Okan Sahin
2023-02-21 11:21 ` Krzysztof Kozlowski
2023-02-21 10:39 ` [PATCH v5 5/5] mfd: max77541: Add ADI MAX77541/MAX77540 PMIC Support Okan Sahin
2023-02-21 12:13 ` Andy Shevchenko
2023-02-22 15:32 ` Lee Jones
2023-02-22 16:14 ` Andy Shevchenko
2023-02-23 14:00 ` Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y/S2pTZzzHCQzNY3@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=caleb.connolly@linaro.org \
--cc=cy_huang@richtek.com \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=lee@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt1@gmail.com \
--cc=marcus.folkesson@gmail.com \
--cc=okan.sahin@analog.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=ramona.bolboaca@analog.com \
--cc=robh+dt@kernel.org \
--cc=william.gray@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox