diff options
Diffstat (limited to 'drivers/hwmon/hp_accel.c')
| -rw-r--r-- | drivers/hwmon/hp_accel.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c index 36e957532230..a56a78412fcb 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, \ |
| @@ -222,7 +225,7 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = { | |||
| 222 | AXIS_DMI_MATCH("HPB452x", "HP ProBook 452", y_inverted), | 225 | AXIS_DMI_MATCH("HPB452x", "HP ProBook 452", y_inverted), |
| 223 | AXIS_DMI_MATCH("HPB522x", "HP ProBook 522", xy_swap), | 226 | AXIS_DMI_MATCH("HPB522x", "HP ProBook 522", xy_swap), |
| 224 | AXIS_DMI_MATCH("HPB532x", "HP ProBook 532", y_inverted), | 227 | AXIS_DMI_MATCH("HPB532x", "HP ProBook 532", y_inverted), |
| 225 | AXIS_DMI_MATCH("Mini5102", "HP Mini 5102", xy_rotated_left_usd), | 228 | AXIS_DMI_MATCH("Mini510x", "HP Mini 510", xy_rotated_left_usd), |
| 226 | { NULL, } | 229 | { NULL, } |
| 227 | /* Laptop models without axis info (yet): | 230 | /* Laptop models without axis info (yet): |
| 228 | * "NC6910" "HP Compaq 6910" | 231 | * "NC6910" "HP Compaq 6910" |
| @@ -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; |
