* [PATCH v2] pinctrl: qcom: spmi-gpio: Make IRQCHIP immutable
@ 2022-08-30 8:12 Manivannan Sadhasivam
2022-08-30 8:26 ` Marc Zyngier
0 siblings, 1 reply; 5+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 8:12 UTC (permalink / raw)
To: linus.walleij, bjorn.andersson
Cc: robimarko, linux-arm-msm, linux-gpio, linux-kernel, maz,
johan+linaro, steev, Manivannan Sadhasivam
The IRQCHIP implementation used inside the gpiochips are not supposed to
be changed during runtime. So let's make the one inside the spmi-gpio
gpiochip immutable.
This fixes the below warning during boot:
gpio gpiochip0: (c440000.spmi:pmic@0:gpio@c000): not an immutable chip, please consider fixing it!
Separate callbacks need to be provided for irq_{mask/unmask} pointers since
the callbacks are supposed to mask/unmask the corresponding parent IRQ in
addition to changing the gpio_desc flags.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
Changes in v2:
* Added new callbacks for irq_{mask/unmask} for masking/unmasking the parent
IRQ that was missing in v1. (Thanks to Marc)
* Modified the commit message accordingly.
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 38 +++++++++++++++++-------
1 file changed, 28 insertions(+), 10 deletions(-)
diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
index ccaf40a9c0e6..d40e3b2d38cc 100644
--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
+++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
@@ -171,7 +171,6 @@ struct pmic_gpio_state {
struct regmap *map;
struct pinctrl_dev *ctrl;
struct gpio_chip chip;
- struct irq_chip irq;
u8 usid;
u8 pid_base;
};
@@ -985,6 +984,33 @@ static int pmic_gpio_populate_parent_fwspec(struct gpio_chip *chip,
return 0;
}
+static void pmic_gpio_irq_mask(struct irq_data *data)
+{
+ struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
+
+ irq_chip_mask_parent(data);
+ gpiochip_disable_irq(gc, data->hwirq);
+}
+
+static void pmic_gpio_irq_unmask(struct irq_data *data)
+{
+ struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
+
+ irq_chip_unmask_parent(data);
+ gpiochip_enable_irq(gc, data->hwirq);
+}
+
+static const struct irq_chip spmi_gpio_irq_chip = {
+ .name = "spmi-gpio",
+ .irq_ack = irq_chip_ack_parent,
+ .irq_mask = pmic_gpio_irq_mask,
+ .irq_unmask = pmic_gpio_irq_unmask,
+ .irq_set_type = irq_chip_set_type_parent,
+ .irq_set_wake = irq_chip_set_wake_parent,
+ .flags = IRQCHIP_IMMUTABLE | IRQCHIP_MASK_ON_SUSPEND,
+ GPIOCHIP_IRQ_RESOURCE_HELPERS,
+};
+
static int pmic_gpio_probe(struct platform_device *pdev)
{
struct irq_domain *parent_domain;
@@ -1078,16 +1104,8 @@ static int pmic_gpio_probe(struct platform_device *pdev)
if (!parent_domain)
return -ENXIO;
- state->irq.name = "spmi-gpio",
- state->irq.irq_ack = irq_chip_ack_parent,
- state->irq.irq_mask = irq_chip_mask_parent,
- state->irq.irq_unmask = irq_chip_unmask_parent,
- state->irq.irq_set_type = irq_chip_set_type_parent,
- state->irq.irq_set_wake = irq_chip_set_wake_parent,
- state->irq.flags = IRQCHIP_MASK_ON_SUSPEND,
-
girq = &state->chip.irq;
- girq->chip = &state->irq;
+ gpio_irq_chip_set_chip(girq, &spmi_gpio_irq_chip);
girq->default_type = IRQ_TYPE_NONE;
girq->handler = handle_level_irq;
girq->fwnode = of_node_to_fwnode(state->dev->of_node);
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] pinctrl: qcom: spmi-gpio: Make IRQCHIP immutable
2022-08-30 8:12 [PATCH v2] pinctrl: qcom: spmi-gpio: Make IRQCHIP immutable Manivannan Sadhasivam
@ 2022-08-30 8:26 ` Marc Zyngier
2022-08-30 8:44 ` Manivannan Sadhasivam
0 siblings, 1 reply; 5+ messages in thread
From: Marc Zyngier @ 2022-08-30 8:26 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: linus.walleij, bjorn.andersson, robimarko, linux-arm-msm,
linux-gpio, linux-kernel, johan+linaro, steev
On 2022-08-30 09:12, Manivannan Sadhasivam wrote:
> The IRQCHIP implementation used inside the gpiochips are not supposed
> to
lower case
> be changed during runtime. So let's make the one inside the spmi-gpio
> gpiochip immutable.
>
> This fixes the below warning during boot:
> gpio gpiochip0: (c440000.spmi:pmic@0:gpio@c000): not an immutable
> chip, please consider fixing it!
>
> Separate callbacks need to be provided for irq_{mask/unmask} pointers
> since
> the callbacks are supposed to mask/unmask the corresponding parent IRQ
> in
> addition to changing the gpio_desc flags.
This is all part of the existing documentation, so I don't think
this is really needed.
>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
With the above fixed:
Acked-by: Marc Zyngier <maz@kernel.org>
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] pinctrl: qcom: spmi-gpio: Make IRQCHIP immutable
2022-08-30 8:26 ` Marc Zyngier
@ 2022-08-30 8:44 ` Manivannan Sadhasivam
2022-08-30 8:48 ` Marc Zyngier
0 siblings, 1 reply; 5+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 8:44 UTC (permalink / raw)
To: Marc Zyngier
Cc: linus.walleij, bjorn.andersson, robimarko, linux-arm-msm,
linux-gpio, linux-kernel, johan+linaro, steev
On Tue, Aug 30, 2022 at 09:26:51AM +0100, Marc Zyngier wrote:
> On 2022-08-30 09:12, Manivannan Sadhasivam wrote:
> > The IRQCHIP implementation used inside the gpiochips are not supposed to
>
> lower case
>
> > be changed during runtime. So let's make the one inside the spmi-gpio
> > gpiochip immutable.
> >
> > This fixes the below warning during boot:
> > gpio gpiochip0: (c440000.spmi:pmic@0:gpio@c000): not an immutable
> > chip, please consider fixing it!
> >
> > Separate callbacks need to be provided for irq_{mask/unmask} pointers
> > since
> > the callbacks are supposed to mask/unmask the corresponding parent IRQ
> > in
> > addition to changing the gpio_desc flags.
>
> This is all part of the existing documentation, so I don't think
> this is really needed.
>
Yes it is documented, but developers usually refer the commits doing the similar
thing while doing these kind of conversions. For them, this text serves as a
quick documentation.
So I prefer to keep it in the commit message.
Thanks,
Mani
> >
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
>
> With the above fixed:
>
> Acked-by: Marc Zyngier <maz@kernel.org>
>
> M.
> --
> Jazz is not dead. It just smells funny...
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] pinctrl: qcom: spmi-gpio: Make IRQCHIP immutable
2022-08-30 8:44 ` Manivannan Sadhasivam
@ 2022-08-30 8:48 ` Marc Zyngier
2022-08-30 9:19 ` Manivannan Sadhasivam
0 siblings, 1 reply; 5+ messages in thread
From: Marc Zyngier @ 2022-08-30 8:48 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: linus.walleij, bjorn.andersson, robimarko, linux-arm-msm,
linux-gpio, linux-kernel, johan+linaro, steev
On 2022-08-30 09:44, Manivannan Sadhasivam wrote:
> On Tue, Aug 30, 2022 at 09:26:51AM +0100, Marc Zyngier wrote:
>> On 2022-08-30 09:12, Manivannan Sadhasivam wrote:
>> > The IRQCHIP implementation used inside the gpiochips are not supposed to
>>
>> lower case
>>
>> > be changed during runtime. So let's make the one inside the spmi-gpio
>> > gpiochip immutable.
>> >
>> > This fixes the below warning during boot:
>> > gpio gpiochip0: (c440000.spmi:pmic@0:gpio@c000): not an immutable
>> > chip, please consider fixing it!
>> >
>> > Separate callbacks need to be provided for irq_{mask/unmask} pointers
>> > since
>> > the callbacks are supposed to mask/unmask the corresponding parent IRQ
>> > in
>> > addition to changing the gpio_desc flags.
>>
>> This is all part of the existing documentation, so I don't think
>> this is really needed.
>>
>
> Yes it is documented, but developers usually refer the commits doing
> the similar
> thing while doing these kind of conversions. For them, this text serves
> as a
> quick documentation.
If they can't be bothered to read the documentation, why would they
consider reading unrelated commits?
>
> So I prefer to keep it in the commit message.
I still think this is pointless.
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] pinctrl: qcom: spmi-gpio: Make IRQCHIP immutable
2022-08-30 8:48 ` Marc Zyngier
@ 2022-08-30 9:19 ` Manivannan Sadhasivam
0 siblings, 0 replies; 5+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 9:19 UTC (permalink / raw)
To: Marc Zyngier
Cc: linus.walleij, bjorn.andersson, robimarko, linux-arm-msm,
linux-gpio, linux-kernel, johan+linaro, steev
On Tue, Aug 30, 2022 at 09:48:28AM +0100, Marc Zyngier wrote:
> On 2022-08-30 09:44, Manivannan Sadhasivam wrote:
> > On Tue, Aug 30, 2022 at 09:26:51AM +0100, Marc Zyngier wrote:
> > > On 2022-08-30 09:12, Manivannan Sadhasivam wrote:
> > > > The IRQCHIP implementation used inside the gpiochips are not supposed to
> > >
> > > lower case
> > >
> > > > be changed during runtime. So let's make the one inside the spmi-gpio
> > > > gpiochip immutable.
> > > >
> > > > This fixes the below warning during boot:
> > > > gpio gpiochip0: (c440000.spmi:pmic@0:gpio@c000): not an immutable
> > > > chip, please consider fixing it!
> > > >
> > > > Separate callbacks need to be provided for irq_{mask/unmask} pointers
> > > > since
> > > > the callbacks are supposed to mask/unmask the corresponding parent IRQ
> > > > in
> > > > addition to changing the gpio_desc flags.
> > >
> > > This is all part of the existing documentation, so I don't think
> > > this is really needed.
> > >
> >
> > Yes it is documented, but developers usually refer the commits doing the
> > similar
> > thing while doing these kind of conversions. For them, this text serves
> > as a
> > quick documentation.
>
> If they can't be bothered to read the documentation, why would they
> consider reading unrelated commits?
>
> >
> > So I prefer to keep it in the commit message.
>
> I still think this is pointless.
>
Okay. I'll remove it in v3.
Thanks,
Mani
> M.
> --
> Jazz is not dead. It just smells funny...
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-08-30 9:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-30 8:12 [PATCH v2] pinctrl: qcom: spmi-gpio: Make IRQCHIP immutable Manivannan Sadhasivam
2022-08-30 8:26 ` Marc Zyngier
2022-08-30 8:44 ` Manivannan Sadhasivam
2022-08-30 8:48 ` Marc Zyngier
2022-08-30 9:19 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).