input: drv260x: Add TI drv260x haptics driver
Subsystems (3)
PATCH v2 1/1 input: drv260x: Add TI drv260x haptics driver
Add the TI drv260x haptics/vibrator driver.
This device uses the input force feedback
to produce a wave form to driver an
ERM or LRA actuator device.
The initial driver supports the devices
real time playback mode. But the device
has additional wave patterns in ROM.
This functionality will be added in
future patchsets.
Product data sheet is located here:
http://www.ti.com/product/drv2605
---
v2 - Fixed binding doc and patch headline - https://patchwork.kernel.org/patch/4619641/
.../devicetree/bindings/input/ti,drv260x.txt | 44 ++ drivers/input/misc/Kconfig | 9 + drivers/input/misc/Makefile | 1 + drivers/input/misc/drv260x.c | 537 ++++++++++++++++++++ include/dt-bindings/input/ti-drv260x.h | 30 ++ include/linux/input/drv260x.h | 181 +++++++ 6 files changed, 802 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/ti,drv260x.txt create mode 100644 drivers/input/misc/drv260x.c create mode 100644 include/dt-bindings/input/ti-drv260x.h create mode 100644 include/linux/input/drv260x.h
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +44 -0
@@ -0,0 +1,44 @@ +Texas Instruments - drv260x Haptics driver family + +The drv260x family serial control bus communicates through I2C protocols + +Required properties: + - compatible - One of: + "ti,drv2604" - DRV2604 + "ti,drv2605" - DRV2605 + "ti,drv2605l" - DRV2605L + - reg - I2C slave address + - mode - Power up mode of the chip (defined in include/dt-bindings/input/ti-drv260x.h) + DRV260X_RTP_MODE - Real time playback mode + DRV260X_LRA_MODE - Linear Resonance Actuator mode (Piezoelectric) + DRV260X_ERM_MODE - Eccentric Rotating Mass mode (Rotary vibrator) + - library_sel - Library to use at power up (defined in include/dt-bindings/input/ti-drv260x.h) + DRV260X_LIB_A - Pre-programmed Library + DRV260X_LIB_B - Pre-programmed Library + DRV260X_LIB_C - Pre-programmed Library + DRV260X_LIB_D - Pre-programmed Library + DRV260X_LIB_E - Pre-programmed Library + DRV260X_LIB_F - Pre-programmed Library + +Optional properties: + - enable-gpio - gpio pin to enable/disable the device. + - vib_rated_voltage - The rated voltage of the actuator. If this is not + set then the value will be defaulted to 0x90 in the + driver. + - vib_overdrive_voltage - The overdrive voltage of the actuator. + If this is not set then the value + will be defaulted to 0x90 in the driver. +Example: + +drv2605l: drv2605l@5a { + compatible = "ti,drv2605l"; + reg = <0x5a>; + enable-gpio = <&gpio1 28 GPIO_ACTIVE_HIGH>; + mode = <DRV260X_RTP_MODE>; + library_sel = <DRV260X_LIB_SEL_DEFAULT>; + vib_rated_voltage = <3200>; + vib_overdriver_voltage = <3200>; +}; + +For more product information please see the link below: +http://www.ti.com/product/drv2605
drivers/input/misc/Kconfig +9 -0
@@ -676,4 +676,13 @@ config INPUT_SOC_BUTTON_ARRAY To compile this driver as a module, choose M here: the module will be called soc_button_array. +config INPUT_DRV260X_HAPTICS + tristate "TI DRV260X haptics support" + depends on INPUT && I2C + help + Say Y to enable support for the TI DRV260X haptics driver. + + To compile this driver as a module, choose M here: the + module will be called drv260x-haptics. + endif
drivers/input/misc/Makefile +1 -0
@@ -64,3 +64,4 @@ obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o obj-$(CONFIG_INPUT_XEN_KBDDEV_FRONTEND) += xen-kbdfront.o obj-$(CONFIG_INPUT_YEALINK) += yealink.o obj-$(CONFIG_INPUT_IDEAPAD_SLIDEBAR) += ideapad_slidebar.o +obj-$(CONFIG_INPUT_DRV260X_HAPTICS) += drv260x.o
drivers/input/misc/drv260x.c new file +537 -0
537 lines not on this page · raw message
include/dt-bindings/input/ti-drv260x.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* ti-drv260x.h - DRV260X haptics driver family +* +* Author: Dan Murphy <[email protected]> +* +* Copyright: (C) 2014 Texas Instruments, Inc. +* +* 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. +* +* 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. +*/ + +/* Calibration Types */ +#define DRV260X_RTP_MODE 0x00 +#define DRV260X_LRA_MODE 0x01 +#define DRV260X_ERM_MODE 0x02 + +/* Library Selection */ +#define DRV260X_LIB_SEL_DEFAULT 0x00 +#define DRV260X_LIB_A 0x01 +#define DRV260X_LIB_B 0x02 +#define DRV260X_LIB_C 0x03 +#define DRV260X_LIB_D 0x04 +#define DRV260X_LIB_E 0x05 +#define DRV260X_LIB_F 0x06
include/linux/input/drv260x.h new file +181 -0
181 lines not on this page · raw message
Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Dmitry Torokhov
maintainerHi Dan,
Quoted 8 lines · Dan Murphy
Add the TI drv260x haptics/vibrator driver. This device uses the input force feedback to produce a wave form to driver an ERM or LRA actuator device.
The initial driver supports the devices real time playback mode. But the device has additional wave patterns in ROM.
As it presented the device appears to be a memoryless device, however you present it to the rest of the system as if it can support playback of multiple effects simultaneously, which is incorrect.
My guess that you need to engage the memoryless input library to schedule handling multiple effects for your device, including ramping up, ramping down, stopping playback when effects runs out, etc.
Thanks.
Signature · 7 lines
Dmitry P.S. If you are using devm_ there is devm_input_allocate_dveice(). -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines
Quoted 4 lines
The initial driver supports the devices
real time playback mode. But the device
has additional wave patterns in ROM.
Quoted 7 lines
As it presented the device appears to be a memoryless device, however you present it to the rest of the system as if it can support playback of multiple effects simultaneously, which is incorrect.
My guess that you need to engage the memoryless input library to schedule handling multiple effects for your device, including ramping up, ramping down, stopping playback when effects runs out, etc.
Hi Dan,
Elias and Michal (cc'ed) are working on a kernel/userland library to handle sending multiple force feedback signals to 'simple' devices, perhaps you should engage with them.
Simon
Dmitry
Thanks for the comments
Quoted 16 lines · Dmitry Torokhov
Hi Dan,
Quoted 8 lines · Dan Murphy
Add the TI drv260x haptics/vibrator driver. This device uses the input force feedback to produce a wave form to driver an ERM or LRA actuator device.
The initial driver supports the devices real time playback mode. But the device has additional wave patterns in ROM.
As it presented the device appears to be a memoryless device, however you present it to the rest of the system as if it can support playback of multiple effects simultaneously, which is incorrect.
Quoted 7 lines
My guess that you need to engage the memoryless input library to schedule handling multiple effects for your device, including ramping up, ramping down, stopping playback when effects runs out, etc.
Thanks.
I had written the driver originally to be a memless device.
But when calling the driver from user space I was not getting the duration, strength of any information from the ff_device structure except the type. The values in the structure were all being passed as 0's.
I will attempt it again as a memless device.
Dan
Signature · 2 lines
------------------ Dan Murphy
Dmitry
Quoted 13 lines · On 07/28/2014 12:59 PM, [email protected] wrote:
Quoted 5 lines
Quoted 4 lines
The initial driver supports the devices
real time playback mode. But the device
has additional wave patterns in ROM.Quoted 7 lines
As it presented the device appears to be a memoryless device, however you present it to the rest of the system as if it can support playback of multiple effects simultaneously, which is incorrect.
My guess that you need to engage the memoryless input library to schedule handling multiple effects for your device, including ramping up, ramping down, stopping playback when effects runs out, etc.
Quoted 8 lines
Hi Dan,
Elias and Michal (cc'ed) are working on a kernel/userland library to handle sending multiple force feedback signals to 'simple' devices, perhaps you should engage with them.Simon
OK I looked at the memless devices and got it to work. Don't know why replay.length is always 0 but at least I got the magnitude. It seems that the input framework expects the user space to manage the on/off of the vibrator in RUMBLE mode. Unless I missed something while going through the code.
This family of devices has the ability to do real time playback, play an index in a pre-programmed library and have feedback waveforms programmed into the device to be played.
The RTP mode is covered in this patch set. But I am also interested in setting the pre-programmed libraries as well as setting my own custom waveform.
I believe the custom is handled via the FF_PERIODIC with the waveform being FF_CUSTOM. I am not really a big fan of mixing the FF_CUSTOM in the periodic. This could be broken out so that the driver can handle the custom waveforms.
But I am not sure with the existing framework we can set a library or index of the library. (Short of adding sysfs nodes which I don't want to do)
My thought would be to add FF_LIBRARY as a force feedback type and create a structure like
struct ff_library {
__u16 library;
__u16 index;
};to be able to program the driver to play a certain library/index combo when play is called. Of course the driver would have to set the max libraries and max indices within the library.
Let me know if this is something we can add and I can RFC a patch for it.
Dan
P.S. Got the P.S. will use devm as suggested.
Signature · 2 lines
------------------ Dan Murphy
Quoted 42 lines · Dan Murphy
Add the TI drv260x haptics/vibrator driver.
This device uses the input force feedback
to produce a wave form to driver an
ERM or LRA actuator device.The initial driver supports the devices
real time playback mode. But the device
has additional wave patterns in ROM.This functionality will be added in
future patchsets.Product data sheet is located here:
http://www.ti.com/product/drv2605Signed-off-by Dan Murphy <[email protected]>---
v2 - Fixed binding doc and patch headline - https://patchwork.kernel.org/patch/4619641/
.../devicetree/bindings/input/ti,drv260x.txt | 44 ++ drivers/input/misc/Kconfig | 9 + drivers/input/misc/Makefile | 1 + drivers/input/misc/drv260x.c | 537 ++++++++++++++++++++ include/dt-bindings/input/ti-drv260x.h | 30 ++ include/linux/input/drv260x.h | 181 +++++++ 6 files changed, 802 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/ti,drv260x.txt create mode 100644 drivers/input/misc/drv260x.c create mode 100644 include/dt-bindings/input/ti-drv260x.h create mode 100644 include/linux/input/drv260x.hDocumentation/devicetree/bindings/input/ti,drv260x.txt new file +4
-0@@ -0,0 +1,44 @@ +Texas Instruments - drv260x Haptics driver family + +The drv260x family serial control bus communicates through I2C protocols +
Documentation/devicetree/bindings/input/ti,drv260x.txt line 14
Quoted 10 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +10
-0+Required properties: + - compatible - One of: + "ti,drv2604" - DRV2604 + "ti,drv2605" - DRV2605 + "ti,drv2605l" - DRV2605L + - reg - I2C slave address + - mode - Power up mode of the chip (defined in include/dt-bindings/input/ti-drv260x.h) + DRV260X_RTP_MODE - Real time playback mode + DRV260X_LRA_MODE - Linear Resonance Actuator mode (Piezoelectric) + DRV260X_ERM_MODE - Eccentric Rotating Mass mode (Rotary vibrator)
What exactly are these, and why does the kernel not decide?
Documentation/devicetree/bindings/input/ti,drv260x.txt line 15
Quoted 1 line
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +1
-0+ - library_sel - Library to use at power up (defined in include/dt-bindings/input/ti-drv260x.h)
Please s/_/-/ in all property names.
Documentation/devicetree/bindings/input/ti,drv260x.txt line 21
Quoted 6 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +6
-0+ DRV260X_LIB_A - Pre-programmed Library + DRV260X_LIB_B - Pre-programmed Library + DRV260X_LIB_C - Pre-programmed Library + DRV260X_LIB_D - Pre-programmed Library + DRV260X_LIB_E - Pre-programmed Library + DRV260X_LIB_F - Pre-programmed Library
What exactly are these, and why does the kernel not decide?
Documentation/devicetree/bindings/input/ti,drv260x.txt line 27
Quoted 6 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +6
-0+ +Optional properties: + - enable-gpio - gpio pin to enable/disable the device. + - vib_rated_voltage - The rated voltage of the actuator. If this is not + set then the value will be defaulted to 0x90 in the + driver.
What units is this in?
Don't mention the driver, just say "if not 0x90" (but with a better description of what 0x90 actually means).
Documentation/devicetree/bindings/input/ti,drv260x.txt line 30
Quoted 3 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +3
-0+ - vib_overdrive_voltage - The overdrive voltage of the actuator. + If this is not set then the value + will be defaulted to 0x90 in the driver.
Similarly on both points.
[...]
Quoted 15 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +15
-0+static int drv260x_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct drv260x_data *haptics; + struct device_node *np = client->dev.of_node; + struct drv260x_platform_data *pdata = client->dev.platform_data; + struct ff_device *ff; + int ret; + int voltage; + + haptics = devm_kzalloc(&client->dev, sizeof(*haptics), GFP_KERNEL); + if (!haptics) + return -ENOMEM; + + haptics->rated_voltage = DRV260X_DEF_OD_CLAMP_VOLT;
Documentation/devicetree/bindings/input/ti,drv260x.txt
Quoted 10 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +10
-0+ haptics->rated_voltage = DRV260X_DEF_RATED_VOLT; + + if (np) { + ret = of_property_read_u32(np, "mode", &haptics->mode); + if (ret < 0) { + dev_err(&client->dev, + "%s: No entry for mode\n", __func__); + + return ret; + }
No sanity checking on the actual value?
As far as I can see, haptics->mode is an int, not a u32.
Documentation/devicetree/bindings/input/ti,drv260x.txt
Quoted 8 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +8
-0+ ret = of_property_read_u32(np, "library_sel", + &haptics->library); + if (ret < 0) { + dev_err(&client->dev, + "%s: No entry for library selection\n", __func__); + + return ret; + }
Sanity checking?
haptics->library is not a u32.
Documentation/devicetree/bindings/input/ti,drv260x.txt
Quoted 11 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +11
-0+ ret = of_property_read_u32(np, "vib_rated_voltage", + &voltage); + if (!ret) + haptics->rated_voltage = drv260x_calculate_voltage(voltage); + + + ret = of_property_read_u32(np, "vib_overdrive_voltage", + &voltage); + if (!ret) + haptics->overdrive_voltage = drv260x_calculate_voltage(voltage); +
And again, on both points.
Documentation/devicetree/bindings/input/ti,drv260x.txt
Quoted 13 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +13
-0+ } else if (pdata) { + haptics->mode = pdata->mode; + haptics->library = pdata->library_selection; + if (pdata->vib_overdrive_voltage) + haptics->overdrive_voltage = drv260x_calculate_voltage(pdata->vib_overdrive_voltage); + if (pdata->vib_rated_voltage) + haptics->rated_voltage = drv260x_calculate_voltage(pdata->vib_rated_voltage); + } else { + dev_err(&client->dev, "Platform data not set\n"); + return -ENODEV; + } + + haptics->regulator = regulator_get(&client->dev, "vbat");
This wasn't in the binding.
Thanks,
Mark.
Quoted 21 lines · Dan
Dmitry
Quoted 18 lines · On 07/28/2014 12:59 PM, [email protected] wrote:
Quoted 11 lines
Quoted 3 lines
The initial driver supports the devices
real time playback mode. But the device
has additional wave patterns in ROM.As it presented the device appears to be a memoryless device, however you present it to the rest of the system as if it can support playback of multiple effects simultaneously, which is incorrect.
My guess that you need to engage the memoryless input library to schedule handling multiple effects for your device, including ramping up, ramping down, stopping playback when effects runs out, etc.
Hi Dan,
Elias and Michal (cc'ed) are working on a kernel/userland library to handle sending multiple force feedback signals to 'simple' devices, perhaps you should engage with them.Simon
Hi Dan,
since I spent some time trying to improve the memoryless library I can hopefully provide you with some hints.
If I'm reading this right, your device cannot play more than one effect at once but it can operate eihter in RTP mode where the user controls the operation of the motors directly on in an automated mode where the device follows some pre- programmed waveform. These two modes are mutually exclusive.
If my understanding of the problem is correct, you will struggle both with memoryless library and your own imlementation. The memoryless library is quite simplistic and it doesn't have any sort of "passthrough" mode so you would not be able to do anything besides RTP that way.
On the other hand if you decide to write your own implementation of effect handling you will end up duplicating a lot of code that already exists in the memoryless library and has been proven to work.
A possible solution for the problem would be to separate the functions that control effect timing from the memoryless library and make them globally accessible. I believe that this would simplify any customized haptic implementation considerably and it might be a decent interim solution before the project Simon mentioned is ready.
If there is anybody interested in such a solution I can probably whip up a patch for it quite quickly.
Regards,
Michal
Michal
Thanks for the feedback
Quoted 25 lines · Michal Malý
Quoted 21 lines · Dan
Dmitry
Quoted 18 lines · On 07/28/2014 12:59 PM, [email protected] wrote:
Quoted 11 lines
Quoted 3 lines
The initial driver supports the devices
real time playback mode. But the device
has additional wave patterns in ROM.As it presented the device appears to be a memoryless device, however you present it to the rest of the system as if it can support playback of multiple effects simultaneously, which is incorrect.
My guess that you need to engage the memoryless input library to schedule handling multiple effects for your device, including ramping up, ramping down, stopping playback when effects runs out, etc.
Hi Dan,
Elias and Michal (cc'ed) are working on a kernel/userland library to handle sending multiple force feedback signals to 'simple' devices, perhaps you should engage with them.Simon
Hi Dan,
Quoted 7 lines
since I spent some time trying to improve the memoryless library I can hopefully provide you with some hints.
If I'm reading this right, your device cannot play more than one effect at once but it can operate eihter in RTP mode where the user controls the operation of the motors directly on in an automated mode where the device follows some pre- programmed waveform. These two modes are mutually exclusive.
Actually there is one other mode here, that is the ability to program in a waveform to be played. So that makes 3 modes I have to think about supporting.
I know there are products out there that would like to and do customize their feedback based on certain user actions.
For the custom mode I could use the FF_CUSTOM id but not sure
how that fits into the Periodic structure. If I can get two out of 3 that would be great.
Quoted 10 lines
If my understanding of the problem is correct, you will struggle both with memoryless library and your own imlementation. The memoryless library is quite simplistic and it doesn't have any sort of "passthrough" mode so you would not be able to do anything besides RTP that way.
On the other hand if you decide to write your own implementation of effect handling you will end up duplicating a lot of code that already exists in the memoryless library and has been proven to work.
Quoted 5 lines
A possible solution for the problem would be to separate the functions that control effect timing from the memoryless library and make them globally accessible. I believe that this would simplify any customized haptic implementation considerably and it might be a decent interim solution before the project Simon mentioned is ready.
How far are you on finishing the project?
If it is only a little bit out I can just keep with the memless RTP mode as a start and then implement the other functions once the solution is accepted.
Dan
Quoted 7 lines
If there is anybody interested in such a solution I can probably whip up a patch for it quite quickly.
Regards,
Michal
Signature · 6 lines
------------------ Dan Murphy -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Mark
Thanks for the feedback
Quoted 47 lines · Mark Rutland
Quoted 46 lines · Dan Murphy
Add the TI drv260x haptics/vibrator driver.
This device uses the input force feedback
to produce a wave form to driver an
ERM or LRA actuator device.The initial driver supports the devices
real time playback mode. But the device
has additional wave patterns in ROM.This functionality will be added in
future patchsets.Product data sheet is located here:
http://www.ti.com/product/drv2605Signed-off-by Dan Murphy <[email protected]>---
v2 - Fixed binding doc and patch headline - https://patchwork.kernel.org/patch/4619641/
.../devicetree/bindings/input/ti,drv260x.txt | 44 ++ drivers/input/misc/Kconfig | 9 + drivers/input/misc/Makefile | 1 + drivers/input/misc/drv260x.c | 537 ++++++++++++++++++++ include/dt-bindings/input/ti-drv260x.h | 30 ++ include/linux/input/drv260x.h | 181 +++++++ 6 files changed, 802 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/ti,drv260x.txt create mode 100644 drivers/input/misc/drv260x.c create mode 100644 include/dt-bindings/input/ti-drv260x.h create mode 100644 include/linux/input/drv260x.hDocumentation/devicetree/bindings/input/ti,drv260x.txt new file +8
-0@@ -0,0 +1,44 @@ +Texas Instruments - drv260x Haptics driver family + +The drv260x family serial control bus communicates through I2C protocols + +Required properties: + - compatible - One of: + "ti,drv2604" - DRV2604 + "ti,drv2605" - DRV2605
Quoted 8 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt line 14
Quoted 6 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +6
-0+ "ti,drv2605l" - DRV2605L + - reg - I2C slave address + - mode - Power up mode of the chip (defined in include/dt-bindings/input/ti-drv260x.h) + DRV260X_RTP_MODE - Real time playback mode + DRV260X_LRA_MODE - Linear Resonance Actuator mode (Piezoelectric) + DRV260X_ERM_MODE - Eccentric Rotating Mass mode (Rotary vibrator)What exactly are these, and why does the kernel not decide?
The LRA and ERM are vibrator types. These are specific to the product and the kernel cannot decide. The kernel driver needs to be told what type of vibrator is connected. The driver then sets the voltages and other settings to drive the vibrator type safely. All vibrators are dumb and do not have IDs identifying themselves so there is no self discovery here.
RTP is not a vibrator type but just a mode you can place the device into. I can probably remove that and have the user space or driver take care of that setting.
Quoted 14 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt line 15
Quoted 2 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +1
-0+ - library_sel - Library to use at power up (defined in include/dt-bindings/input/ti-drv260x.h)Please s/_/-/ in all property names.
Documentation/devicetree/bindings/input/ti,drv260x.txt line 21
Quoted 6 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +6
-0+ DRV260X_LIB_A - Pre-programmed Library + DRV260X_LIB_B - Pre-programmed Library + DRV260X_LIB_C - Pre-programmed Library + DRV260X_LIB_D - Pre-programmed Library + DRV260X_LIB_E - Pre-programmed Library + DRV260X_LIB_F - Pre-programmed LibraryWhat exactly are these, and why does the kernel not decide?
Quoted 8 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt line 27
Quoted 6 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +6
-0+ +Optional properties: + - enable-gpio - gpio pin to enable/disable the device. + - vib_rated_voltage - The rated voltage of the actuator. If this is not + set then the value will be defaulted to 0x90 in the + driver.What units is this in?
Good catch I was thinking this when I was writing the documentation but forgot to add it. I will fix the formatting here and below as well.
Quoted 4 lines
Don't mention the driver, just say "if not
0x90" (but with a better description of what0x90actually means).
OK
Quoted 8 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt line 30
Quoted 3 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +3
-0+ - vib_overdrive_voltage - The overdrive voltage of the actuator. + If this is not set then the value + will be defaulted to 0x90 in the driver.Similarly on both points.
[...]
Same as above as well
Quoted 28 lines
Quoted 15 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +15
-0+static int drv260x_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct drv260x_data *haptics; + struct device_node *np = client->dev.of_node; + struct drv260x_platform_data *pdata = client->dev.platform_data; + struct ff_device *ff; + int ret; + int voltage; + + haptics = devm_kzalloc(&client->dev, sizeof(*haptics), GFP_KERNEL); + if (!haptics) + return -ENOMEM; + + haptics->rated_voltage = DRV260X_DEF_OD_CLAMP_VOLT;Documentation/devicetree/bindings/input/ti,drv260x.txt
Quoted 10 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +10
-0+ haptics->rated_voltage = DRV260X_DEF_RATED_VOLT; + + if (np) { + ret = of_property_read_u32(np, "mode", &haptics->mode); + if (ret < 0) { + dev_err(&client->dev, + "%s: No entry for mode\n", __func__); + + return ret; + }No sanity checking on the actual value?
Quoted 2 lines
As far as I can see,
haptics->modeis an int, not a u32.
Will fix this and all points below.
Quoted 41 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt
Quoted 8 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +8
-0+ ret = of_property_read_u32(np, "library_sel", + &haptics->library); + if (ret < 0) { + dev_err(&client->dev, + "%s: No entry for library selection\n", __func__); + + return ret; + }Sanity checking?
haptics->libraryis not a u32.Documentation/devicetree/bindings/input/ti,drv260x.txt
Quoted 11 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +11
-0+ ret = of_property_read_u32(np, "vib_rated_voltage", + &voltage); + if (!ret) + haptics->rated_voltage = drv260x_calculate_voltage(voltage); + + + ret = of_property_read_u32(np, "vib_overdrive_voltage", + &voltage); + if (!ret) + haptics->overdrive_voltage = drv260x_calculate_voltage(voltage); +And again, on both points.
Documentation/devicetree/bindings/input/ti,drv260x.txt
Quoted 13 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +13
-0+ } else if (pdata) { + haptics->mode = pdata->mode; + haptics->library = pdata->library_selection; + if (pdata->vib_overdrive_voltage) + haptics->overdrive_voltage = drv260x_calculate_voltage(pdata->vib_overdrive_voltage); + if (pdata->vib_rated_voltage) + haptics->rated_voltage = drv260x_calculate_voltage(pdata->vib_rated_voltage); + } else { + dev_err(&client->dev, "Platform data not set\n"); + return -ENODEV; + } + + haptics->regulator = regulator_get(&client->dev, "vbat");
Quoted 1 line
This wasn't in the binding.
Yep will add it.
Dan
Quoted 4 lines
Thanks,
Mark.
Signature · 2 lines
------------------ Dan Murphy
Quoted 61 lines · Dan
Mark
Thanks for the feedback
Quoted 47 lines · Mark Rutland
Quoted 46 lines · Dan Murphy
Add the TI drv260x haptics/vibrator driver.
This device uses the input force feedback
to produce a wave form to driver an
ERM or LRA actuator device.The initial driver supports the devices
real time playback mode. But the device
has additional wave patterns in ROM.This functionality will be added in
future patchsets.Product data sheet is located here:
http://www.ti.com/product/drv2605Signed-off-by Dan Murphy <[email protected]>---
v2 - Fixed binding doc and patch headline - https://patchwork.kernel.org/patch/4619641/
.../devicetree/bindings/input/ti,drv260x.txt | 44 ++ drivers/input/misc/Kconfig | 9 + drivers/input/misc/Makefile | 1 + drivers/input/misc/drv260x.c | 537 ++++++++++++++++++++ include/dt-bindings/input/ti-drv260x.h | 30 ++ include/linux/input/drv260x.h | 181 +++++++ 6 files changed, 802 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/ti,drv260x.txt create mode 100644 drivers/input/misc/drv260x.c create mode 100644 include/dt-bindings/input/ti-drv260x.h create mode 100644 include/linux/input/drv260x.hDocumentation/devicetree/bindings/input/ti,drv260x.txt new file +8
-0@@ -0,0 +1,44 @@ +Texas Instruments - drv260x Haptics driver family + +The drv260x family serial control bus communicates through I2C protocols + +Required properties: + - compatible - One of: + "ti,drv2604" - DRV2604 + "ti,drv2605" - DRV2605Quoted 8 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt line 14
Quoted 6 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +6
-0+ "ti,drv2605l" - DRV2605L + - reg - I2C slave address + - mode - Power up mode of the chip (defined in include/dt-bindings/input/ti-drv260x.h) + DRV260X_RTP_MODE - Real time playback mode + DRV260X_LRA_MODE - Linear Resonance Actuator mode (Piezoelectric) + DRV260X_ERM_MODE - Eccentric Rotating Mass mode (Rotary vibrator)What exactly are these, and why does the kernel not decide?
Quoted 4 lines
The LRA and ERM are vibrator types. These are specific to the product and the kernel cannot decide. The kernel driver needs to be told what type of vibrator is connected. The driver then sets the voltages and other settings to drive the vibrator type safely. All vibrators are dumb and do not have IDs identifying themselves so there is no self discovery here.
I see. That makes sense, thanks for the description.
It might make more sense to call this "vibrator-type", rather than "mode", but otherwise this should be ok.
In the past I've asked for strings rather than magic numbers, but I'll leave that choice to you.
Quoted 2 lines
RTP is not a vibrator type but just a mode you can place the device into. I can probably remove that and have the user space or driver take care of that setting.
Ok, that sounds good to me.
Quoted 24 lines
Quoted 15 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt line 15
Quoted 3 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +1
-0+ - library_sel - Library to use at power up (defined in include/dt-bindings/input/ti-drv260x.h)Please s/_/-/ in all property names.
Documentation/devicetree/bindings/input/ti,drv260x.txt line 21
Quoted 6 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +6
-0+ DRV260X_LIB_A - Pre-programmed Library + DRV260X_LIB_B - Pre-programmed Library + DRV260X_LIB_C - Pre-programmed Library + DRV260X_LIB_D - Pre-programmed Library + DRV260X_LIB_E - Pre-programmed Library + DRV260X_LIB_F - Pre-programmed LibraryWhat exactly are these, and why does the kernel not decide?
Quoted 8 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt line 27
Quoted 6 lines
Documentation/devicetree/bindings/input/ti,drv260x.txt new file +6
-0+ +Optional properties: + - enable-gpio - gpio pin to enable/disable the device. + - vib_rated_voltage - The rated voltage of the actuator. If this is not + set then the value will be defaulted to 0x90 in the + driver.What units is this in?
Quoted 2 lines
Good catch I was thinking this when I was writing the documentation but forgot to add it. I will fix the formatting here and below as well.
Cheers.
Mark.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html