summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuotao Fu <l.fu@pengutronix.de>2009-05-19 13:40:28 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2009-06-23 13:16:30 +0200
commit17e327df8fa98a4e38015436d9664b7cbc246cca (patch)
tree905d5bb845b03a5364a4e997669832b2ba70fd58
parent8c07e0e3ef39fd447a32ab5e8c0fbcac5aa554ea (diff)
downloadlinux-2.6-17e327df8fa98a4e38015436d9664b7cbc246cca.tar.gz
linux-2.6-17e327df8fa98a4e38015436d9664b7cbc246cca.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.c62
-rw-r--r--arch/arm/plat-mxc/include/mach/mx3x.h3
2 files changed, 57 insertions, 8 deletions
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index 2b67c10b8d1..f85444e09a5 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>
@@ -306,16 +307,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 b559a4bb576..44ca1b700f0 100644
--- a/arch/arm/plat-mxc/include/mach/mx3x.h
+++ b/arch/arm/plat-mxc/include/mach/mx3x.h
@@ -279,9 +279,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;