public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Tony Lindgren <tony@atomide.com>,
	Belisko Marek <marek.belisko@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-omap@vger.kernel.org,
	"Dr. H. Nikolaus Schaller" <hns@goldelico.com>
Subject: Re: omap5 fixing palmas IRQ_TYPE_NONE warning leads to gpadc timeouts
Date: Mon, 19 Nov 2018 12:18:10 +0200	[thread overview]
Message-ID: <46d271b2-35d3-6353-c530-3292cdac53ab@ti.com> (raw)
In-Reply-To: <20181113180656.GE53235@atomide.com>



On 2018-11-13 20:06, Tony Lindgren wrote:
> Hi
> 
> * Belisko Marek <marek.belisko@gmail.com> [180703 18:34]:
>> Hi Tony,
>>
>> On Tue, Jul 3, 2018 at 10:45 AM Tony Lindgren <tony@atomide.com> wrote:
>>>
>>> * Belisko Marek <marek.belisko@gmail.com> [180620 09:40]:
>>>> Hello,
>>>>
>>>> I'm trying to fix warning (for omap5 board) produced by recent change
>>>> to avoid using IRQ_TYPE_NONE like:
>>>> [    1.818666] WARNING: CPU: 1 PID: 778 at
>>>> drivers/irqchip/irq-gic.c:1016 gic_irq_domain_translate+0x78/0x100
>>>> [    1.828839] Modules linked in:
>>>>
>>>> I did look to other commit which did update and without deep knowledge
>>>> I just simply do this small change:
>>>> diff --git a/arch/arm/boot/dts/omap5-board-common.dtsi
>>>> b/arch/arm/boot/dts/omap5-board-common.dtsi
>>>> index 218892b..ab2df8c 100644
>>>> --- a/arch/arm/boot/dts/omap5-board-common.dtsi
>>>> +++ b/arch/arm/boot/dts/omap5-board-common.dtsi
>>>> @@ -393,7 +393,7 @@
>>>>
>>>>         palmas: palmas@48 {
>>>>                 compatible = "ti,palmas";
>>>> -               interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */
>>>> +               interrupts = <GIC_SPI 7 IRQ_TYPE_HIGH>; /* IRQ_SYS_1N */
>>>>                 reg = <0x48>;
>>>>                 interrupt-controller;
>>>>                 #interrupt-cells = <2>;
>>>>
>>>> and it looks board boots fine. Only issue is that gpadc driver is not
>>>> working (at least not getting interrupts at all ADC fails with
>>>> timeout). I did look to gpadc driver and driver is not using
>>>> interrupts defined in dts but request interrupt directly from palmas
>>>> mfd module. Any ideas what needs to be changed to have gpadc again
>>>> working with mentioned patch?
>>>
>>> Can you try with IRQF_TRIGGER_HIGH added also to the flags to
>>> regmap_add_irq_chip() in drivers/mfd/palmas.c?
>> Nope issue is till present also after this change like:
>> diff --git a/arch/arm/boot/dts/omap5-board-common.dtsi
>> b/arch/arm/boot/dts/omap5-board-common.dtsi
>> index 218892b..6912769 100644
>> --- a/arch/arm/boot/dts/omap5-board-common.dtsi
>> +++ b/arch/arm/boot/dts/omap5-board-common.dtsi
>> @@ -393,7 +393,7 @@
>>
>>         palmas: palmas@48 {
>>                 compatible = "ti,palmas";
>> -               interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */
>> +               interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_1N */
>>                 reg = <0x48>;
>>                 interrupt-controller;
>>                 #interrupt-cells = <2>;
>> @@ -432,9 +432,9 @@
>>
>>                 gpadc: gpadc {
>>                         compatible = "ti,palmas-gpadc";
>> -                       interrupts = <18 0
>> -                                     16 0
>> -                                     17 0>;
>> +                       interrupts = <18 IRQ_TYPE_LEVEL_HIGH
>> +                                     16 IRQ_TYPE_LEVEL_HIGH
>> +                                     17 IRQ_TYPE_LEVEL_HIGH>;
>>                         #io-channel-cells = <1>;
>>                         ti,channel0-current-microamp = <5>;
>>                         ti,channel3-current-microamp = <10>;
>> diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
>> index 663a239..15d23db 100644
>> --- a/drivers/mfd/palmas.c
>> +++ b/drivers/mfd/palmas.c
>> @@ -601,7 +601,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
>>         regmap_write(palmas->regmap[slave], addr, reg);
>>
>>         ret = regmap_add_irq_chip(palmas->regmap[slave], palmas->irq,
>> -                                 IRQF_ONESHOT | pdata->irq_flags, 0,
>> +                                 IRQF_ONESHOT | IRQF_TRIGGER_HIGH |
>> pdata->irq_flags, 0,
>>                                   driver_data->irq_chip, &palmas->irq_data);
>>         if (ret < 0)
>>                 goto err_i2c;
> 
> Looks like the IRQ_TYPE_NONE issue still is there for omap5 and
> should be fixed with IRQ_TYPE_HIGH.
> 
> No idea about why palmas interrupts would stop working though,
> Peter, do you have any ideas on this one?

No, I don't.
The INT polarity can be changed in Palmas.
based on the pdata->irq_flags (queried via irqd_get_trigger_type())
the code  configures it:

if (pdata->irq_flags & IRQ_TYPE_LEVEL_HIGH)
	reg = PALMAS_POLARITY_CTRL_INT_POLARITY;
else
	reg = 0;

and we pass the same irq_flags to the regmap_add_irq_chip()
IRQ_TYPE_LEVEL_HIGH == IRQF_TRIGGER_HIGH == 0x00000004

A change in DT should be enough, no need to patch palmas.c, imho.

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

  parent reply	other threads:[~2018-11-19 10:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20 16:37 omap5 fixing palmas IRQ_TYPE_NONE warning leads to gpadc timeouts Belisko Marek
2018-07-03  8:45 ` Tony Lindgren
2018-07-03 18:31   ` Belisko Marek
2018-11-13 18:06     ` Tony Lindgren
2018-11-14 17:03       ` Tony Lindgren
2018-11-14 17:26         ` Tony Lindgren
2018-11-19 10:18       ` Peter Ujfalusi [this message]
2018-11-19 16:19         ` Tony Lindgren
2018-11-19 17:14           ` Tony Lindgren
2018-11-20 11:14             ` Jon Hunter
2018-11-23 16:48               ` Tony Lindgren
2018-11-26  9:36                 ` Thierry Reding
2018-11-26  9:49                   ` Peter Ujfalusi
2018-11-26 10:25                     ` Thierry Reding
2018-11-26 19:32                       ` Tony Lindgren
2018-11-26 20:17                         ` Jon Hunter
2018-11-27 17:55                           ` Tony Lindgren
2018-11-27 18:17                             ` Tony Lindgren
2018-11-26 10:13                 ` Jon Hunter
2018-11-20 12:22             ` Laxman Dewangan
2018-11-26 10:14             ` Thierry Reding
2018-11-26 19:14               ` Tony Lindgren
2018-11-26 19:19                 ` Santosh Shilimkar
2018-11-27 18:03               ` Tony Lindgren
2018-11-20  7:36           ` Peter Ujfalusi

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=46d271b2-35d3-6353-c530-3292cdac53ab@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=hns@goldelico.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=marek.belisko@gmail.com \
    --cc=tony@atomide.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