All of lore.kernel.org
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javier@osg.samsung.com>
To: Laxman Dewangan <ldewangan@nvidia.com>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	lee.jones@linaro.org, alexandre.belloni@free-electrons.com
Cc: cw00.choi@samsung.com, linux-kernel@vger.kernel.org,
	rtc-linux@googlegroups.com
Subject: [rtc-linux] Re: [PATCH V3 5/5] rtc: max77686: move initialisation of rtc regmap, irq chip locally
Date: Sat, 6 Feb 2016 10:01:36 -0300	[thread overview]
Message-ID: <56B5EEB0.3040505@osg.samsung.com> (raw)
In-Reply-To: <56B592C5.3040208@nvidia.com>

Hello Laxman,

On 02/06/2016 03:29 AM, Laxman Dewangan wrote:
> Hi Javier,
> '
> On Saturday 06 February 2016 11:00 AM, Javier Martinez Canillas wrote:
>> Hello Laxman,
>>
>> Sorry for not doing this before but today was a busy one.
>>
>
> Thanks for testing.
>
>
>> On 02/05/2016 11:37 AM, Laxman Dewangan wrote:
>>> Hi Krzysztof, Javier,
>>>
>>
>>> 3. Extension of 2
>>> Do regmap_add_irq_chip(), call  regmap_irq_get_virq() for creating irq mapping but dont do any interrupt registration i.e. comment request_threaded_irq() and hence free_irq().
>>> Then do unbind/bind and then suspend.
>>>    To make sure that this happen when only we have client registered interrupt or with mapping also.
>>>
>>
>> This fails, so the problem seems to be with the mapping.
>>
>> So I tried another scenario:
>>
>> 4. Call regmap_del_irq_chip() just after regmap_irq_get_virq() and try to S2R
>>    without doing any unbind before.
>>
>>    To test if this is a general issue with regmap_del_irq_chip() after doing
>>    the IRQ mapping and not something specific to the remove callback.
>>
>> The machine failed to boot. So now at least we have narrowed down the issue.
>>
>> I've looked at both regmap_irq_get_virq() and regmap_del_irq_chip() but I
>> couldn't find any obvious cause for the issue we are seeing. But it's late
>> Friday so probably I should just stop here and take a fresh look on Monday.
>>
>
> So the issue is that when we create mapping, we can not delete the irq_chip.
>
> I saw one function from irq framework irq_dispose_mapping(unsigned int virq).
>
> So we need to dispose the mapping before deleting irq chip.
>
>
> Becasue it is reproduced in normal boot also if we do create mapping and delete the irq chip data, I will also be able to validate if I get some time on weekend.
>

Thanks, that was it! I was searching yesterday for the regmap_irq_get_virq()
counterpart and did not find it, but I was looking at include/linux/regmap.h
and didn't think about looking at include/linux/irqdomain.h.

Maybe we should add a regmap_irq_put_virq() that's just a wrapper around
irq_dispose_mapping() to make the API consistent and avoid this confusion?
I see that most drivers don't dispose the mapping on their error/remove path.

Anyways, with this patch on top of yours 5/5 my system is able to suspend
after an unbind again:

diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 45d639674c0b..8ea6d601482a 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -765,6 +765,7 @@ static int max77686_rtc_remove(struct platform_device *pdev)
  	struct max77686_rtc_info *info = platform_get_drvdata(pdev);
  
  	free_irq(info->virq, info);
+	irq_dispose_mapping(info->virq);
  	regmap_del_irq_chip(info->rtc_irq, info->rtc_irq_data);
  	if (info->rtc)
  		i2c_unregister_device(info->rtc);

This is a bug in the current MFD driver though so I would include it as
a separate patch prior to your patch that moves the regmap and i2c init
to the RTC driver.

When posting your new revsion feel free to add my {Reviewed,Tested}-by
tags for $SUBJECT and the new bugfix patch.

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

WARNING: multiple messages have this Message-ID (diff)
From: Javier Martinez Canillas <javier@osg.samsung.com>
To: Laxman Dewangan <ldewangan@nvidia.com>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	lee.jones@linaro.org, alexandre.belloni@free-electrons.com
Cc: cw00.choi@samsung.com, linux-kernel@vger.kernel.org,
	rtc-linux@googlegroups.com
Subject: Re: [PATCH V3 5/5] rtc: max77686: move initialisation of rtc regmap, irq chip locally
Date: Sat, 6 Feb 2016 10:01:36 -0300	[thread overview]
Message-ID: <56B5EEB0.3040505@osg.samsung.com> (raw)
In-Reply-To: <56B592C5.3040208@nvidia.com>

Hello Laxman,

On 02/06/2016 03:29 AM, Laxman Dewangan wrote:
> Hi Javier,
> '
> On Saturday 06 February 2016 11:00 AM, Javier Martinez Canillas wrote:
>> Hello Laxman,
>>
>> Sorry for not doing this before but today was a busy one.
>>
>
> Thanks for testing.
>
>
>> On 02/05/2016 11:37 AM, Laxman Dewangan wrote:
>>> Hi Krzysztof, Javier,
>>>
>>
>>> 3. Extension of 2
>>> Do regmap_add_irq_chip(), call  regmap_irq_get_virq() for creating irq mapping but dont do any interrupt registration i.e. comment request_threaded_irq() and hence free_irq().
>>> Then do unbind/bind and then suspend.
>>>    To make sure that this happen when only we have client registered interrupt or with mapping also.
>>>
>>
>> This fails, so the problem seems to be with the mapping.
>>
>> So I tried another scenario:
>>
>> 4. Call regmap_del_irq_chip() just after regmap_irq_get_virq() and try to S2R
>>    without doing any unbind before.
>>
>>    To test if this is a general issue with regmap_del_irq_chip() after doing
>>    the IRQ mapping and not something specific to the remove callback.
>>
>> The machine failed to boot. So now at least we have narrowed down the issue.
>>
>> I've looked at both regmap_irq_get_virq() and regmap_del_irq_chip() but I
>> couldn't find any obvious cause for the issue we are seeing. But it's late
>> Friday so probably I should just stop here and take a fresh look on Monday.
>>
>
> So the issue is that when we create mapping, we can not delete the irq_chip.
>
> I saw one function from irq framework irq_dispose_mapping(unsigned int virq).
>
> So we need to dispose the mapping before deleting irq chip.
>
>
> Becasue it is reproduced in normal boot also if we do create mapping and delete the irq chip data, I will also be able to validate if I get some time on weekend.
>

Thanks, that was it! I was searching yesterday for the regmap_irq_get_virq()
counterpart and did not find it, but I was looking at include/linux/regmap.h
and didn't think about looking at include/linux/irqdomain.h.

Maybe we should add a regmap_irq_put_virq() that's just a wrapper around
irq_dispose_mapping() to make the API consistent and avoid this confusion?
I see that most drivers don't dispose the mapping on their error/remove path.

Anyways, with this patch on top of yours 5/5 my system is able to suspend
after an unbind again:

diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 45d639674c0b..8ea6d601482a 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -765,6 +765,7 @@ static int max77686_rtc_remove(struct platform_device *pdev)
  	struct max77686_rtc_info *info = platform_get_drvdata(pdev);
  
  	free_irq(info->virq, info);
+	irq_dispose_mapping(info->virq);
  	regmap_del_irq_chip(info->rtc_irq, info->rtc_irq_data);
  	if (info->rtc)
  		i2c_unregister_device(info->rtc);

This is a bug in the current MFD driver though so I would include it as
a separate patch prior to your patch that moves the regmap and i2c init
to the RTC driver.

When posting your new revsion feel free to add my {Reviewed,Tested}-by
tags for $SUBJECT and the new bugfix patch.

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

  reply	other threads:[~2016-02-06 13:01 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 13:47 [rtc-linux] [PATCH V3 0/5] rtc: max77686: make max77686 rtc driver as IP driver Laxman Dewangan
2016-02-03 13:47 ` Laxman Dewangan
2016-02-03 13:47 ` [rtc-linux] [PATCH V3 1/5] rtc: max77686: fix checkpatch error Laxman Dewangan
2016-02-03 13:47   ` Laxman Dewangan
2016-02-03 13:47 ` [rtc-linux] [PATCH V3 2/5] rtc: max77686: use rtc regmap to access RTC registers Laxman Dewangan
2016-02-03 13:47   ` Laxman Dewangan
2016-02-03 13:47 ` [rtc-linux] [PATCH V3 3/5] rtc: max77686: avoid reference of parent device info multiple places Laxman Dewangan
2016-02-03 13:47   ` Laxman Dewangan
2016-02-03 13:47 ` [rtc-linux] [PATCH V3 4/5] mfd: max77686: do not set i2c client data for rtc i2c client Laxman Dewangan
2016-02-03 13:47   ` Laxman Dewangan
2016-02-03 13:47 ` [rtc-linux] [PATCH V3 5/5] rtc: max77686: move initialisation of rtc regmap, irq chip locally Laxman Dewangan
2016-02-03 13:47   ` Laxman Dewangan
2016-02-04  0:10   ` [rtc-linux] " Krzysztof Kozlowski
2016-02-04  0:10     ` Krzysztof Kozlowski
2016-02-04  2:03     ` [rtc-linux] " Laxman Dewangan
2016-02-04  2:03       ` Laxman Dewangan
2016-02-04  2:50       ` [rtc-linux] " Laxman Dewangan
2016-02-04  2:50         ` Laxman Dewangan
2016-02-04  3:04         ` [rtc-linux] " Javier Martinez Canillas
2016-02-04  3:04           ` Javier Martinez Canillas
2016-02-04 16:49         ` [rtc-linux] " Javier Martinez Canillas
2016-02-04 16:49           ` Javier Martinez Canillas
2016-02-04  6:58       ` [rtc-linux] " Krzysztof Kozlowski
2016-02-04  6:58         ` Krzysztof Kozlowski
2016-02-04  9:08         ` [rtc-linux] " Krzysztof Kozlowski
2016-02-04  9:08           ` Krzysztof Kozlowski
2016-02-04 10:13           ` [rtc-linux] " Laxman Dewangan
2016-02-04 10:13             ` Laxman Dewangan
2016-02-04 17:35             ` [rtc-linux] " Javier Martinez Canillas
2016-02-04 17:35               ` Javier Martinez Canillas
2016-02-05 14:37           ` [rtc-linux] " Laxman Dewangan
2016-02-05 14:37             ` Laxman Dewangan
2016-02-06  5:30             ` [rtc-linux] " Javier Martinez Canillas
2016-02-06  5:30               ` Javier Martinez Canillas
2016-02-06  6:29               ` [rtc-linux] " Laxman Dewangan
2016-02-06  6:29                 ` Laxman Dewangan
2016-02-06 13:01                 ` Javier Martinez Canillas [this message]
2016-02-06 13:01                   ` Javier Martinez Canillas
2016-02-06 13:40                   ` [rtc-linux] " Laxman Dewangan
2016-02-06 13:40                     ` Laxman Dewangan

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=56B5EEB0.3040505@osg.samsung.com \
    --to=javier@osg.samsung.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=cw00.choi@samsung.com \
    --cc=k.kozlowski@samsung.com \
    --cc=ldewangan@nvidia.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.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 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.