Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751483AbeAPKcJ (ORCPT + 1 other); Tue, 16 Jan 2018 05:32:09 -0500 Received: from mail-it0-f65.google.com ([209.85.214.65]:40031 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751395AbeAPKcG (ORCPT ); Tue, 16 Jan 2018 05:32:06 -0500 X-Google-Smtp-Source: ACJfBov8n9CfaEP3Vk2iB2LfL2GPTa3qg2jkrmVT+R171chj2RwptNdMo+lBnEWEKkCzNu5R18/jdQ== Date: Tue, 16 Jan 2018 10:31:59 +0000 From: Meghana Madhyastha To: Lee Jones , Daniel Thompson , Jingoo Han , Thierry Reding , Noralf =?iso-8859-1?Q?Tr=F8nnes?= , Tomi Valkeinen , Daniel Vetter , Sean Paul , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v16 01/10] video: backlight: Add helpers to enable and disable backlight Message-ID: <0ef2305477e69efdf61a378079fb7404a40c909f.1516098341.git.meghana.madhyastha@gmail.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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 --- include/linux/backlight.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index af7003548..7b6a9a2a3 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -130,6 +130,36 @@ 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.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.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