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
This commit is contained in:
Wolfram Sang 2021-11-18 09:14:37 +01:00 committed by Solomon Peachy
parent de0346065b
commit 336ea51af6
3 changed files with 4 additions and 59 deletions

View file

@ -105,6 +105,8 @@
#define CONFIG_TUNER SI4700 #define CONFIG_TUNER SI4700
#define HAVE_TUNER_PWR_CTRL #define HAVE_TUNER_PWR_CTRL
#define HAVE_RDS_CAP #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 this for FM radio input available */
#define HAVE_FMRADIO_IN #define HAVE_FMRADIO_IN

View file

@ -150,6 +150,8 @@
#define CONFIG_TUNER SI4700 #define CONFIG_TUNER SI4700
#define HAVE_TUNER_PWR_CTRL #define HAVE_TUNER_PWR_CTRL
#define HAVE_RDS_CAP #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 this for FM radio input available */
#define HAVE_FMRADIO_IN #define HAVE_FMRADIO_IN

View file

@ -126,62 +126,3 @@ int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count)
(void)address; (void)address;
return read(radio_dev, buf, count); 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 */