Date: Wed, 13 Oct 2021 09:19:21 GMT From: Vladimir Kondratyev <wulf@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 9441d948aa3b - stable/13 - LinuxKPI: Implement backlight_enable and backlight_disable functions Message-ID: <202110130919.19D9JL5n057456@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=9441d948aa3bdf4a4d04c15131d385ae951cd9de commit 9441d948aa3bdf4a4d04c15131d385ae951cd9de Author: Vladimir Kondratyev <wulf@FreeBSD.org> AuthorDate: 2021-09-29 20:15:12 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> CommitDate: 2021-10-13 09:06:51 +0000 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 b52e36384091c5f80b06b79f5889492eac074426) --- .../linuxkpi/common/include/linux/backlight.h | 22 ++++++++++++++++++++-- sys/compat/linuxkpi/common/src/linux_pci.c | 2 ++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/backlight.h b/sys/compat/linuxkpi/common/include/linux/backlight.h index 1d2224811124..b3a07c4cdcaa 100644 --- a/sys/compat/linuxkpi/common/include/linux/backlight.h +++ b/sys/compat/linuxkpi/common/include/linux/backlight.h @@ -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_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index ae45df9c6514..b5bb87b5f2ae 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -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)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110130919.19D9JL5n057456>