lkml.org 
[lkml]   [2014]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 2/4] mfd: max8997: handle IRQs using regmap
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


\
 
 \ /
  Last update: 2014-03-14 10:01    [W:0.184 / U:1.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site