Skip to contentSkip to conversation

Support for isa1200 haptic chip

PATCH In review Mohan Pallaka 4 participants 8 messages May 13, 2011 – May 17, 2011

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Support for isa1200 haptic chip

This patchset includes a __weak attributed pwm apis in pwm.h and a ff-memless based isa1200 driver.

ISA1200 chip can operate in two modes and if the chip has been configured for pwm-generation mode, which doesn't use pwm standard apis then it'd encounter compilation errors if the host doesn't support PWM. This driver is based on Park's isa1200 driver that uses haptic class.

Kyungmin Park (1):
input: misc: Add support for isa1200 chip

Mohan Pallaka (1):
pwm: Add __weak attributed functions for pwm operations

 drivers/input/misc/Kconfig    |   12 +
 drivers/input/misc/Makefile   |    1 +
 drivers/input/misc/isa1200.c  |  442 +++++++++++++++++++++++++++++++++++++++++
 include/linux/input/isa1200.h |   46 +++++
 include/linux/pwm.h           |   12 +-
 5 files changed, 508 insertions(+), 5 deletions(-)
 create mode 100644 drivers/input/misc/isa1200.c
 create mode 100644 include/linux/input/isa1200.h
Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#1 lore raw

PATCH 1/2 pwm: Add __weak attributed functions for pwm operations

For chip drivers that support both pwm and non-pwm modes would encounter compilation errors if the platform doesn't have support for pwm though the chip is programmed to work in non-pwm mode. Add __weak attributed pwm functions to avoid compilation issues in these scenarios.

Change-Id Ia507bf659d4d67d71f135012e7d919aca6c45c6c
---
 include/linux/pwm.h |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
include/linux/pwm.h +7 -5
index 7c77575..e0c8c3f 100644
@@ -3,29 +3,31 @@
 
 struct pwm_device;
 
+/* Add __weak functions to support PWM */
+
 /*
  * pwm_request - request a PWM device
  */
-struct pwm_device *pwm_request(int pwm_id, const char *label);
+struct pwm_device __weak *pwm_request(int pwm_id, const char *label);
 
 /*
  * pwm_free - free a PWM device
  */
-void pwm_free(struct pwm_device *pwm);
+void __weak pwm_free(struct pwm_device *pwm);
 
 /*
  * pwm_config - change a PWM device configuration
  */
-int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns);
+int __weak pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns);
 
 /*
  * pwm_enable - start a PWM output toggling
  */
-int pwm_enable(struct pwm_device *pwm);
+int __weak pwm_enable(struct pwm_device *pwm);
 
 /*
  * pwm_disable - stop a PWM output toggling
  */
-void pwm_disable(struct pwm_device *pwm);
+void __weak pwm_disable(struct pwm_device *pwm);
 
 #endif /* __LINUX_PWM_H */
Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#7 lore raw

PATCH 2/2 input: misc: Add support for isa1200 chip

In reply to Mohan Pallaka

From: Kyungmin Park <[email protected]>

isa1200 chip can be used to generate vibrations to indicate silent alerts, providing gaming haptic actions or vibrations in response to touches. It can operate in two modes, pwm generation and pwm input mode. Pwm generation mode requires external clock and pwm input mode needs the pwm signal to be given as input to the chip.

This patch has been derived based on Kyungmin Park's haptic framework patches at http://lkml.org/lkml/2009/10/7/50 . Park's isa1200 driver registers to the haptic class, which is also introduced as part of the same patch series, and userspace will operate the vibrator through exported sysfs entries. This version supports only pwm input mode.

This derived patch converts the driver from haptic framework to the Linux supported force feeback framework. It also supports the chip operation in both pwm input and generation modes.

Change-Id If253c71e833e629431a35864e33824d8d6dadb35
---
 drivers/input/misc/Kconfig    |   12 +
 drivers/input/misc/Makefile   |    1 +
 drivers/input/misc/isa1200.c  |  442 +++++++++++++++++++++++++++++++++++++++++
 include/linux/input/isa1200.h |   46 +++++
 4 files changed, 501 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/misc/isa1200.c
 create mode 100644 include/linux/input/isa1200.h
drivers/input/misc/Kconfig +12 -0
index f9cf088..9fd762d 100644
@@ -302,6 +302,18 @@ config HP_SDC_RTC
 	  Say Y here if you want to support the built-in real time clock
 	  of the HP SDC controller.
 
+config INPUT_ISA1200
+	tristate "ISA1200 haptic support"
+	depends on I2C
+	select INPUT_FF_MEMLESS
+	help
+	  ISA1200 is a high performance enhanced haptic chip.
+	  Say Y here if you want to support ISA1200 connected via I2C,
+	  and select N if you are unsure.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called isa1200.
+
 config INPUT_PCF50633_PMU
 	tristate "PCF50633 PMU events"
 	depends on MFD_PCF50633
drivers/input/misc/Makefile +1 -0
index e3f7984..47f74f7 100644
@@ -23,6 +23,7 @@ obj-$(CONFIG_INPUT_CMA3000_I2C)		+= cma3000_d0x_i2c.o
 obj-$(CONFIG_INPUT_COBALT_BTNS)		+= cobalt_btns.o
 obj-$(CONFIG_INPUT_DM355EVM)		+= dm355evm_keys.o
 obj-$(CONFIG_HP_SDC_RTC)		+= hp_sdc_rtc.o
+obj-$(CONFIG_INPUT_ISA1200)		+= isa1200.o
 obj-$(CONFIG_INPUT_IXP4XX_BEEPER)	+= ixp4xx-beeper.o
 obj-$(CONFIG_INPUT_KEYSPAN_REMOTE)	+= keyspan_remote.o
 obj-$(CONFIG_INPUT_M68K_BEEP)		+= m68kspkr.o
drivers/input/misc/isa1200.c new file +442 -0

442 lines not on this page · raw message

include/linux/input/isa1200.h new file +46 -0

46 lines not on this page · raw message

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#2 lore raw

Re: [PATCH 1/2] pwm: Add __weak attributed functions for pwm operations

In reply to Mohan Pallaka
Quoted 7 lines · Mohan Pallaka

For chip drivers that support both pwm and non-pwm modes would encounter compilation errors if the platform doesn't have support for pwm though the chip is programmed to work in non-pwm mode. Add __weak attributed pwm functions to avoid compilation issues in these scenarios.

Change-Id: Ia507bf659d4d67d71f135012e7d919aca6c45c6c

Make sure you remove these 'Change-Id' lines before sending patches. They aren't supposed to be in the kernel since they refer to an internal server, and aren't useful to anyone else.

David

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
maintainer
#3 lore raw

Re: [PATCH 1/2] pwm: Add __weak attributed functions for pwm operations

In reply to Mohan Pallaka
Quoted 6 lines · Mohan Pallaka

For chip drivers that support both pwm and non-pwm modes would encounter compilation errors if the platform doesn't have support for pwm though the chip is programmed to work in non-pwm mode. Add __weak attributed pwm functions to avoid compilation issues in these scenarios.

Russell,

You seem to have authored pwm.h, do you have any objections to this change?

Thanks!

Quoted 51 lines
Change-Id Ia507bf659d4d67d71f135012e7d919aca6c45c6c
---
 include/linux/pwm.h |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
include/linux/pwm.h +7 -5
index 7c77575..e0c8c3f 100644
@@ -3,29 +3,31 @@
 
 struct pwm_device;
 
+/* Add __weak functions to support PWM */
+
 /*
  * pwm_request - request a PWM device
  */
-struct pwm_device *pwm_request(int pwm_id, const char *label);
+struct pwm_device __weak *pwm_request(int pwm_id, const char *label);
 
 /*
  * pwm_free - free a PWM device
  */
-void pwm_free(struct pwm_device *pwm);
+void __weak pwm_free(struct pwm_device *pwm);
 
 /*
  * pwm_config - change a PWM device configuration
  */
-int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns);
+int __weak pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns);
 
 /*
  * pwm_enable - start a PWM output toggling
  */
-int pwm_enable(struct pwm_device *pwm);
+int __weak pwm_enable(struct pwm_device *pwm);
 
 /*
  * pwm_disable - stop a PWM output toggling
  */
-void pwm_disable(struct pwm_device *pwm);
+void __weak pwm_disable(struct pwm_device *pwm);
 
 #endif /* __LINUX_PWM_H */
Signature · 3 lines
-- 
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Signature · 1 line
Dmitry
maintainer
#6 lore raw

Re: [PATCH 1/2] pwm: Add __weak attributed functions for pwm operations

In reply to Mohan Pallaka
Quoted 6 lines · Mohan Pallaka

For chip drivers that support both pwm and non-pwm modes would encounter compilation errors if the platform doesn't have support for pwm though the chip is programmed to work in non-pwm mode. Add __weak attributed pwm functions to avoid compilation issues in these scenarios.

Russell,

You seem to have authored pwm.h, do you have any objections to this change?

Thanks!

Quoted 51 lines
Change-Id Ia507bf659d4d67d71f135012e7d919aca6c45c6c
---
 include/linux/pwm.h |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
include/linux/pwm.h +7 -5
index 7c77575..e0c8c3f 100644
@@ -3,29 +3,31 @@
 
 struct pwm_device;
 
+/* Add __weak functions to support PWM */
+
 /*
  * pwm_request - request a PWM device
  */
-struct pwm_device *pwm_request(int pwm_id, const char *label);
+struct pwm_device __weak *pwm_request(int pwm_id, const char *label);
 
 /*
  * pwm_free - free a PWM device
  */
-void pwm_free(struct pwm_device *pwm);
+void __weak pwm_free(struct pwm_device *pwm);
 
 /*
  * pwm_config - change a PWM device configuration
  */
-int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns);
+int __weak pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns);
 
 /*
  * pwm_enable - start a PWM output toggling
  */
-int pwm_enable(struct pwm_device *pwm);
+int __weak pwm_enable(struct pwm_device *pwm);
 
 /*
  * pwm_disable - stop a PWM output toggling
  */
-void pwm_disable(struct pwm_device *pwm);
+void __weak pwm_disable(struct pwm_device *pwm);
 
 #endif /* __LINUX_PWM_H */
Signature · 3 lines
-- 
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Signature · 1 line
Dmitry
#4 lore raw

Re: [PATCH 1/2] pwm: Add __weak attributed functions for pwm operations

In reply to Dmitry Torokhov
Quoted 8 lines · Dmitry Torokhov
Quoted 6 lines · Mohan Pallaka

For chip drivers that support both pwm and non-pwm modes would encounter compilation errors if the platform doesn't have support for pwm though the chip is programmed to work in non-pwm mode. Add __weak attributed pwm functions to avoid compilation issues in these scenarios.

Quoted 4 lines

Russell,

You seem to have authored pwm.h, do you have any objections to this change?

This seems to be a recipe for an oops. Have a look at how linux/regulator/consumer.h deals with this kind of problem, and notice that we have CONFIG_HAVE_PWM to indicate whether this interface is supported or not.

#5 lore raw

Re: [PATCH 1/2] pwm: Add __weak attributed functions for pwm operations

Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Dmitry Torokhov
Quoted 6 lines · Mohan Pallaka

For chip drivers that support both pwm and non-pwm modes would encounter compilation errors if the platform doesn't have support for pwm though the chip is programmed to work in non-pwm mode. Add __weak attributed pwm functions to avoid compilation issues in these scenarios.

Quoted 8 lines
Quoted 4 lines

Russell,

You seem to have authored pwm.h, do you have any objections to this change?

This seems to be a recipe for an oops. Have a look at how linux/regulator/consumer.h deals with this kind of problem, and notice that we have CONFIG_HAVE_PWM to indicate whether this interface is supported or not.

Thanks for the suggestion. I'll upload a new patch.

--Mohan.