From 70dfc38bd33db3c8d595440d17eefeba4a01e5cc Mon Sep 17 00:00:00 2001 From: Ding Wei Date: Fri, 7 May 2021 17:53:08 +0800 Subject: [PATCH] video: rockchip: mpp: Add property for disable freq set if property set, then it will skip get/set/reduce freq. Change-Id: I56f641807327e9e63b8ebc0c91e79ffb19680b1c Signed-off-by: Ding Wei --- drivers/video/rockchip/mpp/mpp_common.c | 11 +++++++---- drivers/video/rockchip/mpp/mpp_common.h | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/video/rockchip/mpp/mpp_common.c b/drivers/video/rockchip/mpp/mpp_common.c index a55283122379..7710ceb2e7aa 100644 --- a/drivers/video/rockchip/mpp/mpp_common.c +++ b/drivers/video/rockchip/mpp/mpp_common.c @@ -373,7 +373,7 @@ static int mpp_process_task(struct mpp_session *session, task->task_index = atomic_fetch_inc(&mpp->task_index); INIT_DELAYED_WORK(&task->timeout_work, mpp_task_timeout_work); - if (mpp->hw_ops->get_freq) + if (mpp->auto_freq_en && mpp->hw_ops->get_freq) mpp->hw_ops->get_freq(mpp, task); /* @@ -459,7 +459,7 @@ int mpp_dev_reset(struct mpp_dev *mpp) else mpp_set_grf(mpp->grf_info); - if (mpp->hw_ops->reduce_freq) + if (mpp->auto_freq_en && mpp->hw_ops->reduce_freq) mpp->hw_ops->reduce_freq(mpp); /* FIXME lock resource lock of the other devices in combo */ mpp_iommu_down_write(mpp->iommu_info); @@ -522,7 +522,7 @@ static int mpp_task_run(struct mpp_dev *mpp, mpp_debug(DEBUG_TASK_INFO, "pid %d, start hw %s\n", task->session->pid, dev_name(mpp->dev)); - if (mpp->hw_ops->set_freq) + if (mpp->auto_freq_en && mpp->hw_ops->set_freq) mpp->hw_ops->set_freq(mpp, task); /* * TODO: Lock the reader locker of the device resource lock here, @@ -1665,6 +1665,8 @@ int mpp_dev_probe(struct mpp_dev *mpp, struct device_node *np = dev->of_node; struct mpp_hw_info *hw_info = mpp->var->hw_info; + /* Get disable auto frequent flag from dtsi */ + mpp->auto_freq_en = !device_property_read_bool(dev, "rockchip,disable-auto-freq"); /* read link table capacity */ ret = of_property_read_u32(np, "rockchip,task-capacity", &mpp->task_capacity); @@ -1830,7 +1832,8 @@ irqreturn_t mpp_dev_isr_sched(int irq, void *param) irqreturn_t ret = IRQ_NONE; struct mpp_dev *mpp = param; - if (mpp->hw_ops->reduce_freq && + if (mpp->auto_freq_en && + mpp->hw_ops->reduce_freq && list_empty(&mpp->queue->pending_list)) mpp->hw_ops->reduce_freq(mpp); diff --git a/drivers/video/rockchip/mpp/mpp_common.h b/drivers/video/rockchip/mpp/mpp_common.h index e9b5f0b35d3d..6d1fcab59bdc 100644 --- a/drivers/video/rockchip/mpp/mpp_common.h +++ b/drivers/video/rockchip/mpp/mpp_common.h @@ -283,6 +283,8 @@ struct mpp_dev { struct work_struct work; /* task for work queue */ struct workqueue_struct *workq; + /* the flag for get/get/reduce freq */ + bool auto_freq_en; /* * The task capacity is the task queue length that hardware can accept. * Default 1 means normal hardware can only accept one task at once.