Re: [PATCH v6 12/13] leds: flash: mt6370: Add MediaTek MT6370 flashlight support

From
Andy Shevchenko <hidden>
Date
2022-07-26 06:11:41
Also in
dri-devel, linux-arm-kernel, linux-devicetree, linux-iio, linux-leds, linux-mediatek, linux-pm, linux-usb, lkml
Reply to
szuni chen, 2022-07-26
On Tue, Jul 26, 2022 at 6:15 AM szuni chen [off-list ref] wrote:

...
quoted
quoted
+#define MT6370_ITORCH_MIN_UA           25000
+#define MT6370_ITORCH_STEP_UA          12500
+#define MT6370_ITORCH_MAX_UA           400000
+#define MT6370_ITORCH_DOUBLE_MAX_UA    800000
+#define MT6370_ISTRB_MIN_UA            50000
+#define MT6370_ISTRB_STEP_UA           12500
+#define MT6370_ISTRB_MAX_UA            1500000
+#define MT6370_ISTRB_DOUBLE_MAX_UA     3000000
Perhaps _uA would be better and consistent across your series
regarding current units.
Yes, _uA will be more consistent, but in general, using upper case in
the define macro is a convention, doesn't it?
There is general convention, but there are also:
1) common sense;
2) usage in practice (e.g. _US, etc for *seconds and _HZ for *frequency).

My common sense tells me that it is convenient to use mA,uA, etc.
Plus "in practice" it's related to use as in your series and elsewhere.

But of course it's minor to me, decide yourself.

...
quoted
quoted
+       /*
+        * For the flash to turn on/off, need to wait for HW ramping up/down time
we need
quoted
+        * 5ms/500us to prevent the unexpected problem.
+        */
+       if (!prev && curr)
+               usleep_range(5000, 6000);
+       else if (prev && !curr)
+               udelay(500);
This still remains unanswered, why in the first place we allow
switching, and a busy loop in the other place?
If I refine the description to
"For the flash to turn on/off, need to wait for 5ms/500us analog settling time.
If any flash led is already used, then the analog is settled done, we
don't need to wait again."
is it answer the question?
No. I'm talking from the Linux APIs perspective. There is a huge
difference between those branches. Please, conduct research, read
documentation to understand what my question is about.

-- 
With Best Regards,
Andy Shevchenko
Thread (52 messages) 52 messages, 8 authors, last reply 2022-08-04
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help