Lines Matching refs:mpp

121 		container_of(dev, struct rkvdec_dev, mpp)
157 struct mpp_dev mpp; member
467 static int power_model_simple_init(struct mpp_dev *mpp) in power_model_simple_init() argument
469 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in power_model_simple_init()
470 struct device_node *np = mpp->dev->of_node; in power_model_simple_init()
478 dev_err(mpp->dev, "could not find power_model node\n"); in power_model_simple_init()
485 dev_err(mpp->dev, "ts in power_model not available\n"); in power_model_simple_init()
499 dev_err(mpp->dev, "static-power-coefficient not available\n"); in power_model_simple_init()
505 dev_err(mpp->dev, "dynamic-power-coefficient not available\n"); in power_model_simple_init()
514 dev_err(mpp->dev, "ts in power_model not available\n"); in power_model_simple_init()
812 struct mpp_dev *mpp = session->mpp; in rkvdec_alloc_task() local
822 mpp_task->hw_info = mpp->var->hw_info; in rkvdec_alloc_task()
853 mpp_task_dump_mem_region(mpp, mpp_task); in rkvdec_alloc_task()
854 mpp_task_dump_reg(mpp, mpp_task); in rkvdec_alloc_task()
860 static void *rkvdec_prepare_with_reset(struct mpp_dev *mpp, in rkvdec_prepare_with_reset() argument
865 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_prepare_with_reset()
867 spin_lock_irqsave(&mpp->queue->running_lock, flags); in rkvdec_prepare_with_reset()
868 out_task = list_empty(&mpp->queue->running_list) ? mpp_task : NULL; in rkvdec_prepare_with_reset()
869 spin_unlock_irqrestore(&mpp->queue->running_lock, flags); in rkvdec_prepare_with_reset()
880 mpp_power_on(mpp); in rkvdec_prepare_with_reset()
881 mpp_dev_reset(mpp); in rkvdec_prepare_with_reset()
882 mpp_power_off(mpp); in rkvdec_prepare_with_reset()
889 static int rkvdec_run(struct mpp_dev *mpp, in rkvdec_run() argument
895 u32 timing_en = mpp->srv->timing_en; in rkvdec_run()
911 mpp_write_relaxed(mpp, RKVDEC_REG_CACHE0_SIZE_BASE, reg); in rkvdec_run()
912 mpp_write_relaxed(mpp, RKVDEC_REG_CACHE1_SIZE_BASE, reg); in rkvdec_run()
914 mpp_write_relaxed(mpp, RKVDEC_REG_CLR_CACHE0_BASE, 1); in rkvdec_run()
915 mpp_write_relaxed(mpp, RKVDEC_REG_CLR_CACHE1_BASE, 1); in rkvdec_run()
923 mpp_write_req(mpp, task->reg, s, e, reg_en); in rkvdec_run()
926 mpp->cur_task = mpp_task; in rkvdec_run()
930 mpp_write(mpp, RKVDEC_REG_INT_EN, in rkvdec_run()
944 static int rkvdec_3328_run(struct mpp_dev *mpp, in rkvdec_3328_run() argument
963 mpp_write_relaxed(mpp, RKVDEC_POWER_CTL_BASE, in rkvdec_3328_run()
967 rkvdec_run(mpp, mpp_task); in rkvdec_3328_run()
974 static int rkvdec_1126_run(struct mpp_dev *mpp, struct mpp_task *mpp_task) in rkvdec_1126_run() argument
979 mpp_iommu_flush_tlb(mpp->iommu_info); in rkvdec_1126_run()
981 return rkvdec_run(mpp, mpp_task); in rkvdec_1126_run()
984 static int rkvdec_px30_run(struct mpp_dev *mpp, in rkvdec_px30_run() argument
987 mpp_iommu_flush_tlb(mpp->iommu_info); in rkvdec_px30_run()
988 return rkvdec_run(mpp, mpp_task); in rkvdec_px30_run()
991 static int rkvdec_irq(struct mpp_dev *mpp) in rkvdec_irq() argument
993 mpp->irq_status = mpp_read(mpp, RKVDEC_REG_INT_EN); in rkvdec_irq()
994 if (!(mpp->irq_status & RKVDEC_DEC_INT_RAW)) in rkvdec_irq()
997 mpp_write(mpp, RKVDEC_REG_INT_EN, 0); in rkvdec_irq()
1002 static int rkvdec_isr(struct mpp_dev *mpp) in rkvdec_isr() argument
1006 struct mpp_task *mpp_task = mpp->cur_task; in rkvdec_isr()
1011 dev_err(mpp->dev, "no current task\n"); in rkvdec_isr()
1015 mpp->cur_task = NULL; in rkvdec_isr()
1017 task->irq_status = mpp->irq_status; in rkvdec_isr()
1029 atomic_inc(&mpp->reset_request); in rkvdec_isr()
1041 static int rkvdec_3328_isr(struct mpp_dev *mpp) in rkvdec_3328_isr() argument
1045 struct mpp_task *mpp_task = mpp->cur_task; in rkvdec_3328_isr()
1046 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_3328_isr()
1051 dev_err(mpp->dev, "no current task\n"); in rkvdec_3328_isr()
1055 mpp->cur_task = NULL; in rkvdec_3328_isr()
1057 task->irq_status = mpp->irq_status; in rkvdec_3328_isr()
1066 atomic_inc(&mpp->reset_request); in rkvdec_3328_isr()
1070 iommu_unmap(mpp->iommu_info->domain, dec->aux_iova, IOMMU_PAGE_SIZE); in rkvdec_3328_isr()
1080 static int rkvdec_finish(struct mpp_dev *mpp, in rkvdec_finish() argument
1100 mpp_read_req(mpp, task->reg, s, e); in rkvdec_finish()
1105 dec_get = mpp_read_relaxed(mpp, RKVDEC_REG_RLC_BASE); in rkvdec_finish()
1120 static int rkvdec_finish_with_record_info(struct mpp_dev *mpp, in rkvdec_finish_with_record_info() argument
1123 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_finish_with_record_info()
1126 rkvdec_finish(mpp, mpp_task); in rkvdec_finish_with_record_info()
1128 dec->had_reset = (atomic_read(&mpp->reset_request) > 0) ? true : false; in rkvdec_finish_with_record_info()
1133 static int rkvdec_result(struct mpp_dev *mpp, in rkvdec_result() argument
1168 static int rkvdec_procfs_remove(struct mpp_dev *mpp) in rkvdec_procfs_remove() argument
1170 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_procfs_remove()
1180 static int rkvdec_procfs_init(struct mpp_dev *mpp) in rkvdec_procfs_init() argument
1182 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_procfs_init()
1184 dec->procfs = proc_mkdir(mpp->dev->of_node->name, mpp->srv->procfs); in rkvdec_procfs_init()
1192 mpp_procfs_create_common(dec->procfs, mpp); in rkvdec_procfs_init()
1203 dec->procfs, &mpp->session_max_buffers); in rkvdec_procfs_init()
1208 static inline int rkvdec_procfs_remove(struct mpp_dev *mpp) in rkvdec_procfs_remove() argument
1213 static inline int rkvdec_procfs_init(struct mpp_dev *mpp) in rkvdec_procfs_init() argument
1219 static int rkvdec_init(struct mpp_dev *mpp) in rkvdec_init() argument
1222 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_init()
1225 mpp->grf_info = &mpp->srv->grf_infos[MPP_DRIVER_RKVDEC]; in rkvdec_init()
1228 ret = mpp_get_clk_info(mpp, &dec->aclk_info, "aclk_vcodec"); in rkvdec_init()
1231 ret = mpp_get_clk_info(mpp, &dec->hclk_info, "hclk_vcodec"); in rkvdec_init()
1234 ret = mpp_get_clk_info(mpp, &dec->core_clk_info, "clk_core"); in rkvdec_init()
1237 ret = mpp_get_clk_info(mpp, &dec->cabac_clk_info, "clk_cabac"); in rkvdec_init()
1240 ret = mpp_get_clk_info(mpp, &dec->hevc_cabac_clk_info, "clk_hevc_cabac"); in rkvdec_init()
1250 of_property_read_u32(mpp->dev->of_node, in rkvdec_init()
1253 dec->rst_a = mpp_reset_control_get(mpp, RST_TYPE_A, "video_a"); in rkvdec_init()
1256 dec->rst_h = mpp_reset_control_get(mpp, RST_TYPE_H, "video_h"); in rkvdec_init()
1259 dec->rst_niu_a = mpp_reset_control_get(mpp, RST_TYPE_NIU_A, "niu_a"); in rkvdec_init()
1262 dec->rst_niu_h = mpp_reset_control_get(mpp, RST_TYPE_NIU_H, "niu_h"); in rkvdec_init()
1265 dec->rst_core = mpp_reset_control_get(mpp, RST_TYPE_CORE, "video_core"); in rkvdec_init()
1268 dec->rst_cabac = mpp_reset_control_get(mpp, RST_TYPE_CABAC, "video_cabac"); in rkvdec_init()
1271 dec->rst_hevc_cabac = mpp_reset_control_get(mpp, RST_TYPE_HEVC_CABAC, "video_hevc_cabac"); in rkvdec_init()
1278 static int rkvdec_px30_init(struct mpp_dev *mpp) in rkvdec_px30_init() argument
1280 rkvdec_init(mpp); in rkvdec_px30_init()
1281 return px30_workaround_combo_init(mpp); in rkvdec_px30_init()
1284 static int rkvdec_3036_init(struct mpp_dev *mpp) in rkvdec_3036_init() argument
1286 rkvdec_init(mpp); in rkvdec_3036_init()
1287 set_bit(mpp->var->device_type, &mpp->queue->dev_active_flags); in rkvdec_3036_init()
1297 struct mpp_dev *mpp = (struct mpp_dev *)arg; in rkvdec_3328_iommu_hdl() local
1298 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_3328_iommu_hdl()
1308 iommu_unmap(mpp->iommu_info->domain, dec->aux_iova, IOMMU_PAGE_SIZE); in rkvdec_3328_iommu_hdl()
1313 ret = iommu_map(mpp->iommu_info->domain, page_iova, in rkvdec_3328_iommu_hdl()
1324 static int rkvdec_devfreq_remove(struct mpp_dev *mpp) in rkvdec_devfreq_remove() argument
1326 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_devfreq_remove()
1328 devfreq_unregister_opp_notifier(mpp->dev, dec->devfreq); in rkvdec_devfreq_remove()
1329 dev_pm_opp_of_remove_table(mpp->dev); in rkvdec_devfreq_remove()
1334 static int rkvdec_devfreq_init(struct mpp_dev *mpp) in rkvdec_devfreq_init() argument
1338 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_devfreq_init()
1341 dec->parent_devfreq = devfreq_get_devfreq_by_phandle(mpp->dev, "rkvdec_devfreq", 0); in rkvdec_devfreq_init()
1344 dev_warn(mpp->dev, "parent devfreq is not ready, retry\n"); in rkvdec_devfreq_init()
1350 devm_devfreq_register_notifier(mpp->dev, in rkvdec_devfreq_init()
1356 dec->vdd = devm_regulator_get_optional(mpp->dev, "vcodec"); in rkvdec_devfreq_init()
1359 dev_warn(mpp->dev, "vcodec regulator not ready, retry\n"); in rkvdec_devfreq_init()
1363 dev_warn(mpp->dev, "no regulator for vcodec\n"); in rkvdec_devfreq_init()
1368 ret = rockchip_init_opp_table(mpp->dev, NULL, in rkvdec_devfreq_init()
1371 dev_err(mpp->dev, "Failed to init_opp_table\n"); in rkvdec_devfreq_init()
1374 dec->devfreq = devm_devfreq_add_device(mpp->dev, &devfreq_profile, in rkvdec_devfreq_init()
1384 ret = devfreq_register_opp_notifier(mpp->dev, dec->devfreq); in rkvdec_devfreq_init()
1389 ret = power_model_simple_init(mpp); in rkvdec_devfreq_init()
1392 of_devfreq_cooling_register_power(mpp->dev->of_node, in rkvdec_devfreq_init()
1397 dev_err(mpp->dev, "Failed to register cooling\n"); in rkvdec_devfreq_init()
1406 static inline int rkvdec_devfreq_remove(struct mpp_dev *mpp) in rkvdec_devfreq_remove() argument
1411 static inline int rkvdec_devfreq_init(struct mpp_dev *mpp) in rkvdec_devfreq_init() argument
1417 static int rkvdec_3328_init(struct mpp_dev *mpp) in rkvdec_3328_init() argument
1420 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_3328_init()
1422 rkvdec_init(mpp); in rkvdec_3328_init()
1427 dev_err(mpp->dev, "allocate a page for auxiliary usage\n"); in rkvdec_3328_init()
1432 mpp->iommu_info->hdl = rkvdec_3328_iommu_hdl; in rkvdec_3328_init()
1434 ret = rkvdec_devfreq_init(mpp); in rkvdec_3328_init()
1439 static int rkvdec_3328_exit(struct mpp_dev *mpp) in rkvdec_3328_exit() argument
1441 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_3328_exit()
1447 iommu_unmap(mpp->iommu_info->domain, dec->aux_iova, IOMMU_PAGE_SIZE); in rkvdec_3328_exit()
1450 rkvdec_devfreq_remove(mpp); in rkvdec_3328_exit()
1455 static int rkvdec_clk_on(struct mpp_dev *mpp) in rkvdec_clk_on() argument
1457 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_clk_on()
1468 static int rkvdec_clk_off(struct mpp_dev *mpp) in rkvdec_clk_off() argument
1470 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_clk_off()
1481 static int rkvdec_get_freq(struct mpp_dev *mpp, in rkvdec_get_freq() argument
1487 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_get_freq()
1497 mutex_lock(&mpp->queue->pending_lock); in rkvdec_get_freq()
1499 &mpp->queue->pending_list, in rkvdec_get_freq()
1506 mutex_unlock(&mpp->queue->pending_lock); in rkvdec_get_freq()
1517 static int rkvdec_3328_get_freq(struct mpp_dev *mpp, in rkvdec_3328_get_freq() argument
1529 rkvdec_get_freq(mpp, mpp_task); in rkvdec_3328_get_freq()
1534 static int rkvdec_3368_set_grf(struct mpp_dev *mpp) in rkvdec_3368_set_grf() argument
1536 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_3368_set_grf()
1538 dec->grf_changed = mpp_grf_is_changed(mpp->grf_info); in rkvdec_3368_set_grf()
1539 mpp_set_grf(mpp->grf_info); in rkvdec_3368_set_grf()
1544 static int rkvdec_3036_set_grf(struct mpp_dev *mpp) in rkvdec_3036_set_grf() argument
1548 struct mpp_taskqueue *queue = mpp->queue; in rkvdec_3036_set_grf()
1551 grf_changed = mpp_grf_is_changed(mpp->grf_info); in rkvdec_3036_set_grf()
1558 pd_is_on = rockchip_pmu_pd_is_on(mpp->dev); in rkvdec_3036_set_grf()
1560 rockchip_pmu_pd_on(mpp->dev); in rkvdec_3036_set_grf()
1561 mpp->hw_ops->clk_on(mpp); in rkvdec_3036_set_grf()
1577 mpp_set_grf(mpp->grf_info); in rkvdec_3036_set_grf()
1578 rockchip_iommu_enable(mpp->dev); in rkvdec_3036_set_grf()
1579 set_bit(mpp->var->device_type, &queue->dev_active_flags); in rkvdec_3036_set_grf()
1581 mpp->hw_ops->clk_off(mpp); in rkvdec_3036_set_grf()
1583 rockchip_pmu_pd_off(mpp->dev); in rkvdec_3036_set_grf()
1590 static int rkvdec_set_freq(struct mpp_dev *mpp, in rkvdec_set_freq() argument
1593 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_set_freq()
1604 static int rkvdec_3368_set_freq(struct mpp_dev *mpp, struct mpp_task *mpp_task) in rkvdec_3368_set_freq() argument
1606 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_3368_set_freq()
1611 mpp_iommu_refresh(mpp->iommu_info, mpp->dev); in rkvdec_3368_set_freq()
1623 static int rkvdec_3328_set_freq(struct mpp_dev *mpp, in rkvdec_3328_set_freq() argument
1626 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_3328_set_freq()
1656 static int rkvdec_reduce_freq(struct mpp_dev *mpp) in rkvdec_reduce_freq() argument
1658 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_reduce_freq()
1668 static int rkvdec_3328_reduce_freq(struct mpp_dev *mpp) in rkvdec_3328_reduce_freq() argument
1670 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_3328_reduce_freq()
1699 static int rkvdec_reset(struct mpp_dev *mpp) in rkvdec_reset() argument
1701 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_reset()
1705 mpp_pmu_idle_request(mpp, true); in rkvdec_reset()
1721 mpp_pmu_idle_request(mpp, false); in rkvdec_reset()
1728 static int rkvdec_sip_reset(struct mpp_dev *mpp) in rkvdec_sip_reset() argument
1732 struct rkvdec_dev *dec = to_rkvdec_dev(mpp); in rkvdec_sip_reset()
1740 return rkvdec_reset(mpp); in rkvdec_sip_reset()
1974 struct mpp_dev *mpp = NULL; in rkvdec_probe() local
1983 mpp = &dec->mpp; in rkvdec_probe()
1984 platform_set_drvdata(pdev, mpp); in rkvdec_probe()
1990 mpp->var = (struct mpp_dev_var *)match->data; in rkvdec_probe()
1993 ret = mpp_dev_probe(mpp, pdev); in rkvdec_probe()
1999 ret = devm_request_threaded_irq(dev, mpp->irq, in rkvdec_probe()
2003 dev_name(dev), mpp); in rkvdec_probe()
2009 mpp->session_max_buffers = RKVDEC_SESSION_MAX_BUFFERS; in rkvdec_probe()
2010 rkvdec_procfs_init(mpp); in rkvdec_probe()
2012 mpp_dev_register_srv(mpp, mpp->srv); in rkvdec_probe()
2024 mpp_dev_remove(&dec->mpp); in rkvdec_remove()
2025 rkvdec_procfs_remove(&dec->mpp); in rkvdec_remove()