2 * drivers/i2c/chips/lis302dl.c
3 * Driver for STMicroelectronics LIS302DL acceleration sensor
5 * Copyright (C) 2008 Nokia Corporation
7 * Written by Henrik Saari <henrik.saari@nokia.com>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 #include <linux/module.h>
25 #include <linux/i2c.h>
26 #include <linux/interrupt.h>
27 #include <linux/delay.h>
29 #include <linux/platform_device.h>
30 #include <linux/gpio.h>
31 #include <linux/lis302dl.h>
32 #include <mach/board.h>
34 #define DRIVER_NAME "lis302dl"
36 #define LIS302_WHOAMI 0x0f
37 #define LIS302_CTRL_1 0x20
38 # define LIS302_CTRL1_DR (1 << 7)
39 # define LIS302_CTRL1_PD (1 << 6)
40 # define LIS302_CTRL1_FS (1 << 5)
41 # define LIS302_CTRL1_STP (1 << 4)
42 # define LIS302_CTRL1_STM (1 << 3)
43 # define LIS302_CTRL1_Z (1 << 2)
44 # define LIS302_CTRL1_Y (1 << 1)
45 # define LIS302_CTRL1_X (1 << 0)
46 #define LIS302_CTRL_2 0x21
47 # define LIS302_CTRL2_BOOT (1 << 6)
48 #define LIS302_CTRL_3 0x22
49 # define LIS302_CTRL3_GND 0x00
50 # define LIS302_CTRL3_FF_WU_1 0x01
51 # define LIS302_CTRL3_FF_WU_2 0x02
52 # define LIS302_CTRL3_FF_WU_12 0x03
53 # define LIS302_CTRL3_DATA_RDY 0x04
54 # define LIS302_CTRL3_CLICK 0x07
55 #define LIS302_HP_FILTER_RESET 0x23
56 #define LIS302_STATUS_REG 0x27
60 #define LIS302_FF_WU_CFG_1 0x30
62 /* configurable interrupt events */
63 #define LIS302_X_LOW (1 << 0)
64 #define LIS302_X_HIGH (1 << 1)
65 #define LIS302_Y_LOW (1 << 2)
66 #define LIS302_Y_HIGH (1 << 3)
67 #define LIS302_Z_LOW (1 << 4)
68 #define LIS302_Z_HIGH (1 << 5)
69 #define LIS302_LIR (1 << 6)
70 #define LIS302_AOI (1 << 7)
72 #define LIS302_FF_WU_SRC_1 0x31
73 #define LIS302_FF_THS_1 0x32
74 #define LIS302_FF_WU_DURATION_1 0x33
75 #define LIS302_FF_WU_CFG_2 0x34
76 #define LIS302_FF_WU_SRC_2 0x34
77 #define LIS302_FF_THS_2 0x35
78 #define LIS302_FF_WU_DURATION_2 0x37
81 #define LIS302_THS 810 /* mg */
82 #define LIS302_DURATION 500 /* ms */
83 #define LIS302_400HZ 1 /* sample rate 400Hz */
84 #define LIS302_100HZ 0 /* sample rate 100Hz */
85 #define LIS302_FS 0 /* full scale 0 / 1 */
86 #define LIS302_SAMPLES 1
87 #define LIS302_SMALL_UNIT 18 /* Typical value 18 mg/digit */
88 #define LIS302_BIG_UNIT 72 /* Typical value 72 mg/digit */
89 #define LIS302_TURN_ON_TIME 3000 /* Turn on time 3000ms / data rate */
91 #define LIS302_POWEROFF_DELAY (5 * HZ)
93 /* A lis302dl chip will contain this value in LIS302_WHOAMI register */
94 #define LIS302_WHOAMI_VALUE 0x3b
95 #define LIS302_IRQ_FLAGS (IRQF_TRIGGER_RISING | IRQF_SAMPLE_RANDOM)
97 struct lis302dl_chip {
99 struct i2c_client *client;
100 struct work_struct work1, work2;
101 struct delayed_work poweroff_work;
108 unsigned int samples;
111 static inline s32 lis302dl_write(struct i2c_client *c, int reg, u8 value)
113 return i2c_smbus_write_byte_data(c, reg, value);
116 static inline s32 lis302dl_read(struct i2c_client *c, int reg)
118 return i2c_smbus_read_byte_data(c, reg);
122 * Detect LIS302DL chip. Return value is zero if
123 * chip detected, otherwise a negative error code.
125 static int lis302dl_detect(struct i2c_client *c)
129 r = lis302dl_read(c, LIS302_WHOAMI);
133 if (r != LIS302_WHOAMI_VALUE)
139 static inline u8 intmode(int pin, u8 mode)
149 static int lis302dl_configure(struct i2c_client *c)
152 struct lis302dl_chip *lis = i2c_get_clientdata(c);
157 /* Controls power, scale, data rate, and enabled axis */
158 r |= lis->sample_rate ? LIS302_CTRL1_DR : 0;
159 r |= lis->fs ? LIS302_CTRL1_FS : 0;
160 r |= LIS302_CTRL1_PD | LIS302_CTRL1_X | LIS302_CTRL1_Y | LIS302_CTRL1_Z;
161 ret = lis302dl_write(c, LIS302_CTRL_1, r);
166 * Boot is used to refresh internal registers
167 * Control High Pass filter selection. not used
169 ret = lis302dl_write(c, LIS302_CTRL_2, LIS302_CTRL2_BOOT);
174 * Interrupt CTRL register. One interrupt pin is used for
177 r = intmode(1, LIS302_CTRL3_FF_WU_1) | intmode(2, LIS302_CTRL3_GND);
178 ret = lis302dl_write(c, LIS302_CTRL_3, r);
182 /* Configure interrupt pin thresholds */
183 ts = lis->threshold / (lis->fs ? LIS302_BIG_UNIT : LIS302_SMALL_UNIT);
185 duration = lis->duration / (lis->sample_rate ? 40 : 10);
187 ret = lis302dl_write(c, LIS302_FF_THS_1, ts);
190 ret = lis302dl_write(c, LIS302_FF_WU_DURATION_1, duration);
193 /* Enable interrupt wakeup on x and y axis */
194 ret = lis302dl_write(c, LIS302_FF_WU_CFG_1,
195 (LIS302_X_HIGH | LIS302_Y_HIGH));
202 static inline void lis302dl_print_event(struct device *dev, u8 event)
205 dev_dbg(dev, "X Low event\n");
207 dev_dbg(dev, "X High event\n");
209 dev_dbg(dev, "Y Low event\n");
211 dev_dbg(dev, "Y High event\n");
213 dev_dbg(dev, "Z Low event\n");
215 dev_dbg(dev, "Z High event\n");
218 /* Interrupt handler bottom halves. */
219 static void lis302dl_work1(struct work_struct *work)
221 struct lis302dl_chip *chip =
222 container_of(work, struct lis302dl_chip, work1);
225 mutex_lock(&chip->lock);
226 /* ack the interrupt */
227 reg = lis302dl_read(chip->client, LIS302_FF_WU_SRC_1);
228 mutex_unlock(&chip->lock);
229 sysfs_notify(&chip->client->dev.kobj, NULL, "coord");
230 lis302dl_print_event(&chip->client->dev, reg);
233 static void lis302dl_work2(struct work_struct *work)
235 struct lis302dl_chip *chip =
236 container_of(work, struct lis302dl_chip, work2);
239 mutex_lock(&chip->lock);
240 /* ack the interrupt */
241 reg = lis302dl_read(chip->client, LIS302_FF_WU_SRC_2);
242 mutex_unlock(&chip->lock);
243 lis302dl_print_event(&chip->client->dev, reg);
247 * We cannot use I2C in interrupt context, so we just schedule work.
249 static irqreturn_t lis302dl_irq1(int irq, void *_chip)
251 struct lis302dl_chip *chip = _chip;
252 schedule_work(&chip->work1);
257 static irqreturn_t lis302dl_irq2(int irq, void *_chip)
262 /* duration depends on chips data rate */
263 static void set_duration(struct i2c_client *c, int dr, int msec)
267 /* 400 Hz data rate max duration is 637.5 ms */
271 duration = (msec / 10) * 4;
273 duration = msec / 10;
274 lis302dl_write(c, LIS302_FF_WU_DURATION_1, duration);
277 static void set_ths(struct i2c_client *c, int full_scale, int ths)
282 threshold = ths / LIS302_BIG_UNIT;
284 /* max threshold is 2286 mg when normal scale is used*/
285 if (ths > (127 * LIS302_SMALL_UNIT))
288 threshold = ths / LIS302_SMALL_UNIT;
291 lis302dl_write(c, LIS302_FF_THS_1, threshold);
294 static int lis302dl_power(struct lis302dl_chip *chip, int on)
299 reg = lis302dl_read(chip->client, LIS302_CTRL_1);
301 regwant = reg | LIS302_CTRL1_PD;
303 regwant = reg & ~LIS302_CTRL1_PD;
305 /* Avoid unnecessary writes */
309 result = lis302dl_write(chip->client, LIS302_CTRL_1, regwant);
311 /* turn on time delay depends on data rate */
313 delay = (chip->sample_rate ? (LIS302_TURN_ON_TIME / 400) :
314 (LIS302_TURN_ON_TIME / 100)) + 1;
323 static void lis302dl_poweroff_work(struct work_struct *work)
325 struct lis302dl_chip *chip =
326 container_of(work, struct lis302dl_chip, poweroff_work.work);
327 mutex_lock(&chip->lock);
328 lis302dl_power(chip, 0);
329 mutex_unlock(&chip->lock);
332 static int lis302dl_selftest(struct lis302dl_chip *chip)
338 reg = lis302dl_read(chip->client, LIS302_CTRL_1);
339 powerbit = reg & LIS302_CTRL1_PD;
340 reg |= LIS302_CTRL1_PD;
341 lis302dl_write(chip->client, LIS302_CTRL_1, (reg | LIS302_CTRL1_STP));
343 x = (s8)lis302dl_read(chip->client, LIS302_X);
344 y = (s8)lis302dl_read(chip->client, LIS302_Y);
345 z = (s8)lis302dl_read(chip->client, LIS302_Z);
346 /* back to normal settings */
347 lis302dl_write(chip->client, LIS302_CTRL_1, reg);
349 x -= (s8)lis302dl_read(chip->client, LIS302_X);
350 y -= (s8)lis302dl_read(chip->client, LIS302_Y);
351 z -= (s8)lis302dl_read(chip->client, LIS302_Z);
353 /* Return to passive state if we were in it. */
355 lis302dl_write(chip->client,
357 reg & ~LIS302_CTRL1_PD);
359 /* Now check that delta is within specified range for each axis */
360 if (x < -32 || x > -3)
371 /*******************************************************************************
373 ******************************************************************************/
375 static ssize_t lis302dl_show_power(struct device *dev,
376 struct device_attribute *attr, char *buf)
380 struct lis302dl_chip *chip = dev_get_drvdata(dev);
382 mutex_lock(&chip->lock);
383 val = lis302dl_read(chip->client, LIS302_CTRL_1);
385 if (val & LIS302_CTRL1_PD)
386 ret = snprintf(buf, PAGE_SIZE, "on\n");
388 ret = snprintf(buf, PAGE_SIZE, "off\n");
391 mutex_unlock(&chip->lock);
395 static ssize_t lis302dl_set_power(struct device *dev,
396 struct device_attribute *attr,
397 const char *buf, size_t len)
399 struct lis302dl_chip *chip = dev_get_drvdata(dev);
401 mutex_lock(&chip->lock);
403 if (!strcmp(buf, "on\n"))
404 lis302dl_power(chip, 1);
405 else if (!strcmp(buf, "off\n"))
406 lis302dl_power(chip, 0);
408 mutex_unlock(&chip->lock);
413 static ssize_t lis302dl_show_rate(struct device *dev,
414 struct device_attribute *attr, char *buf)
418 struct lis302dl_chip *chip = dev_get_drvdata(dev);
420 mutex_lock(&chip->lock);
421 val = lis302dl_read(chip->client, LIS302_CTRL_1);
422 ret = snprintf(buf, PAGE_SIZE, "%d\n",
423 (val & LIS302_CTRL1_DR) ? 400 : 100);
424 mutex_unlock(&chip->lock);
428 static ssize_t lis302dl_set_rate(struct device *dev,
429 struct device_attribute *attr, const char *buf,
432 struct lis302dl_chip *chip = dev_get_drvdata(dev);
435 mutex_lock(&chip->lock);
436 reg = lis302dl_read(chip->client, LIS302_CTRL_1);
437 if (!strcmp(buf, "400\n")) {
438 reg |= LIS302_CTRL1_DR;
439 chip->sample_rate = 1;
440 lis302dl_write(chip->client, LIS302_CTRL_1, reg);
441 set_duration(chip->client, chip->sample_rate, chip->duration);
442 } else if (!strcmp(buf, "100\n")) {
443 reg &= ~LIS302_CTRL1_DR;
444 chip->sample_rate = 0;
445 lis302dl_write(chip->client, LIS302_CTRL_1, reg);
446 set_duration(chip->client, chip->sample_rate, chip->duration);
449 mutex_unlock(&chip->lock);
454 static ssize_t lis302dl_show_scale(struct device *dev,
455 struct device_attribute *attr, char *buf)
458 struct lis302dl_chip *chip = dev_get_drvdata(dev);
460 mutex_lock(&chip->lock);
461 val = lis302dl_read(chip->client, LIS302_CTRL_1);
464 if (val & LIS302_CTRL1_FS)
465 ret = snprintf(buf, PAGE_SIZE, "full\n");
467 ret = snprintf(buf, PAGE_SIZE, "normal\n");
470 mutex_unlock(&chip->lock);
475 static ssize_t lis302dl_set_scale(struct device *dev,
476 struct device_attribute *attr,
477 const char *buf, size_t len)
479 struct lis302dl_chip *chip = dev_get_drvdata(dev);
482 mutex_lock(&chip->lock);
483 reg = lis302dl_read(chip->client, LIS302_CTRL_1);
485 if (!strcmp(buf, "full\n")) {
486 reg |= LIS302_CTRL1_FS;
488 lis302dl_write(chip->client, LIS302_CTRL_1, reg);
489 set_ths(chip->client, chip->fs, chip->threshold);
490 } else if (!strcmp(buf, "normal\n")) {
491 reg &= ~LIS302_CTRL1_FS;
493 lis302dl_write(chip->client, LIS302_CTRL_1, reg);
494 set_ths(chip->client, chip->fs, chip->threshold);
496 mutex_unlock(&chip->lock);
501 static ssize_t lis302dl_show_duration(struct device *dev,
502 struct device_attribute *attr,
507 struct lis302dl_chip *chip = dev_get_drvdata(dev);
509 mutex_lock(&chip->lock);
510 val = lis302dl_read(chip->client, LIS302_FF_WU_DURATION_1);
513 ret = snprintf(buf, PAGE_SIZE, "%d ms\n",
514 chip->sample_rate ? (val * 10 / 4) : (val * 10));
517 mutex_unlock(&chip->lock);
521 static ssize_t lis302dl_set_duration(struct device *dev,
522 struct device_attribute *attr,
523 const char *buf, size_t len)
525 struct lis302dl_chip *chip = dev_get_drvdata(dev);
526 unsigned long duration;
529 ret = strict_strtoul(buf, 0, &duration);
530 if (ret || duration < 0)
532 mutex_lock(&chip->lock);
533 /* max duration is 2.55 s when data rate is 100Hz */
536 set_duration(chip->client, chip->sample_rate, duration);
537 chip->duration = duration;
538 mutex_unlock(&chip->lock);
542 static ssize_t lis302dl_show_ths(struct device *dev,
543 struct device_attribute *attr, char *buf)
546 struct lis302dl_chip *chip = dev_get_drvdata(dev);
548 mutex_lock(&chip->lock);
549 val = lis302dl_read(chip->client, LIS302_FF_THS_1);
552 ret = snprintf(buf, PAGE_SIZE, "%d mg\n", val * (chip->fs ?
553 LIS302_BIG_UNIT : LIS302_SMALL_UNIT));
556 mutex_unlock(&chip->lock);
560 static ssize_t lis302dl_set_ths(struct device *dev,
561 struct device_attribute *attr,
562 const char *buf, size_t len)
564 struct lis302dl_chip *chip = dev_get_drvdata(dev);
568 ret = strict_strtoul(buf, 0, &ths);
571 mutex_lock(&chip->lock);
572 chip->threshold = ths;
573 set_ths(chip->client, chip->fs, chip->threshold);
574 mutex_unlock(&chip->lock);
579 static ssize_t lis302dl_show_samples(struct device *dev,
580 struct device_attribute *attr, char *buf)
583 struct lis302dl_chip *chip = dev_get_drvdata(dev);
585 mutex_lock(&chip->lock);
586 ret = snprintf(buf, PAGE_SIZE, "%d\n", chip->samples);
588 mutex_unlock(&chip->lock);
592 static ssize_t lis302dl_set_samples(struct device *dev,
593 struct device_attribute *attr,
594 const char *buf, size_t len)
596 struct lis302dl_chip *chip = dev_get_drvdata(dev);
597 unsigned long samples;
600 ret = strict_strtoul(buf, 0, &samples);
601 if (ret || samples < 1)
604 mutex_lock(&chip->lock);
605 chip->samples = samples;
606 mutex_unlock(&chip->lock);
611 static ssize_t lis302dl_show_coord(struct device *dev,
612 struct device_attribute *attr, char *buf)
614 struct lis302dl_chip *chip = dev_get_drvdata(dev);
620 /* Cannot cancel synchronously within the mutex */
621 cancel_delayed_work_sync(&chip->poweroff_work);
623 mutex_lock(&chip->lock);
626 ret = lis302dl_power(chip, 1);
628 for (i = 0; i < chip->samples; i++) {
629 x += (s8)lis302dl_read(chip->client, LIS302_X);
630 y += (s8)lis302dl_read(chip->client, LIS302_Y);
631 z += (s8)lis302dl_read(chip->client, LIS302_Z);
633 x /= (int)chip->samples;
634 y /= (int)chip->samples;
635 z /= (int)chip->samples;
638 x *= (chip->fs ? LIS302_BIG_UNIT : LIS302_SMALL_UNIT);
639 y *= (chip->fs ? LIS302_BIG_UNIT : LIS302_SMALL_UNIT);
640 z *= (chip->fs ? LIS302_BIG_UNIT : LIS302_SMALL_UNIT);
641 ret = snprintf(buf, PAGE_SIZE, "%d %d %d\n", x, y, z);
642 mutex_unlock(&chip->lock);
644 schedule_delayed_work(&chip->poweroff_work, LIS302_POWEROFF_DELAY);
649 static ssize_t lis302dl_show_selftest(struct device *dev,
650 struct device_attribute *attr, char *buf)
654 struct lis302dl_chip *chip = dev_get_drvdata(dev);
656 mutex_lock(&chip->lock);
657 if (!lis302dl_selftest(chip))
658 ret = snprintf(buf, PAGE_SIZE, "OK\n");
660 ret = snprintf(buf, PAGE_SIZE, "FAIL\n");
661 mutex_unlock(&chip->lock);
666 static struct device_attribute lis302dl_attrs[] = {
667 __ATTR(enable, S_IRUGO|S_IWUSR,
668 lis302dl_show_power, lis302dl_set_power),
669 __ATTR(rate, S_IRUGO|S_IWUSR,
670 lis302dl_show_rate, lis302dl_set_rate),
671 __ATTR(scale, S_IRUGO|S_IWUSR,
672 lis302dl_show_scale, lis302dl_set_scale),
673 __ATTR(duration, S_IRUGO|S_IWUSR,
674 lis302dl_show_duration, lis302dl_set_duration),
675 __ATTR(ths, S_IRUGO|S_IWUSR,
676 lis302dl_show_ths, lis302dl_set_ths),
677 __ATTR(samples, S_IRUGO|S_IWUSR,
678 lis302dl_show_samples, lis302dl_set_samples),
679 __ATTR(coord, S_IRUGO|S_IWUSR,
680 lis302dl_show_coord, NULL),
681 __ATTR(selftest, S_IRUGO|S_IWUSR,
682 lis302dl_show_selftest, NULL),
685 static int lis302dl_register_sysfs(struct i2c_client *c)
687 struct device *d = &c->dev;
690 for (i = 0; i < ARRAY_SIZE(lis302dl_attrs); i++) {
691 r = device_create_file(d, &lis302dl_attrs[i]);
698 device_remove_file(d, &lis302dl_attrs[i]);
703 static void lis302dl_unregister_sysfs(struct i2c_client *c)
705 struct device *d = &c->dev;
708 for (i = ARRAY_SIZE(lis302dl_attrs) - 1; i >= 0; i--)
709 device_remove_file(d, &lis302dl_attrs[i]);
712 /*******************************************************************************
714 ******************************************************************************/
715 static struct i2c_driver lis302dl_i2c_driver;
717 static int lis302dl_probe(struct i2c_client *client,
718 const struct i2c_device_id *id)
720 struct lis302dl_chip *lis;
721 struct lis302dl_platform_data *pdata = client->dev.platform_data;
725 dev_dbg(&client->dev, "no platform data?\n");
728 lis = kzalloc(sizeof(struct lis302dl_chip), GFP_KERNEL);
732 i2c_set_clientdata(client, lis);
733 lis->client = client;
735 err = lis302dl_detect(client);
739 /* default startup values */
741 lis->threshold = LIS302_THS;
742 lis->duration = LIS302_DURATION;
744 lis->sample_rate = LIS302_100HZ;
745 lis->samples = LIS302_SAMPLES;
747 mutex_init(&lis->lock);
749 err = lis302dl_configure(client);
751 dev_err(&client->dev, "lis302dl error configuring chip\n");
755 err = lis302dl_register_sysfs(client);
758 "lis302dl: sysfs registration failed, error %d\n", err);
762 lis->irq1 = pdata->int1_gpio;
763 lis->irq2 = pdata->int2_gpio;
765 /* gpio for interrupt pin 1 */
766 err = gpio_request(lis->irq1, "lis302dl_irq1");
768 printk(KERN_ALERT "lis302dl: cannot request gpio for int 1\n");
771 gpio_direction_input(lis->irq1);
772 INIT_WORK(&lis->work1, lis302dl_work1);
773 INIT_DELAYED_WORK(&lis->poweroff_work, lis302dl_poweroff_work);
775 err = request_irq(gpio_to_irq(lis->irq1), lis302dl_irq1,
776 LIS302_IRQ_FLAGS, DRIVER_NAME, lis);
778 dev_err(&client->dev, "could not get IRQ_1 = %d\n",
779 gpio_to_irq(lis->irq1));
782 schedule_delayed_work(&lis->poweroff_work, LIS302_POWEROFF_DELAY);
787 free_irq(gpio_to_irq(lis->irq1), lis);
788 gpio_free(lis->irq1);
795 static int lis302dl_remove(struct i2c_client *client)
797 struct lis302dl_chip *chip = i2c_get_clientdata(client);
799 lis302dl_unregister_sysfs(client);
800 free_irq(gpio_to_irq(chip->irq1), chip);
801 gpio_free(chip->irq1);
803 cancel_delayed_work_sync(&chip->poweroff_work);
804 cancel_work_sync(&chip->work1);
805 lis302dl_power(chip, 0);
812 static int lis302dl_suspend(struct i2c_client *client, pm_message_t state)
814 struct lis302dl_chip *chip = i2c_get_clientdata(client);
817 mutex_lock(&chip->lock);
818 ret = lis302dl_power(chip, 0);
819 mutex_unlock(&chip->lock);
824 static int lis302dl_resume(struct i2c_client *client)
826 struct lis302dl_chip *chip = i2c_get_clientdata(client);
829 mutex_lock(&chip->lock);
830 ret = lis302dl_power(chip, 1);
831 mutex_unlock(&chip->lock);
836 static const struct i2c_device_id lis302dl_id[] = {
840 MODULE_DEVICE_TABLE(i2c, lis302dl_id);
842 static struct i2c_driver lis302dl_i2c_driver = {
846 .suspend = lis302dl_suspend,
847 .resume = lis302dl_resume,
848 .probe = lis302dl_probe,
849 .remove = lis302dl_remove,
850 .id_table = lis302dl_id,
853 static int __init lis302dl_init(void)
857 ret = i2c_add_driver(&lis302dl_i2c_driver);
859 printk(KERN_ALERT "lis302dl driver registration failed\n");
864 static void __exit lis302dl_exit(void)
866 i2c_del_driver(&lis302dl_i2c_driver);
869 MODULE_AUTHOR("Nokia Corporation");
870 MODULE_DESCRIPTION("LIS302DL acceleration sensor driver");
871 MODULE_LICENSE("GPL");
873 module_init(lis302dl_init);
874 module_exit(lis302dl_exit);