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