summaryrefslogtreecommitdiffstats
path: root/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0018-Fix-Moved-MCLK-setting-to-the-board-file.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0018-Fix-Moved-MCLK-setting-to-the-board-file.patch')
-rw-r--r--extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0018-Fix-Moved-MCLK-setting-to-the-board-file.patch209
1 files changed, 209 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0018-Fix-Moved-MCLK-setting-to-the-board-file.patch b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0018-Fix-Moved-MCLK-setting-to-the-board-file.patch
new file mode 100644
index 00000000..a47ee196
--- /dev/null
+++ b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0018-Fix-Moved-MCLK-setting-to-the-board-file.patch
@@ -0,0 +1,209 @@
1From 6e9a8ed420020b5692b511b3e8a7c2c1325e1ca2 Mon Sep 17 00:00:00 2001
2From: Penda, Naveen <pnaveen@ti.com>
3Date: Thu, 22 Oct 2009 06:07:01 +0530
4Subject: [PATCH 18/75] Fix: Moved MCLK setting to the board file
5
6This patch provides the flexibility to set the MCLK frequency
7 from the board file
8
9Signed-off-by: Naveen Penda <pnaveen@ti.com>
10Signed-off-by: Curran, Dominic <dcurran@ti.com>
11---
12 arch/arm/mach-omap2/board-zoom2-camera.c | 10 ++++++
13 drivers/media/video/isp/isp.c | 51 +++++++++++++++++++----------
14 drivers/media/video/isp/isp.h | 6 +++
15 3 files changed, 49 insertions(+), 18 deletions(-)
16
17diff --git a/arch/arm/mach-omap2/board-zoom2-camera.c b/arch/arm/mach-omap2/board-zoom2-camera.c
18index 1ba2982..8c035c4 100644
19--- a/arch/arm/mach-omap2/board-zoom2-camera.c
20+++ b/arch/arm/mach-omap2/board-zoom2-camera.c
21@@ -41,6 +41,8 @@ static struct device *zoom2cam_dev;
22
23 #define CAMZOOM2_USE_XCLKB 1
24
25+#define ISP_IMX046_MCLK 216000000
26+
27 /* Sensor specific GPIO signals */
28 #define IMX046_RESET_GPIO 98
29 #define IMX046_STANDBY_GPIO 58
30@@ -148,6 +150,7 @@ static struct isp_interface_config imx046_if_config = {
31 .shutter = 0x0,
32 .wenlog = ISPCCDC_CFG_WENLOG_AND,
33 .wait_hs_vs = 2,
34+ .cam_mclk = ISP_IMX046_MCLK,
35 .u.csi.crc = 0x0,
36 .u.csi.mode = 0x0,
37 .u.csi.edge = 0x0,
38@@ -264,6 +267,8 @@ static int imx046_sensor_power_set(struct v4l2_int_device *s, enum v4l2_power po
39 #ifdef CONFIG_OMAP_PM_SRF
40 omap_pm_set_min_bus_tput(vdev->cam->isp, OCP_INITIATOR_AGENT, 0);
41 #endif
42+ if (previous_power != V4L2_POWER_OFF)
43+ isp_disable_mclk(isp);
44 break;
45 case V4L2_POWER_STANDBY:
46 printk(KERN_DEBUG "imx046_sensor_power_set(STANDBY)\n");
47@@ -272,9 +277,14 @@ static int imx046_sensor_power_set(struct v4l2_int_device *s, enum v4l2_power po
48 #ifdef CONFIG_OMAP_PM_SRF
49 omap_pm_set_min_bus_tput(vdev->cam->isp, OCP_INITIATOR_AGENT, 0);
50 #endif
51+
52+
53+ isp_disable_mclk(isp);
54+
55 break;
56 }
57
58+
59 /* Save powerstate to know what was before calling POWER_ON. */
60 previous_power = power;
61 return err;
62diff --git a/drivers/media/video/isp/isp.c b/drivers/media/video/isp/isp.c
63index 9d46c01..cf68720 100644
64--- a/drivers/media/video/isp/isp.c
65+++ b/drivers/media/video/isp/isp.c
66@@ -552,7 +552,7 @@ EXPORT_SYMBOL(isp_unset_callback);
67 * Configures the specified MCLK divisor in the ISP timing control register
68 * (TCTRL_CTRL) to generate the desired xclk clock value.
69 *
70- * Divisor = CM_CAM_MCLK_HZ / xclk
71+ * Divisor = mclk / xclk
72 *
73 * Returns the final frequency that is actually being generated
74 **/
75@@ -560,15 +560,16 @@ u32 isp_set_xclk(struct device *dev, u32 xclk, u8 xclksel)
76 {
77 u32 divisor;
78 u32 currentxclk;
79+ struct isp_device *isp = dev_get_drvdata(dev);
80
81- if (xclk >= CM_CAM_MCLK_HZ) {
82+ if (xclk >= isp->mclk) {
83 divisor = ISPTCTRL_CTRL_DIV_BYPASS;
84- currentxclk = CM_CAM_MCLK_HZ;
85+ currentxclk = isp->mclk;
86 } else if (xclk >= 2) {
87- divisor = CM_CAM_MCLK_HZ / xclk;
88+ divisor = isp->mclk / xclk;
89 if (divisor >= ISPTCTRL_CTRL_DIV_BYPASS)
90 divisor = ISPTCTRL_CTRL_DIV_BYPASS - 1;
91- currentxclk = CM_CAM_MCLK_HZ / divisor;
92+ currentxclk = isp->mclk / divisor;
93 } else {
94 divisor = xclk;
95 currentxclk = 0;
96@@ -874,6 +875,8 @@ int isp_configure_interface(struct device *dev,
97 /* Set sensor specific fields in CCDC and Previewer module. */
98 ispccdc_set_wenlog(&isp->isp_ccdc, config->wenlog);
99
100+ isp->mclk = config->cam_mclk;
101+ isp_enable_mclk(dev);
102 /* FIXME: this should be set in ispccdc_config_vp() */
103 fmtcfg = isp_reg_readl(dev, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_FMTCFG);
104 fmtcfg &= ISPCCDC_FMTCFG_VPIF_FRQ_MASK;
105@@ -2333,16 +2336,6 @@ static int isp_enable_clocks(struct device *dev)
106 dev_err(dev, "clk_enable cam_ick failed\n");
107 goto out_clk_enable_ick;
108 }
109- r = clk_set_rate(isp->dpll4_m5_ck, CM_CAM_MCLK_HZ/2);
110- if (r) {
111- dev_err(dev, "clk_set_rate for dpll4_m5_ck failed\n");
112- goto out_clk_enable_mclk;
113- }
114- r = clk_enable(isp->cam_mclk);
115- if (r) {
116- dev_err(dev, "clk_enable cam_mclk failed\n");
117- goto out_clk_enable_mclk;
118- }
119 r = clk_enable(isp->csi2_fck);
120 if (r) {
121 dev_err(dev, "clk_enable csi2_fck failed\n");
122@@ -2351,13 +2344,34 @@ static int isp_enable_clocks(struct device *dev)
123 return 0;
124
125 out_clk_enable_csi2_fclk:
126- clk_disable(isp->cam_mclk);
127-out_clk_enable_mclk:
128 clk_disable(isp->cam_ick);
129 out_clk_enable_ick:
130 return r;
131 }
132
133+int isp_enable_mclk(struct device *dev)
134+{
135+ struct isp_device *isp = dev_get_drvdata(dev);
136+ int r;
137+
138+ r = clk_set_rate(isp->dpll4_m5_ck, isp->mclk);
139+ if (r) {
140+ dev_err(dev, "clk_set_rate for dpll4_m5_ck failed\n");
141+ return r;
142+ }
143+ r = clk_enable(isp->cam_mclk);
144+ if (r) {
145+ dev_err(dev, "clk_enable cam_mclk failed\n");
146+ return r;
147+ }
148+ return 0;
149+}
150+
151+void isp_disable_mclk(struct isp_device *isp)
152+{
153+ clk_disable(isp->cam_mclk);
154+}
155+
156 /**
157 * isp_disable_clocks - Disable ISP clocks
158 * @dev: Device pointer specific to the OMAP3 ISP.
159@@ -2367,7 +2381,6 @@ static void isp_disable_clocks(struct device *dev)
160 struct isp_device *isp = dev_get_drvdata(dev);
161
162 clk_disable(isp->cam_ick);
163- clk_disable(isp->cam_mclk);
164 clk_disable(isp->csi2_fck);
165 }
166
167@@ -2668,6 +2681,8 @@ static int isp_probe(struct platform_device *pdev)
168 goto out_free_mmio;
169 }
170
171+ isp->mclk = CM_CAM_MCLK_HZ / 2;
172+
173 isp->cam_ick = clk_get(&camera_dev, "cam_ick");
174 if (IS_ERR(isp->cam_ick)) {
175 dev_err(isp->dev, "clk_get cam_ick failed\n");
176diff --git a/drivers/media/video/isp/isp.h b/drivers/media/video/isp/isp.h
177index 6b100b6..85c3fa9 100644
178--- a/drivers/media/video/isp/isp.h
179+++ b/drivers/media/video/isp/isp.h
180@@ -199,6 +199,7 @@ struct isp_interface_config {
181 u32 prev_slv;
182 u32 wenlog;
183 int wait_hs_vs;
184+ u32 cam_mclk;
185 unsigned int pixelclk;
186 union {
187 struct par {
188@@ -425,6 +426,7 @@ struct isp_device {
189 struct isp_irq irq;
190 struct isp_pipeline pipeline;
191 u32 interrupts;
192+ u32 mclk;
193 enum isp_running running;
194 int current_field;
195 int bt656ifen;
196@@ -489,6 +491,10 @@ struct device *isp_get(void);
197
198 int isp_put(void);
199
200+int isp_enable_mclk(struct device *dev);
201+
202+void isp_disable_mclk(struct isp_device *dev);
203+
204 int isp_queryctrl(struct v4l2_queryctrl *a);
205
206 int isp_querymenu(struct v4l2_querymenu *a);
207--
2081.6.6.1
209