From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754911AbeASLE0 (ORCPT ); Fri, 19 Jan 2018 06:04:26 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35076 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753741AbeASLET (ORCPT ); Fri, 19 Jan 2018 06:04:19 -0500 X-Google-Smtp-Source: ACJfBovE+75xFa9oBxBchgIwYrxR+tXY1uROMjLtyxf7p0EdfVsL7bWR6nSsUGO3ch265/OiZR13lQ== Date: Fri, 19 Jan 2018 11:04:14 +0000 From: Daniel Thompson To: Meghana Madhyastha Cc: Lee Jones , 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: Re: [PATCH v17 01/10] video: backlight: Add helpers to enable and disable backlight Message-ID: <20180119110414.b6d7v3o35bts5hqp@oak.lan> References: <39b5bf0a02008a8072d910bdf8231c431e9ef504.1516358037.git.meghana.madhyastha@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <39b5bf0a02008a8072d910bdf8231c431e9ef504.1516358037.git.meghana.madhyastha@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 19, 2018 at 10:39:16AM +0000, 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 BTW Lee J. looks PRs and merges for the backlight tree, I'll leave it to Lee and whoevers-DRM-tree-this-would-naturally-land-in to decide the merge path. Daniel. > --- > changes in v17: > -set fb_blank along with clearing the BL_CORE_FBBLANK bit > > 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 >