From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754559AbeAQRAg (ORCPT ); Wed, 17 Jan 2018 12:00:36 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:37933 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754480AbeAQRAc (ORCPT ); Wed, 17 Jan 2018 12:00:32 -0500 X-Google-Smtp-Source: ACJfBotjKtwnFq8iijYRIyOROjhoA/jG+eJ6r9hU3CH63G0IPUWixdfi55rZxKdMRG+Gw9WpFRBHPg== Subject: Re: [PATCH v16 01/10] video: backlight: Add helpers to enable and disable backlight To: Meghana Madhyastha , Lee Jones , Jingoo Han , Thierry Reding , =?UTF-8?Q?Noralf_Tr=c3=b8nnes?= , Tomi Valkeinen , Daniel Vetter , Sean Paul , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <0ef2305477e69efdf61a378079fb7404a40c909f.1516098341.git.meghana.madhyastha@gmail.com> From: Daniel Thompson Message-ID: <84821d63-edc4-9a9a-db54-a180bf5fe9f6@linaro.org> Date: Wed, 17 Jan 2018 17:00:27 +0000 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <0ef2305477e69efdf61a378079fb7404a40c909f.1516098341.git.meghana.madhyastha@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16/01/18 10:31, 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 To be clear I don't disagree with anthing Daniel V. said about the horribly confused (and confusing) power states for backlight. Nevertheless I don't recall seeing any response (positive or negative) to this post from v13: https://www.spinics.net/lists/dri-devel/msg154459.html Daniel. > --- > 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); >