23 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25 #include <linux/kernel.h>
28 #include <linux/module.h>
29 #include <linux/types.h>
33 #include <linux/wait.h>
34 #include <linux/poll.h>
40 #include "../../misc/lis3lv02d/lis3lv02d.h"
42 #define DRIVER_NAME "hp_accel"
43 #define ACPI_MDPS_CLASS "accelerometer"
65 static inline void delayed_sysfs_set(
struct led_classdev *led_cdev,
114 unsigned long long lret;
135 unsigned long long ret;
150 static int lis3lv02d_dmi_matched(
const struct dmi_system_id *dmi)
160 #define DEFINE_CONV(name, x, y, z) \
161 static union axis_conversion lis3lv02d_axis_##name = \
162 { .as_array = { x, y, z } }
174 #define AXIS_DMI_MATCH(_ident, _name, _axis) { \
176 .callback = lis3lv02d_dmi_matched, \
178 DMI_MATCH(DMI_PRODUCT_NAME, _name) \
180 .driver_data = &lis3lv02d_axis_##_axis \
183 #define AXIS_DMI_MATCH2(_ident, _class1, _name1, \
187 .callback = lis3lv02d_dmi_matched, \
189 DMI_MATCH(DMI_##_class1, _name1), \
190 DMI_MATCH(DMI_##_class2, _name2), \
192 .driver_data = &lis3lv02d_axis_##_axis \
206 AXIS_DMI_MATCH(
"NC6730b",
"HP Compaq 6730b", xy_rotated_left_usd),
217 PRODUCT_NAME,
"HP Pavilion dv5",
222 PRODUCT_NAME,
"HP Pavilion dv5",
252 unsigned long long ret;
257 in_obj[0].integer.value = !!
value;
264 .name =
"hp::hddprotect",
265 .default_trigger =
"none",
266 .brightness_set = delayed_sysfs_set,
269 .set_brightness = hpled_set,
286 static void lis3lv02d_enum_resources(
struct acpi_device *
device)
291 lis3lv02d_get_resource, &
lis3_dev.irq);
296 static int lis3lv02d_add(
struct acpi_device *device)
312 lis3lv02d_enum_resources(device);
316 pr_info(
"Using custom axes %d,%d,%d\n",
319 pr_info(
"laptop model unknown, using default axes configuration\n");
320 lis3_dev.ac = lis3lv02d_axis_normal;
340 static int lis3lv02d_remove(
struct acpi_device *device,
int type)
355 #ifdef CONFIG_PM_SLEEP
356 static int lis3lv02d_suspend(
struct device *
dev)
363 static int lis3lv02d_resume(
struct device *
dev)
369 #define HP_ACCEL_PM (&hp_accel_pm)
371 #define HP_ACCEL_PM NULL
375 static struct acpi_driver lis3lv02d_driver = {
378 .ids = lis3lv02d_device_ids,
380 .add = lis3lv02d_add,
381 .remove = lis3lv02d_remove,
387 MODULE_DESCRIPTION(
"Glue between LIS3LV02Dx and HP ACPI BIOS and support for disk protection LED.");