* [PATCH 0/4] lis3: clean up and updates
@ 2009-05-21 9:27 Éric Piel
2009-05-21 9:29 ` [PATCH 1/4] lis3: fix misc device unregistering and printk Éric Piel
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: Éric Piel @ 2009-05-21 9:27 UTC (permalink / raw)
To: Andrew Morton; +Cc: LKML, Pavel Machek
Hello,
Here is a patch series for the lis3lv02d accelerometer driver. The main
goal was to clean up the driver by removing non-necessary code.
However, during the process a few minor bugs were discovered and fixed.
Also the usual share of new axis conversion for known laptop models has
been added.
Andrew, would you mind queuing this for 2.6.31?
Eric
drivers/hwmon/hp_accel.c | 21 ++----
drivers/hwmon/lis3lv02d.c | 169 +++++++++++++++------------------------------
drivers/hwmon/lis3lv02d.h | 10 +--
3 files changed, 67 insertions(+), 133 deletions(-)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] lis3: fix misc device unregistering and printk
2009-05-21 9:27 [PATCH 0/4] lis3: clean up and updates Éric Piel
@ 2009-05-21 9:29 ` Éric Piel
2009-05-21 10:48 ` Pavel Machek
2009-05-21 9:30 ` [PATCH 2/4] lis3: remove automatic shutdown of the device Éric Piel
` (2 subsequent siblings)
3 siblings, 1 reply; 13+ messages in thread
From: Éric Piel @ 2009-05-21 9:29 UTC (permalink / raw)
To: Andrew Morton; +Cc: LKML, Pavel Machek
Can only unregister the misc device if it was registered before. Also
remove debugging messages, which in addition were not properly formated.
Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net>
---
drivers/hwmon/lis3lv02d.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c
index 778eb77..17f2003 100644
--- a/drivers/hwmon/lis3lv02d.c
+++ b/drivers/hwmon/lis3lv02d.c
@@ -199,7 +199,6 @@ static int lis3lv02d_misc_open(struct inode *inode, struct file *file)
return -EBUSY;
}
lis3lv02d_increase_use(&lis3_dev);
- printk("lis3: registered interrupt %d\n", lis3_dev.irq);
return 0;
}
@@ -378,7 +377,8 @@ void lis3lv02d_joystick_disable(void)
if (!lis3_dev.idev)
return;
- misc_deregister(&lis3lv02d_misc_device);
+ if (lis3_dev.irq)
+ misc_deregister(&lis3lv02d_misc_device);
input_unregister_device(lis3_dev.idev);
lis3_dev.idev = NULL;
}
@@ -493,8 +493,6 @@ int lis3lv02d_init_device(struct lis3lv02d *dev)
if (lis3lv02d_joystick_enable())
printk(KERN_ERR DRIVER_NAME ": joystick initialization failed\n");
- printk("lis3_init_device: irq %d\n", dev->irq);
-
/* bail if we did not get an IRQ from the bus layer */
if (!dev->irq) {
printk(KERN_ERR DRIVER_NAME
@@ -502,7 +500,6 @@ int lis3lv02d_init_device(struct lis3lv02d *dev)
goto out;
}
- printk("lis3: registering device\n");
if (misc_register(&lis3lv02d_misc_device))
printk(KERN_ERR DRIVER_NAME ": misc_register failed\n");
out:
--
1.6.2.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/4] lis3: remove automatic shutdown of the device
2009-05-21 9:27 [PATCH 0/4] lis3: clean up and updates Éric Piel
2009-05-21 9:29 ` [PATCH 1/4] lis3: fix misc device unregistering and printk Éric Piel
@ 2009-05-21 9:30 ` Éric Piel
2009-05-21 11:36 ` Pavel Machek
2009-05-21 9:31 ` [PATCH 3/4] lis3: use input_polled_device Éric Piel
2009-05-21 9:33 ` [PATCH 4/4] lis3: Add three new laptop models Éric Piel
3 siblings, 1 reply; 13+ messages in thread
From: Éric Piel @ 2009-05-21 9:30 UTC (permalink / raw)
To: Andrew Morton; +Cc: LKML, Pavel Machek
After measurement on my laptop, it seems that turning off the device
does not bring any energy saving (within 0.1W precision). So let's keep
the device always on. It simplifies the code, and it avoids the problem
of reading a wrong value sometimes just after turning the device on.
Moreover, since commit ef2cfc790bf5f0ff189b01eabc0f4feb5e8524df had been
too zealous, the device was actually never turned off anyway. This patch
also restores the damages done by this commit concerning the
initialisation/poweroff.
Also do more clean up with the usage of the lis3_dev global variable.
Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net>
---
drivers/hwmon/hp_accel.c | 10 +----
drivers/hwmon/lis3lv02d.c | 88 +++++++++++++++------------------------------
drivers/hwmon/lis3lv02d.h | 5 +--
3 files changed, 32 insertions(+), 71 deletions(-)
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c
index abca7e9..0ebd009 100644
--- a/drivers/hwmon/hp_accel.c
+++ b/drivers/hwmon/hp_accel.c
@@ -324,7 +324,7 @@ static int lis3lv02d_remove(struct acpi_device *device, int type)
flush_work(&hpled_led.work);
led_classdev_unregister(&hpled_led.led_classdev);
- return lis3lv02d_remove_fs();
+ return lis3lv02d_remove_fs(&lis3_dev);
}
@@ -338,13 +338,7 @@ static int lis3lv02d_suspend(struct acpi_device *device, pm_message_t state)
static int lis3lv02d_resume(struct acpi_device *device)
{
- /* put back the device in the right state (ACPI might turn it on) */
- mutex_lock(&lis3_dev.lock);
- if (lis3_dev.usage > 0)
- lis3lv02d_poweron(&lis3_dev);
- else
- lis3lv02d_poweroff(&lis3_dev);
- mutex_unlock(&lis3_dev.lock);
+ lis3lv02d_poweron(&lis3_dev);
return 0;
}
#else
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c
index 17f2003..df3f586 100644
--- a/drivers/hwmon/lis3lv02d.c
+++ b/drivers/hwmon/lis3lv02d.c
@@ -105,56 +105,39 @@ static void lis3lv02d_get_xyz(struct lis3lv02d *lis3, int *x, int *y, int *z)
{
int position[3];
- position[0] = lis3_dev.read_data(lis3, OUTX);
- position[1] = lis3_dev.read_data(lis3, OUTY);
- position[2] = lis3_dev.read_data(lis3, OUTZ);
+ position[0] = lis3->read_data(lis3, OUTX);
+ position[1] = lis3->read_data(lis3, OUTY);
+ position[2] = lis3->read_data(lis3, OUTZ);
- *x = lis3lv02d_get_axis(lis3_dev.ac.x, position);
- *y = lis3lv02d_get_axis(lis3_dev.ac.y, position);
- *z = lis3lv02d_get_axis(lis3_dev.ac.z, position);
+ *x = lis3lv02d_get_axis(lis3->ac.x, position);
+ *y = lis3lv02d_get_axis(lis3->ac.y, position);
+ *z = lis3lv02d_get_axis(lis3->ac.z, position);
}
void lis3lv02d_poweroff(struct lis3lv02d *lis3)
{
- lis3_dev.is_on = 0;
+ /* disable X,Y,Z axis and power down */
+ lis3->write(lis3, CTRL_REG1, 0x00);
}
EXPORT_SYMBOL_GPL(lis3lv02d_poweroff);
void lis3lv02d_poweron(struct lis3lv02d *lis3)
{
- lis3_dev.is_on = 1;
- lis3_dev.init(lis3);
-}
-EXPORT_SYMBOL_GPL(lis3lv02d_poweron);
+ u8 reg;
-/*
- * To be called before starting to use the device. It makes sure that the
- * device will always be on until a call to lis3lv02d_decrease_use(). Not to be
- * used from interrupt context.
- */
-static void lis3lv02d_increase_use(struct lis3lv02d *dev)
-{
- mutex_lock(&dev->lock);
- dev->usage++;
- if (dev->usage == 1) {
- if (!dev->is_on)
- lis3lv02d_poweron(dev);
- }
- mutex_unlock(&dev->lock);
-}
+ lis3->init(lis3);
-/*
- * To be called whenever a usage of the device is stopped.
- * It will make sure to turn off the device when there is not usage.
- */
-static void lis3lv02d_decrease_use(struct lis3lv02d *dev)
-{
- mutex_lock(&dev->lock);
- dev->usage--;
- if (dev->usage == 0)
- lis3lv02d_poweroff(dev);
- mutex_unlock(&dev->lock);
+ /*
+ * Common configuration
+ * BDU: LSB and MSB values are not updated until both have been read.
+ * So the value read will always be correct.
+ */
+ lis3->read(lis3, CTRL_REG2, ®);
+ reg |= CTRL2_BDU;
+ lis3->write(lis3, CTRL_REG2, reg);
}
+EXPORT_SYMBOL_GPL(lis3lv02d_poweron);
+
static irqreturn_t lis302dl_interrupt(int irq, void *dummy)
{
@@ -198,14 +181,12 @@ static int lis3lv02d_misc_open(struct inode *inode, struct file *file)
printk(KERN_ERR DRIVER_NAME ": IRQ%d allocation failed\n", lis3_dev.irq);
return -EBUSY;
}
- lis3lv02d_increase_use(&lis3_dev);
return 0;
}
static int lis3lv02d_misc_release(struct inode *inode, struct file *file)
{
fasync_helper(-1, file, 0, &lis3_dev.async_queue);
- lis3lv02d_decrease_use(&lis3_dev);
free_irq(lis3_dev.irq, &lis3_dev);
clear_bit(0, &lis3_dev.misc_opened); /* release the device */
return 0;
@@ -314,10 +295,8 @@ static int lis3lv02d_joystick_kthread(void *data)
static int lis3lv02d_joystick_open(struct input_dev *input)
{
- lis3lv02d_increase_use(&lis3_dev);
lis3_dev.kthread = kthread_run(lis3lv02d_joystick_kthread, NULL, "klis3lv02d");
if (IS_ERR(lis3_dev.kthread)) {
- lis3lv02d_decrease_use(&lis3_dev);
return PTR_ERR(lis3_dev.kthread);
}
@@ -327,7 +306,6 @@ static int lis3lv02d_joystick_open(struct input_dev *input)
static void lis3lv02d_joystick_close(struct input_dev *input)
{
kthread_stop(lis3_dev.kthread);
- lis3lv02d_decrease_use(&lis3_dev);
}
static inline void lis3lv02d_calibrate_joystick(void)
@@ -390,9 +368,7 @@ static ssize_t lis3lv02d_position_show(struct device *dev,
{
int x, y, z;
- lis3lv02d_increase_use(&lis3_dev);
lis3lv02d_get_xyz(&lis3_dev, &x, &y, &z);
- lis3lv02d_decrease_use(&lis3_dev);
return sprintf(buf, "(%d,%d,%d)\n", x, y, z);
}
@@ -406,9 +382,7 @@ static ssize_t lis3lv02d_calibrate_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
- lis3lv02d_increase_use(&lis3_dev);
lis3lv02d_calibrate_joystick();
- lis3lv02d_decrease_use(&lis3_dev);
return count;
}
@@ -420,9 +394,7 @@ static ssize_t lis3lv02d_rate_show(struct device *dev,
u8 ctrl;
int val;
- lis3lv02d_increase_use(&lis3_dev);
lis3_dev.read(&lis3_dev, CTRL_REG1, &ctrl);
- lis3lv02d_decrease_use(&lis3_dev);
val = (ctrl & (CTRL1_DF0 | CTRL1_DF1)) >> 4;
return sprintf(buf, "%d\n", lis3lv02dl_df_val[val]);
}
@@ -446,17 +418,17 @@ static struct attribute_group lis3lv02d_attribute_group = {
static int lis3lv02d_add_fs(struct lis3lv02d *lis3)
{
- lis3_dev.pdev = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0);
- if (IS_ERR(lis3_dev.pdev))
- return PTR_ERR(lis3_dev.pdev);
+ lis3->pdev = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0);
+ if (IS_ERR(lis3->pdev))
+ return PTR_ERR(lis3->pdev);
- return sysfs_create_group(&lis3_dev.pdev->dev.kobj, &lis3lv02d_attribute_group);
+ return sysfs_create_group(&lis3->pdev->dev.kobj, &lis3lv02d_attribute_group);
}
-int lis3lv02d_remove_fs(void)
+int lis3lv02d_remove_fs(struct lis3lv02d *lis3)
{
- sysfs_remove_group(&lis3_dev.pdev->dev.kobj, &lis3lv02d_attribute_group);
- platform_device_unregister(lis3_dev.pdev);
+ sysfs_remove_group(&lis3->pdev->dev.kobj, &lis3lv02d_attribute_group);
+ platform_device_unregister(lis3->pdev);
return 0;
}
EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs);
@@ -482,13 +454,12 @@ int lis3lv02d_init_device(struct lis3lv02d *dev)
break;
default:
printk(KERN_ERR DRIVER_NAME
- ": unknown sensor type 0x%X\n", lis3_dev.whoami);
+ ": unknown sensor type 0x%X\n", dev->whoami);
return -EINVAL;
}
- mutex_init(&dev->lock);
lis3lv02d_add_fs(dev);
- lis3lv02d_increase_use(dev);
+ lis3lv02d_poweron(dev);
if (lis3lv02d_joystick_enable())
printk(KERN_ERR DRIVER_NAME ": joystick initialization failed\n");
@@ -503,7 +474,6 @@ int lis3lv02d_init_device(struct lis3lv02d *dev)
if (misc_register(&lis3lv02d_misc_device))
printk(KERN_ERR DRIVER_NAME ": misc_register failed\n");
out:
- lis3lv02d_decrease_use(dev);
return 0;
}
EXPORT_SYMBOL_GPL(lis3lv02d_init_device);
diff --git a/drivers/hwmon/lis3lv02d.h b/drivers/hwmon/lis3lv02d.h
index 745ec96..b007d81 100644
--- a/drivers/hwmon/lis3lv02d.h
+++ b/drivers/hwmon/lis3lv02d.h
@@ -171,14 +171,11 @@ struct lis3lv02d {
struct input_dev *idev; /* input device */
struct task_struct *kthread; /* kthread for input */
- struct mutex lock;
struct platform_device *pdev; /* platform device */
atomic_t count; /* interrupt count after last read */
int xcalib; /* calibrated null value for x */
int ycalib; /* calibrated null value for y */
int zcalib; /* calibrated null value for z */
- unsigned char is_on; /* whether the device is on or off */
- unsigned char usage; /* usage counter */
struct axis_conversion ac; /* hw -> logical axis */
u32 irq; /* IRQ number */
@@ -192,6 +189,6 @@ int lis3lv02d_joystick_enable(void);
void lis3lv02d_joystick_disable(void);
void lis3lv02d_poweroff(struct lis3lv02d *lis3);
void lis3lv02d_poweron(struct lis3lv02d *lis3);
-int lis3lv02d_remove_fs(void);
+int lis3lv02d_remove_fs(struct lis3lv02d *lis3);
extern struct lis3lv02d lis3_dev;
--
1.6.2.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/4] lis3: use input_polled_device
2009-05-21 9:27 [PATCH 0/4] lis3: clean up and updates Éric Piel
2009-05-21 9:29 ` [PATCH 1/4] lis3: fix misc device unregistering and printk Éric Piel
2009-05-21 9:30 ` [PATCH 2/4] lis3: remove automatic shutdown of the device Éric Piel
@ 2009-05-21 9:31 ` Éric Piel
2009-05-21 9:33 ` [PATCH 4/4] lis3: Add three new laptop models Éric Piel
3 siblings, 0 replies; 13+ messages in thread
From: Éric Piel @ 2009-05-21 9:31 UTC (permalink / raw)
To: Andrew Morton; +Cc: LKML, Pavel Machek
Now that there is no need to hookup on the open/close of the joystick,
it's possible to use the simplified interface input_polled_device,
instead of creating our own kthread.
Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net>
---
drivers/hwmon/hp_accel.c | 3 --
drivers/hwmon/lis3lv02d.c | 74 ++++++++++++++------------------------------
drivers/hwmon/lis3lv02d.h | 5 ++-
3 files changed, 27 insertions(+), 55 deletions(-)
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c
index 0ebd009..92db68e 100644
--- a/drivers/hwmon/hp_accel.c
+++ b/drivers/hwmon/hp_accel.c
@@ -27,9 +27,6 @@
#include <linux/types.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
-#include <linux/input.h>
-#include <linux/kthread.h>
-#include <linux/semaphore.h>
#include <linux/delay.h>
#include <linux/wait.h>
#include <linux/poll.h>
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c
index df3f586..3661906 100644
--- a/drivers/hwmon/lis3lv02d.c
+++ b/drivers/hwmon/lis3lv02d.c
@@ -27,9 +27,7 @@
#include <linux/types.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
-#include <linux/input.h>
-#include <linux/kthread.h>
-#include <linux/semaphore.h>
+#include <linux/input-polldev.h>
#include <linux/delay.h>
#include <linux/wait.h>
#include <linux/poll.h>
@@ -270,43 +268,16 @@ static struct miscdevice lis3lv02d_misc_device = {
.fops = &lis3lv02d_misc_fops,
};
-/**
- * lis3lv02d_joystick_kthread - Kthread polling function
- * @data: unused - here to conform to threadfn prototype
- */
-static int lis3lv02d_joystick_kthread(void *data)
+static void lis3lv02d_joystick_poll(struct input_polled_dev *pidev)
{
int x, y, z;
- while (!kthread_should_stop()) {
- lis3lv02d_get_xyz(&lis3_dev, &x, &y, &z);
- input_report_abs(lis3_dev.idev, ABS_X, x - lis3_dev.xcalib);
- input_report_abs(lis3_dev.idev, ABS_Y, y - lis3_dev.ycalib);
- input_report_abs(lis3_dev.idev, ABS_Z, z - lis3_dev.zcalib);
-
- input_sync(lis3_dev.idev);
-
- try_to_freeze();
- msleep_interruptible(MDPS_POLL_INTERVAL);
- }
-
- return 0;
-}
-
-static int lis3lv02d_joystick_open(struct input_dev *input)
-{
- lis3_dev.kthread = kthread_run(lis3lv02d_joystick_kthread, NULL, "klis3lv02d");
- if (IS_ERR(lis3_dev.kthread)) {
- return PTR_ERR(lis3_dev.kthread);
- }
-
- return 0;
+ lis3lv02d_get_xyz(&lis3_dev, &x, &y, &z);
+ input_report_abs(pidev->input, ABS_X, x - lis3_dev.xcalib);
+ input_report_abs(pidev->input, ABS_Y, y - lis3_dev.ycalib);
+ input_report_abs(pidev->input, ABS_Z, z - lis3_dev.zcalib);
}
-static void lis3lv02d_joystick_close(struct input_dev *input)
-{
- kthread_stop(lis3_dev.kthread);
-}
static inline void lis3lv02d_calibrate_joystick(void)
{
@@ -316,33 +287,36 @@ static inline void lis3lv02d_calibrate_joystick(void)
int lis3lv02d_joystick_enable(void)
{
+ struct input_dev *input_dev;
int err;
if (lis3_dev.idev)
return -EINVAL;
- lis3_dev.idev = input_allocate_device();
+ lis3_dev.idev = input_allocate_polled_device();
if (!lis3_dev.idev)
return -ENOMEM;
+ lis3_dev.idev->poll = lis3lv02d_joystick_poll;
+ lis3_dev.idev->poll_interval = MDPS_POLL_INTERVAL;
+ input_dev = lis3_dev.idev->input;
+
lis3lv02d_calibrate_joystick();
- lis3_dev.idev->name = "ST LIS3LV02DL Accelerometer";
- lis3_dev.idev->phys = DRIVER_NAME "/input0";
- lis3_dev.idev->id.bustype = BUS_HOST;
- lis3_dev.idev->id.vendor = 0;
- lis3_dev.idev->dev.parent = &lis3_dev.pdev->dev;
- lis3_dev.idev->open = lis3lv02d_joystick_open;
- lis3_dev.idev->close = lis3lv02d_joystick_close;
+ input_dev->name = "ST LIS3LV02DL Accelerometer";
+ input_dev->phys = DRIVER_NAME "/input0";
+ input_dev->id.bustype = BUS_HOST;
+ input_dev->id.vendor = 0;
+ input_dev->dev.parent = &lis3_dev.pdev->dev;
- set_bit(EV_ABS, lis3_dev.idev->evbit);
- input_set_abs_params(lis3_dev.idev, ABS_X, -lis3_dev.mdps_max_val, lis3_dev.mdps_max_val, 3, 3);
- input_set_abs_params(lis3_dev.idev, ABS_Y, -lis3_dev.mdps_max_val, lis3_dev.mdps_max_val, 3, 3);
- input_set_abs_params(lis3_dev.idev, ABS_Z, -lis3_dev.mdps_max_val, lis3_dev.mdps_max_val, 3, 3);
+ set_bit(EV_ABS, input_dev->evbit);
+ input_set_abs_params(input_dev, ABS_X, -lis3_dev.mdps_max_val, lis3_dev.mdps_max_val, 3, 3);
+ input_set_abs_params(input_dev, ABS_Y, -lis3_dev.mdps_max_val, lis3_dev.mdps_max_val, 3, 3);
+ input_set_abs_params(input_dev, ABS_Z, -lis3_dev.mdps_max_val, lis3_dev.mdps_max_val, 3, 3);
- err = input_register_device(lis3_dev.idev);
+ err = input_register_polled_device(lis3_dev.idev);
if (err) {
- input_free_device(lis3_dev.idev);
+ input_free_polled_device(lis3_dev.idev);
lis3_dev.idev = NULL;
}
@@ -357,7 +331,7 @@ void lis3lv02d_joystick_disable(void)
if (lis3_dev.irq)
misc_deregister(&lis3lv02d_misc_device);
- input_unregister_device(lis3_dev.idev);
+ input_unregister_polled_device(lis3_dev.idev);
lis3_dev.idev = NULL;
}
EXPORT_SYMBOL_GPL(lis3lv02d_joystick_disable);
diff --git a/drivers/hwmon/lis3lv02d.h b/drivers/hwmon/lis3lv02d.h
index b007d81..5a5a196 100644
--- a/drivers/hwmon/lis3lv02d.h
+++ b/drivers/hwmon/lis3lv02d.h
@@ -18,6 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <linux/platform_device.h>
+#include <linux/input-polldev.h>
/*
* The actual chip is STMicroelectronics LIS3LV02DL or LIS3LV02DQ that seems to
@@ -169,8 +171,7 @@ struct lis3lv02d {
s16 (*read_data) (struct lis3lv02d *lis3, int reg);
int mdps_max_val;
- struct input_dev *idev; /* input device */
- struct task_struct *kthread; /* kthread for input */
+ struct input_polled_dev *idev; /* input device */
struct platform_device *pdev; /* platform device */
atomic_t count; /* interrupt count after last read */
int xcalib; /* calibrated null value for x */
--
1.6.2.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/4] lis3: Add three new laptop models
2009-05-21 9:27 [PATCH 0/4] lis3: clean up and updates Éric Piel
` (2 preceding siblings ...)
2009-05-21 9:31 ` [PATCH 3/4] lis3: use input_polled_device Éric Piel
@ 2009-05-21 9:33 ` Éric Piel
2009-05-21 10:49 ` Pavel Machek
3 siblings, 1 reply; 13+ messages in thread
From: Éric Piel @ 2009-05-21 9:33 UTC (permalink / raw)
To: Andrew Morton
Cc: LKML, Pavel Machek, Isaac702, Christian Weidle, Pavel Herrmann
Separate the 6710 and 6715, and set the right axis information for the
6715.
Reported-by: Isaac702 <isaac702@gmail.com>
Add the 6930.
Reported-by: Christian Weidle <slateroni@gmail.com>
Add the 2710.
Reported-by: Pavel Herrmann <morpheus.ibis@gmail.com>
Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net>
---
drivers/hwmon/hp_accel.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c
index 92db68e..8dcb152 100644
--- a/drivers/hwmon/hp_accel.c
+++ b/drivers/hwmon/hp_accel.c
@@ -158,9 +158,11 @@ static struct axis_conversion lis3lv02d_axis_normal = {1, 2, 3};
static struct axis_conversion lis3lv02d_axis_y_inverted = {1, -2, 3};
static struct axis_conversion lis3lv02d_axis_x_inverted = {-1, 2, 3};
static struct axis_conversion lis3lv02d_axis_z_inverted = {1, 2, -3};
+static struct axis_conversion lis3lv02d_axis_xy_swap = {2, 1, 3};
static struct axis_conversion lis3lv02d_axis_xy_rotated_left = {-2, 1, 3};
static struct axis_conversion lis3lv02d_axis_xy_rotated_left_usd = {-2, 1, -3};
static struct axis_conversion lis3lv02d_axis_xy_swap_inverted = {-2, -1, 3};
+static struct axis_conversion lis3lv02d_axis_xy_swap_all_inverted = {-2, -1, -3};
static struct axis_conversion lis3lv02d_axis_xy_rotated_right = {2, -1, 3};
static struct axis_conversion lis3lv02d_axis_xy_swap_yz_inverted = {2, -1, -3};
@@ -191,13 +193,16 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
AXIS_DMI_MATCH("NX9420", "HP Compaq nx9420", x_inverted),
AXIS_DMI_MATCH("NW9440", "HP Compaq nw9440", x_inverted),
AXIS_DMI_MATCH("NC2510", "HP Compaq 2510", y_inverted),
+ AXIS_DMI_MATCH("NC2710", "HP Compaq 2710", xy_swap),
AXIS_DMI_MATCH("NC8510", "HP Compaq 8510", xy_swap_inverted),
AXIS_DMI_MATCH("HP2133", "HP 2133", xy_rotated_left),
AXIS_DMI_MATCH("HP2140", "HP 2140", xy_swap_inverted),
AXIS_DMI_MATCH("NC653x", "HP Compaq 653", xy_rotated_left_usd),
AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd),
AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right),
- AXIS_DMI_MATCH("NC671xx", "HP Compaq 671", xy_swap_yz_inverted),
+ AXIS_DMI_MATCH("NC6710x", "HP Compaq 6710", xy_swap_yz_inverted),
+ AXIS_DMI_MATCH("NC6715x", "HP Compaq 6715", xy_swap_all_inverted),
+ AXIS_DMI_MATCH("NC693xx", "HP EliteBook 693", xy_rotated_right),
/* Intel-based HP Pavilion dv5 */
AXIS_DMI_MATCH2("HPDV5_I",
PRODUCT_NAME, "HP Pavilion dv5",
@@ -213,7 +218,6 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
{ NULL, }
/* Laptop models without axis info (yet):
* "NC6910" "HP Compaq 6910"
- * HP Compaq 8710x Notebook PC / Mobile Workstation
* "NC2400" "HP Compaq nc2400"
* "NX74x0" "HP Compaq nx74"
* "NX6325" "HP Compaq nx6325"
--
1.6.2.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/4] lis3: fix misc device unregistering and printk
2009-05-21 9:29 ` [PATCH 1/4] lis3: fix misc device unregistering and printk Éric Piel
@ 2009-05-21 10:48 ` Pavel Machek
0 siblings, 0 replies; 13+ messages in thread
From: Pavel Machek @ 2009-05-21 10:48 UTC (permalink / raw)
To: Éric Piel; +Cc: Andrew Morton, LKML
On Thu 2009-05-21 11:29:46, Éric Piel wrote:
>
> Can only unregister the misc device if it was registered before. Also
> remove debugging messages, which in addition were not properly formated.
>
> Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net>
Acked-by: Pavel Machek <pavel@ucw.cz>
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/4] lis3: Add three new laptop models
2009-05-21 9:33 ` [PATCH 4/4] lis3: Add three new laptop models Éric Piel
@ 2009-05-21 10:49 ` Pavel Machek
2009-05-21 11:07 ` Éric Piel
0 siblings, 1 reply; 13+ messages in thread
From: Pavel Machek @ 2009-05-21 10:49 UTC (permalink / raw)
To: Éric Piel
Cc: Andrew Morton, LKML, Isaac702, Christian Weidle, Pavel Herrmann
On Thu 2009-05-21 11:33:51, Éric Piel wrote:
> Separate the 6710 and 6715, and set the right axis information for the
> 6715.
> Reported-by: Isaac702 <isaac702@gmail.com>
>
> Add the 6930.
> Reported-by: Christian Weidle <slateroni@gmail.com>
>
> Add the 2710.
> Reported-by: Pavel Herrmann <morpheus.ibis@gmail.com>
>
> Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net>
Acked-by: Pavel Machek <pavel@ucw.cz>
Actually, I guess this should go before 2/4 and 3/4, as it is really
trivial.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/4] lis3: Add three new laptop models
2009-05-21 10:49 ` Pavel Machek
@ 2009-05-21 11:07 ` Éric Piel
2009-05-21 11:36 ` Isaac702
[not found] ` <36a8c4f10905210424i65f5efadjdd6f13dea77cb2e6@mail.gmail.com>
0 siblings, 2 replies; 13+ messages in thread
From: Éric Piel @ 2009-05-21 11:07 UTC (permalink / raw)
To: Pavel Machek
Cc: Andrew Morton, LKML, Isaac702, Christian Weidle, Pavel Herrmann
Op 21-05-09 12:49, Pavel Machek schreef:
> On Thu 2009-05-21 11:33:51, Éric Piel wrote:
>> Separate the 6710 and 6715, and set the right axis information for the
>> 6715.
>> Reported-by: Isaac702 <isaac702@gmail.com>
>>
>> Add the 6930.
>> Reported-by: Christian Weidle <slateroni@gmail.com>
>>
>> Add the 2710.
>> Reported-by: Pavel Herrmann <morpheus.ibis@gmail.com>
>>
>> Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net>
>
> Acked-by: Pavel Machek <pavel@ucw.cz>
>
> Actually, I guess this should go before 2/4 and 3/4, as it is really
> trivial.
Indeed. Actually, it probably also applies cleanly on Linus' tree. So it
could be queued for 2.6.30... but I guess it's getting too late.
Eric
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/4] lis3: remove automatic shutdown of the device
2009-05-21 9:30 ` [PATCH 2/4] lis3: remove automatic shutdown of the device Éric Piel
@ 2009-05-21 11:36 ` Pavel Machek
2009-05-21 11:55 ` Éric Piel
0 siblings, 1 reply; 13+ messages in thread
From: Pavel Machek @ 2009-05-21 11:36 UTC (permalink / raw)
To: Éric Piel; +Cc: Andrew Morton, LKML
Hi!
> After measurement on my laptop, it seems that turning off the device
> does not bring any energy saving (within 0.1W precision). So let's keep
> the device always on. It simplifies the code, and it avoids the problem
> of reading a wrong value sometimes just after turning the device on.
Well, 0.1W is still quite much for cellphone etc... but as we do not
have any such small users in the tree, I guess this can go in...
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/4] lis3: Add three new laptop models
2009-05-21 11:07 ` Éric Piel
@ 2009-05-21 11:36 ` Isaac702
[not found] ` <36a8c4f10905210424i65f5efadjdd6f13dea77cb2e6@mail.gmail.com>
1 sibling, 0 replies; 13+ messages in thread
From: Isaac702 @ 2009-05-21 11:36 UTC (permalink / raw)
To: linux-kernel
I apologize however when I reported that I was still using the 6710
settings. When the normal axis settings were used the results showed
the 6715 should be using "y_inverted" to behave normally.
I'm sorry for reporting this incorrectly in the beginning.
On Thu, May 21, 2009 at 12:07, Éric Piel <eric.piel@tremplin-utc.net> wrote:
> Op 21-05-09 12:49, Pavel Machek schreef:
>> On Thu 2009-05-21 11:33:51, Éric Piel wrote:
>>> Separate the 6710 and 6715, and set the right axis information for the
>>> 6715.
>>> Reported-by: Isaac702 <isaac702@gmail.com>
>>>
>>> Add the 6930.
>>> Reported-by: Christian Weidle <slateroni@gmail.com>
>>>
>>> Add the 2710.
>>> Reported-by: Pavel Herrmann <morpheus.ibis@gmail.com>
>>>
>>> Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net>
>>
>> Acked-by: Pavel Machek <pavel@ucw.cz>
>>
>> Actually, I guess this should go before 2/4 and 3/4, as it is really
>> trivial.
> Indeed. Actually, it probably also applies cleanly on Linus' tree. So it
> could be queued for 2.6.30... but I guess it's getting too late.
>
> Eric
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/4] lis3: Add three new laptop models
[not found] ` <36a8c4f10905210424i65f5efadjdd6f13dea77cb2e6@mail.gmail.com>
@ 2009-05-21 11:38 ` Éric Piel
0 siblings, 0 replies; 13+ messages in thread
From: Éric Piel @ 2009-05-21 11:38 UTC (permalink / raw)
To: Isaac702, Andrew Morton
Cc: Pavel Machek, LKML, Christian Weidle, Pavel Herrmann
Op 21-05-09 13:24, Isaac702 schreef:
> I apologize however when I reported that I was still using the 6710
> settings. When the normal axis settings were used the results showed the
> 6715 should be using "y_inverted" to behave normally.
> I'm sorry for reporting this incorrectly in the beginning.
>
Thank you for noticing this so quickly. Here is an updated patch.
Eric
==
Separate the 6710 and 6715, and set the right axis information for the
6715.
Reported-by: Isaac702 <isaac702@gmail.com>
Add the 6930.
Reported-by: Christian Weidle <slateroni@gmail.com>
Add the 2710.
Reported-by: Pavel Herrmann <morpheus.ibis@gmail.com>
Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net>
---
drivers/hwmon/hp_accel.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c
index 92db68e..6679854 100644
--- a/drivers/hwmon/hp_accel.c
+++ b/drivers/hwmon/hp_accel.c
@@ -158,6 +158,7 @@ static struct axis_conversion lis3lv02d_axis_normal = {1, 2, 3};
static struct axis_conversion lis3lv02d_axis_y_inverted = {1, -2, 3};
static struct axis_conversion lis3lv02d_axis_x_inverted = {-1, 2, 3};
static struct axis_conversion lis3lv02d_axis_z_inverted = {1, 2, -3};
+static struct axis_conversion lis3lv02d_axis_xy_swap = {2, 1, 3};
static struct axis_conversion lis3lv02d_axis_xy_rotated_left = {-2, 1, 3};
static struct axis_conversion lis3lv02d_axis_xy_rotated_left_usd = {-2, 1, -3};
static struct axis_conversion lis3lv02d_axis_xy_swap_inverted = {-2, -1, 3};
@@ -191,13 +192,16 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
AXIS_DMI_MATCH("NX9420", "HP Compaq nx9420", x_inverted),
AXIS_DMI_MATCH("NW9440", "HP Compaq nw9440", x_inverted),
AXIS_DMI_MATCH("NC2510", "HP Compaq 2510", y_inverted),
+ AXIS_DMI_MATCH("NC2710", "HP Compaq 2710", xy_swap),
AXIS_DMI_MATCH("NC8510", "HP Compaq 8510", xy_swap_inverted),
AXIS_DMI_MATCH("HP2133", "HP 2133", xy_rotated_left),
AXIS_DMI_MATCH("HP2140", "HP 2140", xy_swap_inverted),
AXIS_DMI_MATCH("NC653x", "HP Compaq 653", xy_rotated_left_usd),
AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd),
AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right),
- AXIS_DMI_MATCH("NC671xx", "HP Compaq 671", xy_swap_yz_inverted),
+ AXIS_DMI_MATCH("NC6710x", "HP Compaq 6710", xy_swap_yz_inverted),
+ AXIS_DMI_MATCH("NC6715x", "HP Compaq 6715", y_inverted),
+ AXIS_DMI_MATCH("NC693xx", "HP EliteBook 693", xy_rotated_right),
/* Intel-based HP Pavilion dv5 */
AXIS_DMI_MATCH2("HPDV5_I",
PRODUCT_NAME, "HP Pavilion dv5",
@@ -213,7 +217,6 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
{ NULL, }
/* Laptop models without axis info (yet):
* "NC6910" "HP Compaq 6910"
- * HP Compaq 8710x Notebook PC / Mobile Workstation
* "NC2400" "HP Compaq nc2400"
* "NX74x0" "HP Compaq nx74"
* "NX6325" "HP Compaq nx6325"
--
1.6.2.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 2/4] lis3: remove automatic shutdown of the device
2009-05-21 11:36 ` Pavel Machek
@ 2009-05-21 11:55 ` Éric Piel
2009-05-21 12:08 ` Pavel Machek
0 siblings, 1 reply; 13+ messages in thread
From: Éric Piel @ 2009-05-21 11:55 UTC (permalink / raw)
To: Pavel Machek; +Cc: Andrew Morton, LKML
Op 21-05-09 13:36, Pavel Machek schreef:
> Hi!
>
>> After measurement on my laptop, it seems that turning off the device
>> does not bring any energy saving (within 0.1W precision). So let's keep
>> the device always on. It simplifies the code, and it avoids the problem
>> of reading a wrong value sometimes just after turning the device on.
>
> Well, 0.1W is still quite much for cellphone etc... but as we do not
> have any such small users in the tree, I guess this can go in...
>
Yes. BTW, what I meant is that the power consumption on my laptop can be
read with 0.1W precision. Turning on and off the device showed 0.0W
variations. The device should using even much less than 0.1W. According
to the documentation, it's about 2.2mW when on and 3µW when off.
Eric
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/4] lis3: remove automatic shutdown of the device
2009-05-21 11:55 ` Éric Piel
@ 2009-05-21 12:08 ` Pavel Machek
0 siblings, 0 replies; 13+ messages in thread
From: Pavel Machek @ 2009-05-21 12:08 UTC (permalink / raw)
To: Éric Piel; +Cc: Andrew Morton, LKML
Hi!
> >> After measurement on my laptop, it seems that turning off the device
> >> does not bring any energy saving (within 0.1W precision). So let's keep
> >> the device always on. It simplifies the code, and it avoids the problem
> >> of reading a wrong value sometimes just after turning the device on.
> >
> > Well, 0.1W is still quite much for cellphone etc... but as we do not
> > have any such small users in the tree, I guess this can go in...
> >
> Yes. BTW, what I meant is that the power consumption on my laptop can be
> read with 0.1W precision. Turning on and off the device showed 0.0W
> variations. The device should using even much less than 0.1W. According
> to the documentation, it's about 2.2mW when on and 3?W when off.
2mW would be still significant on a cellphone, draining battery in cca
20 days (which is about as bad as GSM radio), but...
If cellphone user comes, he can simply recreate powersaving code...
Feel free to add
Signed-off-by: Pavel Machek <pavel@ucw.cz>
to 2,3/4. ... And btw 4/4 probably could be pushed to 2.6.30. It is
trivial enough... and "new hw" support is okay even late in cycle.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2009-05-21 12:08 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-21 9:27 [PATCH 0/4] lis3: clean up and updates Éric Piel
2009-05-21 9:29 ` [PATCH 1/4] lis3: fix misc device unregistering and printk Éric Piel
2009-05-21 10:48 ` Pavel Machek
2009-05-21 9:30 ` [PATCH 2/4] lis3: remove automatic shutdown of the device Éric Piel
2009-05-21 11:36 ` Pavel Machek
2009-05-21 11:55 ` Éric Piel
2009-05-21 12:08 ` Pavel Machek
2009-05-21 9:31 ` [PATCH 3/4] lis3: use input_polled_device Éric Piel
2009-05-21 9:33 ` [PATCH 4/4] lis3: Add three new laptop models Éric Piel
2009-05-21 10:49 ` Pavel Machek
2009-05-21 11:07 ` Éric Piel
2009-05-21 11:36 ` Isaac702
[not found] ` <36a8c4f10905210424i65f5efadjdd6f13dea77cb2e6@mail.gmail.com>
2009-05-21 11:38 ` Éric Piel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox