aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lis3lv02d.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-10-01 17:14:25 -0400
committerGuenter Roeck <guenter.roeck@ericsson.com>2010-10-25 17:11:20 -0400
commit2ee321440e3a594dcdd9981e68e5e302447047a2 (patch)
treec2dde23d160339ff713f9fd12f7922cca0c8c6d3 /drivers/hwmon/lis3lv02d.c
parent37394050b5be0fe87f96ed8848f11c3c2cd4d556 (diff)
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>
Diffstat (limited to 'drivers/hwmon/lis3lv02d.c')
-rw-r--r--drivers/hwmon/lis3lv02d.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c
index ef7510d83603..25f385010953 100644
--- a/drivers/hwmon/lis3lv02d.c
+++ b/drivers/hwmon/lis3lv02d.c
@@ -75,6 +75,30 @@ struct lis3lv02d lis3_dev = {
75 75
76EXPORT_SYMBOL_GPL(lis3_dev); 76EXPORT_SYMBOL_GPL(lis3_dev);
77 77
78/* just like param_set_int() but does sanity-check so that it won't point
79 * over the axis array size
80 */
81static int param_set_axis(const char *val, const struct kernel_param *kp)
82{
83 int ret = param_set_int(val, kp);
84 if (!ret) {
85 int val = *(int *)kp->arg;
86 if (val < 0)
87 val = -val;
88 if (!val || val > 3)
89 return -EINVAL;
90 }
91 return ret;
92}
93
94static struct kernel_param_ops param_ops_axis = {
95 .set = param_set_axis,
96 .get = param_get_int,
97};
98
99module_param_array_named(axes, lis3_dev.ac.as_array, axis, NULL, 0644);
100MODULE_PARM_DESC(axes, "Axis-mapping for x,y,z directions");
101
78static s16 lis3lv02d_read_8(struct lis3lv02d *lis3, int reg) 102static s16 lis3lv02d_read_8(struct lis3lv02d *lis3, int reg)
79{ 103{
80 s8 lo; 104 s8 lo;