blob: 383a84938a981bd4663a5770d3f54624bcfa2b7e [file] [log] [blame]
Pavel Machek455fbdd2008-11-12 13:27:02 -08001/*
2 * lis3lv02d.c - ST LIS3LV02DL accelerometer driver
3 *
4 * Copyright (C) 2007-2008 Yan Burman
5 * Copyright (C) 2008 Eric Piel
Pavel Machekef2cfc72009-02-18 14:48:23 -08006 * Copyright (C) 2008-2009 Pavel Machek
Pavel Machek455fbdd2008-11-12 13:27:02 -08007 *
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.
12 *
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.
17 *
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
21 */
22
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>
Eric Pieldc6ea972009-06-16 15:34:15 -070030#include <linux/input-polldev.h>
Pavel Machek455fbdd2008-11-12 13:27:02 -080031#include <linux/delay.h>
32#include <linux/wait.h>
33#include <linux/poll.h>
34#include <linux/freezer.h>
Pavel Machek455fbdd2008-11-12 13:27:02 -080035#include <linux/uaccess.h>
Pavel Machekef2cfc72009-02-18 14:48:23 -080036#include <linux/miscdevice.h>
Samu Onkalo2a346992010-10-22 07:57:23 -040037#include <linux/pm_runtime.h>
Pavel Machek455fbdd2008-11-12 13:27:02 -080038#include <asm/atomic.h>
39#include "lis3lv02d.h"
40
41#define DRIVER_NAME "lis3lv02d"
Pavel Machek455fbdd2008-11-12 13:27:02 -080042
43/* joystick device poll interval in milliseconds */
44#define MDPS_POLL_INTERVAL 50
Samu Onkalo4a70a412010-05-24 14:33:37 -070045#define MDPS_POLL_MIN 0
46#define MDPS_POLL_MAX 2000
Samu Onkalo2a346992010-10-22 07:57:23 -040047
48#define LIS3_SYSFS_POWERDOWN_DELAY 5000 /* In milliseconds */
49
Pavel Machek455fbdd2008-11-12 13:27:02 -080050/*
51 * The sensor can also generate interrupts (DRDY) but it's pretty pointless
Éric Pielbc62c142009-12-14 18:01:39 -080052 * because they are generated even if the data do not change. So it's better
Pavel Machek455fbdd2008-11-12 13:27:02 -080053 * to keep the interrupt for the free-fall event. The values are updated at
54 * 40Hz (at the lowest frequency), but as it can be pretty time consuming on
55 * some low processor, we poll the sensor only at 20Hz... enough for the
56 * joystick.
57 */
58
Samu Onkalo641615a2009-12-14 18:01:41 -080059#define LIS3_PWRON_DELAY_WAI_12B (5000)
60#define LIS3_PWRON_DELAY_WAI_8B (3000)
61
Samu Onkalo32496c72009-12-14 18:01:46 -080062/*
63 * LIS3LV02D spec says 1024 LSBs corresponds 1 G -> 1LSB is 1000/1024 mG
64 * LIS302D spec says: 18 mG / digit
65 * LIS3_ACCURACY is used to increase accuracy of the intermediate
66 * calculation results.
67 */
68#define LIS3_ACCURACY 1024
69/* Sensitivity values for -2G +2G scale */
70#define LIS3_SENSITIVITY_12B ((LIS3_ACCURACY * 1000) / 1024)
71#define LIS3_SENSITIVITY_8B (18 * LIS3_ACCURACY)
72
73#define LIS3_DEFAULT_FUZZ 3
74#define LIS3_DEFAULT_FLAT 3
75
Daniel Macka38da2e2009-03-31 15:24:32 -070076struct lis3lv02d lis3_dev = {
Pavel Machekbe84cfc2009-03-31 15:24:26 -070077 .misc_wait = __WAIT_QUEUE_HEAD_INITIALIZER(lis3_dev.misc_wait),
Pavel Machekef2cfc72009-02-18 14:48:23 -080078};
79
Pavel Machekbe84cfc2009-03-31 15:24:26 -070080EXPORT_SYMBOL_GPL(lis3_dev);
Pavel Machek455fbdd2008-11-12 13:27:02 -080081
Takashi Iwai2ee32142010-10-01 17:14:25 -040082/* just like param_set_int() but does sanity-check so that it won't point
83 * over the axis array size
84 */
85static int param_set_axis(const char *val, const struct kernel_param *kp)
86{
87 int ret = param_set_int(val, kp);
88 if (!ret) {
89 int val = *(int *)kp->arg;
90 if (val < 0)
91 val = -val;
92 if (!val || val > 3)
93 return -EINVAL;
94 }
95 return ret;
96}
97
98static struct kernel_param_ops param_ops_axis = {
99 .set = param_set_axis,
100 .get = param_get_int,
101};
102
103module_param_array_named(axes, lis3_dev.ac.as_array, axis, NULL, 0644);
104MODULE_PARM_DESC(axes, "Axis-mapping for x,y,z directions");
105
Daniel Macka38da2e2009-03-31 15:24:32 -0700106static s16 lis3lv02d_read_8(struct lis3lv02d *lis3, int reg)
107{
108 s8 lo;
109 if (lis3->read(lis3, reg, &lo) < 0)
110 return 0;
111
112 return lo;
113}
114
Éric Pielbc62c142009-12-14 18:01:39 -0800115static s16 lis3lv02d_read_12(struct lis3lv02d *lis3, int reg)
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700116{
117 u8 lo, hi;
118
Daniel Macka38da2e2009-03-31 15:24:32 -0700119 lis3->read(lis3, reg - 1, &lo);
120 lis3->read(lis3, reg, &hi);
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700121 /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */
122 return (s16)((hi << 8) | lo);
123}
124
Pavel Machek455fbdd2008-11-12 13:27:02 -0800125/**
126 * lis3lv02d_get_axis - For the given axis, give the value converted
127 * @axis: 1,2,3 - can also be negative
128 * @hw_values: raw values returned by the hardware
129 *
130 * Returns the converted value.
131 */
132static inline int lis3lv02d_get_axis(s8 axis, int hw_values[3])
133{
134 if (axis > 0)
135 return hw_values[axis - 1];
136 else
137 return -hw_values[-axis - 1];
138}
139
140/**
141 * lis3lv02d_get_xyz - Get X, Y and Z axis values from the accelerometer
Daniel Macka38da2e2009-03-31 15:24:32 -0700142 * @lis3: pointer to the device struct
143 * @x: where to store the X axis value
144 * @y: where to store the Y axis value
145 * @z: where to store the Z axis value
Pavel Machek455fbdd2008-11-12 13:27:02 -0800146 *
147 * Note that 40Hz input device can eat up about 10% CPU at 800MHZ
148 */
Daniel Macka38da2e2009-03-31 15:24:32 -0700149static void lis3lv02d_get_xyz(struct lis3lv02d *lis3, int *x, int *y, int *z)
Pavel Machek455fbdd2008-11-12 13:27:02 -0800150{
151 int position[3];
Samu Onkalo32496c72009-12-14 18:01:46 -0800152 int i;
Pavel Machek455fbdd2008-11-12 13:27:02 -0800153
Eric Piela002ee82009-06-16 15:34:14 -0700154 position[0] = lis3->read_data(lis3, OUTX);
155 position[1] = lis3->read_data(lis3, OUTY);
156 position[2] = lis3->read_data(lis3, OUTZ);
Pavel Machek455fbdd2008-11-12 13:27:02 -0800157
Samu Onkalo32496c72009-12-14 18:01:46 -0800158 for (i = 0; i < 3; i++)
159 position[i] = (position[i] * lis3->scale) / LIS3_ACCURACY;
160
Eric Piela002ee82009-06-16 15:34:14 -0700161 *x = lis3lv02d_get_axis(lis3->ac.x, position);
162 *y = lis3lv02d_get_axis(lis3->ac.y, position);
163 *z = lis3lv02d_get_axis(lis3->ac.z, position);
Pavel Machek455fbdd2008-11-12 13:27:02 -0800164}
165
Samu Onkalo641615a2009-12-14 18:01:41 -0800166/* conversion btw sampling rate and the register values */
167static int lis3_12_rates[4] = {40, 160, 640, 2560};
168static int lis3_8_rates[2] = {100, 400};
Takashi Iwai78537c32010-09-23 10:01:39 -0700169static int lis3_3dc_rates[16] = {0, 1, 10, 25, 50, 100, 200, 400, 1600, 5000};
Samu Onkalo641615a2009-12-14 18:01:41 -0800170
Samu Onkaloa253aae2009-12-14 18:01:44 -0800171/* ODR is Output Data Rate */
Samu Onkalo641615a2009-12-14 18:01:41 -0800172static int lis3lv02d_get_odr(void)
173{
174 u8 ctrl;
Samu Onkaloa253aae2009-12-14 18:01:44 -0800175 int shift;
Samu Onkalo641615a2009-12-14 18:01:41 -0800176
177 lis3_dev.read(&lis3_dev, CTRL_REG1, &ctrl);
Samu Onkaloa253aae2009-12-14 18:01:44 -0800178 ctrl &= lis3_dev.odr_mask;
179 shift = ffs(lis3_dev.odr_mask) - 1;
180 return lis3_dev.odrs[(ctrl >> shift)];
181}
Samu Onkalo641615a2009-12-14 18:01:41 -0800182
Samu Onkaloa253aae2009-12-14 18:01:44 -0800183static int lis3lv02d_set_odr(int rate)
184{
185 u8 ctrl;
186 int i, len, shift;
187
Takashi Iwai78537c32010-09-23 10:01:39 -0700188 if (!rate)
189 return -EINVAL;
190
Samu Onkaloa253aae2009-12-14 18:01:44 -0800191 lis3_dev.read(&lis3_dev, CTRL_REG1, &ctrl);
192 ctrl &= ~lis3_dev.odr_mask;
193 len = 1 << hweight_long(lis3_dev.odr_mask); /* # of possible values */
194 shift = ffs(lis3_dev.odr_mask) - 1;
195
196 for (i = 0; i < len; i++)
197 if (lis3_dev.odrs[i] == rate) {
198 lis3_dev.write(&lis3_dev, CTRL_REG1,
199 ctrl | (i << shift));
200 return 0;
201 }
202 return -EINVAL;
Samu Onkalo641615a2009-12-14 18:01:41 -0800203}
204
Samu Onkalo2db4a762009-12-14 18:01:43 -0800205static int lis3lv02d_selftest(struct lis3lv02d *lis3, s16 results[3])
206{
Takashi Iwai78537c32010-09-23 10:01:39 -0700207 u8 ctlreg, reg;
Samu Onkalo2db4a762009-12-14 18:01:43 -0800208 s16 x, y, z;
209 u8 selftest;
210 int ret;
211
212 mutex_lock(&lis3->mutex);
Takashi Iwai78537c32010-09-23 10:01:39 -0700213 if (lis3_dev.whoami == WAI_3DC) {
214 ctlreg = CTRL_REG4;
215 selftest = CTRL4_ST0;
216 } else {
217 ctlreg = CTRL_REG1;
218 if (lis3_dev.whoami == WAI_12B)
219 selftest = CTRL1_ST;
220 else
221 selftest = CTRL1_STP;
222 }
Samu Onkalo2db4a762009-12-14 18:01:43 -0800223
Takashi Iwai78537c32010-09-23 10:01:39 -0700224 lis3->read(lis3, ctlreg, &reg);
225 lis3->write(lis3, ctlreg, (reg | selftest));
Samu Onkalo2db4a762009-12-14 18:01:43 -0800226 msleep(lis3->pwron_delay / lis3lv02d_get_odr());
227
228 /* Read directly to avoid axis remap */
229 x = lis3->read_data(lis3, OUTX);
230 y = lis3->read_data(lis3, OUTY);
231 z = lis3->read_data(lis3, OUTZ);
232
233 /* back to normal settings */
Takashi Iwai78537c32010-09-23 10:01:39 -0700234 lis3->write(lis3, ctlreg, reg);
Samu Onkalo2db4a762009-12-14 18:01:43 -0800235 msleep(lis3->pwron_delay / lis3lv02d_get_odr());
236
237 results[0] = x - lis3->read_data(lis3, OUTX);
238 results[1] = y - lis3->read_data(lis3, OUTY);
239 results[2] = z - lis3->read_data(lis3, OUTZ);
240
241 ret = 0;
242 if (lis3->pdata) {
243 int i;
244 for (i = 0; i < 3; i++) {
245 /* Check against selftest acceptance limits */
246 if ((results[i] < lis3->pdata->st_min_limits[i]) ||
247 (results[i] > lis3->pdata->st_max_limits[i])) {
248 ret = -EIO;
249 goto fail;
250 }
251 }
252 }
253
254 /* test passed */
255fail:
256 mutex_unlock(&lis3->mutex);
257 return ret;
258}
259
Daniel Macka38da2e2009-03-31 15:24:32 -0700260void lis3lv02d_poweroff(struct lis3lv02d *lis3)
Pavel Machek455fbdd2008-11-12 13:27:02 -0800261{
Eric Piela002ee82009-06-16 15:34:14 -0700262 /* disable X,Y,Z axis and power down */
263 lis3->write(lis3, CTRL_REG1, 0x00);
Pavel Machek455fbdd2008-11-12 13:27:02 -0800264}
Eric Pielcfce41a2009-01-09 16:41:01 -0800265EXPORT_SYMBOL_GPL(lis3lv02d_poweroff);
Pavel Machek455fbdd2008-11-12 13:27:02 -0800266
Daniel Macka38da2e2009-03-31 15:24:32 -0700267void lis3lv02d_poweron(struct lis3lv02d *lis3)
Pavel Machek455fbdd2008-11-12 13:27:02 -0800268{
Eric Piela002ee82009-06-16 15:34:14 -0700269 u8 reg;
270
271 lis3->init(lis3);
272
Samu Onkalo641615a2009-12-14 18:01:41 -0800273 /* LIS3 power on delay is quite long */
274 msleep(lis3->pwron_delay / lis3lv02d_get_odr());
275
Eric Piela002ee82009-06-16 15:34:14 -0700276 /*
277 * Common configuration
Éric Piel4b5d95b2009-12-14 18:01:40 -0800278 * BDU: (12 bits sensors only) LSB and MSB values are not updated until
279 * both have been read. So the value read will always be correct.
Eric Piela002ee82009-06-16 15:34:14 -0700280 */
Éric Piel4b5d95b2009-12-14 18:01:40 -0800281 if (lis3->whoami == WAI_12B) {
282 lis3->read(lis3, CTRL_REG2, &reg);
283 reg |= CTRL2_BDU;
284 lis3->write(lis3, CTRL_REG2, reg);
285 }
Pavel Machek455fbdd2008-11-12 13:27:02 -0800286}
Eric Pielcfce41a2009-01-09 16:41:01 -0800287EXPORT_SYMBOL_GPL(lis3lv02d_poweron);
Pavel Machek455fbdd2008-11-12 13:27:02 -0800288
Pavel Machek455fbdd2008-11-12 13:27:02 -0800289
Samu Onkalo6d94d402010-05-24 14:33:37 -0700290static void lis3lv02d_joystick_poll(struct input_polled_dev *pidev)
291{
292 int x, y, z;
293
294 mutex_lock(&lis3_dev.mutex);
295 lis3lv02d_get_xyz(&lis3_dev, &x, &y, &z);
296 input_report_abs(pidev->input, ABS_X, x);
297 input_report_abs(pidev->input, ABS_Y, y);
298 input_report_abs(pidev->input, ABS_Z, z);
299 input_sync(pidev->input);
300 mutex_unlock(&lis3_dev.mutex);
301}
302
Samu Onkalo2a346992010-10-22 07:57:23 -0400303static void lis3lv02d_joystick_open(struct input_polled_dev *pidev)
304{
305 if (lis3_dev.pm_dev)
306 pm_runtime_get_sync(lis3_dev.pm_dev);
307}
308
309static void lis3lv02d_joystick_close(struct input_polled_dev *pidev)
310{
311 if (lis3_dev.pm_dev)
312 pm_runtime_put(lis3_dev.pm_dev);
313}
314
Pavel Machekef2cfc72009-02-18 14:48:23 -0800315static irqreturn_t lis302dl_interrupt(int irq, void *dummy)
316{
Samu Onkalo92ba4fe2010-05-24 14:33:36 -0700317 if (!test_bit(0, &lis3_dev.misc_opened))
318 goto out;
319
Pavel Machekef2cfc72009-02-18 14:48:23 -0800320 /*
321 * Be careful: on some HP laptops the bios force DD when on battery and
322 * the lid is closed. This leads to interrupts as soon as a little move
323 * is done.
324 */
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700325 atomic_inc(&lis3_dev.count);
Pavel Machekef2cfc72009-02-18 14:48:23 -0800326
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700327 wake_up_interruptible(&lis3_dev.misc_wait);
328 kill_fasync(&lis3_dev.async_queue, SIGIO, POLL_IN);
Samu Onkalo92ba4fe2010-05-24 14:33:36 -0700329out:
Takashi Iwaif7c77a32010-09-23 10:01:11 -0700330 if (lis3_dev.pdata && lis3_dev.whoami == WAI_8B && lis3_dev.idev &&
Samu Onkalo92ba4fe2010-05-24 14:33:36 -0700331 lis3_dev.idev->input->users)
332 return IRQ_WAKE_THREAD;
333 return IRQ_HANDLED;
334}
335
Samu Onkalo6d94d402010-05-24 14:33:37 -0700336static void lis302dl_interrupt_handle_click(struct lis3lv02d *lis3)
337{
338 struct input_dev *dev = lis3->idev->input;
339 u8 click_src;
340
341 mutex_lock(&lis3->mutex);
342 lis3->read(lis3, CLICK_SRC, &click_src);
343
344 if (click_src & CLICK_SINGLE_X) {
345 input_report_key(dev, lis3->mapped_btns[0], 1);
346 input_report_key(dev, lis3->mapped_btns[0], 0);
347 }
348
349 if (click_src & CLICK_SINGLE_Y) {
350 input_report_key(dev, lis3->mapped_btns[1], 1);
351 input_report_key(dev, lis3->mapped_btns[1], 0);
352 }
353
354 if (click_src & CLICK_SINGLE_Z) {
355 input_report_key(dev, lis3->mapped_btns[2], 1);
356 input_report_key(dev, lis3->mapped_btns[2], 0);
357 }
358 input_sync(dev);
359 mutex_unlock(&lis3->mutex);
360}
361
362static void lis302dl_interrupt_handle_ff_wu(struct lis3lv02d *lis3)
363{
364 u8 wu1_src;
365 u8 wu2_src;
366
367 lis3->read(lis3, FF_WU_SRC_1, &wu1_src);
368 lis3->read(lis3, FF_WU_SRC_2, &wu2_src);
369
370 wu1_src = wu1_src & FF_WU_SRC_IA ? wu1_src : 0;
371 wu2_src = wu2_src & FF_WU_SRC_IA ? wu2_src : 0;
372
373 /* joystick poll is internally protected by the lis3->mutex. */
374 if (wu1_src || wu2_src)
375 lis3lv02d_joystick_poll(lis3_dev.idev);
376}
377
Samu Onkalo92ba4fe2010-05-24 14:33:36 -0700378static irqreturn_t lis302dl_interrupt_thread1_8b(int irq, void *data)
379{
Samu Onkalo6d94d402010-05-24 14:33:37 -0700380
381 struct lis3lv02d *lis3 = data;
382
383 if ((lis3->pdata->irq_cfg & LIS3_IRQ1_MASK) == LIS3_IRQ1_CLICK)
384 lis302dl_interrupt_handle_click(lis3);
385 else
386 lis302dl_interrupt_handle_ff_wu(lis3);
387
Samu Onkalo92ba4fe2010-05-24 14:33:36 -0700388 return IRQ_HANDLED;
389}
390
391static irqreturn_t lis302dl_interrupt_thread2_8b(int irq, void *data)
392{
Samu Onkalo6d94d402010-05-24 14:33:37 -0700393
394 struct lis3lv02d *lis3 = data;
395
396 if ((lis3->pdata->irq_cfg & LIS3_IRQ2_MASK) == LIS3_IRQ2_CLICK)
397 lis302dl_interrupt_handle_click(lis3);
398 else
399 lis302dl_interrupt_handle_ff_wu(lis3);
400
Pavel Machekef2cfc72009-02-18 14:48:23 -0800401 return IRQ_HANDLED;
402}
403
404static int lis3lv02d_misc_open(struct inode *inode, struct file *file)
405{
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700406 if (test_and_set_bit(0, &lis3_dev.misc_opened))
Pavel Machekef2cfc72009-02-18 14:48:23 -0800407 return -EBUSY; /* already open */
408
Samu Onkalo2a346992010-10-22 07:57:23 -0400409 if (lis3_dev.pm_dev)
410 pm_runtime_get_sync(lis3_dev.pm_dev);
411
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700412 atomic_set(&lis3_dev.count, 0);
Pavel Machekef2cfc72009-02-18 14:48:23 -0800413 return 0;
414}
415
416static int lis3lv02d_misc_release(struct inode *inode, struct file *file)
417{
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700418 fasync_helper(-1, file, 0, &lis3_dev.async_queue);
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700419 clear_bit(0, &lis3_dev.misc_opened); /* release the device */
Samu Onkalo2a346992010-10-22 07:57:23 -0400420 if (lis3_dev.pm_dev)
421 pm_runtime_put(lis3_dev.pm_dev);
Pavel Machekef2cfc72009-02-18 14:48:23 -0800422 return 0;
423}
424
425static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf,
426 size_t count, loff_t *pos)
427{
428 DECLARE_WAITQUEUE(wait, current);
429 u32 data;
430 unsigned char byte_data;
431 ssize_t retval = 1;
432
433 if (count < 1)
434 return -EINVAL;
435
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700436 add_wait_queue(&lis3_dev.misc_wait, &wait);
Pavel Machekef2cfc72009-02-18 14:48:23 -0800437 while (true) {
438 set_current_state(TASK_INTERRUPTIBLE);
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700439 data = atomic_xchg(&lis3_dev.count, 0);
Pavel Machekef2cfc72009-02-18 14:48:23 -0800440 if (data)
441 break;
442
443 if (file->f_flags & O_NONBLOCK) {
444 retval = -EAGAIN;
445 goto out;
446 }
447
448 if (signal_pending(current)) {
449 retval = -ERESTARTSYS;
450 goto out;
451 }
452
453 schedule();
454 }
455
456 if (data < 255)
457 byte_data = data;
458 else
459 byte_data = 255;
460
461 /* make sure we are not going into copy_to_user() with
462 * TASK_INTERRUPTIBLE state */
463 set_current_state(TASK_RUNNING);
464 if (copy_to_user(buf, &byte_data, sizeof(byte_data)))
465 retval = -EFAULT;
466
467out:
468 __set_current_state(TASK_RUNNING);
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700469 remove_wait_queue(&lis3_dev.misc_wait, &wait);
Pavel Machekef2cfc72009-02-18 14:48:23 -0800470
471 return retval;
472}
473
474static unsigned int lis3lv02d_misc_poll(struct file *file, poll_table *wait)
475{
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700476 poll_wait(file, &lis3_dev.misc_wait, wait);
477 if (atomic_read(&lis3_dev.count))
Pavel Machekef2cfc72009-02-18 14:48:23 -0800478 return POLLIN | POLLRDNORM;
479 return 0;
480}
481
482static int lis3lv02d_misc_fasync(int fd, struct file *file, int on)
483{
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700484 return fasync_helper(fd, file, on, &lis3_dev.async_queue);
Pavel Machekef2cfc72009-02-18 14:48:23 -0800485}
486
487static const struct file_operations lis3lv02d_misc_fops = {
488 .owner = THIS_MODULE,
489 .llseek = no_llseek,
490 .read = lis3lv02d_misc_read,
491 .open = lis3lv02d_misc_open,
492 .release = lis3lv02d_misc_release,
493 .poll = lis3lv02d_misc_poll,
494 .fasync = lis3lv02d_misc_fasync,
495};
496
497static struct miscdevice lis3lv02d_misc_device = {
498 .minor = MISC_DYNAMIC_MINOR,
499 .name = "freefall",
500 .fops = &lis3lv02d_misc_fops,
501};
502
Eric Pielcfce41a2009-01-09 16:41:01 -0800503int lis3lv02d_joystick_enable(void)
Pavel Machek455fbdd2008-11-12 13:27:02 -0800504{
Eric Pieldc6ea972009-06-16 15:34:15 -0700505 struct input_dev *input_dev;
Pavel Machek455fbdd2008-11-12 13:27:02 -0800506 int err;
Samu Onkalo32496c72009-12-14 18:01:46 -0800507 int max_val, fuzz, flat;
Samu Onkalo6d94d402010-05-24 14:33:37 -0700508 int btns[] = {BTN_X, BTN_Y, BTN_Z};
Pavel Machek455fbdd2008-11-12 13:27:02 -0800509
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700510 if (lis3_dev.idev)
Pavel Machek455fbdd2008-11-12 13:27:02 -0800511 return -EINVAL;
512
Eric Pieldc6ea972009-06-16 15:34:15 -0700513 lis3_dev.idev = input_allocate_polled_device();
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700514 if (!lis3_dev.idev)
Pavel Machek455fbdd2008-11-12 13:27:02 -0800515 return -ENOMEM;
516
Eric Pieldc6ea972009-06-16 15:34:15 -0700517 lis3_dev.idev->poll = lis3lv02d_joystick_poll;
Samu Onkalo2a346992010-10-22 07:57:23 -0400518 lis3_dev.idev->open = lis3lv02d_joystick_open;
519 lis3_dev.idev->close = lis3lv02d_joystick_close;
Eric Pieldc6ea972009-06-16 15:34:15 -0700520 lis3_dev.idev->poll_interval = MDPS_POLL_INTERVAL;
Samu Onkalo4a70a412010-05-24 14:33:37 -0700521 lis3_dev.idev->poll_interval_min = MDPS_POLL_MIN;
522 lis3_dev.idev->poll_interval_max = MDPS_POLL_MAX;
Eric Pieldc6ea972009-06-16 15:34:15 -0700523 input_dev = lis3_dev.idev->input;
524
Eric Pieldc6ea972009-06-16 15:34:15 -0700525 input_dev->name = "ST LIS3LV02DL Accelerometer";
526 input_dev->phys = DRIVER_NAME "/input0";
527 input_dev->id.bustype = BUS_HOST;
528 input_dev->id.vendor = 0;
529 input_dev->dev.parent = &lis3_dev.pdev->dev;
Pavel Machek455fbdd2008-11-12 13:27:02 -0800530
Eric Pieldc6ea972009-06-16 15:34:15 -0700531 set_bit(EV_ABS, input_dev->evbit);
Samu Onkalo32496c72009-12-14 18:01:46 -0800532 max_val = (lis3_dev.mdps_max_val * lis3_dev.scale) / LIS3_ACCURACY;
533 fuzz = (LIS3_DEFAULT_FUZZ * lis3_dev.scale) / LIS3_ACCURACY;
534 flat = (LIS3_DEFAULT_FLAT * lis3_dev.scale) / LIS3_ACCURACY;
535 input_set_abs_params(input_dev, ABS_X, -max_val, max_val, fuzz, flat);
536 input_set_abs_params(input_dev, ABS_Y, -max_val, max_val, fuzz, flat);
537 input_set_abs_params(input_dev, ABS_Z, -max_val, max_val, fuzz, flat);
Pavel Machek455fbdd2008-11-12 13:27:02 -0800538
Samu Onkalo6d94d402010-05-24 14:33:37 -0700539 lis3_dev.mapped_btns[0] = lis3lv02d_get_axis(abs(lis3_dev.ac.x), btns);
540 lis3_dev.mapped_btns[1] = lis3lv02d_get_axis(abs(lis3_dev.ac.y), btns);
541 lis3_dev.mapped_btns[2] = lis3lv02d_get_axis(abs(lis3_dev.ac.z), btns);
542
Eric Pieldc6ea972009-06-16 15:34:15 -0700543 err = input_register_polled_device(lis3_dev.idev);
Pavel Machek455fbdd2008-11-12 13:27:02 -0800544 if (err) {
Eric Pieldc6ea972009-06-16 15:34:15 -0700545 input_free_polled_device(lis3_dev.idev);
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700546 lis3_dev.idev = NULL;
Pavel Machek455fbdd2008-11-12 13:27:02 -0800547 }
548
549 return err;
550}
Eric Pielcfce41a2009-01-09 16:41:01 -0800551EXPORT_SYMBOL_GPL(lis3lv02d_joystick_enable);
Pavel Machek455fbdd2008-11-12 13:27:02 -0800552
Eric Pielcfce41a2009-01-09 16:41:01 -0800553void lis3lv02d_joystick_disable(void)
Pavel Machek455fbdd2008-11-12 13:27:02 -0800554{
Samu Onkalo92ba4fe2010-05-24 14:33:36 -0700555 if (lis3_dev.irq)
556 free_irq(lis3_dev.irq, &lis3_dev);
557 if (lis3_dev.pdata && lis3_dev.pdata->irq2)
558 free_irq(lis3_dev.pdata->irq2, &lis3_dev);
559
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700560 if (!lis3_dev.idev)
Pavel Machek455fbdd2008-11-12 13:27:02 -0800561 return;
562
Eric Pielc2884242009-06-16 15:34:13 -0700563 if (lis3_dev.irq)
564 misc_deregister(&lis3lv02d_misc_device);
Eric Pieldc6ea972009-06-16 15:34:15 -0700565 input_unregister_polled_device(lis3_dev.idev);
Samu Onkalo66c85692009-12-14 18:01:39 -0800566 input_free_polled_device(lis3_dev.idev);
Pavel Machekbe84cfc2009-03-31 15:24:26 -0700567 lis3_dev.idev = NULL;
Pavel Machek455fbdd2008-11-12 13:27:02 -0800568}
Eric Pielcfce41a2009-01-09 16:41:01 -0800569EXPORT_SYMBOL_GPL(lis3lv02d_joystick_disable);
Pavel Machek455fbdd2008-11-12 13:27:02 -0800570
Pavel Machek455fbdd2008-11-12 13:27:02 -0800571/* Sysfs stuff */
Samu Onkalo2a346992010-10-22 07:57:23 -0400572static void lis3lv02d_sysfs_poweron(struct lis3lv02d *lis3)
573{
574 /*
575 * SYSFS functions are fast visitors so put-call
576 * immediately after the get-call. However, keep
577 * chip running for a while and schedule delayed
578 * suspend. This way periodic sysfs calls doesn't
579 * suffer from relatively long power up time.
580 */
581
582 if (lis3->pm_dev) {
583 pm_runtime_get_sync(lis3->pm_dev);
584 pm_runtime_put_noidle(lis3->pm_dev);
585 pm_schedule_suspend(lis3->pm_dev, LIS3_SYSFS_POWERDOWN_DELAY);
586 }
587}
588
Samu Onkalo2db4a762009-12-14 18:01:43 -0800589static ssize_t lis3lv02d_selftest_show(struct device *dev,
590 struct device_attribute *attr, char *buf)
591{
592 int result;
593 s16 values[3];
594
Samu Onkalo2a346992010-10-22 07:57:23 -0400595 lis3lv02d_sysfs_poweron(&lis3_dev);
Samu Onkalo2db4a762009-12-14 18:01:43 -0800596 result = lis3lv02d_selftest(&lis3_dev, values);
597 return sprintf(buf, "%s %d %d %d\n", result == 0 ? "OK" : "FAIL",
598 values[0], values[1], values[2]);
599}
600
Pavel Machek455fbdd2008-11-12 13:27:02 -0800601static ssize_t lis3lv02d_position_show(struct device *dev,
602 struct device_attribute *attr, char *buf)
603{
604 int x, y, z;
605
Samu Onkalo2a346992010-10-22 07:57:23 -0400606 lis3lv02d_sysfs_poweron(&lis3_dev);
Samu Onkalo6d94d402010-05-24 14:33:37 -0700607 mutex_lock(&lis3_dev.mutex);
Daniel Macka38da2e2009-03-31 15:24:32 -0700608 lis3lv02d_get_xyz(&lis3_dev, &x, &y, &z);
Samu Onkalo6d94d402010-05-24 14:33:37 -0700609 mutex_unlock(&lis3_dev.mutex);
Pavel Machek455fbdd2008-11-12 13:27:02 -0800610 return sprintf(buf, "(%d,%d,%d)\n", x, y, z);
611}
612
Pavel Machek455fbdd2008-11-12 13:27:02 -0800613static ssize_t lis3lv02d_rate_show(struct device *dev,
614 struct device_attribute *attr, char *buf)
615{
Samu Onkalo2a346992010-10-22 07:57:23 -0400616 lis3lv02d_sysfs_poweron(&lis3_dev);
Samu Onkalo641615a2009-12-14 18:01:41 -0800617 return sprintf(buf, "%d\n", lis3lv02d_get_odr());
Pavel Machek455fbdd2008-11-12 13:27:02 -0800618}
619
Samu Onkaloa253aae2009-12-14 18:01:44 -0800620static ssize_t lis3lv02d_rate_set(struct device *dev,
621 struct device_attribute *attr, const char *buf,
622 size_t count)
623{
624 unsigned long rate;
625
626 if (strict_strtoul(buf, 0, &rate))
627 return -EINVAL;
628
Samu Onkalo2a346992010-10-22 07:57:23 -0400629 lis3lv02d_sysfs_poweron(&lis3_dev);
Samu Onkaloa253aae2009-12-14 18:01:44 -0800630 if (lis3lv02d_set_odr(rate))
631 return -EINVAL;
632
633 return count;
634}
635
Samu Onkalo2db4a762009-12-14 18:01:43 -0800636static DEVICE_ATTR(selftest, S_IRUSR, lis3lv02d_selftest_show, NULL);
Pavel Machek455fbdd2008-11-12 13:27:02 -0800637static DEVICE_ATTR(position, S_IRUGO, lis3lv02d_position_show, NULL);
Samu Onkaloa253aae2009-12-14 18:01:44 -0800638static DEVICE_ATTR(rate, S_IRUGO | S_IWUSR, lis3lv02d_rate_show,
639 lis3lv02d_rate_set);
Pavel Machek455fbdd2008-11-12 13:27:02 -0800640
641static struct attribute *lis3lv02d_attributes[] = {
Samu Onkalo2db4a762009-12-14 18:01:43 -0800642 &dev_attr_selftest.attr,
Pavel Machek455fbdd2008-11-12 13:27:02 -0800643 &dev_attr_position.attr,
Pavel Machek455fbdd2008-11-12 13:27:02 -0800644 &dev_attr_rate.attr,
645 NULL
646};
647
648static struct attribute_group lis3lv02d_attribute_group = {
649 .attrs = lis3lv02d_attributes
650};
651
Eric Pielcfce41a2009-01-09 16:41:01 -0800652
Daniel Macka38da2e2009-03-31 15:24:32 -0700653static int lis3lv02d_add_fs(struct lis3lv02d *lis3)
Pavel Machek455fbdd2008-11-12 13:27:02 -0800654{
Eric Piela002ee82009-06-16 15:34:14 -0700655 lis3->pdev = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0);
656 if (IS_ERR(lis3->pdev))
657 return PTR_ERR(lis3->pdev);
Pavel Machek455fbdd2008-11-12 13:27:02 -0800658
Eric Piela002ee82009-06-16 15:34:14 -0700659 return sysfs_create_group(&lis3->pdev->dev.kobj, &lis3lv02d_attribute_group);
Pavel Machek455fbdd2008-11-12 13:27:02 -0800660}
661
Eric Piela002ee82009-06-16 15:34:14 -0700662int lis3lv02d_remove_fs(struct lis3lv02d *lis3)
Pavel Machek455fbdd2008-11-12 13:27:02 -0800663{
Eric Piela002ee82009-06-16 15:34:14 -0700664 sysfs_remove_group(&lis3->pdev->dev.kobj, &lis3lv02d_attribute_group);
665 platform_device_unregister(lis3->pdev);
Samu Onkalo2a346992010-10-22 07:57:23 -0400666 if (lis3->pm_dev) {
667 /* Barrier after the sysfs remove */
668 pm_runtime_barrier(lis3->pm_dev);
669
670 /* SYSFS may have left chip running. Turn off if necessary */
671 if (!pm_runtime_suspended(lis3->pm_dev))
672 lis3lv02d_poweroff(&lis3_dev);
673
674 pm_runtime_disable(lis3->pm_dev);
675 pm_runtime_set_suspended(lis3->pm_dev);
676 }
Pavel Machek455fbdd2008-11-12 13:27:02 -0800677 return 0;
678}
Eric Pielcfce41a2009-01-09 16:41:01 -0800679EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs);
Pavel Machek455fbdd2008-11-12 13:27:02 -0800680
Samu Onkaloecc437a2010-05-24 14:33:34 -0700681static void lis3lv02d_8b_configure(struct lis3lv02d *dev,
682 struct lis3lv02d_platform_data *p)
683{
Samu Onkalo92ba4fe2010-05-24 14:33:36 -0700684 int err;
Samu Onkalo342c5f12010-05-24 14:33:35 -0700685 int ctrl2 = p->hipass_ctrl;
686
Samu Onkaloecc437a2010-05-24 14:33:34 -0700687 if (p->click_flags) {
688 dev->write(dev, CLICK_CFG, p->click_flags);
689 dev->write(dev, CLICK_TIMELIMIT, p->click_time_limit);
690 dev->write(dev, CLICK_LATENCY, p->click_latency);
691 dev->write(dev, CLICK_WINDOW, p->click_window);
692 dev->write(dev, CLICK_THSZ, p->click_thresh_z & 0xf);
693 dev->write(dev, CLICK_THSY_X,
694 (p->click_thresh_x & 0xf) |
695 (p->click_thresh_y << 4));
Samu Onkalo6d94d402010-05-24 14:33:37 -0700696
697 if (dev->idev) {
698 struct input_dev *input_dev = lis3_dev.idev->input;
699 input_set_capability(input_dev, EV_KEY, BTN_X);
700 input_set_capability(input_dev, EV_KEY, BTN_Y);
701 input_set_capability(input_dev, EV_KEY, BTN_Z);
702 }
Samu Onkaloecc437a2010-05-24 14:33:34 -0700703 }
704
705 if (p->wakeup_flags) {
706 dev->write(dev, FF_WU_CFG_1, p->wakeup_flags);
707 dev->write(dev, FF_WU_THS_1, p->wakeup_thresh & 0x7f);
708 /* default to 2.5ms for now */
709 dev->write(dev, FF_WU_DURATION_1, 1);
Samu Onkalo342c5f12010-05-24 14:33:35 -0700710 ctrl2 ^= HP_FF_WU1; /* Xor to keep compatible with old pdata*/
Samu Onkaloecc437a2010-05-24 14:33:34 -0700711 }
Samu Onkalo342c5f12010-05-24 14:33:35 -0700712
713 if (p->wakeup_flags2) {
714 dev->write(dev, FF_WU_CFG_2, p->wakeup_flags2);
715 dev->write(dev, FF_WU_THS_2, p->wakeup_thresh2 & 0x7f);
716 /* default to 2.5ms for now */
717 dev->write(dev, FF_WU_DURATION_2, 1);
718 ctrl2 ^= HP_FF_WU2; /* Xor to keep compatible with old pdata*/
719 }
720 /* Configure hipass filters */
721 dev->write(dev, CTRL_REG2, ctrl2);
Samu Onkalo92ba4fe2010-05-24 14:33:36 -0700722
723 if (p->irq2) {
724 err = request_threaded_irq(p->irq2,
725 NULL,
726 lis302dl_interrupt_thread2_8b,
727 IRQF_TRIGGER_RISING |
728 IRQF_ONESHOT,
729 DRIVER_NAME, &lis3_dev);
730 if (err < 0)
731 printk(KERN_ERR DRIVER_NAME
732 "No second IRQ. Limited functionality\n");
733 }
Samu Onkaloecc437a2010-05-24 14:33:34 -0700734}
735
Daniel Mackab337a62009-03-31 15:24:31 -0700736/*
737 * Initialise the accelerometer and the various subsystems.
Éric Pielbc62c142009-12-14 18:01:39 -0800738 * Should be rather independent of the bus system.
Daniel Mackab337a62009-03-31 15:24:31 -0700739 */
Daniel Macka38da2e2009-03-31 15:24:32 -0700740int lis3lv02d_init_device(struct lis3lv02d *dev)
Daniel Mackab337a62009-03-31 15:24:31 -0700741{
Samu Onkalo92ba4fe2010-05-24 14:33:36 -0700742 int err;
743 irq_handler_t thread_fn;
744
Daniel Macka38da2e2009-03-31 15:24:32 -0700745 dev->whoami = lis3lv02d_read_8(dev, WHO_AM_I);
746
747 switch (dev->whoami) {
Éric Pielbc62c142009-12-14 18:01:39 -0800748 case WAI_12B:
749 printk(KERN_INFO DRIVER_NAME ": 12 bits sensor found\n");
750 dev->read_data = lis3lv02d_read_12;
Daniel Macka38da2e2009-03-31 15:24:32 -0700751 dev->mdps_max_val = 2048;
Samu Onkalo641615a2009-12-14 18:01:41 -0800752 dev->pwron_delay = LIS3_PWRON_DELAY_WAI_12B;
Samu Onkaloa253aae2009-12-14 18:01:44 -0800753 dev->odrs = lis3_12_rates;
754 dev->odr_mask = CTRL1_DF0 | CTRL1_DF1;
Samu Onkalo32496c72009-12-14 18:01:46 -0800755 dev->scale = LIS3_SENSITIVITY_12B;
Daniel Macka38da2e2009-03-31 15:24:32 -0700756 break;
Éric Pielbc62c142009-12-14 18:01:39 -0800757 case WAI_8B:
758 printk(KERN_INFO DRIVER_NAME ": 8 bits sensor found\n");
Daniel Macka38da2e2009-03-31 15:24:32 -0700759 dev->read_data = lis3lv02d_read_8;
760 dev->mdps_max_val = 128;
Samu Onkalo641615a2009-12-14 18:01:41 -0800761 dev->pwron_delay = LIS3_PWRON_DELAY_WAI_8B;
Samu Onkaloa253aae2009-12-14 18:01:44 -0800762 dev->odrs = lis3_8_rates;
763 dev->odr_mask = CTRL1_DR;
Samu Onkalo32496c72009-12-14 18:01:46 -0800764 dev->scale = LIS3_SENSITIVITY_8B;
Daniel Macka38da2e2009-03-31 15:24:32 -0700765 break;
Takashi Iwai78537c32010-09-23 10:01:39 -0700766 case WAI_3DC:
767 printk(KERN_INFO DRIVER_NAME ": 8 bits 3DC sensor found\n");
768 dev->read_data = lis3lv02d_read_8;
769 dev->mdps_max_val = 128;
770 dev->pwron_delay = LIS3_PWRON_DELAY_WAI_8B;
771 dev->odrs = lis3_3dc_rates;
772 dev->odr_mask = CTRL1_ODR0|CTRL1_ODR1|CTRL1_ODR2|CTRL1_ODR3;
773 dev->scale = LIS3_SENSITIVITY_8B;
774 break;
Daniel Macka38da2e2009-03-31 15:24:32 -0700775 default:
776 printk(KERN_ERR DRIVER_NAME
Eric Piela002ee82009-06-16 15:34:14 -0700777 ": unknown sensor type 0x%X\n", dev->whoami);
Daniel Macka38da2e2009-03-31 15:24:32 -0700778 return -EINVAL;
779 }
780
Samu Onkalo2db4a762009-12-14 18:01:43 -0800781 mutex_init(&dev->mutex);
782
Daniel Macka38da2e2009-03-31 15:24:32 -0700783 lis3lv02d_add_fs(dev);
Eric Piela002ee82009-06-16 15:34:14 -0700784 lis3lv02d_poweron(dev);
Daniel Mackab337a62009-03-31 15:24:31 -0700785
Samu Onkalo2a346992010-10-22 07:57:23 -0400786 if (dev->pm_dev) {
787 pm_runtime_set_active(dev->pm_dev);
788 pm_runtime_enable(dev->pm_dev);
789 }
790
Daniel Mackab337a62009-03-31 15:24:31 -0700791 if (lis3lv02d_joystick_enable())
792 printk(KERN_ERR DRIVER_NAME ": joystick initialization failed\n");
793
Daniel Mack8f3128e2009-06-16 15:34:17 -0700794 /* passing in platform specific data is purely optional and only
795 * used by the SPI transport layer at the moment */
796 if (dev->pdata) {
797 struct lis3lv02d_platform_data *p = dev->pdata;
798
Samu Onkaloecc437a2010-05-24 14:33:34 -0700799 if (dev->whoami == WAI_8B)
800 lis3lv02d_8b_configure(dev, p);
Daniel Mack8873c332009-09-21 17:04:43 -0700801
Daniel Mack8f3128e2009-06-16 15:34:17 -0700802 if (p->irq_cfg)
803 dev->write(dev, CTRL_REG3, p->irq_cfg);
804 }
805
Daniel Macka38da2e2009-03-31 15:24:32 -0700806 /* bail if we did not get an IRQ from the bus layer */
Daniel Mackab337a62009-03-31 15:24:31 -0700807 if (!dev->irq) {
808 printk(KERN_ERR DRIVER_NAME
Daniel Macka38da2e2009-03-31 15:24:32 -0700809 ": No IRQ. Disabling /dev/freefall\n");
Daniel Mackab337a62009-03-31 15:24:31 -0700810 goto out;
811 }
812
Samu Onkalo92ba4fe2010-05-24 14:33:36 -0700813 /*
814 * The sensor can generate interrupts for free-fall and direction
815 * detection (distinguishable with FF_WU_SRC and DD_SRC) but to keep
816 * the things simple and _fast_ we activate it only for free-fall, so
817 * no need to read register (very slow with ACPI). For the same reason,
818 * we forbid shared interrupts.
819 *
820 * IRQF_TRIGGER_RISING seems pointless on HP laptops because the
821 * io-apic is not configurable (and generates a warning) but I keep it
822 * in case of support for other hardware.
823 */
Takashi Iwaif7c77a32010-09-23 10:01:11 -0700824 if (dev->pdata && dev->whoami == WAI_8B)
Samu Onkalo92ba4fe2010-05-24 14:33:36 -0700825 thread_fn = lis302dl_interrupt_thread1_8b;
826 else
827 thread_fn = NULL;
828
829 err = request_threaded_irq(dev->irq, lis302dl_interrupt,
830 thread_fn,
831 IRQF_TRIGGER_RISING | IRQF_ONESHOT,
832 DRIVER_NAME, &lis3_dev);
833
834 if (err < 0) {
835 printk(KERN_ERR DRIVER_NAME "Cannot get IRQ\n");
836 goto out;
837 }
838
Daniel Mackab337a62009-03-31 15:24:31 -0700839 if (misc_register(&lis3lv02d_misc_device))
840 printk(KERN_ERR DRIVER_NAME ": misc_register failed\n");
841out:
Daniel Mackab337a62009-03-31 15:24:31 -0700842 return 0;
843}
844EXPORT_SYMBOL_GPL(lis3lv02d_init_device);
845
Pavel Machek455fbdd2008-11-12 13:27:02 -0800846MODULE_DESCRIPTION("ST LIS3LV02Dx three-axis digital accelerometer driver");
Pavel Machekef2cfc72009-02-18 14:48:23 -0800847MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek");
Pavel Machek455fbdd2008-11-12 13:27:02 -0800848MODULE_LICENSE("GPL");