Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1459560

Re: [PATCH] regulator: Add LTC3676 support

From Mark Brown <broonie@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] regulator: Add LTC3676 support
Date 2016-08-10 21:00 +0200
Message-ID <s4GTp-n4-93@gated-at.bofh.it> (permalink)
References <s4oMO-5I4-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, Aug 09, 2016 at 04:36:07PM -0700, Tim Harvey wrote:

Mostly looks good but quite a few issues with not using framework
features here, a lot of the code can be factored out into the core:

> +	/* DVB reference select is bit5 of DVBA reg */
> +	mask = 1 << 5;
> +
> +	if (mode != REGULATOR_MODE_STANDBY)
> +		bit = mask;	/* Select DVBB */

This will silently treat any mode other than standby identically which
is buggy, it should reject any mode not supported.

> +/* LDO1 always on fixed 0.8V-3.3V via scalar via R1/R2 feeback res */
> +static struct regulator_ops ltc3676_fixed_standby_regulator_ops = {
> +};

Remove this, it's pointless.

> +	node = of_get_child_by_name(dev->of_node, "regulators");
> +	if (!node) {
> +		dev_err(dev, "regulators node not found\n");
> +		return -EINVAL;
> +	}
> +
> +	ret = of_regulator_match(dev, node, ltc3676_matches,
> +				 ARRAY_SIZE(ltc3676_matches));

Use the core support for parsing regulators from OF, don't open code it.

> +	/* parse feedback voltage deviders: LDO3 doesn't have them */
> +	for (i = 0; i < LTC3676_NUM_REGULATORS; i++) {
> +		struct ltc3676_regulator *desc = &ltc3676->regulator_descs[i];
> +		struct device_node *np = ltc3676_matches[i].of_node;
> +		u32 vdiv[2];

There's a callback for parsing additional properties out of the
subnodes, of_parse_cb.

> +static bool ltc3676_readable_reg(struct device *dev, unsigned int reg)
> +{
> +	switch (reg) {
> +		case LTC3676_IRQSTAT:
> +		case LTC3676_BUCK1:

Please follow the kernel coding style.

> +	dev_dbg(dev, "irq%d irqstat=0x%02x\n", irq, irqstat);
> +	if (irqstat & LTC3676_IRQSTAT_THERMAL_WARN) {
> +		dev_info(dev, "Over-temperature Warning\n");

dev_warn()

> +static void ltc3676_apply_fb_voltage_divider(struct ltc3676_regulator *rdesc)
> +{
> +	struct regulator_desc *desc = &rdesc->desc;
> +
> +	if (!rdesc->r1 || !rdesc->r2)
> +		return;

This is a bug if we ever get here, we should be complaining loudly.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] regulator: Add LTC3676 support Tim Harvey <tharvey@gateworks.com> - 2016-08-10 01:40 +0200
  Re: [PATCH] regulator: Add LTC3676 support Mark Brown <broonie@kernel.org> - 2016-08-10 21:00 +0200
    Re: [PATCH] regulator: Add LTC3676 support Tim Harvey <tharvey@gateworks.com> - 2016-08-11 02:50 +0200
      Re: [PATCH] regulator: Add LTC3676 support Mark Brown <broonie@kernel.org> - 2016-08-11 11:50 +0200
        Re: [PATCH] regulator: Add LTC3676 support Tim Harvey <tharvey@gateworks.com> - 2016-08-11 22:50 +0200
          Re: [PATCH] regulator: Add LTC3676 support Mark Brown <broonie@kernel.org> - 2016-08-12 11:30 +0200
  Re: [PATCH] regulator: Add LTC3676 support Rob Herring <robh@kernel.org> - 2016-08-11 00:30 +0200
    Re: [PATCH] regulator: Add LTC3676 support Tim Harvey <tharvey@gateworks.com> - 2016-08-11 02:50 +0200
  [PATCH v2] regulator: Add LTC3676 support Tim Harvey <tharvey@gateworks.com> - 2016-08-15 21:40 +0200
    Applied "regulator: Add LTC3676 support" to the regulator tree Mark Brown <broonie@kernel.org> - 2016-08-16 13:40 +0200

csiph-web