mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
LinuxKPI: Implement backlight_enable and backlight_disable functions
For now, disable backlight if brightness level is set to 0.
In the future we may implement separate knob in backlight(8).
Required by drm-kmod v5.6
Reviewed by: hselasky, manu
Differential revision: https://reviews.freebsd.org/D32165
(cherry picked from commit b52e363840)
This commit is contained in:
parent
f2a3116ab4
commit
9441d948aa
2 changed files with 22 additions and 2 deletions
|
|
@ -79,10 +79,10 @@ void linux_backlight_device_unregister(struct backlight_device *bd);
|
|||
linux_backlight_device_register(name, dev, data, ops, props)
|
||||
#define backlight_device_unregister(bd) linux_backlight_device_unregister(bd)
|
||||
|
||||
static inline void
|
||||
static inline int
|
||||
backlight_update_status(struct backlight_device *bd)
|
||||
{
|
||||
bd->ops->update_status(bd);
|
||||
return (bd->ops->update_status(bd));
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
@ -91,4 +91,22 @@ backlight_force_update(struct backlight_device *bd, int reason)
|
|||
bd->props.brightness = bd->ops->get_brightness(bd);
|
||||
}
|
||||
|
||||
static inline int
|
||||
backlight_enable(struct backlight_device *bd)
|
||||
{
|
||||
if (bd == NULL)
|
||||
return (0);
|
||||
bd->props.power = 0/* FB_BLANK_UNBLANK */;
|
||||
return (backlight_update_status(bd));
|
||||
}
|
||||
|
||||
static inline int
|
||||
backlight_disable(struct backlight_device *bd)
|
||||
{
|
||||
if (bd == NULL)
|
||||
return (0);
|
||||
bd->props.power = 4/* FB_BLANK_POWERDOWN */;
|
||||
return (backlight_update_status(bd));
|
||||
}
|
||||
|
||||
#endif /* _LINUX_BACKLIGHT_H_ */
|
||||
|
|
|
|||
|
|
@ -1159,6 +1159,8 @@ linux_backlight_update_status(device_t dev, struct backlight_props *props)
|
|||
|
||||
pdev->dev.bd->props.brightness = pdev->dev.bd->props.max_brightness *
|
||||
props->brightness / 100;
|
||||
pdev->dev.bd->props.power = props->brightness == 0 ?
|
||||
4/* FB_BLANK_POWERDOWN */ : 0/* FB_BLANK_UNBLANK */;
|
||||
return (pdev->dev.bd->ops->update_status(pdev->dev.bd));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue