1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2019 Intel Corporation
4  */
5 
6 #ifndef __INTEL_PANEL_H__
7 #define __INTEL_PANEL_H__
8 
9 #include <linux/types.h>
10 
11 #include "intel_display.h"
12 
13 struct drm_connector;
14 struct drm_connector_state;
15 struct drm_display_mode;
16 struct intel_connector;
17 struct intel_crtc;
18 struct intel_crtc_state;
19 struct intel_encoder;
20 struct intel_panel;
21 
22 int intel_panel_init(struct intel_panel *panel,
23 		     struct drm_display_mode *fixed_mode,
24 		     struct drm_display_mode *downclock_mode);
25 void intel_panel_fini(struct intel_panel *panel);
26 void intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
27 			    struct drm_display_mode *adjusted_mode);
28 int intel_pch_panel_fitting(struct intel_crtc_state *crtc_state,
29 			    const struct drm_connector_state *conn_state);
30 int intel_gmch_panel_fitting(struct intel_crtc_state *crtc_state,
31 			     const struct drm_connector_state *conn_state);
32 void intel_panel_set_backlight_acpi(const struct drm_connector_state *conn_state,
33 				    u32 level, u32 max);
34 int intel_panel_setup_backlight(struct drm_connector *connector,
35 				enum pipe pipe);
36 void intel_panel_enable_backlight(const struct intel_crtc_state *crtc_state,
37 				  const struct drm_connector_state *conn_state);
38 void intel_panel_update_backlight(struct intel_atomic_state *state,
39 				  struct intel_encoder *encoder,
40 				  const struct intel_crtc_state *crtc_state,
41 				  const struct drm_connector_state *conn_state);
42 void intel_panel_disable_backlight(const struct drm_connector_state *old_conn_state);
43 struct drm_display_mode *
44 intel_panel_edid_downclock_mode(struct intel_connector *connector,
45 				const struct drm_display_mode *fixed_mode);
46 struct drm_display_mode *
47 intel_panel_edid_fixed_mode(struct intel_connector *connector);
48 struct drm_display_mode *
49 intel_panel_vbt_fixed_mode(struct intel_connector *connector);
50 
51 #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
52 int intel_backlight_device_register(struct intel_connector *connector);
53 void intel_backlight_device_unregister(struct intel_connector *connector);
54 #else /* CONFIG_BACKLIGHT_CLASS_DEVICE */
55 static inline int intel_backlight_device_register(struct intel_connector *connector)
56 {
57 	return 0;
58 }
59 static inline void intel_backlight_device_unregister(struct intel_connector *connector)
60 {
61 }
62 #endif /* CONFIG_BACKLIGHT_CLASS_DEVICE */
63 
64 #endif /* __INTEL_PANEL_H__ */
65