public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	Nayden Kanchev <nkanchev@mm-sol.com>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	Cohen David Abraham <david.cohen@nokia.com>
Subject: Re: [RFC] V4L2 API for flash devices
Date: Wed, 30 Mar 2011 15:44:25 +0300	[thread overview]
Message-ID: <4D9325A9.4080200@maxwell.research.nokia.com> (raw)
In-Reply-To: <201103301055.42521.laurent.pinchart@ideasonboard.com>

Laurent Pinchart wrote:
> Hi Sakari,

Hi Laurent,

> On Tuesday 29 March 2011 11:35:19 Sakari Ailus wrote:
>> Hans Verkuil wrote:
>>> On Monday, March 28, 2011 14:55:40 Sakari Ailus wrote:
> 
> [snip]
> 
>>>> 	V4L2_CID_FLASH_TIMEOUT (integer; LED)
>>>>
>>>> The flash controller provides timeout functionality to shut down the led
>>>> in case the host fails to do that. For hardware strobe, this is the
>>>> maximum amount of time the flash should stay on, and the purpose of the
>>>> setting is to prevent the LED from catching fire.
>>>>
>>>> For software strobe, the setting may be used to limit the length of the
>>>> strobe in case a driver does not implement it itself. The granularity of
>>>> the timeout in [1, 2, 3] is very coarse. However, the length of a
>>>> driver-implemented LED strobe shutoff is very dependent on host.
>>>> Possibly V4L2_CID_FLASH_DURATION should be added, and
>>>> V4L2_CID_FLASH_TIMEOUT would be read-only so that the user would be able
>>>> to obtain the actual hardware implemented safety timeout.
>>>>
>>>> Likely a standard unit such as ms or µs should be used.
>>>
>>> It seems to me that this control should always be read-only. A setting
>>> like this is very much hardware specific and you don't want an attacker
>>> changing the timeout to the max value that might cause a LED catching
>>> fire.
>>
>> I'm not sure about that.
>>
>> The driver already must take care of protecting the hardware in my
>> opinion. Besides, at least one control is required to select the
>> duration for the flash if there's no hardware synchronisation.
>>
>> What about this:
>>
>> 	V4L2_CID_FLASH_TIMEOUT
>>
>> Hardware timeout, read-only. Programmed to the maximum value allowed by
>> the hardware for the external strobe, greater or equal to
>> V4L2_CID_FLASH_DURATION for software strobe.
>>
>> 	V4L2_CID_FLASH_DURATION
>>
>> Software implemented timeout when V4L2_CID_FLASH_STROBE_MODE ==
>> V4L2_FLASH_STROBE_MODE_SOFTWARE.
> 
> Why would we need two controls here ? My understanding is that the maximum 
> strobe duration length can be limited by
> 
> - the flash controller itself
> - platform-specific constraints to avoid over-heating the flash
> 
> The platform-specific constraints come from board code, and the flash driver 
> needs to ensure that the flash is never strobed for a duration longer than the 
> limit. This requires implementing a software timer if the hardware has no 
> timeout control, and programming the hardware with the correct timeout value 
> otherwise. The limit can be queried with QUERYCTRL on the duration control.

That's true.

The alternative would be software timeout since the hardware timeout is
rather coarse. Its intention is to protect the hardware from catching
fire mostly.

But as I commented in the other e-mail, there likely isn't a need to be
able to control this very precisely. The user just shuts down the flash
whenever (s)he no longer needs it rather than knows beforehand how long
it needs to stay on.

>> I have to say I'm not entirely sure the duration control is required.
>> The timeout could be writable for software strobe in the case drivers do
>> not implement software timeout. The granularity isn't _that_ much
>> anyway. Also, a timeout fault should be produced whenever the duration
>> would expire.
>>
>> Perhaps it would be best to just leave that out for now.
>>
>>>> 	V4L2_CID_FLASH_LED_MODE (menu; LED)
>>>>
>>>> enum v4l2_flash_led_mode {
>>>>
>>>> 	V4L2_FLASH_LED_MODE_FLASH = 1,
>>>> 	V4L2_FLASH_LED_MODE_TORCH,
> 
> "torch" mode can also be used for video, should we rename TORCH to something 
> more generic ? Maybe a "manual" mode ?

The controllers recognise a torch mode and I think it describes the
functionality quite well. Some appear to make a difference between torch
and video light --- but I can't imagine a purpose in which this could be
useful.

...

Regards,

-- 
Sakari Ailus
sakari.ailus@maxwell.research.nokia.com

  reply	other threads:[~2011-03-30 12:44 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-28 12:55 [RFC] V4L2 API for flash devices Sakari Ailus
2011-03-29  6:49 ` Hans Verkuil
2011-03-29  9:35   ` Sakari Ailus
2011-03-29  9:54     ` Hans Verkuil
2011-03-29 11:38       ` Sakari Ailus
2011-03-29 11:51         ` Sakari Ailus
2011-03-30  8:47           ` Laurent Pinchart
2011-04-05 10:00             ` Sakari Ailus
2011-05-02 16:04               ` Sakari Ailus
2011-05-02 19:13                 ` Hans Verkuil
2011-05-02 19:32                   ` Laurent Pinchart
2011-05-02 20:07                     ` Hans Verkuil
2011-03-30  8:55     ` Laurent Pinchart
2011-03-30 12:44       ` Sakari Ailus [this message]
2011-03-30 13:53         ` Laurent Pinchart
2011-03-30 14:18           ` Sakari Ailus
2011-03-30 14:57             ` David Cohen
2011-03-30 15:00               ` Laurent Pinchart
2011-03-31  8:09                 ` Sakari Ailus
2011-03-29 10:43 ` Kim, HeungJun
2011-03-29 14:41   ` Sakari Ailus
2011-03-30  5:06     ` Kim, HeungJun
2011-03-30 11:37       ` Sakari Ailus
2011-03-30 20:37         ` Kim HeungJun
2011-03-31  8:50           ` Sakari Ailus
2011-03-30  9:34 ` Laurent Pinchart
2011-03-30 11:05   ` Sakari Ailus
2011-03-30 13:54     ` Laurent Pinchart
2011-03-31  8:17       ` Sakari Ailus
2011-04-05 10:23         ` Sakari Ailus
2011-04-05 10:39           ` Laurent Pinchart
2011-04-05 11:21             ` Sakari Ailus
2011-04-05 11:28               ` Laurent Pinchart
2011-04-05 13:35                 ` Sakari Ailus
     [not found]                   ` <4D9B303D.1000003@mm-sol.com>
2011-04-05 16:25                     ` Laurent Pinchart
2011-04-05 12:11 ` David Cohen
2011-04-06  8:04   ` Sakari Ailus
2011-04-12 19:31 ` Sung Hee Park
     [not found] ` <BANLkTik+xqCD7uiGUchsehoUy+gwM+Cjdg@mail.gmail.com>
2011-04-13 12:16   ` Sakari Ailus
2011-04-14 19:38     ` Laurent Pinchart
2011-04-15  5:27       ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D9325A9.4080200@maxwell.research.nokia.com \
    --to=sakari.ailus@maxwell.research.nokia.com \
    --cc=david.cohen@nokia.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=nkanchev@mm-sol.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox