[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKMK7uGUoJi_3Wo6j-3PO8CUn6GrewhCgVtJKb5LYBTmDex5hQ@mail.gmail.com>
Date: Wed, 17 Jan 2018 22:24:43 +0100
From: Daniel Vetter <daniel@...ll.ch>
To: Daniel Thompson <daniel.thompson@...aro.org>
Cc: Meghana Madhyastha <meghana.madhyastha@...il.com>,
Lee Jones <lee.jones@...aro.org>,
Jingoo Han <jingoohan1@...il.com>,
Thierry Reding <thierry.reding@...il.com>,
Noralf Trønnes <noralf@...nnes.org>,
Tomi Valkeinen <tomi.valkeinen@...com>,
Daniel Vetter <daniel.vetter@...el.com>,
Sean Paul <seanpaul@...omium.org>,
dri-devel <dri-devel@...ts.freedesktop.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v16 01/10] video: backlight: Add helpers to enable and
disable backlight
On Wed, Jan 17, 2018 at 6:00 PM, Daniel Thompson
<daniel.thompson@...aro.org> wrote:
> 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 <meghana.madhyastha@...il.com>
>
>
> 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
I think also adjusting the fb_blank bits in these new helpers is a
reasonable thing to do. Maybe with add a huge TODO comment that this
is all a bit sad ...
-Daniel
> 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);
>>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Powered by blists - more mailing lists