diff options
Diffstat (limited to 'drivers/media/platform/exynos4-is')
-rw-r--r-- | drivers/media/platform/exynos4-is/fimc-is-regs.c | 2 | ||||
-rw-r--r-- | drivers/media/platform/exynos4-is/fimc-is.c | 48 | ||||
-rw-r--r-- | drivers/media/platform/exynos4-is/fimc-is.h | 2 | ||||
-rw-r--r-- | drivers/media/platform/exynos4-is/fimc-isp.c | 4 | ||||
-rw-r--r-- | drivers/media/platform/exynos4-is/mipi-csis.c | 2 |
5 files changed, 22 insertions, 36 deletions
diff --git a/drivers/media/platform/exynos4-is/fimc-is-regs.c b/drivers/media/platform/exynos4-is/fimc-is-regs.c index b0ff67bc1b05..d05eaa2c8490 100644 --- a/drivers/media/platform/exynos4-is/fimc-is-regs.c +++ b/drivers/media/platform/exynos4-is/fimc-is-regs.c | |||
@@ -174,7 +174,7 @@ int fimc_is_hw_change_mode(struct fimc_is *is) | |||
174 | HIC_CAPTURE_STILL, HIC_CAPTURE_VIDEO, | 174 | HIC_CAPTURE_STILL, HIC_CAPTURE_VIDEO, |
175 | }; | 175 | }; |
176 | 176 | ||
177 | if (WARN_ON(is->config_index > ARRAY_SIZE(cmd))) | 177 | if (WARN_ON(is->config_index >= ARRAY_SIZE(cmd))) |
178 | return -EINVAL; | 178 | return -EINVAL; |
179 | 179 | ||
180 | mcuctl_write(cmd[is->config_index], is, MCUCTL_REG_ISSR(0)); | 180 | mcuctl_write(cmd[is->config_index], is, MCUCTL_REG_ISSR(0)); |
diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 47c6363d04e2..0741945b79ed 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c | |||
@@ -48,7 +48,6 @@ static char *fimc_is_clocks[ISS_CLKS_MAX] = { | |||
48 | [ISS_CLK_LITE0] = "lite0", | 48 | [ISS_CLK_LITE0] = "lite0", |
49 | [ISS_CLK_LITE1] = "lite1", | 49 | [ISS_CLK_LITE1] = "lite1", |
50 | [ISS_CLK_MPLL] = "mpll", | 50 | [ISS_CLK_MPLL] = "mpll", |
51 | [ISS_CLK_SYSREG] = "sysreg", | ||
52 | [ISS_CLK_ISP] = "isp", | 51 | [ISS_CLK_ISP] = "isp", |
53 | [ISS_CLK_DRC] = "drc", | 52 | [ISS_CLK_DRC] = "drc", |
54 | [ISS_CLK_FD] = "fd", | 53 | [ISS_CLK_FD] = "fd", |
@@ -71,7 +70,6 @@ static void fimc_is_put_clocks(struct fimc_is *is) | |||
71 | for (i = 0; i < ISS_CLKS_MAX; i++) { | 70 | for (i = 0; i < ISS_CLKS_MAX; i++) { |
72 | if (IS_ERR(is->clocks[i])) | 71 | if (IS_ERR(is->clocks[i])) |
73 | continue; | 72 | continue; |
74 | clk_unprepare(is->clocks[i]); | ||
75 | clk_put(is->clocks[i]); | 73 | clk_put(is->clocks[i]); |
76 | is->clocks[i] = ERR_PTR(-EINVAL); | 74 | is->clocks[i] = ERR_PTR(-EINVAL); |
77 | } | 75 | } |
@@ -90,12 +88,6 @@ static int fimc_is_get_clocks(struct fimc_is *is) | |||
90 | ret = PTR_ERR(is->clocks[i]); | 88 | ret = PTR_ERR(is->clocks[i]); |
91 | goto err; | 89 | goto err; |
92 | } | 90 | } |
93 | ret = clk_prepare(is->clocks[i]); | ||
94 | if (ret < 0) { | ||
95 | clk_put(is->clocks[i]); | ||
96 | is->clocks[i] = ERR_PTR(-EINVAL); | ||
97 | goto err; | ||
98 | } | ||
99 | } | 91 | } |
100 | 92 | ||
101 | return 0; | 93 | return 0; |
@@ -103,7 +95,7 @@ err: | |||
103 | fimc_is_put_clocks(is); | 95 | fimc_is_put_clocks(is); |
104 | dev_err(&is->pdev->dev, "failed to get clock: %s\n", | 96 | dev_err(&is->pdev->dev, "failed to get clock: %s\n", |
105 | fimc_is_clocks[i]); | 97 | fimc_is_clocks[i]); |
106 | return -ENXIO; | 98 | return ret; |
107 | } | 99 | } |
108 | 100 | ||
109 | static int fimc_is_setup_clocks(struct fimc_is *is) | 101 | static int fimc_is_setup_clocks(struct fimc_is *is) |
@@ -144,7 +136,7 @@ int fimc_is_enable_clocks(struct fimc_is *is) | |||
144 | for (i = 0; i < ISS_GATE_CLKS_MAX; i++) { | 136 | for (i = 0; i < ISS_GATE_CLKS_MAX; i++) { |
145 | if (IS_ERR(is->clocks[i])) | 137 | if (IS_ERR(is->clocks[i])) |
146 | continue; | 138 | continue; |
147 | ret = clk_enable(is->clocks[i]); | 139 | ret = clk_prepare_enable(is->clocks[i]); |
148 | if (ret < 0) { | 140 | if (ret < 0) { |
149 | dev_err(&is->pdev->dev, "clock %s enable failed\n", | 141 | dev_err(&is->pdev->dev, "clock %s enable failed\n", |
150 | fimc_is_clocks[i]); | 142 | fimc_is_clocks[i]); |
@@ -163,7 +155,7 @@ void fimc_is_disable_clocks(struct fimc_is *is) | |||
163 | 155 | ||
164 | for (i = 0; i < ISS_GATE_CLKS_MAX; i++) { | 156 | for (i = 0; i < ISS_GATE_CLKS_MAX; i++) { |
165 | if (!IS_ERR(is->clocks[i])) { | 157 | if (!IS_ERR(is->clocks[i])) { |
166 | clk_disable(is->clocks[i]); | 158 | clk_disable_unprepare(is->clocks[i]); |
167 | pr_debug("disabled clock: %s\n", fimc_is_clocks[i]); | 159 | pr_debug("disabled clock: %s\n", fimc_is_clocks[i]); |
168 | } | 160 | } |
169 | } | 161 | } |
@@ -326,6 +318,11 @@ int fimc_is_start_firmware(struct fimc_is *is) | |||
326 | struct device *dev = &is->pdev->dev; | 318 | struct device *dev = &is->pdev->dev; |
327 | int ret; | 319 | int ret; |
328 | 320 | ||
321 | if (is->fw.f_w == NULL) { | ||
322 | dev_err(dev, "firmware is not loaded\n"); | ||
323 | return -EINVAL; | ||
324 | } | ||
325 | |||
329 | memcpy(is->memory.vaddr, is->fw.f_w->data, is->fw.f_w->size); | 326 | memcpy(is->memory.vaddr, is->fw.f_w->data, is->fw.f_w->size); |
330 | wmb(); | 327 | wmb(); |
331 | 328 | ||
@@ -837,23 +834,11 @@ static int fimc_is_probe(struct platform_device *pdev) | |||
837 | goto err_clk; | 834 | goto err_clk; |
838 | } | 835 | } |
839 | pm_runtime_enable(dev); | 836 | pm_runtime_enable(dev); |
840 | /* | ||
841 | * Enable only the ISP power domain, keep FIMC-IS clocks off until | ||
842 | * the whole clock tree is configured. The ISP power domain needs | ||
843 | * be active in order to acces any CMU_ISP clock registers. | ||
844 | */ | ||
845 | ret = pm_runtime_get_sync(dev); | ||
846 | if (ret < 0) | ||
847 | goto err_irq; | ||
848 | |||
849 | ret = fimc_is_setup_clocks(is); | ||
850 | pm_runtime_put_sync(dev); | ||
851 | 837 | ||
838 | ret = pm_runtime_get_sync(dev); | ||
852 | if (ret < 0) | 839 | if (ret < 0) |
853 | goto err_irq; | 840 | goto err_irq; |
854 | 841 | ||
855 | is->clk_init = true; | ||
856 | |||
857 | is->alloc_ctx = vb2_dma_contig_init_ctx(dev); | 842 | is->alloc_ctx = vb2_dma_contig_init_ctx(dev); |
858 | if (IS_ERR(is->alloc_ctx)) { | 843 | if (IS_ERR(is->alloc_ctx)) { |
859 | ret = PTR_ERR(is->alloc_ctx); | 844 | ret = PTR_ERR(is->alloc_ctx); |
@@ -875,6 +860,8 @@ static int fimc_is_probe(struct platform_device *pdev) | |||
875 | if (ret < 0) | 860 | if (ret < 0) |
876 | goto err_dfs; | 861 | goto err_dfs; |
877 | 862 | ||
863 | pm_runtime_put_sync(dev); | ||
864 | |||
878 | dev_dbg(dev, "FIMC-IS registered successfully\n"); | 865 | dev_dbg(dev, "FIMC-IS registered successfully\n"); |
879 | return 0; | 866 | return 0; |
880 | 867 | ||
@@ -894,9 +881,11 @@ err_clk: | |||
894 | static int fimc_is_runtime_resume(struct device *dev) | 881 | static int fimc_is_runtime_resume(struct device *dev) |
895 | { | 882 | { |
896 | struct fimc_is *is = dev_get_drvdata(dev); | 883 | struct fimc_is *is = dev_get_drvdata(dev); |
884 | int ret; | ||
897 | 885 | ||
898 | if (!is->clk_init) | 886 | ret = fimc_is_setup_clocks(is); |
899 | return 0; | 887 | if (ret) |
888 | return ret; | ||
900 | 889 | ||
901 | return fimc_is_enable_clocks(is); | 890 | return fimc_is_enable_clocks(is); |
902 | } | 891 | } |
@@ -905,9 +894,7 @@ static int fimc_is_runtime_suspend(struct device *dev) | |||
905 | { | 894 | { |
906 | struct fimc_is *is = dev_get_drvdata(dev); | 895 | struct fimc_is *is = dev_get_drvdata(dev); |
907 | 896 | ||
908 | if (is->clk_init) | 897 | fimc_is_disable_clocks(is); |
909 | fimc_is_disable_clocks(is); | ||
910 | |||
911 | return 0; | 898 | return 0; |
912 | } | 899 | } |
913 | 900 | ||
@@ -941,7 +928,8 @@ static int fimc_is_remove(struct platform_device *pdev) | |||
941 | vb2_dma_contig_cleanup_ctx(is->alloc_ctx); | 928 | vb2_dma_contig_cleanup_ctx(is->alloc_ctx); |
942 | fimc_is_put_clocks(is); | 929 | fimc_is_put_clocks(is); |
943 | fimc_is_debugfs_remove(is); | 930 | fimc_is_debugfs_remove(is); |
944 | release_firmware(is->fw.f_w); | 931 | if (is->fw.f_w) |
932 | release_firmware(is->fw.f_w); | ||
945 | fimc_is_free_cpu_memory(is); | 933 | fimc_is_free_cpu_memory(is); |
946 | 934 | ||
947 | return 0; | 935 | return 0; |
diff --git a/drivers/media/platform/exynos4-is/fimc-is.h b/drivers/media/platform/exynos4-is/fimc-is.h index f5275a5b0156..d7db133b493f 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.h +++ b/drivers/media/platform/exynos4-is/fimc-is.h | |||
@@ -73,7 +73,6 @@ enum { | |||
73 | ISS_CLK_LITE0, | 73 | ISS_CLK_LITE0, |
74 | ISS_CLK_LITE1, | 74 | ISS_CLK_LITE1, |
75 | ISS_CLK_MPLL, | 75 | ISS_CLK_MPLL, |
76 | ISS_CLK_SYSREG, | ||
77 | ISS_CLK_ISP, | 76 | ISS_CLK_ISP, |
78 | ISS_CLK_DRC, | 77 | ISS_CLK_DRC, |
79 | ISS_CLK_FD, | 78 | ISS_CLK_FD, |
@@ -265,7 +264,6 @@ struct fimc_is { | |||
265 | spinlock_t slock; | 264 | spinlock_t slock; |
266 | 265 | ||
267 | struct clk *clocks[ISS_CLKS_MAX]; | 266 | struct clk *clocks[ISS_CLKS_MAX]; |
268 | bool clk_init; | ||
269 | void __iomem *regs; | 267 | void __iomem *regs; |
270 | void __iomem *pmu_regs; | 268 | void __iomem *pmu_regs; |
271 | int irq; | 269 | int irq; |
diff --git a/drivers/media/platform/exynos4-is/fimc-isp.c b/drivers/media/platform/exynos4-is/fimc-isp.c index d63947f7b302..7ede30b5910f 100644 --- a/drivers/media/platform/exynos4-is/fimc-isp.c +++ b/drivers/media/platform/exynos4-is/fimc-isp.c | |||
@@ -138,7 +138,7 @@ static int fimc_isp_subdev_get_fmt(struct v4l2_subdev *sd, | |||
138 | return 0; | 138 | return 0; |
139 | } | 139 | } |
140 | 140 | ||
141 | mf->colorspace = V4L2_COLORSPACE_JPEG; | 141 | mf->colorspace = V4L2_COLORSPACE_SRGB; |
142 | 142 | ||
143 | mutex_lock(&isp->subdev_lock); | 143 | mutex_lock(&isp->subdev_lock); |
144 | __is_get_frame_size(is, &cur_fmt); | 144 | __is_get_frame_size(is, &cur_fmt); |
@@ -194,7 +194,7 @@ static int fimc_isp_subdev_set_fmt(struct v4l2_subdev *sd, | |||
194 | v4l2_dbg(1, debug, sd, "%s: pad%d: code: 0x%x, %dx%d\n", | 194 | v4l2_dbg(1, debug, sd, "%s: pad%d: code: 0x%x, %dx%d\n", |
195 | __func__, fmt->pad, mf->code, mf->width, mf->height); | 195 | __func__, fmt->pad, mf->code, mf->width, mf->height); |
196 | 196 | ||
197 | mf->colorspace = V4L2_COLORSPACE_JPEG; | 197 | mf->colorspace = V4L2_COLORSPACE_SRGB; |
198 | 198 | ||
199 | mutex_lock(&isp->subdev_lock); | 199 | mutex_lock(&isp->subdev_lock); |
200 | __isp_subdev_try_format(isp, fmt); | 200 | __isp_subdev_try_format(isp, fmt); |
diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c index a2eda9d5ac87..254d70fe762a 100644 --- a/drivers/media/platform/exynos4-is/mipi-csis.c +++ b/drivers/media/platform/exynos4-is/mipi-csis.c | |||
@@ -746,7 +746,7 @@ static int s5pcsis_parse_dt(struct platform_device *pdev, | |||
746 | node = v4l2_of_get_next_endpoint(node, NULL); | 746 | node = v4l2_of_get_next_endpoint(node, NULL); |
747 | if (!node) { | 747 | if (!node) { |
748 | dev_err(&pdev->dev, "No port node at %s\n", | 748 | dev_err(&pdev->dev, "No port node at %s\n", |
749 | node->full_name); | 749 | pdev->dev.of_node->full_name); |
750 | return -EINVAL; | 750 | return -EINVAL; |
751 | } | 751 | } |
752 | /* Get port node and validate MIPI-CSI channel id. */ | 752 | /* Get port node and validate MIPI-CSI channel id. */ |