hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/video/rockchip/mpp/mpp_jpgdec.c
....@@ -251,6 +251,7 @@
251251 u32 i;
252252 u32 reg_en;
253253 struct jpgdec_task *task = to_jpgdec_task(mpp_task);
254
+ u32 timing_en = mpp->srv->timing_en;
254255
255256 mpp_debug_enter();
256257
....@@ -263,12 +264,20 @@
263264
264265 mpp_write_req(mpp, task->reg, s, e, reg_en);
265266 }
267
+ /* flush tlb before starting hardware */
268
+ mpp_iommu_flush_tlb(mpp->iommu_info);
269
+
266270 /* init current task */
267271 mpp->cur_task = mpp_task;
272
+
273
+ mpp_task_run_begin(mpp_task, timing_en, MPP_WORK_TIMEOUT_DELAY);
274
+
268275 /* Flush the register before the start the device */
269276 wmb();
270277 mpp_write(mpp, JPGDEC_REG_INT_EN_BASE,
271278 task->reg[reg_en] | JPGDEC_START_EN);
279
+
280
+ mpp_task_run_end(mpp_task, timing_en);
272281
273282 mpp_debug_leave();
274283
....@@ -374,6 +383,10 @@
374383 dec->procfs = NULL;
375384 return -EIO;
376385 }
386
+
387
+ /* for common mpp_dev options */
388
+ mpp_procfs_create_common(dec->procfs, mpp);
389
+
377390 mpp_procfs_create_u32("aclk", 0644,
378391 dec->procfs, &dec->aclk_info.debug_rate_hz);
379392 mpp_procfs_create_u32("session_buffers", 0644,
....@@ -510,13 +523,13 @@
510523 mpp_debug(DEBUG_RESET, "reset in\n");
511524
512525 /* Don't skip this or iommu won't work after reset */
513
- rockchip_pmu_idle_request(mpp->dev, true);
526
+ mpp_pmu_idle_request(mpp, true);
514527 mpp_safe_reset(dec->rst_a);
515528 mpp_safe_reset(dec->rst_h);
516529 udelay(5);
517530 mpp_safe_unreset(dec->rst_a);
518531 mpp_safe_unreset(dec->rst_h);
519
- rockchip_pmu_idle_request(mpp->dev, false);
532
+ mpp_pmu_idle_request(mpp, false);
520533
521534 mpp_debug(DEBUG_RESET, "reset out\n");
522535 }
....@@ -545,7 +558,7 @@
545558 };
546559
547560 static const struct mpp_dev_var jpgdec_v1_data = {
548
- .device_type = MPP_DEVICE_JPGDEC,
561
+ .device_type = MPP_DEVICE_RKJPEGD,
549562 .hw_info = &jpgdec_v1_hw_info,
550563 .trans_info = jpgdec_v1_trans,
551564 .hw_ops = &jpgdec_v1_hw_ops,
....@@ -572,9 +585,9 @@
572585 dec = devm_kzalloc(dev, sizeof(struct jpgdec_dev), GFP_KERNEL);
573586 if (!dec)
574587 return -ENOMEM;
575
- platform_set_drvdata(pdev, dec);
576
-
577588 mpp = &dec->mpp;
589
+ platform_set_drvdata(pdev, mpp);
590
+
578591 if (pdev->dev.of_node) {
579592 match = of_match_node(mpp_jpgdec_dt_match, pdev->dev.of_node);
580593 if (match)
....@@ -609,37 +622,19 @@
609622 static int jpgdec_remove(struct platform_device *pdev)
610623 {
611624 struct device *dev = &pdev->dev;
612
- struct jpgdec_dev *dec = platform_get_drvdata(pdev);
625
+ struct mpp_dev *mpp = dev_get_drvdata(dev);
613626
614627 dev_info(dev, "remove device\n");
615
- mpp_dev_remove(&dec->mpp);
616
- jpgdec_procfs_remove(&dec->mpp);
628
+ mpp_dev_remove(mpp);
629
+ jpgdec_procfs_remove(mpp);
617630
618631 return 0;
619
-}
620
-
621
-static void jpgdec_shutdown(struct platform_device *pdev)
622
-{
623
- int ret;
624
- int val;
625
- struct device *dev = &pdev->dev;
626
- struct jpgdec_dev *dec = platform_get_drvdata(pdev);
627
- struct mpp_dev *mpp = &dec->mpp;
628
-
629
- dev_info(dev, "shutdown device\n");
630
-
631
- atomic_inc(&mpp->srv->shutdown_request);
632
- ret = readx_poll_timeout(atomic_read,
633
- &mpp->task_count,
634
- val, val == 0, 20000, 200000);
635
- if (ret == -ETIMEDOUT)
636
- dev_err(dev, "wait total running time out\n");
637632 }
638633
639634 struct platform_driver rockchip_jpgdec_driver = {
640635 .probe = jpgdec_probe,
641636 .remove = jpgdec_remove,
642
- .shutdown = jpgdec_shutdown,
637
+ .shutdown = mpp_dev_shutdown,
643638 .driver = {
644639 .name = JPGDEC_DRIVER_NAME,
645640 .of_match_table = of_match_ptr(mpp_jpgdec_dt_match),