xref: /linux/include/drm/drm_privacy_screen_consumer.h (revision a4eb44a6435d6d8f9e642407a4a06f65eb90ca04)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright (C) 2020 Red Hat, Inc.
4  *
5  * Authors:
6  * Hans de Goede <hdegoede@redhat.com>
7  */
8 
9 #ifndef __DRM_PRIVACY_SCREEN_CONSUMER_H__
10 #define __DRM_PRIVACY_SCREEN_CONSUMER_H__
11 
12 #include <linux/device.h>
13 #include <drm/drm_connector.h>
14 
15 struct drm_privacy_screen;
16 
17 #if IS_ENABLED(CONFIG_DRM_PRIVACY_SCREEN)
18 struct drm_privacy_screen *drm_privacy_screen_get(struct device *dev,
19 						  const char *con_id);
20 void drm_privacy_screen_put(struct drm_privacy_screen *priv);
21 
22 int drm_privacy_screen_set_sw_state(struct drm_privacy_screen *priv,
23 				    enum drm_privacy_screen_status sw_state);
24 void drm_privacy_screen_get_state(struct drm_privacy_screen *priv,
25 				  enum drm_privacy_screen_status *sw_state_ret,
26 				  enum drm_privacy_screen_status *hw_state_ret);
27 
28 int drm_privacy_screen_register_notifier(struct drm_privacy_screen *priv,
29 					 struct notifier_block *nb);
30 int drm_privacy_screen_unregister_notifier(struct drm_privacy_screen *priv,
31 					   struct notifier_block *nb);
32 #else
33 static inline struct drm_privacy_screen *drm_privacy_screen_get(struct device *dev,
34 								const char *con_id)
35 {
36 	return ERR_PTR(-ENODEV);
37 }
38 static inline void drm_privacy_screen_put(struct drm_privacy_screen *priv)
39 {
40 }
41 static inline int drm_privacy_screen_set_sw_state(struct drm_privacy_screen *priv,
42 						  enum drm_privacy_screen_status sw_state)
43 {
44 	return -ENODEV;
45 }
46 static inline void drm_privacy_screen_get_state(struct drm_privacy_screen *priv,
47 						enum drm_privacy_screen_status *sw_state_ret,
48 						enum drm_privacy_screen_status *hw_state_ret)
49 {
50 	*sw_state_ret = PRIVACY_SCREEN_DISABLED;
51 	*hw_state_ret = PRIVACY_SCREEN_DISABLED;
52 }
53 static inline int drm_privacy_screen_register_notifier(struct drm_privacy_screen *priv,
54 						       struct notifier_block *nb)
55 {
56 	return -ENODEV;
57 }
58 static inline int drm_privacy_screen_unregister_notifier(struct drm_privacy_screen *priv,
59 							 struct notifier_block *nb)
60 {
61 	return -ENODEV;
62 }
63 #endif
64 
65 #endif
66