Re: [PATCH v4 1/2] Input: add regulator haptic driver
Hi Dmity, 2014년 12월 03일 15:29에 Jaewon Kim 이(가) 쓴 글: Hi Dmitry, 2014년 12월 03일 15:02에 Dmitry Torokhov 이(가) 쓴 글: Hi Jaewon, On Mon, Dec 01, 2014 at 11:11:12AM +0900, Jaewon Kim 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 Tested-by: Chanwoo Choi cw00.c...@samsung.com Reviewed-by: Chanwoo Choi cw00.c...@samsung.com Reviewed-by: Pankaj Dubey pankaj.du...@samsung.com --- .../devicetree/bindings/input/regulator-haptic.txt | 21 ++ drivers/input/misc/Kconfig | 11 + drivers/input/misc/Makefile|1 + drivers/input/misc/regulator-haptic.c | 247 include/linux/input/regulator-haptic.h | 31 +++ 5 files changed, 311 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/regulator-haptic.txt create mode 100644 drivers/input/misc/regulator-haptic.c create mode 100644 include/linux/input/regulator-haptic.h diff --git a/Documentation/devicetree/bindings/input/regulator-haptic.txt b/Documentation/devicetree/bindings/input/regulator-haptic.txt new file mode 100644 index 000..3ed1c7e --- /dev/null +++ b/Documentation/devicetree/bindings/input/regulator-haptic.txt @@ -0,0 +1,21 @@ +* Regulator Haptic Device Tree Bindings + +Required Properties: + - compatible : Should be regulator-haptic + - haptic-supply : Power supply to the haptic motor. +[*] refer Documentation/devicetree/bindings/regulator/regulator.txt + + - max-microvolt : The maximum voltage value supplied to the haptic motor. +[The unit of the voltage is a micro] + + - min-microvolt : The minimum voltage value supplied to the haptic motor. +[The unit of the voltage is a micro] + +Example: + +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..6bc8e45 --- /dev/null +++ b/drivers/input/misc/regulator-haptic.c @@ -0,0 +1,247 @@ +/* + * 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/input.h +#include linux/input/regulator-haptic.h +#include linux/module.h +#include linux/of.h +#include linux/platform_device.h +#include linux/regulator/consumer.h +#include linux/slab.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, bool state) +{ +int error; + +if (haptic-enabled == state) +return; + +if (state) +error =
Re: [PATCH v4 1/2] Input: add regulator haptic driver
Hi Jaewon, On Mon, Dec 01, 2014 at 11:11:12AM +0900, Jaewon Kim 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 Tested-by: Chanwoo Choi cw00.c...@samsung.com Reviewed-by: Chanwoo Choi cw00.c...@samsung.com Reviewed-by: Pankaj Dubey pankaj.du...@samsung.com --- .../devicetree/bindings/input/regulator-haptic.txt | 21 ++ drivers/input/misc/Kconfig | 11 + drivers/input/misc/Makefile|1 + drivers/input/misc/regulator-haptic.c | 247 include/linux/input/regulator-haptic.h | 31 +++ 5 files changed, 311 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/regulator-haptic.txt create mode 100644 drivers/input/misc/regulator-haptic.c create mode 100644 include/linux/input/regulator-haptic.h diff --git a/Documentation/devicetree/bindings/input/regulator-haptic.txt b/Documentation/devicetree/bindings/input/regulator-haptic.txt new file mode 100644 index 000..3ed1c7e --- /dev/null +++ b/Documentation/devicetree/bindings/input/regulator-haptic.txt @@ -0,0 +1,21 @@ +* Regulator Haptic Device Tree Bindings + +Required Properties: + - compatible : Should be regulator-haptic + - haptic-supply : Power supply to the haptic motor. + [*] refer Documentation/devicetree/bindings/regulator/regulator.txt + + - max-microvolt : The maximum voltage value supplied to the haptic motor. + [The unit of the voltage is a micro] + + - min-microvolt : The minimum voltage value supplied to the haptic motor. + [The unit of the voltage is a micro] + +Example: + + 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..6bc8e45 --- /dev/null +++ b/drivers/input/misc/regulator-haptic.c @@ -0,0 +1,247 @@ +/* + * 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/input.h +#include linux/input/regulator-haptic.h +#include linux/module.h +#include linux/of.h +#include linux/platform_device.h +#include linux/regulator/consumer.h +#include linux/slab.h + +#define MAX_MAGNITUDE_SHIFT 16 + +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, bool state) +{ + int error; + + if (haptic-enabled == state) + return; +
Re: [PATCH v4 1/2] Input: add regulator haptic driver
Hi Dmitry, 2014년 12월 03일 15:02에 Dmitry Torokhov 이(가) 쓴 글: Hi Jaewon, On Mon, Dec 01, 2014 at 11:11:12AM +0900, Jaewon Kim 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 Tested-by: Chanwoo Choi cw00.c...@samsung.com Reviewed-by: Chanwoo Choi cw00.c...@samsung.com Reviewed-by: Pankaj Dubey pankaj.du...@samsung.com --- .../devicetree/bindings/input/regulator-haptic.txt | 21 ++ drivers/input/misc/Kconfig | 11 + drivers/input/misc/Makefile|1 + drivers/input/misc/regulator-haptic.c | 247 include/linux/input/regulator-haptic.h | 31 +++ 5 files changed, 311 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/regulator-haptic.txt create mode 100644 drivers/input/misc/regulator-haptic.c create mode 100644 include/linux/input/regulator-haptic.h diff --git a/Documentation/devicetree/bindings/input/regulator-haptic.txt b/Documentation/devicetree/bindings/input/regulator-haptic.txt new file mode 100644 index 000..3ed1c7e --- /dev/null +++ b/Documentation/devicetree/bindings/input/regulator-haptic.txt @@ -0,0 +1,21 @@ +* Regulator Haptic Device Tree Bindings + +Required Properties: + - compatible : Should be regulator-haptic + - haptic-supply : Power supply to the haptic motor. + [*] refer Documentation/devicetree/bindings/regulator/regulator.txt + + - max-microvolt : The maximum voltage value supplied to the haptic motor. + [The unit of the voltage is a micro] + + - min-microvolt : The minimum voltage value supplied to the haptic motor. + [The unit of the voltage is a micro] + +Example: + + 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..6bc8e45 --- /dev/null +++ b/drivers/input/misc/regulator-haptic.c @@ -0,0 +1,247 @@ +/* + * 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/input.h +#include linux/input/regulator-haptic.h +#include linux/module.h +#include linux/of.h +#include linux/platform_device.h +#include linux/regulator/consumer.h +#include linux/slab.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, bool state) +{ + int error; + + if (haptic-enabled == state) +
[PATCH v4 1/2] Input: add regulator haptic driver
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 Tested-by: Chanwoo Choi cw00.c...@samsung.com Reviewed-by: Chanwoo Choi cw00.c...@samsung.com Reviewed-by: Pankaj Dubey pankaj.du...@samsung.com --- .../devicetree/bindings/input/regulator-haptic.txt | 21 ++ drivers/input/misc/Kconfig | 11 + drivers/input/misc/Makefile|1 + drivers/input/misc/regulator-haptic.c | 247 include/linux/input/regulator-haptic.h | 31 +++ 5 files changed, 311 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/regulator-haptic.txt create mode 100644 drivers/input/misc/regulator-haptic.c create mode 100644 include/linux/input/regulator-haptic.h diff --git a/Documentation/devicetree/bindings/input/regulator-haptic.txt b/Documentation/devicetree/bindings/input/regulator-haptic.txt new file mode 100644 index 000..3ed1c7e --- /dev/null +++ b/Documentation/devicetree/bindings/input/regulator-haptic.txt @@ -0,0 +1,21 @@ +* Regulator Haptic Device Tree Bindings + +Required Properties: + - compatible : Should be regulator-haptic + - haptic-supply : Power supply to the haptic motor. + [*] refer Documentation/devicetree/bindings/regulator/regulator.txt + + - max-microvolt : The maximum voltage value supplied to the haptic motor. + [The unit of the voltage is a micro] + + - min-microvolt : The minimum voltage value supplied to the haptic motor. + [The unit of the voltage is a micro] + +Example: + + 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..6bc8e45 --- /dev/null +++ b/drivers/input/misc/regulator-haptic.c @@ -0,0 +1,247 @@ +/* + * 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/input.h +#include linux/input/regulator-haptic.h +#include linux/module.h +#include linux/of.h +#include linux/platform_device.h +#include linux/regulator/consumer.h +#include linux/slab.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, bool state) +{ + int error; + + if (haptic-enabled == state) + return; + + if (state) + error = regulator_enable(haptic-regulator); + else + error =