Re: [PATCH v18 01/10] video: backlight: Add helpers to enable and disable backlight

2018-01-23 Thread Noralf Trønnes


Den 23.01.2018 11.00, skrev Daniel Thompson:

On Mon, Jan 22, 2018 at 02:49:28PM +, Meghana Madhyastha wrote:

Add helper functions backlight_enable and backlight_disable to
enable/disable a backlight device. These helper functions can
then be used by different drm and tinydrm drivers to avoid
repetition of code and also to enforce a uniform and consistent
way to enable/disable a backlight device.

Signed-off-by: Meghana Madhyastha 
---
Acked-by: Daniel Thompson 
Reviewed-by: Noralf Trønnes 
Reviewed-by: Sean Paul

Just in case there's another spin...  the additional tags are normally
presented above the --- (otherwise they are unlikely to be copied into
the git history when they are applied).


Indeed, they should be part of the commit message.

Noralf.



Daniel.



  include/linux/backlight.h | 32 
  1 file changed, 32 insertions(+)

diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index af7003548..ace825e2c 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -130,6 +130,38 @@ static inline int backlight_update_status(struct 
backlight_device *bd)
return ret;
  }
  
+/**

+ * backlight_enable - Enable backlight
+ * @bd: the backlight device to enable
+ */
+static inline int backlight_enable(struct backlight_device *bd)
+{
+   if (!bd)
+   return 0;
+
+   bd->props.power = FB_BLANK_UNBLANK;
+   bd->props.fb_blank = FB_BLANK_UNBLANK;
+   bd->props.state &= ~BL_CORE_FBBLANK;
+
+   return backlight_update_status(bd);
+}
+
+/**
+ * backlight_disable - Disable backlight
+ * @bd: the backlight device to disable
+ */
+static inline int backlight_disable(struct backlight_device *bd)
+{
+   if (!bd)
+   return 0;
+
+   bd->props.power = FB_BLANK_POWERDOWN;
+   bd->props.fb_blank = FB_BLANK_POWERDOWN;
+   bd->props.state |= BL_CORE_FBBLANK;
+
+   return backlight_update_status(bd);
+}
+
  extern struct backlight_device *backlight_device_register(const char *name,
struct device *dev, void *devdata, const struct backlight_ops *ops,
const struct backlight_properties *props);
--
2.11.0





Re: [PATCH v18 01/10] video: backlight: Add helpers to enable and disable backlight

2018-01-23 Thread Noralf Trønnes


Den 23.01.2018 11.00, skrev Daniel Thompson:

On Mon, Jan 22, 2018 at 02:49:28PM +, Meghana Madhyastha wrote:

Add helper functions backlight_enable and backlight_disable to
enable/disable a backlight device. These helper functions can
then be used by different drm and tinydrm drivers to avoid
repetition of code and also to enforce a uniform and consistent
way to enable/disable a backlight device.

Signed-off-by: Meghana Madhyastha 
---
Acked-by: Daniel Thompson 
Reviewed-by: Noralf Trønnes 
Reviewed-by: Sean Paul

Just in case there's another spin...  the additional tags are normally
presented above the --- (otherwise they are unlikely to be copied into
the git history when they are applied).


Indeed, they should be part of the commit message.

Noralf.



Daniel.



  include/linux/backlight.h | 32 
  1 file changed, 32 insertions(+)

diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index af7003548..ace825e2c 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -130,6 +130,38 @@ static inline int backlight_update_status(struct 
backlight_device *bd)
return ret;
  }
  
+/**

+ * backlight_enable - Enable backlight
+ * @bd: the backlight device to enable
+ */
+static inline int backlight_enable(struct backlight_device *bd)
+{
+   if (!bd)
+   return 0;
+
+   bd->props.power = FB_BLANK_UNBLANK;
+   bd->props.fb_blank = FB_BLANK_UNBLANK;
+   bd->props.state &= ~BL_CORE_FBBLANK;
+
+   return backlight_update_status(bd);
+}
+
+/**
+ * backlight_disable - Disable backlight
+ * @bd: the backlight device to disable
+ */
+static inline int backlight_disable(struct backlight_device *bd)
+{
+   if (!bd)
+   return 0;
+
+   bd->props.power = FB_BLANK_POWERDOWN;
+   bd->props.fb_blank = FB_BLANK_POWERDOWN;
+   bd->props.state |= BL_CORE_FBBLANK;
+
+   return backlight_update_status(bd);
+}
+
  extern struct backlight_device *backlight_device_register(const char *name,
struct device *dev, void *devdata, const struct backlight_ops *ops,
const struct backlight_properties *props);
--
2.11.0





Re: [PATCH v18 01/10] video: backlight: Add helpers to enable and disable backlight

2018-01-23 Thread Daniel Thompson
On Mon, Jan 22, 2018 at 02:49:28PM +, Meghana Madhyastha wrote:
> Add helper functions backlight_enable and backlight_disable to
> enable/disable a backlight device. These helper functions can
> then be used by different drm and tinydrm drivers to avoid
> repetition of code and also to enforce a uniform and consistent
> way to enable/disable a backlight device.
> 
> Signed-off-by: Meghana Madhyastha 
> ---
> Acked-by: Daniel Thompson 
> Reviewed-by: Noralf Trønnes 
> Reviewed-by: Sean Paul

Just in case there's another spin...  the additional tags are normally 
presented above the --- (otherwise they are unlikely to be copied into 
the git history when they are applied).


Daniel.


> 
>  include/linux/backlight.h | 32 
>  1 file changed, 32 insertions(+)
> 
> diff --git a/include/linux/backlight.h b/include/linux/backlight.h
> index af7003548..ace825e2c 100644
> --- a/include/linux/backlight.h
> +++ b/include/linux/backlight.h
> @@ -130,6 +130,38 @@ static inline int backlight_update_status(struct 
> backlight_device *bd)
>   return ret;
>  }
>  
> +/**
> + * backlight_enable - Enable backlight
> + * @bd: the backlight device to enable
> + */
> +static inline int backlight_enable(struct backlight_device *bd)
> +{
> + if (!bd)
> + return 0;
> +
> + bd->props.power = FB_BLANK_UNBLANK;
> + bd->props.fb_blank = FB_BLANK_UNBLANK;
> + bd->props.state &= ~BL_CORE_FBBLANK;
> +
> + return backlight_update_status(bd);
> +}
> +
> +/**
> + * backlight_disable - Disable backlight
> + * @bd: the backlight device to disable
> + */
> +static inline int backlight_disable(struct backlight_device *bd)
> +{
> + if (!bd)
> + return 0;
> +
> + bd->props.power = FB_BLANK_POWERDOWN;
> + bd->props.fb_blank = FB_BLANK_POWERDOWN;
> + bd->props.state |= BL_CORE_FBBLANK;
> +
> + return backlight_update_status(bd);
> +}
> +
>  extern struct backlight_device *backlight_device_register(const char *name,
>   struct device *dev, void *devdata, const struct backlight_ops *ops,
>   const struct backlight_properties *props);
> -- 
> 2.11.0
> 


Re: [PATCH v18 01/10] video: backlight: Add helpers to enable and disable backlight

2018-01-23 Thread Daniel Thompson
On Mon, Jan 22, 2018 at 02:49:28PM +, Meghana Madhyastha wrote:
> Add helper functions backlight_enable and backlight_disable to
> enable/disable a backlight device. These helper functions can
> then be used by different drm and tinydrm drivers to avoid
> repetition of code and also to enforce a uniform and consistent
> way to enable/disable a backlight device.
> 
> Signed-off-by: Meghana Madhyastha 
> ---
> Acked-by: Daniel Thompson 
> Reviewed-by: Noralf Trønnes 
> Reviewed-by: Sean Paul

Just in case there's another spin...  the additional tags are normally 
presented above the --- (otherwise they are unlikely to be copied into 
the git history when they are applied).


Daniel.


> 
>  include/linux/backlight.h | 32 
>  1 file changed, 32 insertions(+)
> 
> diff --git a/include/linux/backlight.h b/include/linux/backlight.h
> index af7003548..ace825e2c 100644
> --- a/include/linux/backlight.h
> +++ b/include/linux/backlight.h
> @@ -130,6 +130,38 @@ static inline int backlight_update_status(struct 
> backlight_device *bd)
>   return ret;
>  }
>  
> +/**
> + * backlight_enable - Enable backlight
> + * @bd: the backlight device to enable
> + */
> +static inline int backlight_enable(struct backlight_device *bd)
> +{
> + if (!bd)
> + return 0;
> +
> + bd->props.power = FB_BLANK_UNBLANK;
> + bd->props.fb_blank = FB_BLANK_UNBLANK;
> + bd->props.state &= ~BL_CORE_FBBLANK;
> +
> + return backlight_update_status(bd);
> +}
> +
> +/**
> + * backlight_disable - Disable backlight
> + * @bd: the backlight device to disable
> + */
> +static inline int backlight_disable(struct backlight_device *bd)
> +{
> + if (!bd)
> + return 0;
> +
> + bd->props.power = FB_BLANK_POWERDOWN;
> + bd->props.fb_blank = FB_BLANK_POWERDOWN;
> + bd->props.state |= BL_CORE_FBBLANK;
> +
> + return backlight_update_status(bd);
> +}
> +
>  extern struct backlight_device *backlight_device_register(const char *name,
>   struct device *dev, void *devdata, const struct backlight_ops *ops,
>   const struct backlight_properties *props);
> -- 
> 2.11.0
>