public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: linux-leds@vger.kernel.org, linux-media@vger.kernel.org,
	kyungmin.park@samsung.com, pavel@ucw.cz, cooloney@gmail.com,
	rpurdie@rpsys.net, s.nawrocki@samsung.com
Subject: Re: [PATCH v8 5/8] exynos4-is: Add support for v4l2-flash subdevs
Date: Thu, 21 May 2015 11:39:35 +0200	[thread overview]
Message-ID: <555DA7D7.1000308@samsung.com> (raw)
In-Reply-To: <20150521074648.GF8601@valkosipuli.retiisi.org.uk>



On 05/21/2015 09:46 AM, Sakari Ailus wrote:
> Hi Jacek,
>
> On Wed, May 20, 2015 at 04:10:12PM +0200, Jacek Anaszewski wrote:
>> This patch adds support for external v4l2-flash devices.
>> The support includes parsing "samsung,flash-led" DT property
>> and asynchronous subdevice registration.
>>
>> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
>> Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
>> Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
>> ---
>>   drivers/media/platform/exynos4-is/media-dev.c |   39 +++++++++++++++++++++++--
>>   drivers/media/platform/exynos4-is/media-dev.h |   13 ++++++++-
>>   2 files changed, 49 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
>> index f315ef9..80cecd8 100644
>> --- a/drivers/media/platform/exynos4-is/media-dev.c
>> +++ b/drivers/media/platform/exynos4-is/media-dev.c
>> @@ -451,6 +451,28 @@ rpm_put:
>>   	return ret;
>>   }
>>
>> +static void fimc_md_register_flash_entities(struct fimc_md *fmd)
>> +{
>> +	int i;
>> +
>> +	fmd->num_flashes = 0;
>> +
>> +	for (i = 0; i < fmd->num_sensors; i++) {
>> +		const struct device_node *np =
>> +					fmd->sensor[i].asd.match.of.node;
>> +		const int nf = fmd->num_flashes;
>> +
>> +		np = of_parse_phandle(np, "samsung,flash-led", 0);
>> +		if (!np)
>> +			continue;
>> +
>> +		fmd->flash[nf].asd.match_type = V4L2_ASYNC_MATCH_OF;
>> +		fmd->flash[nf].asd.match.of.node = np;
>> +		fmd->async_subdevs[fmd->num_sensors + nf] = &fmd->flash[nf].asd;
>> +		fmd->num_flashes++;
>> +	}
>> +}
>> +
>>   static int __of_get_csis_id(struct device_node *np)
>>   {
>>   	u32 reg = 0;
>> @@ -1275,6 +1297,15 @@ static int subdev_notifier_bound(struct v4l2_async_notifier *notifier,
>>   	struct fimc_sensor_info *si = NULL;
>>   	int i;
>>
>> +	/* Register flash subdev if detected any */
>> +	for (i = 0; i < ARRAY_SIZE(fmd->flash); i++) {
>> +		if (fmd->flash[i].asd.match.of.node == subdev->of_node) {
>
> Does the index of a particular sub-device index matter? Could you just use
> the next available one?

Having the positions of sensor sub-devices kept in synch with
the positions of associated flash sub-devices in the 'flash' array
allows to avoid the addition o a condition for checking if the element
of the flash array is available.

> There would be no need to for the check anything here, please see how the
> omap3isp driver does it --- it's in isp_subdev_notifier_bound()
> drivers/media/platform/omap3isp/isp.c .

This 'for' loop allows to detect that the sub-device being bound
is of flash type and basing on that we can exit the function
at this point. Otherwise some guards would have to be added in
the remaining part of the function.

>> +			fmd->flash[i].subdev = subdev;
>> +			fmd->num_flashes++;
>> +			return 0;
>> +		}
>> +	}
>> +
>>   	/* Find platform data for this sensor subdev */
>>   	for (i = 0; i < ARRAY_SIZE(fmd->sensor); i++)
>>   		if (fmd->sensor[i].asd.match.of.node == subdev->dev->of_node)
>


-- 
Best Regards,
Jacek Anaszewski

  reply	other threads:[~2015-05-21  9:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-20 14:10 [PATCH v8 0/8] LED / flash API integration Jacek Anaszewski
2015-05-20 14:10 ` [PATCH v8 1/8] media: Add registration helpers for V4L2 flash sub-devices Jacek Anaszewski
2015-05-20 14:44   ` Sakari Ailus
2015-05-20 14:10 ` [PATCH v8 2/8] leds: max77693: add support for V4L2 Flash sub-device Jacek Anaszewski
2015-05-20 14:59   ` Sakari Ailus
2015-05-20 20:02   ` Sakari Ailus
2015-05-20 14:10 ` [PATCH v8 3/8] DT: aat1290: Document handling external strobe sources Jacek Anaszewski
2015-05-20 14:10 ` [PATCH v8 4/8] leds: aat1290: add support for V4L2 Flash sub-device Jacek Anaszewski
2015-05-20 14:10 ` [PATCH v8 5/8] exynos4-is: Add support for v4l2-flash subdevs Jacek Anaszewski
2015-05-21  7:46   ` Sakari Ailus
2015-05-21  9:39     ` Jacek Anaszewski [this message]
2015-05-21 10:38       ` Sakari Ailus
2015-05-20 14:10 ` [PATCH v8 6/8] DT: s5c73m3: Add documentation for samsung,flash-led property Jacek Anaszewski
2015-05-20 14:10 ` [PATCH v8 7/8] DT: s5k6a3: " Jacek Anaszewski
2015-05-20 14:10 ` [PATCH v8 8/8] DT: samsung-fimc: Add examples " Jacek Anaszewski
2015-05-20 22:00   ` Sakari Ailus
2015-05-21  9:10     ` Jacek Anaszewski
2015-05-21 11:32       ` Sakari Ailus
2015-05-21 13:28         ` Sylwester Nawrocki
2015-05-21 14:20           ` Sakari Ailus
2015-05-21 16:58             ` Sylwester Nawrocki
2015-05-21 23:27               ` Sakari Ailus
2015-05-23 12:03           ` Sakari Ailus
2015-05-25 12:00             ` Sylwester Nawrocki
2015-05-25 12:50               ` Jacek Anaszewski
2015-05-25 14:28                 ` Sylwester Nawrocki
2015-05-25 15:20                   ` Jacek Anaszewski
2015-05-25 20:56                   ` Sakari Ailus
2015-06-01 21:17               ` 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=555DA7D7.1000308@samsung.com \
    --to=j.anaszewski@samsung.com \
    --cc=cooloney@gmail.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rpurdie@rpsys.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox