|
@@ -29,6 +29,7 @@
|
|
|
#include <video/sh_mobile_lcdc.h>
|
|
|
#include <media/sh_mobile_ceu.h>
|
|
|
#include <media/tw9910.h>
|
|
|
+#include <media/mt9t112.h>
|
|
|
#include <asm/heartbeat.h>
|
|
|
#include <asm/sh_eth.h>
|
|
|
#include <asm/clock.h>
|
|
@@ -566,11 +567,19 @@ static struct platform_device msiof0_device = {
|
|
|
|
|
|
#endif
|
|
|
|
|
|
-/* I2C Video */
|
|
|
+/* I2C Video/Camera */
|
|
|
static struct i2c_board_info i2c_camera[] = {
|
|
|
{
|
|
|
I2C_BOARD_INFO("tw9910", 0x45),
|
|
|
},
|
|
|
+ {
|
|
|
+ /* 1st camera */
|
|
|
+ I2C_BOARD_INFO("mt9t112", 0x3c),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ /* 2nd camera */
|
|
|
+ I2C_BOARD_INFO("mt9t112", 0x3c),
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
/* tw9910 */
|
|
@@ -599,6 +608,52 @@ static struct soc_camera_link tw9910_link = {
|
|
|
.priv = &tw9910_info,
|
|
|
};
|
|
|
|
|
|
+/* mt9t112 */
|
|
|
+static int mt9t112_power1(struct device *dev, int mode)
|
|
|
+{
|
|
|
+ gpio_set_value(GPIO_PTA3, mode);
|
|
|
+ if (mode)
|
|
|
+ mdelay(100);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static struct mt9t112_camera_info mt9t112_info1 = {
|
|
|
+ .flags = MT9T112_FLAG_PCLK_RISING_EDGE | MT9T112_FLAG_DATAWIDTH_8,
|
|
|
+ .divider = { 0x49, 0x6, 0, 6, 0, 9, 9, 6, 0 }, /* for 24MHz */
|
|
|
+};
|
|
|
+
|
|
|
+static struct soc_camera_link mt9t112_link1 = {
|
|
|
+ .i2c_adapter_id = 0,
|
|
|
+ .power = mt9t112_power1,
|
|
|
+ .bus_id = 0,
|
|
|
+ .board_info = &i2c_camera[1],
|
|
|
+ .module_name = "mt9t112",
|
|
|
+ .priv = &mt9t112_info1,
|
|
|
+};
|
|
|
+
|
|
|
+static int mt9t112_power2(struct device *dev, int mode)
|
|
|
+{
|
|
|
+ gpio_set_value(GPIO_PTA4, mode);
|
|
|
+ if (mode)
|
|
|
+ mdelay(100);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static struct mt9t112_camera_info mt9t112_info2 = {
|
|
|
+ .flags = MT9T112_FLAG_PCLK_RISING_EDGE | MT9T112_FLAG_DATAWIDTH_8,
|
|
|
+ .divider = { 0x49, 0x6, 0, 6, 0, 9, 9, 6, 0 }, /* for 24MHz */
|
|
|
+};
|
|
|
+
|
|
|
+static struct soc_camera_link mt9t112_link2 = {
|
|
|
+ .i2c_adapter_id = 1,
|
|
|
+ .power = mt9t112_power2,
|
|
|
+ .bus_id = 1,
|
|
|
+ .board_info = &i2c_camera[2],
|
|
|
+ .module_name = "mt9t112",
|
|
|
+ .priv = &mt9t112_info2,
|
|
|
+};
|
|
|
|
|
|
static struct platform_device camera_devices[] = {
|
|
|
{
|
|
@@ -608,6 +663,20 @@ static struct platform_device camera_devices[] = {
|
|
|
.platform_data = &tw9910_link,
|
|
|
},
|
|
|
},
|
|
|
+ {
|
|
|
+ .name = "soc-camera-pdrv",
|
|
|
+ .id = 1,
|
|
|
+ .dev = {
|
|
|
+ .platform_data = &mt9t112_link1,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ .name = "soc-camera-pdrv",
|
|
|
+ .id = 2,
|
|
|
+ .dev = {
|
|
|
+ .platform_data = &mt9t112_link2,
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
static struct platform_device *ecovec_devices[] __initdata = {
|
|
@@ -627,6 +696,8 @@ static struct platform_device *ecovec_devices[] __initdata = {
|
|
|
&msiof0_device,
|
|
|
#endif
|
|
|
&camera_devices[0],
|
|
|
+ &camera_devices[1],
|
|
|
+ &camera_devices[2],
|
|
|
};
|
|
|
|
|
|
#define EEPROM_ADDR 0x50
|
|
@@ -943,6 +1014,12 @@ static int __init arch_setup(void)
|
|
|
gpio_request(GPIO_PTU2, NULL);
|
|
|
gpio_direction_output(GPIO_PTU2, 1);
|
|
|
|
|
|
+ /* enable Camera */
|
|
|
+ gpio_request(GPIO_PTA3, NULL);
|
|
|
+ gpio_request(GPIO_PTA4, NULL);
|
|
|
+ gpio_direction_output(GPIO_PTA3, 0);
|
|
|
+ gpio_direction_output(GPIO_PTA4, 0);
|
|
|
+
|
|
|
/* enable I2C device */
|
|
|
i2c_register_board_info(1, i2c1_devices,
|
|
|
ARRAY_SIZE(i2c1_devices));
|