summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/export/config-gigabeat-s.h3
-rw-r--r--firmware/export/mc13783.h1
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c3
3 files changed, 7 insertions, 0 deletions
diff --git a/firmware/export/config-gigabeat-s.h b/firmware/export/config-gigabeat-s.h
index c1b7f93c89..68cc9160ff 100644
--- a/firmware/export/config-gigabeat-s.h
+++ b/firmware/export/config-gigabeat-s.h
@@ -48,6 +48,9 @@
/* define this if you have a real-time clock */
#define CONFIG_RTC RTC_MC13783
+/* Define if the device can wake from an RTC alarm */
+#define HAVE_RTC_ALARM
+
/* Define this for LCD backlight available */
#define HAVE_BACKLIGHT
diff --git a/firmware/export/mc13783.h b/firmware/export/mc13783.h
index bb9cf589aa..61d7b37a1c 100644
--- a/firmware/export/mc13783.h
+++ b/firmware/export/mc13783.h
@@ -277,5 +277,6 @@ int mc13783_write_regset(const unsigned char *regs, const uint32_t *data, int co
uint32_t mc13783_read(unsigned address);
int mc13783_read_multiple(unsigned start, uint32_t *buffer, int count);
int mc13783_read_regset(const unsigned char *regs, uint32_t *buffer, int count);
+void mc1378_alarm_start(void);
#endif /* _MC13783_H_ */
diff --git a/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c b/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c
index 8f504746c3..20a54c5bb4 100644
--- a/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c
@@ -66,6 +66,9 @@ static __attribute__((noreturn)) void mc13783_interrupt_thread(void)
gpio_enable_event(MC13783_GPIO_NUM, MC13783_EVENT_ID);
+ if (pending[1] & MC13783_TODA) /* only needs to be polled on startup */
+ mc1378_alarm_start();
+
/* Check initial states for events with a sense bit */
value = mc13783_read(MC13783_INTERRUPT_SENSE0);
usb_set_status(value & MC13783_USB4V4);