Send commitlog mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r3101 - branches/src/target/kernel/2.6.23.x/patches
      ([EMAIL PROTECTED])
   2. r3102 - developers/werner ([EMAIL PROTECTED])
   3. r3103 - trunk/src/host/usbpath ([EMAIL PROTECTED])
   4. r3104 - developers/werner ([EMAIL PROTECTED])
   5. r3105 - trunk/src/target/kernel/patches
      ([EMAIL PROTECTED])
--- Begin Message ---
Author: shoragan
Date: 2007-10-07 12:50:05 +0200 (Sun, 07 Oct 2007)
New Revision: 3101

Added:
   branches/src/target/kernel/2.6.23.x/patches/gta-vibrator.patch
Modified:
   branches/src/target/kernel/2.6.23.x/patches/series
Log:
Add support for the vibrator using the generic s3c24xx led support.

Added: branches/src/target/kernel/2.6.23.x/patches/gta-vibrator.patch
===================================================================
--- branches/src/target/kernel/2.6.23.x/patches/gta-vibrator.patch      
2007-10-07 09:44:53 UTC (rev 3100)
+++ branches/src/target/kernel/2.6.23.x/patches/gta-vibrator.patch      
2007-10-07 10:50:05 UTC (rev 3101)
@@ -0,0 +1,98 @@
+Index: linux-2.6.22/arch/arm/mach-s3c2410/mach-gta01.c
+===================================================================
+--- linux-2.6.22.orig/arch/arm/mach-s3c2410/mach-gta01.c
++++ linux-2.6.22/arch/arm/mach-s3c2410/mach-gta01.c
+@@ -55,6 +55,7 @@
+ #include <asm/mach-types.h>
+ 
+ #include <asm/arch/regs-gpio.h>
++#include <asm/arch/leds-gpio.h>
+ #include <asm/arch/fb.h>
+ #include <asm/arch/mci.h>
+ #include <asm/arch/ts.h>
+@@ -585,17 +586,18 @@
+       },
+ };
+ 
+-static struct resource gta01_led_resources[] = {
+-      [0] = {
+-              .start  = GTA01_GPIO_VIBRATOR_ON,
+-              .end    = GTA01_GPIO_VIBRATOR_ON,
+-      },
++static struct s3c24xx_led_platdata gta01_led_pdata = {
++    .name       = "gta01-vib",
++    .gpio       = GTA01_GPIO_VIBRATOR_ON,
++    .def_trigger    = "",
+ };
+ 
+-struct platform_device gta01_led_dev = {
+-      .name           = "gta01-led",
+-      .num_resources  = ARRAY_SIZE(gta01_led_resources),
+-      .resource       = gta01_led_resources,
++static struct platform_device gta01_led_dev = {
++    .name       = "s3c24xx_led",
++    .id     = 1,
++    .dev        = {
++        .platform_data  = &gta01_led_pdata,
++    },
+ };
+ 
+ static struct resource gta01_button_resources[] = {
+@@ -688,14 +690,12 @@
+       case GTA01Bv2_SYSTEM_REV:
+       case GTA01Bv3_SYSTEM_REV:
+               /* just use the default (GTA01_IRQ_PCF50606) */
+-              gta01_led_resources[0].start =
+-                      gta01_led_resources[0].end = GTA01Bv2_GPIO_VIBRATOR_ON;
++              gta01_led_pdata.gpio = GTA01Bv2_GPIO_VIBRATOR_ON;
+               break;
+       case GTA01Bv4_SYSTEM_REV:
+               gta01_pmu_resources[0].start =
+                       gta01_pmu_resources[0].end = GTA01Bv4_IRQ_PCF50606;
+-              gta01_led_resources[0].start =
+-                      gta01_led_resources[0].end = GTA01Bv4_GPIO_VIBRATOR_ON;
++              gta01_led_pdata.gpio = GTA01Bv4_GPIO_VIBRATOR_ON;
+               break;
+       }
+       mangle_pmu_pdata_by_system_rev();
+Index: linux-2.6.22/arch/arm/mach-s3c2440/mach-gta02.c
+===================================================================
+--- linux-2.6.22.orig/arch/arm/mach-s3c2440/mach-gta02.c
++++ linux-2.6.22/arch/arm/mach-s3c2440/mach-gta02.c
+@@ -56,6 +56,7 @@
+ 
+ #include <asm/arch/regs-gpio.h>
+ #include <asm/arch/regs-gpioj.h>
++#include <asm/arch/leds-gpio.h>
+ #include <asm/arch/fb.h>
+ #include <asm/arch/mci.h>
+ #include <asm/arch/ts.h>
+@@ -499,18 +500,18 @@
+ #endif
+ #endif
+ 
+-static struct resource gta02_led_resources[] = {
+-      [0] = {
+-              .start  = GTA02_GPIO_VIBRATOR_ON,
+-              .end    = GTA02_GPIO_VIBRATOR_ON,
+-      },
+-      /* FIXME */
++static struct s3c24xx_led_platdata gta02_led_pdata = {
++    .name       = "gta02-vib",
++    .gpio       = GTA02_GPIO_VIBRATOR_ON,
++    .def_trigger    = "",
+ };
+ 
+-struct platform_device gta02_led_dev = {
+-      .name           = "gta01-led",
+-      .num_resources  = ARRAY_SIZE(gta02_led_resources),
+-      .resource       = gta02_led_resources,
++static struct platform_device gta02_led_dev = {
++    .name       = "s3c24xx_led",
++    .id     = 1,
++    .dev        = {
++        .platform_data  = &gta02_led_pdata,
++    },
+ };
+ 
+ static struct resource gta01_button_resources[] = {

Modified: branches/src/target/kernel/2.6.23.x/patches/series
===================================================================
--- branches/src/target/kernel/2.6.23.x/patches/series  2007-10-07 09:44:53 UTC 
(rev 3100)
+++ branches/src/target/kernel/2.6.23.x/patches/series  2007-10-07 10:50:05 UTC 
(rev 3101)
@@ -45,3 +45,4 @@
 neo1973-soc-include-fix.patch
 explicitly-link-notes-section.patch
 fix-s3c2410fb-register-access.patch
+gta-vibrator.patch




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2007-10-07 13:44:44 +0200 (Sun, 07 Oct 2007)
New Revision: 3102

Removed:
   developers/werner/usbreset/
Log:
- usbreset/ has moved to trunk/src/host/






--- End Message ---
--- Begin Message ---
Author: werner
Date: 2007-10-07 14:56:57 +0200 (Sun, 07 Oct 2007)
New Revision: 3103

Modified:
   trunk/src/host/usbpath/README
   trunk/src/host/usbpath/devnum2path.c
   trunk/src/host/usbpath/path2devnum.c
   trunk/src/host/usbpath/usbpath.c
   trunk/src/host/usbpath/usbpath.h
Log:
Converted numbering scheme from bus+port+... with zero-based ports to
  bus-port. ... .port with one-based ports, as used by the kernel.



Modified: trunk/src/host/usbpath/README
===================================================================
--- trunk/src/host/usbpath/README       2007-10-07 11:44:44 UTC (rev 3102)
+++ trunk/src/host/usbpath/README       2007-10-07 12:56:57 UTC (rev 3103)
@@ -12,19 +12,19 @@
 The physical location of a USB device is represented by the following
 syntax:
 
-bus+port+...+port
+bus-port. ... .port
 
 where "bus" is again the number of the USB bus, and "port" is the number
-of the port on the respective next hub, counting from zero.
+of the port on the respective next hub, counting from one.
 
 
 usbport converts between the two representations.
 
 Example:
 usbport 1/19
-1+1+2
+1-1.2
 
-usbport 1+1+2
+usbport 1-1.2
 1/19
 
 

Modified: trunk/src/host/usbpath/devnum2path.c
===================================================================
--- trunk/src/host/usbpath/devnum2path.c        2007-10-07 11:44:44 UTC (rev 
3102)
+++ trunk/src/host/usbpath/devnum2path.c        2007-10-07 12:56:57 UTC (rev 
3103)
@@ -123,8 +123,8 @@
        for (i = 0; i != n-1; i++) {
                if (!path_size--)
                        return -1;
-               *path++ = '+';
-               res = add_int(&path, &path_size, ports[i]);
+               *path++ = i ? '.' : '-';
+               res = add_int(&path, &path_size, ports[i]+1);
                if (res < 0)
                        return -1;
                len += res+1;

Modified: trunk/src/host/usbpath/path2devnum.c
===================================================================
--- trunk/src/host/usbpath/path2devnum.c        2007-10-07 11:44:44 UTC (rev 
3102)
+++ trunk/src/host/usbpath/path2devnum.c        2007-10-07 12:56:57 UTC (rev 
3103)
@@ -116,7 +116,7 @@
        if (!*path)
                return -1;
        for (p = path; *p; p++)
-               if (*p == '+')
+               if (*p == '-' || *p == '.')
                        nums++;
        num = malloc(sizeof(int)*nums);
        if (!num) {
@@ -126,10 +126,17 @@
        while (1) {
                char *end;
 
-               num[n++] = strtoul(path, &end, 10);
+               num[n] = strtoul(path, &end, 10);
+               if (!num[n]) {
+                       free(num);
+                       return -1;
+               }
+               if (n)
+                       num[n]--;
+               n++;
                if (!*end && n == nums)
                        break;
-               if (*end != '+') {
+               if (*end != (n == 1 ? '-' : '.')) {
                        free(num);
                        return -1;
                }

Modified: trunk/src/host/usbpath/usbpath.c
===================================================================
--- trunk/src/host/usbpath/usbpath.c    2007-10-07 11:44:44 UTC (rev 3102)
+++ trunk/src/host/usbpath/usbpath.c    2007-10-07 12:56:57 UTC (rev 3103)
@@ -33,7 +33,7 @@
 
 static void usage(const char *name)
 {
-       fprintf(stderr, "usage: %s bus+port+...\n", name);
+       fprintf(stderr, "usage: %s bus-port. ... .port\n", name);
        fprintf(stderr, "       %s bus/dev\n", name);
        exit(1);
 }

Modified: trunk/src/host/usbpath/usbpath.h
===================================================================
--- trunk/src/host/usbpath/usbpath.h    2007-10-07 11:44:44 UTC (rev 3102)
+++ trunk/src/host/usbpath/usbpath.h    2007-10-07 12:56:57 UTC (rev 3103)
@@ -36,6 +36,8 @@
 /* path2devnum.c */
 
 /*
+ * Note that the port numbers in ports[] are 0-based.
+ *
  * Return codes:
  * 0  device not found
  * N  device number
@@ -45,6 +47,8 @@
     int num_ports);
 
 /*
+ * Note that the port numbers in the string are 1-based.
+ *
  * Return codes:
  * -1  invalid path specification
  * 0   device not found
@@ -57,16 +61,20 @@
 /* devnum2path.c */
 
 /*
+ * Note that the port numbers in ports[] are 0-based.
+ *
  * Return codes:
  * -1  buffer overflow
  * 0   device not found
- * N   N-1 ports placed into "ports"
+ * N   N-1 ports placed into "ports".
  */
 
 int usb_devnum2portlist(const struct usb_bus *bus, int devnum, int *ports,
     int num_ports);
 
 /*
+ * Note that the port numbers in the string are 1-based.
+ *
  * Return codes:
  * -1  buffer overflow
  * 0   device not found




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2007-10-07 15:35:06 +0200 (Sun, 07 Oct 2007)
New Revision: 3104

Added:
   developers/werner/dfu-util-r3103.patch
Log:
configure.ac: added libusbpath.a and usbpath.h dependency
src/main.c: added search filter DFU_IFF_DEVNUM (bus, devnum)
src/main.c: added pseudo search filter DFU_IFF_PATH (path)
src/main.c (get_first_dfu_device, count_dfu_devices): abstracted common code
  into iterate_dfu_devices
src/main.c (iterate_dfu_devices): added filtering by USB device number
src/main.c (resolve_device_path): new function to resolve physical USB path to
  device number suitable for filtering
src/main.c (main): new option "-p bus-port. ... .port" to specify physical USB
   path
src/main.c (main): repeat resolution after bus reset



Added: developers/werner/dfu-util-r3103.patch
===================================================================
--- developers/werner/dfu-util-r3103.patch      2007-10-07 12:56:57 UTC (rev 
3103)
+++ developers/werner/dfu-util-r3103.patch      2007-10-07 13:35:06 UTC (rev 
3104)
@@ -0,0 +1,263 @@
+Index: configure.ac
+===================================================================
+--- configure.ac       (revision 3103)
++++ configure.ac       (working copy)
+@@ -17,12 +17,14 @@
+ 
+ PKG_CHECK_MODULES(USB, libusb >= 0.1.4,,
+                  AC_MSG_ERROR([*** Required libusb >= 0.1.4 not installed 
***]))
++AC_CHECK_LIB([usbpath],[usb_path2devnum],,,-lusb)
++
+ LIBS="$LIBS $USB_LIBS"
+ CFLAGS="$CFLAGS $USB_CFLAGS"
+ 
+ # Checks for header files.
+ AC_HEADER_STDC
+-AC_CHECK_HEADERS([stdlib.h string.h stdio.h])
++AC_CHECK_HEADERS([stdlib.h string.h stdio.h usbpath.h])
+ 
+ # Checks for typedefs, structures, and compiler characteristics.
+ AC_C_CONST
+Index: src/main.c
+===================================================================
+--- src/main.c (revision 3103)
++++ src/main.c (working copy)
+@@ -37,7 +37,11 @@
+ #include "config.h"
+ #endif
+ 
++#ifdef HAVE_USBPATH_H
++#include <usbpath.h>
++#endif
+ 
++
+ int debug;
+ static int verbose = 0;
+ 
+@@ -47,6 +51,8 @@
+ #define DFU_IFF_CONFIG                0x0400
+ #define DFU_IFF_IFACE         0x0800
+ #define DFU_IFF_ALT           0x1000
++#define DFU_IFF_DEVNUM                0x2000
++#define DFU_IFF_PATH          0x4000
+ 
+ struct usb_vendprod {
+       u_int16_t vendor;
+@@ -59,6 +65,9 @@
+       u_int8_t configuration;
+       u_int8_t interface;
+       u_int8_t altsetting;
++      int bus;
++      u_int8_t devnum;
++      const char *path;
+       unsigned int flags;
+       struct usb_device *dev;
+ 
+@@ -211,53 +220,74 @@
+       return num_found;
+ }
+ 
+-/* Find the first DFU-capable device, save it in dfu_if->dev */
+-static int get_first_dfu_device(struct dfu_if *dif)
++
++/* Iterate over all matching DFU capable devices within system */
++static int iterate_dfu_devices(struct dfu_if *dif,
++    int (*action)(struct usb_device *dev, void *user), void *user)
+ {
+       struct usb_bus *usb_bus;
+       struct usb_device *dev;
+ 
++      /* Walk the tree and find our device. */
+       for (usb_bus = usb_get_busses(); NULL != usb_bus;
+            usb_bus = usb_bus->next) {
+               for (dev = usb_bus->devices; NULL != dev; dev = dev->next) {
+-                      if (!dif || 
+-                          (dif->flags & (DFU_IFF_VENDOR|DFU_IFF_PRODUCT)) == 
0 ||
+-                          (dev->descriptor.idVendor == dif->vendor &&
+-                           dev->descriptor.idProduct == dif->product)) {
+-                              if (count_dfu_interfaces(dev) >= 1) {
+-                                      dif->dev = dev;
+-                                      return 1;
+-                              }
+-                      }
++                      int retval;
++
++                      if (dif && (dif->flags &
++                          (DFU_IFF_VENDOR|DFU_IFF_PRODUCT)) &&
++                          (dev->descriptor.idVendor != dif->vendor ||
++                          dev->descriptor.idProduct != dif->product))
++                              continue;
++                      if (dif && (dif->flags & DFU_IFF_DEVNUM) &&
++                          (atoi(usb_bus->dirname) != dif->bus ||
++                          dev->devnum != dif->devnum))
++                              continue;
++
++                      retval = action(dev, user);
++                      if (retval)
++                              return retval;
+               }
+       }
++      return 0;
++}
+ 
++
++static int found_dfu_device(struct usb_device *dev, void *user)
++{
++      struct dfu_if *dif = user;
++
++      dif->dev = dev;
++      return 1;
++}
++
++
++/* Find the first DFU-capable device, save it in dfu_if->dev */
++static int get_first_dfu_device(struct dfu_if *dif)
++{
++      return iterate_dfu_devices(dif, found_dfu_device, dif);
++}
++
++
++static int count_one_dfu_device(struct usb_device *dev, void *user)
++{
++      int *num = user;
++
++      (*num)++;
+       return 0;
+ }
+ 
++
+ /* Count DFU capable devices within system */
+ static int count_dfu_devices(struct dfu_if *dif)
+ {
+-      struct usb_bus *usb_bus;
+-      struct usb_device *dev;
+       int num_found = 0;
+ 
+-      /* Walk the tree and find our device. */
+-      for (usb_bus = usb_get_busses(); NULL != usb_bus;
+-           usb_bus = usb_bus->next) {
+-              for (dev = usb_bus->devices; NULL != dev; dev = dev->next) {
+-                      if (!dif || 
+-                          (dif->flags & (DFU_IFF_VENDOR|DFU_IFF_PRODUCT)) == 
0 ||
+-                          (dev->descriptor.idVendor == dif->vendor &&
+-                           dev->descriptor.idProduct == dif->product)) {
+-                              if (count_dfu_interfaces(dev) >= 1)
+-                                      num_found++;
+-                      }
+-              }
+-      }
++      iterate_dfu_devices(dif, count_one_dfu_device, &num_found);
+       return num_found;
+ }
+ 
++
+ static int list_dfu_interfaces(void)
+ {
+       struct usb_bus *usb_bus;
+@@ -294,6 +324,40 @@
+       return 0;
+ }
+ 
++
++#ifdef HAVE_USBPATH_H
++
++static int resolve_device_path(struct dfu_if *dif)
++{
++      int res;
++
++      if (!(dif->flags & DFU_IFF_PATH))
++              return 0;
++
++      res = usb_path2devnum(dif->path);
++      if (res < 0)
++              return -EINVAL;
++      if (!res)
++              return 0;
++
++      dif->bus = atoi(dif->path);
++      dif->devnum = res;
++      dif->flags |= DFU_IFF_DEVNUM;
++      return res;
++}
++
++#else /* HAVE_USBPATH_H */
++
++static int resolve_device_path(struct dfu_if *dif)
++{
++      fprintf(stderr,
++          "USB device paths are not supported by this dfu-util.\n");
++      exit(1);
++}
++
++#endif /* !HAVE_USBPATH_H */
++
++
+ static void help(void)
+ {
+       printf("Usage: dfu-util [options] ...\n"
+@@ -301,6 +365,7 @@
+               "  -V --version\t\t\tPrint the version number\n"
+               "  -l --list\t\t\tList the currently attached DFU capable USB 
devices\n"
+               "  -d --device vendor:product\tSpecify Vendor/Product ID of DFU 
device\n"
++              "  -p --path bus-port. ... .port\tSpecify path to DFU device\n"
+               "  -c --cfg config_nr\t\tSpecify the Configuration of DFU 
device\n"
+               "  -i --intf intf_nr\t\tSpecify the DFU Interface number\n"
+               "  -a --alt alt\t\t\tSpecify the Altsetting of the DFU 
Interface\n"
+@@ -323,6 +388,7 @@
+       { "verbose", 0, 0, 'v' },
+       { "list", 0, 0, 'l' },
+       { "device", 1, 0, 'd' },
++      { "path", 1, 0, 'p' },
+       { "configuration", 1, 0, 'c' },
+       { "cfg", 1, 0, 'c' },
+       { "interface", 1, 0, 'i' },
+@@ -370,7 +436,7 @@
+ 
+       while (1) {
+               int c, option_index = 0;
+-              c = getopt_long(argc, argv, "hVvld:c:i:a:t:U:D:R", opts, 
&option_index);
++              c = getopt_long(argc, argv, "hVvld:p:c:i:a:t:U:D:R", opts, 
&option_index);
+               if (c == -1)
+                       break;
+ 
+@@ -400,6 +466,21 @@
+                       dif->product = vendprod.product;
+                       dif->flags |= (DFU_IFF_VENDOR | DFU_IFF_PRODUCT);
+                       break;
++              case 'p':
++                      /* Parse device path */
++                      dif->path = optarg;
++                      dif->flags |= DFU_IFF_PATH;
++                      ret = resolve_device_path(dif);
++                      if (ret < 0) {
++                              fprintf(stderr, "unable to parse `%s'\n",
++                                  optarg);
++                              exit(2);
++                      }
++                      if (!ret) {
++                              fprintf(stderr, "cannot find `%s'\n", optarg);
++                              exit(1);
++                      }
++                      break;
+               case 'c':
+                       /* Configuration */
+                       dif->configuration = atoi(optarg);
+@@ -535,6 +616,18 @@
+               if (usb_find_devices() < 2)
+                       printf("not at least 2 device changes found ?!?\n");
+ 
++              ret = resolve_device_path(dif);
++              if (ret < 0) {
++                      fprintf(stderr,
++                          "internal error: cannot re-parse `%s'\n",
++                          dif->path);
++                      abort();
++              }
++              if (!ret) {
++                      fprintf(stderr, "Can't resolve path after RESET?\n");
++                      exit(1);
++              }
++
+               num_devs = count_dfu_devices(dif);
+               if (num_devs == 0) {
+                       fprintf(stderr, "Lost device after RESET?\n");




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-10-07 18:54:47 +0200 (Sun, 07 Oct 2007)
New Revision: 3105

Added:
   trunk/src/target/kernel/patches/lis302dl.patch
Modified:
   trunk/src/target/kernel/patches/series
Log:
add preliminary lis302 accelerometer input device driver for GTA02


Added: trunk/src/target/kernel/patches/lis302dl.patch
===================================================================
--- trunk/src/target/kernel/patches/lis302dl.patch      2007-10-07 13:35:06 UTC 
(rev 3104)
+++ trunk/src/target/kernel/patches/lis302dl.patch      2007-10-07 16:54:47 UTC 
(rev 3105)
@@ -0,0 +1,750 @@
+This is a Linux driver for the STmicro LIS302DL 3-axis accelerometer.
+
+Signed-off-by: Harald Welte <[EMAIL PROTECTED]>
+
+Index: linux-2.6.22.5-moko/arch/arm/mach-s3c2440/mach-gta02.c
+===================================================================
+--- linux-2.6.22.5-moko.orig/arch/arm/mach-s3c2440/mach-gta02.c
++++ linux-2.6.22.5-moko/arch/arm/mach-s3c2440/mach-gta02.c
+@@ -310,6 +310,7 @@
+       &s3c_device_usbgadget,
+       &s3c_device_nand,
+       &s3c_device_ts,
++      &s3c_device_spi1,
+ };
+ 
+ static struct s3c2410_nand_set gta02_nand_sets[] = {
+@@ -439,6 +440,47 @@
+       .board_info     = gta02_spi_board_info,
+ };
+ 
++static void gta02_spi_acc_set_cs(struct s3c2410_spi_info *spi, int cs, int 
pol)
++{
++      s3c2410_gpio_setpin(cs, pol);
++}
++
++static 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            = S3C2410_EINT0,
++              .max_speed_hz   = 400 * 1000,
++              .bus_num        = 1,
++              .chip_select    = S3C2410_GPD12,
++              .mode           = SPI_MODE_3,
++      },
++      {
++              .modalias       = "lis302dl",
++              .platform_data  = lis302_pdata[1],
++              .irq            = S3C2410_EINT16,
++              .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,
++};
++
++
+ #if 0
+ #ifdef SPI_HARD
+ static struct s3c2410_spi_info spi_cfg = {
+@@ -628,6 +670,7 @@
+       s3c_device_usb.dev.platform_data = &gta02_usb_info;
+       s3c_device_nand.dev.platform_data = &gta02_nand_info;
+       s3c_device_sdi.dev.platform_data = &gta02_mmc_cfg;
++      s3c_device_spi1.dev.platform_data = &gta02_spi_acc_cfg;
+ 
+       INIT_WORK(&gta02_udc_vbus_drawer.work, __gta02_udc_vbus_draw);
+       s3c24xx_udc_set_platdata(&gta02_udc_cfg);
+Index: linux-2.6.22.5-moko/drivers/spi/lis302dl.c
+===================================================================
+--- /dev/null
++++ linux-2.6.22.5-moko/drivers/spi/lis302dl.c
+@@ -0,0 +1,633 @@
++/* Linux kernel driver for the ST LIS302D 3-axis accelerometer
++ *
++ * Copyright (C) 2007 by OpenMoko, Inc.
++ * Author: Harald Welte <[EMAIL PROTECTED]>
++ * All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License as
++ * published by the Free Software Foundation; either version 2 of
++ * the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ * MA 02111-1307 USA
++ *
++ * TODO
++ *    * statistics for overflow events
++ *    * configuration interface (sysfs) for
++ *            * enable/disable x/y/z axis data ready
++ *            * enable/disable resume from freee fall / click
++ *            * free fall / click parameters
++ *            * high pass filter parameters
++ */
++#include <linux/kernel.h>
++#include <linux/types.h>
++#include <linux/module.h>
++#include <linux/device.h>
++#include <linux/platform_device.h>
++#include <linux/delay.h>
++#include <linux/input.h>
++#include <linux/irq.h>
++#include <linux/interrupt.h>
++#include <linux/sysfs.h>
++
++#include <linux/lis302dl.h>
++
++#include <linux/spi/spi.h>
++
++#define LIS302DL_WHO_AM_I_MAGIC               0x3b
++
++enum lis302dl_reg {
++      LIS302DL_REG_WHO_AM_I           = 0x0f,
++      LIS302DL_REG_CTRL1              = 0x20,
++      LIS302DL_REG_CTRL2              = 0x21,
++      LIS302DL_REG_CTRL3              = 0x22,
++      LIS302DL_REG_HP_FILTER_RESET    = 0x23,
++      LIS302DL_REG_STATUS             = 0x27,
++      LIS302DL_REG_OUT_X              = 0x29,
++      LIS302DL_REG_OUT_Y              = 0x2b,
++      LIS302DL_REG_OUT_Z              = 0x2d,
++      LIS302DL_REG_FF_WU_CFG_1        = 0x30,
++      LIS302DL_REG_FF_WU_SRC_1        = 0x31,
++      LIS302DL_REG_FF_WU_THS_1        = 0x32,
++      LIS302DL_REG_FF_WU_DURATION_1   = 0x33,
++      LIS302DL_REG_FF_WU_CFG_2        = 0x34,
++      LIS302DL_REG_FF_WU_SRC_2        = 0x35,
++      LIS302DL_REG_FF_WU_THS_2        = 0x36,
++      LIS302DL_REG_FF_WU_DURATION_2   = 0x37,
++      LIS302DL_REG_CLICK_CFG          = 0x38,
++      LIS302DL_REG_CLICK_SRC          = 0x39,
++      LIS302DL_REG_CLICK_THSY_X       = 0x3b,
++      LIS302DL_REG_CLICK_THSZ         = 0x3c,
++      LIS302DL_REG_CLICK_TIME_LIMIT   = 0x3d,
++      LIS302DL_REG_CLICK_LATENCY      = 0x3e,
++      LIS302DL_REG_CLICK_WINDOW       = 0x3f,
++};
++
++enum lis302dl_reg_ctrl1 {
++      LIS302DL_CTRL1_Xen              = 0x01,
++      LIS302DL_CTRL1_Yen              = 0x02,
++      LIS302DL_CTRL1_Zen              = 0x04,
++      LIS302DL_CTRL1_STM              = 0x08,
++      LIS302DL_CTRL1_STP              = 0x10,
++      LIS302DL_CTRL1_FS               = 0x20,
++      LIS302DL_CTRL1_PD               = 0x40,
++      LIS302DL_CTRL1_DR               = 0x80,
++};
++
++enum lis302dl_reg_ctrl3 {
++      LIS302DL_CTRL3_PP_OD            = 0x40,
++};
++
++enum lis302dl_reg_status {
++      LIS302DL_STATUS_XDA             = 0x01,
++      LIS302DL_STATUS_YDA             = 0x02,
++      LIS302DL_STATUS_ZDA             = 0x04,
++      LIS302DL_STATUS_XYZDA           = 0x08,
++      LIS302DL_STATUS_XOR             = 0x10,
++      LIS302DL_STATUS_YOR             = 0x20,
++      LIS302DL_STATUS_ZOR             = 0x40,
++      LIS302DL_STATUS_XYZOR           = 0x80,
++};
++
++enum lis302dl_reg_ffwusrc1 {
++      LIS302DL_FFWUSRC1_XL            = 0x01,
++      LIS302DL_FFWUSRC1_XH            = 0x02,
++      LIS302DL_FFWUSRC1_YL            = 0x04,
++      LIS302DL_FFWUSRC1_YH            = 0x08,
++      LIS302DL_FFWUSRC1_ZL            = 0x10,
++      LIS302DL_FFWUSRC1_ZH            = 0x20,
++      LIS302DL_FFWUSRC1_IA            = 0x40,
++};
++
++enum lis302dl_reg_cloik_src {
++      LIS302DL_CLICKSRC_SINGLE_X      = 0x01,
++      LIS302DL_CLICKSRC_DOUBLE_X      = 0x02,
++      LIS302DL_CLICKSRC_SINGLE_Y      = 0x04,
++      LIS302DL_CLICKSRC_DOUBLE_Y      = 0x08,
++      LIS302DL_CLICKSRC_SINGLE_Z      = 0x10,
++      LIS302DL_CLICKSRC_DOUBLE_Z      = 0x20,
++      LIS302DL_CLICKSRC_IA            = 0x40,
++};
++
++struct lis302dl_info {
++      struct spi_device *spi_dev;
++      struct input_dev *input_dev;
++      struct mutex lock;
++      struct work_struct work;
++      unsigned int flags;
++      unsigned int working;
++      u_int8_t regs[0x40];
++};
++
++#define LIS302DL_F_WUP_FF             0x0001  /* wake up from free fall */
++#define LIS302DL_F_WUP_CLICK          0x0002
++#define LIS302DL_F_POWER              0x0010
++#define LIS302DL_F_FS                 0x0020  /* ADC full scale */
++
++/* lowlevel register access functions */
++
++#define READ_BIT      0x01
++#define MS_BIT                0x02
++#define ADDR_SHIFT    2
++
++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;
++
++      rc = spi_w8r8(lis->spi_dev, cmd);
++
++      return rc;
++}
++
++static u_int8_t reg_read(struct lis302dl_info *lis, u_int8_t reg)
++{
++      u_int8_t ret;
++
++      mutex_lock(&lis->lock);
++      ret = __reg_read(lis, reg);
++      mutex_unlock(&lis->lock);
++
++      return ret;
++}
++
++static inline int __reg_write(struct lis302dl_info *lis, u_int8_t reg, 
u_int8_t val)
++{
++      u_int8_t buf[2];
++
++      buf[0] = (reg << ADDR_SHIFT);
++      buf[1] = val;
++
++      return spi_write(lis->spi_dev, buf, sizeof(buf));
++}
++
++static int reg_write(struct lis302dl_info *lis, u_int8_t reg, u_int8_t val)
++{
++      int ret;
++
++      mutex_lock(&lis->lock);
++      ret = __reg_write(lis, reg, val);
++      mutex_unlock(&lis->lock);
++
++      return ret;
++}
++
++static int reg_set_bit_mask(struct lis302dl_info *lis,
++                          u_int8_t reg, u_int8_t mask, u_int8_t val)
++{
++      int ret;
++      u_int8_t tmp;
++
++      val &= mask;
++
++      mutex_lock(&lis->lock);
++
++      tmp = __reg_read(lis, reg);
++      tmp &= ~mask;
++      tmp |= val;
++      ret = __reg_write(lis, reg, tmp);
++
++      mutex_unlock(&lis->lock);
++
++      return ret;
++}
++
++/* interrupt handling related */
++
++enum lis302dl_intmode {
++      LIS302DL_INTMODE_GND            = 0x00,
++      LIS302DL_INTMODE_FF_WU_1        = 0x01,
++      LIX302DL_INTMODE_FF_WU_2        = 0x02,
++      LIX302DL_INTMODE_FF_WU_12       = 0x03,
++      LIX302DL_INTMODE_DATA_READY     = 0x04,
++      LIX302DL_INTMODE_CLICK          = 0x07,
++};
++
++static void lis302dl_int_mode(struct spi_device *spi, int int_pin,
++                            enum lis302dl_intmode mode)
++{
++      struct lis302dl_info *lis = dev_get_drvdata(&spi->dev);
++
++      if (int_pin == 1)
++              reg_set_bit_mask(lis, LIS302DL_REG_CTRL3, 0x07, mode);
++      else if (int_pin == 2)
++              reg_set_bit_mask(lis, LIS302DL_REG_CTRL3, 0x38, mode << 3);
++}
++
++static void _report_btn_single(struct input_dev *inp, int btn)
++{
++      input_report_key(inp, btn, 1);
++      input_sync(inp);
++      input_report_key(inp, btn, 0);
++}
++
++static void _report_btn_double(struct input_dev *inp, int btn)
++{
++      input_report_key(inp, btn, 1);
++      input_sync(inp);
++      input_report_key(inp, btn, 0);
++      input_sync(inp);
++      input_report_key(inp, btn, 1);
++      input_sync(inp);
++      input_report_key(inp, btn, 0);
++}
++
++static void lis302dl_work(struct work_struct *work)
++{
++      struct lis302dl_info *lis =
++                      container_of(work, struct lis302dl_info, work);
++
++      u_int8_t status, ff_wu_src_1, click_src;
++      u_int8_t val;
++
++      lis->working = 1;
++
++      status = reg_read(lis, LIS302DL_REG_STATUS);
++      ff_wu_src_1 = reg_read(lis, LIS302DL_REG_FF_WU_SRC_1);
++      click_src = reg_read(lis, LIS302DL_REG_CLICK_SRC);
++
++      if (status & LIS302DL_STATUS_XDA) {
++              val = reg_read(lis, LIS302DL_REG_OUT_X);
++              if (lis->flags & LIS302DL_F_FS)
++                      val = val << 2;
++              input_report_rel(lis->input_dev, REL_X, val);
++      }
++
++      if (status & LIS302DL_STATUS_YDA) {
++              val = reg_read(lis, LIS302DL_REG_OUT_Y);
++              if (lis->flags & LIS302DL_F_FS)
++                      val = val << 2;
++              input_report_rel(lis->input_dev, REL_Y, val);
++      }
++
++      if (status & LIS302DL_STATUS_ZDA) {
++              val = reg_read(lis, LIS302DL_REG_OUT_Z);
++              if (lis->flags & LIS302DL_F_FS)
++                      val = val << 2;
++              input_report_rel(lis->input_dev, REL_Z, val);
++      }
++
++      if (status & 0xf0)
++              dev_dbg(&lis->spi_dev->dev, "overrun!\n");
++
++      /* FIXME: implement overrun statistics */
++
++      if (ff_wu_src_1 & LIS302DL_FFWUSRC1_IA) {
++              /* FIXME: free fall interrupt handling */
++      }
++
++      if (click_src & LIS302DL_CLICKSRC_IA) {
++              if (click_src & LIS302DL_CLICKSRC_SINGLE_X)
++                      _report_btn_single(lis->input_dev, BTN_X);
++              if (click_src & LIS302DL_CLICKSRC_DOUBLE_X)
++                      _report_btn_double(lis->input_dev, BTN_X);
++
++              if (click_src & LIS302DL_CLICKSRC_SINGLE_Y)
++                      _report_btn_single(lis->input_dev, BTN_Y);
++              if (click_src & LIS302DL_CLICKSRC_DOUBLE_Y)
++                      _report_btn_double(lis->input_dev, BTN_Y);
++
++              if (click_src & LIS302DL_CLICKSRC_SINGLE_Z)
++                      _report_btn_single(lis->input_dev, BTN_Z);
++              if (click_src & LIS302DL_CLICKSRC_DOUBLE_Z)
++                      _report_btn_double(lis->input_dev, BTN_Z);
++      }
++
++      lis->working = 0;
++      input_sync(lis->input_dev);
++      put_device(&lis->spi_dev->dev);
++
++      enable_irq(lis->spi_dev->irq);
++}
++
++static void lis302dl_schedule_work(struct lis302dl_info *lis)
++{
++      int status;
++
++      get_device(&lis->spi_dev->dev);
++      status = schedule_work(&lis->work);
++      if (!status && !lis->working)
++              dev_dbg(&lis->spi_dev->dev, "work item may be lost\n");
++}
++
++static irqreturn_t lis302dl_interrupt(int irq, void *_lis)
++{
++      struct lis302dl_info *lis = _lis;
++
++      lis302dl_schedule_work(lis);
++
++      /* Disable any further interrupts until we have processed
++       * the current one */
++      disable_irq(lis->spi_dev->irq);
++
++      return IRQ_HANDLED;
++}
++
++/* sysfs */
++
++static ssize_t show_rate(struct device *dev, struct device_attribute *attr,
++                       char *buf)
++{
++      struct lis302dl_info *lis = dev_get_drvdata(dev);
++      u_int8_t ctrl1 = reg_read(lis, LIS302DL_REG_CTRL1);
++
++      return sprintf(buf, "%d\n", ctrl1 & LIS302DL_CTRL1_DR ? 400 : 100);
++}
++
++static ssize_t set_rate(struct device *dev, struct device_attribute *attr,
++                      const char *buf, size_t count)
++{
++      struct lis302dl_info *lis = dev_get_drvdata(dev);
++
++      if (!strcmp(buf, "400\n"))
++              reg_set_bit_mask(lis, LIS302DL_REG_CTRL1, LIS302DL_CTRL1_DR,
++                               LIS302DL_CTRL1_DR);
++      else
++              reg_set_bit_mask(lis, LIS302DL_REG_CTRL1, LIS302DL_CTRL1_DR, 0);
++
++      return count;
++}
++
++static DEVICE_ATTR(sample_rate, S_IRUGO | S_IWUSR, show_rate, set_rate);
++
++static ssize_t show_scale(struct device *dev, struct device_attribute *attr,
++                        char *buf)
++{
++      struct lis302dl_info *lis = dev_get_drvdata(dev);
++      u_int8_t ctrl1 = reg_read(lis, LIS302DL_REG_CTRL1);
++
++      return sprintf(buf, "%s\n", ctrl1 & LIS302DL_CTRL1_FS ? "9.2" : "2.3");
++}
++
++static ssize_t set_scale(struct device *dev, struct device_attribute *attr,
++                       const char *buf, size_t count)
++{
++      struct lis302dl_info *lis = dev_get_drvdata(dev);
++
++      if (!strcmp(buf, "9.2\n"))
++              reg_set_bit_mask(lis, LIS302DL_REG_CTRL1, LIS302DL_CTRL1_FS,
++                               LIS302DL_CTRL1_FS);
++      else
++              reg_set_bit_mask(lis, LIS302DL_REG_CTRL1, LIS302DL_CTRL1_FS, 0);
++
++      return count;
++}
++
++static DEVICE_ATTR(full_scale, S_IRUGO | S_IWUSR, show_scale, set_scale);
++
++static struct attribute *lis302dl_sysfs_entries[] = {
++      &dev_attr_sample_rate.attr,
++      &dev_attr_full_scale.attr,
++};
++
++static struct attribute_group lis302dl_attr_group = {
++      .name   = NULL,
++      .attrs  = lis302dl_sysfs_entries,
++};
++
++/* input device handling and driver core interaction */
++
++static int lis302dl_input_open(struct input_dev *inp)
++{
++      struct lis302dl_info *lis = inp->private;
++      u_int8_t ctrl1 = LIS302DL_CTRL1_PD | LIS302DL_CTRL1_Xen |
++                       LIS302DL_CTRL1_Yen | LIS302DL_CTRL1_Zen;
++
++      /* make sure we're powered up and generate data ready */
++      reg_set_bit_mask(lis, LIS302DL_REG_CTRL1, ctrl1, ctrl1);
++
++      return 0;
++}
++
++static void lis302dl_input_close(struct input_dev *inp)
++{
++      struct lis302dl_info *lis = inp->private;
++      u_int8_t ctrl1 = LIS302DL_CTRL1_Xen | LIS302DL_CTRL1_Yen |
++                       LIS302DL_CTRL1_Zen;
++
++      /* since the input core already serializes access and makes sure we
++       * only see close() for the close of the lastre user, we can safely
++       * disable the data ready events */
++      reg_set_bit_mask(lis, LIS302DL_REG_CTRL1, ctrl1, 0x00);
++
++      /* however, don't power down the whole device if still needed */
++      if (!(lis->flags & LIS302DL_F_WUP_FF ||
++            lis->flags & LIS302DL_F_WUP_CLICK)) {
++              reg_set_bit_mask(lis, LIS302DL_REG_CTRL1, LIS302DL_CTRL1_PD,
++                               0x00);
++      }
++}
++
++static int __devinit lis302dl_probe(struct spi_device *spi)
++{
++      int rc;
++      struct lis302dl_info *lis;
++      u_int8_t wai;
++
++      lis = kzalloc(sizeof(*lis), GFP_KERNEL);
++      if (!lis)
++              return -ENOMEM;
++
++      mutex_init(&lis->lock);
++      INIT_WORK(&lis->work, lis302dl_work);
++      lis->spi_dev = spi;
++
++      spi_set_drvdata(spi, lis);
++
++      rc = spi_setup(spi);
++      if (rc < 0) {
++              printk(KERN_ERR "error durign spi_setup of lis302dl driver\n");
++              dev_set_drvdata(&spi->dev, NULL);
++              kfree(lis);
++              return rc;
++      }
++
++      wai = reg_read(lis, LIS302DL_REG_WHO_AM_I);
++      if (wai != LIS302DL_WHO_AM_I_MAGIC) {
++              printk(KERN_ERR "unknown who_am_i signature 0x%02x\n", wai);
++              dev_set_drvdata(&spi->dev, NULL);
++              kfree(lis);
++              return -ENODEV;
++      }
++
++      /* switch interrupt to open collector */
++      reg_write(lis, LIS302DL_CTRL3_PP_OD, 0x7c);
++
++      rc = request_irq(lis->spi_dev->irq, lis302dl_interrupt, IRQF_DISABLED,
++                       "lis302dl", NULL);
++      if (rc < 0) {
++              dev_err(&spi->dev, "error requesting IRQ %d\n",
++                      lis->spi_dev->irq);
++              /* FIXME */
++              return rc;
++      }
++
++      rc = sysfs_create_group(&spi->dev.kobj, &lis302dl_attr_group);
++      if (rc) {
++              dev_err(&spi->dev, "error creating sysfs group\n");
++              /* FIXME */
++              return rc;
++      }
++
++      /* initialize input layer details */
++      lis->input_dev = input_allocate_device();
++      if (!lis->input_dev) {
++              dev_err(&spi->dev, "Unable to allocate input device\n");
++              /* FIXME */
++      }
++
++      set_bit(EV_REL, lis->input_dev->evbit);
++      set_bit(EV_KEY, lis->input_dev->evbit);
++      set_bit(BTN_X, lis->input_dev->keybit);
++      set_bit(BTN_Y, lis->input_dev->keybit);
++      set_bit(BTN_Z, lis->input_dev->keybit);
++
++      lis->input_dev->private = lis;
++      lis->input_dev->name = "lis302dl"; /* FIXME: platform data */
++      lis->input_dev->id.bustype = BUS_I2C; /* FIXME: SPI Bus */
++      lis->input_dev->open = lis302dl_input_open;
++      lis->input_dev->close = lis302dl_input_close;
++
++      input_register_device(lis->input_dev);
++
++      return 0;
++}
++
++static int __devexit lis302dl_remove(struct spi_device *spi)
++{
++      struct lis302dl_info *lis = dev_get_drvdata(&spi->dev);
++
++      /* power down the device */
++      reg_write(lis, LIS302DL_REG_CTRL1, 0x00);
++      sysfs_remove_group(&spi->dev.kobj, &lis302dl_attr_group);
++      input_unregister_device(lis->input_dev);
++      dev_set_drvdata(&spi->dev, NULL);
++      kfree(lis);
++
++      return 0;
++}
++
++#ifdef CONFIG_PM
++static int lis302dl_suspend(struct spi_device *spi, pm_message_t state)
++{
++      struct lis302dl_info *lis = dev_get_drvdata(&spi->dev);
++
++      /* save registers */
++      lis->regs[LIS302DL_REG_CTRL1] = reg_read(lis, LIS302DL_REG_CTRL1);
++      lis->regs[LIS302DL_REG_CTRL2] = reg_read(lis, LIS302DL_REG_CTRL2);
++      lis->regs[LIS302DL_REG_CTRL3] = reg_read(lis, LIS302DL_REG_CTRL3);
++      lis->regs[LIS302DL_REG_FF_WU_CFG_1] =
++                              reg_read(lis, LIS302DL_REG_FF_WU_CFG_1);
++      lis->regs[LIS302DL_REG_FF_WU_THS_1] =
++                              reg_read(lis, LIS302DL_REG_FF_WU_THS_1);
++      lis->regs[LIS302DL_REG_FF_WU_DURATION_1] =
++                              reg_read(lis, LIS302DL_REG_FF_WU_DURATION_1);
++      lis->regs[LIS302DL_REG_FF_WU_CFG_2] =
++                              reg_read(lis, LIS302DL_REG_FF_WU_CFG_2);
++      lis->regs[LIS302DL_REG_FF_WU_THS_2] =
++                              reg_read(lis, LIS302DL_REG_FF_WU_THS_2);
++      lis->regs[LIS302DL_REG_FF_WU_DURATION_2] =
++                              reg_read(lis, LIS302DL_REG_FF_WU_DURATION_2);
++      lis->regs[LIS302DL_REG_CLICK_CFG] =
++                              reg_read(lis, LIS302DL_REG_CLICK_CFG);
++      lis->regs[LIS302DL_REG_CLICK_THSY_X] =
++                              reg_read(lis, LIS302DL_REG_CLICK_THSY_X);
++      lis->regs[LIS302DL_REG_CLICK_THSZ] =
++                              reg_read(lis, LIS302DL_REG_CLICK_THSZ);
++      lis->regs[LIS302DL_REG_CLICK_TIME_LIMIT] =
++                              reg_read(lis, LIS302DL_REG_CLICK_TIME_LIMIT);
++      lis->regs[LIS302DL_REG_CLICK_LATENCY] =
++                              reg_read(lis, LIS302DL_REG_CLICK_LATENCY);
++      lis->regs[LIS302DL_REG_CLICK_WINDOW] =
++                              reg_read(lis, LIS302DL_REG_CLICK_WINDOW);
++
++      /* determine if we want to wake up from the accel. */
++      if (!(lis->flags & LIS302DL_F_WUP_FF ||
++            lis->flags & LIS302DL_F_WUP_CLICK)) {
++              /* power down */
++              u_int8_t tmp;
++              tmp = reg_read(lis, LIS302DL_REG_CTRL1);
++              tmp &= ~LIS302DL_CTRL1_PD;
++              reg_write(lis, LIS302DL_REG_CTRL1, tmp);
++      }
++
++      return 0;
++}
++
++static int lis302dl_resume(struct spi_device *spi)
++{
++      struct lis302dl_info *lis = dev_get_drvdata(&spi->dev);
++
++      /* restore registers after resume */
++      reg_write(lis, LIS302DL_REG_CTRL1, lis->regs[LIS302DL_REG_CTRL1]);
++      reg_write(lis, LIS302DL_REG_CTRL2, lis->regs[LIS302DL_REG_CTRL2]);
++      reg_write(lis, LIS302DL_REG_CTRL3, lis->regs[LIS302DL_REG_CTRL3]);
++      reg_write(lis, LIS302DL_REG_FF_WU_CFG_1,
++                lis->regs[LIS302DL_REG_FF_WU_CFG_1]);
++      reg_write(lis, LIS302DL_REG_FF_WU_THS_1,
++                lis->regs[LIS302DL_REG_FF_WU_THS_1]);
++      reg_write(lis, LIS302DL_REG_FF_WU_DURATION_1,
++                lis->regs[LIS302DL_REG_FF_WU_DURATION_1]);
++      reg_write(lis, LIS302DL_REG_FF_WU_CFG_2,
++                lis->regs[LIS302DL_REG_FF_WU_CFG_2]);
++      reg_write(lis, LIS302DL_REG_FF_WU_THS_2,
++                lis->regs[LIS302DL_REG_FF_WU_THS_2]);
++      reg_write(lis, LIS302DL_REG_FF_WU_DURATION_2,
++                lis->regs[LIS302DL_REG_FF_WU_DURATION_2]);
++      reg_write(lis, LIS302DL_REG_CLICK_CFG,
++                lis->regs[LIS302DL_REG_CLICK_CFG]);
++      reg_write(lis, LIS302DL_REG_CLICK_THSY_X,
++                lis->regs[LIS302DL_REG_CLICK_THSY_X]);
++      reg_write(lis, LIS302DL_REG_CLICK_THSZ,
++                lis->regs[LIS302DL_REG_CLICK_THSZ]);
++      reg_write(lis, LIS302DL_REG_CLICK_TIME_LIMIT,
++                lis->regs[LIS302DL_REG_CLICK_TIME_LIMIT]);
++      reg_write(lis, LIS302DL_REG_CLICK_LATENCY,
++                lis->regs[LIS302DL_REG_CLICK_LATENCY]);
++      reg_write(lis, LIS302DL_REG_CLICK_WINDOW,
++                lis->regs[LIS302DL_REG_CLICK_WINDOW]);
++
++      return 0;
++}
++#else
++#define lis302dl_suspend      NULL
++#define lis302dl_resume               NULL
++#endif
++
++static struct spi_driver lis302dl_driver = {
++      .driver = {
++              .name   = "lis302dl",
++              .owner  = THIS_MODULE,
++      },
++
++      .probe   = lis302dl_probe,
++      .remove  = __devexit_p(lis302dl_remove),
++      .suspend = lis302dl_suspend,
++      .resume  = lis302dl_resume,
++};
++
++static int __init lis302dl_init(void)
++{
++      return spi_register_driver(&lis302dl_driver);
++}
++
++static void __exit lis302dl_exit(void)
++{
++      spi_unregister_driver(&lis302dl_driver);
++}
++
++MODULE_AUTHOR("Harald Welte <[EMAIL PROTECTED]>");
++MODULE_LICENSE("GPL");
++
++module_init(lis302dl_init);
++module_exit(lis302dl_exit);
+Index: linux-2.6.22.5-moko/drivers/spi/Kconfig
+===================================================================
+--- linux-2.6.22.5-moko.orig/drivers/spi/Kconfig
++++ linux-2.6.22.5-moko/drivers/spi/Kconfig
+@@ -197,5 +197,9 @@
+       tristate "tpo JP6K74 LCM ASIC"
+       depends on SPI_MASTER && (MACH_NEO1973_GTA01 || MACH_QT2410)
+ 
++config SPI_SLAVE_LIS302DL
++      tristate "STmicro LIS302DL 3-axis accelerometer"
++      depends on SPI_MASTER && MACH_NEO1973_GTA02
++
+ endmenu # "SPI support"
+ 
+Index: linux-2.6.22.5-moko/drivers/spi/Makefile
+===================================================================
+--- linux-2.6.22.5-moko.orig/drivers/spi/Makefile
++++ linux-2.6.22.5-moko/drivers/spi/Makefile
+@@ -35,4 +35,5 @@
+ 
+ # SPI slave drivers (protocol for that link)
+ obj-$(CONFIG_SPI_SLAVE_JBT6K74)               += jbt6k74.o
++obj-$(CONFIG_SPI_SLAVE_LIS302DL)      += lis302dl.o
+ #     ... add above this line ...
+Index: linux-2.6.22.5-moko/include/linux/lis302dl.h
+===================================================================
+--- /dev/null
++++ linux-2.6.22.5-moko/include/linux/lis302dl.h
+@@ -0,0 +1,11 @@
++#ifndef _LINUX_LIS302DL_H
++#define _LINUX_LIS302DL_H
++
++#include <linux/types.h>
++
++struct lis302dl_platform_data {
++      char *name;
++};
++
++#endif /* _LINUX_LIS302DL_H */
++

Modified: trunk/src/target/kernel/patches/series
===================================================================
--- trunk/src/target/kernel/patches/series      2007-10-07 13:35:06 UTC (rev 
3104)
+++ trunk/src/target/kernel/patches/series      2007-10-07 16:54:47 UTC (rev 
3105)
@@ -43,3 +43,4 @@
 s3c24xx-nand-largepage.patch
 s3c2442b-cpuid.patch
 gta02-core.patch
+lis302dl.patch




--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to