Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 149356
b: refs/heads/master
c: 76e3fc3
h: refs/heads/master
v: v3
  • Loading branch information
Mike Rapoport authored and Eric Miao committed Jun 5, 2009
1 parent a923590 commit 02d6398
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1ce2c51e6d594d19126f51bba88aa9f57eb7cea6
refs/heads/master: 76e3fc36eb3d78997e7f4dcdc01cc38dc3178201
64 changes: 46 additions & 18 deletions trunk/arch/arm/mach-pxa/em-x270.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include <linux/spi/libertas_spi.h>
#include <linux/power_supply.h>
#include <linux/apm-emulation.h>
#include <linux/i2c.h>
#include <linux/i2c/pca953x.h>

#include <media/soc_camera.h>

Expand All @@ -52,15 +54,18 @@
#define GPIO13_MMC_CD (13)
#define GPIO95_MMC_WP (95)
#define GPIO56_NAND_RB (56)
#define GPIO93_CAM_RESET (93)

/* eXeda specific GPIOs */
#define GPIO114_MMC_CD (114)
#define GPIO20_NAND_RB (20)
#define GPIO38_SD_PWEN (38)
#define GPIO37_WLAN_RST (37)
#define GPIO95_TOUCHPAD_INT (95)
#define GPIO130_CAM_RESET (130)

/* common GPIOs */
#define GPIO11_NAND_CS (11)
#define GPIO93_CAM_RESET (93)
#define GPIO41_ETHIRQ (41)
#define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ)
#define GPIO115_WLAN_PWEN (115)
Expand All @@ -69,6 +74,7 @@
static int mmc_cd;
static int nand_rb;
static int dm9000_flags;
static int cam_reset;

static unsigned long common_pin_config[] = {
/* AC'97 */
Expand Down Expand Up @@ -180,7 +186,6 @@ static unsigned long common_pin_config[] = {

/* power controls */
GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */
GPIO93_GPIO | MFP_LPM_DRIVE_LOW, /* Camera reset */
GPIO115_GPIO | MFP_LPM_DRIVE_LOW, /* WLAN_PWEN */

/* NAND controls */
Expand All @@ -191,14 +196,16 @@ static unsigned long common_pin_config[] = {
};

static unsigned long em_x270_pin_config[] = {
GPIO13_GPIO, /* MMC card detect */
GPIO56_GPIO, /* NAND Ready/Busy */
GPIO95_GPIO, /* MMC Write protect */
GPIO13_GPIO, /* MMC card detect */
GPIO56_GPIO, /* NAND Ready/Busy */
GPIO93_GPIO | MFP_LPM_DRIVE_LOW, /* Camera reset */
GPIO95_GPIO, /* MMC Write protect */
};

static unsigned long exeda_pin_config[] = {
GPIO20_GPIO, /* NAND Ready/Busy */
GPIO38_GPIO | MFP_LPM_DRIVE_LOW, /* SD slot power */
GPIO95_GPIO, /* touchpad IRQ */
GPIO114_GPIO, /* MMC card detect */
};

Expand Down Expand Up @@ -863,26 +870,26 @@ static int em_x270_sensor_init(struct device *dev)
{
int ret;

ret = gpio_request(GPIO93_CAM_RESET, "camera reset");
ret = gpio_request(cam_reset, "camera reset");
if (ret)
return ret;

gpio_direction_output(GPIO93_CAM_RESET, 0);
gpio_direction_output(cam_reset, 0);

em_x270_camera_ldo = regulator_get(NULL, "vcc cam");
if (em_x270_camera_ldo == NULL) {
gpio_free(GPIO93_CAM_RESET);
gpio_free(cam_reset);
return -ENODEV;
}

ret = regulator_enable(em_x270_camera_ldo);
if (ret) {
regulator_put(em_x270_camera_ldo);
gpio_free(GPIO93_CAM_RESET);
gpio_free(cam_reset);
return ret;
}

gpio_set_value(GPIO93_CAM_RESET, 1);
gpio_set_value(cam_reset, 1);

return 0;
}
Expand All @@ -902,7 +909,7 @@ static int em_x270_sensor_power(struct device *dev, int on)
if (on == is_on)
return 0;

gpio_set_value(GPIO93_CAM_RESET, !on);
gpio_set_value(cam_reset, !on);

if (on)
ret = regulator_enable(em_x270_camera_ldo);
Expand All @@ -912,7 +919,7 @@ static int em_x270_sensor_power(struct device *dev, int on)
if (ret)
return ret;

gpio_set_value(GPIO93_CAM_RESET, on);
gpio_set_value(cam_reset, on);

return 0;
}
Expand All @@ -929,13 +936,8 @@ static struct i2c_board_info em_x270_i2c_cam_info[] = {
},
};

static struct i2c_pxa_platform_data em_x270_i2c_info = {
.fast_mode = 1,
};

static void __init em_x270_init_camera(void)
{
pxa_set_i2c_info(&em_x270_i2c_info);
i2c_register_board_info(0, ARRAY_AND_SIZE(em_x270_i2c_cam_info));
pxa_set_camera_info(&em_x270_camera_platform_data);
}
Expand Down Expand Up @@ -1069,6 +1071,29 @@ static void __init em_x270_init_da9030(void)
i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1);
}

static struct pca953x_platform_data exeda_gpio_ext_pdata = {
.gpio_base = 128,
};

static struct i2c_board_info exeda_i2c_info[] = {
{
I2C_BOARD_INFO("pca9555", 0x21),
.platform_data = &exeda_gpio_ext_pdata,
},
};

static struct i2c_pxa_platform_data em_x270_i2c_info = {
.fast_mode = 1,
};

static void __init em_x270_init_i2c(void)
{
pxa_set_i2c_info(&em_x270_i2c_info);

if (machine_is_exeda())
i2c_register_board_info(0, ARRAY_AND_SIZE(exeda_i2c_info));
}

static void __init em_x270_module_init(void)
{
pr_info("%s\n", __func__);
Expand All @@ -1077,6 +1102,7 @@ static void __init em_x270_module_init(void)
mmc_cd = GPIO13_MMC_CD;
nand_rb = GPIO56_NAND_RB;
dm9000_flags = DM9000_PLATF_32BITONLY;
cam_reset = GPIO93_CAM_RESET;
}

static void __init em_x270_exeda_init(void)
Expand All @@ -1087,6 +1113,7 @@ static void __init em_x270_exeda_init(void)
mmc_cd = GPIO114_MMC_CD;
nand_rb = GPIO20_NAND_RB;
dm9000_flags = DM9000_PLATF_16BITONLY;
cam_reset = GPIO130_CAM_RESET;
}

static void __init em_x270_init(void)
Expand All @@ -1111,8 +1138,9 @@ static void __init em_x270_init(void)
em_x270_init_keypad();
em_x270_init_gpio_keys();
em_x270_init_ac97();
em_x270_init_camera();
em_x270_init_spi();
em_x270_init_i2c();
em_x270_init_camera();
}

MACHINE_START(EM_X270, "Compulab EM-X270")
Expand Down

0 comments on commit 02d6398

Please sign in to comment.