[PATCH] regulator: mt6397: Implement of_map_mode regulator_desc function

Mark Brown broonie at kernel.org
Tue Jun 30 06:38:34 EDT 2020


On Tue, Jun 30, 2020 at 11:10:51AM +1000, Anand K Mistry wrote:
> Without a of_map_mode implementation, the regulator-allowed-modes
> devicetree field is skipped, and attempting to change the regulator mode
> results in an error:
> [    1.439165] vpca15: mode operation not allowed

The modes aren't documented in the binding document, any new device tree
property needs to be added to the binding document.

> +static unsigned int mt6397_map_mode(unsigned int mode)
> +{
> +	return mode == MT6397_BUCK_MODE_AUTO ?
> +		REGULATOR_MODE_NORMAL : REGULATOR_MODE_FAST;
> +}
> +

Please write normal conditional statements to improve legibility, the
ternery operator has uses but they're pretty specialist.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20200630/0d39e2ef/attachment-0001.sig>


More information about the Linux-mediatek mailing list