You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
459 lines
17 KiB
459 lines
17 KiB
/*
|
|
* Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2020. All rights reserved.
|
|
* Description : hdmirx unf-part
|
|
* Author : Hisilicon
|
|
* Create : 2019-11-20
|
|
*/
|
|
|
|
#include <pthread.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include "uapi_hdmirx.h"
|
|
#include "securec.h"
|
|
#include "mpi_hdmirx.h"
|
|
#include "mpi_hdmirx_ext.h"
|
|
#include "soc_errno.h"
|
|
|
|
static ext_hdmirx_video_format_convert g_hdmirx_vid_format[] = {
|
|
{ UAPI_FORMAT_YUV_SEMIPLANAR_422_VU, EXT_DRV_PIXEL_FMT_NV61_2X1 },
|
|
{ UAPI_FORMAT_YUV_SEMIPLANAR_420_VU, EXT_DRV_PIXEL_FMT_NV21 },
|
|
{ UAPI_FORMAT_YUV_SEMIPLANAR_400, EXT_DRV_PIXEL_FMT_NV80 },
|
|
{ UAPI_FORMAT_YUV_SEMIPLANAR_411_VU, EXT_DRV_PIXEL_FMT_NV12_411 },
|
|
{ UAPI_FORMAT_YUV_SEMIPLANAR_422_UV, EXT_DRV_PIXEL_FMT_NV61 },
|
|
{ UAPI_FORMAT_YUV_SEMIPLANAR_444_VU, EXT_DRV_PIXEL_FMT_NV42 },
|
|
{ UAPI_FORMAT_YUV_PACKAGE_UYVY, EXT_DRV_PIXEL_FMT_UYVY },
|
|
{ UAPI_FORMAT_YUV_PACKAGE_YUYV, EXT_DRV_PIXEL_FMT_YUYV },
|
|
{ UAPI_FORMAT_YUV_SEMIPLANAR_420_UV, EXT_DRV_PIXEL_FMT_NV12 },
|
|
{ UAPI_FORMAT_YUV_PLANAR_400, EXT_DRV_PIXEL_FMT_YUV400 },
|
|
{ UAPI_FORMAT_YUV_SEMIPLANAR_400, EXT_DRV_PIXEL_FMT_NV80 },
|
|
{ UAPI_FORMAT_YUV_PLANAR_411_VU, EXT_DRV_PIXEL_FMT_YUV411 },
|
|
{ UAPI_FORMAT_YUV_PLANAR_420_VU, EXT_DRV_PIXEL_FMT_YUV420P },
|
|
{ UAPI_FORMAT_YUV_PLANAR_422_UV, EXT_DRV_PIXEL_FMT_YUV422_1X2 },
|
|
{ UAPI_FORMAT_YUV_PLANAR_422_VU, EXT_DRV_PIXEL_FMT_YUV422_2X1 },
|
|
{ UAPI_FORMAT_YUV_PLANAR_444_UV, EXT_DRV_PIXEL_FMT_YUV_444 },
|
|
{ UAPI_FORMAT_YUV_PLANAR_410_VU, EXT_DRV_PIXEL_FMT_YUV410P },
|
|
{ UAPI_FORMAT_RGB888, EXT_DRV_PIXEL_FMT_RGB24 },
|
|
{ UAPI_FORMAT_ARGB8888, EXT_DRV_PIXEL_FMT_ARGB8888 },
|
|
{ UAPI_FORMAT_YUV_TILE_420_VU, EXT_DRV_PIXEL_FMT_NV21 },
|
|
{ UAPI_FORMAT_YUV_TILE_420_UV, EXT_DRV_PIXEL_FMT_NV12 },
|
|
{ UAPI_FORMAT_RGB_SEMIPLANAR_444, EXT_DRV_PIXEL_FMT_NV42_RGB},
|
|
};
|
|
|
|
static ext_hdmirx_audio_format_convert g_hdmirx_audio_format[] = {
|
|
{ EXT_DRV_AI_HDMI_DATA_PCM, UAPI_AUDIO_FORMAT_PCM },
|
|
{ EXT_DRV_AI_HDMI_DATA_DD, UAPI_AUDIO_FORMAT_AC3 },
|
|
{ EXT_DRV_AI_HDMI_DATA_DDP, UAPI_AUDIO_FORMAT_EAC3 },
|
|
{ EXT_DRV_AI_HDMI_DATA_DTS, UAPI_AUDIO_FORMAT_DTS },
|
|
{ EXT_DRV_AI_HDMI_DATA_DTSHD, UAPI_AUDIO_FORMAT_DTS_HD },
|
|
{ EXT_DRV_AI_HDMI_DATA_TRUEHD, UAPI_AUDIO_FORMAT_MAT },
|
|
{ EXT_DRV_AI_HDMI_DATA_MAT, UAPI_AUDIO_FORMAT_MAT },
|
|
{ EXT_DRV_AI_HDMI_DATA_UNKNOWN, UAPI_AUDIO_FORMAT_STREAM },
|
|
};
|
|
|
|
td_s32 uapi_hdmirx_init(td_void)
|
|
{
|
|
return ext_mpi_hdmirx_init();
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_deinit(td_void)
|
|
{
|
|
return ext_mpi_hdmirx_de_init();
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_connect(uapi_hdmirx_port port)
|
|
{
|
|
ext_drv_hdmirx_port hdmirx_port = (ext_drv_hdmirx_port)port;
|
|
return ext_mpi_hdmirx_connect(hdmirx_port);
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_disconnect(uapi_hdmirx_port port)
|
|
{
|
|
return ext_mpi_hdmirx_dis_connect((ext_drv_hdmirx_port)port);
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_get_timing_info(uapi_hdmirx_port port,
|
|
uapi_hdmirx_timing_info *timing_info)
|
|
{
|
|
td_s32 ret;
|
|
td_u32 index;
|
|
td_u32 max_index;
|
|
ext_drv_hdmirx_timing_info timing;
|
|
if (timing_info == TD_NULL) {
|
|
ext_err_hdmirx("input null pointer pstTimingInfo, return!\n");
|
|
return SOC_ERR_HDMIRX_NULL_PTR;
|
|
}
|
|
|
|
ret = ext_mpi_hdmirx_get_timing_info((ext_drv_hdmirx_port)port, &timing);
|
|
if (ret != TD_SUCCESS) {
|
|
ext_err_hdmirx("get timing info fail, return!\n");
|
|
return ret;
|
|
}
|
|
timing_info->width = timing.width;
|
|
timing_info->height = timing.height;
|
|
timing_info->frame_rate = timing.frame_rate;
|
|
timing_info->color_space.color_primary = (uapi_color_primary)timing.color_space.color_primary;
|
|
timing_info->color_space.color_space = (uapi_color_space)timing.color_space.color_space;
|
|
timing_info->color_space.quantify_range = (uapi_color_quantify_range)timing.color_space.quantify_range;
|
|
timing_info->color_space.matrix_coef = (uapi_color_matrix_coeffs)timing.color_space.matrix_coef;
|
|
timing_info->color_space.transfer_type = (uapi_color_transfer_curve)timing.color_space.transfer_type;
|
|
timing_info->depth = (uapi_pixel_bit_depth)timing.bit_width;
|
|
timing_info->is_interlace = timing.interlace;
|
|
timing_info->oversample = (uapi_oversample)timing.oversample;
|
|
timing_info->fmt = (uapi_video_frame_packing_type)timing.fmt;
|
|
timing_info->hdmi_mode = timing.hdmi_mode;
|
|
timing_info->v_blank = timing.vblank;
|
|
timing_info->pc_mode = timing.pc_mode;
|
|
timing_info->timing_idx = timing.timing_idx;
|
|
timing_info->is_mhl = timing.mhl;
|
|
max_index = sizeof(g_hdmirx_vid_format) / sizeof(g_hdmirx_vid_format[0]);
|
|
for (index = 0; index < max_index; index++) {
|
|
if (timing.pixel_fmt == g_hdmirx_vid_format[index].drv_video_format) {
|
|
timing_info->pixel_fmt = (uapi_video_pixel_format)g_hdmirx_vid_format[index].iapi_video_format;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_get_audio_info(uapi_hdmirx_port port,
|
|
uapi_hdmirx_audio_attr *audio_info)
|
|
{
|
|
td_s32 ret;
|
|
td_u32 index;
|
|
ext_drv_ai_hdmirx_attr aud_info;
|
|
td_u32 max_index;
|
|
uapi_audio_format aud_format;
|
|
|
|
if (audio_info == TD_NULL) {
|
|
ext_err_hdmirx("input null pointer pstAudioInfo, return!\n");
|
|
return SOC_ERR_HDMIRX_NULL_PTR;
|
|
}
|
|
ret = ext_mpi_hdmirx_get_audio_info((ext_drv_hdmirx_port)port, &aud_info);
|
|
if (ret != TD_SUCCESS) {
|
|
ext_err_hdmirx("get audio info of port:%d fail, return!\n", port);
|
|
return ret;
|
|
}
|
|
audio_info->channels = (uapi_audio_channel)aud_info.channel;
|
|
audio_info->bit_depth = (uapi_audio_bit_depth)aud_info.bit_depth;
|
|
audio_info->sample_rate = (uapi_audio_sample_rate)aud_info.sample_rate;
|
|
audio_info->audio_data_type = (uapi_audio_data_type)aud_info.hdmi_audio_data_format;
|
|
max_index = sizeof(g_hdmirx_audio_format) / sizeof(g_hdmirx_audio_format[0]);
|
|
aud_format = UAPI_AUDIO_FORMAT_STREAM;
|
|
for (index = 0; index < max_index; index++) {
|
|
if (aud_info.hdmi_audio_data_type == g_hdmirx_audio_format[index].drv_audio_format) {
|
|
aud_format = g_hdmirx_audio_format[index].iapi_audio_format;
|
|
break;
|
|
}
|
|
}
|
|
audio_info->audio_format = aud_format;
|
|
return ret;
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_get_signal_status(uapi_hdmirx_port port,
|
|
uapi_sig_status *status)
|
|
{
|
|
td_s32 ret;
|
|
if (status == TD_NULL) {
|
|
ext_err_hdmirx("input null pointer penStatus, return!\n");
|
|
return SOC_ERR_HDMIRX_NULL_PTR;
|
|
}
|
|
ret = ext_mpi_hdmirx_get_sig_status((ext_drv_hdmirx_port)port, (ext_drv_sig_status *)status);
|
|
return ret;
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_get_audio_status(uapi_hdmirx_port port,
|
|
uapi_sig_status *status)
|
|
{
|
|
td_s32 ret;
|
|
if (status == TD_NULL) {
|
|
ext_err_hdmirx("input null pointer status, return!\n");
|
|
return SOC_ERR_HDMIRX_NULL_PTR;
|
|
}
|
|
ret = ext_mpi_hdmirx_get_audio_status((ext_drv_hdmirx_port)port, (ext_drv_sig_status *)status);
|
|
return ret;
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_init_edid(uapi_hdmirx_port port,
|
|
const uapi_hdmirx_edid *edid_info, td_u32 edid_count)
|
|
{
|
|
errno_t err_ret;
|
|
if (edid_info == NULL) {
|
|
ext_err_hdmirx("Input Edid ptr is NULL.\n");
|
|
return SOC_ERR_HDMIRX_NULL_PTR;
|
|
}
|
|
if (edid_info->edid == TD_NULL) {
|
|
ext_err_hdmirx("Input Edid data ptr is NULL.\n");
|
|
return SOC_ERR_HDMIRX_NULL_PTR;
|
|
}
|
|
if (edid_count > HDMIRX_EDID_NUM) {
|
|
ext_err_hdmirx("Input Edid count error.\n");
|
|
return SOC_ERR_HDMIRX_EDID_COUNT_ERR;
|
|
}
|
|
if (port >= UAPI_HDMIRX_PORT_MAX) {
|
|
ext_err_hdmirx("EDID port error!\n");
|
|
return SOC_ERR_HDMIRX_INVALID_PORT;
|
|
}
|
|
ext_info_hdmirx("port%d init hdmirx edid\n", port);
|
|
ext_drv_hdmirx_edid edid[HDMIRX_EDID_NUM];
|
|
|
|
for (td_u32 temp = 0; temp < edid_count; temp++) {
|
|
edid[temp].cec_addr = edid_info[temp].cec_addr;
|
|
edid[temp].edid_length = edid_info[temp].edid_length;
|
|
err_ret = memset_s(edid[temp].edid_data, HDMIRX_EDID_LENGTH * sizeof(td_u8),
|
|
0, HDMIRX_EDID_LENGTH * sizeof(td_u8));
|
|
if (err_ret != EOK) {
|
|
ext_err_hdmirx("secure func call error\n");
|
|
return SOC_ERR_HDMIRX_SECURE_FUNC_FAILED;
|
|
}
|
|
if (edid_info[temp].edid_length != HDMIRX_EDID_LENGTH) {
|
|
ext_err_hdmirx("EDID length error!\n");
|
|
return SOC_ERR_HDMIRX_EDID_LEN_ERR;
|
|
}
|
|
err_ret = memcpy_s(edid[temp].edid_data, HDMIRX_EDID_LENGTH * sizeof(td_u8),
|
|
edid_info[temp].edid, edid_info[temp].edid_length * sizeof(td_u8));
|
|
if (err_ret != EOK) {
|
|
ext_err_hdmirx("secure func call error\n");
|
|
return SOC_ERR_HDMIRX_SECURE_FUNC_FAILED;
|
|
}
|
|
}
|
|
return ext_mpi_hdmirx_init_edid((ext_drv_hdmirx_port)port, edid, edid_count);
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_set_edid_mode(uapi_hdmirx_port port, uapi_hdmirx_edid_mode edid_mode)
|
|
{
|
|
return ext_mpi_hdmirx_set_edid_mode((ext_drv_hdmirx_port)port, (ext_drv_hdmirx_edid_mode)edid_mode);
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_get_capability(uapi_hdmirx_capability *capability)
|
|
{
|
|
ext_drv_hdmirx_capability_info caps;
|
|
td_s32 ret;
|
|
td_u32 i;
|
|
errno_t err_ret;
|
|
|
|
if (capability == TD_NULL) {
|
|
ext_err_hdmirx("input null pointer capability, return!\n");
|
|
return SOC_ERR_HDMIRX_NULL_PTR;
|
|
}
|
|
err_ret = memset_s(&caps, sizeof(ext_drv_hdmirx_capability_info), 0, sizeof(ext_drv_hdmirx_capability_info));
|
|
if (err_ret != EOK) {
|
|
ext_err_hdmirx("secure func call error\n");
|
|
return SOC_ERR_HDMIRX_SECURE_FUNC_FAILED;
|
|
}
|
|
ret = ext_mpi_hdmirx_get_capability(&caps);
|
|
if (ret != TD_SUCCESS) {
|
|
ext_err_hdmirx("get capability info fail, return!\n");
|
|
return ret;
|
|
}
|
|
capability->port_max = caps.port_max;
|
|
if (caps.port_max > UAPI_HDMIRX_PORT_MAX) {
|
|
ext_err_hdmirx("caps.port_max = %d, is error\n", caps.port_max);
|
|
return SOC_ERR_HDMIRX_INVALID_PORT;
|
|
}
|
|
for (i = 0; i < UAPI_HDMIRX_PORT_MAX; i++) {
|
|
capability->caps[i].ver = (uapi_hdmirx_ver)caps.capability[i].ver;
|
|
capability->caps[i].enable = caps.capability[i].enable;
|
|
capability->caps[i].arc_port = caps.capability[i].arc_port;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_load_hdcp(uapi_hdmirx_port port,
|
|
uapi_hdmirx_hdcp_ver type, const uapi_hdmirx_hdcp *hdcp)
|
|
{
|
|
#ifndef CONFIG_HDMIRX_EXCLUDE_HDCP
|
|
ext_drv_hdmirx_hdcp hdcp_info;
|
|
|
|
if (hdcp == TD_NULL) {
|
|
ext_err_hdmirx("input pstHdcp ptr is null ptr!\n");
|
|
return SOC_ERR_HDMIRX_NULL_PTR;
|
|
}
|
|
|
|
hdcp_info.hdcp_length = hdcp->hdcp_length;
|
|
hdcp_info.hdcp_data = hdcp->hdcp_data;
|
|
|
|
return ext_mpi_hdmirx_update_hdcp((ext_drv_hdmirx_port)port, (ext_drv_hdmirx_hdcp_type)type, &hdcp_info);
|
|
#else
|
|
TD_UNUSED(port);
|
|
TD_UNUSED(type);
|
|
TD_UNUSED(hdcp);
|
|
return TD_SUCCESS;
|
|
#endif
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_get_offline_status(uapi_hdmirx_port port, uapi_hdmirx_offline_info *offline_info)
|
|
{
|
|
return ext_mpi_hdmirx_get_offline_status((ext_drv_hdmirx_port)port, (ext_drv_hdmirx_offline_info *)offline_info);
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_cec_enable(td_bool enable)
|
|
{
|
|
return ext_mpi_hdmirx_cec_enable(enable);
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_cec_send_msg(const uapi_cec_msg *cec_msg)
|
|
{
|
|
td_s32 ret;
|
|
ext_drv_hdmirx_cec_cmd cec_cmd;
|
|
errno_t err_ret;
|
|
if (cec_msg == NULL) {
|
|
ext_err_hdmirx("Input pstCECCmd ptr is NULL.\n");
|
|
return SOC_ERR_HDMIRX_NULL_PTR;
|
|
}
|
|
if (cec_msg->operand.len > UAPI_CEC_MAX_OPERAND_SIZE) {
|
|
ext_err_hdmirx("Input pstCECCmd u32ArgCount is invalid!\n");
|
|
return SOC_ERR_HDMIRX_INVALID_PARA;
|
|
}
|
|
if ((cec_msg->dst_addr > UAPI_CEC_LOGIC_ADDR_BROADCAST) ||
|
|
(cec_msg->src_addr > UAPI_CEC_LOGIC_ADDR_BROADCAST)) {
|
|
ext_err_hdmirx("src/dst addr is invalid!\n");
|
|
return SOC_ERR_HDMIRX_INVALID_PARA;
|
|
}
|
|
if (cec_msg->opcode > UAPI_CEC_OPCODE_POLLING_MESSAGE) {
|
|
ext_err_hdmirx("cec opcode 0x%x is invalid!\n", cec_msg->opcode);
|
|
return SOC_ERR_HDMIRX_INVALID_PARA;
|
|
}
|
|
cec_cmd.src_addr = cec_msg->src_addr;
|
|
cec_cmd.dst_addr = cec_msg->dst_addr;
|
|
cec_cmd.opcode = (ext_drv_hdmirx_cec_opcode)cec_msg->opcode;
|
|
cec_cmd.operand.arg_count = cec_msg->operand.len;
|
|
err_ret = memcpy_s(cec_cmd.operand.args, sizeof(cec_cmd.operand.args),
|
|
cec_msg->operand.data, sizeof(td_u8) * cec_msg->operand.len);
|
|
if (err_ret != EOK) {
|
|
ext_err_hdmirx("secure func call error\n");
|
|
return SOC_ERR_HDMIRX_SECURE_FUNC_FAILED;
|
|
}
|
|
|
|
ret = ext_mpi_hdmirx_cec_set_command(&cec_cmd);
|
|
|
|
return ret;
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_cec_receive_msg(uapi_cec_msg *cec_msg)
|
|
{
|
|
td_s32 ret;
|
|
ext_drv_hdmirx_cec_cmd cec_cmd;
|
|
errno_t err_ret;
|
|
if (cec_msg == NULL) {
|
|
ext_err_hdmirx("Input pstCECCmd ptr is NULL.\n");
|
|
return SOC_ERR_HDMIRX_NULL_PTR;
|
|
}
|
|
ret = ext_mpi_hdmirx_cec_get_command(&cec_cmd);
|
|
if (ret != TD_SUCCESS) {
|
|
return ret;
|
|
}
|
|
cec_msg->src_addr = cec_cmd.src_addr;
|
|
cec_msg->dst_addr = cec_cmd.dst_addr;
|
|
cec_msg->opcode = (uapi_cec_opcode)cec_cmd.opcode;
|
|
cec_msg->operand.len = cec_cmd.operand.arg_count >= UAPI_CEC_MAX_OPERAND_SIZE ? UAPI_CEC_MAX_OPERAND_SIZE :
|
|
cec_cmd.operand.arg_count;
|
|
err_ret = memcpy_s(cec_msg->operand.data, sizeof(cec_msg->operand.data), cec_cmd.operand.args,
|
|
sizeof(td_u8) * cec_msg->operand.len);
|
|
if (err_ret != EOK) {
|
|
ext_err_hdmirx("secure func call error\n");
|
|
return SOC_ERR_HDMIRX_SECURE_FUNC_FAILED;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_cec_get_cur_msg_state(uapi_hdmirx_cec_status *cec_status)
|
|
{
|
|
td_s32 ret;
|
|
ext_drv_hdmirx_cec_cmd_state_data cmd_state;
|
|
if (cec_status == NULL) {
|
|
ext_err_hdmirx("Input pstCmdState ptr is NULL.\n");
|
|
return SOC_ERR_HDMIRX_NULL_PTR;
|
|
}
|
|
ret = ext_mpi_hdmirx_cec_get_cur_cmd_state(&cmd_state);
|
|
if (ret != TD_SUCCESS) {
|
|
return ret;
|
|
}
|
|
cec_status->cur_opcode = (uapi_cec_opcode)cmd_state.cur_opcode;
|
|
cec_status->cur_status = (uapi_hdmirx_cec_msg_status)cmd_state.cur_state;
|
|
cec_status->dst_addr = cmd_state.dst_addr;
|
|
return ret;
|
|
}
|
|
|
|
|
|
td_s32 uapi_hdmirx_set_hpd_value(uapi_hdmirx_port port, td_bool value)
|
|
{
|
|
return ext_mpi_hdmirx_set_hpd_value((ext_drv_hdmirx_port)port, value);
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_get_video_info(uapi_hdmirx_port port, uapi_hdmirx_video_info *video_info)
|
|
{
|
|
td_s32 ret;
|
|
ext_drv_hdmirx_video_attr mpi_video_info;
|
|
if (video_info == NULL) {
|
|
ext_err_hdmirx("Input video info ptr is NULL.\n");
|
|
return SOC_ERR_HDMIRX_NULL_PTR;
|
|
}
|
|
ret = ext_mpi_hdmirx_get_video_attr((ext_drv_hdmirx_port)port, &mpi_video_info);
|
|
if (ret != TD_SUCCESS) {
|
|
ext_err_hdmirx("get mpi video info fail, return!\n");
|
|
return ret;
|
|
}
|
|
if (mpi_video_info.allm_status == EXT_DRV_HDMIRX_ALLM_STATUS_DISABLE) {
|
|
video_info->allm_status = UAPI_HDMIRX_ALLM_STATUS_DISABLE;
|
|
} else if (mpi_video_info.allm_status == EXT_DRV_HDMIRX_ALLM_STATUS_ENABLE) {
|
|
video_info->allm_status = UAPI_HDMIRX_ALLM_STATUS_ENABLE;
|
|
} else {
|
|
video_info->allm_status = UAPI_HDMIRX_ALLM_STATUS_NONE;
|
|
}
|
|
if (mpi_video_info.vrr_mode == EXT_DRV_HDMIRX_VRR_MODE_VRR) {
|
|
video_info->vrr_mode = UAPI_HDMIRX_VRR_MODE_VRR;
|
|
} else if (mpi_video_info.vrr_mode == EXT_DRV_HDMIRX_VRR_MODE_QMS) {
|
|
video_info->vrr_mode = UAPI_HDMIRX_VRR_MODE_QMS;
|
|
} else if (mpi_video_info.vrr_mode == EXT_DRV_HDMIRX_VRR_MODE_ARR) {
|
|
video_info->vrr_mode = UAPI_HDMIRX_VRR_MODE_ARR;
|
|
} else if (mpi_video_info.vrr_mode == EXT_DRV_HDMIRX_VRR_MODE_FRR) {
|
|
video_info->vrr_mode = UAPI_HDMIRX_VRR_MODE_FRR;
|
|
} else {
|
|
video_info->vrr_mode = UAPI_HDMIRX_VRR_MODE_NONE;
|
|
}
|
|
video_info->cur_frame_rate = mpi_video_info.cur_frame_rate;
|
|
|
|
return ret;
|
|
}
|
|
|
|
td_s32 uapi_hdmirx_get_source_product_description(uapi_hdmirx_port port,
|
|
uapi_hdmirx_source_product_description *source_product_description)
|
|
{
|
|
td_s32 ret;
|
|
ext_drv_hdmirx_spd_info spd_info = {0};
|
|
errno_t err_ret;
|
|
|
|
if (source_product_description == NULL) {
|
|
ext_err_hdmirx("Input product_description_info ptr is NULL.\n");
|
|
return SOC_ERR_HDMIRX_NULL_PTR;
|
|
}
|
|
err_ret = memset_s(source_product_description, sizeof(uapi_hdmirx_source_product_description),
|
|
0, sizeof(uapi_hdmirx_source_product_description));
|
|
if (err_ret != EOK) {
|
|
ext_err_hdmirx("secure func call error\n");
|
|
return SOC_ERR_HDMIRX_SECURE_FUNC_FAILED;
|
|
}
|
|
spd_info.port = (ext_drv_hdmirx_port)port;
|
|
ret = ext_mpi_hdmirx_get_source_product_description(&spd_info);
|
|
if (ret != TD_SUCCESS) {
|
|
ext_err_hdmirx("get mpi product description info fail, return!\n");
|
|
return ret;
|
|
}
|
|
err_ret = memcpy_s(source_product_description->vendor_name, sizeof(td_u8) * UAPI_HDMIRX_VENDOR_NAME_LEN,
|
|
spd_info.product_description.vendor_name, sizeof(td_u8) * EXT_HDMIRX_VENDOR_NAME_LEN);
|
|
if (err_ret != EOK) {
|
|
ext_err_hdmirx("secure func call error\n");
|
|
return SOC_ERR_HDMIRX_SECURE_FUNC_FAILED;
|
|
}
|
|
err_ret = memcpy_s(source_product_description->product_description,
|
|
sizeof(td_u8) * UAPI_HDMIRX_PRODUCT_DESCRIPTION_LEN, spd_info.product_description.product_description,
|
|
sizeof(td_u8) * EXT_HDMIRX_PRODUCT_DESCRIPTION_LEN);
|
|
if (err_ret != EOK) {
|
|
ext_err_hdmirx("secure func call error\n");
|
|
return SOC_ERR_HDMIRX_SECURE_FUNC_FAILED;
|
|
}
|
|
|
|
return ret;
|
|
}
|