diff options
Diffstat (limited to 'drivers/hwmon/hp_accel.c')
-rw-r--r-- | drivers/hwmon/hp_accel.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c index c5cd3db78c9..a56a78412fc 100644 --- a/drivers/hwmon/hp_accel.c +++ b/drivers/hwmon/hp_accel.c | |||
@@ -146,7 +146,7 @@ int lis3lv02d_acpi_write(struct lis3lv02d *lis3, int reg, u8 val) | |||
146 | 146 | ||
147 | static int lis3lv02d_dmi_matched(const struct dmi_system_id *dmi) | 147 | static int lis3lv02d_dmi_matched(const struct dmi_system_id *dmi) |
148 | { | 148 | { |
149 | lis3_dev.ac = *((struct axis_conversion *)dmi->driver_data); | 149 | lis3_dev.ac = *((union axis_conversion *)dmi->driver_data); |
150 | printk(KERN_INFO DRIVER_NAME ": hardware type %s found.\n", dmi->ident); | 150 | printk(KERN_INFO DRIVER_NAME ": hardware type %s found.\n", dmi->ident); |
151 | 151 | ||
152 | return 1; | 152 | return 1; |
@@ -154,16 +154,19 @@ static int lis3lv02d_dmi_matched(const struct dmi_system_id *dmi) | |||
154 | 154 | ||
155 | /* Represents, for each axis seen by userspace, the corresponding hw axis (+1). | 155 | /* Represents, for each axis seen by userspace, the corresponding hw axis (+1). |
156 | * If the value is negative, the opposite of the hw value is used. */ | 156 | * If the value is negative, the opposite of the hw value is used. */ |
157 | static struct axis_conversion lis3lv02d_axis_normal = {1, 2, 3}; | 157 | #define DEFINE_CONV(name, x, y, z) \ |
158 | static struct axis_conversion lis3lv02d_axis_y_inverted = {1, -2, 3}; | 158 | static union axis_conversion lis3lv02d_axis_##name = \ |
159 | static struct axis_conversion lis3lv02d_axis_x_inverted = {-1, 2, 3}; | 159 | { .as_array = { x, y, z } } |
160 | static struct axis_conversion lis3lv02d_axis_z_inverted = {1, 2, -3}; | 160 | DEFINE_CONV(normal, 1, 2, 3); |
161 | static struct axis_conversion lis3lv02d_axis_xy_swap = {2, 1, 3}; | 161 | DEFINE_CONV(y_inverted, 1, -2, 3); |
162 | static struct axis_conversion lis3lv02d_axis_xy_rotated_left = {-2, 1, 3}; | 162 | DEFINE_CONV(x_inverted, -1, 2, 3); |
163 | static struct axis_conversion lis3lv02d_axis_xy_rotated_left_usd = {-2, 1, -3}; | 163 | DEFINE_CONV(z_inverted, 1, 2, -3); |
164 | static struct axis_conversion lis3lv02d_axis_xy_swap_inverted = {-2, -1, 3}; | 164 | DEFINE_CONV(xy_swap, 2, 1, 3); |
165 | static struct axis_conversion lis3lv02d_axis_xy_rotated_right = {2, -1, 3}; | 165 | DEFINE_CONV(xy_rotated_left, -2, 1, 3); |
166 | static struct axis_conversion lis3lv02d_axis_xy_swap_yz_inverted = {2, -1, -3}; | 166 | DEFINE_CONV(xy_rotated_left_usd, -2, 1, -3); |
167 | DEFINE_CONV(xy_swap_inverted, -2, -1, 3); | ||
168 | DEFINE_CONV(xy_rotated_right, 2, -1, 3); | ||
169 | DEFINE_CONV(xy_swap_yz_inverted, 2, -1, -3); | ||
167 | 170 | ||
168 | #define AXIS_DMI_MATCH(_ident, _name, _axis) { \ | 171 | #define AXIS_DMI_MATCH(_ident, _name, _axis) { \ |
169 | .ident = _ident, \ | 172 | .ident = _ident, \ |
@@ -299,7 +302,10 @@ static int lis3lv02d_add(struct acpi_device *device) | |||
299 | lis3lv02d_enum_resources(device); | 302 | lis3lv02d_enum_resources(device); |
300 | 303 | ||
301 | /* If possible use a "standard" axes order */ | 304 | /* If possible use a "standard" axes order */ |
302 | if (dmi_check_system(lis3lv02d_dmi_ids) == 0) { | 305 | if (lis3_dev.ac.x && lis3_dev.ac.y && lis3_dev.ac.z) { |
306 | printk(KERN_INFO DRIVER_NAME ": Using custom axes %d,%d,%d\n", | ||
307 | lis3_dev.ac.x, lis3_dev.ac.y, lis3_dev.ac.z); | ||
308 | } else if (dmi_check_system(lis3lv02d_dmi_ids) == 0) { | ||
303 | printk(KERN_INFO DRIVER_NAME ": laptop model unknown, " | 309 | printk(KERN_INFO DRIVER_NAME ": laptop model unknown, " |
304 | "using default axes configuration\n"); | 310 | "using default axes configuration\n"); |
305 | lis3_dev.ac = lis3lv02d_axis_normal; | 311 | lis3_dev.ac = lis3lv02d_axis_normal; |