Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ece488e5 authored by Prateek Sood's avatar Prateek Sood
Browse files

pinctrl: qcom: disable MPM_WAKEUP_INT_EN bits for gpio



BY default MPM_WAKEUP_INT_EN bits are set from firmware
for gpios which can have wakeup capability. This results
in wakeup capability set for a gpio which is not being used
as IRQ. Problem manifests as spurious interrupts coming to
GIC from PDC as MPM_WAKEUP_INT_EN registers bit corresponding
to gpio is set.

Fix this by disabling wakeup capability for gpio not being
used as IRQ. When client driver calls irq_set_irq_wake()
after requesting gpio as irq, enable wakeup capability.

Change-Id: Ie215f2fdd36483b133b17ec8162c7423a7d8db31
Signed-off-by: default avatarPrateek Sood <prsood@codeaurora.org>
parent 9a721aa3
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -137,8 +137,26 @@ static int msm_pinmux_request(struct pinctrl_dev *pctldev, unsigned offset)
{
	struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
	struct gpio_chip *chip = &pctrl->chip;
	int ret;

	ret = gpiochip_line_is_valid(chip, offset) ? 0 : -EINVAL;
	if (!ret && pctrl->mpm_wake_ctl)
		msm_gpio_mpm_wake_set(offset, false);

	return gpiochip_line_is_valid(chip, offset) ? 0 : -EINVAL;
	return ret;
}

static int msm_pinmux_free(struct pinctrl_dev *pctldev, unsigned int offset)
{
	struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
	struct gpio_chip *chip = &pctrl->chip;
	int ret;

	ret = gpiochip_line_is_valid(chip, offset) ? 0 : -EINVAL;
	if (!ret && pctrl->mpm_wake_ctl)
		msm_gpio_mpm_wake_set(offset, true);

	return ret;
}

static int msm_get_functions_count(struct pinctrl_dev *pctldev)
@@ -222,6 +240,7 @@ static int msm_pinmux_request_gpio(struct pinctrl_dev *pctldev,

static const struct pinmux_ops msm_pinmux_ops = {
	.request		= msm_pinmux_request,
	.free			= msm_pinmux_free,
	.get_functions_count	= msm_get_functions_count,
	.get_function_name	= msm_get_function_name,
	.get_function_groups	= msm_get_function_groups,
@@ -1175,6 +1194,9 @@ static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
	struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
	unsigned long flags;

	if (pctrl->mpm_wake_ctl)
		msm_gpio_mpm_wake_set(d->hwirq, on);

	if (d->parent_data)
		irq_chip_set_wake_parent(d, on);