All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: linux-media@vger.kernel.org
Cc: hj210.choi@samsung.com, dh09.lee@samsung.com,
	a.hajda@samsung.com, shaik.ameer@samsung.com,
	arun.kk@samsung.com, Kyungmin Park <kyungmin.park@samsung.com>,
	Seung-Woo Kim <sw0312.kim@samsung.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Sakari Ailus <sakari.ailus@iki.fi>
Subject: Re: [PATCH 09/13] media: Change media device link_notify behaviour
Date: Tue, 28 May 2013 19:39:12 +0200	[thread overview]
Message-ID: <51A4EBC0.9090300@samsung.com> (raw)
In-Reply-To: <1368113805-20233-10-git-send-email-s.nawrocki@samsung.com>

Hi All,

(replying to myself, probably a bad sign... ;))

On 05/09/2013 05:36 PM, Sylwester Nawrocki wrote:
> Currently the media device link_notify callback is invoked before the
> actual change of state of a link when the link is being enabled, and
> after the actual change of state when the link is being disabled.
> 
> This doesn't allow a media device driver to perform any operations
> on a full graph before a link is disabled, as well as performing
> any tasks on a modified graph right after a link's state is changed.
> 
> This patch modifies signature of the link_notify callback. This
> callback is now called always before and after a link's state change.
> To distinguish the notifications a 'notification' argument is added
> to the link_notify callback: MEDIA_DEV_NOTIFY_PRE_LINK_CH indicates
> notification before link's state change and
> MEDIA_DEV_NOTIFY_POST_LINK_CH corresponds to a notification after
> link flags change.
> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/media/media-entity.c                  |   18 +++--------
>  drivers/media/platform/exynos4-is/media-dev.c |   16 +++++-----
>  drivers/media/platform/omap3isp/isp.c         |   41 +++++++++++++++----------
>  include/media/media-device.h                  |    9 ++++--
>  4 files changed, 46 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index 7c2b51c..0fcf4c0 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -547,25 +547,17 @@ int __media_entity_setup_link(struct media_link *link, u32 flags)
>  
>  	mdev = source->parent;
>  
> -	if ((flags & MEDIA_LNK_FL_ENABLED) && mdev->link_notify) {
> -		ret = mdev->link_notify(link->source, link->sink,
> -					MEDIA_LNK_FL_ENABLED);
> +	if (mdev->link_notify) {
> +		ret = mdev->link_notify(link, MEDIA_LNK_FL_ENABLED,
> +						MEDIA_DEV_NOTIFY_PRE_LINK_CH);

After some testing I found it really should have been

		ret = mdev->link_notify(link, flags,
					MEDIA_DEV_NOTIFY_PRE_LINK_CH);

Otherwise the pipeline never gets powered off upon link disconnection.

I will repost the whole series in the end of week, after some more testing.
Still, any further comments on this are appreciated.

Thanks,
Sylwester
>  		if (ret < 0)
>  			return ret;
>  	}
>  
>  	ret = __media_entity_setup_link_notify(link, flags);
> -	if (ret < 0)
> -		goto err;
>  
> -	if (!(flags & MEDIA_LNK_FL_ENABLED) && mdev->link_notify)
> -		mdev->link_notify(link->source, link->sink, 0);
> -
> -	return 0;
> -
> -err:
> -	if ((flags & MEDIA_LNK_FL_ENABLED) && mdev->link_notify)
> -		mdev->link_notify(link->source, link->sink, 0);
> +	if (mdev->link_notify)
> +		mdev->link_notify(link, flags, MEDIA_DEV_NOTIFY_POST_LINK_CH);
>  
>  	return ret;
>  }

-- 
Sylwester Nawrocki
Samsung R&D Institute Poland
Samsung Electronics

  reply	other threads:[~2013-05-28 17:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-09 15:36 [PATCH RFC 00/13] Media link_notify behaviour change an exynos4-is updates Sylwester Nawrocki
2013-05-09 15:36 ` [PATCH 01/13] exynos4-is: Remove platform_device_id table at fimc-lite driver Sylwester Nawrocki
2013-05-09 15:36 ` [PATCH 02/13] exynos4-is: Correct querycap ioctl handling " Sylwester Nawrocki
2013-05-09 15:36 ` [PATCH 03/13] exynos4-is: Move common functions to a separate module Sylwester Nawrocki
2013-05-09 15:36 ` [PATCH 04/13] exynos4-is: Add struct exynos_video_entity Sylwester Nawrocki
2013-05-09 15:36 ` [PATCH 05/13] exynos4-is: Preserve state of controls between /dev/video open/close Sylwester Nawrocki
2013-05-09 15:36 ` [PATCH 06/13] exynos4-is: Media graph/video device locking rework Sylwester Nawrocki
2013-05-09 15:36 ` [PATCH 07/13] exynos4-is: Do not use asynchronous runtime PM in release fop Sylwester Nawrocki
2013-05-09 15:36 ` [PATCH 08/13] exynos4-is: Use common exynos_media_pipeline data structure Sylwester Nawrocki
2013-05-09 15:36 ` [PATCH 09/13] media: Change media device link_notify behaviour Sylwester Nawrocki
2013-05-28 17:39   ` Sylwester Nawrocki [this message]
2013-05-30  2:02   ` Laurent Pinchart
2013-05-31 10:02     ` Sylwester Nawrocki
2013-05-09 15:36 ` [PATCH 10/13] exynos4-is: Extend link_notify handler to support fimc-is/lite pipelines Sylwester Nawrocki
2013-05-09 15:36 ` [PATCH 11/13] exynos4-is: Fix sensor subdev -> FIMC notification setup Sylwester Nawrocki
2013-05-09 15:36 ` [PATCH 12/13] exynos4-is: Add locking at fimc(-lite) subdev unregistered handler Sylwester Nawrocki
2013-05-09 15:36 ` [PATCH 13/13] exynos4-is: Remove WARN_ON() from __fimc_pipeline_close() Sylwester Nawrocki

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=51A4EBC0.9090300@samsung.com \
    --to=s.nawrocki@samsung.com \
    --cc=a.hajda@samsung.com \
    --cc=arun.kk@samsung.com \
    --cc=dh09.lee@samsung.com \
    --cc=hj210.choi@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    --cc=shaik.ameer@samsung.com \
    --cc=sw0312.kim@samsung.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 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.