2020-08-27 14:16:55 -07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _DP_PANEL_H_
|
|
|
|
#define _DP_PANEL_H_
|
|
|
|
|
2025-05-18 14:21:44 +03:00
|
|
|
#include <drm/drm_modes.h>
|
2020-08-27 14:16:55 -07:00
|
|
|
#include <drm/msm_drm.h>
|
|
|
|
|
|
|
|
#include "dp_aux.h"
|
|
|
|
#include "dp_link.h"
|
|
|
|
|
|
|
|
struct edid;
|
|
|
|
|
2024-10-29 22:28:24 +02:00
|
|
|
struct msm_dp_display_mode {
|
2020-08-27 14:16:55 -07:00
|
|
|
struct drm_display_mode drm_mode;
|
|
|
|
u32 bpp;
|
|
|
|
u32 h_active_low;
|
|
|
|
u32 v_active_low;
|
2024-02-22 11:39:52 -08:00
|
|
|
bool out_fmt_is_yuv_420;
|
2020-08-27 14:16:55 -07:00
|
|
|
};
|
|
|
|
|
2024-10-29 22:28:24 +02:00
|
|
|
struct msm_dp_panel_psr {
|
2023-03-02 22:03:12 +05:30
|
|
|
u8 version;
|
|
|
|
u8 capabilities;
|
|
|
|
};
|
|
|
|
|
2024-10-29 22:28:24 +02:00
|
|
|
struct msm_dp_panel {
|
2020-08-27 14:16:55 -07:00
|
|
|
/* dpcd raw data */
|
2023-08-29 11:47:26 -07:00
|
|
|
u8 dpcd[DP_RECEIVER_CAP_SIZE];
|
2023-09-04 01:24:32 +03:00
|
|
|
u8 downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
|
2020-08-27 14:16:55 -07:00
|
|
|
|
2024-10-29 22:28:24 +02:00
|
|
|
struct msm_dp_link_info link_info;
|
2024-05-14 15:55:14 +03:00
|
|
|
const struct drm_edid *drm_edid;
|
2020-08-27 14:16:55 -07:00
|
|
|
struct drm_connector *connector;
|
2024-10-29 22:28:24 +02:00
|
|
|
struct msm_dp_display_mode msm_dp_mode;
|
|
|
|
struct msm_dp_panel_psr psr_cap;
|
2020-08-27 14:16:55 -07:00
|
|
|
bool video_test;
|
2024-02-22 11:39:53 -08:00
|
|
|
bool vsc_sdp_supported;
|
2025-05-18 14:21:41 +03:00
|
|
|
u32 hw_revision;
|
2020-08-27 14:16:55 -07:00
|
|
|
|
|
|
|
u32 max_dp_lanes;
|
2022-12-27 09:45:03 -08:00
|
|
|
u32 max_dp_link_rate;
|
2020-08-27 14:16:55 -07:00
|
|
|
|
|
|
|
u32 max_bw_code;
|
|
|
|
};
|
|
|
|
|
2024-10-29 22:28:24 +02:00
|
|
|
int msm_dp_panel_init_panel_info(struct msm_dp_panel *msm_dp_panel);
|
|
|
|
int msm_dp_panel_deinit(struct msm_dp_panel *msm_dp_panel);
|
2025-05-18 14:21:44 +03:00
|
|
|
int msm_dp_panel_timing_cfg(struct msm_dp_panel *msm_dp_panel, bool wide_bus_en);
|
2024-10-29 22:28:24 +02:00
|
|
|
int msm_dp_panel_read_sink_caps(struct msm_dp_panel *msm_dp_panel,
|
2020-08-27 14:16:55 -07:00
|
|
|
struct drm_connector *connector);
|
2024-10-29 22:28:24 +02:00
|
|
|
u32 msm_dp_panel_get_mode_bpp(struct msm_dp_panel *msm_dp_panel, u32 mode_max_bpp,
|
2020-08-27 14:16:55 -07:00
|
|
|
u32 mode_pclk_khz);
|
2024-10-29 22:28:24 +02:00
|
|
|
int msm_dp_panel_get_modes(struct msm_dp_panel *msm_dp_panel,
|
2022-03-31 01:30:05 +03:00
|
|
|
struct drm_connector *connector);
|
2024-10-29 22:28:24 +02:00
|
|
|
void msm_dp_panel_handle_sink_request(struct msm_dp_panel *msm_dp_panel);
|
|
|
|
void msm_dp_panel_tpg_config(struct msm_dp_panel *msm_dp_panel, bool enable);
|
2020-08-27 14:16:55 -07:00
|
|
|
|
2025-05-18 14:21:39 +03:00
|
|
|
void msm_dp_panel_clear_dsc_dto(struct msm_dp_panel *msm_dp_panel);
|
|
|
|
|
|
|
|
void msm_dp_panel_enable_vsc_sdp(struct msm_dp_panel *msm_dp_panel, struct dp_sdp *vsc_sdp);
|
|
|
|
void msm_dp_panel_disable_vsc_sdp(struct msm_dp_panel *msm_dp_panel);
|
|
|
|
|
2020-08-27 14:16:55 -07:00
|
|
|
/**
|
|
|
|
* is_link_rate_valid() - validates the link rate
|
|
|
|
* @lane_rate: link rate requested by the sink
|
|
|
|
*
|
|
|
|
* Returns true if the requested link rate is supported.
|
|
|
|
*/
|
|
|
|
static inline bool is_link_rate_valid(u32 bw_code)
|
|
|
|
{
|
|
|
|
return (bw_code == DP_LINK_BW_1_62 ||
|
|
|
|
bw_code == DP_LINK_BW_2_7 ||
|
|
|
|
bw_code == DP_LINK_BW_5_4 ||
|
|
|
|
bw_code == DP_LINK_BW_8_1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-10-29 22:28:24 +02:00
|
|
|
* msm_dp_link_is_lane_count_valid() - validates the lane count
|
2020-08-27 14:16:55 -07:00
|
|
|
* @lane_count: lane count requested by the sink
|
|
|
|
*
|
|
|
|
* Returns true if the requested lane count is supported.
|
|
|
|
*/
|
|
|
|
static inline bool is_lane_count_valid(u32 lane_count)
|
|
|
|
{
|
|
|
|
return (lane_count == 1 ||
|
|
|
|
lane_count == 2 ||
|
|
|
|
lane_count == 4);
|
|
|
|
}
|
|
|
|
|
2024-12-16 00:44:09 +02:00
|
|
|
struct msm_dp_panel *msm_dp_panel_get(struct device *dev, struct drm_dp_aux *aux,
|
2025-05-18 14:21:44 +03:00
|
|
|
struct msm_dp_link *link,
|
|
|
|
void __iomem *link_base,
|
|
|
|
void __iomem *p0_base);
|
2024-10-29 22:28:24 +02:00
|
|
|
void msm_dp_panel_put(struct msm_dp_panel *msm_dp_panel);
|
2020-08-27 14:16:55 -07:00
|
|
|
#endif /* _DP_PANEL_H_ */
|