diff options
author | Hans de Goede | 2021-10-05 22:23:16 +0200 |
---|---|---|
committer | Hans de Goede | 2021-10-14 13:12:25 +0200 |
commit | 8a12b170558aabb31cc98fda0da6a56b518cadaa (patch) | |
tree | 09f3df415d74132ec03a82e4b15c1e3962697553 /include/drm/drm_privacy_screen_consumer.h | |
parent | befe5404a00b3b1547c944738df4a9229909bdc9 (diff) |
drm/privacy-screen: Add notifier support (v2)
Add support for privacy-screen consumers to register a notifier to
be notified of external (e.g. done by the hw itself on a hotkey press)
state changes.
Changes in v2:
- Drop WARN_ON(mutex_is_locked(&priv->lock)) check in
drm_privacy_screen_call_notifier_chain() it may be locked by
another thread, which would lead to a false-positive triggering
of the check
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211005202322.700909-5-hdegoede@redhat.com
Diffstat (limited to 'include/drm/drm_privacy_screen_consumer.h')
-rw-r--r-- | include/drm/drm_privacy_screen_consumer.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/drm/drm_privacy_screen_consumer.h b/include/drm/drm_privacy_screen_consumer.h index 0cbd23b0453d..7f66a90d15b7 100644 --- a/include/drm/drm_privacy_screen_consumer.h +++ b/include/drm/drm_privacy_screen_consumer.h @@ -24,6 +24,11 @@ int drm_privacy_screen_set_sw_state(struct drm_privacy_screen *priv, void drm_privacy_screen_get_state(struct drm_privacy_screen *priv, enum drm_privacy_screen_status *sw_state_ret, enum drm_privacy_screen_status *hw_state_ret); + +int drm_privacy_screen_register_notifier(struct drm_privacy_screen *priv, + struct notifier_block *nb); +int drm_privacy_screen_unregister_notifier(struct drm_privacy_screen *priv, + struct notifier_block *nb); #else static inline struct drm_privacy_screen *drm_privacy_screen_get(struct device *dev, const char *con_id) @@ -45,6 +50,16 @@ static inline void drm_privacy_screen_get_state(struct drm_privacy_screen *priv, *sw_state_ret = PRIVACY_SCREEN_DISABLED; *hw_state_ret = PRIVACY_SCREEN_DISABLED; } +static inline int drm_privacy_screen_register_notifier(struct drm_privacy_screen *priv, + struct notifier_block *nb) +{ + return -ENODEV; +} +static inline int drm_privacy_screen_unregister_notifier(struct drm_privacy_screen *priv, + struct notifier_block *nb) +{ + return -ENODEV; +} #endif #endif |