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

Configure Feed

Select the types of activity you want to include in your feed.

media: exynos4-is: fimc-is: replace duplicate pmu node with phandle

Devicetree for the FIMC IS camera included duplicated PMU node as its
child like:

soc@0 {
system-controller@10020000 { ... }; // Real PMU

camera@11800000 {
fimc-is@12000000 {
// FIMC IS camera node
pmu@10020000 {
reg = <0x10020000 0x3000>; // Fake PMU node
};
};
};
};

This is not a correct representation of the hardware. Mapping the PMU
(Power Management Unit) IO memory should be via syscon-like phandle
(samsung,pmu-syscon, already used for other drivers), not by duplicating
"pmu" Devicetree node inside the FIMC IS. Backward compatibility is
preserved.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Krzysztof Kozlowski and committed by
Hans Verkuil
292f83dc 6c378c24

+24 -9
+24 -9
drivers/media/platform/samsung/exynos4-is/fimc-is.c
··· 767 767 static int fimc_is_runtime_resume(struct device *dev); 768 768 static int fimc_is_runtime_suspend(struct device *dev); 769 769 770 + static void __iomem *fimc_is_get_pmu_regs(struct device *dev) 771 + { 772 + struct device_node *node; 773 + void __iomem *regs; 774 + 775 + node = of_parse_phandle(dev->of_node, "samsung,pmu-syscon", 0); 776 + if (!node) { 777 + node = of_get_child_by_name(dev->of_node, "pmu"); 778 + if (!node) 779 + return IOMEM_ERR_PTR(-ENODEV); 780 + dev_warn(dev, "Found PMU node via deprecated method, update your DTB\n"); 781 + } 782 + 783 + regs = of_iomap(node, 0); 784 + of_node_put(node); 785 + if (!regs) 786 + return IOMEM_ERR_PTR(-ENOMEM); 787 + 788 + return regs; 789 + } 790 + 770 791 static int fimc_is_probe(struct platform_device *pdev) 771 792 { 772 793 struct device *dev = &pdev->dev; 773 794 struct fimc_is *is; 774 795 struct resource res; 775 - struct device_node *node; 776 796 int ret; 777 797 778 798 is = devm_kzalloc(&pdev->dev, sizeof(*is), GFP_KERNEL); ··· 814 794 if (IS_ERR(is->regs)) 815 795 return PTR_ERR(is->regs); 816 796 817 - node = of_get_child_by_name(dev->of_node, "pmu"); 818 - if (!node) 819 - return -ENODEV; 820 - 821 - is->pmu_regs = of_iomap(node, 0); 822 - of_node_put(node); 823 - if (!is->pmu_regs) 824 - return -ENOMEM; 797 + is->pmu_regs = fimc_is_get_pmu_regs(dev); 798 + if (IS_ERR(is->pmu_regs)) 799 + return PTR_ERR(is->pmu_regs); 825 800 826 801 is->irq = irq_of_parse_and_map(dev->of_node, 0); 827 802 if (!is->irq) {