mbox series

[0/4] regulator: Add Maxim MAX20411 support

Message ID 20230119214749.4048933-1-quic_bjorande@quicinc.com
Headers show
Series regulator: Add Maxim MAX20411 support | expand

Message

Bjorn Andersson Jan. 19, 2023, 9:47 p.m. UTC
Introduce binding and driver for the Maxim MAX20411, and wire these up
on the Qualcomm SA8295P ADP.

Bjorn Andersson (4):
  dt-bindings: regulator: Describe Maxim MAX20411
  regulator: Introduce Maxim MAX20411 Step-Down converter
  arm64: dts: qcom: sc8280xp: Add qup1_i2c4
  arm64: dts: qcom: sa8295p-adp: Add max20411 on i2c4

 .../bindings/regulator/maxim,max20411.yaml    |  59 +++++++
 arch/arm64/boot/dts/qcom/sa8295p-adp.dts      |  41 +++++
 arch/arm64/boot/dts/qcom/sc8280xp.dtsi        |  16 ++
 drivers/regulator/Kconfig                     |   8 +
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/max20411-regulator.c        | 163 ++++++++++++++++++
 6 files changed, 288 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/maxim,max20411.yaml
 create mode 100644 drivers/regulator/max20411-regulator.c

Comments

Mark Brown Jan. 20, 2023, 11:47 a.m. UTC | #1
On Thu, Jan 19, 2023 at 01:47:47PM -0800, Bjorn Andersson wrote:

> +	desc->ops = &max20411_ops;
> +	desc->owner = THIS_MODULE;
> +	desc->type = REGULATOR_VOLTAGE;
> +	desc->supply_name = "vin";
> +	desc->name = "max20411";
> +
> +	/*
> +	 * voltage = 0.24375V + selector * 6.25mV
> +	 * with valid selector between 41 to 165 (0.5V to 1.275V)
> +	 */
> +	desc->min_uV = MAX20411_BASE_UV;
> +	desc->uV_step = MAX20411_UV_STEP;
> +	desc->linear_min_sel = MAX20411_MIN_SEL;
> +	desc->n_voltages = MAX20411_MAX_SEL;

Doesn't really matter either way but the more normal way to write
this is to have a static struct with all the fixed values in it
rather than dynamically initialising one at runtime.  Otherwise
this looks good.