Commit 38e0689b authored by Alexandre Torgue's avatar Alexandre Torgue Committed by Alexandre Belloni
Browse files

rtc: stm32: remove dedicated wakeup management



There is no more needs to use a dedicated wake up interrupt for RTC as
EXTI block manages by itself now all interrupt lines.

Dedicated wakeup interrupt has been introduced with STM32 MP1 support
commit b72252b6 ("rtc: stm32: add stm32mp1 rtc support") because GIC &
EXTI interrupts were not yet linked in EXTI driver.

Removing this interrupt won't break compatibility with device trees which
do use two interrupts entries: it could only prevent wakeup from low power
modes on STM32MP1x, but platform power management is not yet available.

Signed-off-by: default avatarAlexandre Torgue <alexandre.torgue@foss.st.com>
Signed-off-by: default avatarAmelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/r/20230531122732.1515594-1-amelie.delaunay@foss.st.com


Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 93eff1e0
Loading
Loading
Loading
Loading
+5 −23
Original line number Diff line number Diff line
@@ -114,7 +114,6 @@ struct stm32_rtc_data {
	void (*clear_events)(struct stm32_rtc *rtc, unsigned int flags);
	bool has_pclk;
	bool need_dbp;
	bool has_wakeirq;
};

struct stm32_rtc {
@@ -127,7 +126,6 @@ struct stm32_rtc {
	struct clk *rtc_ck;
	const struct stm32_rtc_data *data;
	int irq_alarm;
	int wakeirq_alarm;
};

static void stm32_rtc_wpr_unlock(struct stm32_rtc *rtc)
@@ -547,7 +545,6 @@ static void stm32_rtc_clear_events(struct stm32_rtc *rtc,
static const struct stm32_rtc_data stm32_rtc_data = {
	.has_pclk = false,
	.need_dbp = true,
	.has_wakeirq = false,
	.regs = {
		.tr = 0x00,
		.dr = 0x04,
@@ -569,7 +566,6 @@ static const struct stm32_rtc_data stm32_rtc_data = {
static const struct stm32_rtc_data stm32h7_rtc_data = {
	.has_pclk = true,
	.need_dbp = true,
	.has_wakeirq = false,
	.regs = {
		.tr = 0x00,
		.dr = 0x04,
@@ -600,7 +596,6 @@ static void stm32mp1_rtc_clear_events(struct stm32_rtc *rtc,
static const struct stm32_rtc_data stm32mp1_data = {
	.has_pclk = true,
	.need_dbp = false,
	.has_wakeirq = true,
	.regs = {
		.tr = 0x00,
		.dr = 0x04,
@@ -779,19 +774,12 @@ static int stm32_rtc_probe(struct platform_device *pdev)
	}

	ret = device_init_wakeup(&pdev->dev, true);
	if (rtc->data->has_wakeirq) {
		rtc->wakeirq_alarm = platform_get_irq(pdev, 1);
		if (rtc->wakeirq_alarm > 0) {
			ret = dev_pm_set_dedicated_wake_irq(&pdev->dev,
							    rtc->wakeirq_alarm);
		} else {
			ret = rtc->wakeirq_alarm;
			if (rtc->wakeirq_alarm == -EPROBE_DEFER)
	if (ret)
		goto err;
		}
	}

	ret = dev_pm_set_wake_irq(&pdev->dev, rtc->irq_alarm);
	if (ret)
		dev_warn(&pdev->dev, "alarm can't wake up the system: %d", ret);
		goto err;

	platform_set_drvdata(pdev, rtc);

@@ -879,9 +867,6 @@ static int stm32_rtc_suspend(struct device *dev)
	if (rtc->data->has_pclk)
		clk_disable_unprepare(rtc->pclk);

	if (device_may_wakeup(dev))
		return enable_irq_wake(rtc->irq_alarm);

	return 0;
}

@@ -903,9 +888,6 @@ static int stm32_rtc_resume(struct device *dev)
		return ret;
	}

	if (device_may_wakeup(dev))
		return disable_irq_wake(rtc->irq_alarm);

	return ret;
}
#endif