video: rockchip: mpp: add query hw_id via client_type

if device in session has initialized, return hw_id directly.
otherwise, return hw_id via client_type which user set.
cat /proc/mpp_service/supports-device will show the hw_id.

Change-Id: Ie5e7c0227774ff5cacc8654f048c1447857e9e9d
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
This commit is contained in:
Ding Wei
2020-10-29 09:10:07 +08:00
parent fff0f25956
commit fca74dc112
2 changed files with 29 additions and 3 deletions

View File

@@ -904,7 +904,20 @@ static int mpp_process_request(struct mpp_session *session,
case MPP_CMD_QUERY_HW_ID: {
struct mpp_hw_info *hw_info;
mpp = session->mpp;
mpp = NULL;
if (session && session->mpp) {
mpp = session->mpp;
} else {
u32 client_type;
if (get_user(client_type, (u32 __user *)req->data))
return -EFAULT;
mpp_debug(DEBUG_IOCTL, "client %d\n", client_type);
client_type = array_index_nospec(client_type, MPP_DEVICE_BUTT);
if (test_bit(client_type, &srv->hw_support))
mpp = srv->sub_devices[client_type];
}
if (!mpp)
return -EINVAL;
hw_info = mpp->var->hw_info;

View File

@@ -17,6 +17,7 @@
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/nospec.h>
#include <linux/mfd/syscon.h>
#include "mpp_debug.h"
@@ -223,8 +224,20 @@ static int mpp_show_support_device(struct seq_file *file, void *v)
seq_puts(file, "---- SUPPORT DEVICES ----\n");
for (i = 0; i < MPP_DEVICE_BUTT; i++) {
if (test_bit(i, &srv->hw_support))
seq_printf(file, "DEVICE[%2d]:%s\n", i, mpp_device_name[i]);
struct mpp_dev *mpp;
struct mpp_hw_info *hw_info;
if (test_bit(i, &srv->hw_support)) {
mpp = srv->sub_devices[array_index_nospec(i, MPP_DEVICE_BUTT)];
if (!mpp)
continue;
seq_printf(file, "DEVICE[%2d]:%-10s", i, mpp_device_name[i]);
hw_info = mpp->var->hw_info;
if (hw_info->hw_id)
seq_printf(file, "HW_ID:0x%08x", hw_info->hw_id);
seq_puts(file, "\n");
}
}
return 0;