1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2021 Intel Corporation
4  */
5 
6 #ifndef __INTEL_BACKLIGHT_H__
7 #define __INTEL_BACKLIGHT_H__
8 
9 #include <linux/types.h>
10 
11 struct drm_connector_state;
12 struct intel_atomic_state;
13 struct intel_connector;
14 struct intel_crtc_state;
15 struct intel_encoder;
16 struct intel_panel;
17 enum pipe;
18 
19 void intel_backlight_init_funcs(struct intel_panel *panel);
20 int intel_backlight_setup(struct intel_connector *connector, enum pipe pipe);
21 void intel_backlight_destroy(struct intel_panel *panel);
22 
23 void intel_backlight_enable(const struct intel_crtc_state *crtc_state,
24 			    const struct drm_connector_state *conn_state);
25 void intel_backlight_update(struct intel_atomic_state *state,
26 			    struct intel_encoder *encoder,
27 			    const struct intel_crtc_state *crtc_state,
28 			    const struct drm_connector_state *conn_state);
29 void intel_backlight_disable(const struct drm_connector_state *old_conn_state);
30 
31 void intel_backlight_set_acpi(const struct drm_connector_state *conn_state,
32 			      u32 level, u32 max);
33 void intel_backlight_set_pwm_level(const struct drm_connector_state *conn_state,
34 				   u32 level);
35 u32 intel_backlight_invert_pwm_level(struct intel_connector *connector, u32 level);
36 u32 intel_backlight_level_to_pwm(struct intel_connector *connector, u32 level);
37 u32 intel_backlight_level_from_pwm(struct intel_connector *connector, u32 val);
38 
39 #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
40 int intel_backlight_device_register(struct intel_connector *connector);
41 void intel_backlight_device_unregister(struct intel_connector *connector);
42 #else /* CONFIG_BACKLIGHT_CLASS_DEVICE */
43 static inline int intel_backlight_device_register(struct intel_connector *connector)
44 {
45 	return 0;
46 }
47 static inline void intel_backlight_device_unregister(struct intel_connector *connector)
48 {
49 }
50 #endif /* CONFIG_BACKLIGHT_CLASS_DEVICE */
51 
52 #endif /* __INTEL_BACKLIGHT_H__ */
53