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

Commit a6a70d50 authored by Rishabh Bhatnagar's avatar Rishabh Bhatnagar
Browse files

pinctrl: Add api to enable/disable wakeup capability for a gpio



Add api to write to mpm wakeup registers to configure a gpio
as wakeup capable.

Change-Id: Ia11a22160394e76969200691cfaf8fb1505bf5c1
Signed-off-by: default avatarRishabh Bhatnagar <rishabhb@codeaurora.org>
parent 7ea52e5a
Loading
Loading
Loading
Loading
+29 −0
Original line number Original line Diff line number Diff line
@@ -1284,6 +1284,35 @@ int msm_qup_read(unsigned int mode)
	return -ENOENT;
	return -ENOENT;
}
}


/*
 * msm_gpio_mpm_wake_set - API to make interrupt wakeup capable
 * @gpio:       Gpio number to make interrupt wakeup capable
 * @enable:     Enable/Disable wakeup capability
 */
int msm_gpio_mpm_wake_set(unsigned int gpio, bool enable)
{
	const struct msm_pingroup *g;
	unsigned long flags;
	u32 val;

	g = &msm_pinctrl_data->soc->groups[gpio];
	if (g->wake_bit == -1)
		return -ENOENT;

	raw_spin_lock_irqsave(&msm_pinctrl_data->lock, flags);
	val = readl_relaxed(msm_pinctrl_data->regs + g->wake_reg);
	if (enable)
		val |= BIT(g->wake_bit);
	else
		val &= ~BIT(g->wake_bit);

	writel_relaxed(val, msm_pinctrl_data->regs + g->wake_reg);
	raw_spin_unlock_irqrestore(&msm_pinctrl_data->lock, flags);

	return 0;
}
EXPORT_SYMBOL(msm_gpio_mpm_wake_set);

int msm_pinctrl_probe(struct platform_device *pdev,
int msm_pinctrl_probe(struct platform_device *pdev,
		      const struct msm_pinctrl_soc_data *soc_data)
		      const struct msm_pinctrl_soc_data *soc_data)
{
{
+2 −0
Original line number Original line Diff line number Diff line
@@ -10,5 +10,7 @@
int msm_qup_write(u32 mode, u32 val);
int msm_qup_write(u32 mode, u32 val);
int msm_qup_read(u32 mode);
int msm_qup_read(u32 mode);


/* API to write to mpm_wakeup registers */
int msm_gpio_mpm_wake_set(unsigned int gpio, bool enable);


#endif /* __LINUX_PINCTRL_MSM_H__ */
#endif /* __LINUX_PINCTRL_MSM_H__ */