Commit 66e860ff authored by Yunfei Dong's avatar Yunfei Dong Committed by Mauro Carvalho Chehab

media: mtk-vcodec: Add new interface to lock different hardware

For add new hardware, not only need to lock lat hardware, also
need to lock core hardware in case of different instance start
to decoder at the same time.
Signed-off-by: default avatarYunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 5797f7e1
...@@ -105,12 +105,12 @@ static int vidioc_decoder_cmd(struct file *file, void *priv, ...@@ -105,12 +105,12 @@ static int vidioc_decoder_cmd(struct file *file, void *priv,
void mtk_vdec_unlock(struct mtk_vcodec_ctx *ctx) void mtk_vdec_unlock(struct mtk_vcodec_ctx *ctx)
{ {
mutex_unlock(&ctx->dev->dec_mutex); mutex_unlock(&ctx->dev->dec_mutex[ctx->hw_id]);
} }
void mtk_vdec_lock(struct mtk_vcodec_ctx *ctx) void mtk_vdec_lock(struct mtk_vcodec_ctx *ctx)
{ {
mutex_lock(&ctx->dev->dec_mutex); mutex_lock(&ctx->dev->dec_mutex[ctx->hw_id]);
} }
void mtk_vcodec_dec_release(struct mtk_vcodec_ctx *ctx) void mtk_vcodec_dec_release(struct mtk_vcodec_ctx *ctx)
......
...@@ -279,7 +279,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ...@@ -279,7 +279,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
struct video_device *vfd_dec; struct video_device *vfd_dec;
phandle rproc_phandle; phandle rproc_phandle;
enum mtk_vcodec_fw_type fw_type; enum mtk_vcodec_fw_type fw_type;
int ret; int i, ret;
dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
if (!dev) if (!dev)
...@@ -311,7 +311,8 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ...@@ -311,7 +311,8 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
goto err_dec_pm; goto err_dec_pm;
} }
mutex_init(&dev->dec_mutex); for (i = 0; i < MTK_VDEC_HW_MAX; i++)
mutex_init(&dev->dec_mutex[i]);
mutex_init(&dev->dev_mutex); mutex_init(&dev->dev_mutex);
spin_lock_init(&dev->irqlock); spin_lock_init(&dev->irqlock);
......
...@@ -500,7 +500,8 @@ struct mtk_vcodec_dev { ...@@ -500,7 +500,8 @@ struct mtk_vcodec_dev {
int dec_irq; int dec_irq;
int enc_irq; int enc_irq;
struct mutex dec_mutex; /* decoder hardware mutex lock */
struct mutex dec_mutex[MTK_VDEC_HW_MAX];
struct mutex enc_mutex; struct mutex enc_mutex;
struct mtk_vcodec_pm pm; struct mtk_vcodec_pm pm;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment