diff mbox

[1/2] drm: Add few more wrapper functions for drm panel

Message ID 1455881334-3295-1-git-send-email-m.deepak@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Deepak M Feb. 19, 2016, 11:28 a.m. UTC
Currently there are few pair of functions which
are called during the panel enable/disable sequence.
To improve the granularity, adding few more wrapper
functions so that the functions are more specific
on what they are doing.

Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Deepak M <m.deepak@intel.com>
Signed-off-by: Gaurav K Singh <gaurav.k.singh@intel.com>
---
 include/drm/drm_panel.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

Comments

Jani Nikula Feb. 19, 2016, 1:53 p.m. UTC | #1
On Fri, 19 Feb 2016, Deepak M <m.deepak@intel.com> wrote:
> Currently there are few pair of functions which
> are called during the panel enable/disable sequence.
> To improve the granularity, adding few more wrapper
> functions so that the functions are more specific
> on what they are doing.

I want to see where all these new drm_panel_* functions would be called
in intel_dsi.c.

Also, this patch touches drm core, not i915. You need to send this kind
of stuff to dri-devel@lists.freedesktop.org to get them merged,
preferably Cc'ing the relevant maintainers (try
scripts/get_maintainer.pl). But for that, I think you need to have the
use case and the in-kernel user as well, so please send the intel_dsi.c
patch too.

BR,
Jani.

>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Deepak M <m.deepak@intel.com>
> Signed-off-by: Gaurav K Singh <gaurav.k.singh@intel.com>
> ---
>  include/drm/drm_panel.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 47 insertions(+)
>
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index 13ff44b..c729f6d 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -73,6 +73,12 @@ struct drm_panel_funcs {
>  	int (*get_modes)(struct drm_panel *panel);
>  	int (*get_timings)(struct drm_panel *panel, unsigned int num_timings,
>  			   struct display_timing *timings);
> +	int (*power_on)(struct drm_panel *panel);
> +	int (*power_off)(struct drm_panel *panel);
> +	int (*backlight_on)(struct drm_panel *panel);
> +	int (*backlight_off)(struct drm_panel *panel);
> +	int (*get_info)(struct drm_panel *panel,
> +				struct drm_connector *connector);
>  };
>  
>  struct drm_panel {
> @@ -117,6 +123,47 @@ static inline int drm_panel_enable(struct drm_panel *panel)
>  	return panel ? -ENOSYS : -EINVAL;
>  }
>  
> +static inline int drm_panel_power_on(struct drm_panel *panel)
> +{
> +	if (panel && panel->funcs && panel->funcs->power_on)
> +		return panel->funcs->power_on(panel);
> +
> +	return panel ? -ENOSYS : -EINVAL;
> +}
> +
> +static inline int drm_panel_power_off(struct drm_panel *panel)
> +{
> +	if (panel && panel->funcs && panel->funcs->power_off)
> +		return panel->funcs->power_off(panel);
> +
> +	return panel ? -ENOSYS : -EINVAL;
> +}
> +
> +static inline int drm_panel_backlight_on(struct drm_panel *panel)
> +{
> +	if (panel && panel->funcs && panel->funcs->backlight_on)
> +		return panel->funcs->backlight_on(panel);
> +
> +	return panel ? -ENOSYS : -EINVAL;
> +}
> +
> +static inline int drm_panel_backlight_off(struct drm_panel *panel)
> +{
> +	if (panel && panel->funcs && panel->funcs->backlight_off)
> +		return panel->funcs->backlight_off(panel);
> +
> +	return panel ? -ENOSYS : -EINVAL;
> +}
> +
> +static inline int drm_panel_get_info(struct drm_panel *panel,
> +				struct drm_connector *connector)
> +{
> +	if (connector && panel && panel->funcs && panel->funcs->get_info)
> +		return panel->funcs->get_info(panel, connector);
> +
> +	return panel ? -ENOSYS : -EINVAL;
> +}
> +
>  static inline int drm_panel_get_modes(struct drm_panel *panel)
>  {
>  	if (panel && panel->funcs && panel->funcs->get_modes)
diff mbox

Patch

diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 13ff44b..c729f6d 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -73,6 +73,12 @@  struct drm_panel_funcs {
 	int (*get_modes)(struct drm_panel *panel);
 	int (*get_timings)(struct drm_panel *panel, unsigned int num_timings,
 			   struct display_timing *timings);
+	int (*power_on)(struct drm_panel *panel);
+	int (*power_off)(struct drm_panel *panel);
+	int (*backlight_on)(struct drm_panel *panel);
+	int (*backlight_off)(struct drm_panel *panel);
+	int (*get_info)(struct drm_panel *panel,
+				struct drm_connector *connector);
 };
 
 struct drm_panel {
@@ -117,6 +123,47 @@  static inline int drm_panel_enable(struct drm_panel *panel)
 	return panel ? -ENOSYS : -EINVAL;
 }
 
+static inline int drm_panel_power_on(struct drm_panel *panel)
+{
+	if (panel && panel->funcs && panel->funcs->power_on)
+		return panel->funcs->power_on(panel);
+
+	return panel ? -ENOSYS : -EINVAL;
+}
+
+static inline int drm_panel_power_off(struct drm_panel *panel)
+{
+	if (panel && panel->funcs && panel->funcs->power_off)
+		return panel->funcs->power_off(panel);
+
+	return panel ? -ENOSYS : -EINVAL;
+}
+
+static inline int drm_panel_backlight_on(struct drm_panel *panel)
+{
+	if (panel && panel->funcs && panel->funcs->backlight_on)
+		return panel->funcs->backlight_on(panel);
+
+	return panel ? -ENOSYS : -EINVAL;
+}
+
+static inline int drm_panel_backlight_off(struct drm_panel *panel)
+{
+	if (panel && panel->funcs && panel->funcs->backlight_off)
+		return panel->funcs->backlight_off(panel);
+
+	return panel ? -ENOSYS : -EINVAL;
+}
+
+static inline int drm_panel_get_info(struct drm_panel *panel,
+				struct drm_connector *connector)
+{
+	if (connector && panel && panel->funcs && panel->funcs->get_info)
+		return panel->funcs->get_info(panel, connector);
+
+	return panel ? -ENOSYS : -EINVAL;
+}
+
 static inline int drm_panel_get_modes(struct drm_panel *panel)
 {
 	if (panel && panel->funcs && panel->funcs->get_modes)