| .. | .. |
|---|
| 18 | 18 | #include <linux/uaccess.h> |
|---|
| 19 | 19 | #include <linux/regmap.h> |
|---|
| 20 | 20 | #include <linux/proc_fs.h> |
|---|
| 21 | | -#include <linux/mfd/syscon.h> |
|---|
| 22 | | -#include <linux/rockchip/cpu.h> |
|---|
| 23 | 21 | #include <soc/rockchip/pm_domains.h> |
|---|
| 24 | 22 | |
|---|
| 25 | 23 | #include "mpp_debug.h" |
|---|
| .. | .. |
|---|
| 91 | 89 | struct reset_control *rst_s; |
|---|
| 92 | 90 | /* for zme */ |
|---|
| 93 | 91 | void __iomem *zme_base; |
|---|
| 94 | | - struct regmap *grf; |
|---|
| 95 | 92 | }; |
|---|
| 96 | 93 | |
|---|
| 97 | 94 | static struct vdpp_hw_info vdpp_v1_hw_info = { |
|---|
| .. | .. |
|---|
| 312 | 309 | struct vdpp_dev *vdpp = to_vdpp_dev(mpp); |
|---|
| 313 | 310 | struct vdpp_task *task = to_vdpp_task(mpp_task); |
|---|
| 314 | 311 | struct vdpp_hw_info *hw_info = vdpp->hw_info; |
|---|
| 312 | + u32 timing_en = mpp->srv->timing_en; |
|---|
| 315 | 313 | |
|---|
| 316 | 314 | mpp_debug_enter(); |
|---|
| 317 | 315 | |
|---|
| .. | .. |
|---|
| 342 | 340 | |
|---|
| 343 | 341 | /* init current task */ |
|---|
| 344 | 342 | mpp->cur_task = mpp_task; |
|---|
| 343 | + |
|---|
| 344 | + mpp_task_run_begin(mpp_task, timing_en, MPP_WORK_TIMEOUT_DELAY); |
|---|
| 345 | 345 | /* Flush the register before the start the device */ |
|---|
| 346 | 346 | wmb(); |
|---|
| 347 | 347 | mpp_write(mpp, hw_info->start_base, task->reg[reg_en]); |
|---|
| 348 | + |
|---|
| 349 | + mpp_task_run_end(mpp_task, timing_en); |
|---|
| 348 | 350 | |
|---|
| 349 | 351 | mpp_debug_leave(); |
|---|
| 350 | 352 | |
|---|
| .. | .. |
|---|
| 481 | 483 | { |
|---|
| 482 | 484 | int ret; |
|---|
| 483 | 485 | struct vdpp_dev *vdpp = to_vdpp_dev(mpp); |
|---|
| 484 | | - |
|---|
| 485 | | - mpp->grf_info = &mpp->srv->grf_infos[MPP_DRIVER_VDPP]; |
|---|
| 486 | 486 | |
|---|
| 487 | 487 | /* Get clock info from dtsi */ |
|---|
| 488 | 488 | ret = mpp_get_clk_info(mpp, &vdpp->aclk_info, "aclk"); |
|---|
| .. | .. |
|---|
| 645 | 645 | /* ensure hardware is being off status */ |
|---|
| 646 | 646 | mpp_write(mpp, hw_info->start_base, 0); |
|---|
| 647 | 647 | |
|---|
| 648 | | - |
|---|
| 649 | 648 | return 0; |
|---|
| 650 | 649 | } |
|---|
| 651 | 650 | |
|---|
| .. | .. |
|---|
| 704 | 703 | match = of_match_node(mpp_vdpp_dt_match, pdev->dev.of_node); |
|---|
| 705 | 704 | if (match) |
|---|
| 706 | 705 | mpp->var = (struct mpp_dev_var *)match->data; |
|---|
| 706 | + mpp->core_id = -1; |
|---|
| 707 | 707 | } |
|---|
| 708 | 708 | |
|---|
| 709 | 709 | ret = mpp_dev_probe(mpp, pdev); |
|---|
| .. | .. |
|---|
| 772 | 772 | dev_err(dev, "wait total running time out\n"); |
|---|
| 773 | 773 | } |
|---|
| 774 | 774 | |
|---|
| 775 | | -static int vdpp_runtime_suspend(struct device *dev) |
|---|
| 776 | | -{ |
|---|
| 777 | | - struct mpp_dev *mpp = dev_get_drvdata(dev); |
|---|
| 778 | | - struct mpp_grf_info *info = mpp->grf_info; |
|---|
| 779 | | - struct mpp_taskqueue *queue = mpp->queue; |
|---|
| 780 | | - |
|---|
| 781 | | - if (cpu_is_rk3528() && info && info->mem_offset) { |
|---|
| 782 | | - mutex_lock(&queue->ref_lock); |
|---|
| 783 | | - if (!atomic_dec_if_positive(&queue->runtime_cnt)) { |
|---|
| 784 | | - regmap_write(info->grf, info->mem_offset, |
|---|
| 785 | | - info->val_mem_off); |
|---|
| 786 | | - } |
|---|
| 787 | | - mutex_unlock(&queue->ref_lock); |
|---|
| 788 | | - } |
|---|
| 789 | | - |
|---|
| 790 | | - return 0; |
|---|
| 791 | | -} |
|---|
| 792 | | - |
|---|
| 793 | | -static int vdpp_runtime_resume(struct device *dev) |
|---|
| 794 | | -{ |
|---|
| 795 | | - struct mpp_dev *mpp = dev_get_drvdata(dev); |
|---|
| 796 | | - struct mpp_grf_info *info = mpp->grf_info; |
|---|
| 797 | | - struct mpp_taskqueue *queue = mpp->queue; |
|---|
| 798 | | - |
|---|
| 799 | | - if (cpu_is_rk3528() && info && info->mem_offset) { |
|---|
| 800 | | - mutex_lock(&queue->ref_lock); |
|---|
| 801 | | - regmap_write(info->grf, info->mem_offset, |
|---|
| 802 | | - info->val_mem_on); |
|---|
| 803 | | - atomic_inc(&queue->runtime_cnt); |
|---|
| 804 | | - mutex_unlock(&queue->ref_lock); |
|---|
| 805 | | - } |
|---|
| 806 | | - |
|---|
| 807 | | - return 0; |
|---|
| 808 | | -} |
|---|
| 809 | | - |
|---|
| 810 | | -static const struct dev_pm_ops vdpp_pm_ops = { |
|---|
| 811 | | - .runtime_suspend = vdpp_runtime_suspend, |
|---|
| 812 | | - .runtime_resume = vdpp_runtime_resume, |
|---|
| 813 | | -}; |
|---|
| 814 | | - |
|---|
| 815 | 775 | struct platform_driver rockchip_vdpp_driver = { |
|---|
| 816 | 776 | .probe = vdpp_probe, |
|---|
| 817 | 777 | .remove = vdpp_remove, |
|---|
| 818 | 778 | .shutdown = vdpp_shutdown, |
|---|
| 819 | 779 | .driver = { |
|---|
| 820 | 780 | .name = VDPP_DRIVER_NAME, |
|---|
| 821 | | - .pm = &vdpp_pm_ops, |
|---|
| 822 | 781 | .of_match_table = of_match_ptr(mpp_vdpp_dt_match), |
|---|
| 823 | 782 | }, |
|---|
| 824 | 783 | }; |
|---|