summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfram Sang <wsa@the-dreams.de>2021-11-18 09:14:37 +0100
committerSolomon Peachy <pizza@shaftnet.org>2021-11-18 16:53:57 -0500
commit336ea51af65c8511ba38f0c3ccfdf7634b87c12d (patch)
treec2c2f4a946c2e4fa9d89be94e259c4100c6edc29
parentde0346065b415e03efad5746ffdee99d607a0d3c (diff)
downloadrockbox-336ea51af65c8511ba38f0c3ccfdf7634b87c12d.tar.gz
rockbox-336ea51af65c8511ba38f0c3ccfdf7634b87c12d.zip
WIP: Samsung YPR0/1: switch to generic SI47xx polling
Should work(tm). But I don't have the hardware, so it needs to be tested. Change-Id: Ic086434f570dcddacb5b7e7a1acce4b8cafc5c03
-rw-r--r--firmware/export/config/samsungypr0.h2
-rw-r--r--firmware/export/config/samsungypr1.h2
-rw-r--r--firmware/target/hosted/samsungypr/radio-ypr.c59
3 files changed, 4 insertions, 59 deletions
diff --git a/firmware/export/config/samsungypr0.h b/firmware/export/config/samsungypr0.h
index e29ea6a974..520eb08d01 100644
--- a/firmware/export/config/samsungypr0.h
+++ b/firmware/export/config/samsungypr0.h
@@ -105,6 +105,8 @@
#define CONFIG_TUNER SI4700
#define HAVE_TUNER_PWR_CTRL
#define HAVE_RDS_CAP
+#define CONFIG_RDS (RDS_CFG_POLL | RDS_CFG_PROCESS)
+#define CONFIG_RDS_POLL_TICKS 4
/* Define this for FM radio input available */
#define HAVE_FMRADIO_IN
diff --git a/firmware/export/config/samsungypr1.h b/firmware/export/config/samsungypr1.h
index d091e3ed1e..50abfa323e 100644
--- a/firmware/export/config/samsungypr1.h
+++ b/firmware/export/config/samsungypr1.h
@@ -150,6 +150,8 @@
#define CONFIG_TUNER SI4700
#define HAVE_TUNER_PWR_CTRL
#define HAVE_RDS_CAP
+#define CONFIG_RDS (RDS_CFG_POLL | RDS_CFG_PROCESS)
+#define CONFIG_RDS_POLL_TICKS 4
/* Define this for FM radio input available */
#define HAVE_FMRADIO_IN
diff --git a/firmware/target/hosted/samsungypr/radio-ypr.c b/firmware/target/hosted/samsungypr/radio-ypr.c
index 42d485231d..ef7fb84aa0 100644
--- a/firmware/target/hosted/samsungypr/radio-ypr.c
+++ b/firmware/target/hosted/samsungypr/radio-ypr.c
@@ -126,62 +126,3 @@ int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count)
(void)address;
return read(radio_dev, buf, count);
}
-
-#ifdef HAVE_RDS_CAP
-
-/* Register we are going to poll */
-#define STATUSRSSI (0xA)
-#define STATUSRSSI_RDSR (0x1 << 15)
-
-/* Low-level RDS Support */
-static struct event_queue rds_queue;
-static uint32_t rds_stack[DEFAULT_STACK_SIZE / sizeof(uint32_t)];
-
-enum {
- Q_POWERUP,
-};
-
-static void NORETURN_ATTR rds_thread(void)
-{
- /* start up frozen */
- int timeout = TIMEOUT_BLOCK;
- struct queue_event ev;
- bool rds_rdy = false;
- struct si4700_dbg_info radio_regs;
-
- while (true) {
- queue_wait_w_tmo(&rds_queue, &ev, timeout);
- switch (ev.id) {
- case Q_POWERUP:
- /* power up: timeout after 1 tick, else block indefinitely */
- timeout = ev.data ? 1 : TIMEOUT_BLOCK;
- break;
- case SYS_TIMEOUT:
- /* Captures RDS data and processes it */
- si4700_dbg_info(&radio_regs);
- bool rdsr = radio_regs.regs[STATUSRSSI] & STATUSRSSI_RDSR;
- if (rdsr != rds_rdy) {
- rds_rdy = rdsr;
- if (rdsr) {
- si4700_rds_process();
- }
- }
- break;
- }
- }
-}
-
-/* true after full radio power up, and false before powering down */
-void si4700_rds_powerup(bool on)
-{
- queue_post(&rds_queue, Q_POWERUP, on);
-}
-
-/* One-time RDS init at startup */
-void si4700_rds_init(void)
-{
- queue_init(&rds_queue, false);
- create_thread(rds_thread, rds_stack, sizeof(rds_stack), 0, "rds"
- IF_PRIO(, PRIORITY_PLAYBACK) IF_COP(, CPU));
-}
-#endif /* HAVE_RDS_CAP */