Message ID | 20210114154004.v6.1.I3ad184e3423d8e479bc3e86f5b393abb1704a1d1@changeid |
---|---|
State | Accepted |
Commit | a82e537807d5c85706cd4c16fd2de77a8495dc8d |
Headers | show |
Series | [v6,1/4] pinctrl: qcom: Allow SoCs to specify a GPIO function that's not 0 | expand |
Quoting Douglas Anderson (2021-01-14 15:40:27) > diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c > index 192ed31eabf4..712a693425fc 100644 > --- a/drivers/pinctrl/qcom/pinctrl-msm.c > +++ b/drivers/pinctrl/qcom/pinctrl-msm.c > @@ -1097,16 +1128,11 @@ static int msm_gpio_irq_reqres(struct irq_data *d) > } > > /* > - * Clear the interrupt that may be pending before we enable > - * the line. > - * This is especially a problem with the GPIOs routed to the > - * PDC. These GPIOs are direct-connect interrupts to the GIC. > - * Disabling the interrupt line at the PDC does not prevent > - * the interrupt from being latched at the GIC. The state at > - * GIC needs to be cleared before enabling. > + * The disable / clear-enable workaround we do in msm_pinmux_set_mux() > + * only works if disable is not lazy since we only clear any bogus > + # interrupt in hardware. Explicitly mark the interrupt as UNLAZY. Ah! What is # doing there? > */ > - if (d->parent_data && test_bit(d->hwirq, pctrl->skip_wake_irqs)) > - irq_chip_set_parent_state(d, IRQCHIP_STATE_PENDING, 0); > + irq_set_status_flags(d->irq, IRQ_DISABLE_UNLAZY); >
diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c index e051aecf95c4..d1261188fb6e 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -210,8 +210,7 @@ static int msm_pinmux_request_gpio(struct pinctrl_dev *pctldev, if (!g->nfuncs) return 0; - /* For now assume function 0 is GPIO because it always is */ - return msm_pinmux_set_mux(pctldev, g->funcs[0], offset); + return msm_pinmux_set_mux(pctldev, g->funcs[pctrl->soc->gpio_func], offset); } static const struct pinmux_ops msm_pinmux_ops = { diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h b/drivers/pinctrl/qcom/pinctrl-msm.h index 333f99243c43..e31a5167c91e 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.h +++ b/drivers/pinctrl/qcom/pinctrl-msm.h @@ -118,6 +118,7 @@ struct msm_gpio_wakeirq_map { * @wakeirq_dual_edge_errata: If true then GPIOs using the wakeirq_map need * to be aware that their parent can't handle dual * edge interrupts. + * @gpio_func: Which function number is GPIO (usually 0). */ struct msm_pinctrl_soc_data { const struct pinctrl_pin_desc *pins; @@ -134,6 +135,7 @@ struct msm_pinctrl_soc_data { const struct msm_gpio_wakeirq_map *wakeirq_map; unsigned int nwakeirq_map; bool wakeirq_dual_edge_errata; + unsigned int gpio_func; }; extern const struct dev_pm_ops msm_pinctrl_dev_pm_ops;