diff options
author | Luotao Fu <l.fu@pengutronix.de> | 2009-05-19 13:40:28 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-05-27 10:42:04 +0200 |
commit | e93d7a73b0e4e11cc44d866269738da7f2717bd4 (patch) | |
tree | c840c4ccd303ae22139fdeedf38bde358c6267cf | |
parent | 606a4440f9c014fc89f2aeb37e3aa4baaa7c74a9 (diff) | |
download | linux-2.6-e93d7a73b0e4e11cc44d866269738da7f2717bd4.tar.gz linux-2.6-e93d7a73b0e4e11cc44d866269738da7f2717bd4.tar.xz |
mx31: add mt9m001 and mt9v022 CMOS camera to PCM037 board
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/mach-mx3/pcm037.c | 62 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/mx3x.h | 3 |
2 files changed, 57 insertions, 8 deletions
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c index f7a870382fc..8dadbc8ade3 100644 --- a/arch/arm/mach-mx3/pcm037.c +++ b/arch/arm/mach-mx3/pcm037.c @@ -28,6 +28,7 @@ #include <linux/interrupt.h> #include <linux/i2c.h> #include <linux/i2c/at24.h> +#include <linux/i2c/pca953x.h> #include <linux/delay.h> #include <linux/spi/spi.h> #include <linux/irq.h> @@ -280,16 +281,67 @@ static int pcm037_camera_power(struct device *dev, int on) gpio_set_value(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), !on); return 0; } +/* count of GPIOs that are occupied by the CPU itself */ +#define MAX_INTERNAL_GPIO 96 +static int gpio_bus_switch; -static struct soc_camera_link iclink = { - .bus_id = 0, /* Must match with the camera ID */ - .power = pcm037_camera_power, +static unsigned long pcm037_camera_query_bus_param(struct soc_camera_link *link) +{ + int ret; + + if (!gpio_bus_switch) { + ret = gpio_request(MAX_INTERNAL_GPIO, "camera"); + if (!ret) { + gpio_bus_switch = MAX_INTERNAL_GPIO; + gpio_direction_output(gpio_bus_switch, 0); + } else + gpio_bus_switch = -EINVAL; + } + + return SOCAM_DATAWIDTH_10; +} + +static int pcm037_camera_set_bus_param(struct soc_camera_link *link, + unsigned long flags) +{ + return 0; +} + +static struct soc_camera_link iclink[] = { + { + .bus_id = 0, /* Must match with the camera ID */ + .query_bus_param = pcm037_camera_query_bus_param, + .set_bus_param = pcm037_camera_set_bus_param, + .power = pcm037_camera_power, + + }, { + .bus_id = 0, /* Must match with the camera ID */ + .query_bus_param = pcm037_camera_query_bus_param, + .set_bus_param = pcm037_camera_set_bus_param, + .power = pcm037_camera_power, + .flags = SOCAM_SENSOR_INVERT_PCLK, + } +}; + +/* count of GPIOs that are occupied by the CPU itself */ +#define MAX_INTERNAL_GPIO 96 + +static struct pca953x_platform_data pca9536_data = { + .gpio_base = MAX_INTERNAL_GPIO, }; static struct i2c_board_info pcm037_i2c_2_devices[] = { { - I2C_BOARD_INFO("mt9t031", 0x5d), - .platform_data = &iclink, + /* Must initialize before the camera(s) */ + I2C_BOARD_INFO("pca953x", 0x41), + .type = "pca9536", + .platform_data = &pca9536_data, + }, { + I2C_BOARD_INFO("mt9m001", 0x5d), + .platform_data = &iclink[0], + }, { + I2C_BOARD_INFO("mt9v022", 0x48), + .platform_data = &iclink[1], /* mt9v022 needs pclk inversion*/ }, }; diff --git a/arch/arm/plat-mxc/include/mach/mx3x.h b/arch/arm/plat-mxc/include/mach/mx3x.h index 3878c6085d5..c9fc99f4e1c 100644 --- a/arch/arm/plat-mxc/include/mach/mx3x.h +++ b/arch/arm/plat-mxc/include/mach/mx3x.h @@ -273,9 +273,6 @@ /* Mandatory defines used globally */ -/* this CPU supports up to 96 GPIOs */ -#define ARCH_NR_GPIOS 96 - #if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS) extern unsigned int system_rev; |