2019-06-03 13:44:51 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2017-02-05 15:54:56 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Chris Zhong <zyw@rock-chips.com>
|
|
|
|
* Copyright (C) 2016 ROCKCHIP, Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _CDN_DP_CORE_H
|
|
|
|
#define _CDN_DP_CORE_H
|
|
|
|
|
2022-04-21 15:31:02 +08:00
|
|
|
#include <drm/display/drm_dp_helper.h>
|
2017-02-05 15:54:56 +08:00
|
|
|
#include <drm/drm_panel.h>
|
2019-01-18 05:03:34 +08:00
|
|
|
#include <drm/drm_probe_helper.h>
|
2022-01-15 07:02:08 +08:00
|
|
|
#include <sound/hdmi-codec.h>
|
2019-07-16 14:42:19 +08:00
|
|
|
|
2017-02-05 15:54:56 +08:00
|
|
|
#include "rockchip_drm_drv.h"
|
|
|
|
|
|
|
|
#define MAX_PHY 2
|
|
|
|
|
|
|
|
enum audio_format {
|
|
|
|
AFMT_I2S = 0,
|
|
|
|
AFMT_SPDIF = 1,
|
|
|
|
AFMT_UNUSED,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct audio_info {
|
|
|
|
enum audio_format format;
|
|
|
|
int sample_rate;
|
|
|
|
int channels;
|
|
|
|
int sample_width;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum vic_pxl_encoding_format {
|
|
|
|
PXL_RGB = 0x1,
|
|
|
|
YCBCR_4_4_4 = 0x2,
|
|
|
|
YCBCR_4_2_2 = 0x4,
|
|
|
|
YCBCR_4_2_0 = 0x8,
|
|
|
|
Y_ONLY = 0x10,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct video_info {
|
|
|
|
bool h_sync_polarity;
|
|
|
|
bool v_sync_polarity;
|
|
|
|
bool interlaced;
|
|
|
|
int color_depth;
|
|
|
|
enum vic_pxl_encoding_format color_fmt;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cdn_firmware_header {
|
|
|
|
u32 size_bytes; /* size of the entire header+image(s) in bytes */
|
|
|
|
u32 header_size; /* size of just the header in bytes */
|
|
|
|
u32 iram_size; /* size of iram */
|
|
|
|
u32 dram_size; /* size of dram */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cdn_dp_port {
|
|
|
|
struct cdn_dp_device *dp;
|
|
|
|
struct notifier_block event_nb;
|
|
|
|
struct extcon_dev *extcon;
|
|
|
|
struct phy *phy;
|
|
|
|
u8 lanes;
|
|
|
|
bool phy_enabled;
|
|
|
|
u8 id;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cdn_dp_device {
|
|
|
|
struct device *dev;
|
|
|
|
struct drm_device *drm_dev;
|
|
|
|
struct drm_connector connector;
|
2022-04-22 15:28:19 +08:00
|
|
|
struct rockchip_encoder encoder;
|
2017-02-05 15:54:56 +08:00
|
|
|
struct drm_display_mode mode;
|
|
|
|
struct platform_device *audio_pdev;
|
|
|
|
struct work_struct event_work;
|
|
|
|
struct edid *edid;
|
|
|
|
|
|
|
|
struct mutex lock;
|
|
|
|
bool connected;
|
|
|
|
bool active;
|
2017-02-05 15:54:58 +08:00
|
|
|
bool suspended;
|
2017-02-05 15:54:56 +08:00
|
|
|
|
|
|
|
const struct firmware *fw; /* cdn dp firmware */
|
|
|
|
unsigned int fw_version; /* cdn fw version */
|
|
|
|
bool fw_loaded;
|
|
|
|
|
|
|
|
void __iomem *regs;
|
|
|
|
struct regmap *grf;
|
|
|
|
struct clk *core_clk;
|
|
|
|
struct clk *pclk;
|
|
|
|
struct clk *spdif_clk;
|
|
|
|
struct clk *grf_clk;
|
|
|
|
struct reset_control *spdif_rst;
|
|
|
|
struct reset_control *dptx_rst;
|
|
|
|
struct reset_control *apb_rst;
|
|
|
|
struct reset_control *core_rst;
|
|
|
|
struct audio_info audio_info;
|
|
|
|
struct video_info video_info;
|
|
|
|
struct cdn_dp_port *port[MAX_PHY];
|
|
|
|
u8 ports;
|
2019-10-21 22:34:36 +08:00
|
|
|
u8 max_lanes;
|
2020-01-09 15:31:29 +08:00
|
|
|
unsigned int max_rate;
|
2017-02-05 15:54:56 +08:00
|
|
|
u8 lanes;
|
2017-02-05 15:55:01 +08:00
|
|
|
int active_port;
|
2017-02-05 15:54:56 +08:00
|
|
|
|
|
|
|
u8 dpcd[DP_RECEIVER_CAP_SIZE];
|
|
|
|
bool sink_has_audio;
|
2022-01-15 07:02:08 +08:00
|
|
|
|
|
|
|
hdmi_codec_plugged_cb plugged_cb;
|
|
|
|
struct device *codec_dev;
|
2017-02-05 15:54:56 +08:00
|
|
|
};
|
|
|
|
#endif /* _CDN_DP_CORE_H */
|