Thread (12 messages) 12 messages, 4 authors, 2021-05-27

Re: [PATCH v4 2/2] power: supply: mt6360_charger: add MT6360 charger support

From: Matti Vaittinen <hidden>
Date: 2021-05-27 10:22:54
Also in: linux-devicetree, linux-mediatek, linux-pm, lkml

On Thu, 2021-05-27 at 17:58 +0800, Gene Chen wrote:
Matti Vaittinen [off-list ref] 於 2021年5月27日 週四
下午12:25寫道:
quoted
On Wed, 2021-05-26 at 17:40 +0800, Gene Chen wrote:
quoted
Matti Vaittinen [off-list ref] 於 2021年3月30日
週二
下午7:48寫道:
quoted
On Mon, 2021-01-18 at 20:41 +0800, Gene Chen wrote:
quoted
From: Gene Chen <redacted>

Add basic support for the battery charger for MT6360 PMIC

Signed-off-by: Gene Chen <redacted>
---
 drivers/power/supply/Kconfig          |  10 +
 drivers/power/supply/Makefile         |   1 +
 drivers/power/supply/mt6360_charger.c | 914
++++++++++++++++++++++++++++++++++
 3 files changed, 925 insertions(+)
 create mode 100644 drivers/power/supply/mt6360_charger.c
Thanks for the contribution :)

Few comments which I am not demanding to be 'fixed' - but which
might
be good to be checked. Eg, please consider my comments as
'nit's.

...
quoted
+static unsigned int mt6360_map_reg_sel(u32 data, u32 min,
u32
max,
u32 step)
+{
+     u32 target = 0, max_sel;
+
+     if (data >= min) {
+             target = (data - min) / step;
+             max_sel = (max - min) / step;
+             if (target > max_sel)
+                     target = max_sel;
+     }
+     return target;
+}
lib/linear_ranges.c might already implement this ...
I found we are neither linear_range_get_selector_high or
linear_range_get_selector_low.
When value lower than min_value, choose min_sel. If higher than
max_value, choose max_sel.
Ah, correct.
quoted
Should I create linear_range_get_selector() for this?
My suggestion would be yes, but I am not insisting on it.
Maybe this is a special choosing mechanism, I will keep it.
Could I also keep mt6360_map_real_val?
I think adding generic function to linear range code for others to re-
use would be nice. But if you choose to keep the mt6360_map_reg_sel()
then it I agree that you should also keep the mt6360_map_real_val().

Best regards
	Matti Vaittinen


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help