]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-bsp/linux/linux-omap-psp-2.6.32/cam/0042-omap3beagle-camera-Further-clode-cleanup.patch
linux-omap-psp 2.6.32: sync with .dev
[glsdk/meta-ti-glsdk.git] / recipes-bsp / linux / linux-omap-psp-2.6.32 / cam / 0042-omap3beagle-camera-Further-clode-cleanup.patch
1 From 7f6cbc648dcf2d7805f12e7b56bb2c7b602ca61d Mon Sep 17 00:00:00 2001
2 From: Vaibhav Hiremath <hvaibhav@ti.com>
3 Date: Wed, 14 Jul 2010 19:07:06 +0530
4 Subject: [PATCH 42/75] omap3beagle-camera: Further clode cleanup
6 Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
7 ---
8  arch/arm/mach-omap2/board-omap3beagle-camera.c |   89 ++++--------------------
9  drivers/media/video/isp/isp.h                  |   13 ++++
10  2 files changed, 28 insertions(+), 74 deletions(-)
12 diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c
13 index 8d4e5ab..90eadd0 100644
14 --- a/arch/arm/mach-omap2/board-omap3beagle-camera.c
15 +++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c
16 @@ -46,21 +46,19 @@
17  #include "mux.h"
18  #include "board-omap3beagle-camera.h"
19  
20 -#define MODULE_NAME                    "omap3beaglelmb"
21 +#define MODULE_NAME            "omap3beaglelmb"
22  
23 -#define CAM_USE_XCLKA       0
24 +#define CAM_USE_XCLKA          0
25  
26 -#define ISP_MT9V113_MCLK               216000000
27 +#define ISP_MT9V113_MCLK       216000000
28  
29 -#define LEOPARD_RESET_GPIO             98
30 +#define LEOPARD_RESET_GPIO     98
31  
32  static struct regulator *beagle_mt9v113_1_8v1;
33  static struct regulator *beagle_mt9v113_1_8v2;
34  
35 -#if defined(CONFIG_VIDEO_MT9V113) || defined(CONFIG_VIDEO_MT9V113_MODULE)
36 -
37  /* Arbitrary memory handling limit */
38 -#define MT9V113_BIGGEST_FRAME_BYTE_SIZE        PAGE_ALIGN(2048 * 1536 * 4)
39 +#define MT9V113_MAX_FRAME_SIZE PAGE_ALIGN(640 * 480 * 4)
40  
41  static struct isp_interface_config mt9v113_if_config = {
42         .ccdc_par_ser           = ISP_PARLL,
43 @@ -77,21 +75,6 @@ static struct isp_interface_config mt9v113_if_config = {
44  };
45  
46  static struct v4l2_ifparm mt9v113_ifparm_s = {
47 -#if 0
48 -       .if_type = V4L2_IF_TYPE_RAW,
49 -       .u       = {
50 -               .raw = {
51 -                       .frame_start_on_rising_vs = 1,
52 -                       .bt_sync_correct        = 0,
53 -                       .swap                   = 0,
54 -                       .latch_clk_inv          = 0,
55 -                       .nobt_hs_inv            = 0,    /* active high */
56 -                       .nobt_vs_inv            = 0,    /* active high */
57 -                       .clock_min              = MT9V113_CLK_MIN,
58 -                       .clock_max              = MT9V113_CLK_MAX,
59 -               },
60 -       },
61 -#else
62         .if_type = V4L2_IF_TYPE_YCbCr,
63         .u       = {
64                 .ycbcr = {
65 @@ -99,13 +82,12 @@ static struct v4l2_ifparm mt9v113_ifparm_s = {
66                         .bt_sync_correct        = 0,
67                         .swap                   = 0,
68                         .latch_clk_inv          = 0,
69 -                       .nobt_hs_inv            = 0,    /* active high */
70 -                       .nobt_vs_inv            = 0,    /* active high */
71 +                       .nobt_hs_inv            = 0,
72 +                       .nobt_vs_inv            = 0,
73                         .clock_min              = MT9V113_CLK_MIN,
74                         .clock_max              = MT9V113_CLK_MAX,
75                 },
76         },
77 -#endif
78  };
79  
80  /**
81 @@ -124,16 +106,14 @@ static int mt9v113_ifparm(struct v4l2_ifparm *p)
82         return 0;
83  }
84  
85 -#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
86  static struct omap34xxcam_hw_config mt9v113_hwc = {
87         .dev_index              = 0,
88         .dev_minor              = 0,
89         .dev_type               = OMAP34XXCAM_SLAVE_SENSOR,
90         .u.sensor.sensor_isp    = 1,
91 -       .u.sensor.capture_mem   = MT9V113_BIGGEST_FRAME_BYTE_SIZE * 2,
92 +       .u.sensor.capture_mem   = MT9V113_MAX_FRAME_SIZE * 2,
93         .u.sensor.ival_default  = { 1, 10 },
94  };
95 -#endif
96  
97  /**
98   * @brief mt9v113_set_prv_data - Returns mt9v113 omap34xx driver private data
99 @@ -144,7 +124,6 @@ static struct omap34xxcam_hw_config mt9v113_hwc = {
100   */
101  static int mt9v113_set_prv_data(void *priv)
102  {
103 -#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
104         struct omap34xxcam_hw_config *hwc = priv;
105  
106         if (priv == NULL)
107 @@ -154,10 +133,8 @@ static int mt9v113_set_prv_data(void *priv)
108         hwc->dev_index = mt9v113_hwc.dev_index;
109         hwc->dev_minor = mt9v113_hwc.dev_minor;
110         hwc->dev_type = mt9v113_hwc.dev_type;
112         return 0;
113 -#else
114 -       return -EINVAL;
115 -#endif
116  }
117  
118  /**
119 @@ -172,21 +149,22 @@ static int mt9v113_power_set(struct v4l2_int_device *s, enum v4l2_power power)
120         struct omap34xxcam_videodev *vdev = s->u.slave->master->priv;
121  
122         switch (power) {
123 -       case V4L2_POWER_OFF:
124         case V4L2_POWER_STANDBY:
125 +               break;
127 +       case V4L2_POWER_OFF:
128                 isp_set_xclk(vdev->cam->isp, 0, CAM_USE_XCLKA);
129  
130                 if (regulator_is_enabled(beagle_mt9v113_1_8v1))
131                         regulator_disable(beagle_mt9v113_1_8v1);
132                 if (regulator_is_enabled(beagle_mt9v113_1_8v2))
133                         regulator_disable(beagle_mt9v113_1_8v2);
135                 break;
136  
137         case V4L2_POWER_ON:
138 -#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
139 -               isp_configure_interface(vdev->cam->isp, &mt9v113_if_config);
140 -#endif
141  
142 +               isp_configure_interface(vdev->cam->isp, &mt9v113_if_config);
143                 /* Set RESET_BAR to 0 */
144                 gpio_set_value(LEOPARD_RESET_GPIO, 0);
145  
146 @@ -216,8 +194,8 @@ static int mt9v113_power_set(struct v4l2_int_device *s, enum v4l2_power power)
147  
148         default:
149                 return -ENODEV;
150 -               break;
151         }
153         return 0;
154  }
155  
156 @@ -232,9 +210,6 @@ struct mt9v113_platform_data mt9v113_pdata = {
157         .vs_polarity    = 1, /* 0 - Active low, 1- Active high */
158  };
159  
160 -#endif                         /* #ifdef CONFIG_VIDEO_MT9V113 */
163  static int beagle_cam_probe(struct platform_device *pdev)
164  {
165         beagle_mt9v113_1_8v1 = regulator_get(&pdev->dev, "vaux3_1");
166 @@ -277,40 +252,6 @@ static int beagle_cam_remove(struct platform_device *pdev)
167  
168         gpio_free(LEOPARD_RESET_GPIO);
169  
170 -       /* MUX init */
171 -       omap_ctrl_writew(OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
172 -                        0x10C); /* CAM_HS */
173 -       omap_ctrl_writew(OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
174 -                        0x10E); /* CAM_VS */
175 -       omap_ctrl_writew(OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
176 -                        0x110); /* CAM_XCLKA */
177 -       omap_ctrl_writew(OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
178 -                        0x112); /* CAM_PCLK */
179 -       omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
180 -                        0x116); /* CAM_D0 */
181 -       omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
182 -                        0x118); /* CAM_D1 */
183 -       omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
184 -                        0x11A); /* CAM_D2 */
185 -       omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
186 -                        0x11C); /* CAM_D3 */
187 -       omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
188 -                        0x11E); /* CAM_D4 */
189 -       omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
190 -                        0x120); /* CAM_D5 */
191 -       omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
192 -                        0x122); /* CAM_D6 */
193 -       omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
194 -                        0x124); /* CAM_D7 */
195 -       omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
196 -                        0x126); /* CAM_D8 */
197 -       omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
198 -                        0x128); /* CAM_D9 */
199 -       omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
200 -                        0x12A); /* CAM_D10 */
201 -       omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
202 -                        0x12C); /* CAM_D11 */
204         return 0;
205  }
206  
207 diff --git a/drivers/media/video/isp/isp.h b/drivers/media/video/isp/isp.h
208 index 85c3fa9..4929fad 100644
209 --- a/drivers/media/video/isp/isp.h
210 +++ b/drivers/media/video/isp/isp.h
211 @@ -482,10 +482,23 @@ int isp_set_callback(struct device *dev, enum isp_callback_type type,
212  
213  int isp_unset_callback(struct device *dev, enum isp_callback_type type);
214  
215 +#if defined(CONFIG_VIDEO_OMAP3_ISP)
216  u32 isp_set_xclk(struct device *dev, u32 xclk, u8 xclksel);
217  
218  int isp_configure_interface(struct device *dev,
219                             struct isp_interface_config *config);
220 +#else
221 +static inline u32 isp_set_xclk(struct device *dev, u32 xclk, u8 xclksel)
222 +{
223 +       return 0;
224 +}
225 +static inline int isp_configure_interface(struct device *dev,
226 +                           struct isp_interface_config *config)
227 +{
228 +       return 0;
229 +}
231 +#endif
232  
233  struct device *isp_get(void);
234  
235 -- 
236 1.6.6.1