xref: /OK3568_Linux_fs/kernel/include/drm/bridge/analogix_dp.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Analogix DP (Display Port) Core interface driver.
4  *
5  * Copyright (C) 2015 Rockchip Electronics Co., Ltd.
6  */
7 #ifndef _ANALOGIX_DP_H_
8 #define _ANALOGIX_DP_H_
9 
10 #include <drm/drm_crtc.h>
11 #include <sound/hdmi-codec.h>
12 
13 struct analogix_dp_device;
14 
15 enum analogix_dp_devtype {
16 	EXYNOS_DP,
17 	RK3288_DP,
18 	RK3399_EDP,
19 	RK3568_EDP,
20 	RK3588_EDP,
21 };
22 
is_rockchip(enum analogix_dp_devtype type)23 static inline bool is_rockchip(enum analogix_dp_devtype type)
24 {
25 	switch (type) {
26 	case RK3288_DP:
27 	case RK3399_EDP:
28 	case RK3568_EDP:
29 	case RK3588_EDP:
30 		return true;
31 	default:
32 		return false;
33 	}
34 }
35 
36 struct analogix_dp_plat_data {
37 	enum analogix_dp_devtype dev_type;
38 	struct drm_panel *panel;
39 	struct drm_bridge *bridge;
40 	struct drm_encoder *encoder;
41 	struct drm_connector *connector;
42 	bool skip_connector;
43 	bool ssc;
44 
45 	bool split_mode;
46 
47 	/* split with other display interface */
48 	bool dual_connector_split;
49 	bool left_display;
50 
51 	struct analogix_dp_device *left;
52 	struct analogix_dp_device *right;
53 
54 	int (*power_on_start)(struct analogix_dp_plat_data *);
55 	int (*power_on_end)(struct analogix_dp_plat_data *);
56 	int (*power_off)(struct analogix_dp_plat_data *);
57 	int (*attach)(struct analogix_dp_plat_data *, struct drm_bridge *,
58 		      struct drm_connector *);
59 	void (*detach)(struct analogix_dp_plat_data *, struct drm_bridge *);
60 	int (*get_modes)(struct analogix_dp_plat_data *,
61 			 struct drm_connector *);
62 	void (*convert_to_split_mode)(struct drm_display_mode *);
63 	void (*convert_to_origin_mode)(struct drm_display_mode *);
64 };
65 
66 int analogix_dp_resume(struct analogix_dp_device *dp);
67 int analogix_dp_suspend(struct analogix_dp_device *dp);
68 int analogix_dp_runtime_resume(struct analogix_dp_device *dp);
69 int analogix_dp_runtime_suspend(struct analogix_dp_device *dp);
70 
71 struct analogix_dp_device *
72 analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data);
73 int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev);
74 void analogix_dp_unbind(struct analogix_dp_device *dp);
75 void analogix_dp_remove(struct analogix_dp_device *dp);
76 
77 int analogix_dp_start_crc(struct drm_connector *connector);
78 int analogix_dp_stop_crc(struct drm_connector *connector);
79 
80 int analogix_dp_audio_hw_params(struct analogix_dp_device *dp,
81 				struct hdmi_codec_daifmt *daifmt,
82 				struct hdmi_codec_params *params);
83 void analogix_dp_audio_shutdown(struct analogix_dp_device *dp);
84 int analogix_dp_audio_startup(struct analogix_dp_device *dp);
85 int analogix_dp_audio_get_eld(struct analogix_dp_device *dp,
86 			      u8 *buf, size_t len);
87 int analogix_dp_loader_protect(struct analogix_dp_device *dp);
88 void analogix_dp_disable(struct analogix_dp_device *dp);
89 
90 #endif /* _ANALOGIX_DP_H_ */
91