led: ledtrig-transient: add support for hrtimer
Subsystems (3)
v2 cover led: ledtrig-transient: add support for hrtimer
Hi,
These patch series add the LED_BRIGHTNESS_FAST flag support for ledtrig-transient to use hrtimer so that platforms with high-resolution timer support can have better accuracy in the trigger duration timing. The need for this support is driven by the fact that Android has removed the timed_ouput [1] and is now using led-trigger for handling vibrator control which requires the timer to be accurate up to a millisecond. However, this flag support would also allow hrtimer to co-exist with the ktimer without causing warning to the existing drivers [2].
David
[1] https://patchwork.kernel.org/patch/8664831/
[2] https://lkml.org/lkml/2015/4/28/260
Changes from v1 to v2:
- Convert all the bit shifting flag in leds.h to use the BIT macro.
- Removed inline modifiers for the timer helper function.
David Lin (3):
leds: Replace flags bit shift with BIT() macros
leds: Add the LED_BRIGHTNESS_FAST flag
led: ledtrig-transient: add support for hrtimer
Documentation/leds/leds-class.txt | 5 +++ drivers/leds/trigger/ledtrig-transient.c | 59 +++++++++++++++++++++++++++++--- include/linux/leds.h | 19 +++++----- 3 files changed, 69 insertions(+), 14 deletions(-)
Signature · 1 line
2.14.1.581.gf28d330327-goog
PATCH v2 1/3 leds: Replace flags bit shift with BIT() macros
This is for readability as well as to avoid checkpatch warnings when adding new bit flag information in the future.
--- include/linux/leds.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
include/linux/leds.h +9 -9
@@ -40,16 +40,16 @@ struct led_classdev {int flags;/* Lower 16 bits reflect status */ -#define LED_SUSPENDED (1 << 0) -#define LED_UNREGISTERING (1 << 1) +#define LED_SUSPENDED BIT(0) +#define LED_UNREGISTERING BIT(1)/* Upper 16 bits reflect control information */ -#define LED_CORE_SUSPENDRESUME (1 << 16) -#define LED_SYSFS_DISABLE (1 << 17) -#define LED_DEV_CAP_FLASH (1 << 18) -#define LED_HW_PLUGGABLE (1 << 19) -#define LED_PANIC_INDICATOR (1 << 20) -#define LED_BRIGHT_HW_CHANGED (1 << 21) -#define LED_RETAIN_AT_SHUTDOWN (1 << 22) +#define LED_CORE_SUSPENDRESUME BIT(16) +#define LED_SYSFS_DISABLE BIT(17) +#define LED_DEV_CAP_FLASH BIT(18) +#define LED_HW_PLUGGABLE BIT(19) +#define LED_PANIC_INDICATOR BIT(20) +#define LED_BRIGHT_HW_CHANGED BIT(21) +#define LED_RETAIN_AT_SHUTDOWN BIT(22)/* set_brightness_work / blink_timer flags, atomic, private. */ unsigned long work_flags;
Signature · 1 line
2.14.1.581.gf28d330327-goog
Jacek Anaszewski
AppliedRe: [PATCH v2 1/3] leds: Replace flags bit shift with BIT() macros
Hi David,
Thanks for the patch.
Quoted 29 lines · David Lin
This is for readability as well as to avoid checkpatch warnings when adding new bit flag information in the future.
Signed-off-by David Lin <[email protected]>--- include/linux/leds.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)include/linux/leds.h +2
-9@@ -40,16 +40,16 @@ struct led_classdev {int flags;/* Lower 16 bits reflect status */ -#define LED_SUSPENDED (1 << 0) -#define LED_UNREGISTERING (1 << 1) +#define LED_SUSPENDED BIT(0) +#define LED_UNREGISTERING BIT(1)/* Upper 16 bits reflect control information */ -#define LED_CORE_SUSPENDRESUME (1 << 16) -#define LED_SYSFS_DISABLE (1 << 17) -#define LED_DEV_CAP_FLASH (1 << 18) -#define LED_HW_PLUGGABLE (1 << 19) -#define LED_PANIC_INDICATOR (1 << 20) -#define LED_BRIGHT_HW_CHANGED (1 << 21) -#define LED_RETAIN_AT_SHUTDOWN (1 << 22)
include/linux/leds.h struct led_classdev { · line 55
Quoted 10 lines
include/linux/leds.h +7
-0+#define LED_CORE_SUSPENDRESUME BIT(16) +#define LED_SYSFS_DISABLE BIT(17) +#define LED_DEV_CAP_FLASH BIT(18) +#define LED_HW_PLUGGABLE BIT(19) +#define LED_PANIC_INDICATOR BIT(20) +#define LED_BRIGHT_HW_CHANGED BIT(21) +#define LED_RETAIN_AT_SHUTDOWN BIT(22)/* set_brightness_work / blink_timer flags, atomic, private. */ unsigned long work_flags;
This one should not raise any doubts.
Applied to the for-4.15 branch of linux-leds.git.
Signature · 2 lines
Best regards, Jacek Anaszewski
PATCH v2 2/3 leds: Add the LED_BRIGHTNESS_FAST flag
In reply to David LinThis patch adds the LED_BRIGHTNESS_FAST flag to allow the driver to indicate that the brightness_set() callback is implemented on a fastpath so that the LED core may choose to for example use a hrtimer to implement the duration of a trigger for better timing accuracy.
--- Documentation/leds/leds-class.txt | 5 +++++ include/linux/leds.h | 1 + 2 files changed, 6 insertions(+)
Documentation/leds/leds-class.txt +5 -0
@@ -80,6 +80,11 @@ flag must be set in flags before registering. Calling led_classdev_notify_brightness_hw_changed on a classdev not registered with the LED_BRIGHT_HW_CHANGED flag is a bug and will trigger a WARN_ON. +Optionally, the driver may choose to register with the LED_BRIGHTNESS_FAST flag. +This flag indicates that the driver implements the brightness_set() callback +function using a fastpath so the LED core can use hrtimer if the driver requires +high precision for the trigger timing. + Hardware accelerated blink of LEDs ==================================
include/linux/leds.h +1 -0
@@ -50,6 +50,7 @@ struct led_classdev {#define LED_PANIC_INDICATOR BIT(20)#define LED_BRIGHT_HW_CHANGED BIT(21)#define LED_RETAIN_AT_SHUTDOWN BIT(22) +#define LED_BRIGHTNESS_FAST BIT(23)/* set_brightness_work / blink_timer flags, atomic, private. */ unsigned long work_flags;
Signature · 1 line
2.14.1.581.gf28d330327-goog
PATCH v2 3/3 led: ledtrig-transient: add support for hrtimer
In reply to David LinThis patch adds a hrtimer to ledtrig-transient so that when driver is registered with LED_BRIGHTNESS_FAST, the hrtimer is used for the better time accuracy in handling the duration.
--- drivers/leds/trigger/ledtrig-transient.c | 59 +++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 5 deletions(-)
drivers/leds/trigger/ledtrig-transient.c +54 -5
@@ -24,15 +24,18 @@#include <linux/device.h> #include <linux/slab.h> #include <linux/timer.h> +#include <linux/hrtimer.h> #include <linux/leds.h> #include "../leds.h" struct transient_trig_data { +struct led_classdev *led_cdev;int activate;int state;int restore_state;unsigned long duration;struct timer_list timer; +struct hrtimer hrtimer; };static void transient_timer_function (unsigned long data)
@@ -44,6 +47,54 @@ static void transient_timer_function(unsigned long data)led_set_brightness_nosleep (led_cdev, transient_data->restore_state); } +static enum hrtimer_restart transient_hrtimer_function (struct hrtimer *timer) +{ +struct transient_trig_data *transient_data = + container_of(timer, struct transient_trig_data, hrtimer); + +transient_timer_function ((unsigned long )transient_data->led_cdev); + +return HRTIMER_NORESTART ; +} + +static void transient_timer_setup (struct led_classdev *led_cdev) +{ +struct transient_trig_data *tdata = led_cdev->trigger_data; + +if (led_cdev->flags &LED_BRIGHTNESS_FAST ) { + tdata->led_cdev = led_cdev; +hrtimer_init (&tdata->hrtimer,CLOCK_MONOTONIC , +HRTIMER_MODE_REL ); + tdata->hrtimer.function = transient_hrtimer_function; + }else { +setup_timer (&tdata->timer, transient_timer_function, + (unsigned long )led_cdev); + } +} + +static void transient_timer_start (struct led_classdev *led_cdev) +{ +struct transient_trig_data *tdata = led_cdev->trigger_data; + +if (led_cdev->flags &LED_BRIGHTNESS_FAST ) { +hrtimer_start (&tdata->hrtimer,ms_to_ktime (tdata->duration), +HRTIMER_MODE_REL ); + }else { +mod_timer (&tdata->timer, + jiffies +msecs_to_jiffies (tdata->duration)); + } +} + +static void transient_timer_cancel (struct led_classdev *led_cdev) +{ +struct transient_trig_data *tdata = led_cdev->trigger_data; + +if (led_cdev->flags &LED_BRIGHTNESS_FAST ) +hrtimer_cancel (&tdata->hrtimer); +else +del_timer_sync (&tdata->timer); +} +static ssize_t transient_activate_show (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -70,7 +121,7 @@ static ssize_t transient_activate_store(struct device *dev,/* cancel the running timer */ if (state ==0 && transient_data->activate ==1 ) { -del_timer (&transient_data->timer); +transient_timer_cancel (led_cdev); transient_data->activate = state;led_set_brightness_nosleep (led_cdev, transient_data->restore_state);
@@ -84,8 +135,7 @@ static ssize_t transient_activate_store(struct device *dev,led_set_brightness_nosleep (led_cdev, transient_data->state); transient_data->restore_state = (transient_data->state ==LED_FULL ) ?LED_OFF :LED_FULL ; -mod_timer (&transient_data->timer, - jiffies +msecs_to_jiffies (transient_data->duration)); +transient_timer_start (led_cdev); }/* state == 0 && transient_data->activate == 0
@@ -182,8 +232,7 @@ static void transient_trig_activate(struct led_classdev *led_cdev)if (rc) goto err_out_state; -setup_timer (&tdata->timer, transient_timer_function, - (unsigned long ) led_cdev); +transient_timer_setup (led_cdev); led_cdev->activated = true;return ;
Signature · 1 line
2.14.1.581.gf28d330327-goog
Pavel Machek
NAKHi!
Quoted 8 lines
These patch series add the
LED_BRIGHTNESS_FASTflag support for ledtrig-transient to use hrtimer so that platforms with high-resolution timer support can have better accuracy in the trigger duration timing. The need for this support is driven by the fact that Android has removed thetimed_ouput[1] and is now using led-trigger for handling vibrator control which requires the timer to be accurate up to a millisecond. However, this flag support would also allow hrtimer to co-exist with the ktimer without causing warning to the existing drivers [2].
NAK.
LEDs do not need extra overhead, and vibrator control should not go through LED subsystem.
Input subsystem includes support for vibrations and force feedback. Please use that instead.
Pavel
Quoted 10 lines
David Lin (3):
leds: Replace flags bit shift withBIT()macros
leds: Add theLED_BRIGHTNESS_FASTflag
led: ledtrig-transient: add support for hrtimerDocumentation/leds/leds-class.txt | 5 +++ drivers/leds/trigger/ledtrig-transient.c | 59 +++++++++++++++++++++++++++++--- include/linux/leds.h | 19 +++++----- 3 files changed, 69 insertions(+), 14 deletions(-)
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 12 lines · Pavel Machek
Hi!
Quoted 8 lines
These patch series add the
LED_BRIGHTNESS_FASTflag support for ledtrig-transient to use hrtimer so that platforms with high-resolution timer support can have better accuracy in the trigger duration timing. The need for this support is driven by the fact that Android has removed thetimed_ouput[1] and is now using led-trigger for handling vibrator control which requires the timer to be accurate up to a millisecond. However, this flag support would also allow hrtimer to co-exist with the ktimer without causing warning to the existing drivers [2].
Quoted 7 lines
NAK.
LEDs do not need extra overhead, and vibrator control should not go through LED subsystem.
Input subsystem includes support for vibrations and force feedback. Please use that instead.
I thought we are already over this discussion. As of now, the support of vibrator through ledtrig is documented (Documentation/leds/ledtrig-transient.txt) and there are users using it.
Quoted 18 lines · David Lin
Quoted 17 lines · Pavel Machek
Hi!
Quoted 8 lines
These patch series add the
LED_BRIGHTNESS_FASTflag support for ledtrig-transient to use hrtimer so that platforms with high-resolution timer support can have better accuracy in the trigger duration timing. The need for this support is driven by the fact that Android has removed thetimed_ouput[1] and is now using led-trigger for handling vibrator control which requires the timer to be accurate up to a millisecond. However, this flag support would also allow hrtimer to co-exist with the ktimer without causing warning to the existing drivers [2].NAK.
LEDs do not need extra overhead, and vibrator control should not go through LED subsystem.
Quoted 7 lines
Quoted 2 lines
Input subsystem includes support for vibrations and force feedback. Please use that instead.
I thought we are already over this discussion. As of now, the support of vibrator through ledtrig is documented (
Documentation/leds/ledtrig-transient.txt) and there are users using it.
I also thought we are over with that discussion.
Yes, I'm working on fixing the docs.
What mainline users are doing that?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 28 lines · Pavel Machek
Quoted 18 lines · David Lin
Quoted 17 lines · Pavel Machek
Hi!
Quoted 8 lines
These patch series add the
LED_BRIGHTNESS_FASTflag support for ledtrig-transient to use hrtimer so that platforms with high-resolution timer support can have better accuracy in the trigger duration timing. The need for this support is driven by the fact that Android has removed thetimed_ouput[1] and is now using led-trigger for handling vibrator control which requires the timer to be accurate up to a millisecond. However, this flag support would also allow hrtimer to co-exist with the ktimer without causing warning to the existing drivers [2].NAK.
LEDs do not need extra overhead, and vibrator control should not go through LED subsystem.
Quoted 7 lines
Quoted 2 lines
Input subsystem includes support for vibrations and force feedback. Please use that instead.
I thought we are already over this discussion. As of now, the support of vibrator through ledtrig is documented (
Documentation/leds/ledtrig-transient.txt) and there are users using it.
Quoted 5 lines
I also thought we are over with that discussion.
Yes, I'm working on fixing the docs.
What mainline users are doing that?
Please refer to patch:
https://patchwork.kernel.org/patch/8664831/ and
https://android.googlesource.com/platform%2Fhardware%2Flibhardware/+/61701df363310a5cbd95e3e1638baa9526e42c9b
I don't think currently there are drivers in the mainline using it yet, the reason being most of the Android devices are still on 4.4 kernel which still uses the legacy timed_output device.
Hi!
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
NAK.
LEDs do not need extra overhead, and vibrator control should not go through LED subsystem.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Input subsystem includes support for vibrations and force feedback. Please use that instead.
I thought we are already over this discussion. As of now, the support of vibrator through ledtrig is documented (
Documentation/leds/ledtrig-transient.txt) and there are users using it.
Stop misleading people. No _users_ are using Android on mainline kernel, as there is not a single Android phone supported by mainline kernel.
Quoted 6 lines
Quoted 5 lines
I also thought we are over with that discussion.
Yes, I'm working on fixing the docs.
What mainline users are doing that?
Quoted 7 lines
Please refer to patch:
https://patchwork.kernel.org/patch/8664831/ and
https://android.googlesource.com/platform%2Fhardware%2Flibhardware/+/61701df363310a5cbd95e3e1638baa9526e42c9bI don't think currently there are drivers in the mainline using it yet, the reason being most of the Android devices are still on 4.4 kernel which still uses the legacy
timed_outputdevice.
Ok. I'm sorry commit 61701df363310a5cbd95e3e1638baa9526e42c9b pushed your libhardware into wrong direction, but that is exactly what happened.
LED subsystem is not suitable for vibrations. We have input subsystem for that, it is handling vibrations for 10+ years, and for example Nokia N900 cellphone (which is supported by mainline) uses them.
Please fix libhardware accordingly.
Thank you,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi David and Pavel,
Quoted 11 lines · Pavel Machek
Hi!
Quoted 8 lines
These patch series add the
LED_BRIGHTNESS_FASTflag support for ledtrig-transient to use hrtimer so that platforms with high-resolution timer support can have better accuracy in the trigger duration timing. The need for this support is driven by the fact that Android has removed thetimed_ouput[1] and is now using led-trigger for handling vibrator control which requires the timer to be accurate up to a millisecond. However, this flag support would also allow hrtimer to co-exist with the ktimer without causing warning to the existing drivers [2].
Quoted 7 lines
NAK.
LEDs do not need extra overhead, and vibrator control should not go through LED subsystem.
Input subsystem includes support for vibrations and force feedback. Please use that instead.
I think that most vital criterion here is the usability of the interface. If it can be harnessed for doing the work seemingly unrelated to the primary subsystem's purpose, that's fine. Moreover, it is extremely easy to use in comparison to the force feedback one.
I would change one more thing in this patch, though. The hr_timer engine should be made optional and not used by default for fast LEDs. It could be made configurable by exposing additional sysfs file from ledtrig-transient.c, e.g. hr_timer_support, accepting boolean value.
Signature · 2 lines
Best regards, Jacek Anaszewski
Quoted 4 lines · Jacek Anaszewski
I would change one more thing in this patch, though. The
hr_timerengine should be made optional and not used by default for fast LEDs. It could be made configurable by exposing additional sysfs file fromledtrig-transient.c, e.g.hr_timer_support, accepting boolean value.
Do you mean in additional to checking the LED_BRIGHTNESS_FAST flag, userspace has to explicitly enable it via sysfs for ledtrig to select hrtimer? This seems to be redundant to me. Could you please explain your concerns and the benefit of doing this? Thanks.
Quoted 11 lines · David Lin
Quoted 4 lines · Jacek Anaszewski
I would change one more thing in this patch, though. The
hr_timerengine should be made optional and not used by default for fast LEDs. It could be made configurable by exposing additional sysfs file fromledtrig-transient.c, e.g.hr_timer_support, accepting boolean value.Do you mean in additional to checking the
LED_BRIGHTNESS_FASTflag, userspace has to explicitly enable it via sysfs for ledtrig to select hrtimer? This seems to be redundant to me. Could you please explain your concerns and the benefit of doing this? Thanks.
My concern is that fast LED users would be automatically imposed a hr_timer overhead, which they may not need.
Signature · 2 lines
Best regards, Jacek Anaszewski
Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
In reply to Jacek AnaszewskiQuoted 19 lines · Jacek Anaszewski
Hi David and Pavel,
Quoted 16 lines · Pavel Machek
Hi!
Quoted 8 lines
These patch series add the
LED_BRIGHTNESS_FASTflag support for ledtrig-transient to use hrtimer so that platforms with high-resolution timer support can have better accuracy in the trigger duration timing. The need for this support is driven by the fact that Android has removed thetimed_ouput[1] and is now using led-trigger for handling vibrator control which requires the timer to be accurate up to a millisecond. However, this flag support would also allow hrtimer to co-exist with the ktimer without causing warning to the existing drivers [2].NAK.
LEDs do not need extra overhead, and vibrator control should not go through LED subsystem.
Quoted 8 lines
Quoted 2 lines
Input subsystem includes support for vibrations and force feedback. Please use that instead.
I think that most vital criterion here is the usability of the interface. If it can be harnessed for doing the work seemingly unrelated to the primary subsystem's purpose, that's fine. Moreover, it is extremely easy to use in comparison to the force feedback one.
Well, no.
Kernel is supposed to provide hardware abstraction, that means it should hide differences between different devices.
And we already have devices using input as designed. We don't want to have situation where "on phones A, D and E, vibrations are handled via input, while on B, C and F, they are handled via /sys/class/leds".
If we want to have discussion "how to make vibrations in input easier to use", well that's fair. But I don't think it is particulary hard.
If we want to say "lets move all vibrations from input to LED subsystem"... I don't think that is good idea, but its a valid discussion. Some good reasons would be needed.
But having half devices use one interface and half use different one is just bad... especially when only reason to do it that way is "David wants to do it that way, android library made a mistake and he now wants it to propagate to whole world".
Thank you,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Quoted 34 lines · Pavel Machek
Quoted 19 lines · Jacek Anaszewski
Hi David and Pavel,
Quoted 16 lines · Pavel Machek
Hi!
Quoted 8 lines
These patch series add the
LED_BRIGHTNESS_FASTflag support for ledtrig-transient to use hrtimer so that platforms with high-resolution timer support can have better accuracy in the trigger duration timing. The need for this support is driven by the fact that Android has removed thetimed_ouput[1] and is now using led-trigger for handling vibrator control which requires the timer to be accurate up to a millisecond. However, this flag support would also allow hrtimer to co-exist with the ktimer without causing warning to the existing drivers [2].NAK.
LEDs do not need extra overhead, and vibrator control should not go through LED subsystem.
Quoted 8 lines
Quoted 2 lines
Input subsystem includes support for vibrations and force feedback. Please use that instead.
I think that most vital criterion here is the usability of the interface. If it can be harnessed for doing the work seemingly unrelated to the primary subsystem's purpose, that's fine. Moreover, it is extremely easy to use in comparison to the force feedback one.
Well, no.
Kernel is supposed to provide hardware abstraction, that means it should hide differences between different devices.
Quoted 7 lines
And we already have devices using input as designed. We don't want to have situation where "on phones A, D and E, vibrations are handled via input, while on B, C and F, they are handled via
/sys/class/leds".If we want to have discussion "how to make vibrations in input easier to use", well that's fair. But I don't think it is particulary hard.
I would like to know more about why you find the FF interface hard, given that for rumble you need calls - one ioctl to set up rumble parameters, and a write to start the playback. The FF core should take care of handling duration of the effect, ramping it up and decaying, if desired, and we make sure to automatically stop effects when userspace closes the fd (because of ordinary exit or crash or FD being revoked).
Quoted 6 lines
If we want to say "lets move all vibrations from input to LED subsystem"... I don't think that is good idea, but its a valid discussion. Some good reasons would be needed.
But having half devices use one interface and half use different one is just bad...
Completely agree here. I just merged PWM vibra driver from Sebastian Reichel, we already had regulator-haptic driver, do we need gpio-based one? Or make regulator-based one working with fixed regulators?
Thanks.
Signature · 1 line
Dmitry
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Quoted 39 lines · Dmitry Torokhov
Quoted 38 lines · Pavel Machek
Quoted 19 lines · Jacek Anaszewski
Hi David and Pavel,
Quoted 16 lines · Pavel Machek
Hi!
Quoted 8 lines
These patch series add the
LED_BRIGHTNESS_FASTflag support for ledtrig-transient to use hrtimer so that platforms with high-resolution timer support can have better accuracy in the trigger duration timing. The need for this support is driven by the fact that Android has removed thetimed_ouput[1] and is now using led-trigger for handling vibrator control which requires the timer to be accurate up to a millisecond. However, this flag support would also allow hrtimer to co-exist with the ktimer without causing warning to the existing drivers [2].NAK.
LEDs do not need extra overhead, and vibrator control should not go through LED subsystem.
Quoted 8 lines
Quoted 2 lines
Input subsystem includes support for vibrations and force feedback. Please use that instead.
I think that most vital criterion here is the usability of the interface. If it can be harnessed for doing the work seemingly unrelated to the primary subsystem's purpose, that's fine. Moreover, it is extremely easy to use in comparison to the force feedback one.
Well, no.
Kernel is supposed to provide hardware abstraction, that means it should hide differences between different devices.
And we already have devices using input as designed. We don't want to have situation where "on phones A, D and E, vibrations are handled via input, while on B, C and F, they are handled via
/sys/class/leds".
Quoted 5 lines
Quoted 3 lines
If we want to have discussion "how to make vibrations in input easier to use", well that's fair. But I don't think it is particulary hard.
I would like to know more about why you find the FF interface hard,
led-transient trigger can be activated using only following bash commands:
# echo 1 > state # echo 1000 > duration # while [ 1 ]; do echo 1 > activate; sleep 3; done
Could you share sample sequence of commands to use ff driver?
Quoted 11 lines
given that for rumble you need calls - one ioctl to set up rumble parameters, and a write to start the playback. The FF core should take care of handling duration of the effect, ramping it up and decaying, if desired, and we make sure to automatically stop effects when userspace closes the fd (because of ordinary exit or crash or FD being revoked).
Quoted 4 lines
If we want to say "lets move all vibrations from input to LED subsystem"... I don't think that is good idea, but its a valid discussion. Some good reasons would be needed.
Quoted 6 lines
Quoted 2 lines
But having half devices use one interface and half use different one is just bad...
Completely agree here. I just merged PWM vibra driver from Sebastian Reichel, we already had regulator-haptic driver, do we need gpio-based one? Or make regulator-based one working with fixed regulators?
Just to clarify: the background of this discussion is the question whether we should remove the following lines from Documentation/leds/ledtrig-transient.txt:
-As a specific example of this use-case, let's look at vibrate feature on -phones. Vibrate function on phones is implemented using PWM pins on SoC or -PMIC. There is a need to activate one shot timer to control the vibrate -feature, to prevent user space crashes leaving the phone in vibrate mode -permanently causing the battery to drain.
whether we should remove the following use case example from
In effect Pavel has objections to increasing ledtrig-transient interval accuracy by adding hr_timer support to it, because vibrate devices, as one of the use cases, can benefit from it.
So there are two issues:
1. Addition of hr_timer support to LED trigger.
2. Removal of vibrate devices use case from ledtrig-transient doc.
I am in favour of 1. and against 2. since we're not gaining anything by hiding information about some kernel functionality when it will still be there. It also doesn't define the location of any vibrate device drivers, since sheer leds-gpio driver can be used for that purpose.
Signature · 2 lines
Best regards, Jacek Anaszewski
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Quoted 46 lines · Jacek Anaszewski
Quoted 39 lines · Dmitry Torokhov
Quoted 38 lines · Pavel Machek
Quoted 19 lines · Jacek Anaszewski
Hi David and Pavel,
Quoted 16 lines · Pavel Machek
Hi!
Quoted 8 lines
These patch series add the
LED_BRIGHTNESS_FASTflag support for ledtrig-transient to use hrtimer so that platforms with high-resolution timer support can have better accuracy in the trigger duration timing. The need for this support is driven by the fact that Android has removed thetimed_ouput[1] and is now using led-trigger for handling vibrator control which requires the timer to be accurate up to a millisecond. However, this flag support would also allow hrtimer to co-exist with the ktimer without causing warning to the existing drivers [2].NAK.
LEDs do not need extra overhead, and vibrator control should not go through LED subsystem.
Quoted 8 lines
Quoted 2 lines
Input subsystem includes support for vibrations and force feedback. Please use that instead.
I think that most vital criterion here is the usability of the interface. If it can be harnessed for doing the work seemingly unrelated to the primary subsystem's purpose, that's fine. Moreover, it is extremely easy to use in comparison to the force feedback one.
Well, no.
Kernel is supposed to provide hardware abstraction, that means it should hide differences between different devices.
And we already have devices using input as designed. We don't want to have situation where "on phones A, D and E, vibrations are handled via input, while on B, C and F, they are handled via
/sys/class/leds".Quoted 5 lines
Quoted 3 lines
If we want to have discussion "how to make vibrations in input easier to use", well that's fair. But I don't think it is particulary hard.
I would like to know more about why you find the FF interface hard,
Quoted 8 lines
led-transient trigger can be activated using only following bash commands:
# echo 1 > state # echo 1000 > duration # while [ 1 ]; do echo 1 > activate; sleep 3; doneCould you share sample sequence of commands to use ff driver?
Cut what you need from this:
https://github.com/flosse/linuxconsole/blob/master/utils/fftest.c
If your objection is that FF is not easily engaged from the shell - yes, but I do not think that actual users who want to do vibration do that via shell either. On the other hand, can you drop privileges and still allow a certain process control your vibrator via LED interface? With FF you can pass an FD to whoever you deem worthy and later revoke access.
IOW sysfs interfaces are nice for quick hacks, but when you want to use them in real frameworks, where you need to think about proper namespaces, isolation, etc, etc, other kinds of interfaces might suit better.
Quoted 38 lines
Quoted 12 lines
given that for rumble you need calls - one ioctl to set up rumble parameters, and a write to start the playback. The FF core should take care of handling duration of the effect, ramping it up and decaying, if desired, and we make sure to automatically stop effects when userspace closes the fd (because of ordinary exit or crash or FD being revoked).
Quoted 4 lines
If we want to say "lets move all vibrations from input to LED subsystem"... I don't think that is good idea, but its a valid discussion. Some good reasons would be needed.
Quoted 6 lines
Quoted 2 lines
But having half devices use one interface and half use different one is just bad...
Completely agree here. I just merged PWM vibra driver from Sebastian Reichel, we already had regulator-haptic driver, do we need gpio-based one? Or make regulator-based one working with fixed regulators?
Just to clarify: the background of this discussion is the question whether we should remove the following lines from
Documentation/leds/ledtrig-transient.txt:(quoted diff) +0
-5-As a specific example of this use-case, let's look at vibrate feature on -phones. Vibrate function on phones is implemented using PWM pins on SoC or -PMIC. There is a need to activate one shot timer to control the vibrate -feature, to prevent user space crashes leaving the phone in vibrate mode -permanently causing the battery to drain.whether we should remove the following use case example from
In effect Pavel has objections to increasing ledtrig-transient interval accuracy by adding
hr_timersupport to it, because vibrate devices, as one of the use cases, can benefit from it.So there are two issues:
1. Addition ofhr_timersupport to LED trigger.
2. Removal of vibrate devices use case from ledtrig-transient doc.
Quoted 5 lines
I am in favour of 1. and against 2. since we're not gaining anything by hiding information about some kernel functionality when it will still be there. It also doesn't define the location of any vibrate device drivers, since sheer leds-gpio driver can be used for that purpose.
I would say that while leds-gpio can be used to do whatever (you can wire PS/2 mouse to a set of gpios and probably manage to drive it through a set of leds-gpio devices) it does not make it right interface for everything. We do have a standard interface for haptic (via rumble FF), at this moment I see no reason why we need another one. It just confuses userspace as it now needs to implement multiple interfaces, depending on the system it runs. Android expects that HAL will take care of hiding all of that from their upper layers and does not really pay close attention to kernel ABIs, but I think we should.
Thanks.
Signature · 1 line
Dmitry
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Quoted 67 lines · Dmitry Torokhov
Quoted 46 lines · Jacek Anaszewski
Quoted 39 lines · Dmitry Torokhov
Quoted 38 lines · Pavel Machek
Quoted 19 lines · Jacek Anaszewski
Hi David and Pavel,
Quoted 16 lines · Pavel Machek
Hi!
Quoted 8 lines
These patch series add the
LED_BRIGHTNESS_FASTflag support for ledtrig-transient to use hrtimer so that platforms with high-resolution timer support can have better accuracy in the trigger duration timing. The need for this support is driven by the fact that Android has removed thetimed_ouput[1] and is now using led-trigger for handling vibrator control which requires the timer to be accurate up to a millisecond. However, this flag support would also allow hrtimer to co-exist with the ktimer without causing warning to the existing drivers [2].NAK.
LEDs do not need extra overhead, and vibrator control should not go through LED subsystem.
Quoted 8 lines
Quoted 2 lines
Input subsystem includes support for vibrations and force feedback. Please use that instead.
I think that most vital criterion here is the usability of the interface. If it can be harnessed for doing the work seemingly unrelated to the primary subsystem's purpose, that's fine. Moreover, it is extremely easy to use in comparison to the force feedback one.
Well, no.
Kernel is supposed to provide hardware abstraction, that means it should hide differences between different devices.
And we already have devices using input as designed. We don't want to have situation where "on phones A, D and E, vibrations are handled via input, while on B, C and F, they are handled via
/sys/class/leds".Quoted 5 lines
Quoted 3 lines
If we want to have discussion "how to make vibrations in input easier to use", well that's fair. But I don't think it is particulary hard.
I would like to know more about why you find the FF interface hard,
Quoted 8 lines
led-transient trigger can be activated using only following bash commands:
# echo 1 > state # echo 1000 > duration # while [ 1 ]; do echo 1 > activate; sleep 3; doneCould you share sample sequence of commands to use ff driver?
Cut what you need from this:
https://github.com/flosse/linuxconsole/blob/master/utils/fftest.cIf your objection is that FF is not easily engaged from the shell - yes, but I do not think that actual users who want to do vibration do that via shell either. On the other hand, can you drop privileges and still allow a certain process control your vibrator via LED interface? With FF you can pass an FD to whoever you deem worthy and later revoke access.
Quoted 4 lines
IOW sysfs interfaces are nice for quick hacks, but when you want to use them in real frameworks, where you need to think about proper namespaces, isolation, etc, etc, other kinds of interfaces might suit better.
I'd leave the decision to the user. We could add a note to the Documentation/leds/ledtrig-transient.txt that force feedback interface should be preferable choice for driving vibrate devices. However only if following conditions are met:
- force feedback driver supports gpio driven devices
- there is sample application in tools/input showing how to setup gpio driven vibrate device with use of ff interface
- it will be possible to setup vibrate interval with 1ms accuracy, similarly to what the discussed patch allows to do
Quoted 38 lines
Quoted 38 lines
Quoted 12 lines
given that for rumble you need calls - one ioctl to set up rumble parameters, and a write to start the playback. The FF core should take care of handling duration of the effect, ramping it up and decaying, if desired, and we make sure to automatically stop effects when userspace closes the fd (because of ordinary exit or crash or FD being revoked).
Quoted 4 lines
If we want to say "lets move all vibrations from input to LED subsystem"... I don't think that is good idea, but its a valid discussion. Some good reasons would be needed.
Quoted 6 lines
Quoted 2 lines
But having half devices use one interface and half use different one is just bad...
Completely agree here. I just merged PWM vibra driver from Sebastian Reichel, we already had regulator-haptic driver, do we need gpio-based one? Or make regulator-based one working with fixed regulators?
Just to clarify: the background of this discussion is the question whether we should remove the following lines from
Documentation/leds/ledtrig-transient.txt:(quoted diff) +0
-5-As a specific example of this use-case, let's look at vibrate feature on -phones. Vibrate function on phones is implemented using PWM pins on SoC or -PMIC. There is a need to activate one shot timer to control the vibrate -feature, to prevent user space crashes leaving the phone in vibrate mode -permanently causing the battery to drain.whether we should remove the following use case example from
In effect Pavel has objections to increasing ledtrig-transient interval accuracy by adding
hr_timersupport to it, because vibrate devices, as one of the use cases, can benefit from it.So there are two issues:
1. Addition ofhr_timersupport to LED trigger.
2. Removal of vibrate devices use case from ledtrig-transient doc.
Quoted 15 lines
Quoted 5 lines
I am in favour of 1. and against 2. since we're not gaining anything by hiding information about some kernel functionality when it will still be there. It also doesn't define the location of any vibrate device drivers, since sheer leds-gpio driver can be used for that purpose.
I would say that while leds-gpio can be used to do whatever (you can wire PS/2 mouse to a set of gpios and probably manage to drive it through a set of leds-gpio devices) it does not make it right interface for everything. We do have a standard interface for haptic (via rumble FF), at this moment I see no reason why we need another one. It just confuses userspace as it now needs to implement multiple interfaces, depending on the system it runs. Android expects that HAL will take care of hiding all of that from their upper layers and does not really pay close attention to kernel ABIs, but I think we should.
Generally I agree, provided that user will be able to achieve the same using force feedback device as in case of LED transient trigger, with the same easy guidance on how to employ it to do this particular task with given hardware configuration.
Signature · 2 lines
Best regards, Jacek Anaszewski
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Hi!
Quoted 7 lines
Quoted 7 lines
If your objection is that FF is not easily engaged from the shell - yes, but I do not think that actual users who want to do vibration do that via shell either. On the other hand, can you drop privileges and still allow a certain process control your vibrator via LED interface? With FF you can pass an FD to whoever you deem worthy and later revoke access.
Quoted 8 lines
Quoted 4 lines
IOW sysfs interfaces are nice for quick hacks, but when you want to use them in real frameworks, where you need to think about proper namespaces, isolation, etc, etc, other kinds of interfaces might suit better.
I'd leave the decision to the user. We could add a note to the
Documentation/leds/ledtrig-transient.txtthat force feedback interface should be preferable choice for driving vibrate devices.
We don't want to leave decision to the user; because then we'll end up with userland applications having to support _both_ interfaces.
Plus, it is not really your decision. Dmitry is maintainer of input subsystem, input was doing force feedback for 10+ years, and he already made a decision.
Quoted 6 lines
However only if following conditions are met:
- force feedback driver supports gpio driven devices
- there is sample application intools/inputshowing how to setup gpio driven vibrate device with use of ff interface
- it will be possible to setup vibrate interval with 1ms accuracy, similarly to what the discussed patch allows to do
I agree these would be nice. Interested parties are welcome to help there. But I don't think this should have any impact on LED susbystem. Force feedback just does not belong to LED subsystem.
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Hi!
Quoted 2 lines
Quoted 2 lines
However only if following conditions are met:
- force feedback driver supports gpio driven devices
INPUT_PWM_VIBRA option was just merged into v4.14.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
In reply to Pavel MachekHi,
Quoted 14 lines · Pavel Machek
Hi!
Quoted 12 lines
Quoted 11 lines
If your objection is that FF is not easily engaged from the shell - yes, but I do not think that actual users who want to do vibration do that via shell either. On the other hand, can you drop privileges and still allow a certain process control your vibrator via LED interface? With FF you can pass an FD to whoever you deem worthy and later revoke access.
IOW sysfs interfaces are nice for quick hacks, but when you want to use them in real frameworks, where you need to think about proper namespaces, isolation, etc, etc, other kinds of interfaces might suit better.
Quoted 6 lines
Quoted 3 lines
I'd leave the decision to the user. We could add a note to the
Documentation/leds/ledtrig-transient.txtthat force feedback interface should be preferable choice for driving vibrate devices.We don't want to leave decision to the user; because then we'll end up with userland applications having to support _both_ interfaces.
This state has lasted for five years now. I don't recall any complaints. Do you?
Quoted 3 lines
Plus, it is not really your decision. Dmitry is maintainer of input subsystem, input was doing force feedback for 10+ years, and he already made a decision.
It seems that you applied a fait accompli method here.
Actually could you share what the decision is? AFAIK we're not discussing here any patch for the input subsystem?
Quoted 10 lines
Quoted 6 lines
However only if following conditions are met:
- force feedback driver supports gpio driven devices
- there is sample application intools/inputshowing how to setup gpio driven vibrate device with use of ff interface
- it will be possible to setup vibrate interval with 1ms accuracy, similarly to what the discussed patch allows to doI agree these would be nice. Interested parties are welcome to help there. But I don't think this should have any impact on LED susbystem. Force feedback just does not belong to LED subsystem.
You cut off important piece of my text from the beginning of this paragraph. It was:
Quoted 4 lines
I'd leave the decision to the user. We could add a note to the
Documentation/leds/ledtrig-transient.txtthat force feedback interface should be preferable choice for driving vibrate devices. However only if following conditions are met:
What I meant is that it is my decision, as a LED subsystem maintainer, to accept the addition of a note about some other subsystem offering an equivalent or even better substitute of the feature being available in the subsystem I am responsible for. And I will accept such a patch only if mentioned conditions are met.
Signature · 2 lines
Best regards, Jacek Anaszewski
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Quoted 21 lines · Jacek Anaszewski
Hi,
Quoted 18 lines · Pavel Machek
Hi!
Quoted 15 lines
Quoted 11 lines
If your objection is that FF is not easily engaged from the shell - yes, but I do not think that actual users who want to do vibration do that via shell either. On the other hand, can you drop privileges and still allow a certain process control your vibrator via LED interface? With FF you can pass an FD to whoever you deem worthy and later revoke access.
IOW sysfs interfaces are nice for quick hacks, but when you want to use them in real frameworks, where you need to think about proper namespaces, isolation, etc, etc, other kinds of interfaces might suit better.
I'd leave the decision to the user. We could add a note to the
Documentation/leds/ledtrig-transient.txtthat force feedback interface should be preferable choice for driving vibrate devices.
Quoted 5 lines
Quoted 2 lines
We don't want to leave decision to the user; because then we'll end up with userland applications having to support _both_ interfaces.
This state has lasted for five years now. I don't recall any complaints. Do you?
I was telling Shuah 5 years ago that using LED for what she wanted was not the right idea. I even made a patch for her implementing the functionality they were after: https://lkml.org/lkml/2012/4/10/41
Unfortunately this still somehow made it into the kernel. I guess the angle of having LEDs auto-shutoff makes sense still; using it for haptics does not.
Quoted 9 lines
Quoted 4 lines
Plus, it is not really your decision. Dmitry is maintainer of input subsystem, input was doing force feedback for 10+ years, and he already made a decision.
It seems that you applied a fait accompli method here.
Actually could you share what the decision is? AFAIK we're not discussing here any patch for the input subsystem?
No, we are discussing if it makes sense encouraging 2nd interface for haptic. We are also discussing whether it makes sense to implement new features in LED subsystem that seem to be only beneficial for this interface (I assume the "normal" LEDs do not need that kind of precision?).
Quoted 20 lines
Quoted 11 lines
Quoted 7 lines
However only if following conditions are met:
- force feedback driver supports gpio driven devices
- there is sample application intools/inputshowing how to setup gpio driven vibrate device with use of ff interface
- it will be possible to setup vibrate interval with 1ms accuracy, similarly to what the discussed patch allows to doI agree these would be nice. Interested parties are welcome to help there. But I don't think this should have any impact on LED susbystem. Force feedback just does not belong to LED subsystem.
You cut off important piece of my text from the beginning of this paragraph. It was:
Quoted 4 lines
I'd leave the decision to the user. We could add a note to the
Documentation/leds/ledtrig-transient.txtthat force feedback interface should be preferable choice for driving vibrate devices. However only if following conditions are met:
Quoted 5 lines
What I meant is that it is my decision, as a LED subsystem maintainer, to accept the addition of a note about some other subsystem offering an equivalent or even better substitute of the feature being available in the subsystem I am responsible for. And I will accept such a patch only if mentioned conditions are met.
Having the wording in documentation does not in any way stops Android folks from continuing [ab]using the transient trigger. But this is their choice. The purpose of documentation is to document the best practices, not all possible crazy solutions one can come up with.
Thanks.
Signature · 1 line
Dmitry
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Quoted 29 lines · Dmitry Torokhov
Quoted 21 lines · Jacek Anaszewski
Hi,
Quoted 18 lines · Pavel Machek
Hi!
Quoted 15 lines
Quoted 11 lines
If your objection is that FF is not easily engaged from the shell - yes, but I do not think that actual users who want to do vibration do that via shell either. On the other hand, can you drop privileges and still allow a certain process control your vibrator via LED interface? With FF you can pass an FD to whoever you deem worthy and later revoke access.
IOW sysfs interfaces are nice for quick hacks, but when you want to use them in real frameworks, where you need to think about proper namespaces, isolation, etc, etc, other kinds of interfaces might suit better.
I'd leave the decision to the user. We could add a note to the
Documentation/leds/ledtrig-transient.txtthat force feedback interface should be preferable choice for driving vibrate devices.Quoted 5 lines
Quoted 2 lines
We don't want to leave decision to the user; because then we'll end up with userland applications having to support _both_ interfaces.
This state has lasted for five years now. I don't recall any complaints. Do you?
Quoted 7 lines
I was telling Shuah 5 years ago that using LED for what she wanted was not the right idea. I even made a patch for her implementing the functionality they were after: https://lkml.org/lkml/2012/4/10/41
Unfortunately this still somehow made it into the kernel. I guess the angle of having LEDs auto-shutoff makes sense still; using it for haptics does not.
Thanks for the pointer.
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Plus, it is not really your decision. Dmitry is maintainer of input subsystem, input was doing force feedback for 10+ years, and he already made a decision.
It seems that you applied a fait accompli method here.
Quoted 8 lines
Quoted 2 lines
Actually could you share what the decision is? AFAIK we're not discussing here any patch for the input subsystem?
No, we are discussing if it makes sense encouraging 2nd interface for haptic. We are also discussing whether it makes sense to implement new features in LED subsystem that seem to be only beneficial for this interface (I assume the "normal" LEDs do not need that kind of precision?).
As you noticed in one of the previous messages, thanks to the leds-gpio driver we can drive a wide range of devices from the level of LED subsystem. LED trigger mechanism makes it even more versatile, and, in this area, even somehow akin to the GPIO subsystem. In the future we could think of making this trigger mechanism accessible by the two and thus any initiative aiming at enhancing it shouldn't be discouraged.
Quoted 25 lines
Quoted 19 lines
Quoted 10 lines
Quoted 6 lines
However only if following conditions are met:
- force feedback driver supports gpio driven devices
- there is sample application intools/inputshowing how to setup gpio driven vibrate device with use of ff interface
- it will be possible to setup vibrate interval with 1ms accuracy, similarly to what the discussed patch allows to doI agree these would be nice. Interested parties are welcome to help there. But I don't think this should have any impact on LED susbystem. Force feedback just does not belong to LED subsystem.
You cut off important piece of my text from the beginning of this paragraph. It was:
Quoted 4 lines
I'd leave the decision to the user. We could add a note to the
Documentation/leds/ledtrig-transient.txtthat force feedback interface should be preferable choice for driving vibrate devices. However only if following conditions are met:Quoted 5 lines
What I meant is that it is my decision, as a LED subsystem maintainer, to accept the addition of a note about some other subsystem offering an equivalent or even better substitute of the feature being available in the subsystem I am responsible for. And I will accept such a patch only if mentioned conditions are met.
Quoted 4 lines
Having the wording in documentation does not in any way stops Android folks from continuing [ab]using the transient trigger. But this is their choice. The purpose of documentation is to document the best practices, not all possible crazy solutions one can come up with.
Yes. but if the information has been in place for years, we can't just remove it without giving an instruction on how to use the substitute.
Signature · 2 lines
Best regards, Jacek Anaszewski
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Quoted 56 lines · Jacek Anaszewski
Quoted 29 lines · Dmitry Torokhov
Quoted 21 lines · Jacek Anaszewski
Hi,
Quoted 18 lines · Pavel Machek
Hi!
Quoted 15 lines
Quoted 11 lines
If your objection is that FF is not easily engaged from the shell - yes, but I do not think that actual users who want to do vibration do that via shell either. On the other hand, can you drop privileges and still allow a certain process control your vibrator via LED interface? With FF you can pass an FD to whoever you deem worthy and later revoke access.
IOW sysfs interfaces are nice for quick hacks, but when you want to use them in real frameworks, where you need to think about proper namespaces, isolation, etc, etc, other kinds of interfaces might suit better.
I'd leave the decision to the user. We could add a note to the
Documentation/leds/ledtrig-transient.txtthat force feedback interface should be preferable choice for driving vibrate devices.Quoted 5 lines
Quoted 2 lines
We don't want to leave decision to the user; because then we'll end up with userland applications having to support _both_ interfaces.
This state has lasted for five years now. I don't recall any complaints. Do you?
Quoted 7 lines
I was telling Shuah 5 years ago that using LED for what she wanted was not the right idea. I even made a patch for her implementing the functionality they were after: https://lkml.org/lkml/2012/4/10/41
Unfortunately this still somehow made it into the kernel. I guess the angle of having LEDs auto-shutoff makes sense still; using it for haptics does not.
Thanks for the pointer.
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Plus, it is not really your decision. Dmitry is maintainer of input subsystem, input was doing force feedback for 10+ years, and he already made a decision.
It seems that you applied a fait accompli method here.
Quoted 8 lines
Quoted 2 lines
Actually could you share what the decision is? AFAIK we're not discussing here any patch for the input subsystem?
No, we are discussing if it makes sense encouraging 2nd interface for haptic. We are also discussing whether it makes sense to implement new features in LED subsystem that seem to be only beneficial for this interface (I assume the "normal" LEDs do not need that kind of precision?).
Quoted 3 lines
As you noticed in one of the previous messages, thanks to the leds-gpio driver we can drive a wide range of devices from the level of LED subsystem.
Yes, you can create whatever. It goes normally as this: crap, we need to ship something really soon, factory build is a week from now and we have absolutely no time to think about proper interface. Hey, let's quickly bolt on some quirk on an unrelated interface, it almost does what we want. We do not care that out use case does not really fit here, our custom one-off userspace will know how to deal with it.
Quoted 5 lines
LED trigger mechanism makes it even more versatile,
and, in this area, even somehow akin to the GPIO subsystem. In the future we could think of making this trigger mechanism accessible by the two and thus any initiative aiming at enhancing it shouldn't be discouraged.
If there is a use case that would benefit from this functionality:
certainly. Do you have one in mind?
Thanks.
Signature · 1 line
Dmitry
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Quoted 69 lines · Dmitry Torokhov
Quoted 56 lines · Jacek Anaszewski
Quoted 29 lines · Dmitry Torokhov
Quoted 21 lines · Jacek Anaszewski
Hi,
Quoted 18 lines · Pavel Machek
Hi!
Quoted 15 lines
Quoted 11 lines
If your objection is that FF is not easily engaged from the shell - yes, but I do not think that actual users who want to do vibration do that via shell either. On the other hand, can you drop privileges and still allow a certain process control your vibrator via LED interface? With FF you can pass an FD to whoever you deem worthy and later revoke access.
IOW sysfs interfaces are nice for quick hacks, but when you want to use them in real frameworks, where you need to think about proper namespaces, isolation, etc, etc, other kinds of interfaces might suit better.
I'd leave the decision to the user. We could add a note to the
Documentation/leds/ledtrig-transient.txtthat force feedback interface should be preferable choice for driving vibrate devices.Quoted 5 lines
Quoted 2 lines
We don't want to leave decision to the user; because then we'll end up with userland applications having to support _both_ interfaces.
This state has lasted for five years now. I don't recall any complaints. Do you?
Quoted 7 lines
I was telling Shuah 5 years ago that using LED for what she wanted was not the right idea. I even made a patch for her implementing the functionality they were after: https://lkml.org/lkml/2012/4/10/41
Unfortunately this still somehow made it into the kernel. I guess the angle of having LEDs auto-shutoff makes sense still; using it for haptics does not.
Thanks for the pointer.
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Plus, it is not really your decision. Dmitry is maintainer of input subsystem, input was doing force feedback for 10+ years, and he already made a decision.
It seems that you applied a fait accompli method here.
Quoted 8 lines
Quoted 2 lines
Actually could you share what the decision is? AFAIK we're not discussing here any patch for the input subsystem?
No, we are discussing if it makes sense encouraging 2nd interface for haptic. We are also discussing whether it makes sense to implement new features in LED subsystem that seem to be only beneficial for this interface (I assume the "normal" LEDs do not need that kind of precision?).
Quoted 3 lines
As you noticed in one of the previous messages, thanks to the leds-gpio driver we can drive a wide range of devices from the level of LED subsystem.
Yes, you can create whatever. It goes normally as this: crap, we need to ship something really soon, factory build is a week from now and we have absolutely no time to think about proper interface. Hey, let's quickly bolt on some quirk on an unrelated interface, it almost does what we want. We do not care that out use case does not really fit here, our custom one-off userspace will know how to deal with it.
Quoted 8 lines
Quoted 5 lines
LED trigger mechanism makes it even more versatile,
and, in this area, even somehow akin to the GPIO subsystem. In the future we could think of making this trigger mechanism accessible by the two and thus any initiative aiming at enhancing it shouldn't be discouraged.If there is a use case that would benefit from this functionality:
certainly. Do you have one in mind?
Few minutes of googling gave below results. People are doing that anyway so adding EXPERIMENTAL support in mainline maybe wouldn't be such a wrong idea. It seems that there would be many testers.
[0]
https://stackoverflow.com/questions/16534668/how-to-generate-a-steady-37khz-gpio-trigger-from-inside-linux-kernel
[1]
https://discuss.96boards.org/t/generate-high-frequency-square-wave-on-a-gpio-pin/2615/4
[2]
https://stackoverflow.com/questions/4634991/how-to-generate-100khz-clock-signal-in-liunx-kernel-module-with-bit-banging
[3] http://www.friendlyarm.net/forum/topic/3566
[4] http://codeandlife.com/2016/04/18/beaglebone-black-gpio-benchmark/
[5] https://www.raspberrypi.org/forums/viewtopic.php?t=56748
Signature · 2 lines
Best regards, Jacek Anaszewski
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
In reply to Jacek AnaszewskiQuoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 4 lines
I'd leave the decision to the user. We could add a note to the
Documentation/leds/ledtrig-transient.txtthat force feedback interface should be preferable choice for driving vibrate devices. However only if following conditions are met:What I meant is that it is my decision, as a LED subsystem maintainer, to accept the addition of a note about some other subsystem offering an equivalent or even better substitute of the feature being available in the subsystem I am responsible for. And I will accept such a patch only if mentioned conditions are met.
Quoted 8 lines
Quoted 4 lines
Having the wording in documentation does not in any way stops Android folks from continuing [ab]using the transient trigger. But this is their choice. The purpose of documentation is to document the best practices, not all possible crazy solutions one can come up with.
Yes. but if the information has been in place for years, we can't just remove it without giving an instruction on how to use the substitute.
I gave you information how to use the substitute.
I already suggested patch to documentation. If you do the same, maybe we can agree on documentation update.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Quoted 16 lines · Pavel Machek
Quoted 16 lines
Quoted 15 lines
Quoted 10 lines
Quoted 4 lines
I'd leave the decision to the user. We could add a note to the
Documentation/leds/ledtrig-transient.txtthat force feedback interface should be preferable choice for driving vibrate devices. However only if following conditions are met:What I meant is that it is my decision, as a LED subsystem maintainer, to accept the addition of a note about some other subsystem offering an equivalent or even better substitute of the feature being available in the subsystem I am responsible for. And I will accept such a patch only if mentioned conditions are met.
Having the wording in documentation does not in any way stops Android folks from continuing [ab]using the transient trigger. But this is their choice. The purpose of documentation is to document the best practices, not all possible crazy solutions one can come up with.
Quoted 5 lines
Quoted 3 lines
Yes. but if the information has been in place for years, we can't just remove it without giving an instruction on how to use the substitute.
I gave you information how to use the substitute.
That information was quite vague. I'd like to see a sample application in tools/input.
Quoted 2 lines
I already suggested patch to documentation. If you do the same, maybe we can agree on documentation update.
Your patch was just removing few lines of documentation. I'd expect more empathic approach to the current users, i.e.:
- pointer to the sample application in tools/input showing how to setup gpio driven vibrate device with use of ff interface with 1kHz vibration frequency.
Signature · 2 lines
Best regards, Jacek Anaszewski
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Quoted 17 lines · Jacek Anaszewski
Quoted 16 lines · Pavel Machek
Quoted 16 lines
Quoted 15 lines
Quoted 10 lines
Quoted 4 lines
I'd leave the decision to the user. We could add a note to the
Documentation/leds/ledtrig-transient.txtthat force feedback interface should be preferable choice for driving vibrate devices. However only if following conditions are met:What I meant is that it is my decision, as a LED subsystem maintainer, to accept the addition of a note about some other subsystem offering an equivalent or even better substitute of the feature being available in the subsystem I am responsible for. And I will accept such a patch only if mentioned conditions are met.
Having the wording in documentation does not in any way stops Android folks from continuing [ab]using the transient trigger. But this is their choice. The purpose of documentation is to document the best practices, not all possible crazy solutions one can come up with.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Yes. but if the information has been in place for years, we can't just remove it without giving an instruction on how to use the substitute.
I gave you information how to use the substitute.
That information was quite vague. I'd like to see a sample application in
tools/input.
So please write it.
Quoted 9 lines
Quoted 2 lines
I already suggested patch to documentation. If you do the same, maybe we can agree on documentation update.
Your patch was just removing few lines of documentation. I'd expect more empathic approach to the current users, i.e.:
- pointer to the sample application in
tools/inputshowing how to setup gpio driven vibrate device with use of ff interface with 1kHz vibration frequency.
Yes, my patch is removing dangerously misleading documentation about LED subsystem.
Please apply it.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Quoted 22 lines · Pavel Machek
Quoted 21 lines · Jacek Anaszewski
Quoted 20 lines · Pavel Machek
Quoted 19 lines
Quoted 11 lines
Quoted 10 lines
Quoted 4 lines
I'd leave the decision to the user. We could add a note to the
Documentation/leds/ledtrig-transient.txtthat force feedback interface should be preferable choice for driving vibrate devices. However only if following conditions are met:What I meant is that it is my decision, as a LED subsystem maintainer, to accept the addition of a note about some other subsystem offering an equivalent or even better substitute of the feature being available in the subsystem I am responsible for. And I will accept such a patch only if mentioned conditions are met.
Quoted 4 lines
Having the wording in documentation does not in any way stops Android folks from continuing [ab]using the transient trigger. But this is their choice. The purpose of documentation is to document the best practices, not all possible crazy solutions one can come up with.
Yes. but if the information has been in place for years, we can't just remove it without giving an instruction on how to use the substitute.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
I gave you information how to use the substitute.
That information was quite vague. I'd like to see a sample application in
tools/input.So please write it.
This is my demand as a reviewer. I've already laid out the conditions under which I'll accept the patch. It seems that you're proficient in the subject enough to cope with this task.
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
I already suggested patch to documentation. If you do the same, maybe we can agree on documentation update.
Your patch was just removing few lines of documentation. I'd expect more empathic approach to the current users, i.e.:
Quoted 6 lines
Quoted 3 lines
- pointer to the sample application in
tools/inputshowing how to setup gpio driven vibrate device with use of ff interface with 1kHz vibration frequency.Yes, my patch is removing dangerously misleading documentation about LED subsystem.
It's neither dangerous nor misleading.
Quoted 1 line
Please apply it.
Right after I'll get the patch with the tool showing how to use input subsystem to achieve the same effect as with use of ledtrig-transient.
Signature · 2 lines
Best regards, Jacek Anaszewski
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
In reply to Jacek AnaszewskiHi!
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
However only if following conditions are met:
- force feedback driver supports gpio driven devices
- there is sample application intools/inputshowing how to setup gpio driven vibrate device with use of ff interface
- it will be possible to setup vibrate interval with 1ms accuracy, similarly to what the discussed patch allows to do
Quoted 11 lines
Quoted 3 lines
I agree these would be nice. Interested parties are welcome to help there. But I don't think this should have any impact on LED susbystem. Force feedback just does not belong to LED subsystem.
You cut off important piece of my text from the beginning of this paragraph. It was:
Quoted 4 lines
I'd leave the decision to the user. We could add a note to the
Documentation/leds/ledtrig-transient.txtthat force feedback interface should be preferable choice for driving vibrate devices. However only if following conditions are met:
And that's very bad idea.
As a user of these interfaces, I am telling you: I want _single_ kernel interface to control vibration. Not different interfaces depending on which phone I'm running at.
Quoted 5 lines
What I meant is that it is my decision, as a LED subsystem maintainer, to accept the addition of a note about some other subsystem offering an equivalent or even better substitute of the feature being available in the subsystem I am responsible for. And I will accept such a patch only if mentioned conditions are met.
If you want to improve input, please go ahead.
If you want to encourage haptic feedback to use LED subsystem, that is not welcome.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
In reply to Dmitry TorokhovDmitry,
Quoted 110 lines · Dmitry Torokhov
Quoted 46 lines · Jacek Anaszewski
Quoted 39 lines · Dmitry Torokhov
Quoted 38 lines · Pavel Machek
Quoted 19 lines · Jacek Anaszewski
Hi David and Pavel,
Quoted 16 lines · Pavel Machek
Hi!
Quoted 8 lines
These patch series add the
LED_BRIGHTNESS_FASTflag support for ledtrig-transient to use hrtimer so that platforms with high-resolution timer support can have better accuracy in the trigger duration timing. The need for this support is driven by the fact that Android has removed thetimed_ouput[1] and is now using led-trigger for handling vibrator control which requires the timer to be accurate up to a millisecond. However, this flag support would also allow hrtimer to co-exist with the ktimer without causing warning to the existing drivers [2].NAK.
LEDs do not need extra overhead, and vibrator control should not go through LED subsystem.
Quoted 8 lines
Quoted 2 lines
Input subsystem includes support for vibrations and force feedback. Please use that instead.
I think that most vital criterion here is the usability of the interface. If it can be harnessed for doing the work seemingly unrelated to the primary subsystem's purpose, that's fine. Moreover, it is extremely easy to use in comparison to the force feedback one.
Well, no.
Kernel is supposed to provide hardware abstraction, that means it should hide differences between different devices.
And we already have devices using input as designed. We don't want to have situation where "on phones A, D and E, vibrations are handled via input, while on B, C and F, they are handled via
/sys/class/leds".Quoted 5 lines
Quoted 3 lines
If we want to have discussion "how to make vibrations in input easier to use", well that's fair. But I don't think it is particulary hard.
I would like to know more about why you find the FF interface hard,
Quoted 8 lines
led-transient trigger can be activated using only following bash commands:
# echo 1 > state # echo 1000 > duration # while [ 1 ]; do echo 1 > activate; sleep 3; doneCould you share sample sequence of commands to use ff driver?
Cut what you need from this:
https://github.com/flosse/linuxconsole/blob/master/utils/fftest.cIf your objection is that FF is not easily engaged from the shell - yes, but I do not think that actual users who want to do vibration do that via shell either. On the other hand, can you drop privileges and still allow a certain process control your vibrator via LED interface? With FF you can pass an FD to whoever you deem worthy and later revoke access.
IOW sysfs interfaces are nice for quick hacks, but when you want to use them in real frameworks, where you need to think about proper namespaces, isolation, etc, etc, other kinds of interfaces might suit better.
Quoted 38 lines
Quoted 12 lines
given that for rumble you need calls - one ioctl to set up rumble parameters, and a write to start the playback. The FF core should take care of handling duration of the effect, ramping it up and decaying, if desired, and we make sure to automatically stop effects when userspace closes the fd (because of ordinary exit or crash or FD being revoked).
Quoted 4 lines
If we want to say "lets move all vibrations from input to LED subsystem"... I don't think that is good idea, but its a valid discussion. Some good reasons would be needed.
Quoted 6 lines
Quoted 2 lines
But having half devices use one interface and half use different one is just bad...
Completely agree here. I just merged PWM vibra driver from Sebastian Reichel, we already had regulator-haptic driver, do we need gpio-based one? Or make regulator-based one working with fixed regulators?
Just to clarify: the background of this discussion is the question whether we should remove the following lines from
Documentation/leds/ledtrig-transient.txt:(quoted diff) +0
-5-As a specific example of this use-case, let's look at vibrate feature on -phones. Vibrate function on phones is implemented using PWM pins on SoC or -PMIC. There is a need to activate one shot timer to control the vibrate -feature, to prevent user space crashes leaving the phone in vibrate mode -permanently causing the battery to drain.whether we should remove the following use case example from
In effect Pavel has objections to increasing ledtrig-transient interval accuracy by adding
hr_timersupport to it, because vibrate devices, as one of the use cases, can benefit from it.So there are two issues:
1. Addition ofhr_timersupport to LED trigger.
2. Removal of vibrate devices use case from ledtrig-transient doc.
Quoted 15 lines
Quoted 5 lines
I am in favour of 1. and against 2. since we're not gaining anything by hiding information about some kernel functionality when it will still be there. It also doesn't define the location of any vibrate device drivers, since sheer leds-gpio driver can be used for that purpose.
I would say that while leds-gpio can be used to do whatever (you can wire PS/2 mouse to a set of gpios and probably manage to drive it through a set of leds-gpio devices) it does not make it right interface for everything. We do have a standard interface for haptic (via rumble FF), at this moment I see no reason why we need another one. It just confuses userspace as it now needs to implement multiple interfaces, depending on the system it runs. Android expects that HAL will take care of hiding all of that from their upper layers and does not really pay close attention to kernel ABIs, but I think we should.
One thing I noticed is that input_ff_create_memless() also does not use high-resolution timer hence it also does not have the stop-time precision that I'm looking for.
Another thing is that ff_reply duration value is maxed-out at 32767 ms (u16) while the Android/userspace requires size long for performing long notification alert.
David
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Quoted 152 lines · David Lin
Dmitry,
Quoted 4 lines · Dmitry Torokhov
Quoted 2 lines · Jacek Anaszewski
Quoted 1 line · Dmitry Torokhov
On Thu, Sep 14, 2017 at 1:58 PM, Pavel Machek <[email protected]> wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Jacek Anaszewski
Quoted 7 lines
Hi David and Pavel,
Quoted 4 lines · Pavel Machek
Hi!
Quoted 2 lines
These patch series add the
LED_BRIGHTNESS_FASTflag support for ledtrig-transient to use hrtimer so that platforms withhigh-resolution timer
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
support can have better accuracy in the trigger duration
timing. The need for
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
this support is driven by the fact that Android has removed the
timed_ouput[1]Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and is now using led-trigger for handling vibrator control
which requires the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
timer to be accurate up to a millisecond. However, this flag
support would also
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
allow hrtimer to co-exist with the ktimer without causing
warning to the
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
existing drivers [2].
NAK.
LEDs do not need extra overhead, and vibrator control should not
go
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 4 lines
through LED subsystem.
Input subsystem includes support for vibrations and force feedback. Please use that instead.
I think that most vital criterion here is the usability of the interface. If it can be harnessed for doing the work seemingly unrelated to the primary subsystem's purpose, that's fine. Moreover, it is extremely easy to use in comparison to the force feedback one.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Well, no.
Kernel is supposed to provide hardware abstraction, that means it should hide differences between different devices.
And we already have devices using input as designed. We don't want
to
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
have situation where "on phones A, D and E, vibrations are handled
via
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
input, while on B, C and F, they are handled via
/sys/class/leds".If we want to have discussion "how to make vibrations in input easier to use", well that's fair. But I don't think it is
particulary hard.
Quoted 13 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
I would like to know more about why you find the FF interface hard,
Quoted 8 lines
led-transient trigger can be activated using only following bash commands:
# echo 1 > state # echo 1000 > duration # while [ 1 ]; do echo 1 > activate; sleep 3; doneCould you share sample sequence of commands to use ff driver?
Quoted 7 lines
Cut what you need from this:
https://github.com/flosse/linuxconsole/blob/master/utils/fftest.cIf your objection is that FF is not easily engaged from the shell - yes, but I do not think that actual users who want to do vibration do that via shell either. On the other hand, can you drop privileges and still allow a certain process control your vibrator via LED
interface?
Quoted 1 line
With FF you can pass an FD to whoever you deem worthy and later
revoke
Quoted 10 lines
access.
IOW sysfs interfaces are nice for quick hacks, but when you want to use them in real frameworks, where you need to think about proper namespaces, isolation, etc, etc, other kinds of interfaces might suit better.
Quoted 3 lines
Quoted 3 lines
given that for rumble you need calls - one ioctl to set up rumble parameters, and a write to start the playback. The FF core should
take
Quoted 1 line
Quoted 1 line
Quoted 1 line
care of handling duration of the effect, ramping it up and
decaying,
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
if desired, and we make sure to automatically stop effects when userspace closes the fd (because of ordinary exit or crash or FD
being
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
revoked).
Quoted 5 lines
If we want to say "lets move all vibrations from input to LED subsystem"... I don't think that is good idea, but its a valid discussion. Some good reasons would be needed.
But having half devices use one interface and half use different
one
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
is just bad...
Completely agree here. I just merged PWM vibra driver from
Sebastian
Quoted 1 line
Quoted 1 line
Quoted 1 line
Reichel, we already had regulator-haptic driver, do we need
gpio-based
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
one? Or make regulator-based one working with fixed regulators?
Just to clarify: the background of this discussion is the question whether we should remove the following lines from
Documentation/leds/ledtrig-transient.txt:-As a specific example of this use-case, let's look at vibrate
feature on
Quoted 1 line
Quoted 1 line
-phones. Vibrate function on phones is implemented using PWM pins on
SoC or
Quoted 1 line
Quoted 1 line
-PMIC. There is a need to activate one shot timer to control the
vibrate
Quoted 1 line
Quoted 1 line
-feature, to prevent user space crashes leaving the phone in vibrate
mode
Quoted 17 lines
Quoted 11 lines
-permanently causing the battery to drain.
whether we should remove the following use case example fromIn effect Pavel has objections to increasing ledtrig-transient interval accuracy by adding
hr_timersupport to it, because vibrate devices, as one of the use cases, can benefit from it.So there are two issues:
1. Addition ofhr_timersupport to LED trigger.
2. Removal of vibrate devices use case from ledtrig-transient doc.Quoted 5 lines
I am in favour of 1. and against 2. since we're not gaining anything by hiding information about some kernel functionality when it will still be there. It also doesn't define the location of any vibrate device drivers, since sheer leds-gpio driver can be used for that purpose.
Quoted 9 lines
I would say that while leds-gpio can be used to do whatever (you can wire PS/2 mouse to a set of gpios and probably manage to drive it through a set of leds-gpio devices) it does not make it right interface for everything. We do have a standard interface for haptic (via rumble FF), at this moment I see no reason why we need another one. It just confuses userspace as it now needs to implement multiple interfaces, depending on the system it runs. Android expects that HAL will take care of hiding all of that from their upper layers and does not really pay close attention to kernel ABIs, but I think we should.
Quoted 3 lines
One thing I noticed is that
input_ff_create_memless()also does not use high-resolution timer hence it also does not have the stop-time precision that I'm looking for.
I'll take patches for high resolution timers in ff memless, they should also help with more accurate scheduling of ramping up and fading of events.
Quoted 5 lines
Another thing is that
ff_replyduration value is maxed-out at 32767 ms (u16) while the Android/userspace requires size long for performing long notification alert.
You need unattended vibrations lasting longer than 30 seconds? Anyway, replay.length == 0 means endless IIRC, so you only need to schedule stopping. We still will clean up properly if your process crashes or exits or closes the fd.
Thanks.
Signature · 1 line
Dmitry
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Quoted 5 lines · Dmitry Torokhov
Quoted 3 lines
One thing I noticed is that
input_ff_create_memless()also does not use high-resolution timer hence it also does not have the stop-time precision that I'm looking for.I'll take patches for high resolution timers in ff memless, they should also help with more accurate scheduling of ramping up and fading of events.
Thanks.
Quoted 8 lines
Quoted 6 lines
Another thing is that
ff_replyduration value is maxed-out at 32767 ms (u16) while the Android/userspace requires size long for performing long notification alert.You need unattended vibrations lasting longer than 30 seconds? Anyway, replay.length == 0 means endless IIRC, so you only need to schedule stopping. We still will clean up properly if your process crashes or exits or closes the fd.
Yes, it's up to the application to vibrate for as long as it requires. Is there any concern making the duration variable a type long? [If this is getting off-topic, I'll follow up with another email]
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Quoted 17 lines · David Lin
Quoted 5 lines · Dmitry Torokhov
Quoted 3 lines
One thing I noticed is that
input_ff_create_memless()also does not use high-resolution timer hence it also does not have the stop-time precision that I'm looking for.I'll take patches for high resolution timers in ff memless, they should also help with more accurate scheduling of ramping up and fading of events.
Thanks.
Quoted 7 lines
Quoted 6 lines
Another thing is that
ff_replyduration value is maxed-out at 32767 ms (u16) while the Android/userspace requires size long for performing long notification alert.
Quoted 5 lines
Quoted 1 line
You need unattended vibrations lasting longer than 30 seconds? Anyway, replay.length == 0 means endless IIRC, so you only need to schedule stopping. We still will clean up properly if your process crashes or exits or closes the fd.
Yes, it's up to the application to vibrate for as long as it requires. Is there any concern making the duration variable a type long? [If this is getting off-topic, I'll follow up with another email]
Yes, given ABI constraints that is not really feasible. I think for effects longer than 30 seconds you'd have to handle it in the framework by using replay.length 0 and cancelling the effect some time later.
Thanks.
Signature · 1 line
Dmitry
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
In reply to Jacek AnaszewskiHi!
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
If we want to have discussion "how to make vibrations in input easier to use", well that's fair. But I don't think it is particulary hard.
I would like to know more about why you find the FF interface hard,
Quoted 8 lines
led-transient trigger can be activated using only following bash commands:
# echo 1 > state # echo 1000 > duration # while [ 1 ]; do echo 1 > activate; sleep 3; doneCould you share sample sequence of commands to use ff driver?
Well, LED transient trigger can be activated like that. But that will not work on any hardware currently supported by the mainline kernel.
Equivalent command with forcefeedback is:
(echo 5; sleep 1; echo -1) | sudo fftest /dev/input/event2
You would not want to use either in production.
Quoted 26 lines
Quoted 6 lines
Quoted 2 lines
But having half devices use one interface and half use different one is just bad...
Completely agree here. I just merged PWM vibra driver from Sebastian Reichel, we already had regulator-haptic driver, do we need gpio-based one? Or make regulator-based one working with fixed regulators?
Just to clarify: the background of this discussion is the question whether we should remove the following lines from
Documentation/leds/ledtrig-transient.txt:(quoted diff) +0
-5-As a specific example of this use-case, let's look at vibrate feature on -phones. Vibrate function on phones is implemented using PWM pins on SoC or -PMIC. There is a need to activate one shot timer to control the vibrate -feature, to prevent user space crashes leaving the phone in vibrate mode -permanently causing the battery to drain.whether we should remove the following use case example from
In effect Pavel has objections to increasing ledtrig-transient interval accuracy by adding
hr_timersupport to it, because vibrate devices, as one of the use cases, can benefit from it.So there are two issues:
1. Addition ofhr_timersupport to LED trigger.
2. Removal of vibrate devices use case from ledtrig-transient doc.
Quoted 5 lines
I am in favour of 1. and against 2. since we're not gaining anything by hiding information about some kernel functionality when it will still be there. It also doesn't define the location of any vibrate device drivers, since sheer leds-gpio driver can be used for that purpose.
I would like to see reasonable explanation why we want 1. (and vibrations are not that) and certainly 2. because we don't want people to use LED subsystem for vibrations.
We already have perfectly good interface for that.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
In reply to Pavel MachekQuoted 41 lines · Pavel Machek
Quoted 19 lines · Jacek Anaszewski
Hi David and Pavel,
Quoted 16 lines · Pavel Machek
Hi!
Quoted 8 lines
These patch series add the
LED_BRIGHTNESS_FASTflag support for ledtrig-transient to use hrtimer so that platforms with high-resolution timer support can have better accuracy in the trigger duration timing. The need for this support is driven by the fact that Android has removed thetimed_ouput[1] and is now using led-trigger for handling vibrator control which requires the timer to be accurate up to a millisecond. However, this flag support would also allow hrtimer to co-exist with the ktimer without causing warning to the existing drivers [2].NAK.
LEDs do not need extra overhead, and vibrator control should not go through LED subsystem.
Quoted 8 lines
Quoted 2 lines
Input subsystem includes support for vibrations and force feedback. Please use that instead.
I think that most vital criterion here is the usability of the interface. If it can be harnessed for doing the work seemingly unrelated to the primary subsystem's purpose, that's fine. Moreover, it is extremely easy to use in comparison to the force feedback one.
Well, no.
Kernel is supposed to provide hardware abstraction, that means it should hide differences between different devices.
And we already have devices using input as designed. We don't want to have situation where "on phones A, D and E, vibrations are handled via input, while on B, C and F, they are handled via
/sys/class/leds".If we want to have discussion "how to make vibrations in input easier to use", well that's fair. But I don't think it is particulary hard.
Quoted 8 lines
If we want to say "lets move all vibrations from input to LED subsystem"... I don't think that is good idea, but its a valid discussion. Some good reasons would be needed.
But having half devices use one interface and half use different one is just bad... especially when only reason to do it that way is "David wants to do it that way, android library made a mistake and he now wants it to propagate to whole world".
This is not the only reason. Adding hr_timer support to ledtrig-transient (and similarly to ledtrig-timer) would allow to increase the accuracy and stability of delay_on/delay_off intervals at low values.
Do you think such an improvement could be harmful in some way, even if it was made optional?
Signature · 2 lines
Best regards, Jacek Anaszewski
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Hi!
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
These patch series add the
LED_BRIGHTNESS_FASTflag support for ledtrig-transient to use hrtimer so that platforms with high-resolution timer support can have better accuracy in the trigger duration timing. The need for
...
Quoted 9 lines
Quoted 8 lines
If we want to say "lets move all vibrations from input to LED subsystem"... I don't think that is good idea, but its a valid discussion. Some good reasons would be needed.
But having half devices use one interface and half use different one is just bad... especially when only reason to do it that way is "David wants to do it that way, android library made a mistake and he now wants it to propagate to whole world".
Quoted 7 lines
This is not the only reason. Adding
hr_timersupport to ledtrig-transient (and similarly to ledtrig-timer) would allow to increase the accuracy and stability of delay_on/delay_off intervals at low values.Do you think such an improvement could be harmful in some way, even if it was made optional?
Of course, we can make LED timing accurate down to microseconds. It will mean increased overhead -- for "improvement" human can not perceive.
If someone has problems with LED delays not being accurate enough... we may want to fix it. But that is not the case here, is it?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Hi,
Quoted 20 lines · Pavel Machek
Hi!
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
These patch series add the
LED_BRIGHTNESS_FASTflag support for ledtrig-transient to use hrtimer so that platforms with high-resolution timer support can have better accuracy in the trigger duration timing. The need for...
Quoted 14 lines
Quoted 8 lines
If we want to say "lets move all vibrations from input to LED subsystem"... I don't think that is good idea, but its a valid discussion. Some good reasons would be needed.
But having half devices use one interface and half use different one is just bad... especially when only reason to do it that way is "David wants to do it that way, android library made a mistake and he now wants it to propagate to whole world".
This is not the only reason. Adding
hr_timersupport to ledtrig-transient (and similarly to ledtrig-timer) would allow to increase the accuracy and stability of delay_on/delay_off intervals at low values.
Quoted 8 lines
Quoted 2 lines
Do you think such an improvement could be harmful in some way, even if it was made optional?
Of course, we can make LED timing accurate down to microseconds. It will mean increased overhead -- for "improvement" human can not perceive.
If someone has problems with LED delays not being accurate enough... we may want to fix it. But that is not the case here, is it?
AFAIR David was mentioning that the hr_timer support is perceivable
Signature · 2 lines
Best regards, Jacek Anaszewski
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Hi!
Quoted 10 lines
Quoted 8 lines
Quoted 2 lines
Do you think such an improvement could be harmful in some way, even if it was made optional?
Of course, we can make LED timing accurate down to microseconds. It will mean increased overhead -- for "improvement" human can not perceive.
If someone has problems with LED delays not being accurate enough... we may want to fix it. But that is not the case here, is it?
AFAIR David was mentioning that the
hr_timersupport is perceivable
He said that hr_timer support is perceivable _when he is driving vibration motor_. Which he should not do in the first place.
Yes, if the difference is perceivable with LED in non-crazy configuration (*), we can take the patch. Is it? Do we have someone not from Google observing it?
Pavel
(*) emulating PWM using blink trigger counts as "crazy" :-)
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Hi,
Quoted 16 lines · Pavel Machek
Hi!
Quoted 10 lines
Quoted 8 lines
Quoted 2 lines
Do you think such an improvement could be harmful in some way, even if it was made optional?
Of course, we can make LED timing accurate down to microseconds. It will mean increased overhead -- for "improvement" human can not perceive.
If someone has problems with LED delays not being accurate enough... we may want to fix it. But that is not the case here, is it?
AFAIR David was mentioning that the
hr_timersupport is perceivableHe said that
hr_timersupport is perceivable_whenhe is driving vibrationmotor_. Which he should not do in the first place.
Quoted 6 lines
Yes, if the difference is perceivable with LED in non-crazy configuration (*), we can take the patch. Is it? Do we have someone not from Google observing it?
Pavel
(*) emulating PWM using blink trigger counts as "crazy" :-)
How about adding CONFIG_LED_TRIGGERS_HR_TIMER_SUPPORT, guarding the hr timer support in triggers (timer trigger could also benefit from it) with it, and adding "(EXPERIMENTAL)" tag to the config description?
Signature · 2 lines
Best regards, Jacek Anaszewski
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Quoted 23 lines · Jacek Anaszewski
Hi,
Quoted 20 lines · Pavel Machek
Hi!
Quoted 10 lines
Quoted 8 lines
Quoted 2 lines
Do you think such an improvement could be harmful in some way, even if it was made optional?
Of course, we can make LED timing accurate down to microseconds. It will mean increased overhead -- for "improvement" human can not perceive.
If someone has problems with LED delays not being accurate enough... we may want to fix it. But that is not the case here, is it?
AFAIR David was mentioning that the
hr_timersupport is perceivableHe said that
hr_timersupport is perceivable_whenhe is driving vibrationmotor_. Which he should not do in the first place.Yes, if the difference is perceivable with LED in non-crazy configuration (*), we can take the patch. Is it? Do we have someone not from Google observing it?
Quoted 5 lines
Quoted 1 line
(*) emulating PWM using blink trigger counts as "crazy" :-)
How about adding
CONFIG_LED_TRIGGERS_HR_TIMER_SUPPORT, guarding the hr timer support in triggers (timer trigger could also benefit from it) with it, and adding "(EXPERIMENTAL)" tag to the config description?
Why would we want to add code in the LED subsystem that is useless for LEDs?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer
Hi,
Quoted 24 lines · Pavel Machek
Quoted 23 lines · Jacek Anaszewski
Hi,
Quoted 20 lines · Pavel Machek
Hi!
Quoted 10 lines
Quoted 8 lines
Quoted 2 lines
Do you think such an improvement could be harmful in some way, even if it was made optional?
Of course, we can make LED timing accurate down to microseconds. It will mean increased overhead -- for "improvement" human can not perceive.
If someone has problems with LED delays not being accurate enough... we may want to fix it. But that is not the case here, is it?
AFAIR David was mentioning that the
hr_timersupport is perceivableHe said that
hr_timersupport is perceivable_whenhe is driving vibrationmotor_. Which he should not do in the first place.Yes, if the difference is perceivable with LED in non-crazy configuration (*), we can take the patch. Is it? Do we have someone not from Google observing it?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
(*) emulating PWM using blink trigger counts as "crazy" :-)
How about adding
CONFIG_LED_TRIGGERS_HR_TIMER_SUPPORT, guarding the hr timer support in triggers (timer trigger could also benefit from it) with it, and adding "(EXPERIMENTAL)" tag to the config description?Why would we want to add code in the LED subsystem that is useless for LEDs?
It could be used for software pwm trigger, there has been at least one an attempt to add such [0].
[0] https://lkml.org/lkml/2015/4/27/493
Signature · 2 lines
Best regards, Jacek Anaszewski