From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: linux-media@vger.kernel.org, linux-leds@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
s.nawrocki@samsung.com, a.hajda@samsung.com,
kyungmin.park@samsung.com
Subject: Re: [PATCH/RFC v3 5/5] media: Add registration helpers for V4L2 flash sub-devices
Date: Mon, 28 Apr 2014 13:25:09 +0200 [thread overview]
Message-ID: <535E3A95.6010206@samsung.com> (raw)
In-Reply-To: <20140423152435.GJ8753@valkosipuli.retiisi.org.uk>
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.
[...]
>>>> +/*
>>>> + * V4L2 subdev internal operations
>>>> + */
>>>> +
>>>> +static int v4l2_flash_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
>>>> +{
>>>> + struct v4l2_flash *v4l2_flash = v4l2_subdev_to_v4l2_flash(sd);
>>>> + struct led_classdev *led_cdev = v4l2_flash->led_cdev;
>>>> +
>>>> + mutex_lock(&led_cdev->led_lock);
>>>> + v4l2_call_flash_op(sysfs_lock, led_cdev);
>>>
>>> Have you thought about device power management yet?
>>
>> Having in mind that the V4L2 Flash sub-device is only a wrapper
>> for LED driver, shouldn't power management be left to the
>> drivers?
>
> How does the LED controller driver know it needs to power the device up in
> that case?
>
> I think an s_power() op which uses PM runtime to set the power state until
> V4L2 sub-device switches to it should be enough. But I'm fine leaving it out
> from this patchset.
>
This solution looks reasonable.
Regards,
Jacek Anaszewski
next prev parent reply other threads:[~2014-04-28 11:25 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-11 14:56 [PATCH/RFC v3 0/5] LED / flash API integration Jacek Anaszewski
2014-04-11 14:56 ` [PATCH/RFC v3 1/5] leds: Add sysfs and kernel internal API for flash LEDs Jacek Anaszewski
2014-04-14 13:49 ` Sakari Ailus
[not found] ` <1397228216-6657-2-git-send-email-j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-25 23:17 ` Bryan Wu
2014-04-25 23:17 ` Bryan Wu
[not found] ` <CAK5ve-+kMJVRFNYLG9Y8oL389R5NpONu6wf84iX4u5C2fudeuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-28 11:53 ` Jacek Anaszewski
2014-04-28 11:53 ` Jacek Anaszewski
2014-04-11 14:56 ` [PATCH/RFC v3 2/5] leds: Improve and export led_update_brightness function Jacek Anaszewski
2014-04-11 14:56 ` [PATCH/RFC v3 3/5] leds: Add support for max77693 mfd flash cell Jacek Anaszewski
[not found] ` <1397228216-6657-4-git-send-email-j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-16 10:35 ` Lee Jones
2014-04-16 10:35 ` Lee Jones
2014-04-16 17:26 ` Sakari Ailus
2014-04-17 9:23 ` Jacek Anaszewski
2014-04-23 15:52 ` Sakari Ailus
2014-04-28 11:27 ` Jacek Anaszewski
2014-05-06 8:28 ` Sakari Ailus
2014-04-11 14:56 ` [PATCH/RFC v3 4/5] DT: Add documentation for the mfd Maxim max77693 " Jacek Anaszewski
2014-04-11 14:56 ` [PATCH/RFC v3 5/5] media: Add registration helpers for V4L2 flash sub-devices Jacek Anaszewski
[not found] ` <1397228216-6657-6-git-send-email-j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-16 18:21 ` Sakari Ailus
2014-04-16 18:21 ` Sakari Ailus
2014-04-17 8:26 ` Jacek Anaszewski
2014-04-23 15:24 ` Sakari Ailus
2014-04-28 11:25 ` Jacek Anaszewski [this message]
2014-05-02 11:06 ` Sakari Ailus
2014-05-06 6:44 ` Jacek Anaszewski
2014-05-06 9:10 ` Sakari Ailus
2014-05-07 7:20 ` Jacek Anaszewski
2014-05-07 7:58 ` Sakari Ailus
2014-05-09 7:18 ` Jacek Anaszewski
2014-07-10 18:40 ` Sakari Ailus
2014-04-18 17:54 ` [PATCH/RFC v3 0/5] LED / flash API integration Bryan Wu
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=535E3A95.6010206@samsung.com \
--to=j.anaszewski@samsung.com \
--cc=a.hajda@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=s.nawrocki@samsung.com \
--cc=sakari.ailus@iki.fi \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.