All of lore.kernel.org
 help / color / mirror / Atom feed
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,
	cooloney@gmail.com, g.liakhovetski@gmx.de,
	s.nawrocki@samsung.com, laurent.pinchart@ideasonboard.com,
	mchehab@osg.samsung.com
Subject: Re: [PATCH 4/5] leds: aat1290: Pass dev and dev->of_node to v4l2_flash_init()
Date: Thu, 21 May 2015 14:13:12 +0200	[thread overview]
Message-ID: <555DCBD8.8040507@samsung.com> (raw)
In-Reply-To: <20150521100604.GG8601@valkosipuli.retiisi.org.uk>

Hi Sakari

On 05/21/2015 12:06 PM, Sakari Ailus wrote:
[...]
>>> On Wed, May 20, 2015 at 03:47:25PM +0200, Jacek Anaszewski wrote:
>>> ...
>>>>>>>> --- a/drivers/leds/leds-aat1290.c
>>>>>>>> +++ b/drivers/leds/leds-aat1290.c
>>>>>>>> @@ -524,9 +524,8 @@ static int aat1290_led_probe(struct
>>>>>>>> platform_device *pdev)
>>>>>>>>       led_cdev->dev->of_node = sub_node;
>>>>>>>>
>>>>>>>>       /* Create V4L2 Flash subdev. */
>>>>>>>> -    led->v4l2_flash = v4l2_flash_init(fled_cdev,
>>>>>>>> -                      &v4l2_flash_ops,
>>>>>>>> -                      &v4l2_sd_cfg);
>>>>>>>> +    led->v4l2_flash = v4l2_flash_init(dev, NULL, fled_cdev,
>>>>>>>> +                      &v4l2_flash_ops, &v4l2_sd_cfg);
>>>>>>>
>>>>>>> Here the first argument should be led_cdev->dev, not dev, which is
>>>>>>> &pdev->dev, whereas led_cdev->dev is returned by
>>>>>>> device_create_with_groups (it takes dev as a parent) called from
>>>>>>> led_classdev_register.
>>>>>>
>>>>>> The reason for this is the fact that pdev->dev has its of_node
>>>>>> field initialized, which makes v4l2_async trying to match
>>>>>> subdev by parent node of a LED device, not by sub-LED related
>>>>>> DT node.
>>>>>
>>>>> If v4l2_subdev->of_node is set, then it won't be replaced with one from
>>>>> struct device. I.e. you need to provide of_node pointer only if it's
>>>>> different from dev->of_node.
>>>>>
>>>>
>>>> It will always be different since dev->of_node pointer is related
>>>> to the main DT node of LED device, whereas each LED connected to it
>>>> must be expressed in the form of sub-node, as
>>>> Documentation/devicetree/bindings/leds/common.txt DT states.
>>>
>>> You can still refer to the device's root device_node using a phandle.
>>
>> Why should I need to refer to the device's root node?
>>
>> What I meant here was that DT documentation enforces that even if
>> there is a single LED connected to the device it has to be expressed
>> as a sub-node anyway. Each LED will have to be matched by the phandle
>> to the sub-node representing it. This implies that v4l2_subdev->of_node
>> (related to sub-LED DT node) will be always different from dev->of_node
>> (related to LED controller DT node).
>
>>From driver point of view this makes no difference; it's just easier to
> parse if you don't refer to the LEDs separately. I think this is a bit
> special case; nowadays many LED flash controllers drive two LEDs.

As I understand, your stance is as follows:
- second argument to v4l2_flash_init needn't always be initialized
   because some LEDs could be referred to by the phandle to the parent
   node (e.g. flash LED and indicator under common sub-device)

If this is true, than how we would handle the situation where
there is a flash LED controller with two separate flash LEDs
and one of them is associated with indicator LED?

>>
>>> Say, if you have a LED flash controller with an indicator. It's intended to
>>> be used together with the flash LED, and the existing as3645a driver exposes
>>> it through the same sub-device. I think that'd make sense with LED class
>>> driver as well (i.e. you'd have two LED class devices but a single
>>> sub-device). Small changes to the wrapper would be needed.
>>>
>>
>> How the sub-device name should look like then? We would have to
>> concatenate somehow both LED class device names?
>
> It'd be different, i.e. there would be no flash or indicator in the name.
>

Currently there is no such a requirement too. As we discussed it few
months ago v4l2-flash sub-device name should be composed:
- for I2C devices "<LED class dev name> <i2c_adapter_id>-<i2c_addr>"
- for GPIO driven devices: <LED class dev name>

-- 
Best Regards,
Jacek Anaszewski

  reply	other threads:[~2015-05-21 12:13 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19 23:04 [PATCH 0/5] V4L2 flash API wrapper improvements Sakari Ailus
2015-05-19 23:04 ` [PATCH 1/5] v4l: async: Add a pointer to of_node to struct v4l2_subdev, match it Sakari Ailus
2015-05-20 14:20   ` Jacek Anaszewski
2015-05-23 18:47   ` Laurent Pinchart
2015-05-31 21:54     ` Sakari Ailus
2015-05-31 22:24     ` [PATCH v1.1 " Sakari Ailus
2015-06-02  2:47       ` Laurent Pinchart
2015-06-09  8:05         ` Sakari Ailus
2015-06-10 21:27         ` [PATCH v1.2 " Sakari Ailus
2015-06-11 19:18           ` [PATCH v1.3 " Sakari Ailus
2015-06-11 19:27             ` Laurent Pinchart
2015-06-12  6:41               ` Sakari Ailus
2015-06-15 18:34                 ` Bryan Wu
2015-05-19 23:04 ` [PATCH 2/5] v4l: flash: Make v4l2_flash_init() and v4l2_flash_release() functions always Sakari Ailus
2015-05-23 18:40   ` Laurent Pinchart
2015-05-19 23:04 ` [PATCH 3/5] v4l: flash: Pass struct device and device_node to v4l2_flash_init() Sakari Ailus
2015-05-19 23:04 ` [PATCH 4/5] leds: aat1290: Pass dev and dev->of_node " Sakari Ailus
2015-05-20  9:47   ` Jacek Anaszewski
2015-05-20 10:19     ` Sakari Ailus
2015-05-20 10:37     ` Jacek Anaszewski
2015-05-20 12:27       ` Sakari Ailus
2015-05-20 13:47         ` Jacek Anaszewski
2015-05-20 14:31           ` Sakari Ailus
2015-05-21  8:54             ` Jacek Anaszewski
2015-05-21 10:06               ` Sakari Ailus
2015-05-21 12:13                 ` Jacek Anaszewski [this message]
2015-05-21 13:14                   ` Sakari Ailus
2015-05-19 23:04 ` [PATCH 5/5] leds: max77693: " 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=555DCBD8.8040507@samsung.com \
    --to=j.anaszewski@samsung.com \
    --cc=cooloney@gmail.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --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.