From: Hui Wang <jason77.wang@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Hui Wang <jason77.wang@gmail.com>,
gaowanlong@cn.fujitsu.com, s.hauer@pengutronix.de,
maramaopercheseimorto@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH] input/imx_keypad: add pm suspend and resume functions
Date: Sun, 9 Oct 2011 17:49:57 +0800 [thread overview]
Message-ID: <4E916E45.4050201@gmail.com> (raw)
In-Reply-To: <20110930091229.GA21336@core.coreip.homeip.net>
Dmitry Torokhov wrote:
> On Fri, Sep 30, 2011 at 04:59:53PM +0800, Hui Wang wrote:
>
>> Wanlong Gao wrote:
>>
>>> On 09/30/2011 03:54 PM, Hui Wang wrote:
>>>
>>>> +
>>>> +static int imx_kbd_resume(struct device *dev)
>>>> +{
>>>> + struct platform_device *pdev = to_platform_device(dev);
>>>> + struct imx_keypad *kbd = platform_get_drvdata(pdev);
>>>> + struct input_dev *input_dev = kbd->input_dev;
>>>> +
>>>> + mutex_lock(&input_dev->mutex);
>>>> +
>>>> + if (device_may_wakeup(&pdev->dev))
>>>> + disable_irq_wake(kbd->irq);
>>>> +
>>>> + if (input_dev->users)
>>>> + clk_enable(kbd->clk);
>>>> +
>>>> + mutex_unlock(&input_dev->mutex);
>>>> +
>>>> + return 0;
>>>> +}
>>>>
>>> struct input_dev *input_dev = kbd->input_dev;
>>> if (device_may_wakeup(dev)) {
>>> disable_irq_wake(kdb->irq);
>>> } else {
>>> mutex_lock(&input_dev->mutex);
>>>
>>> if (input_dev->users)
>>> clk_enable(kbd->clk);
>>>
>>> mutex_unlock(&input_dev->mutex);
>>> }
>>>
>>>
>> So, if we unconditionally disable kpp clock in the suspend, we don't
>> need above logic as well in the resume.
>>
>
> We should not unconditionally disable clock in suspend, you need to check
> if there are any users (or drop check in resume), otherwise you'll get
> unbalanced count in clk (suspend - decrement, resume - not enabling clk
> if device is not being used).
>
> Also locking is needed in suspend.
>
>
Got it, will fix them in the V2.
Thanks,
Hui.
> Thanks.
>
>
prev parent reply other threads:[~2011-10-09 9:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-30 7:54 [PATCH] input/imx_keypad: add pm suspend and resume functions Hui Wang
2011-09-30 8:30 ` Wanlong Gao
2011-09-30 8:59 ` Hui Wang
2011-09-30 9:05 ` Wanlong Gao
2011-10-09 9:47 ` Hui Wang
2011-09-30 9:12 ` Dmitry Torokhov
2011-10-09 9:49 ` Hui Wang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E916E45.4050201@gmail.com \
--to=jason77.wang@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=gaowanlong@cn.fujitsu.com \
--cc=linux-input@vger.kernel.org \
--cc=maramaopercheseimorto@gmail.com \
--cc=s.hauer@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.