On Wed, Nov 11, 2020 at 5:56 PM Sakari Ailus <sakari.ailus@xxxxxx> wrote: > On Wed, Nov 11, 2020 at 05:34:58PM +0100, Linus Walleij wrote: > > The way I understand it is that this component contains its own > > current regulation electronic. You request a brightness > > between 1-100 and it will support this range (no external > > current boost). And as a user that is "all you need to know". > > > > Isn't this problem more prevalent when you have some kind of > > external current-regulator that you need to program? > > > > This component draws its power directly from VBAT (the main > > battery) so regulating how much of that it takes is up to the > > component. > > > > I could think of the component brightness being a problem if > > the flash is embedded in some kind of plastic that cannot > > take the heat though, but I haven't seen any code trying to > > hold it down for this reason. I suppose the component > > datasheet (that I don't have) specifies all these things... > > The LED is different from the LED driver. If you happen to have a LED with > smaller maximum current than the LED driver can provide, the software has > to limit the current the driver provides, or hardware damage will result. > > This is why virtually all flash LED drivers have these properties. Hm you're right of course. I did some research, the flash driver in the RT8515 appears to be somewhat clever. Here is a schematic picture from the LG P970 service manual where you can see the connections from the RT8515 to the LED: https://dflund.se/~triad/images/rt8515.jpg On this image you can see that there are two resistors connected from the pins "RFS" and "RTS" to ground. RFS (resistance flash setting?) is 20 kOhm RTS (resistance torch setting?) is 39 kOhm Some sleuthing finds us the RT9387A which we have a datasheet for: https://static5.arrow.com/pdfs/2014/7/27/8/21/12/794/rtt_/manual/94download_ds.jspprt9387a.jspprt9387a.pdf This apparently works the same way so now we have a RT9387A driver as well. The two resistances control the max current for flash and torch, with I = 5500 / R, up to 700 mA. For 20 and 39 kOhm this means ImaxFlash = 275 mA ImaxTorch = 141 mA So the max current is actually hardwired into the circuit. The setting of brightness is done with the pulse train, but it is a PWM dimmer setting on top of the max current. So I'll just put in these max currents (assuming they are using the same equation). Yours, Linus Walleij