From: Robert Baldyga <r.baldyga@samsung.com>
To: Chanwoo Choi <cw00.choi@samsung.com>
Cc: sameo@linux.intel.com, lee.jones@linaro.org,
myungjoo.ham@samsung.com, dmitry.torokhov@gmail.com,
cooloney@gmail.com, rpurdie@rpsys.net, dbaryshkov@gmail.com,
dwmw2@infradead.org, lgirdwood@gmail.com, broonie@kernel.org,
a.zummo@towertech.it, paul.gortmaker@windriver.com,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
linux-leds@vger.kernel.org, rtc-linux@googlegroups.com,
m.szyprowski@samsung.com, k.kozlowski@samsung.com
Subject: Re: [PATCH v3 2/4] mfd: max8997: handle IRQs using regmap
Date: Fri, 14 Mar 2014 09:33:35 +0100 [thread overview]
Message-ID: <5322BEDF.4080408@samsung.com> (raw)
In-Reply-To: <53218C30.9000707@samsung.com>
On 03/13/2014 11:45 AM, Chanwoo Choi wrote:
> Hi Robert,
>
> On 03/13/2014 06:38 PM, Robert Baldyga wrote:
>> This patch modifies mfd driver to use regmap for handling interrupts.
>> It allows to simplify irq handling process. This modifications needed
>> to make small changes in function drivers, which use interrupts.
>>
>> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
(...)
>> @@ -468,8 +560,11 @@ static int max8997_suspend(struct device *dev)
>> struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
>> struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
>>
>> - if (device_may_wakeup(dev))
>> - irq_set_irq_wake(max8997->irq, 1);
>> + if (device_may_wakeup(dev)) {
>> + enable_irq_wake(max8997->irq);
>> + disable_irq(max8997->irq);
>
> irq_set_irq_wake() is same as enable_irq_wake().
It's more intuitive name and makes code reading easier.
> Why is it necessary for disable_irq(max8997->irq)?
It's because we don't want to get interrupts before i2c controller will
be ready. So we disable irq in drivers suspend, and enable in resume.
If some iqr will come before enable_irq() call, it will be noticed, and
IRQ_PENDING flag will be set. In this case irq will be handled
immediately after enable_irq() call.
In previous version there was call of max8997_irq_resume() in resume
function, which caused forced interrupt handling, which has similar effect.
>
>> + }
>> +
>> return 0;
>> }
>>
>> @@ -478,9 +573,12 @@ static int max8997_resume(struct device *dev)
>> struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
>> struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
>>
>> - if (device_may_wakeup(dev))
>> - irq_set_irq_wake(max8997->irq, 0);
>> - return max8997_irq_resume(max8997);
>> + if (device_may_wakeup(dev)) {
>> + disable_irq_wake(max8997->irq);
>> + enable_irq(max8997->irq);
>
> ditto.
>
>> + }
>> +
>> + return 0;
>> }
>>
Thanks,
Robert Baldyga
next prev parent reply other threads:[~2014-03-14 8:33 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-13 9:38 [PATCH v3 0/4] mfd: max8997: add regmap support Robert Baldyga
2014-03-13 9:38 ` [PATCH v3 1/4] mfd: max8997: use regmap to access registers Robert Baldyga
2014-03-18 9:51 ` Chanwoo Choi
2014-03-18 22:33 ` Bryan Wu
2014-03-13 9:38 ` [PATCH v3 2/4] mfd: max8997: handle IRQs using regmap Robert Baldyga
2014-03-13 9:44 ` Krzysztof Kozlowski
2014-03-13 10:45 ` Chanwoo Choi
2014-03-14 8:33 ` Robert Baldyga [this message]
2014-03-18 9:52 ` Chanwoo Choi
2014-03-13 9:38 ` [PATCH v3 3/4] mfd: max8997: change irq names to upper case Robert Baldyga
2014-03-13 9:44 ` Krzysztof Kozlowski
2014-03-13 10:18 ` Chanwoo Choi
2014-03-13 9:38 ` [PATCH v3 4/4] mfd: max8997: move regmap handling to function drivers Robert Baldyga
2014-03-13 9:50 ` Krzysztof Kozlowski
2014-03-13 11:09 ` Chanwoo Choi
2014-03-13 12:55 ` Lee Jones
2014-03-13 14:09 ` Mark Brown
2014-03-14 11:21 ` Robert Baldyga
2014-03-18 8:50 ` Lee Jones
2014-03-13 10:25 ` [PATCH v3 0/4] mfd: max8997: add regmap support Chanwoo Choi
2014-03-13 10:52 ` Robert Baldyga
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=5322BEDF.4080408@samsung.com \
--to=r.baldyga@samsung.com \
--cc=a.zummo@towertech.it \
--cc=broonie@kernel.org \
--cc=cooloney@gmail.com \
--cc=cw00.choi@samsung.com \
--cc=dbaryshkov@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=k.kozlowski@samsung.com \
--cc=lee.jones@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=myungjoo.ham@samsung.com \
--cc=paul.gortmaker@windriver.com \
--cc=rpurdie@rpsys.net \
--cc=rtc-linux@googlegroups.com \
--cc=sameo@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).