Re: [PATCH/RFC v3 5/5] media: Add registration helpers for V4L2 flash sub-devices

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

 




Hi Jacek,

On Mon, Apr 28, 2014 at 01:25:09PM +0200, Jacek Anaszewski wrote:
> Hi Sakari,
> 
> On 04/23/2014 05:24 PM, Sakari Ailus wrote:
> >Hi Jacek,
> >
> >On Thu, Apr 17, 2014 at 10:26:44AM +0200, Jacek Anaszewski wrote:
> >>Hi Sakari,
> >>
> >>Thanks for the review.
> >>
> >>On 04/16/2014 08:21 PM, Sakari Ailus wrote:
> >>>Hi Jacek,
> >>>
> >>>Thanks for the update!
> >>>
> >>[...]
> >>>>+static inline enum led_brightness v4l2_flash_intensity_to_led_brightness(
> >>>>+					struct led_ctrl *config,
> >>>>+					u32 intensity)
> >>>
> >>>Fits on a single line.
> >>>
> >>>>+{
> >>>>+	return intensity / config->step;
> >>>
> >>>Shouldn't you first decrement the minimum before the division?
> >>
> >>Brightness level 0 means that led is off. Let's consider following case:
> >>
> >>intensity - 15625
> >>config->step - 15625
> >>intensity / config->step = 1 (the lowest possible current level)
> >
> >In V4L2 controls the minimum is not off, and zero might not be a possible
> >value since minimum isn't divisible by step.
> >
> >I wonder how to best take that into account.
> 
> I've assumed that in MODE_TORCH a led is always on. Switching
> the mode to MODE_FLASH or MODE_OFF turns the led off.
> This way we avoid the problem with converting 0 uA value to
> led_brightness, as available torch brightness levels start from
> the minimum current level value and turning the led off is
> accomplished on transition to MODE_OFF or MODE_FLASH, by
> calling brightness_set op with led_brightness = 0.

I'm not sure if we understood the issue the same way. My concern was that if
the intensity isn't a multiple of step (but intensity - min is), the above
formula won't return a valid result (unless I miss something).

-- 
Regards,

Sakari Ailus
e-mail: sakari.ailus@xxxxxx	XMPP: sailus@xxxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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