video/rockchip: mpp: read hwid with power on

Change-Id: I0da57743a92999efb9e0ebc503dc626d1ece6535
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
This commit is contained in:
Jianqun Xu 2020-03-05 14:43:42 +08:00
commit 73da7c8a6b
6 changed files with 14 additions and 15 deletions

View file

@ -1318,6 +1318,7 @@ int mpp_dev_probe(struct mpp_dev *mpp,
struct resource *res = NULL;
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
struct mpp_hw_info *hw_info = mpp->var->hw_info;
/* Get and attach to service */
ret = mpp_attach_service(mpp, dev);
@ -1388,6 +1389,15 @@ int mpp_dev_probe(struct mpp_dev *mpp,
if (ret)
goto failed_init;
}
if (hw_info->reg_id >= 0) {
if (mpp->hw_ops->power_on)
mpp->hw_ops->power_on(mpp);
hw_info->hw_id = mpp_read(mpp, hw_info->reg_id);
if (mpp->hw_ops->power_off)
mpp->hw_ops->power_off(mpp);
}
pm_runtime_put_sync(dev);
return ret;

View file

@ -1104,7 +1104,6 @@ static int rkvdec_debugfs_init(struct mpp_dev *mpp)
static int rkvdec_init(struct mpp_dev *mpp)
{
struct mpp_hw_info *hw_info;
struct rkvdec_dev *dec = to_rkvdec_dev(mpp);
mutex_init(&dec->sip_reset_lock);
@ -1164,10 +1163,6 @@ static int rkvdec_init(struct mpp_dev *mpp)
dec->rst_core = NULL;
}
/* read hardware id*/
hw_info = mpp->var->hw_info;
hw_info->hw_id = mpp_read(mpp, hw_info->reg_id);
return 0;
}

View file

@ -527,7 +527,6 @@ static int vdpu_debugfs_init(struct mpp_dev *mpp)
static int vdpu_init(struct mpp_dev *mpp)
{
struct mpp_hw_info *hw_info;
struct vdpu_dev *dec = to_vdpu_dev(mpp);
mpp->grf_info = &mpp->srv->grf_infos[MPP_DRIVER_VDPU1];
@ -554,10 +553,6 @@ static int vdpu_init(struct mpp_dev *mpp)
dec->rst_h = NULL;
}
/* read hardware id*/
hw_info = mpp->var->hw_info;
hw_info->hw_id = mpp_read(mpp, hw_info->reg_id);
return 0;
}

View file

@ -31,6 +31,7 @@
#define VDPU2_SESSION_MAX_BUFFERS 40
/* The maximum registers number of all the version */
#define VDPU2_REG_NUM 159
#define VDPU2_REG_HW_ID_INDEX -1 /* INVALID */
#define VDPU2_REG_START_INDEX 50
#define VDPU2_REG_END_INDEX 158
@ -117,6 +118,7 @@ struct vdpu_dev {
static struct mpp_hw_info vdpu_v2_hw_info = {
.reg_num = VDPU2_REG_NUM,
.reg_id = VDPU2_REG_HW_ID_INDEX,
.reg_start = VDPU2_REG_START_INDEX,
.reg_end = VDPU2_REG_END_INDEX,
.reg_en = VDPU2_REG_DEC_EN_INDEX,

View file

@ -443,7 +443,6 @@ static int vepu_debugfs_init(struct mpp_dev *mpp)
static int vepu_init(struct mpp_dev *mpp)
{
struct mpp_hw_info *hw_info;
struct vepu_dev *enc = to_vepu_dev(mpp);
mpp->grf_info = &mpp->srv->grf_infos[MPP_DRIVER_VEPU1];
@ -470,10 +469,6 @@ static int vepu_init(struct mpp_dev *mpp)
enc->rst_h = NULL;
}
/* read hardware id*/
hw_info = mpp->var->hw_info;
hw_info->hw_id = mpp_read(mpp, hw_info->reg_id);
return 0;
}

View file

@ -30,6 +30,7 @@
#define VEPU2_SESSION_MAX_BUFFERS 20
/* The maximum registers number of all the version */
#define VEPU2_REG_NUM 184
#define VEPU2_REG_HW_ID_INDEX -1 /* INVALID */
#define VEPU2_REG_START_INDEX 0
#define VEPU2_REG_END_INDEX 183
@ -107,6 +108,7 @@ struct vepu_dev {
static struct mpp_hw_info vepu_v2_hw_info = {
.reg_num = VEPU2_REG_NUM,
.reg_id = VEPU2_REG_HW_ID_INDEX,
.reg_start = VEPU2_REG_START_INDEX,
.reg_end = VEPU2_REG_END_INDEX,
.reg_en = VEPU2_REG_ENC_EN_INDEX,