Re: [PATCH 1/2] Input: add regulator haptic driver

2014-11-30 Thread Jaewon Kim

Hi Mark,

2014년 11월 28일 21:50에 Mark Brown 이(가) 쓴 글:

On Thu, Nov 20, 2014 at 10:31:39PM +0900, Jaewon Kim wrote:


+   haptic-regulator = devm_regulator_get(pdev-dev, haptic);
+   if (IS_ERR(haptic-regulator)) {
+   dev_err(pdev-dev, failed to get regulator\n);
+   return PTR_ERR(haptic-regulator);
+   }

This needs to be _get_exclusive() - the driver will be broken if
something else shares the regualtor since it relies on both enabling and
disabling the regulator and on setting the voltage for effects.  It's
not like a power supply where leaving the device powered when it could
be off is going to have no effect, if the power is left on then the
haptic motor will continue to operate.


Thanks to review my patch.

Haptic regulator has to only be used in this driver.
So, it is right to change like your advice.
I will fix next version.

Thanks
Jaewon Kim.
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] Input: add regulator haptic driver

2014-11-20 Thread Jaewon Kim
This patch adds support for haptic driver controlled by
voltage of regulator. And this driver support for
Force Feedback interface from input framework

Signed-off-by: Jaewon Kim jaewon02@samsung.com
Signed-off-by: Hyunhee Kim hyunhee@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
---
 .../devicetree/bindings/input/regulator-haptic.txt |   24 ++
 drivers/input/misc/Kconfig |   11 +
 drivers/input/misc/Makefile|1 +
 drivers/input/misc/regulator-haptic.c  |  241 
 4 files changed, 277 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/regulator-haptic.txt
 create mode 100644 drivers/input/misc/regulator-haptic.c

diff --git a/Documentation/devicetree/bindings/input/regulator-haptic.txt 
b/Documentation/devicetree/bindings/input/regulator-haptic.txt
new file mode 100644
index 000..9f60e17
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/regulator-haptic.txt
@@ -0,0 +1,24 @@
+* Requlator Haptic Device Tree Bindings
+
+The regulator haptic driver controlled by voltage of regulator.
+This driver implemented via Force Feedback interface.
+
+Required Properties:
+ - compatible : Should be regulator-haptic
+ - haptic-supply : Power supply for the haptic motor.
+   [*] refer Documentation/devicetree/bindings/regulator/regulator.txt
+
+ - max-microvolt : The maximum voltage value supplied to haptic motor.
+   [The unit of the voltage is a micro]
+
+ - min-microvolt : The minimum voltage value in which haptic motor reacts.
+   [The unit of the voltage is a micro]
+
+Example:
+
+   regulator-haptic {
+   compatible = regulator-haptic;
+   haptic-supply = motor_regulator;
+   max-microvolt = 270;
+   min-microvolt = 110;
+   };
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 23297ab..e5e556d 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -394,6 +394,17 @@ config INPUT_CM109
  To compile this driver as a module, choose M here: the module will be
  called cm109.
 
+config INPUT_REGULATOR_HAPTIC
+   tristate regulator haptics support
+   select INPUT_FF_MEMLESS
+   help
+ This option enables device driver support for the haptic controlled
+ by regulator. This driver supports ff-memless interface
+ from input framework.
+
+ To compile this driver as a module, choose M here: the
+ module will be called regulator-haptic.
+
 config INPUT_RETU_PWRBUTTON
tristate Retu Power button Driver
depends on MFD_RETU
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 19c7603..1f135af 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -53,6 +53,7 @@ obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY)   += pmic8xxx-pwrkey.o
 obj-$(CONFIG_INPUT_POWERMATE)  += powermate.o
 obj-$(CONFIG_INPUT_PWM_BEEPER) += pwm-beeper.o
 obj-$(CONFIG_INPUT_RB532_BUTTON)   += rb532_button.o
+obj-$(CONFIG_INPUT_REGULATOR_HAPTIC)   += regulator-haptic.o
 obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o
 obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER)+= rotary_encoder.o
 obj-$(CONFIG_INPUT_SGI_BTNS)   += sgi_btns.o
diff --git a/drivers/input/misc/regulator-haptic.c 
b/drivers/input/misc/regulator-haptic.c
new file mode 100644
index 000..1a83ecb
--- /dev/null
+++ b/drivers/input/misc/regulator-haptic.c
@@ -0,0 +1,241 @@
+/*
+ * Regulator haptic driver
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Author: Jaewon Kim jaewon02@samsung.com
+ * Author: Hyunhee Kim hyunhee@samsung.com
+ *
+ * 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.
+ */
+
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/input.h
+#include linux/slab.h
+#include linux/regulator/consumer.h
+#include linux/of.h
+
+#define MAX_MAGNITUDE_SHIFT16
+
+struct regulator_haptic {
+   struct device *dev;
+   struct input_dev *input_dev;
+   struct regulator *regulator;
+   struct work_struct work;
+
+   bool enabled;
+   bool suspend_state;
+   unsigned int max_volt;
+   unsigned int min_volt;
+   unsigned int intensity;
+   unsigned int magnitude;
+};
+
+static void regulator_haptic_enable(struct regulator_haptic *haptic)
+{
+   int error;
+
+   if (haptic-enabled)
+   return;
+
+   error = regulator_enable(haptic-regulator);
+   if (error) {
+   dev_err(haptic-dev, cannot enable regulator\n);
+   return;
+   }
+
+   haptic-enabled = true;
+}
+
+static void regulator_haptic_disable(struct regulator_haptic *haptic)
+{
+   int error;
+
+   if (!haptic-enabled)
+

Re: [PATCH 1/2] Input: add regulator haptic driver

2014-11-20 Thread Pankaj Dubey
Hi Jaewon,

On 20 November 2014 19:01, Jaewon Kim jaewon02@samsung.com wrote:
 This patch adds support for haptic driver controlled by
 voltage of regulator. And this driver support for
 Force Feedback interface from input framework

 Signed-off-by: Jaewon Kim jaewon02@samsung.com
 Signed-off-by: Hyunhee Kim hyunhee@samsung.com
 Acked-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
  .../devicetree/bindings/input/regulator-haptic.txt |   24 ++
  drivers/input/misc/Kconfig |   11 +
  drivers/input/misc/Makefile|1 +
  drivers/input/misc/regulator-haptic.c  |  241 
 
  4 files changed, 277 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/input/regulator-haptic.txt
  create mode 100644 drivers/input/misc/regulator-haptic.c

 diff --git a/Documentation/devicetree/bindings/input/regulator-haptic.txt 
 b/Documentation/devicetree/bindings/input/regulator-haptic.txt
 new file mode 100644
 index 000..9f60e17
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/input/regulator-haptic.txt
 @@ -0,0 +1,24 @@
 +* Requlator Haptic Device Tree Bindings
 +
 +The regulator haptic driver controlled by voltage of regulator.
 +This driver implemented via Force Feedback interface.
 +
 +Required Properties:
 + - compatible : Should be regulator-haptic
 + - haptic-supply : Power supply for the haptic motor.
 +   [*] refer Documentation/devicetree/bindings/regulator/regulator.txt
 +
 + - max-microvolt : The maximum voltage value supplied to haptic motor.
 +   [The unit of the voltage is a micro]
 +
 + - min-microvolt : The minimum voltage value in which haptic motor reacts.
 +   [The unit of the voltage is a micro]
 +
 +Example:
 +
 +   regulator-haptic {
 +   compatible = regulator-haptic;
 +   haptic-supply = motor_regulator;
 +   max-microvolt = 270;
 +   min-microvolt = 110;
 +   };
 diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
 index 23297ab..e5e556d 100644
 --- a/drivers/input/misc/Kconfig
 +++ b/drivers/input/misc/Kconfig
 @@ -394,6 +394,17 @@ config INPUT_CM109
   To compile this driver as a module, choose M here: the module will 
 be
   called cm109.

 +config INPUT_REGULATOR_HAPTIC
 +   tristate regulator haptics support
 +   select INPUT_FF_MEMLESS
 +   help
 + This option enables device driver support for the haptic controlled
 + by regulator. This driver supports ff-memless interface
 + from input framework.
 +
 + To compile this driver as a module, choose M here: the
 + module will be called regulator-haptic.
 +
  config INPUT_RETU_PWRBUTTON
 tristate Retu Power button Driver
 depends on MFD_RETU
 diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
 index 19c7603..1f135af 100644
 --- a/drivers/input/misc/Makefile
 +++ b/drivers/input/misc/Makefile
 @@ -53,6 +53,7 @@ obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY)   += pmic8xxx-pwrkey.o
  obj-$(CONFIG_INPUT_POWERMATE)  += powermate.o
  obj-$(CONFIG_INPUT_PWM_BEEPER) += pwm-beeper.o
  obj-$(CONFIG_INPUT_RB532_BUTTON)   += rb532_button.o
 +obj-$(CONFIG_INPUT_REGULATOR_HAPTIC)   += regulator-haptic.o
  obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o
  obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER)+= rotary_encoder.o
  obj-$(CONFIG_INPUT_SGI_BTNS)   += sgi_btns.o
 diff --git a/drivers/input/misc/regulator-haptic.c 
 b/drivers/input/misc/regulator-haptic.c
 new file mode 100644
 index 000..1a83ecb
 --- /dev/null
 +++ b/drivers/input/misc/regulator-haptic.c
 @@ -0,0 +1,241 @@
 +/*
 + * Regulator haptic driver
 + *
 + * Copyright (c) 2014 Samsung Electronics Co., Ltd.
 + * Author: Jaewon Kim jaewon02@samsung.com
 + * Author: Hyunhee Kim hyunhee@samsung.com
 + *
 + * 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.
 + */
 +
 +#include linux/module.h
 +#include linux/platform_device.h
 +#include linux/input.h
 +#include linux/slab.h
 +#include linux/regulator/consumer.h
 +#include linux/of.h
 +
 +#define MAX_MAGNITUDE_SHIFT16
 +
 +struct regulator_haptic {
 +   struct device *dev;
 +   struct input_dev *input_dev;
 +   struct regulator *regulator;
 +   struct work_struct work;
 +
 +   bool enabled;
 +   bool suspend_state;
 +   unsigned int max_volt;
 +   unsigned int min_volt;
 +   unsigned int intensity;
 +   unsigned int magnitude;
 +};
 +
 +static void regulator_haptic_enable(struct regulator_haptic *haptic)
 +{
 +   int error;
 +
 +   if (haptic-enabled)
 +   return;
 +
 +   error = regulator_enable(haptic-regulator);
 +   if (error) {
 +   dev_err(haptic-dev, cannot enable 

Re: [PATCH 1/2] Input: add regulator haptic driver

2014-11-20 Thread Dan Murphy
Hi

On 11/20/2014 08:33 AM, Pankaj Dubey wrote:
 Hi Jaewon,

 On 20 November 2014 19:01, Jaewon Kim jaewon02@samsung.com wrote:
 This patch adds support for haptic driver controlled by
 voltage of regulator. And this driver support for
 Force Feedback interface from input framework

 Signed-off-by: Jaewon Kim jaewon02@samsung.com
 Signed-off-by: Hyunhee Kim hyunhee@samsung.com
 Acked-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
  .../devicetree/bindings/input/regulator-haptic.txt |   24 ++
  drivers/input/misc/Kconfig |   11 +
  drivers/input/misc/Makefile|1 +
  drivers/input/misc/regulator-haptic.c  |  241 
 
  4 files changed, 277 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/input/regulator-haptic.txt
  create mode 100644 drivers/input/misc/regulator-haptic.c

 diff --git a/Documentation/devicetree/bindings/input/regulator-haptic.txt 
 b/Documentation/devicetree/bindings/input/regulator-haptic.txt
 new file mode 100644
 index 000..9f60e17
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/input/regulator-haptic.txt
 @@ -0,0 +1,24 @@
 +* Requlator Haptic Device Tree Bindings
 +
 +The regulator haptic driver controlled by voltage of regulator.
 +This driver implemented via Force Feedback interface.
 +
 +Required Properties:
 + - compatible : Should be regulator-haptic
 + - haptic-supply : Power supply for the haptic motor.
 +   [*] refer Documentation/devicetree/bindings/regulator/regulator.txt
 +
 + - max-microvolt : The maximum voltage value supplied to haptic motor.
 +   [The unit of the voltage is a micro]
 +
 + - min-microvolt : The minimum voltage value in which haptic motor reacts.
 +   [The unit of the voltage is a micro]
 +
 +Example:
 +
 +   regulator-haptic {

Should this be more about the function and not the driver name?
Somehting like

haptics {

 +   compatible = regulator-haptic;
 +   haptic-supply = motor_regulator;
 +   max-microvolt = 270;
 +   min-microvolt = 110;
 +   };
 diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
 index 23297ab..e5e556d 100644
 --- a/drivers/input/misc/Kconfig
 +++ b/drivers/input/misc/Kconfig
 @@ -394,6 +394,17 @@ config INPUT_CM109
   To compile this driver as a module, choose M here: the module will 
 be
   called cm109.

 +config INPUT_REGULATOR_HAPTIC
 +   tristate regulator haptics support
 +   select INPUT_FF_MEMLESS
 +   help
 + This option enables device driver support for the haptic controlled
 + by regulator. This driver supports ff-memless interface
 + from input framework.
 +
 + To compile this driver as a module, choose M here: the
 + module will be called regulator-haptic.
 +
  config INPUT_RETU_PWRBUTTON
 tristate Retu Power button Driver
 depends on MFD_RETU
 diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
 index 19c7603..1f135af 100644
 --- a/drivers/input/misc/Makefile
 +++ b/drivers/input/misc/Makefile
 @@ -53,6 +53,7 @@ obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY)   += pmic8xxx-pwrkey.o
  obj-$(CONFIG_INPUT_POWERMATE)  += powermate.o
  obj-$(CONFIG_INPUT_PWM_BEEPER) += pwm-beeper.o
  obj-$(CONFIG_INPUT_RB532_BUTTON)   += rb532_button.o
 +obj-$(CONFIG_INPUT_REGULATOR_HAPTIC)   += regulator-haptic.o
  obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o
  obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER)+= rotary_encoder.o
  obj-$(CONFIG_INPUT_SGI_BTNS)   += sgi_btns.o
 diff --git a/drivers/input/misc/regulator-haptic.c 
 b/drivers/input/misc/regulator-haptic.c
 new file mode 100644
 index 000..1a83ecb
 --- /dev/null
 +++ b/drivers/input/misc/regulator-haptic.c
 @@ -0,0 +1,241 @@
 +/*
 + * Regulator haptic driver
 + *
 + * Copyright (c) 2014 Samsung Electronics Co., Ltd.
 + * Author: Jaewon Kim jaewon02@samsung.com
 + * Author: Hyunhee Kim hyunhee@samsung.com
 + *
 + * 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.
 + */
 +
 +#include linux/module.h
 +#include linux/platform_device.h
 +#include linux/input.h
 +#include linux/slab.h
 +#include linux/regulator/consumer.h
 +#include linux/of.h
 +
 +#define MAX_MAGNITUDE_SHIFT16
 +
 +struct regulator_haptic {
 +   struct device *dev;
 +   struct input_dev *input_dev;
 +   struct regulator *regulator;
 +   struct work_struct work;
 +
 +   bool enabled;
 +   bool suspend_state;

I don't understand what you are tracking here.  You only set it and unset
this value but never do any checking

 +   unsigned int max_volt;
 +   unsigned int min_volt;
 +   unsigned int intensity;
 +   unsigned int magnitude;
 +};
 +
 +static void 

Re: [PATCH 1/2] Input: add regulator haptic driver

2014-11-20 Thread Jaewon Kim

Hi Pankaj,

2014년 11월 20일 23:33에 Pankaj Dubey 이(가) 쓴 글:

Hi Jaewon,

On 20 November 2014 19:01, Jaewon Kim jaewon02@samsung.com wrote:

This patch adds support for haptic driver controlled by
voltage of regulator. And this driver support for
Force Feedback interface from input framework

Signed-off-by: Jaewon Kim jaewon02@samsung.com
Signed-off-by: Hyunhee Kim hyunhee@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
---
  .../devicetree/bindings/input/regulator-haptic.txt |   24 ++
  drivers/input/misc/Kconfig |   11 +
  drivers/input/misc/Makefile|1 +
  drivers/input/misc/regulator-haptic.c  |  241 
  4 files changed, 277 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/input/regulator-haptic.txt
  create mode 100644 drivers/input/misc/regulator-haptic.c

diff --git a/Documentation/devicetree/bindings/input/regulator-haptic.txt 
b/Documentation/devicetree/bindings/input/regulator-haptic.txt
new file mode 100644
index 000..9f60e17
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/regulator-haptic.txt
@@ -0,0 +1,24 @@
+* Requlator Haptic Device Tree Bindings
+
+The regulator haptic driver controlled by voltage of regulator.
+This driver implemented via Force Feedback interface.
+
+Required Properties:
+ - compatible : Should be regulator-haptic
+ - haptic-supply : Power supply for the haptic motor.
+   [*] refer Documentation/devicetree/bindings/regulator/regulator.txt
+
+ - max-microvolt : The maximum voltage value supplied to haptic motor.
+   [The unit of the voltage is a micro]
+
+ - min-microvolt : The minimum voltage value in which haptic motor reacts.
+   [The unit of the voltage is a micro]
+
+Example:
+
+   regulator-haptic {
+   compatible = regulator-haptic;
+   haptic-supply = motor_regulator;
+   max-microvolt = 270;
+   min-microvolt = 110;
+   };
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 23297ab..e5e556d 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -394,6 +394,17 @@ config INPUT_CM109
   To compile this driver as a module, choose M here: the module will be
   called cm109.

+config INPUT_REGULATOR_HAPTIC
+   tristate regulator haptics support
+   select INPUT_FF_MEMLESS
+   help
+ This option enables device driver support for the haptic controlled
+ by regulator. This driver supports ff-memless interface
+ from input framework.
+
+ To compile this driver as a module, choose M here: the
+ module will be called regulator-haptic.
+
  config INPUT_RETU_PWRBUTTON
 tristate Retu Power button Driver
 depends on MFD_RETU
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 19c7603..1f135af 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -53,6 +53,7 @@ obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY)   += pmic8xxx-pwrkey.o
  obj-$(CONFIG_INPUT_POWERMATE)  += powermate.o
  obj-$(CONFIG_INPUT_PWM_BEEPER) += pwm-beeper.o
  obj-$(CONFIG_INPUT_RB532_BUTTON)   += rb532_button.o
+obj-$(CONFIG_INPUT_REGULATOR_HAPTIC)   += regulator-haptic.o
  obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o
  obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER)+= rotary_encoder.o
  obj-$(CONFIG_INPUT_SGI_BTNS)   += sgi_btns.o
diff --git a/drivers/input/misc/regulator-haptic.c 
b/drivers/input/misc/regulator-haptic.c
new file mode 100644
index 000..1a83ecb
--- /dev/null
+++ b/drivers/input/misc/regulator-haptic.c
@@ -0,0 +1,241 @@
+/*
+ * Regulator haptic driver
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Author: Jaewon Kim jaewon02@samsung.com
+ * Author: Hyunhee Kim hyunhee@samsung.com
+ *
+ * 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.
+ */
+
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/input.h
+#include linux/slab.h
+#include linux/regulator/consumer.h
+#include linux/of.h
+
+#define MAX_MAGNITUDE_SHIFT16
+
+struct regulator_haptic {
+   struct device *dev;
+   struct input_dev *input_dev;
+   struct regulator *regulator;
+   struct work_struct work;
+
+   bool enabled;
+   bool suspend_state;
+   unsigned int max_volt;
+   unsigned int min_volt;
+   unsigned int intensity;
+   unsigned int magnitude;
+};
+
+static void regulator_haptic_enable(struct regulator_haptic *haptic)
+{
+   int error;
+
+   if (haptic-enabled)
+   return;
+
+   error = regulator_enable(haptic-regulator);
+   if (error) {
+   dev_err(haptic-dev, cannot enable regulator\n);
+   return;
+   }
+
+   

Re: [PATCH 1/2] Input: add regulator haptic driver

2014-11-20 Thread Jaewon Kim

Hi Dan,

2014년 11월 21일 00:09에 Dan Murphy 이(가) 쓴 글:

Hi

On 11/20/2014 08:33 AM, Pankaj Dubey wrote:

Hi Jaewon,

On 20 November 2014 19:01, Jaewon Kim jaewon02@samsung.com wrote:

This patch adds support for haptic driver controlled by
voltage of regulator. And this driver support for
Force Feedback interface from input framework

Signed-off-by: Jaewon Kim jaewon02@samsung.com
Signed-off-by: Hyunhee Kim hyunhee@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
---
  .../devicetree/bindings/input/regulator-haptic.txt |   24 ++
  drivers/input/misc/Kconfig |   11 +
  drivers/input/misc/Makefile|1 +
  drivers/input/misc/regulator-haptic.c  |  241 
  4 files changed, 277 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/input/regulator-haptic.txt
  create mode 100644 drivers/input/misc/regulator-haptic.c

diff --git a/Documentation/devicetree/bindings/input/regulator-haptic.txt 
b/Documentation/devicetree/bindings/input/regulator-haptic.txt
new file mode 100644
index 000..9f60e17
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/regulator-haptic.txt
@@ -0,0 +1,24 @@
+* Requlator Haptic Device Tree Bindings
+
+The regulator haptic driver controlled by voltage of regulator.
+This driver implemented via Force Feedback interface.
+
+Required Properties:
+ - compatible : Should be regulator-haptic
+ - haptic-supply : Power supply for the haptic motor.
+   [*] refer Documentation/devicetree/bindings/regulator/regulator.txt
+
+ - max-microvolt : The maximum voltage value supplied to haptic motor.
+   [The unit of the voltage is a micro]
+
+ - min-microvolt : The minimum voltage value in which haptic motor reacts.
+   [The unit of the voltage is a micro]
+
+Example:
+
+   regulator-haptic {

Should this be more about the function and not the driver name?
Somehting like

haptics {

Yes, haptics is better than driver name.




+   compatible = regulator-haptic;
+   haptic-supply = motor_regulator;
+   max-microvolt = 270;
+   min-microvolt = 110;
+   };
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 23297ab..e5e556d 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -394,6 +394,17 @@ config INPUT_CM109
   To compile this driver as a module, choose M here: the module will be
   called cm109.

+config INPUT_REGULATOR_HAPTIC
+   tristate regulator haptics support
+   select INPUT_FF_MEMLESS
+   help
+ This option enables device driver support for the haptic controlled
+ by regulator. This driver supports ff-memless interface
+ from input framework.
+
+ To compile this driver as a module, choose M here: the
+ module will be called regulator-haptic.
+
  config INPUT_RETU_PWRBUTTON
 tristate Retu Power button Driver
 depends on MFD_RETU
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 19c7603..1f135af 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -53,6 +53,7 @@ obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY)   += pmic8xxx-pwrkey.o
  obj-$(CONFIG_INPUT_POWERMATE)  += powermate.o
  obj-$(CONFIG_INPUT_PWM_BEEPER) += pwm-beeper.o
  obj-$(CONFIG_INPUT_RB532_BUTTON)   += rb532_button.o
+obj-$(CONFIG_INPUT_REGULATOR_HAPTIC)   += regulator-haptic.o
  obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o
  obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER)+= rotary_encoder.o
  obj-$(CONFIG_INPUT_SGI_BTNS)   += sgi_btns.o
diff --git a/drivers/input/misc/regulator-haptic.c 
b/drivers/input/misc/regulator-haptic.c
new file mode 100644
index 000..1a83ecb
--- /dev/null
+++ b/drivers/input/misc/regulator-haptic.c
@@ -0,0 +1,241 @@
+/*
+ * Regulator haptic driver
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Author: Jaewon Kim jaewon02@samsung.com
+ * Author: Hyunhee Kim hyunhee@samsung.com
+ *
+ * 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.
+ */
+
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/input.h
+#include linux/slab.h
+#include linux/regulator/consumer.h
+#include linux/of.h
+
+#define MAX_MAGNITUDE_SHIFT16
+
+struct regulator_haptic {
+   struct device *dev;
+   struct input_dev *input_dev;
+   struct regulator *regulator;
+   struct work_struct work;
+
+   bool enabled;
+   bool suspend_state;

I don't understand what you are tracking here.  You only set it and unset
this value but never do any checking


+   unsigned int max_volt;
+   unsigned int min_volt;
+   unsigned int intensity;
+   unsigned int magnitude;
+};
+
+static void