@@ -1039,8 +1039,8 @@ void mdp_comp_clock_on(struct device *dev, struct mdp_comp *comp)
{
int i, err;
- if (comp->larb_dev) {
- err = pm_runtime_get_sync(comp->larb_dev);
+ if (comp->comp_dev) {
+ err = pm_runtime_get_sync(comp->comp_dev);
if (err < 0)
dev_err(dev,
"Failed to get larb, err %d. type:%d id:%d\n",
@@ -1068,8 +1068,8 @@ void mdp_comp_clock_off(struct device *dev, struct mdp_comp *comp)
clk_disable_unprepare(comp->clks[i]);
}
- if (comp->larb_dev)
- pm_runtime_put(comp->larb_dev);
+ if (comp->comp_dev)
+ pm_runtime_put(comp->comp_dev);
}
static int mdp_get_subsys_id(struct device *dev, struct device_node *node,
@@ -1153,8 +1153,7 @@ static int mdp_comp_init(struct device *dev, struct mdp_dev *mdp,
struct device_node *node, struct mdp_comp *comp,
enum mdp_comp_id id)
{
- struct device_node *larb_node;
- struct platform_device *larb_pdev;
+ struct platform_device *pdev;
int i;
if (id < 0 || id >= MDP_MAX_COMP_COUNT) {
@@ -1176,29 +1175,22 @@ static int mdp_comp_init(struct device *dev, struct mdp_dev *mdp,
mdp_get_subsys_id(dev, node, comp);
- /* Only DMA capable components need the LARB property */
- comp->larb_dev = NULL;
+ /* Only DMA capable components need the pm control */
+ comp->comp_dev = NULL;
if (comp->type != MDP_COMP_TYPE_RDMA &&
comp->type != MDP_COMP_TYPE_WROT &&
comp->type != MDP_COMP_TYPE_WDMA)
return 0;
- larb_node = of_parse_phandle(node, "mediatek,larb", 0);
- if (!larb_node) {
- dev_err(dev, "Missing mediatek,larb phandle in %pOF node\n",
- node);
- return -EINVAL;
- }
-
- larb_pdev = of_find_device_by_node(larb_node);
- if (!larb_pdev) {
- dev_warn(dev, "Waiting for larb device %pOF\n", larb_node);
- of_node_put(larb_node);
- return -EPROBE_DEFER;
+ pdev = of_find_device_by_node(node);
+ if (!pdev) {
+ dev_warn(dev, "can't find platform device of node:%s\n",
+ node->name);
+ return -ENODEV;
}
- of_node_put(larb_node);
- comp->larb_dev = &larb_pdev->dev;
+ comp->comp_dev = &pdev->dev;
+ pm_runtime_enable(comp->comp_dev);
return 0;
}
@@ -113,7 +113,7 @@ struct mdp_comp {
phys_addr_t reg_base;
u8 subsys_id;
struct clk *clks[2];
- struct device *larb_dev;
+ struct device *comp_dev;
enum mdp_comp_type type;
enum mdp_comp_id id;
u32 alias_id;
@@ -152,7 +152,6 @@ static int mdp_probe(struct platform_device *pdev)
#endif
vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32));
- pm_runtime_enable(dev);
ret = v4l2_device_register(dev, &mdp->v4l2_dev);
if (ret) {
@@ -212,7 +211,7 @@ static int mdp_remove(struct platform_device *pdev)
return 0;
}
-static int __maybe_unused mdp_pm_suspend(struct device *dev)
+static int __maybe_unused mdp_suspend(struct device *dev)
{
struct mdp_dev *mdp = dev_get_drvdata(dev);
int ret;
@@ -222,19 +221,19 @@ static int __maybe_unused mdp_pm_suspend(struct device *dev)
if (atomic_read(&mdp->job_count)) {
ret = wait_event_timeout(mdp->callback_wq,
!atomic_read(&mdp->job_count),
- HZ);
- if (ret == 0)
+ 2 * HZ);
+ if (ret == 0) {
dev_err(dev,
- "%s:flushed cmdq task incomplete\n",
- __func__);
- else//need to remove
- pr_err("%s:ret=%d\n", __func__, ret);
+ "%s:flushed cmdq task incomplete, count=%d\n",
+ __func__, atomic_read(&mdp->job_count));
+ return -EBUSY;
+ }
}
return 0;
}
-static int __maybe_unused mdp_pm_resume(struct device *dev)
+static int __maybe_unused mdp_resume(struct device *dev)
{
struct mdp_dev *mdp = dev_get_drvdata(dev);
@@ -243,25 +242,8 @@ static int __maybe_unused mdp_pm_resume(struct device *dev)
return 0;
}
-static int __maybe_unused mdp_suspend(struct device *dev)
-{
- if (pm_runtime_suspended(dev))
- return 0;
-
- return mdp_pm_suspend(dev);
-}
-
-static int __maybe_unused mdp_resume(struct device *dev)
-{
- if (pm_runtime_suspended(dev))
- return 0;
-
- return mdp_pm_resume(dev);
-}
-
static const struct dev_pm_ops mdp_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(mdp_suspend, mdp_resume)
- SET_RUNTIME_PM_OPS(mdp_pm_suspend, mdp_pm_resume, NULL)
};
static struct platform_driver mdp_driver = {