Commit 9ceca28e authored by kyrie wu's avatar kyrie wu Committed by Mauro Carvalho Chehab

media: mtk-jpeg: add jpeg single core initial function

add single core initial function to init reg_base,
irq and clk.
Signed-off-by: default avatarkyrie wu <kyrie.wu@mediatek.com>
Signed-off-by: default avatarirui wang <irui.wang@mediatek.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 75c38caf
......@@ -1671,28 +1671,12 @@ static void mtk_jpeg_job_timeout_work(struct work_struct *work)
v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx);
}
static int mtk_jpeg_probe(struct platform_device *pdev)
static int mtk_jpeg_single_core_init(struct platform_device *pdev,
struct mtk_jpeg_dev *jpeg_dev)
{
struct mtk_jpeg_dev *jpeg;
int jpeg_irq;
int ret;
jpeg = devm_kzalloc(&pdev->dev, sizeof(*jpeg), GFP_KERNEL);
if (!jpeg)
return -ENOMEM;
mutex_init(&jpeg->lock);
spin_lock_init(&jpeg->hw_lock);
jpeg->dev = &pdev->dev;
jpeg->variant = of_device_get_match_data(jpeg->dev);
struct mtk_jpeg_dev *jpeg = jpeg_dev;
int jpeg_irq, ret;
ret = devm_of_platform_populate(&pdev->dev);
if (ret) {
v4l2_err(&jpeg->v4l2_dev, "Master of platform populate failed.");
return -EINVAL;
}
if (!jpeg->variant->multi_core) {
INIT_DELAYED_WORK(&jpeg->job_timeout_work,
mtk_jpeg_job_timeout_work);
......@@ -1724,6 +1708,36 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Failed to init clk\n");
return ret;
}
return 0;
}
static int mtk_jpeg_probe(struct platform_device *pdev)
{
struct mtk_jpeg_dev *jpeg;
int ret;
jpeg = devm_kzalloc(&pdev->dev, sizeof(*jpeg), GFP_KERNEL);
if (!jpeg)
return -ENOMEM;
mutex_init(&jpeg->lock);
spin_lock_init(&jpeg->hw_lock);
jpeg->dev = &pdev->dev;
jpeg->variant = of_device_get_match_data(jpeg->dev);
ret = devm_of_platform_populate(&pdev->dev);
if (ret) {
v4l2_err(&jpeg->v4l2_dev, "Master of platform populate failed.");
return -EINVAL;
}
if (!jpeg->variant->multi_core) {
ret = mtk_jpeg_single_core_init(pdev, jpeg);
if (ret) {
v4l2_err(&jpeg->v4l2_dev, "mtk_jpeg_single_core_init failed.");
return -EINVAL;
}
}
ret = v4l2_device_register(&pdev->dev, &jpeg->v4l2_dev);
......
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