3f83ed8e29b80f4ac1af4457ce75e212714bb897
[openembedded.git] /
1 From 4855949888a0ad8aca69c1ca3eefc7fbc8dad6f9 Mon Sep 17 00:00:00 2001
2 From: Sergio Aguirre <saaguirre@ti.com>
3 Date: Wed, 16 Jun 2010 04:58:46 +0300
4 Subject: [PATCH 11/28] omap3beagle: camera: Move i2c registration to the main board
5
6 This is because the board-omap3beagle-camera.c file now is
7 late_initcall, and the i2c bus registration needed to be before
8 i2c host init.
9
10 So, in order to have the i2c init, meanwhile having late_initcall,
11 this is so far the best solution.
12
13 Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
14 ---
15  arch/arm/mach-omap2/board-omap3beagle-camera.c |   24 +-----------------------
16  arch/arm/mach-omap2/board-omap3beagle.c        |   12 +++++++++++-
17  2 files changed, 12 insertions(+), 24 deletions(-)
18
19 diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c
20 index 55a113c..1652f15 100644
21 --- a/arch/arm/mach-omap2/board-omap3beagle-camera.c
22 +++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c
23 @@ -47,8 +47,6 @@
24  
25  #define MODULE_NAME                    "omap3beaglelmb"
26  
27 -#define MT9T111_I2C_BUSNUM     (2)
28 -
29  #define CAM_USE_XCLKA       1
30  
31  static struct regulator *beagle_mt9t111_reg1;
32 @@ -191,7 +189,7 @@ static int mt9t111_power_set(struct v4l2_int_device *s, enum v4l2_power power)
33         return 0;
34  }
35  
36 -static struct mt9t111_platform_data mt9t111_pdata = {
37 +struct mt9t111_platform_data mt9t111_pdata = {
38         .master         = "omap34xxcam",
39         .power_set      = mt9t111_power_set,
40         .priv_data_set  = mt9t111_set_prv_data,
41 @@ -202,11 +200,6 @@ static struct mt9t111_platform_data mt9t111_pdata = {
42         .vs_polarity    = 1, /* 0 - Active low, 1- Active high */
43  };
44  
45 -static struct i2c_board_info __initdata mt9t111_i2c_board_info = {
46 -       I2C_BOARD_INFO("mt9t111", MT9T111_I2C_ADDR),
47 -       .platform_data  = &mt9t111_pdata,
48 -};
49 -
50  #endif                         /* #ifdef CONFIG_VIDEO_MT9T111 */
51  
52  
53 @@ -225,21 +218,6 @@ static int beagle_cam_probe(struct platform_device *pdev)
54                 regulator_put(beagle_mt9t111_reg1);
55                 return PTR_ERR(beagle_mt9t111_reg2);
56         }
57 -       /*
58 -        * Register the I2C devices present in the board to the I2C
59 -        * framework.
60 -        * If more I2C devices are added, then each device information should
61 -        * be registered with I2C using i2c_register_board_info().
62 -        */
63 -#if defined(CONFIG_VIDEO_MT9T111) || defined(CONFIG_VIDEO_MT9T111_MODULE)
64 -       err = i2c_register_board_info(MT9T111_I2C_BUSNUM,
65 -                                       &mt9t111_i2c_board_info, 1);
66 -       if (err) {
67 -               printk(KERN_ERR MODULE_NAME \
68 -                               ": MT9T111 I2C Board Registration failed \n");
69 -               return err;
70 -       }
71 -#endif
72  
73         printk(KERN_INFO MODULE_NAME ": Driver registration complete \n");
74  
75 diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
76 index aa16acd..757d430 100644
77 --- a/arch/arm/mach-omap2/board-omap3beagle.c
78 +++ b/arch/arm/mach-omap2/board-omap3beagle.c
79 @@ -71,6 +71,11 @@ static struct omap_opp * _omap35x_l3_rate_table         = NULL;
80  static struct omap_opp * _omap37x_l3_rate_table         = NULL;
81  #endif  /* CONFIG_PM */
82  
83 +#ifdef CONFIG_VIDEO_MT9T111
84 +#include <media/v4l2-int-device.h>
85 +#include <media/mt9t111.h>
86 +extern struct mt9t111_platform_data mt9t111_pdata;
87 +#endif
88  
89  #define GPMC_CS0_BASE  0x60
90  #define GPMC_CS_SIZE   0x30
91 @@ -588,7 +593,12 @@ static struct i2c_board_info __initdata beagle_zippy_i2c2_boardinfo[] = {
92  static struct i2c_board_info __initdata beagle_zippy_i2c2_boardinfo[] = {};
93  #endif
94  
95 -static struct i2c_board_info __initdata beagle_i2c2_boardinfo[] = {};
96 +static struct i2c_board_info __initdata beagle_i2c2_boardinfo[] = {
97 +       {
98 +               I2C_BOARD_INFO("mt9t111", MT9T111_I2C_ADDR),
99 +               .platform_data  = &mt9t111_pdata,
100 +       },
101 +};
102  
103  static int __init omap3_beagle_i2c_init(void)
104  {
105 -- 
106 1.6.6.1
107