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 enum drm_connector_status 27 intel_panel_detect(struct drm_connector *connector, bool force); 28 void intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode, 29 struct drm_display_mode *adjusted_mode); 30 int intel_pch_panel_fitting(struct intel_crtc_state *crtc_state, 31 const struct drm_connector_state *conn_state); 32 int intel_gmch_panel_fitting(struct intel_crtc_state *crtc_state, 33 const struct drm_connector_state *conn_state); 34 void intel_panel_set_backlight_acpi(const struct drm_connector_state *conn_state, 35 u32 level, u32 max); 36 int intel_panel_setup_backlight(struct drm_connector *connector, 37 enum pipe pipe); 38 void intel_panel_enable_backlight(const struct intel_crtc_state *crtc_state, 39 const struct drm_connector_state *conn_state); 40 void intel_panel_update_backlight(struct intel_atomic_state *state, 41 struct intel_encoder *encoder, 42 const struct intel_crtc_state *crtc_state, 43 const struct drm_connector_state *conn_state); 44 void intel_panel_disable_backlight(const struct drm_connector_state *old_conn_state); 45 struct drm_display_mode * 46 intel_panel_edid_downclock_mode(struct intel_connector *connector, 47 const struct drm_display_mode *fixed_mode); 48 struct drm_display_mode * 49 intel_panel_edid_fixed_mode(struct intel_connector *connector); 50 struct drm_display_mode * 51 intel_panel_vbt_fixed_mode(struct intel_connector *connector); 52 void intel_panel_set_pwm_level(const struct drm_connector_state *conn_state, u32 level); 53 u32 intel_panel_invert_pwm_level(struct intel_connector *connector, u32 level); 54 u32 intel_panel_backlight_level_to_pwm(struct intel_connector *connector, u32 level); 55 u32 intel_panel_backlight_level_from_pwm(struct intel_connector *connector, u32 val); 56 57 #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) 58 int intel_backlight_device_register(struct intel_connector *connector); 59 void intel_backlight_device_unregister(struct intel_connector *connector); 60 #else /* CONFIG_BACKLIGHT_CLASS_DEVICE */ 61 static inline int intel_backlight_device_register(struct intel_connector *connector) 62 { 63 return 0; 64 } 65 static inline void intel_backlight_device_unregister(struct intel_connector *connector) 66 { 67 } 68 #endif /* CONFIG_BACKLIGHT_CLASS_DEVICE */ 69 70 #endif /* __INTEL_PANEL_H__ */ 71