hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/video/rockchip/mpp/mpp_vepu1.c
....@@ -264,6 +264,7 @@
264264 u32 i;
265265 u32 reg_en;
266266 struct vepu_task *task = to_vepu_task(mpp_task);
267
+ u32 timing_en = mpp->srv->timing_en;
267268
268269 mpp_debug_enter();
269270
....@@ -282,12 +283,21 @@
282283
283284 mpp_write_req(mpp, task->reg, s, e, reg_en);
284285 }
286
+
287
+ /* flush tlb before starting hardware */
288
+ mpp_iommu_flush_tlb(mpp->iommu_info);
289
+
285290 /* init current task */
286291 mpp->cur_task = mpp_task;
292
+
293
+ mpp_task_run_begin(mpp_task, timing_en, MPP_WORK_TIMEOUT_DELAY);
294
+
287295 /* Last, flush start registers */
288296 wmb();
289297 mpp_write(mpp, VEPU1_REG_ENC_EN,
290298 task->reg[reg_en] | VEPU1_ENC_START);
299
+
300
+ mpp_task_run_end(mpp_task, timing_en);
291301
292302 mpp_debug_leave();
293303
....@@ -499,7 +509,7 @@
499509 }
500510 seq_puts(seq, "\n");
501511 /* item data*/
502
- seq_printf(seq, "|%8p|", session);
512
+ seq_printf(seq, "|%8d|", session->index);
503513 seq_printf(seq, "%8s|", mpp_device_name[session->device_type]);
504514 for (i = ENC_INFO_BASE; i < ENC_INFO_BUTT; i++) {
505515 u32 flag = priv->codec_info[i].flag;
....@@ -532,7 +542,7 @@
532542 mutex_lock(&mpp->srv->session_lock);
533543 list_for_each_entry_safe(session, n,
534544 &mpp->srv->session_list,
535
- session_link) {
545
+ service_link) {
536546 if (session->device_type != MPP_DEVICE_VEPU1)
537547 continue;
538548 if (!session->priv)
....@@ -555,6 +565,10 @@
555565 enc->procfs = NULL;
556566 return -EIO;
557567 }
568
+
569
+ /* for common mpp_dev options */
570
+ mpp_procfs_create_common(enc->procfs, mpp);
571
+
558572 mpp_procfs_create_u32("aclk", 0644,
559573 enc->procfs, &enc->aclk_info.debug_rate_hz);
560574 mpp_procfs_create_u32("session_buffers", 0644,
....@@ -656,13 +670,13 @@
656670
657671 if (enc->rst_a && enc->rst_h) {
658672 /* Don't skip this or iommu won't work after reset */
659
- rockchip_pmu_idle_request(mpp->dev, true);
673
+ mpp_pmu_idle_request(mpp, true);
660674 mpp_safe_reset(enc->rst_a);
661675 mpp_safe_reset(enc->rst_h);
662676 udelay(5);
663677 mpp_safe_unreset(enc->rst_a);
664678 mpp_safe_unreset(enc->rst_h);
665
- rockchip_pmu_idle_request(mpp->dev, false);
679
+ mpp_pmu_idle_request(mpp, false);
666680 }
667681 mpp_write(mpp, VEPU1_REG_ENC_EN, 0);
668682
....@@ -722,12 +736,14 @@
722736 return -ENOMEM;
723737
724738 mpp = &enc->mpp;
725
- platform_set_drvdata(pdev, enc);
739
+ platform_set_drvdata(pdev, mpp);
726740
727741 if (pdev->dev.of_node) {
728742 match = of_match_node(mpp_vepu1_dt_match, pdev->dev.of_node);
729743 if (match)
730744 mpp->var = (struct mpp_dev_var *)match->data;
745
+
746
+ mpp->core_id = of_alias_get_id(pdev->dev.of_node, "vepu");
731747 }
732748
733749 ret = mpp_dev_probe(mpp, pdev);
....@@ -758,37 +774,19 @@
758774 static int vepu_remove(struct platform_device *pdev)
759775 {
760776 struct device *dev = &pdev->dev;
761
- struct vepu_dev *enc = platform_get_drvdata(pdev);
777
+ struct mpp_dev *mpp = dev_get_drvdata(dev);
762778
763779 dev_info(dev, "remove device\n");
764
- mpp_dev_remove(&enc->mpp);
765
- vepu_procfs_remove(&enc->mpp);
780
+ mpp_dev_remove(mpp);
781
+ vepu_procfs_remove(mpp);
766782
767783 return 0;
768
-}
769
-
770
-static void vepu_shutdown(struct platform_device *pdev)
771
-{
772
- int ret;
773
- int val;
774
- struct device *dev = &pdev->dev;
775
- struct vepu_dev *enc = platform_get_drvdata(pdev);
776
- struct mpp_dev *mpp = &enc->mpp;
777
-
778
- dev_info(dev, "shutdown device\n");
779
-
780
- atomic_inc(&mpp->srv->shutdown_request);
781
- ret = readx_poll_timeout(atomic_read,
782
- &mpp->task_count,
783
- val, val == 0, 20000, 200000);
784
- if (ret == -ETIMEDOUT)
785
- dev_err(dev, "wait total running time out\n");
786784 }
787785
788786 struct platform_driver rockchip_vepu1_driver = {
789787 .probe = vepu_probe,
790788 .remove = vepu_remove,
791
- .shutdown = vepu_shutdown,
789
+ .shutdown = mpp_dev_shutdown,
792790 .driver = {
793791 .name = VEPU1_DRIVER_NAME,
794792 .of_match_table = of_match_ptr(mpp_vepu1_dt_match),