[ARM] pxa/pcm990: convert pcm990 to soc-camera as platform-device
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Wed, 13 May 2009 09:33:43 +0000 (11:33 +0200)
committerEric Miao <eric.y.miao@gmail.com>
Thu, 10 Sep 2009 10:49:31 +0000 (18:49 +0800)
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
arch/arm/mach-pxa/pcm990-baseboard.c

index e211633471f7dc339f2a7df07ed506c007e06865..bbda57078e0f71915fd489a00d274c6cc654d890 100644 (file)
@@ -430,25 +430,56 @@ static void pcm990_camera_free_bus(struct soc_camera_link *link)
        gpio_bus_switch = -EINVAL;
 }
 
-static struct soc_camera_link iclink = {
-       .bus_id = 0, /* Must match with the camera ID above */
-       .query_bus_param = pcm990_camera_query_bus_param,
-       .set_bus_param = pcm990_camera_set_bus_param,
-       .free_bus = pcm990_camera_free_bus,
-};
-
 /* Board I2C devices. */
 static struct i2c_board_info __initdata pcm990_i2c_devices[] = {
        {
                /* Must initialize before the camera(s) */
                I2C_BOARD_INFO("pca9536", 0x41),
                .platform_data = &pca9536_data,
-       }, {
+       },
+};
+
+static struct i2c_board_info pcm990_camera_i2c[] = {
+       {
                I2C_BOARD_INFO("mt9v022", 0x48),
-               .platform_data = &iclink, /* With extender */
        }, {
                I2C_BOARD_INFO("mt9m001", 0x5d),
-               .platform_data = &iclink, /* With extender */
+       },
+};
+
+static struct soc_camera_link iclink[] = {
+       {
+               .bus_id                 = 0, /* Must match with the camera ID */
+               .board_info             = &pcm990_camera_i2c[0],
+               .i2c_adapter_id         = 0,
+               .query_bus_param        = pcm990_camera_query_bus_param,
+               .set_bus_param          = pcm990_camera_set_bus_param,
+               .free_bus               = pcm990_camera_free_bus,
+               .module_name            = "mt9v022",
+       }, {
+               .bus_id                 = 0, /* Must match with the camera ID */
+               .board_info             = &pcm990_camera_i2c[1],
+               .i2c_adapter_id         = 0,
+               .query_bus_param        = pcm990_camera_query_bus_param,
+               .set_bus_param          = pcm990_camera_set_bus_param,
+               .free_bus               = pcm990_camera_free_bus,
+               .module_name            = "mt9m001",
+       },
+};
+
+static struct platform_device pcm990_camera[] = {
+       {
+               .name   = "soc-camera-pdrv",
+               .id     = 0,
+               .dev    = {
+                       .platform_data = &iclink[0],
+               },
+       }, {
+               .name   = "soc-camera-pdrv",
+               .id     = 1,
+               .dev    = {
+                       .platform_data = &iclink[1],
+               },
        },
 };
 #endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */
@@ -504,6 +535,9 @@ void __init pcm990_baseboard_init(void)
        pxa_set_camera_info(&pcm990_pxacamera_platform_data);
 
        i2c_register_board_info(0, ARRAY_AND_SIZE(pcm990_i2c_devices));
+
+       platform_device_register(&pcm990_camera[0]);
+       platform_device_register(&pcm990_camera[1]);
 #endif
 
        printk(KERN_INFO "PCM-990 Evaluation baseboard initialized\n");