Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: mtk-mdp: Get rid of mtk_smi_larb_get/put

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the mdp device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Houlong Wei <houlong.wei@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Yong Wu and committed by
Mauro Carvalho Chehab
682c3cd8 ba3cd671

-43
-40
drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
··· 9 9 #include <linux/of.h> 10 10 #include <linux/of_address.h> 11 11 #include <linux/of_platform.h> 12 - #include <soc/mediatek/smi.h> 13 12 14 13 #include "mtk_mdp_comp.h" 15 14 ··· 16 17 void mtk_mdp_comp_clock_on(struct device *dev, struct mtk_mdp_comp *comp) 17 18 { 18 19 int i, err; 19 - 20 - if (comp->larb_dev) { 21 - err = mtk_smi_larb_get(comp->larb_dev); 22 - if (err) 23 - dev_err(dev, 24 - "failed to get larb, err %d. type:%d\n", 25 - err, comp->type); 26 - } 27 20 28 21 for (i = 0; i < ARRAY_SIZE(comp->clk); i++) { 29 22 if (IS_ERR(comp->clk[i])) ··· 37 46 continue; 38 47 clk_disable_unprepare(comp->clk[i]); 39 48 } 40 - 41 - if (comp->larb_dev) 42 - mtk_smi_larb_put(comp->larb_dev); 43 49 } 44 50 45 51 int mtk_mdp_comp_init(struct device *dev, struct device_node *node, 46 52 struct mtk_mdp_comp *comp, 47 53 enum mtk_mdp_comp_type comp_type) 48 54 { 49 - struct device_node *larb_node; 50 - struct platform_device *larb_pdev; 51 55 int ret; 52 56 int i; 53 57 ··· 62 76 if (comp->type != MTK_MDP_RDMA) 63 77 break; 64 78 } 65 - 66 - /* Only DMA capable components need the LARB property */ 67 - comp->larb_dev = NULL; 68 - if (comp->type != MTK_MDP_RDMA && 69 - comp->type != MTK_MDP_WDMA && 70 - comp->type != MTK_MDP_WROT) 71 - return 0; 72 - 73 - larb_node = of_parse_phandle(node, "mediatek,larb", 0); 74 - if (!larb_node) { 75 - dev_err(dev, 76 - "Missing mediadek,larb phandle in %pOF node\n", node); 77 - ret = -EINVAL; 78 - goto put_dev; 79 - } 80 - 81 - larb_pdev = of_find_device_by_node(larb_node); 82 - if (!larb_pdev) { 83 - dev_warn(dev, "Waiting for larb device %pOF\n", larb_node); 84 - of_node_put(larb_node); 85 - ret = -EPROBE_DEFER; 86 - goto put_dev; 87 - } 88 - of_node_put(larb_node); 89 - 90 - comp->larb_dev = &larb_pdev->dev; 91 79 92 80 return 0; 93 81
-2
drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
··· 26 26 * @node: list node to track sibing MDP components 27 27 * @dev_node: component device node 28 28 * @clk: clocks required for component 29 - * @larb_dev: SMI device required for component 30 29 * @type: component type 31 30 */ 32 31 struct mtk_mdp_comp { 33 32 struct list_head node; 34 33 struct device_node *dev_node; 35 34 struct clk *clk[2]; 36 - struct device *larb_dev; 37 35 enum mtk_mdp_comp_type type; 38 36 }; 39 37
-1
drivers/media/platform/mtk-mdp/mtk_mdp_core.c
··· 17 17 #include <linux/platform_device.h> 18 18 #include <linux/pm_runtime.h> 19 19 #include <linux/workqueue.h> 20 - #include <soc/mediatek/smi.h> 21 20 22 21 #include "mtk_mdp_core.h" 23 22 #include "mtk_mdp_m2m.h"