2 * lis3lv02d.c - ST LIS3LV02DL accelerometer driver
4 * Copyright (C) 2007-2008 Yan Burman
5 * Copyright (C) 2008 Eric Piel
6 * Copyright (C) 2008-2009 Pavel Machek
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <linux/kernel.h>
24 #include <linux/init.h>
25 #include <linux/dmi.h>
26 #include <linux/module.h>
27 #include <linux/types.h>
28 #include <linux/platform_device.h>
29 #include <linux/interrupt.h>
30 #include <linux/input-polldev.h>
31 #include <linux/delay.h>
32 #include <linux/wait.h>
33 #include <linux/poll.h>
34 #include <linux/freezer.h>
35 #include <linux/uaccess.h>
36 #include <linux/miscdevice.h>
37 #include <asm/atomic.h>
38 #include "lis3lv02d.h"
40 #define DRIVER_NAME "lis3lv02d"
42 /* joystick device poll interval in milliseconds */
43 #define MDPS_POLL_INTERVAL 50
44 #define MDPS_POLL_MIN 0
45 #define MDPS_POLL_MAX 2000
47 * The sensor can also generate interrupts (DRDY) but it's pretty pointless
48 * because they are generated even if the data do not change. So it's better
49 * to keep the interrupt for the free-fall event. The values are updated at
50 * 40Hz (at the lowest frequency), but as it can be pretty time consuming on
51 * some low processor, we poll the sensor only at 20Hz... enough for the
55 #define LIS3_PWRON_DELAY_WAI_12B (5000)
56 #define LIS3_PWRON_DELAY_WAI_8B (3000)
59 * LIS3LV02D spec says 1024 LSBs corresponds 1 G -> 1LSB is 1000/1024 mG
60 * LIS302D spec says: 18 mG / digit
61 * LIS3_ACCURACY is used to increase accuracy of the intermediate
62 * calculation results.
64 #define LIS3_ACCURACY 1024
65 /* Sensitivity values for -2G +2G scale */
66 #define LIS3_SENSITIVITY_12B ((LIS3_ACCURACY * 1000) / 1024)
67 #define LIS3_SENSITIVITY_8B (18 * LIS3_ACCURACY)
69 #define LIS3_DEFAULT_FUZZ 3
70 #define LIS3_DEFAULT_FLAT 3
72 struct lis3lv02d lis3_dev = {
73 .misc_wait = __WAIT_QUEUE_HEAD_INITIALIZER(lis3_dev.misc_wait),
76 EXPORT_SYMBOL_GPL(lis3_dev);
78 /* just like param_set_int() but does sanity-check so that it won't point
79 * over the axis array size
81 static int param_set_axis(const char *val, const struct kernel_param *kp)
83 int ret = param_set_int(val, kp);
85 int val = *(int *)kp->arg;
94 static struct kernel_param_ops param_ops_axis = {
95 .set = param_set_axis,
99 module_param_array_named(axes, lis3_dev.ac.as_array, axis, NULL, 0644);
100 MODULE_PARM_DESC(axes, "Axis-mapping for x,y,z directions");
102 static s16 lis3lv02d_read_8(struct lis3lv02d *lis3, int reg)
105 if (lis3->read(lis3, reg, &lo) < 0)
111 static s16 lis3lv02d_read_12(struct lis3lv02d *lis3, int reg)
115 lis3->read(lis3, reg - 1, &lo);
116 lis3->read(lis3, reg, &hi);
117 /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */
118 return (s16)((hi << 8) | lo);
122 * lis3lv02d_get_axis - For the given axis, give the value converted
123 * @axis: 1,2,3 - can also be negative
124 * @hw_values: raw values returned by the hardware
126 * Returns the converted value.
128 static inline int lis3lv02d_get_axis(s8 axis, int hw_values[3])
131 return hw_values[axis - 1];
133 return -hw_values[-axis - 1];
137 * lis3lv02d_get_xyz - Get X, Y and Z axis values from the accelerometer
138 * @lis3: pointer to the device struct
139 * @x: where to store the X axis value
140 * @y: where to store the Y axis value
141 * @z: where to store the Z axis value
143 * Note that 40Hz input device can eat up about 10% CPU at 800MHZ
145 static void lis3lv02d_get_xyz(struct lis3lv02d *lis3, int *x, int *y, int *z)
150 position[0] = lis3->read_data(lis3, OUTX);
151 position[1] = lis3->read_data(lis3, OUTY);
152 position[2] = lis3->read_data(lis3, OUTZ);
154 for (i = 0; i < 3; i++)
155 position[i] = (position[i] * lis3->scale) / LIS3_ACCURACY;
157 *x = lis3lv02d_get_axis(lis3->ac.x, position);
158 *y = lis3lv02d_get_axis(lis3->ac.y, position);
159 *z = lis3lv02d_get_axis(lis3->ac.z, position);
162 /* conversion btw sampling rate and the register values */
163 static int lis3_12_rates[4] = {40, 160, 640, 2560};
164 static int lis3_8_rates[2] = {100, 400};
165 static int lis3_3dc_rates[16] = {0, 1, 10, 25, 50, 100, 200, 400, 1600, 5000};
167 /* ODR is Output Data Rate */
168 static int lis3lv02d_get_odr(void)
173 lis3_dev.read(&lis3_dev, CTRL_REG1, &ctrl);
174 ctrl &= lis3_dev.odr_mask;
175 shift = ffs(lis3_dev.odr_mask) - 1;
176 return lis3_dev.odrs[(ctrl >> shift)];
179 static int lis3lv02d_set_odr(int rate)
187 lis3_dev.read(&lis3_dev, CTRL_REG1, &ctrl);
188 ctrl &= ~lis3_dev.odr_mask;
189 len = 1 << hweight_long(lis3_dev.odr_mask); /* # of possible values */
190 shift = ffs(lis3_dev.odr_mask) - 1;
192 for (i = 0; i < len; i++)
193 if (lis3_dev.odrs[i] == rate) {
194 lis3_dev.write(&lis3_dev, CTRL_REG1,
195 ctrl | (i << shift));
201 static int lis3lv02d_selftest(struct lis3lv02d *lis3, s16 results[3])
208 mutex_lock(&lis3->mutex);
209 if (lis3_dev.whoami == WAI_3DC) {
211 selftest = CTRL4_ST0;
214 if (lis3_dev.whoami == WAI_12B)
217 selftest = CTRL1_STP;
220 lis3->read(lis3, ctlreg, ®);
221 lis3->write(lis3, ctlreg, (reg | selftest));
222 msleep(lis3->pwron_delay / lis3lv02d_get_odr());
224 /* Read directly to avoid axis remap */
225 x = lis3->read_data(lis3, OUTX);
226 y = lis3->read_data(lis3, OUTY);
227 z = lis3->read_data(lis3, OUTZ);
229 /* back to normal settings */
230 lis3->write(lis3, ctlreg, reg);
231 msleep(lis3->pwron_delay / lis3lv02d_get_odr());
233 results[0] = x - lis3->read_data(lis3, OUTX);
234 results[1] = y - lis3->read_data(lis3, OUTY);
235 results[2] = z - lis3->read_data(lis3, OUTZ);
240 for (i = 0; i < 3; i++) {
241 /* Check against selftest acceptance limits */
242 if ((results[i] < lis3->pdata->st_min_limits[i]) ||
243 (results[i] > lis3->pdata->st_max_limits[i])) {
252 mutex_unlock(&lis3->mutex);
256 void lis3lv02d_poweroff(struct lis3lv02d *lis3)
258 /* disable X,Y,Z axis and power down */
259 lis3->write(lis3, CTRL_REG1, 0x00);
261 EXPORT_SYMBOL_GPL(lis3lv02d_poweroff);
263 void lis3lv02d_poweron(struct lis3lv02d *lis3)
269 /* LIS3 power on delay is quite long */
270 msleep(lis3->pwron_delay / lis3lv02d_get_odr());
273 * Common configuration
274 * BDU: (12 bits sensors only) LSB and MSB values are not updated until
275 * both have been read. So the value read will always be correct.
277 if (lis3->whoami == WAI_12B) {
278 lis3->read(lis3, CTRL_REG2, ®);
280 lis3->write(lis3, CTRL_REG2, reg);
283 EXPORT_SYMBOL_GPL(lis3lv02d_poweron);
286 static void lis3lv02d_joystick_poll(struct input_polled_dev *pidev)
290 mutex_lock(&lis3_dev.mutex);
291 lis3lv02d_get_xyz(&lis3_dev, &x, &y, &z);
292 input_report_abs(pidev->input, ABS_X, x);
293 input_report_abs(pidev->input, ABS_Y, y);
294 input_report_abs(pidev->input, ABS_Z, z);
295 input_sync(pidev->input);
296 mutex_unlock(&lis3_dev.mutex);
299 static irqreturn_t lis302dl_interrupt(int irq, void *dummy)
301 if (!test_bit(0, &lis3_dev.misc_opened))
305 * Be careful: on some HP laptops the bios force DD when on battery and
306 * the lid is closed. This leads to interrupts as soon as a little move
309 atomic_inc(&lis3_dev.count);
311 wake_up_interruptible(&lis3_dev.misc_wait);
312 kill_fasync(&lis3_dev.async_queue, SIGIO, POLL_IN);
314 if (lis3_dev.pdata && lis3_dev.whoami == WAI_8B && lis3_dev.idev &&
315 lis3_dev.idev->input->users)
316 return IRQ_WAKE_THREAD;
320 static void lis302dl_interrupt_handle_click(struct lis3lv02d *lis3)
322 struct input_dev *dev = lis3->idev->input;
325 mutex_lock(&lis3->mutex);
326 lis3->read(lis3, CLICK_SRC, &click_src);
328 if (click_src & CLICK_SINGLE_X) {
329 input_report_key(dev, lis3->mapped_btns[0], 1);
330 input_report_key(dev, lis3->mapped_btns[0], 0);
333 if (click_src & CLICK_SINGLE_Y) {
334 input_report_key(dev, lis3->mapped_btns[1], 1);
335 input_report_key(dev, lis3->mapped_btns[1], 0);
338 if (click_src & CLICK_SINGLE_Z) {
339 input_report_key(dev, lis3->mapped_btns[2], 1);
340 input_report_key(dev, lis3->mapped_btns[2], 0);
343 mutex_unlock(&lis3->mutex);
346 static void lis302dl_interrupt_handle_ff_wu(struct lis3lv02d *lis3)
351 lis3->read(lis3, FF_WU_SRC_1, &wu1_src);
352 lis3->read(lis3, FF_WU_SRC_2, &wu2_src);
354 wu1_src = wu1_src & FF_WU_SRC_IA ? wu1_src : 0;
355 wu2_src = wu2_src & FF_WU_SRC_IA ? wu2_src : 0;
357 /* joystick poll is internally protected by the lis3->mutex. */
358 if (wu1_src || wu2_src)
359 lis3lv02d_joystick_poll(lis3_dev.idev);
362 static irqreturn_t lis302dl_interrupt_thread1_8b(int irq, void *data)
365 struct lis3lv02d *lis3 = data;
367 if ((lis3->pdata->irq_cfg & LIS3_IRQ1_MASK) == LIS3_IRQ1_CLICK)
368 lis302dl_interrupt_handle_click(lis3);
370 lis302dl_interrupt_handle_ff_wu(lis3);
375 static irqreturn_t lis302dl_interrupt_thread2_8b(int irq, void *data)
378 struct lis3lv02d *lis3 = data;
380 if ((lis3->pdata->irq_cfg & LIS3_IRQ2_MASK) == LIS3_IRQ2_CLICK)
381 lis302dl_interrupt_handle_click(lis3);
383 lis302dl_interrupt_handle_ff_wu(lis3);
388 static int lis3lv02d_misc_open(struct inode *inode, struct file *file)
390 if (test_and_set_bit(0, &lis3_dev.misc_opened))
391 return -EBUSY; /* already open */
393 atomic_set(&lis3_dev.count, 0);
397 static int lis3lv02d_misc_release(struct inode *inode, struct file *file)
399 fasync_helper(-1, file, 0, &lis3_dev.async_queue);
400 clear_bit(0, &lis3_dev.misc_opened); /* release the device */
404 static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf,
405 size_t count, loff_t *pos)
407 DECLARE_WAITQUEUE(wait, current);
409 unsigned char byte_data;
415 add_wait_queue(&lis3_dev.misc_wait, &wait);
417 set_current_state(TASK_INTERRUPTIBLE);
418 data = atomic_xchg(&lis3_dev.count, 0);
422 if (file->f_flags & O_NONBLOCK) {
427 if (signal_pending(current)) {
428 retval = -ERESTARTSYS;
440 /* make sure we are not going into copy_to_user() with
441 * TASK_INTERRUPTIBLE state */
442 set_current_state(TASK_RUNNING);
443 if (copy_to_user(buf, &byte_data, sizeof(byte_data)))
447 __set_current_state(TASK_RUNNING);
448 remove_wait_queue(&lis3_dev.misc_wait, &wait);
453 static unsigned int lis3lv02d_misc_poll(struct file *file, poll_table *wait)
455 poll_wait(file, &lis3_dev.misc_wait, wait);
456 if (atomic_read(&lis3_dev.count))
457 return POLLIN | POLLRDNORM;
461 static int lis3lv02d_misc_fasync(int fd, struct file *file, int on)
463 return fasync_helper(fd, file, on, &lis3_dev.async_queue);
466 static const struct file_operations lis3lv02d_misc_fops = {
467 .owner = THIS_MODULE,
469 .read = lis3lv02d_misc_read,
470 .open = lis3lv02d_misc_open,
471 .release = lis3lv02d_misc_release,
472 .poll = lis3lv02d_misc_poll,
473 .fasync = lis3lv02d_misc_fasync,
476 static struct miscdevice lis3lv02d_misc_device = {
477 .minor = MISC_DYNAMIC_MINOR,
479 .fops = &lis3lv02d_misc_fops,
482 int lis3lv02d_joystick_enable(void)
484 struct input_dev *input_dev;
486 int max_val, fuzz, flat;
487 int btns[] = {BTN_X, BTN_Y, BTN_Z};
492 lis3_dev.idev = input_allocate_polled_device();
496 lis3_dev.idev->poll = lis3lv02d_joystick_poll;
497 lis3_dev.idev->poll_interval = MDPS_POLL_INTERVAL;
498 lis3_dev.idev->poll_interval_min = MDPS_POLL_MIN;
499 lis3_dev.idev->poll_interval_max = MDPS_POLL_MAX;
500 input_dev = lis3_dev.idev->input;
502 input_dev->name = "ST LIS3LV02DL Accelerometer";
503 input_dev->phys = DRIVER_NAME "/input0";
504 input_dev->id.bustype = BUS_HOST;
505 input_dev->id.vendor = 0;
506 input_dev->dev.parent = &lis3_dev.pdev->dev;
508 set_bit(EV_ABS, input_dev->evbit);
509 max_val = (lis3_dev.mdps_max_val * lis3_dev.scale) / LIS3_ACCURACY;
510 fuzz = (LIS3_DEFAULT_FUZZ * lis3_dev.scale) / LIS3_ACCURACY;
511 flat = (LIS3_DEFAULT_FLAT * lis3_dev.scale) / LIS3_ACCURACY;
512 input_set_abs_params(input_dev, ABS_X, -max_val, max_val, fuzz, flat);
513 input_set_abs_params(input_dev, ABS_Y, -max_val, max_val, fuzz, flat);
514 input_set_abs_params(input_dev, ABS_Z, -max_val, max_val, fuzz, flat);
516 lis3_dev.mapped_btns[0] = lis3lv02d_get_axis(abs(lis3_dev.ac.x), btns);
517 lis3_dev.mapped_btns[1] = lis3lv02d_get_axis(abs(lis3_dev.ac.y), btns);
518 lis3_dev.mapped_btns[2] = lis3lv02d_get_axis(abs(lis3_dev.ac.z), btns);
520 err = input_register_polled_device(lis3_dev.idev);
522 input_free_polled_device(lis3_dev.idev);
523 lis3_dev.idev = NULL;
528 EXPORT_SYMBOL_GPL(lis3lv02d_joystick_enable);
530 void lis3lv02d_joystick_disable(void)
533 free_irq(lis3_dev.irq, &lis3_dev);
534 if (lis3_dev.pdata && lis3_dev.pdata->irq2)
535 free_irq(lis3_dev.pdata->irq2, &lis3_dev);
541 misc_deregister(&lis3lv02d_misc_device);
542 input_unregister_polled_device(lis3_dev.idev);
543 input_free_polled_device(lis3_dev.idev);
544 lis3_dev.idev = NULL;
546 EXPORT_SYMBOL_GPL(lis3lv02d_joystick_disable);
549 static ssize_t lis3lv02d_selftest_show(struct device *dev,
550 struct device_attribute *attr, char *buf)
555 result = lis3lv02d_selftest(&lis3_dev, values);
556 return sprintf(buf, "%s %d %d %d\n", result == 0 ? "OK" : "FAIL",
557 values[0], values[1], values[2]);
560 static ssize_t lis3lv02d_position_show(struct device *dev,
561 struct device_attribute *attr, char *buf)
565 mutex_lock(&lis3_dev.mutex);
566 lis3lv02d_get_xyz(&lis3_dev, &x, &y, &z);
567 mutex_unlock(&lis3_dev.mutex);
568 return sprintf(buf, "(%d,%d,%d)\n", x, y, z);
571 static ssize_t lis3lv02d_rate_show(struct device *dev,
572 struct device_attribute *attr, char *buf)
574 return sprintf(buf, "%d\n", lis3lv02d_get_odr());
577 static ssize_t lis3lv02d_rate_set(struct device *dev,
578 struct device_attribute *attr, const char *buf,
583 if (strict_strtoul(buf, 0, &rate))
586 if (lis3lv02d_set_odr(rate))
592 static DEVICE_ATTR(selftest, S_IRUSR, lis3lv02d_selftest_show, NULL);
593 static DEVICE_ATTR(position, S_IRUGO, lis3lv02d_position_show, NULL);
594 static DEVICE_ATTR(rate, S_IRUGO | S_IWUSR, lis3lv02d_rate_show,
597 static struct attribute *lis3lv02d_attributes[] = {
598 &dev_attr_selftest.attr,
599 &dev_attr_position.attr,
604 static struct attribute_group lis3lv02d_attribute_group = {
605 .attrs = lis3lv02d_attributes
609 static int lis3lv02d_add_fs(struct lis3lv02d *lis3)
611 lis3->pdev = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0);
612 if (IS_ERR(lis3->pdev))
613 return PTR_ERR(lis3->pdev);
615 return sysfs_create_group(&lis3->pdev->dev.kobj, &lis3lv02d_attribute_group);
618 int lis3lv02d_remove_fs(struct lis3lv02d *lis3)
620 sysfs_remove_group(&lis3->pdev->dev.kobj, &lis3lv02d_attribute_group);
621 platform_device_unregister(lis3->pdev);
624 EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs);
626 static void lis3lv02d_8b_configure(struct lis3lv02d *dev,
627 struct lis3lv02d_platform_data *p)
630 int ctrl2 = p->hipass_ctrl;
632 if (p->click_flags) {
633 dev->write(dev, CLICK_CFG, p->click_flags);
634 dev->write(dev, CLICK_TIMELIMIT, p->click_time_limit);
635 dev->write(dev, CLICK_LATENCY, p->click_latency);
636 dev->write(dev, CLICK_WINDOW, p->click_window);
637 dev->write(dev, CLICK_THSZ, p->click_thresh_z & 0xf);
638 dev->write(dev, CLICK_THSY_X,
639 (p->click_thresh_x & 0xf) |
640 (p->click_thresh_y << 4));
643 struct input_dev *input_dev = lis3_dev.idev->input;
644 input_set_capability(input_dev, EV_KEY, BTN_X);
645 input_set_capability(input_dev, EV_KEY, BTN_Y);
646 input_set_capability(input_dev, EV_KEY, BTN_Z);
650 if (p->wakeup_flags) {
651 dev->write(dev, FF_WU_CFG_1, p->wakeup_flags);
652 dev->write(dev, FF_WU_THS_1, p->wakeup_thresh & 0x7f);
653 /* default to 2.5ms for now */
654 dev->write(dev, FF_WU_DURATION_1, 1);
655 ctrl2 ^= HP_FF_WU1; /* Xor to keep compatible with old pdata*/
658 if (p->wakeup_flags2) {
659 dev->write(dev, FF_WU_CFG_2, p->wakeup_flags2);
660 dev->write(dev, FF_WU_THS_2, p->wakeup_thresh2 & 0x7f);
661 /* default to 2.5ms for now */
662 dev->write(dev, FF_WU_DURATION_2, 1);
663 ctrl2 ^= HP_FF_WU2; /* Xor to keep compatible with old pdata*/
665 /* Configure hipass filters */
666 dev->write(dev, CTRL_REG2, ctrl2);
669 err = request_threaded_irq(p->irq2,
671 lis302dl_interrupt_thread2_8b,
672 IRQF_TRIGGER_RISING |
674 DRIVER_NAME, &lis3_dev);
676 printk(KERN_ERR DRIVER_NAME
677 "No second IRQ. Limited functionality\n");
682 * Initialise the accelerometer and the various subsystems.
683 * Should be rather independent of the bus system.
685 int lis3lv02d_init_device(struct lis3lv02d *dev)
688 irq_handler_t thread_fn;
690 dev->whoami = lis3lv02d_read_8(dev, WHO_AM_I);
692 switch (dev->whoami) {
694 printk(KERN_INFO DRIVER_NAME ": 12 bits sensor found\n");
695 dev->read_data = lis3lv02d_read_12;
696 dev->mdps_max_val = 2048;
697 dev->pwron_delay = LIS3_PWRON_DELAY_WAI_12B;
698 dev->odrs = lis3_12_rates;
699 dev->odr_mask = CTRL1_DF0 | CTRL1_DF1;
700 dev->scale = LIS3_SENSITIVITY_12B;
703 printk(KERN_INFO DRIVER_NAME ": 8 bits sensor found\n");
704 dev->read_data = lis3lv02d_read_8;
705 dev->mdps_max_val = 128;
706 dev->pwron_delay = LIS3_PWRON_DELAY_WAI_8B;
707 dev->odrs = lis3_8_rates;
708 dev->odr_mask = CTRL1_DR;
709 dev->scale = LIS3_SENSITIVITY_8B;
712 printk(KERN_INFO DRIVER_NAME ": 8 bits 3DC sensor found\n");
713 dev->read_data = lis3lv02d_read_8;
714 dev->mdps_max_val = 128;
715 dev->pwron_delay = LIS3_PWRON_DELAY_WAI_8B;
716 dev->odrs = lis3_3dc_rates;
717 dev->odr_mask = CTRL1_ODR0|CTRL1_ODR1|CTRL1_ODR2|CTRL1_ODR3;
718 dev->scale = LIS3_SENSITIVITY_8B;
721 printk(KERN_ERR DRIVER_NAME
722 ": unknown sensor type 0x%X\n", dev->whoami);
726 mutex_init(&dev->mutex);
728 lis3lv02d_add_fs(dev);
729 lis3lv02d_poweron(dev);
731 if (lis3lv02d_joystick_enable())
732 printk(KERN_ERR DRIVER_NAME ": joystick initialization failed\n");
734 /* passing in platform specific data is purely optional and only
735 * used by the SPI transport layer at the moment */
737 struct lis3lv02d_platform_data *p = dev->pdata;
739 if (dev->whoami == WAI_8B)
740 lis3lv02d_8b_configure(dev, p);
743 dev->write(dev, CTRL_REG3, p->irq_cfg);
746 /* bail if we did not get an IRQ from the bus layer */
748 printk(KERN_ERR DRIVER_NAME
749 ": No IRQ. Disabling /dev/freefall\n");
754 * The sensor can generate interrupts for free-fall and direction
755 * detection (distinguishable with FF_WU_SRC and DD_SRC) but to keep
756 * the things simple and _fast_ we activate it only for free-fall, so
757 * no need to read register (very slow with ACPI). For the same reason,
758 * we forbid shared interrupts.
760 * IRQF_TRIGGER_RISING seems pointless on HP laptops because the
761 * io-apic is not configurable (and generates a warning) but I keep it
762 * in case of support for other hardware.
764 if (dev->pdata && dev->whoami == WAI_8B)
765 thread_fn = lis302dl_interrupt_thread1_8b;
769 err = request_threaded_irq(dev->irq, lis302dl_interrupt,
771 IRQF_TRIGGER_RISING | IRQF_ONESHOT,
772 DRIVER_NAME, &lis3_dev);
775 printk(KERN_ERR DRIVER_NAME "Cannot get IRQ\n");
779 if (misc_register(&lis3lv02d_misc_device))
780 printk(KERN_ERR DRIVER_NAME ": misc_register failed\n");
784 EXPORT_SYMBOL_GPL(lis3lv02d_init_device);
786 MODULE_DESCRIPTION("ST LIS3LV02Dx three-axis digital accelerometer driver");
787 MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek");
788 MODULE_LICENSE("GPL");