diff options
author | mokopatches <mokopatches@openmoko.org> | 2008-11-19 17:03:16 +0000 |
---|---|---|
committer | warmcat <andy@warmcat.com> | 2008-11-19 17:03:16 +0000 |
commit | c8a8421359011e536c4152ddae84ea04316f436f (patch) | |
tree | 9f93018841167facc01188f242348ef488074efc /arch | |
parent | 5915ea88b0b6ada7fc5234239feec5d4960887df (diff) |
lis302dl.patch
This is a Linux driver for the STmicro LIS302DL 3-axis accelerometer.
Signed-off-by: Harald Welte <laforge@openmoko.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-s3c2440/mach-gta02.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c index f72a5aee1d8..d11da106b66 100644 --- a/arch/arm/mach-s3c2440/mach-gta02.c +++ b/arch/arm/mach-s3c2440/mach-gta02.c @@ -46,6 +46,7 @@ #include <linux/mtd/physmap.h> #include <linux/pcf50633.h> +#include <linux/lis302dl.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> @@ -463,7 +464,7 @@ static struct s3c2410_ts_mach_info gta02_ts_cfg = { .oversampling_shift = 5, }; -/* SPI */ +/* SPI: LCM control interface attached to Glamo3362 */ static struct spi_board_info gta02_spi_board_info[] = { { @@ -504,6 +505,48 @@ static struct platform_device gta01_led_dev = { .resource = gta01_led_resources, }; +/* SPI: Accelerometers attached to SPI of s3c244x */ + +static void gta02_spi_acc_set_cs(struct s3c2410_spi_info *spi, int cs, int pol) +{ + s3c2410_gpio_setpin(cs, pol); +} + +static const struct lis302dl_platform_data lis302_pdata[] = { + { + .name = "lis302-1 (top)" + }, { + .name = "lis302-2 (bottom)" + }, +}; + +static struct spi_board_info gta02_spi_acc_bdinfo[] = { + { + .modalias = "lis302dl", + .platform_data = &lis302_pdata[0], + .irq = GTA02_IRQ_GSENSOR_1, + .max_speed_hz = 400 * 1000, + .bus_num = 1, + .chip_select = S3C2410_GPD12, + .mode = SPI_MODE_3, + }, + { + .modalias = "lis302dl", + .platform_data = &lis302_pdata[1], + .irq = GTA02_IRQ_GSENSOR_2, + .max_speed_hz = 400 * 1000, + .bus_num = 1, + .chip_select = S3C2410_GPD13, + .mode = SPI_MODE_3, + }, +}; + +static struct s3c2410_spi_info gta02_spi_acc_cfg = { + .set_cs = gta02_spi_acc_set_cs, + .board_size = ARRAY_SIZE(gta02_spi_acc_bdinfo), + .board_info = gta02_spi_acc_bdinfo, +}; + static struct resource gta02_led_resources[] = { { .name = "gta02-power:orange", @@ -746,6 +789,7 @@ static void __init gta02_machine_init(void) s3c_device_usb.dev.platform_data = >a02_usb_info; s3c_device_nand.dev.platform_data = >a02_nand_info; s3c_device_sdi.dev.platform_data = >a02_mmc_cfg; + s3c_device_spi1.dev.platform_data = >a02_spi_acc_cfg; /* Only GTA02v1 has a SD_DETECT GPIO. Since the slot is not * hot-pluggable, this is not required anyway */ |