Re: [PATCH v2 1/3] regulator: da9063: add voltage monitoring registers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Benjamin,

On 4/5/23 08:29, Benjamin Bara wrote:
From: Benjamin Bara <benjamin.bara@xxxxxxxxxxx>

Add the definitions for the registers responsible for voltage
monitoring. Add a voltage monitor enable bitfield per regulator.

Signed-off-by: Benjamin Bara <benjamin.bara@xxxxxxxxxxx>
---
  drivers/regulator/da9063-regulator.c | 29 +++++++++++++++++++++++++++++
  include/linux/mfd/da9063/registers.h | 23 +++++++++++++++++++++++
  2 files changed, 52 insertions(+)

diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index 82f52a2a031a..1c720fc595b3 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c

...

@@ -932,6 +955,12 @@ static int da9063_regulator_probe(struct platform_device *pdev)
  			if (IS_ERR(regl->suspend_sleep))
  				return PTR_ERR(regl->suspend_sleep);
  		}
+		if (regl->info->vmon.reg) {

Just a very minor thing - wouldn't this check be better as:
if (regl->info->vmon.mask) ?

We may have device(s) where 0 is a valid reg. However, mask 0 is probably not making sense - unless I misunderstand something?

Well, I guess the reg 0 is not valid for vmon on currently supported ICs, and it probably is unlikely that would happen on a future device either. Still, treating register 0 as 'not initialized' always feels a tad bad for me if it can be avoided. So, perhaps consider this if you re-spin for some other reason - but I don't think this is by any means crucial.

FWIW:
Reviewed-by: Matti Vaittinen <mazziesaccount@xxxxxxxxx>

+			regl->vmon = devm_regmap_field_alloc(&pdev->dev,
+				da9063->regmap, regl->info->vmon);
+			if (IS_ERR(regl->vmon))
+				return PTR_ERR(regl->vmon);
+		}



--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux