hwmon: (lis3) add axes module parameter for custom axis-mapping
The axis-mapping of lis3dev device on many (rather most) HP machines
doesn't follow the standard. When each new model appears, users need to
adjust again. Testing this requires the rebuild of kernel, thus it's not
trivial for end-users.
This patch adds a module parameter "axes" to allow a custom axis-mapping
without patching and recompiling the kernel driver. User can pass the
parameter such as axes=3,2,1. Also it can be changed via sysfs.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Eric Piel <eric.piel@tremplin-utc.net>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
diff --git a/drivers/hwmon/lis3lv02d.h b/drivers/hwmon/lis3lv02d.h
index 62c6652..eb5db58 100644
--- a/drivers/hwmon/lis3lv02d.h
+++ b/drivers/hwmon/lis3lv02d.h
@@ -223,10 +223,11 @@
CLICK_IA = 0x40,
};
-struct axis_conversion {
- s8 x;
- s8 y;
- s8 z;
+union axis_conversion {
+ struct {
+ int x, y, z;
+ };
+ int as_array[3];
};
struct lis3lv02d {
@@ -249,7 +250,7 @@
struct input_polled_dev *idev; /* input device */
struct platform_device *pdev; /* platform device */
atomic_t count; /* interrupt count after last read */
- struct axis_conversion ac; /* hw -> logical axis */
+ union axis_conversion ac; /* hw -> logical axis */
int mapped_btns[3];
u32 irq; /* IRQ number */