dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andrzej Hajda <a.hajda@samsung.com>
To: Ajay Kumar <ajaykumar.rs@samsung.com>,
	dri-devel@lists.freedesktop.org,
	linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org,
	thierry.reding@gmail.com
Cc: inki.dae@samsung.com, seanpaul@google.com, ajaynumb@gmail.com,
	jg1.han@samsung.com, joshi@samsung.com, prashanth.g@samsung.com
Subject: Re: [PATCH 01/15] drm/panel: add prepare and unprepare routines
Date: Tue, 05 Aug 2014 11:11:35 +0200	[thread overview]
Message-ID: <53E09FC7.6010901@samsung.com> (raw)
In-Reply-To: <1406828534-10072-2-git-send-email-ajaykumar.rs@samsung.com>

Hi Ajay,

[RESEND with reconstructed mail receivers, sorry for noise]

I am glad we have finally more fine-grained callbacks.
Just few nitpicks.

On 07/31/2014 07:42 PM, Ajay Kumar wrote:
> Most of the panels need an init sequence as mentioned below:
> 	-- poweron LCD unit/LCD_EN
> 	-- start video data
> 	-- poweron LED unit/BACKLIGHT_EN
> And, a de-init sequence as mentioned below:
> 	-- poweroff LED unit/BACKLIGHT_EN
> 	-- stop video data
> 	-- poweroff LCD unit/LCD_EN
> With existing callbacks for drm panel, we cannot accomodate such panels,
> since only two callbacks, i.e "panel_enable" and panel_disable are supported.
> 
> This patch adds:
> 	-- "prepare" callback which can be called before
> 	the actual video data is on, and then call the "enable"
> 	callback after the video data is available.
> 
> 	-- "unprepare" callback which can be called after
> 	the video data is off, and use "disable" callback
> 	to do something before switching off the video data.
> 
> Now, we can easily map the above scenario as shown below:
> 	poweron LCD unit/LCD_EN = "prepare" callback
> 	poweron LED unit/BACKLIGHT_EN = "enable" callback
> 	poweroff LED unit/BACKLIGHT_EN = "disable" callback
> 	poweroff LCD unit/LCD_EN = "unprepare" callback
> 
> Signed-off-by: Ajay Kumar <ajaykumar.rs-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
>  include/drm/drm_panel.h |   18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index c2ab77a..9addc69 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -31,7 +31,9 @@ struct drm_device;
>  struct drm_panel;
>  
>  struct drm_panel_funcs {
> +	int (*unprepare)(struct drm_panel *panel);
>  	int (*disable)(struct drm_panel *panel);
> +	int (*prepare)(struct drm_panel *panel);
>  	int (*enable)(struct drm_panel *panel);
>  	int (*get_modes)(struct drm_panel *panel);
>  };
> @@ -46,6 +48,14 @@ struct drm_panel {
>  	struct list_head list;
>  };
>  
> +static inline int drm_panel_unprepare(struct drm_panel *panel)
> +{
> +	if (panel && panel->funcs && panel->funcs->unprepare)
> +		return panel->funcs->unprepare(panel);
> +
> +	return panel ? -ENOSYS : -EINVAL;
> +}

Wouldn't be better to return 0 in case there is no callback.
In such case we could avoid implementing ugly dummy callbacks in
each panel driver. This is true for all
prepare/unprepare/enable/disable callbacks.

Regards
Andrzej

> +
>  static inline int drm_panel_disable(struct drm_panel *panel)
>  {
>  	if (panel && panel->funcs && panel->funcs->disable)
> @@ -54,6 +64,14 @@ static inline int drm_panel_disable(struct drm_panel *panel)
>  	return panel ? -ENOSYS : -EINVAL;
>  }
>  
> +static inline int drm_panel_prepare(struct drm_panel *panel)
> +{
> +	if (panel && panel->funcs && panel->funcs->prepare)
> +		return panel->funcs->prepare(panel);
> +
> +	return panel ? -ENOSYS : -EINVAL;
> +}
> +
>  static inline int drm_panel_enable(struct drm_panel *panel)
>  {
>  	if (panel && panel->funcs && panel->funcs->enable)
> 

  parent reply	other threads:[~2014-08-05  9:11 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-31 17:41 [PATCH 00/15] drm/panel: Add prepare and unprepare routines Ajay Kumar
2014-07-31 17:42 ` [PATCH 03/15] drm/panel: ld9040: Add dummy " Ajay Kumar
2014-07-31 17:42 ` [PATCH 04/15] drm/panel: s6e8aa0: " Ajay Kumar
2014-07-31 17:42 ` [PATCH 05/15] drm/panel: simple: " Ajay Kumar
     [not found] ` <1406828534-10072-1-git-send-email-ajaykumar.rs-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-07-31 17:42   ` [PATCH 01/15] drm/panel: add " Ajay Kumar
2014-08-05  9:00     ` Andrzej Hajda
2014-08-05  9:11     ` Andrzej Hajda [this message]
2014-07-31 17:42   ` [PATCH 02/15] drm/panel: Add get_modes helper Ajay Kumar
2014-07-31 17:42   ` [PATCH 06/15] drm/exynos: dpi: Add support for panel prepare and unprepare routines Ajay Kumar
2014-08-01  9:04     ` Thierry Reding
2014-08-01  9:24       ` Inki Dae
2014-08-01 10:22         ` Thierry Reding
2014-07-31 17:42   ` [PATCH 07/15] drm/exynos: dsi: " Ajay Kumar
2014-08-01  9:05     ` Thierry Reding
2014-08-03  7:58       ` Inki Dae
2014-08-05 10:03     ` Andrzej Hajda
2014-08-05 16:11       ` Ajay kumar
2014-07-31 17:42   ` [PATCH 10/15] drm/panel: s6e8aa0: Add proper definition for prepare and unprepare Ajay Kumar
2014-07-31 17:42   ` [PATCH 14/15] drm/exynos: Move DP setup into commit() Ajay Kumar
2014-08-01  9:18     ` Thierry Reding
2014-08-01  9:41       ` Ajay kumar
2014-08-01 10:21         ` Thierry Reding
2014-07-31 17:42 ` [PATCH 08/15] drm/tegra: Add support for panel prepare and unprepare routines Ajay Kumar
2014-07-31 17:42 ` [PATCH 09/15] drm/panel: ld9040: Add proper definition for prepare and unprepare Ajay Kumar
2014-07-31 17:42 ` [PATCH 11/15] drm/panel: simple: " Ajay Kumar
2014-07-31 17:42 ` [PATCH 12/15] drm/panel: simple: Support usage of delays in panel functions Ajay Kumar
2014-07-31 17:42 ` [PATCH 13/15] drm/panel: simple: Add support for auo_b133htn01 panel Ajay Kumar
2014-07-31 17:42 ` [PATCH 15/15] drm/exynos: dp: Modify driver to support drm_panel Ajay Kumar
2014-08-01  9:09   ` Thierry Reding
2014-08-01  9:26     ` Inki Dae
2014-08-01 10:59 ` [PATCH 00/15] drm/panel: Add prepare and unprepare routines Thierry Reding

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=53E09FC7.6010901@samsung.com \
    --to=a.hajda@samsung.com \
    --cc=ajaykumar.rs@samsung.com \
    --cc=ajaynumb@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=inki.dae@samsung.com \
    --cc=jg1.han@samsung.com \
    --cc=joshi@samsung.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=prashanth.g@samsung.com \
    --cc=seanpaul@google.com \
    --cc=thierry.reding@gmail.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