mbox series

[0/2] DA9121 regulator support

Message ID 20201029151538.23463-1-vincent.whitchurch@axis.com
Headers show
Series DA9121 regulator support | expand

Message

Vincent Whitchurch Oct. 29, 2020, 3:15 p.m. UTC
This series adds support for the DA9121, a "High-Performance, 10 A, Dual-Phase
DC-DC Converter".  The datasheet is currently available here:

 https://www.dialog-semiconductor.com/sites/default/files/da9121_datasheet_2v3.pdf

Vincent Whitchurch (2):
  dt-bindings: regulator: Add DA9121
  regulator: Add support for DA9121 regulator

 .../bindings/regulator/dlg,da9121.yaml        |  42 +++++++
 drivers/regulator/Kconfig                     |  12 ++
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/da9121-regulator.c          | 111 ++++++++++++++++++
 4 files changed, 166 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/dlg,da9121.yaml
 create mode 100644 drivers/regulator/da9121-regulator.c

Comments

Mark Brown Oct. 29, 2020, 3:28 p.m. UTC | #1
On Thu, Oct 29, 2020 at 04:15:38PM +0100, Vincent Whitchurch wrote:

> +	config.init_data = of_get_regulator_init_data(dev, dev->of_node, &da9121_reg);
> +	if (!config.init_data)
> +		return -ENOMEM;

Don't do this, the core can do the DT bit for you and there is no reason
not to register the device if there are no constraints.  -ENOMEM would
also be the wrong error code here.
Vincent Whitchurch Nov. 2, 2020, 3:48 p.m. UTC | #2
On Thu, Oct 29, 2020 at 03:28:43PM +0000, Mark Brown wrote:
> On Thu, Oct 29, 2020 at 04:15:38PM +0100, Vincent Whitchurch wrote:
> 
> > +	config.init_data = of_get_regulator_init_data(dev, dev->of_node, &da9121_reg);
> > +	if (!config.init_data)
> > +		return -ENOMEM;
> 
> Don't do this, the core can do the DT bit for you and there is no reason
> not to register the device if there are no constraints.  -ENOMEM would
> also be the wrong error code here.

OK, thanks.  I see that I can get the core to do it if I set ->of_match
on the regulator_desc.  I also see that there is some flexibility about
the placement of the constraints (desc->regulators_node is optional).

This chip has only one output which the datasheet calls Buck1, so I will
remove this call and set the desc.of_match field to get the driver to
support a node which looks like this:

      regulator@68 {
        compatible = "dlg,da9121";
        reg = <0x68>;

        buck1 {
            regulator-min-microvolt = <675000>;
            regulator-max-microvolt = <825000>;
        };
      };