* [PATCH 0/2] Dell Latitude freefall driver (ACPI SMO8800/SMO8810)
@ 2014-05-03 10:47 Pali Rohár
2014-05-03 10:47 ` [PATCH 1/2] platform: x86: dell-smo8800: " Pali Rohár
2014-05-03 10:47 ` [PATCH 2/2] Documentation: Rename hpfall.c => freefall.c, fixes for Dell Pali Rohár
0 siblings, 2 replies; 20+ messages in thread
From: Pali Rohár @ 2014-05-03 10:47 UTC (permalink / raw)
To: Matthew Garrett, Randy Dunlap
Cc: linux-kernel, platform-driver-x86, linux-doc, Sonal Santan,
Pali Rohár
This patch series add dell-smo8800.ko driver and update program hpfall.c
Pali Rohár (2):
platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI
SMO8800/SMO8810)
Documentation: Rename hpfall.c => freefall.c, fixes for Dell
Documentation/laptops/00-INDEX | 4 +-
Documentation/laptops/freefall.c | 171 +++++++++++++++++++++++
Documentation/laptops/hpfall.c | 146 --------------------
drivers/platform/x86/Kconfig | 10 ++
drivers/platform/x86/Makefile | 1 +
drivers/platform/x86/dell-smo8800.c | 253 +++++++++++++++++++++++++++++++++++
6 files changed, 437 insertions(+), 148 deletions(-)
create mode 100644 Documentation/laptops/freefall.c
delete mode 100644 Documentation/laptops/hpfall.c
create mode 100644 drivers/platform/x86/dell-smo8800.c
--
1.7.9.5
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 1/2] platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI SMO8800/SMO8810)
2014-05-03 10:47 [PATCH 0/2] Dell Latitude freefall driver (ACPI SMO8800/SMO8810) Pali Rohár
@ 2014-05-03 10:47 ` Pali Rohár
2014-05-07 16:29 ` One Thousand Gnomes
` (2 more replies)
2014-05-03 10:47 ` [PATCH 2/2] Documentation: Rename hpfall.c => freefall.c, fixes for Dell Pali Rohár
1 sibling, 3 replies; 20+ messages in thread
From: Pali Rohár @ 2014-05-03 10:47 UTC (permalink / raw)
To: Matthew Garrett, Randy Dunlap
Cc: linux-kernel, platform-driver-x86, linux-doc, Sonal Santan,
Pali Rohár
This acpi driver provide supports for freefall sensors SMO8800/SMO8810 which
can be found on Dell Latitude laptops. Driver register /dev/freefall misc
device which has same interface as driver hp_accel freefall driver. So any
existing applications for HP freefall sensor /dev/freefall will work for with
this new driver for Dell Latitude laptops too.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Cc: Sonal Santan <sonal.santan@gmail.com>
---
drivers/platform/x86/Kconfig | 10 ++
drivers/platform/x86/Makefile | 1 +
drivers/platform/x86/dell-smo8800.c | 253 +++++++++++++++++++++++++++++++++++
3 files changed, 264 insertions(+)
create mode 100644 drivers/platform/x86/dell-smo8800.c
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 27df2c5..f0c2e45 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -127,6 +127,16 @@ config DELL_WMI_AIO
To compile this driver as a module, choose M here: the module will
be called dell-wmi-aio.
+config DELL_SMO8800
+ tristate "Dell Latitude freefall driver (ACPI SMO8800/SMO8810)"
+ depends ON ACPI
+ ---help---
+ Say Y here if you want to support SMO8800/SMO8810 freefall device
+ on Dell Latitude laptops.
+
+ To compile this driver as a module, choose M here: the module will
+ be called dell-smo8800.
+
config FUJITSU_LAPTOP
tristate "Fujitsu Laptop Extras"
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index 1a2eafc..c4ca428 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o
obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o
obj-$(CONFIG_DELL_WMI) += dell-wmi.o
obj-$(CONFIG_DELL_WMI_AIO) += dell-wmi-aio.o
+obj-$(CONFIG_DELL_SMO8800) += dell-smo8800.o
obj-$(CONFIG_ACER_WMI) += acer-wmi.o
obj-$(CONFIG_ACERHDF) += acerhdf.o
obj-$(CONFIG_HP_ACCEL) += hp_accel.o
diff --git a/drivers/platform/x86/dell-smo8800.c b/drivers/platform/x86/dell-smo8800.c
new file mode 100644
index 0000000..4aabb74
--- /dev/null
+++ b/drivers/platform/x86/dell-smo8800.c
@@ -0,0 +1,253 @@
+/*
+ * dell-smo8800.c - Dell Latitude ACPI SMO8800/SMO8810 freefall sensor driver
+ *
+ * Copyright (C) 2012 Sonal Santan <sonal.santan@gmail.com>
+ * Copyright (C) 2014 Pali Rohár <pali.rohar@gmail.com>
+ *
+ * This is loosely based on lis3lv02d driver.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#define DRIVER_NAME "smo8800"
+#define pr_fmt(fmt) DRIVER_NAME ": " fmt
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/acpi.h>
+#include <linux/interrupt.h>
+#include <linux/miscdevice.h>
+
+struct smo8800_device {
+ u32 irq; /* acpi device irq */
+ atomic_t count; /* count after last read */
+ struct miscdevice miscdev; /* for /dev/freefall */
+ unsigned long misc_opened; /* whether the device is open */
+ wait_queue_head_t misc_wait; /* Wait queue for the misc dev */
+ struct device *dev; /* acpi device */
+};
+
+static irqreturn_t smo8800_interrupt_quick(int irq, void *data)
+{
+ struct smo8800_device *smo8800 = data;
+ atomic_inc(&smo8800->count);
+ wake_up_interruptible(&smo8800->misc_wait);
+ return IRQ_WAKE_THREAD;
+}
+
+static irqreturn_t smo8800_interrupt_thread(int irq, void *data)
+{
+ struct smo8800_device *smo8800 = data;
+ dev_info(smo8800->dev, "detected free fall\n");
+ return IRQ_HANDLED;
+}
+
+static acpi_status smo8800_get_resource(struct acpi_resource *resource,
+ void *context)
+{
+ struct acpi_resource_extended_irq *irq;
+
+ if (resource->type != ACPI_RESOURCE_TYPE_EXTENDED_IRQ)
+ return AE_OK;
+
+ irq = &resource->data.extended_irq;
+ if (!irq || !irq->interrupt_count)
+ return AE_OK;
+
+ *((u32 *)context) = irq->interrupts[0];
+ return AE_CTRL_TERMINATE;
+}
+
+static u32 smo8800_get_irq(struct acpi_device *device)
+{
+ u32 irq = 0;
+ acpi_status status;
+
+ status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
+ smo8800_get_resource, &irq);
+ if (ACPI_FAILURE(status)) {
+ dev_err(&device->dev, "acpi_walk_resources failed\n");
+ return 0;
+ }
+
+ return irq;
+}
+
+static ssize_t smo8800_misc_read(struct file *file, char __user *buf,
+ size_t count, loff_t *pos)
+{
+ struct smo8800_device *smo8800 = container_of(file->private_data,
+ struct smo8800_device, miscdev);
+
+ DECLARE_WAITQUEUE(wait, current);
+ u32 data;
+ unsigned char byte_data;
+ ssize_t retval = 1;
+
+ if (count < 1)
+ return -EINVAL;
+
+ add_wait_queue(&smo8800->misc_wait, &wait);
+ while (true) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ data = atomic_xchg(&smo8800->count, 0);
+ if (data)
+ break;
+
+ if (file->f_flags & O_NONBLOCK) {
+ retval = -EAGAIN;
+ goto out;
+ }
+
+ if (signal_pending(current)) {
+ retval = -ERESTARTSYS;
+ goto out;
+ }
+
+ schedule();
+ }
+
+ if (data < 255)
+ byte_data = data;
+ else
+ byte_data = 255;
+
+ /* make sure we are not going into copy_to_user() with
+ * TASK_INTERRUPTIBLE state */
+ set_current_state(TASK_RUNNING);
+ if (copy_to_user(buf, &byte_data, sizeof(byte_data)))
+ retval = -EFAULT;
+
+out:
+ __set_current_state(TASK_RUNNING);
+ remove_wait_queue(&smo8800->misc_wait, &wait);
+
+ return retval;
+}
+
+static int smo8800_misc_open(struct inode *inode, struct file *file)
+{
+ struct smo8800_device *smo8800 = container_of(file->private_data,
+ struct smo8800_device, miscdev);
+
+ if (test_and_set_bit(0, &smo8800->misc_opened))
+ return -EBUSY; /* already open */
+
+ atomic_set(&smo8800->count, 0);
+ return 0;
+}
+
+static int smo8800_misc_release(struct inode *inode, struct file *file)
+{
+ struct smo8800_device *smo8800 = container_of(file->private_data,
+ struct smo8800_device, miscdev);
+
+ clear_bit(0, &smo8800->misc_opened); /* release the device */
+ return 0;
+}
+
+static const struct file_operations smo8800_misc_fops = {
+ .owner = THIS_MODULE,
+ .read = smo8800_misc_read,
+ .open = smo8800_misc_open,
+ .release = smo8800_misc_release,
+};
+
+static int smo8800_add(struct acpi_device *device)
+{
+ int err;
+ struct smo8800_device *smo8800;
+
+ if (!device)
+ return -EINVAL;
+
+ smo8800 = devm_kzalloc(&device->dev, sizeof(*smo8800), GFP_KERNEL);
+ if (!smo8800) {
+ dev_err(&device->dev, "failed to allocate device data\n");
+ return -ENOMEM;
+ }
+
+ smo8800->dev = &device->dev;
+ smo8800->miscdev.minor = MISC_DYNAMIC_MINOR;
+ smo8800->miscdev.name = "freefall";
+ smo8800->miscdev.fops = &smo8800_misc_fops;
+
+ init_waitqueue_head(&smo8800->misc_wait);
+
+ err = misc_register(&smo8800->miscdev);
+ if (err) {
+ dev_err(&device->dev, "failed to register misc dev: %d\n", err);
+ return err;
+ }
+
+ atomic_set(&smo8800->count, 0);
+ device->driver_data = smo8800;
+
+ smo8800->irq = smo8800_get_irq(device);
+ if (!smo8800->irq) {
+ dev_err(&device->dev, "failed to obtain IRQ\n");
+ err = -EINVAL;
+ goto error;
+ }
+
+ err = request_threaded_irq(smo8800->irq, smo8800_interrupt_quick,
+ smo8800_interrupt_thread,
+ IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+ DRIVER_NAME, smo8800);
+ if (err) {
+ dev_err(&device->dev,
+ "failed to request thread for IRQ %d: %d\n",
+ smo8800->irq, err);
+ goto error;
+ }
+
+ dev_info(&device->dev, "device /dev/freefall registered with IRQ %d\n",
+ smo8800->irq);
+ return 0;
+
+error:
+ misc_deregister(&smo8800->miscdev);
+ return err;
+}
+
+static int smo8800_remove(struct acpi_device *device)
+{
+ struct smo8800_device *smo8800 = device->driver_data;
+ free_irq(smo8800->irq, smo8800);
+ misc_deregister(&smo8800->miscdev);
+ dev_info(&device->dev, "device /dev/freefall unregistered\n");
+ return 0;
+}
+
+static const struct acpi_device_id smo8800_ids[] = {
+ { "SMO8800", 0 },
+ { "SMO8810", 0 },
+ { "", 0 },
+};
+
+MODULE_DEVICE_TABLE(acpi, smo8800_ids);
+
+static struct acpi_driver smo8800_driver = {
+ .name = DRIVER_NAME,
+ .class = "Latitude",
+ .ids = smo8800_ids,
+ .ops = {
+ .add = smo8800_add,
+ .remove = smo8800_remove,
+ },
+ .owner = THIS_MODULE,
+};
+
+module_acpi_driver(smo8800_driver);
+
+MODULE_DESCRIPTION("Dell Latitude freefall driver (ACPI SMO8800/SMO8810)");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Sonal Santan, Pali Rohár");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 2/2] Documentation: Rename hpfall.c => freefall.c, fixes for Dell
2014-05-03 10:47 [PATCH 0/2] Dell Latitude freefall driver (ACPI SMO8800/SMO8810) Pali Rohár
2014-05-03 10:47 ` [PATCH 1/2] platform: x86: dell-smo8800: " Pali Rohár
@ 2014-05-03 10:47 ` Pali Rohár
2014-06-11 8:02 ` [PATCH v2] " Pali Rohár
1 sibling, 1 reply; 20+ messages in thread
From: Pali Rohár @ 2014-05-03 10:47 UTC (permalink / raw)
To: Matthew Garrett, Randy Dunlap
Cc: linux-kernel, platform-driver-x86, linux-doc, Sonal Santan,
Pali Rohár
Dell kernel driver dell-smo8800 provides same freefall interface as hp_accel so
program hpfall.c works also on Dell laptops. So rename it to freefall.c.
Dell driver does not provide hp::hddprotect led so make sure that freefall.c
works also if hp::hddprotect does not exist in sysfs.
Additionally write info to syslog.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Cc: Sonal Santan <sonal.santan@gmail.com>
---
Documentation/laptops/00-INDEX | 4 +-
Documentation/laptops/freefall.c | 171 ++++++++++++++++++++++++++++++++++++++
Documentation/laptops/hpfall.c | 146 --------------------------------
3 files changed, 173 insertions(+), 148 deletions(-)
create mode 100644 Documentation/laptops/freefall.c
delete mode 100644 Documentation/laptops/hpfall.c
diff --git a/Documentation/laptops/00-INDEX b/Documentation/laptops/00-INDEX
index d13b9a9..d399ae1 100644
--- a/Documentation/laptops/00-INDEX
+++ b/Documentation/laptops/00-INDEX
@@ -8,8 +8,8 @@ disk-shock-protection.txt
- information on hard disk shock protection.
dslm.c
- Simple Disk Sleep Monitor program
-hpfall.c
- - (HP) laptop accelerometer program for disk protection.
+freefall.c
+ - (HP/DELL) laptop accelerometer program for disk protection.
laptop-mode.txt
- how to conserve battery power using laptop-mode.
sony-laptop.txt
diff --git a/Documentation/laptops/freefall.c b/Documentation/laptops/freefall.c
new file mode 100644
index 0000000..4d4d90a
--- /dev/null
+++ b/Documentation/laptops/freefall.c
@@ -0,0 +1,171 @@
+/* Disk protection for HP/DELL machines.
+ *
+ * Copyright 2008 Eric Piel
+ * Copyright 2009 Pavel Machek <pavel@ucw.cz>
+ * Copyright 2012 Sonal Santan
+ * Copyright 2014 Pali Rohár <pali.rohar@gmail.com>
+ *
+ * GPLv2.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <string.h>
+#include <stdint.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/mman.h>
+#include <sched.h>
+#include <syslog.h>
+
+static int noled;
+static char unload_heads_path[64];
+static char device_path[32];
+static const char app_name[] = "FREE FALL";
+
+static int set_unload_heads_path(char *device)
+{
+ char devname[64];
+
+ if (strlen(device) <= 5 || strncmp(device, "/dev/", 5) != 0)
+ return -EINVAL;
+ strncpy(devname, device + 5, sizeof(devname) - 1);
+ strncpy(device_path, device, sizeof(device_path) - 1);
+
+ snprintf(unload_heads_path, sizeof(unload_heads_path) - 1,
+ "/sys/block/%s/device/unload_heads", devname);
+ return 0;
+}
+
+static int valid_disk(void)
+{
+ int fd = open(unload_heads_path, O_RDONLY);
+ if (fd < 0) {
+ perror(unload_heads_path);
+ return 0;
+ }
+
+ close(fd);
+ return 1;
+}
+
+static void write_int(char *path, int i)
+{
+ char buf[1024];
+ int fd = open(path, O_RDWR);
+ if (fd < 0) {
+ perror("open");
+ exit(1);
+ }
+ sprintf(buf, "%d", i);
+ if (write(fd, buf, strlen(buf)) != strlen(buf)) {
+ perror("write");
+ exit(1);
+ }
+ close(fd);
+}
+
+static void set_led(int on)
+{
+ if (noled)
+ return;
+ write_int("/sys/class/leds/hp::hddprotect/brightness", on);
+}
+
+static void protect(int seconds)
+{
+ const char *str = (seconds == 0) ? "Unparked" : "Parked";
+ write_int(unload_heads_path, seconds*1000);
+ syslog(LOG_INFO, "%s %s disk head\n", str, device_path);
+}
+
+static int on_ac(void)
+{
+ /* /sys/class/power_supply/AC0/online */
+ return 1;
+}
+
+static int lid_open(void)
+{
+ /* /proc/acpi/button/lid/LID/state */
+ return 1;
+}
+
+static void ignore_me(int signum)
+{
+ protect(0);
+ set_led(0);
+}
+
+int main(int argc, char **argv)
+{
+ int fd, ret;
+ struct stat st;
+ struct sched_param param;
+
+ if (argc == 1)
+ ret = set_unload_heads_path("/dev/sda");
+ else if (argc == 2)
+ ret = set_unload_heads_path(argv[1]);
+ else
+ ret = -EINVAL;
+
+ if (ret || !valid_disk()) {
+ fprintf(stderr, "usage: %s <device> (default: /dev/sda)\n",
+ argv[0]);
+ exit(1);
+ }
+
+ fd = open("/dev/freefall", O_RDONLY);
+ if (fd < 0) {
+ perror("/dev/freefall");
+ return EXIT_FAILURE;
+ }
+
+ if (stat("/sys/class/leds/hp::hddprotect/brightness", &st))
+ noled = 1;
+
+ if (daemon(0, 0) != 0) {
+ perror("daemon");
+ return EXIT_FAILURE;
+ }
+
+ openlog(app_name, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
+
+ param.sched_priority = sched_get_priority_max(SCHED_FIFO);
+ sched_setscheduler(0, SCHED_FIFO, ¶m);
+ mlockall(MCL_CURRENT|MCL_FUTURE);
+
+ signal(SIGALRM, ignore_me);
+
+ for (;;) {
+ unsigned char count;
+
+ ret = read(fd, &count, sizeof(count));
+ alarm(0);
+ if ((ret == -1) && (errno == EINTR)) {
+ /* Alarm expired, time to unpark the heads */
+ continue;
+ }
+
+ if (ret != sizeof(count)) {
+ perror("read");
+ break;
+ }
+
+ protect(21);
+ set_led(1);
+ if (1 || on_ac() || lid_open())
+ alarm(2);
+ else
+ alarm(20);
+ }
+
+ closelog();
+ close(fd);
+ return EXIT_SUCCESS;
+}
diff --git a/Documentation/laptops/hpfall.c b/Documentation/laptops/hpfall.c
deleted file mode 100644
index b85dbba..0000000
--- a/Documentation/laptops/hpfall.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/* Disk protection for HP machines.
- *
- * Copyright 2008 Eric Piel
- * Copyright 2009 Pavel Machek <pavel@ucw.cz>
- *
- * GPLv2.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <string.h>
-#include <stdint.h>
-#include <errno.h>
-#include <signal.h>
-#include <sys/mman.h>
-#include <sched.h>
-
-char unload_heads_path[64];
-
-int set_unload_heads_path(char *device)
-{
- char devname[64];
-
- if (strlen(device) <= 5 || strncmp(device, "/dev/", 5) != 0)
- return -EINVAL;
- strncpy(devname, device + 5, sizeof(devname));
-
- snprintf(unload_heads_path, sizeof(unload_heads_path) - 1,
- "/sys/block/%s/device/unload_heads", devname);
- return 0;
-}
-int valid_disk(void)
-{
- int fd = open(unload_heads_path, O_RDONLY);
- if (fd < 0) {
- perror(unload_heads_path);
- return 0;
- }
-
- close(fd);
- return 1;
-}
-
-void write_int(char *path, int i)
-{
- char buf[1024];
- int fd = open(path, O_RDWR);
- if (fd < 0) {
- perror("open");
- exit(1);
- }
- sprintf(buf, "%d", i);
- if (write(fd, buf, strlen(buf)) != strlen(buf)) {
- perror("write");
- exit(1);
- }
- close(fd);
-}
-
-void set_led(int on)
-{
- write_int("/sys/class/leds/hp::hddprotect/brightness", on);
-}
-
-void protect(int seconds)
-{
- write_int(unload_heads_path, seconds*1000);
-}
-
-int on_ac(void)
-{
-// /sys/class/power_supply/AC0/online
-}
-
-int lid_open(void)
-{
-// /proc/acpi/button/lid/LID/state
-}
-
-void ignore_me(void)
-{
- protect(0);
- set_led(0);
-}
-
-int main(int argc, char **argv)
-{
- int fd, ret;
- struct sched_param param;
-
- if (argc == 1)
- ret = set_unload_heads_path("/dev/sda");
- else if (argc == 2)
- ret = set_unload_heads_path(argv[1]);
- else
- ret = -EINVAL;
-
- if (ret || !valid_disk()) {
- fprintf(stderr, "usage: %s <device> (default: /dev/sda)\n",
- argv[0]);
- exit(1);
- }
-
- fd = open("/dev/freefall", O_RDONLY);
- if (fd < 0) {
- perror("/dev/freefall");
- return EXIT_FAILURE;
- }
-
- daemon(0, 0);
- param.sched_priority = sched_get_priority_max(SCHED_FIFO);
- sched_setscheduler(0, SCHED_FIFO, ¶m);
- mlockall(MCL_CURRENT|MCL_FUTURE);
-
- signal(SIGALRM, ignore_me);
-
- for (;;) {
- unsigned char count;
-
- ret = read(fd, &count, sizeof(count));
- alarm(0);
- if ((ret == -1) && (errno == EINTR)) {
- /* Alarm expired, time to unpark the heads */
- continue;
- }
-
- if (ret != sizeof(count)) {
- perror("read");
- break;
- }
-
- protect(21);
- set_led(1);
- if (1 || on_ac() || lid_open())
- alarm(2);
- else
- alarm(20);
- }
-
- close(fd);
- return EXIT_SUCCESS;
-}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 1/2] platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI SMO8800/SMO8810)
2014-05-03 10:47 ` [PATCH 1/2] platform: x86: dell-smo8800: " Pali Rohár
@ 2014-05-07 16:29 ` One Thousand Gnomes
2014-05-20 7:00 ` Valdis.Kletnieks
2014-05-22 11:15 ` [PATCH v2] " Pali Rohár
2 siblings, 0 replies; 20+ messages in thread
From: One Thousand Gnomes @ 2014-05-07 16:29 UTC (permalink / raw)
To: Pali Rohár
Cc: Matthew Garrett, Randy Dunlap, linux-kernel, platform-driver-x86,
linux-doc, Sonal Santan
> +static irqreturn_t smo8800_interrupt_quick(int irq, void *data)
> +{
> + struct smo8800_device *smo8800 = data;
> + atomic_inc(&smo8800->count);
> + wake_up_interruptible(&smo8800->misc_wait);
> + return IRQ_WAKE_THREAD;
> +}
> +
> +static irqreturn_t smo8800_interrupt_thread(int irq, void *data)
> +{
> + struct smo8800_device *smo8800 = data;
> + dev_info(smo8800->dev, "detected free fall\n");
printk should be fast enough not to justify a thread, in fact the
threaded IRQ overhead is going to be higher than the printk IMHO.
I'm not entirely sure a printk is the useful response here either ?
> +static ssize_t smo8800_misc_read(struct file *file, char __user *buf,
> + size_t count, loff_t *pos)
> +{
> + struct smo8800_device *smo8800 = container_of(file->private_data,
> + struct smo8800_device, miscdev);
> +
> + DECLARE_WAITQUEUE(wait, current);
> + u32 data;
> + unsigned char byte_data;
> + ssize_t retval = 1;
> +
> + if (count < 1)
> + return -EINVAL;
How can this occur ??
> +
> + add_wait_queue(&smo8800->misc_wait, &wait);
> + while (true) {
> + set_current_state(TASK_INTERRUPTIBLE);
> + data = atomic_xchg(&smo8800->count, 0);
> + if (data)
> + break;
> +
> + if (file->f_flags & O_NONBLOCK) {
> + retval = -EAGAIN;
> + goto out;
> + }
> +
> + if (signal_pending(current)) {
> + retval = -ERESTARTSYS;
> + goto out;
> + }
> +
> + schedule();
> + }
wait_event_interruptible ?
> + if (copy_to_user(buf, &byte_data, sizeof(byte_data)))
> + retval = -EFAULT;
put_user
> +static int smo8800_add(struct acpi_device *device)
> +{
> + int err;
> + struct smo8800_device *smo8800;
> +
> + if (!device)
> + return -EINVAL;
How can this occur ??
> + atomic_set(&smo8800->count, 0);
Not needed - you can't see a count until it is open
> + dev_info(&device->dev, "device /dev/freefall registered with IRQ %d\n",
> + smo8800->irq);
dev_dbg would be more appropriate. If every driver reported its
registration we'd drown in logs
> + dev_info(&device->dev, "device /dev/freefall unregistered\n");
Ditto
Alan
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/2] platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI SMO8800/SMO8810)
2014-05-03 10:47 ` [PATCH 1/2] platform: x86: dell-smo8800: " Pali Rohár
2014-05-07 16:29 ` One Thousand Gnomes
@ 2014-05-20 7:00 ` Valdis.Kletnieks
2014-05-20 8:56 ` Pali Rohár
2014-05-22 11:15 ` [PATCH v2] " Pali Rohár
2 siblings, 1 reply; 20+ messages in thread
From: Valdis.Kletnieks @ 2014-05-20 7:00 UTC (permalink / raw)
To: Pali Rohár
Cc: Matthew Garrett, Randy Dunlap, linux-kernel, platform-driver-x86,
linux-doc, Sonal Santan
[-- Attachment #1: Type: text/plain, Size: 1855 bytes --]
On Sat, 03 May 2014 12:47:56 +0200, Pali Rohár said:
> This acpi driver provide supports for freefall sensors SMO8800/SMO8810 which
> can be found on Dell Latitude laptops. Driver register /dev/freefall misc
> device which has same interface as driver hp_accel freefall driver. So any
> existing applications for HP freefall sensor /dev/freefall will work for with
> this new driver for Dell Latitude laptops too.
So just for grins, I tossed this patchset on top of next-20140519, and
it actually works on my Dell Latitude E6530. Tested with a controlled
drop of 3-4 inches, and I get the distinctive sound of a head park, and
the following in /var/log/messages:
May 20 02:46:22 turing-police kernel: [18839.158926] smo8800 SMO8810:00: detected free fall
May 20 02:46:22 turing-police FREE FALL[1337]: Parked /dev/sda disk head
May 20 02:46:24 turing-police FREE FALL[1337]: Unparked /dev/sda disk head
I did a quick read-through of the code, looks OK. checkpatch complains about
missing blank lines after declarations in 3-4 places. Sparse and gcc have no
complaints. We've certainly merged much uglier code. And it certainly makes
the world a better place for us Dell users.
So it's OK by me if Pali adds this to the signoffs after fixing the
checkpatch and the one serious nit below....
Tested-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Acked-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
One nit:
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -127,6 +127,16 @@ config DELL_WMI_AIO
> To compile this driver as a module, choose M here: the module will
> be called dell-wmi-aio.
>
> +config DELL_SMO8800
> + tristate "Dell Latitude freefall driver (ACPI SMO8800/SMO8810)"
> + depends ON ACPI
Lowercase ON. Not sure how this escaped, Kbuild barfs on it.
[-- Attachment #2: Type: application/pgp-signature, Size: 848 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/2] platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI SMO8800/SMO8810)
2014-05-20 7:00 ` Valdis.Kletnieks
@ 2014-05-20 8:56 ` Pali Rohár
2014-05-20 18:02 ` Valdis.Kletnieks
0 siblings, 1 reply; 20+ messages in thread
From: Pali Rohár @ 2014-05-20 8:56 UTC (permalink / raw)
To: Valdis.Kletnieks
Cc: Matthew Garrett, Randy Dunlap, linux-kernel, platform-driver-x86,
linux-doc, Sonal Santan
[-- Attachment #1: Type: Text/Plain, Size: 2528 bytes --]
On Tuesday 20 May 2014 09:00:05 Valdis.Kletnieks@vt.edu wrote:
> On Sat, 03 May 2014 12:47:56 +0200, Pali Rohár said:
> > This acpi driver provide supports for freefall sensors
> > SMO8800/SMO8810 which can be found on Dell Latitude
> > laptops. Driver register /dev/freefall misc device which
> > has same interface as driver hp_accel freefall driver. So
> > any existing applications for HP freefall sensor
> > /dev/freefall will work for with this new driver for Dell
> > Latitude laptops too.
>
> So just for grins, I tossed this patchset on top of
> next-20140519, and it actually works on my Dell Latitude
> E6530. Tested with a controlled drop of 3-4 inches, and I get
> the distinctive sound of a head park, and the following in
> /var/log/messages:
>
> May 20 02:46:22 turing-police kernel: [18839.158926] smo8800
> SMO8810:00: detected free fall May 20 02:46:22 turing-police
> FREE FALL[1337]: Parked /dev/sda disk head May 20 02:46:24
> turing-police FREE FALL[1337]: Unparked /dev/sda disk head
>
> I did a quick read-through of the code, looks OK. checkpatch
> complains about missing blank lines after declarations in 3-4
> places. Sparse and gcc have no complaints. We've certainly
> merged much uglier code. And it certainly makes the world a
> better place for us Dell users.
>
Hm? Which errors? Here is output from checkpacth:
total: 0 errors, 0 warnings, 276 lines checked
0001-platform-x86-dell-smo8800-Dell-Latitude-freefall-dri.patch
has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 181 lines checked
0002-Documentation-Rename-hpfall.c-freefall.c-fixes-for-D.patch
has no obvious style problems and is ready for submission.
> So it's OK by me if Pali adds this to the signoffs after
> fixing the checkpatch and the one serious nit below....
>
> Tested-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
> Acked-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
>
> One nit:
> > --- a/drivers/platform/x86/Kconfig
> > +++ b/drivers/platform/x86/Kconfig
> > @@ -127,6 +127,16 @@ config DELL_WMI_AIO
> >
> > To compile this driver as a module, choose M here: the
> > module will be called dell-wmi-aio.
> >
> > +config DELL_SMO8800
> > + tristate "Dell Latitude freefall driver (ACPI
> > SMO8800/SMO8810)" + depends ON ACPI
>
> Lowercase ON. Not sure how this escaped, Kbuild barfs on it.
I will send new version with some changes from Sonal.
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/2] platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI SMO8800/SMO8810)
2014-05-20 8:56 ` Pali Rohár
@ 2014-05-20 18:02 ` Valdis.Kletnieks
2014-05-20 18:10 ` Pali Rohár
0 siblings, 1 reply; 20+ messages in thread
From: Valdis.Kletnieks @ 2014-05-20 18:02 UTC (permalink / raw)
To: Pali Rohár
Cc: Matthew Garrett, Randy Dunlap, linux-kernel, platform-driver-x86,
linux-doc, Sonal Santan
[-- Attachment #1: Type: text/plain, Size: 2026 bytes --]
On Tue, 20 May 2014 10:56:47 +0200, Pali Rohár said:
> Hm? Which errors? Here is output from checkpacth:
>
> total: 0 errors, 0 warnings, 276 lines checked
>
> 0001-platform-x86-dell-smo8800-Dell-Latitude-freefall-dri.patch
> has no obvious style problems and is ready for submission.
>
> total: 0 errors, 0 warnings, 181 lines checked
>
> 0002-Documentation-Rename-hpfall.c-freefall.c-fixes-for-D.patch
> has no obvious style problems and is ready for submission.
Hmm.. what tree are you building against? I wonder if your checkpatch is
a different version than mine (next-20140519). What I see:
[/usr/src/linux-next] scripts/checkpatch.pl patches/freefall.1
WARNING: Missing a blank line after declarations
#135: FILE: drivers/platform/x86/dell-smo8800.c:41:
+ struct smo8800_device *smo8800 = data;
+ atomic_inc(&smo8800->count);
WARNING: Missing a blank line after declarations
#143: FILE: drivers/platform/x86/dell-smo8800.c:49:
+ struct smo8800_device *smo8800 = data;
+ dev_info(smo8800->dev, "detected free fall\n");
WARNING: Missing a blank line after declarations
#318: FILE: drivers/platform/x86/dell-smo8800.c:224:
+ struct smo8800_device *smo8800 = device->driver_data;
+ free_irq(smo8800->irq, smo8800);
total: 0 errors, 3 warnings, 276 lines checked
patches/freefall.1 has style problems, please review.
[/usr/src/linux-next] scripts/checkpatch.pl patches/freefall.2
WARNING: Missing a blank line after declarations
#126: FILE: Documentation/laptops/freefall.c:47:
+ int fd = open(unload_heads_path, O_RDONLY);
+ if (fd < 0) {
WARNING: Missing a blank line after declarations
#139: FILE: Documentation/laptops/freefall.c:60:
+ int fd = open(path, O_RDWR);
+ if (fd < 0) {
WARNING: Missing a blank line after declarations
#161: FILE: Documentation/laptops/freefall.c:82:
+ const char *str = (seconds == 0) ? "Unparked" : "Parked";
+ write_int(unload_heads_path, seconds*1000);
total: 0 errors, 3 warnings, 181 lines checked
[-- Attachment #2: Type: application/pgp-signature, Size: 848 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/2] platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI SMO8800/SMO8810)
2014-05-20 18:02 ` Valdis.Kletnieks
@ 2014-05-20 18:10 ` Pali Rohár
2014-05-20 18:36 ` Valdis.Kletnieks
0 siblings, 1 reply; 20+ messages in thread
From: Pali Rohár @ 2014-05-20 18:10 UTC (permalink / raw)
To: Valdis.Kletnieks
Cc: Matthew Garrett, Randy Dunlap, linux-kernel, platform-driver-x86,
linux-doc, Sonal Santan
[-- Attachment #1: Type: Text/Plain, Size: 943 bytes --]
On Tuesday 20 May 2014 20:02:41 Valdis.Kletnieks@vt.edu wrote:
> On Tue, 20 May 2014 10:56:47 +0200, Pali Rohár said:
> > Hm? Which errors? Here is output from checkpacth:
> >
> > total: 0 errors, 0 warnings, 276 lines checked
> >
> > 0001-platform-x86-dell-smo8800-Dell-Latitude-freefall-dri.pa
> > tch has no obvious style problems and is ready for
> > submission.
> >
> > total: 0 errors, 0 warnings, 181 lines checked
> >
> > 0002-Documentation-Rename-hpfall.c-freefall.c-fixes-for-D.pa
> > tch has no obvious style problems and is ready for
> > submission.
>
> Hmm.. what tree are you building against? I wonder if your
> checkpatch is a different version than mine (next-20140519).
I'm using up-to-date linus tree, git rev
60b5f90d0fac7585f1a43ccdad06787b97eda0ab
$ sha1sum scripts/checkpatch.pl
979ad287faf59d84d78825595ec97513a9d46fba scripts/checkpatch.pl
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/2] platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI SMO8800/SMO8810)
2014-05-20 18:10 ` Pali Rohár
@ 2014-05-20 18:36 ` Valdis.Kletnieks
0 siblings, 0 replies; 20+ messages in thread
From: Valdis.Kletnieks @ 2014-05-20 18:36 UTC (permalink / raw)
To: Pali Rohár
Cc: Matthew Garrett, Randy Dunlap, linux-kernel, platform-driver-x86,
linux-doc, Sonal Santan
[-- Attachment #1: Type: text/plain, Size: 561 bytes --]
On Tue, 20 May 2014 20:10:28 +0200, Pali Rohár said:
> > Hmm.. what tree are you building against? I wonder if your
> > checkpatch is a different version than mine (next-20140519).
>
> I'm using up-to-date linus tree, git rev
> 60b5f90d0fac7585f1a43ccdad06787b97eda0ab
Ah, OK. Linux-next tree has a bunch of changes to checkpatch.pl that
will probably go into the Linus tree during the next merge window, and
several of them address the "blank line after declarations" warning - they
roughly tripled the number of checks made for that case....
[-- Attachment #2: Type: application/pgp-signature, Size: 848 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2] platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI SMO8800/SMO8810)
2014-05-03 10:47 ` [PATCH 1/2] platform: x86: dell-smo8800: " Pali Rohár
2014-05-07 16:29 ` One Thousand Gnomes
2014-05-20 7:00 ` Valdis.Kletnieks
@ 2014-05-22 11:15 ` Pali Rohár
2014-05-28 13:31 ` Pali Rohár
2 siblings, 1 reply; 20+ messages in thread
From: Pali Rohár @ 2014-05-22 11:15 UTC (permalink / raw)
To: Matthew Garrett, Randy Dunlap, Valdis.Kletnieks
Cc: linux-kernel, platform-driver-x86, One Thousand Gnomes,
Pali Rohár, Sonal Santan
This acpi driver provide supports for freefall sensors SMO8800/SMO8810 which
can be found on Dell Latitude laptops. Driver register /dev/freefall misc
device which has same interface as driver hp_accel freefall driver. So any
existing applications for HP freefall sensor /dev/freefall will work for with
this new driver for Dell Latitude laptops too.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Cc: Sonal Santan <sonal.santan@gmail.com>
Tested-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Acked-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
---
Changes since v1:
* Fixed warnings: Missing a blank line after declarations
* Fixed Lowercase ON in Kconfig
* Fixed Alan's review problems by Sonal Santan
---
drivers/platform/x86/Kconfig | 10 ++
drivers/platform/x86/Makefile | 1 +
drivers/platform/x86/dell-smo8800.c | 233 +++++++++++++++++++++++++++++++++++
3 files changed, 244 insertions(+)
create mode 100644 drivers/platform/x86/dell-smo8800.c
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 27df2c5..0e80401 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -127,6 +127,16 @@ config DELL_WMI_AIO
To compile this driver as a module, choose M here: the module will
be called dell-wmi-aio.
+config DELL_SMO8800
+ tristate "Dell Latitude freefall driver (ACPI SMO8800/SMO8810)"
+ depends on ACPI
+ ---help---
+ Say Y here if you want to support SMO8800/SMO8810 freefall device
+ on Dell Latitude laptops.
+
+ To compile this driver as a module, choose M here: the module will
+ be called dell-smo8800.
+
config FUJITSU_LAPTOP
tristate "Fujitsu Laptop Extras"
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index 1a2eafc..c4ca428 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o
obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o
obj-$(CONFIG_DELL_WMI) += dell-wmi.o
obj-$(CONFIG_DELL_WMI_AIO) += dell-wmi-aio.o
+obj-$(CONFIG_DELL_SMO8800) += dell-smo8800.o
obj-$(CONFIG_ACER_WMI) += acer-wmi.o
obj-$(CONFIG_ACERHDF) += acerhdf.o
obj-$(CONFIG_HP_ACCEL) += hp_accel.o
diff --git a/drivers/platform/x86/dell-smo8800.c b/drivers/platform/x86/dell-smo8800.c
new file mode 100644
index 0000000..a653716
--- /dev/null
+++ b/drivers/platform/x86/dell-smo8800.c
@@ -0,0 +1,233 @@
+/*
+ * dell-smo8800.c - Dell Latitude ACPI SMO8800/SMO8810 freefall sensor driver
+ *
+ * Copyright (C) 2012 Sonal Santan <sonal.santan@gmail.com>
+ * Copyright (C) 2014 Pali Rohár <pali.rohar@gmail.com>
+ *
+ * This is loosely based on lis3lv02d driver.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#define DRIVER_NAME "smo8800"
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/acpi.h>
+#include <linux/interrupt.h>
+#include <linux/miscdevice.h>
+
+struct smo8800_device {
+ u32 irq; /* acpi device irq */
+ atomic_t counter; /* count after last read */
+ struct miscdevice miscdev; /* for /dev/freefall */
+ unsigned long misc_opened; /* whether the device is open */
+ wait_queue_head_t misc_wait; /* Wait queue for the misc dev */
+ struct device *dev; /* acpi device */
+};
+
+static irqreturn_t smo8800_interrupt_quick(int irq, void *data)
+{
+ struct smo8800_device *smo8800 = data;
+
+ atomic_inc(&smo8800->counter);
+ wake_up_interruptible(&smo8800->misc_wait);
+ return IRQ_WAKE_THREAD;
+}
+
+static irqreturn_t smo8800_interrupt_thread(int irq, void *data)
+{
+ struct smo8800_device *smo8800 = data;
+
+ dev_info(smo8800->dev, "detected free fall\n");
+ return IRQ_HANDLED;
+}
+
+static acpi_status smo8800_get_resource(struct acpi_resource *resource,
+ void *context)
+{
+ struct acpi_resource_extended_irq *irq;
+
+ if (resource->type != ACPI_RESOURCE_TYPE_EXTENDED_IRQ)
+ return AE_OK;
+
+ irq = &resource->data.extended_irq;
+ if (!irq || !irq->interrupt_count)
+ return AE_OK;
+
+ *((u32 *)context) = irq->interrupts[0];
+ return AE_CTRL_TERMINATE;
+}
+
+static u32 smo8800_get_irq(struct acpi_device *device)
+{
+ u32 irq = 0;
+ acpi_status status;
+
+ status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
+ smo8800_get_resource, &irq);
+ if (ACPI_FAILURE(status)) {
+ dev_err(&device->dev, "acpi_walk_resources failed\n");
+ return 0;
+ }
+
+ return irq;
+}
+
+static ssize_t smo8800_misc_read(struct file *file, char __user *buf,
+ size_t count, loff_t *pos)
+{
+ struct smo8800_device *smo8800 = container_of(file->private_data,
+ struct smo8800_device, miscdev);
+
+ u32 data = 0;
+ unsigned char byte_data = 0;
+ ssize_t retval = 1;
+
+ if (count < 1)
+ return -EINVAL;
+
+ atomic_set(&smo8800->counter, 0);
+ retval = wait_event_interruptible(smo8800->misc_wait,
+ (data = atomic_xchg(&smo8800->counter, 0)));
+
+ if (retval)
+ return retval;
+
+ byte_data = 1;
+ retval = 1;
+
+ if (data < 255)
+ byte_data = data;
+ else
+ byte_data = 255;
+
+ if (put_user(byte_data, buf))
+ retval = -EFAULT;
+
+ return retval;
+}
+
+static int smo8800_misc_open(struct inode *inode, struct file *file)
+{
+ struct smo8800_device *smo8800 = container_of(file->private_data,
+ struct smo8800_device, miscdev);
+
+ if (test_and_set_bit(0, &smo8800->misc_opened))
+ return -EBUSY; /* already open */
+
+ atomic_set(&smo8800->counter, 0);
+ return 0;
+}
+
+static int smo8800_misc_release(struct inode *inode, struct file *file)
+{
+ struct smo8800_device *smo8800 = container_of(file->private_data,
+ struct smo8800_device, miscdev);
+
+ clear_bit(0, &smo8800->misc_opened); /* release the device */
+ return 0;
+}
+
+static const struct file_operations smo8800_misc_fops = {
+ .owner = THIS_MODULE,
+ .read = smo8800_misc_read,
+ .open = smo8800_misc_open,
+ .release = smo8800_misc_release,
+};
+
+static int smo8800_add(struct acpi_device *device)
+{
+ int err;
+ struct smo8800_device *smo8800;
+
+ smo8800 = devm_kzalloc(&device->dev, sizeof(*smo8800), GFP_KERNEL);
+ if (!smo8800) {
+ dev_err(&device->dev, "failed to allocate device data\n");
+ return -ENOMEM;
+ }
+
+ smo8800->dev = &device->dev;
+ smo8800->miscdev.minor = MISC_DYNAMIC_MINOR;
+ smo8800->miscdev.name = "freefall";
+ smo8800->miscdev.fops = &smo8800_misc_fops;
+
+ init_waitqueue_head(&smo8800->misc_wait);
+
+ err = misc_register(&smo8800->miscdev);
+ if (err) {
+ dev_err(&device->dev, "failed to register misc dev: %d\n", err);
+ return err;
+ }
+
+ device->driver_data = smo8800;
+
+ smo8800->irq = smo8800_get_irq(device);
+ if (!smo8800->irq) {
+ dev_err(&device->dev, "failed to obtain IRQ\n");
+ err = -EINVAL;
+ goto error;
+ }
+
+ err = request_threaded_irq(smo8800->irq, smo8800_interrupt_quick,
+ smo8800_interrupt_thread,
+ IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+ DRIVER_NAME, smo8800);
+ if (err) {
+ dev_err(&device->dev,
+ "failed to request thread for IRQ %d: %d\n",
+ smo8800->irq, err);
+ goto error;
+ }
+
+ dev_dbg(&device->dev, "device /dev/freefall registered with IRQ %d\n",
+ smo8800->irq);
+ return 0;
+
+error:
+ misc_deregister(&smo8800->miscdev);
+ return err;
+}
+
+static int smo8800_remove(struct acpi_device *device)
+{
+ struct smo8800_device *smo8800 = device->driver_data;
+
+ free_irq(smo8800->irq, smo8800);
+ misc_deregister(&smo8800->miscdev);
+ dev_dbg(&device->dev, "device /dev/freefall unregistered\n");
+ return 0;
+}
+
+static const struct acpi_device_id smo8800_ids[] = {
+ { "SMO8800", 0 },
+ { "SMO8810", 0 },
+ { "", 0 },
+};
+
+MODULE_DEVICE_TABLE(acpi, smo8800_ids);
+
+static struct acpi_driver smo8800_driver = {
+ .name = DRIVER_NAME,
+ .class = "Latitude",
+ .ids = smo8800_ids,
+ .ops = {
+ .add = smo8800_add,
+ .remove = smo8800_remove,
+ },
+ .owner = THIS_MODULE,
+};
+
+module_acpi_driver(smo8800_driver);
+
+MODULE_DESCRIPTION("Dell Latitude freefall driver (ACPI SMO8800/SMO8810)");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Sonal Santan, Pali Rohár");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH v2] platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI SMO8800/SMO8810)
2014-05-22 11:15 ` [PATCH v2] " Pali Rohár
@ 2014-05-28 13:31 ` Pali Rohár
2014-06-06 10:24 ` Pali Rohár
0 siblings, 1 reply; 20+ messages in thread
From: Pali Rohár @ 2014-05-28 13:31 UTC (permalink / raw)
To: Matthew Garrett
Cc: Randy Dunlap, Valdis.Kletnieks, linux-kernel,
platform-driver-x86, One Thousand Gnomes, Sonal Santan
[-- Attachment #1: Type: Text/Plain, Size: 1252 bytes --]
On Thursday 22 May 2014 13:15:48 Pali Rohár wrote:
> This acpi driver provide supports for freefall sensors
> SMO8800/SMO8810 which can be found on Dell Latitude laptops.
> Driver register /dev/freefall misc device which has same
> interface as driver hp_accel freefall driver. So any existing
> applications for HP freefall sensor /dev/freefall will work
> for with this new driver for Dell Latitude laptops too.
>
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> Cc: Sonal Santan <sonal.santan@gmail.com>
> Tested-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
> Acked-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
> ---
> Changes since v1:
> * Fixed warnings: Missing a blank line after declarations
> * Fixed Lowercase ON in Kconfig
> * Fixed Alan's review problems by Sonal Santan
> ---
> drivers/platform/x86/Kconfig | 10 ++
> drivers/platform/x86/Makefile | 1 +
> drivers/platform/x86/dell-smo8800.c | 233
> +++++++++++++++++++++++++++++++++++ 3 files changed, 244
> insertions(+)
> create mode 100644 drivers/platform/x86/dell-smo8800.c
>
After week there are no other objections.
Matthew Garrett, can you apply driver into platform tree?
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2] platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI SMO8800/SMO8810)
2014-05-28 13:31 ` Pali Rohár
@ 2014-06-06 10:24 ` Pali Rohár
0 siblings, 0 replies; 20+ messages in thread
From: Pali Rohár @ 2014-06-06 10:24 UTC (permalink / raw)
To: Matthew Garrett
Cc: Randy Dunlap, Valdis.Kletnieks, linux-kernel,
platform-driver-x86, One Thousand Gnomes, Sonal Santan
[-- Attachment #1: Type: Text/Plain, Size: 1390 bytes --]
On Wednesday 28 May 2014 15:31:30 Pali Rohár wrote:
> On Thursday 22 May 2014 13:15:48 Pali Rohár wrote:
> > This acpi driver provide supports for freefall sensors
> > SMO8800/SMO8810 which can be found on Dell Latitude laptops.
> > Driver register /dev/freefall misc device which has same
> > interface as driver hp_accel freefall driver. So any
> > existing applications for HP freefall sensor /dev/freefall
> > will work for with this new driver for Dell Latitude
> > laptops too.
> >
> > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > Cc: Sonal Santan <sonal.santan@gmail.com>
> > Tested-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
> > Acked-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
> > ---
> > Changes since v1:
> > * Fixed warnings: Missing a blank line after declarations
> > * Fixed Lowercase ON in Kconfig
> > * Fixed Alan's review problems by Sonal Santan
> > ---
> >
> > drivers/platform/x86/Kconfig | 10 ++
> > drivers/platform/x86/Makefile | 1 +
> > drivers/platform/x86/dell-smo8800.c | 233
> >
> > +++++++++++++++++++++++++++++++++++ 3 files changed, 244
> > insertions(+)
> >
> > create mode 100644 drivers/platform/x86/dell-smo8800.c
>
> After week there are no other objections.
>
> Matthew Garrett, can you apply driver into platform tree?
PING.
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2] Documentation: Rename hpfall.c => freefall.c, fixes for Dell
2014-05-03 10:47 ` [PATCH 2/2] Documentation: Rename hpfall.c => freefall.c, fixes for Dell Pali Rohár
@ 2014-06-11 8:02 ` Pali Rohár
2014-06-14 8:53 ` Pavel Machek
2014-06-29 2:12 ` Randy Dunlap
0 siblings, 2 replies; 20+ messages in thread
From: Pali Rohár @ 2014-06-11 8:02 UTC (permalink / raw)
To: Matthew Garrett, Randy Dunlap, Pavel Machek, Valdis Kletnieks
Cc: linux-doc, linux-kernel, platform-driver-x86, Pali Rohár,
Sonal Santan
Dell kernel driver dell-smo8800 provides same freefall interface as hp_accel so
program hpfall.c works also on Dell laptops. So rename it to freefall.c.
Dell driver does not provide hp::hddprotect led so make sure that freefall.c
works also if hp::hddprotect does not exist in sysfs.
Additionally write info to syslog.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Cc: Sonal Santan <sonal.santan@gmail.com>
---
Changes since v1:
* Fixed warnings: Missing a blank line after declarations
---
Documentation/laptops/00-INDEX | 4 +-
Documentation/laptops/freefall.c | 177 ++++++++++++++++++++++++++++++++++++++
Documentation/laptops/hpfall.c | 146 -------------------------------
3 files changed, 179 insertions(+), 148 deletions(-)
create mode 100644 Documentation/laptops/freefall.c
delete mode 100644 Documentation/laptops/hpfall.c
diff --git a/Documentation/laptops/00-INDEX b/Documentation/laptops/00-INDEX
index d13b9a9..d399ae1 100644
--- a/Documentation/laptops/00-INDEX
+++ b/Documentation/laptops/00-INDEX
@@ -8,8 +8,8 @@ disk-shock-protection.txt
- information on hard disk shock protection.
dslm.c
- Simple Disk Sleep Monitor program
-hpfall.c
- - (HP) laptop accelerometer program for disk protection.
+freefall.c
+ - (HP/DELL) laptop accelerometer program for disk protection.
laptop-mode.txt
- how to conserve battery power using laptop-mode.
sony-laptop.txt
diff --git a/Documentation/laptops/freefall.c b/Documentation/laptops/freefall.c
new file mode 100644
index 0000000..aab2ff0
--- /dev/null
+++ b/Documentation/laptops/freefall.c
@@ -0,0 +1,177 @@
+/* Disk protection for HP/DELL machines.
+ *
+ * Copyright 2008 Eric Piel
+ * Copyright 2009 Pavel Machek <pavel@ucw.cz>
+ * Copyright 2012 Sonal Santan
+ * Copyright 2014 Pali Rohár <pali.rohar@gmail.com>
+ *
+ * GPLv2.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <string.h>
+#include <stdint.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/mman.h>
+#include <sched.h>
+#include <syslog.h>
+
+static int noled;
+static char unload_heads_path[64];
+static char device_path[32];
+static const char app_name[] = "FREE FALL";
+
+static int set_unload_heads_path(char *device)
+{
+ char devname[64];
+
+ if (strlen(device) <= 5 || strncmp(device, "/dev/", 5) != 0)
+ return -EINVAL;
+ strncpy(devname, device + 5, sizeof(devname) - 1);
+ strncpy(device_path, device, sizeof(device_path) - 1);
+
+ snprintf(unload_heads_path, sizeof(unload_heads_path) - 1,
+ "/sys/block/%s/device/unload_heads", devname);
+ return 0;
+}
+
+static int valid_disk(void)
+{
+ int fd = open(unload_heads_path, O_RDONLY);
+
+ if (fd < 0) {
+ perror(unload_heads_path);
+ return 0;
+ }
+
+ close(fd);
+ return 1;
+}
+
+static void write_int(char *path, int i)
+{
+ char buf[1024];
+ int fd = open(path, O_RDWR);
+
+ if (fd < 0) {
+ perror("open");
+ exit(1);
+ }
+
+ sprintf(buf, "%d", i);
+
+ if (write(fd, buf, strlen(buf)) != strlen(buf)) {
+ perror("write");
+ exit(1);
+ }
+
+ close(fd);
+}
+
+static void set_led(int on)
+{
+ if (noled)
+ return;
+ write_int("/sys/class/leds/hp::hddprotect/brightness", on);
+}
+
+static void protect(int seconds)
+{
+ const char *str = (seconds == 0) ? "Unparked" : "Parked";
+
+ write_int(unload_heads_path, seconds*1000);
+ syslog(LOG_INFO, "%s %s disk head\n", str, device_path);
+}
+
+static int on_ac(void)
+{
+ /* /sys/class/power_supply/AC0/online */
+ return 1;
+}
+
+static int lid_open(void)
+{
+ /* /proc/acpi/button/lid/LID/state */
+ return 1;
+}
+
+static void ignore_me(int signum)
+{
+ protect(0);
+ set_led(0);
+}
+
+int main(int argc, char **argv)
+{
+ int fd, ret;
+ struct stat st;
+ struct sched_param param;
+
+ if (argc == 1)
+ ret = set_unload_heads_path("/dev/sda");
+ else if (argc == 2)
+ ret = set_unload_heads_path(argv[1]);
+ else
+ ret = -EINVAL;
+
+ if (ret || !valid_disk()) {
+ fprintf(stderr, "usage: %s <device> (default: /dev/sda)\n",
+ argv[0]);
+ exit(1);
+ }
+
+ fd = open("/dev/freefall", O_RDONLY);
+ if (fd < 0) {
+ perror("/dev/freefall");
+ return EXIT_FAILURE;
+ }
+
+ if (stat("/sys/class/leds/hp::hddprotect/brightness", &st))
+ noled = 1;
+
+ if (daemon(0, 0) != 0) {
+ perror("daemon");
+ return EXIT_FAILURE;
+ }
+
+ openlog(app_name, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
+
+ param.sched_priority = sched_get_priority_max(SCHED_FIFO);
+ sched_setscheduler(0, SCHED_FIFO, ¶m);
+ mlockall(MCL_CURRENT|MCL_FUTURE);
+
+ signal(SIGALRM, ignore_me);
+
+ for (;;) {
+ unsigned char count;
+
+ ret = read(fd, &count, sizeof(count));
+ alarm(0);
+ if ((ret == -1) && (errno == EINTR)) {
+ /* Alarm expired, time to unpark the heads */
+ continue;
+ }
+
+ if (ret != sizeof(count)) {
+ perror("read");
+ break;
+ }
+
+ protect(21);
+ set_led(1);
+ if (1 || on_ac() || lid_open())
+ alarm(2);
+ else
+ alarm(20);
+ }
+
+ closelog();
+ close(fd);
+ return EXIT_SUCCESS;
+}
diff --git a/Documentation/laptops/hpfall.c b/Documentation/laptops/hpfall.c
deleted file mode 100644
index b85dbba..0000000
--- a/Documentation/laptops/hpfall.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/* Disk protection for HP machines.
- *
- * Copyright 2008 Eric Piel
- * Copyright 2009 Pavel Machek <pavel@ucw.cz>
- *
- * GPLv2.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <string.h>
-#include <stdint.h>
-#include <errno.h>
-#include <signal.h>
-#include <sys/mman.h>
-#include <sched.h>
-
-char unload_heads_path[64];
-
-int set_unload_heads_path(char *device)
-{
- char devname[64];
-
- if (strlen(device) <= 5 || strncmp(device, "/dev/", 5) != 0)
- return -EINVAL;
- strncpy(devname, device + 5, sizeof(devname));
-
- snprintf(unload_heads_path, sizeof(unload_heads_path) - 1,
- "/sys/block/%s/device/unload_heads", devname);
- return 0;
-}
-int valid_disk(void)
-{
- int fd = open(unload_heads_path, O_RDONLY);
- if (fd < 0) {
- perror(unload_heads_path);
- return 0;
- }
-
- close(fd);
- return 1;
-}
-
-void write_int(char *path, int i)
-{
- char buf[1024];
- int fd = open(path, O_RDWR);
- if (fd < 0) {
- perror("open");
- exit(1);
- }
- sprintf(buf, "%d", i);
- if (write(fd, buf, strlen(buf)) != strlen(buf)) {
- perror("write");
- exit(1);
- }
- close(fd);
-}
-
-void set_led(int on)
-{
- write_int("/sys/class/leds/hp::hddprotect/brightness", on);
-}
-
-void protect(int seconds)
-{
- write_int(unload_heads_path, seconds*1000);
-}
-
-int on_ac(void)
-{
-// /sys/class/power_supply/AC0/online
-}
-
-int lid_open(void)
-{
-// /proc/acpi/button/lid/LID/state
-}
-
-void ignore_me(void)
-{
- protect(0);
- set_led(0);
-}
-
-int main(int argc, char **argv)
-{
- int fd, ret;
- struct sched_param param;
-
- if (argc == 1)
- ret = set_unload_heads_path("/dev/sda");
- else if (argc == 2)
- ret = set_unload_heads_path(argv[1]);
- else
- ret = -EINVAL;
-
- if (ret || !valid_disk()) {
- fprintf(stderr, "usage: %s <device> (default: /dev/sda)\n",
- argv[0]);
- exit(1);
- }
-
- fd = open("/dev/freefall", O_RDONLY);
- if (fd < 0) {
- perror("/dev/freefall");
- return EXIT_FAILURE;
- }
-
- daemon(0, 0);
- param.sched_priority = sched_get_priority_max(SCHED_FIFO);
- sched_setscheduler(0, SCHED_FIFO, ¶m);
- mlockall(MCL_CURRENT|MCL_FUTURE);
-
- signal(SIGALRM, ignore_me);
-
- for (;;) {
- unsigned char count;
-
- ret = read(fd, &count, sizeof(count));
- alarm(0);
- if ((ret == -1) && (errno == EINTR)) {
- /* Alarm expired, time to unpark the heads */
- continue;
- }
-
- if (ret != sizeof(count)) {
- perror("read");
- break;
- }
-
- protect(21);
- set_led(1);
- if (1 || on_ac() || lid_open())
- alarm(2);
- else
- alarm(20);
- }
-
- close(fd);
- return EXIT_SUCCESS;
-}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH v2] Documentation: Rename hpfall.c => freefall.c, fixes for Dell
2014-06-11 8:02 ` [PATCH v2] " Pali Rohár
@ 2014-06-14 8:53 ` Pavel Machek
2014-06-16 11:55 ` Pali Rohár
2014-06-29 2:12 ` Randy Dunlap
1 sibling, 1 reply; 20+ messages in thread
From: Pavel Machek @ 2014-06-14 8:53 UTC (permalink / raw)
To: Pali Roh?r
Cc: Matthew Garrett, Randy Dunlap, Valdis Kletnieks, linux-doc,
linux-kernel, platform-driver-x86, Sonal Santan
On Wed 2014-06-11 10:02:07, Pali Roh?r wrote:
> Dell kernel driver dell-smo8800 provides same freefall interface as hp_accel so
> program hpfall.c works also on Dell laptops. So rename it to freefall.c.
>
> Dell driver does not provide hp::hddprotect led so make sure that freefall.c
> works also if hp::hddprotect does not exist in sysfs.
>
> Additionally write info to syslog.
>
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> Cc: Sonal Santan <sonal.santan@gmail.com>
> ---
> Changes since v1:
> * Fixed warnings: Missing a blank line after declarations
> ---
> Documentation/laptops/00-INDEX | 4 +-
> Documentation/laptops/freefall.c | 177 ++++++++++++++++++++++++++++++++++++++
> Documentation/laptops/hpfall.c | 146 -------------------------------
> 3 files changed, 179 insertions(+), 148 deletions(-)
> create mode 100644 Documentation/laptops/freefall.c
> delete mode 100644 Documentation/laptops/hpfall.c
Acked-by: Pavel Machek <pavel@ucw.cz>
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2] Documentation: Rename hpfall.c => freefall.c, fixes for Dell
2014-06-14 8:53 ` Pavel Machek
@ 2014-06-16 11:55 ` Pali Rohár
2014-06-27 19:08 ` Pali Rohár
0 siblings, 1 reply; 20+ messages in thread
From: Pali Rohár @ 2014-06-16 11:55 UTC (permalink / raw)
To: Matthew Garrett, Randy Dunlap
Cc: Pavel Machek, Valdis Kletnieks, linux-doc, linux-kernel,
platform-driver-x86, Sonal Santan
[-- Attachment #1: Type: Text/Plain, Size: 1346 bytes --]
On Saturday 14 June 2014 10:53:29 Pavel Machek wrote:
> On Wed 2014-06-11 10:02:07, Pali Roh?r wrote:
> > Dell kernel driver dell-smo8800 provides same freefall
> > interface as hp_accel so program hpfall.c works also on
> > Dell laptops. So rename it to freefall.c.
> >
> > Dell driver does not provide hp::hddprotect led so make sure
> > that freefall.c works also if hp::hddprotect does not exist
> > in sysfs.
> >
> > Additionally write info to syslog.
> >
> > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > Cc: Sonal Santan <sonal.santan@gmail.com>
> > ---
> > Changes since v1:
> > * Fixed warnings: Missing a blank line after declarations
> > ---
> >
> > Documentation/laptops/00-INDEX | 4 +-
> > Documentation/laptops/freefall.c | 177
> > ++++++++++++++++++++++++++++++++++++++
> > Documentation/laptops/hpfall.c | 146
> > ------------------------------- 3 files changed, 179
> > insertions(+), 148 deletions(-) create mode 100644
> > Documentation/laptops/freefall.c delete mode 100644
> > Documentation/laptops/hpfall.c
>
> Acked-by: Pavel Machek <pavel@ucw.cz>
>
> Pavel
Randy, Matthew: PING
first patch which implementing dell-smo8800.ko was merged, but
this patch which updating documentation and fall daemon *not*.
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2] Documentation: Rename hpfall.c => freefall.c, fixes for Dell
2014-06-16 11:55 ` Pali Rohár
@ 2014-06-27 19:08 ` Pali Rohár
2014-06-27 20:25 ` Randy Dunlap
0 siblings, 1 reply; 20+ messages in thread
From: Pali Rohár @ 2014-06-27 19:08 UTC (permalink / raw)
To: Matthew Garrett
Cc: Randy Dunlap, Pavel Machek, Valdis Kletnieks, linux-doc,
linux-kernel, platform-driver-x86, Sonal Santan
[-- Attachment #1: Type: Text/Plain, Size: 1572 bytes --]
On Monday 16 June 2014 13:55:03 Pali Rohár wrote:
> On Saturday 14 June 2014 10:53:29 Pavel Machek wrote:
> > On Wed 2014-06-11 10:02:07, Pali Roh?r wrote:
> > > Dell kernel driver dell-smo8800 provides same freefall
> > > interface as hp_accel so program hpfall.c works also on
> > > Dell laptops. So rename it to freefall.c.
> > >
> > > Dell driver does not provide hp::hddprotect led so make
> > > sure that freefall.c works also if hp::hddprotect does
> > > not exist in sysfs.
> > >
> > > Additionally write info to syslog.
> > >
> > > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > > Cc: Sonal Santan <sonal.santan@gmail.com>
> > > ---
> > > Changes since v1:
> > > * Fixed warnings: Missing a blank line after declarations
> > > ---
> > >
> > > Documentation/laptops/00-INDEX | 4 +-
> > > Documentation/laptops/freefall.c | 177
> > > ++++++++++++++++++++++++++++++++++++++
> > > Documentation/laptops/hpfall.c | 146
> > > ------------------------------- 3 files changed, 179
> > > insertions(+), 148 deletions(-) create mode 100644
> > > Documentation/laptops/freefall.c delete mode 100644
> > > Documentation/laptops/hpfall.c
> >
> > Acked-by: Pavel Machek <pavel@ucw.cz>
> >
> > Pavel
>
> Randy, Matthew: PING
>
> first patch which implementing dell-smo8800.ko was merged, but
> this patch which updating documentation and fall daemon *not*.
PING.
What is with this patch? Why was still not set to Linus in doc or
platform pull request?
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2] Documentation: Rename hpfall.c => freefall.c, fixes for Dell
2014-06-27 19:08 ` Pali Rohár
@ 2014-06-27 20:25 ` Randy Dunlap
0 siblings, 0 replies; 20+ messages in thread
From: Randy Dunlap @ 2014-06-27 20:25 UTC (permalink / raw)
To: Pali Rohár, Matthew Garrett
Cc: Pavel Machek, Valdis Kletnieks, linux-doc, linux-kernel,
platform-driver-x86, Sonal Santan
On 06/27/14 12:08, Pali Rohár wrote:
> On Monday 16 June 2014 13:55:03 Pali Rohár wrote:
>> On Saturday 14 June 2014 10:53:29 Pavel Machek wrote:
>>> On Wed 2014-06-11 10:02:07, Pali Roh?r wrote:
>>>> Dell kernel driver dell-smo8800 provides same freefall
>>>> interface as hp_accel so program hpfall.c works also on
>>>> Dell laptops. So rename it to freefall.c.
>>>>
>>>> Dell driver does not provide hp::hddprotect led so make
>>>> sure that freefall.c works also if hp::hddprotect does
>>>> not exist in sysfs.
>>>>
>>>> Additionally write info to syslog.
>>>>
>>>> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
>>>> Cc: Sonal Santan <sonal.santan@gmail.com>
>>>> ---
>>>> Changes since v1:
>>>> * Fixed warnings: Missing a blank line after declarations
>>>> ---
>>>>
>>>> Documentation/laptops/00-INDEX | 4 +-
>>>> Documentation/laptops/freefall.c | 177
>>>> ++++++++++++++++++++++++++++++++++++++
>>>> Documentation/laptops/hpfall.c | 146
>>>> ------------------------------- 3 files changed, 179
>>>> insertions(+), 148 deletions(-) create mode 100644
>>>> Documentation/laptops/freefall.c delete mode 100644
>>>> Documentation/laptops/hpfall.c
>>>
>>> Acked-by: Pavel Machek <pavel@ucw.cz>
>>>
>>> Pavel
>>
>> Randy, Matthew: PING
>>
>> first patch which implementing dell-smo8800.ko was merged, but
>> this patch which updating documentation and fall daemon *not*.
>
> PING.
>
> What is with this patch? Why was still not set to Linus in doc or
> platform pull request?
>
Sorry, I was on vacation this week, but that does not explain the previous
delays.
I'll merge it sometime this weekend.
Thanks.
--
~Randy
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2] Documentation: Rename hpfall.c => freefall.c, fixes for Dell
2014-06-11 8:02 ` [PATCH v2] " Pali Rohár
2014-06-14 8:53 ` Pavel Machek
@ 2014-06-29 2:12 ` Randy Dunlap
2014-07-07 18:15 ` Pali Rohár
1 sibling, 1 reply; 20+ messages in thread
From: Randy Dunlap @ 2014-06-29 2:12 UTC (permalink / raw)
To: Pali Rohár, Matthew Garrett, Pavel Machek, Valdis Kletnieks
Cc: linux-doc, linux-kernel, platform-driver-x86, Sonal Santan
Hi,
This should really be done as 2 separate patches:
One to move/rename the file and one to make the changes/additions
to it for DELL.
Can you resend it as 2 patches like that, please?
Thanks... and sorry for the delay.
On 06/11/14 01:02, Pali Rohár wrote:
> Dell kernel driver dell-smo8800 provides same freefall interface as hp_accel so
> program hpfall.c works also on Dell laptops. So rename it to freefall.c.
>
> Dell driver does not provide hp::hddprotect led so make sure that freefall.c
> works also if hp::hddprotect does not exist in sysfs.
>
> Additionally write info to syslog.
>
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> Cc: Sonal Santan <sonal.santan@gmail.com>
> ---
> Changes since v1:
> * Fixed warnings: Missing a blank line after declarations
> ---
> Documentation/laptops/00-INDEX | 4 +-
> Documentation/laptops/freefall.c | 177 ++++++++++++++++++++++++++++++++++++++
> Documentation/laptops/hpfall.c | 146 -------------------------------
> 3 files changed, 179 insertions(+), 148 deletions(-)
> create mode 100644 Documentation/laptops/freefall.c
> delete mode 100644 Documentation/laptops/hpfall.c
--
~Randy
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2] Documentation: Rename hpfall.c => freefall.c, fixes for Dell
2014-06-29 2:12 ` Randy Dunlap
@ 2014-07-07 18:15 ` Pali Rohár
2014-07-08 22:49 ` Randy Dunlap
0 siblings, 1 reply; 20+ messages in thread
From: Pali Rohár @ 2014-07-07 18:15 UTC (permalink / raw)
To: Randy Dunlap
Cc: Matthew Garrett, Pavel Machek, Valdis Kletnieks, linux-doc,
linux-kernel, platform-driver-x86, Sonal Santan
[-- Attachment #1: Type: Text/Plain, Size: 1433 bytes --]
Hello Randy, sorry but now I do not have any free time...
On Sunday 29 June 2014 04:12:17 Randy Dunlap wrote:
> Hi,
>
> This should really be done as 2 separate patches:
> One to move/rename the file and one to make the
> changes/additions to it for DELL.
>
> Can you resend it as 2 patches like that, please?
>
> Thanks... and sorry for the delay.
>
> On 06/11/14 01:02, Pali Rohár wrote:
> > Dell kernel driver dell-smo8800 provides same freefall
> > interface as hp_accel so program hpfall.c works also on
> > Dell laptops. So rename it to freefall.c.
> >
> > Dell driver does not provide hp::hddprotect led so make sure
> > that freefall.c works also if hp::hddprotect does not exist
> > in sysfs.
> >
> > Additionally write info to syslog.
> >
> > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > Cc: Sonal Santan <sonal.santan@gmail.com>
> > ---
> > Changes since v1:
> > * Fixed warnings: Missing a blank line after declarations
> > ---
> >
> > Documentation/laptops/00-INDEX | 4 +-
> > Documentation/laptops/freefall.c | 177
> > ++++++++++++++++++++++++++++++++++++++
> > Documentation/laptops/hpfall.c | 146
> > ------------------------------- 3 files changed, 179
> > insertions(+), 148 deletions(-) create mode 100644
> > Documentation/laptops/freefall.c delete mode 100644
> > Documentation/laptops/hpfall.c
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2] Documentation: Rename hpfall.c => freefall.c, fixes for Dell
2014-07-07 18:15 ` Pali Rohár
@ 2014-07-08 22:49 ` Randy Dunlap
0 siblings, 0 replies; 20+ messages in thread
From: Randy Dunlap @ 2014-07-08 22:49 UTC (permalink / raw)
To: Pali Rohár
Cc: Matthew Garrett, Pavel Machek, Valdis Kletnieks, linux-doc,
linux-kernel, platform-driver-x86, Sonal Santan
On 07/07/2014 11:15 AM, Pali Rohár wrote:
> Hello Randy, sorry but now I do not have any free time...
a. It took me 7 minutes to split the patch into 2 patches as I requested.
b. In the future please do it like that.
c. Pavel asked me to go ahead and apply the patch. I will do that since
I have a few other patches to hpfall.c (freefall.c) that need to be applied.
> On Sunday 29 June 2014 04:12:17 Randy Dunlap wrote:
>> Hi,
>>
>> This should really be done as 2 separate patches:
>> One to move/rename the file and one to make the
>> changes/additions to it for DELL.
>>
>> Can you resend it as 2 patches like that, please?
>>
>> Thanks... and sorry for the delay.
>>
>> On 06/11/14 01:02, Pali Rohár wrote:
>>> Dell kernel driver dell-smo8800 provides same freefall
>>> interface as hp_accel so program hpfall.c works also on
>>> Dell laptops. So rename it to freefall.c.
>>>
>>> Dell driver does not provide hp::hddprotect led so make sure
>>> that freefall.c works also if hp::hddprotect does not exist
>>> in sysfs.
>>>
>>> Additionally write info to syslog.
>>>
>>> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
>>> Cc: Sonal Santan <sonal.santan@gmail.com>
>>> ---
>>> Changes since v1:
>>> * Fixed warnings: Missing a blank line after declarations
>>> ---
>>>
>>> Documentation/laptops/00-INDEX | 4 +-
>>> Documentation/laptops/freefall.c | 177
>>> ++++++++++++++++++++++++++++++++++++++
>>> Documentation/laptops/hpfall.c | 146
>>> ------------------------------- 3 files changed, 179
>>> insertions(+), 148 deletions(-) create mode 100644
>>> Documentation/laptops/freefall.c delete mode 100644
>>> Documentation/laptops/hpfall.c
>
--
~Randy
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2014-07-08 22:49 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-03 10:47 [PATCH 0/2] Dell Latitude freefall driver (ACPI SMO8800/SMO8810) Pali Rohár
2014-05-03 10:47 ` [PATCH 1/2] platform: x86: dell-smo8800: " Pali Rohár
2014-05-07 16:29 ` One Thousand Gnomes
2014-05-20 7:00 ` Valdis.Kletnieks
2014-05-20 8:56 ` Pali Rohár
2014-05-20 18:02 ` Valdis.Kletnieks
2014-05-20 18:10 ` Pali Rohár
2014-05-20 18:36 ` Valdis.Kletnieks
2014-05-22 11:15 ` [PATCH v2] " Pali Rohár
2014-05-28 13:31 ` Pali Rohár
2014-06-06 10:24 ` Pali Rohár
2014-05-03 10:47 ` [PATCH 2/2] Documentation: Rename hpfall.c => freefall.c, fixes for Dell Pali Rohár
2014-06-11 8:02 ` [PATCH v2] " Pali Rohár
2014-06-14 8:53 ` Pavel Machek
2014-06-16 11:55 ` Pali Rohár
2014-06-27 19:08 ` Pali Rohár
2014-06-27 20:25 ` Randy Dunlap
2014-06-29 2:12 ` Randy Dunlap
2014-07-07 18:15 ` Pali Rohár
2014-07-08 22:49 ` Randy Dunlap
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.