Re: [PATCH v6 1/2] Input: add regulator haptic driver
From: Dmitry Torokhov
Date: Mon Dec 15 2014 - 20:42:39 EST
On Tue, Dec 16, 2014 at 10:09:25AM +0900, Jaewon Kim wrote:
> Hi Dmitry,
>
> 2014ë 12ì 14ì 04:56ì Dmitry Torokhov ì(ê) ì ê:
> >Hi Jaewon,
> >
> >On Fri, Dec 12, 2014 at 07:32:28PM +0900, Jaewon Kim wrote:
...
> >>+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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/