summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-omap-psp-2.6.32/cam/0017-omap3isp-set-CAM_MCLK-to-172.8-MHz-allows-exact-9.6-.patch
blob: 77e5c1515dcc60f2cefdf3cc31ce371b4c759bcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
From da7a0c9d99ac42332cab5fcc961006a56531e1c4 Mon Sep 17 00:00:00 2001
From: Tuukka Toivonen <tuukka.o.toivonen@nokia.com>
Date: Thu, 2 Jul 2009 16:17:55 +0200
Subject: [PATCH 17/71] omap3isp: set CAM_MCLK to 172.8 MHz, allows exact 9.6 MHz for camera xclka/b

Camera cam_xclka and cam_xclkb clocks are generated by dividing
CAM_MCLK with an integer. We want to use 9.6 MHz for cameras,
so CAM_MCLK should be multiple of it. Otherwise the generated
frequency is slightly off due to rounding.

Signed-off-by: Tuukka Toivonen <tuukka.o.toivonen@nokia.com>
---
 drivers/media/video/isp/isp.c    |   14 ++++++++++++++
 drivers/media/video/isp/isp.h    |    1 +
 drivers/media/video/isp/ispreg.h |    2 +-
 3 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/isp/isp.c b/drivers/media/video/isp/isp.c
index ceed870..9d46c01 100644
--- a/drivers/media/video/isp/isp.c
+++ b/drivers/media/video/isp/isp.c
@@ -2333,6 +2333,11 @@ static int isp_enable_clocks(struct device *dev)
 		dev_err(dev, "clk_enable cam_ick failed\n");
 		goto out_clk_enable_ick;
 	}
+	r = clk_set_rate(isp->dpll4_m5_ck, CM_CAM_MCLK_HZ/2);
+	if (r) {
+		dev_err(dev, "clk_set_rate for dpll4_m5_ck failed\n");
+		goto out_clk_enable_mclk;
+	}
 	r = clk_enable(isp->cam_mclk);
 	if (r) {
 		dev_err(dev, "clk_enable cam_mclk failed\n");
@@ -2499,6 +2504,7 @@ static int isp_remove(struct platform_device *pdev)
 
 	clk_put(isp->cam_ick);
 	clk_put(isp->cam_mclk);
+	clk_put(isp->dpll4_m5_ck);
 	clk_put(isp->csi2_fck);
 	clk_put(isp->l3_ick);
 
@@ -2674,6 +2680,12 @@ static int isp_probe(struct platform_device *pdev)
 		ret_err = PTR_ERR(isp->cam_mclk);
 		goto out_clk_get_mclk;
 	}
+	isp->dpll4_m5_ck = clk_get(&camera_dev, "dpll4_m5_ck");
+	if (IS_ERR(isp->dpll4_m5_ck)) {
+		dev_err(isp->dev, "clk_get dpll4_m5_ck failed\n");
+		ret_err = PTR_ERR(isp->dpll4_m5_ck);
+		goto out_clk_get_dpll4_m5_ck;
+	}
 	isp->csi2_fck = clk_get(&camera_dev, "csi2_96m_fck");
 	if (IS_ERR(isp->csi2_fck)) {
 		dev_err(isp->dev, "clk_get csi2_96m_fck failed\n");
@@ -2734,6 +2746,8 @@ out_request_irq:
 out_clk_get_l3_ick:
 	clk_put(isp->csi2_fck);
 out_clk_get_csi2_fclk:
+	clk_put(isp->dpll4_m5_ck);
+out_clk_get_dpll4_m5_ck:
 	clk_put(isp->cam_mclk);
 out_clk_get_mclk:
 	clk_put(isp->cam_ick);
diff --git a/drivers/media/video/isp/isp.h b/drivers/media/video/isp/isp.h
index dc85d61..6b100b6 100644
--- a/drivers/media/video/isp/isp.h
+++ b/drivers/media/video/isp/isp.h
@@ -414,6 +414,7 @@ struct isp_device {
 	int ref_count;
 	struct clk *cam_ick;
 	struct clk *cam_mclk;
+	struct clk *dpll4_m5_ck;
 	struct clk *csi2_fck;
 	struct clk *l3_ick;
 	struct isp_interface_config *config;
diff --git a/drivers/media/video/isp/ispreg.h b/drivers/media/video/isp/ispreg.h
index 676a33d..1240e0e 100644
--- a/drivers/media/video/isp/ispreg.h
+++ b/drivers/media/video/isp/ispreg.h
@@ -116,7 +116,7 @@
 #define ISP_32B_BOUNDARY_BUF		0xFFFFFFE0
 #define ISP_32B_BOUNDARY_OFFSET		0x0000FFE0
 
-#define CM_CAM_MCLK_HZ			216000000
+#define CM_CAM_MCLK_HZ			172800000	/* Hz */
 
 /* ISP Submodules offset */
 
-- 
1.6.6.1