Thread (6 messages) 6 messages, 2 authors, 2014-12-16

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

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2014-12-16 01:42:36
Also in: linux-samsung-soc, lkml

On Tue, Dec 16, 2014 at 10:09:25AM +0900, Jaewon Kim wrote:
Hi Dmitry,

2014년 12월 14일 04:56에 Dmitry Torokhov 이(가) 쓴 글:
quoted
Hi Jaewon,

On Fri, Dec 12, 2014 at 07:32:28PM +0900, Jaewon Kim wrote:
...
quoted
quoted
+static int __maybe_unused regulator_haptic_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct regulator_haptic *haptic = platform_get_drvdata(pdev);
+
+	mutex_lock(&haptic->mutex);
+	if (haptic->enabled) {
+		regulator_haptic_enable(haptic, false);
+		haptic->suspend_state = true;
Why do we only set suspend_state if an effect was playing? I think we
should always indicate that the device is suspended so that we do not
try to start playing another effect - while it is true that normally
effects are played by request from userspace which should be frozen by
now, it is theoretically possible to trigger an effect from kernel as
well.
This variable name seems to make you confuse.
I used this variable to restore the old state.

When kernel is entering suspend state while the motor is vibrating,
I store vibrating state for vibrate again after escape suspend state.


I will change variable name to "suspend_restore".
And prevent to start playing effect  when kernel entering suspend state.
You do not need to save if haptic was playing or not - on resume, if
haptic->magnitude != 0 you need to restart playing, otherwise leave it
off.

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help