[Linux-stm32] [PATCH 2/2] regulator: Add support for stm32 power regulators

Mark Brown broonie at kernel.org
Wed Apr 10 10:38:52 UTC 2019


On Mon, Apr 08, 2019 at 03:24:08PM +0000, Pascal PAILLET-LME wrote:

> +config REGULATOR_STM32_PWR
> +	bool "STMicroelectronics STM32 PWR"
> +	depends on ARCH_STM32

There's no build time dependency here, please also add an || COMPILE_TEST to 
help with build coverage.

> +int stm32_pwr_reg_is_enabled(struct regulator_dev *rdev)
> +{
> +	struct stm32_pwr_reg *priv = rdev_get_drvdata(rdev);
> +	u32 val;
> +
> +	val = readl_relaxed(priv->base + REG_PWR_CR3);
> +
> +	return (val & priv->ready_mask);
> +}

This looks like it's reading back a status bit from the hardware not the
state requested by software - I'd expect an _is_enabled() to reference
the same bit that's updated by the enable/disable functions.  This looks
like a better fit for _get_status().

> +	of_regulator_match(&pdev->dev, np, stm32_pwr_reg_matches,
> +			   STM32PWR_REG_NUM_REGS);

You don't need to open code the matching any more, just set of_match and
regulators_node in the regulator_desc and the core will do it for you.

> +MODULE_DESCRIPTION("STM32MP1 PWR voltage regulator driver");
> +MODULE_AUTHOR("Gabriel Fernandez <gabriel.fernandez at st.com>");
> +MODULE_LICENSE("GPL v2");

No signoff from Gabriel?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://st-md-mailman.stormreply.com/pipermail/linux-stm32/attachments/20190410/2a5d0d10/attachment.sig>


More information about the Linux-stm32 mailing list