Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1382304 > unrolled thread

Re: [PATCH v2 6/9] pinctrl: Add IRQ support to STM32 gpios

Started byMaxime Coquelin <mcoquelin.stm32@gmail.com>
First post2016-04-19 11:10 +0200
Last post2016-04-19 11:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v2 6/9] pinctrl: Add IRQ support to STM32 gpios Maxime Coquelin <mcoquelin.stm32@gmail.com> - 2016-04-19 11:10 +0200

#1382304 — Re: [PATCH v2 6/9] pinctrl: Add IRQ support to STM32 gpios

FromMaxime Coquelin <mcoquelin.stm32@gmail.com>
Date2016-04-19 11:10 +0200
SubjectRe: [PATCH v2 6/9] pinctrl: Add IRQ support to STM32 gpios
Message-ID<rpzPs-4lP-5@gated-at.bofh.it>
Hi Linus

2016-04-08 11:43 GMT+02:00 Linus Walleij <linus.walleij@linaro.org>:
> On Thu, Mar 31, 2016 at 5:09 PM, Maxime Coquelin
> <mcoquelin.stm32@gmail.com> wrote:
>
>> +static int stm32_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
>> +{
>> +       struct stm32_pinctrl *pctl = dev_get_drvdata(chip->parent);
>> +       struct stm32_gpio_bank *bank = gpiochip_get_data(chip);
>> +       unsigned int irq;
>> +
>> +       regmap_field_write(pctl->irqmux[offset], bank->range.id);
>
> No. You must implement the irqchip and GPIO controllers to
> be orthogonal, doing things like this creates a semantic that
> assumes .to_irq() is always called before using the IRQ and
> that is not guaranteed at all. A consumer may very well
> use an interrupt right off the irqchip without this being called
> first. All this function should do is translate a number. No
> other semantics.
>
> This needs to be done from the irqchip (sorry).

Actually, the register written here is not part of the irqchip.
It is a system config register that is only used when using a GPIO as
external interrupt.
Its aim is to mux the GPIO bank on a line.
For example on line 1, it can be muxed to select either gpioa1,
gpiob1, gpioc1, ...
How could I do it in the irqchip that has no gpio knowledge?

In case the consumer uses an interrupt right off the irqchip, it
should not access this register.
For example the RTC wakeup lines, where we will reference directly the irqchip.

That said, do you still believe the implementation is wrong? Do I miss
something?

Best regards,
Maxime

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web