Re: [PATCH v3 2/4] mfd: max8997: handle IRQs using regmap

From: Chanwoo Choi
Date: Tue Mar 18 2014 - 05:52:51 EST


On 03/14/2014 05:33 PM, Robert Baldyga wrote:
> 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@xxxxxxxxxxx>
>
> (...)
>
>>> @@ -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.
>

OK,

For extcon part,
Acked-by: Chanwoo Choi <cw00.choi@xxxxxxxxxxx>

Thanks,
Chanwoo Choi

--
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/