r3800 - trunk/src/target/kernel/patches
werner at sita.openmoko.org
werner at sita.openmoko.org
Wed Jan 9 21:14:33 CET 2008
Author: werner
Date: 2008-01-09 21:14:30 +0100 (Wed, 09 Jan 2008)
New Revision: 3800
Modified:
trunk/src/target/kernel/patches/gta02-acc.patch
Log:
Cleanup and big fixes for the accelerometer driver. Note that it still hangs
the system with what seems to be a permanently asserted interrupt. So don't
enable it yet.
gta02-acc.patch:
- arch/arm/mach-s3c2440/mach-gta02.c (gta02_spi_acc_set_cs): chip select is now
handled by spi_acc_cs, removed
- drivers/spi/lis302dl.c (enum lis302dl_reg_ctrl3): added LIS302DL_CTRL3_IHL
- drivers/spi/lis302dl.c (READ_BIT, ADDR_MASK, __reg_read, __reg_write):
updated, and use these symbolic names instead of numeric constants
- drivers/spi/lis302dl.c (__reg_read, __reg_write): trying to use an invalid
register number is a BUG
- drivers/spi/lis302dl.c (lis302dl_int_mode): use "switch" instead of "if"
cascade
- drivers/spi/lis302dl.c (lis302dl_sysfs_entries): list needs to end with a
NULL entry
- drivers/spi/lis302dl.c (lis302dl_probe): CTRL_REG3 setting was bogus and also
needs to include active-low
- drivers/spi/lis302dl.c (lis302dl_probe): use lis302dl_int_mode instead of
setting the combined configuration value
- drivers/spi/lis302dl.c (lis302dl_probe): pass "lis" device pointer to
interrupt handler
- drivers/spi/lis302dl.c (lis302dl_probe): un-commented calls to request_irq
and sysfs_create_group
Modified: trunk/src/target/kernel/patches/gta02-acc.patch
===================================================================
--- trunk/src/target/kernel/patches/gta02-acc.patch 2008-01-09 19:53:26 UTC (rev 3799)
+++ trunk/src/target/kernel/patches/gta02-acc.patch 2008-01-09 20:14:30 UTC (rev 3800)
@@ -11,7 +11,19 @@
>a02_nor_flash,
};
-@@ -522,10 +520,54 @@
+@@ -488,11 +486,6 @@
+
+ /* 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)"
+@@ -522,10 +515,54 @@
},
};
@@ -69,7 +81,7 @@
};
static struct resource gta02_led_resources[] = {
-@@ -673,7 +715,6 @@
+@@ -673,7 +710,6 @@
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;
@@ -77,7 +89,7 @@
/* Only GTA02v1 has a SD_DETECT GPIO. Since the slot is not
* hot-pluggable, this is not required anyway */
-@@ -702,6 +743,7 @@
+@@ -702,6 +738,7 @@
break;
}
@@ -85,7 +97,7 @@
platform_device_register(>a01_button_dev);
platform_device_register(>a01_pm_gsm_dev);
-@@ -721,6 +763,13 @@
+@@ -721,6 +758,13 @@
s3c2410_gpio_cfgpin(GTA01_GPIO_LCD_RESET, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_setpin(GTA01_GPIO_LCD_RESET, 1);
@@ -103,49 +115,91 @@
===================================================================
--- linux-2.6.22.5.orig/drivers/spi/lis302dl.c
+++ linux-2.6.22.5/drivers/spi/lis302dl.c
-@@ -143,7 +143,7 @@
+@@ -84,6 +84,7 @@
+
+ enum lis302dl_reg_ctrl3 {
+ LIS302DL_CTRL3_PP_OD = 0x40,
++ LIS302DL_CTRL3_IHL = 0x80,
+ };
+
+ enum lis302dl_reg_status {
+@@ -134,16 +135,17 @@
+
+ /* lowlevel register access functions */
+
+-#define READ_BIT 0x01
+-#define MS_BIT 0x02
+-#define ADDR_SHIFT 2
++#define READ_BIT 0x80
++#define ADDR_MASK 0x3f
+
+ static inline u_int8_t __reg_read(struct lis302dl_info *lis, u_int8_t reg)
+ {
int rc;
u_int8_t cmd;
- cmd = (reg << ADDR_SHIFT) | READ_BIT;
-+ cmd = (0x80) | (reg & 0x3F);
++ BUG_ON(reg & ~ADDR_MASK);
++
++ cmd = reg | READ_BIT;
rc = spi_w8r8(lis->spi_dev, cmd);
-@@ -165,7 +165,7 @@
+@@ -165,7 +167,9 @@
{
u_int8_t buf[2];
- buf[0] = (reg << ADDR_SHIFT);
-+ buf[0] = (reg & 0x3F);
++ BUG_ON(reg & ~ADDR_MASK);
++
++ buf[0] = reg;
buf[1] = val;
return spi_write(lis->spi_dev, buf, sizeof(buf));
-@@ -459,12 +459,13 @@
+@@ -218,10 +222,16 @@
+ {
+ struct lis302dl_info *lis = dev_get_drvdata(&spi->dev);
+
+- if (int_pin == 1)
++ switch (int_pin) {
++ case 1:
+ reg_set_bit_mask(lis, LIS302DL_REG_CTRL3, 0x07, mode);
+- else if (int_pin == 2)
++ break;
++ case 2:
+ reg_set_bit_mask(lis, LIS302DL_REG_CTRL3, 0x38, mode << 3);
++ break;
++ default:
++ BUG();
++ }
+ }
+
+ static void _report_btn_single(struct input_dev *inp, int btn)
+@@ -388,6 +398,7 @@
+ static struct attribute *lis302dl_sysfs_entries[] = {
+ &dev_attr_sample_rate.attr,
+ &dev_attr_full_scale.attr,
++ NULL
+ };
+
+ static struct attribute_group lis302dl_attr_group = {
+@@ -459,12 +470,15 @@
kfree(lis);
return -ENODEV;
}
++ /* switch interrupt to open collector, active-low */
++ reg_write(lis, LIS302DL_REG_CTRL3,
++ LIS302DL_CTRL3_PP_OD | LIS302DL_CTRL3_IHL);
++ lis302dl_int_mode(spi, 1, LIX302DL_INTMODE_DATA_READY);
++ lis302dl_int_mode(spi, 2, LIX302DL_INTMODE_CLICK);
+
+- /* switch interrupt to open collector */
+- reg_write(lis, LIS302DL_CTRL3_PP_OD, 0x7c);
-
- /* switch interrupt to open collector */
- reg_write(lis, LIS302DL_CTRL3_PP_OD, 0x7c);
-
-- rc = request_irq(lis->spi_dev->irq, lis302dl_interrupt, IRQF_DISABLED,
++ /* Fix me: always interrupt */
+ rc = request_irq(lis->spi_dev->irq, lis302dl_interrupt, IRQF_DISABLED,
- "lis302dl", NULL);
-+ /* Fix me: always interrupt */
-+ //rc = request_irq(lis->spi_dev->irq, lis302dl_interrupt, IRQF_DISABLED,
-+ // "lis302dl", NULL);
-+ rc = 0;
++ "lis302dl", lis);
if (rc < 0) {
dev_err(&spi->dev, "error requesting IRQ %d\n",
lis->spi_dev->irq);
-@@ -472,7 +473,9 @@
- return rc;
- }
-
-- rc = sysfs_create_group(&spi->dev.kobj, &lis302dl_attr_group);
-+ /* Fix me: can't create group */
-+ //rc = sysfs_create_group(&spi->dev.kobj, &lis302dl_attr_group);
-+ rc = 0;
- if (rc) {
- dev_err(&spi->dev, "error creating sysfs group\n");
- /* FIXME */
More information about the commitlog
mailing list