drm/rockchip: dw-dp: support user simulate aux for sideband message

Change-Id: I23be5e753ac650fe08afe42819ebe4e55a8cf708
Signed-off-by: Zhang Yubing <yubing.zhang@rock-chips.com>
This commit is contained in:
Zhang Yubing
2024-04-30 09:10:02 +08:00
committed by Tao Huang
parent 33c51f42c4
commit 82e9773633

View File

@@ -46,6 +46,7 @@
#include "rockchip_drm_drv.h"
#include "rockchip_drm_vop.h"
#include "rockchip_dp_mst_aux_client.h"
#define DPTX_VERSION_NUMBER 0x0000
#define DPTX_VERSION_TYPE 0x0004
@@ -496,6 +497,7 @@ struct dw_dp {
struct drm_dp_mst_topology_mgr mst_mgr;
struct dw_dp_mst_enc mst_enc[DPTX_MAX_STREAMS];
struct list_head mst_conn_list;
struct rockchip_dp_aux_client *aux_client;
struct drm_info_list *debugfs_files;
};
@@ -3123,6 +3125,17 @@ static ssize_t dw_dp_aux_transfer(struct drm_dp_aux *aux,
return ret;
}
static ssize_t dw_dp_sim_aux_transfer(struct drm_dp_aux *aux,
struct drm_dp_aux_msg *msg)
{
struct dw_dp *dp = container_of(aux, struct dw_dp, aux);
if (dp->aux_client && dp->aux_client->transfer)
return dp->aux_client->transfer(dp->aux_client, aux, msg);
else
return dw_dp_aux_transfer(aux, msg);
}
static enum drm_mode_status
dw_dp_bridge_mode_valid(struct drm_bridge *bridge,
const struct drm_display_info *info,
@@ -5353,6 +5366,17 @@ static const struct drm_encoder_funcs dw_dp_encoder_funcs = {
.late_register = dw_dp_encoder_late_register,
};
static void dw_dp_mst_poll_hpd_irq(void *data)
{
struct dw_dp *dp = data;
mutex_lock(&dp->irq_lock);
dp->hotplug.long_hpd = false;
mutex_unlock(&dp->irq_lock);
schedule_work(&dp->hpd_work);
}
static int dw_dp_bind(struct device *dev, struct device *master, void *data)
{
struct dw_dp *dp = dev_get_drvdata(dev);
@@ -5402,6 +5426,12 @@ static int dw_dp_bind(struct device *dev, struct device *master, void *data)
goto error_unregister_aux;
}
if (dp->aux_client) {
dp->aux_client->register_hpd_irq(dp->aux_client, dw_dp_mst_poll_hpd_irq, dp);
dp->aux_client->register_transfer(dp->aux_client, dw_dp_aux_transfer);
dp->aux.transfer = dw_dp_sim_aux_transfer;
}
pm_runtime_enable(dp->dev);
pm_runtime_get_sync(dp->dev);
@@ -5684,6 +5714,11 @@ static int dw_dp_probe(struct platform_device *pdev)
return ret;
}
dp->aux_client = rockchip_dp_get_aux_client(dev->of_node, "rockchip,mst-sim");
if (IS_ERR(dp->aux_client))
return dev_err_probe(dev, PTR_ERR(dp->aux_client),
"failed to get dp aux_client\n");
dp->bridge.of_node = dp->support_mst ? dp->mst_enc[0].port_node : dev->of_node;
dp->bridge.funcs = &dw_dp_bridge_funcs;
dp->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID |