Skip to contentSkip to conversation

Haptic: add haptic class

PATCH In review Kyungmin Park 4 participants 6 messages Oct 7, 2009 – Oct 14, 2009 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 Haptic: add haptic class

New haptic class support.
This class handles the haptic devices.

---
 drivers/haptic/Kconfig        |   14 +++
 drivers/haptic/Makefile       |    2 +
 drivers/haptic/haptic-class.c |  255 +++++++++++++++++++++++++++++++++++++++++
 drivers/haptic/haptic.h       |   35 ++++++
 include/linux/haptic.h        |   85 ++++++++++++++
 5 files changed, 391 insertions(+), 0 deletions(-)
 create mode 100644 drivers/haptic/Kconfig
 create mode 100644 drivers/haptic/Makefile
 create mode 100644 drivers/haptic/haptic-class.c
 create mode 100644 drivers/haptic/haptic.h
 create mode 100644 include/linux/haptic.h
drivers/haptic/Kconfig new file +14 -0
new file mode 100644
index 0000000..656b022
@@ -0,0 +1,14 @@
+menuconfig HAPTIC
+	bool "Haptic support"
+	help
+	  Say Y to enable haptic support. It enables the haptic and controls
+	  from userspace.
+
+if HAPTIC
+
+config HAPTIC_CLASS
+	tristate "Haptic Class Support"
+	help
+	  This option enables the haptic sysfs class in /sys/class/haptic.
+
+endif	# HAPTIC
drivers/haptic/Makefile new file +2 -0
new file mode 100644
index 0000000..d30f8cd
@@ -0,0 +1,2 @@
+# Haptic Core
+obj-$(CONFIG_HAPTIC_CLASS)		+= haptic-class.o
drivers/haptic/haptic-class.c new file +255 -0

255 lines not on this page · raw message

drivers/haptic/haptic.h new file +35 -0
new file mode 100644
index 0000000..888aaa3
@@ -0,0 +1,35 @@
+/*
+ *  Haptic Core
+ *
+ *  Copyright (C) 2008 Samsung Electronics
+ *  Kyungmin Park <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#ifndef __HAPTIC_H_INCLUDED
+#define __HAPTIC_H_INCLUDED
+
+#include <linux/device.h>
+#include <linux/rwsem.h>
+#include <linux/haptic.h>
+
+static inline void haptic_set_value(struct haptic_classdev *haptic_cdev,
+					enum haptic_value value)
+{
+	if (value > HAPTIC_FULL)
+		value = HAPTIC_FULL;
+	haptic_cdev->value = value;
+	if (!(haptic_cdev->flags & HAPTIC_SUSPENDED))
+		haptic_cdev->set(haptic_cdev, value);
+}
+
+static inline int haptic_get_value(struct haptic_classdev *haptic_cdev)
+{
+	return haptic_cdev->value;
+}
+
+#endif	/* __HAPTIC_H_INCLUDED */
include/linux/haptic.h new file +85 -0

85 lines not on this page · raw message

Signature · 1 line
1.5.3.3
#2 lore raw
In reply to Kyungmin Park
Quoted 2 lines · Kyungmin Park

New haptic class support.
This class handles the haptic devices.

I'm wondering why a haptic class is needed when there is force feedback support. Admittedly, I don't know the force feedback implementation too well, but could someone please enlighten me on this? Am I missing something here?

I see haptics as simple force feedback, just with (usually) small force and short duration. There are devices out there doing haptics using vibra motors, which I think would be limited if implemented using this haptics class driver. Would it be somehow problematic interfacing with the simple haptic hardware using the force feedback API?

BR,
Jani.

#3 lore raw

Hi Kyungmin, Dmitry,

Quoted 9 lines · Jani Nikula
Quoted 2 lines · Kyungmin Park

New haptic class support.
This class handles the haptic devices.

I'm wondering why a haptic class is needed when there is force feedback support. Admittedly, I don't know the force feedback implementation too well, but could someone please enlighten me on this? Am I missing something here?

Quoted 6 lines

I see haptics as simple force feedback, just with (usually) small force and short duration. There are devices out there doing haptics using vibra motors, which I think would be limited if implemented using this haptics class driver. Would it be somehow problematic interfacing with the simple haptic hardware using the force feedback API?

Please share your inputs on ff_device usage instead of haptics class. I think Dmitry could add some points here as I don't see much users of ff_device and I don't see any embedded device (like mobile) using it.

Signature · 3 lines
---Trilok Soni
http://triloksoni.wordpress.com
http://www.linkedin.com/in/triloksoni
#4 lore raw
Quoted 20 lines · Trilok Soni

Hi Kyungmin, Dmitry,

Quoted 9 lines · Jani Nikula
Quoted 2 lines · Kyungmin Park

New haptic class support.
This class handles the haptic devices.

I'm wondering why a haptic class is needed when there is force feedback support. Admittedly, I don't know the force feedback implementation too well, but could someone please enlighten me on this? Am I missing something here?

Quoted 6 lines

I see haptics as simple force feedback, just with (usually) small force and short duration. There are devices out there doing haptics using vibra motors, which I think would be limited if implemented using this haptics class driver. Would it be somehow problematic interfacing with the simple haptic hardware using the force feedback API?

Quoted 4 lines

Please share your inputs on ff_device usage instead of haptics class. I think Dmitry could add some points here as I don't see much users of ff_device and I don't see any embedded device (like mobile) using it.

Using ff_device was considered when Jiri Slaby was trying to merge PHANTOM driver, bit for that device FF infrastructure was too limited and this it was decided that phantom would need a special userpsace that knows what it is and how to handle it.

The curtrent haptic class seems to be bery limited and may be served via FF (constant or other effect in a single direction) but I don't know what kind of plans you have to extend it. I guess it warrants another discussion.

Signature · 1 line
Dmitry
#5 lore raw

Hi Dmitry,

Quoted 31 lines · Dmitry Torokhov
Quoted 20 lines · Trilok Soni

Hi Kyungmin, Dmitry,

Quoted 9 lines · Jani Nikula
Quoted 2 lines · Kyungmin Park

New haptic class support.
This class handles the haptic devices.

I'm wondering why a haptic class is needed when there is force feedback support. Admittedly, I don't know the force feedback implementation too well, but could someone please enlighten me on this? Am I missing something here?

Quoted 6 lines

I see haptics as simple force feedback, just with (usually) small force and short duration. There are devices out there doing haptics using vibra motors, which I think would be limited if implemented using this haptics class driver. Would it be somehow problematic interfacing with the simple haptic hardware using the force feedback API?

Quoted 4 lines

Please share your inputs on ff_device usage instead of haptics class. I think Dmitry could add some points here as I don't see much users of ff_device and I don't see any embedded device (like mobile) using it.

Using ff_device was considered when Jiri Slaby was trying to merge PHANTOM driver, bit for that device FF infrastructure was too limited and this it was decided that phantom would need a special userpsace that knows what it is and how to handle it.

Quoted 4 lines

The curtrent haptic class seems to be bery limited and may be served via FF (constant or other effect in a single direction) but I don't know what kind of plans you have to extend it. I guess it warrants another discussion.

Probably Kyungmin is the right person to analyze the ff_device infrastructure in input_device framework and see it fits haptics class or not. As per me, for the mobile like applications current haptics class should meet the needs.

Signature · 3 lines
---Trilok Soni
http://triloksoni.wordpress.com
http://www.linkedin.com/in/triloksoni