Fix MSM8905 WCD 48 kHz interpolators, ADSP clock retention, and boot audio sync
Ensure LPASS_CDC_RX1/2/3_B5_CTL and TX1/2_CLK_FS_CTL are always reprogrammed for 48 kHz on MSM8905 (Q6_ADSP_VERSION_2_6) targets (nokia-beatles, nokia-argon, nokia-coconut), preserve INT_DIGITAL_CDC_CLK on ADSP < 2.7, eliminate unclocked debugfs AHB reads, harden PipeWire boot sink/unity sync, and update rebuilt a1125 (ampere) image checksums.
This commit is contained in:
1 parent
4f73c28e5e
commit
aba38a58f2
21 files changed
+568
-104
No files matched your search
@@ -10,6 +10,7 @@
|
||||
|
||||
static volatile sig_atomic_t stop_requested = 0;
|
||||
static volatile pid_t pactl_pid = -1;
|
||||
static int internal_synced = 0;
|
||||
|
||||
static void handle_signal(int sig)
|
||||
{
|
||||
@@ -215,6 +216,28 @@ static void find_bt_sink(char *out, size_t out_len)
|
||||
}
|
||||
}
|
||||
|
||||
static int has_internal_sink(void)
|
||||
{
|
||||
char raw[2048];
|
||||
char *line;
|
||||
char *save = NULL;
|
||||
char *const argv[] = {
|
||||
(char *)"pactl", (char *)"list", (char *)"short", (char *)"sinks", NULL
|
||||
};
|
||||
if(run_capture(argv, raw, sizeof(raw)) != 0)
|
||||
return 0;
|
||||
for(line = strtok_r(raw, "\n", &save); line; line = strtok_r(NULL, "\n", &save)) {
|
||||
char *c1 = strtok(line, " \t");
|
||||
char *c2 = c1 ? strtok(NULL, " \t") : NULL;
|
||||
if(c2 &&
|
||||
(strncmp(c2, "alsa_output.platform-7702000.", 29) == 0 ||
|
||||
strncmp(c2, "alsa_output.platform-sound.", 27) == 0)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sxmo_audio_cmd(const char *arg1, const char *arg2)
|
||||
{
|
||||
if(arg2) {
|
||||
@@ -346,7 +369,8 @@ static int start_pactl_subscribe(char *prev_bt, size_t prev_bt_len)
|
||||
return pfd[0];
|
||||
}
|
||||
|
||||
static void dispatch_pactl_line(const char *line, char *prev_bt, size_t prev_bt_len)
|
||||
static void dispatch_pactl_line(const char *line, char *prev_bt, size_t prev_bt_len,
|
||||
int jack_fd)
|
||||
{
|
||||
if((strstr(line, "Event 'new' on sink") != NULL) ||
|
||||
(strstr(line, "Event 'new' on card") != NULL) ||
|
||||
@@ -357,6 +381,15 @@ static void dispatch_pactl_line(const char *line, char *prev_bt, size_t prev_bt_
|
||||
safe_copy(prev_bt, prev_bt_len, bt_sink);
|
||||
sxmo_audio_cmd("set", "Bluetooth");
|
||||
}
|
||||
if(!internal_synced && has_internal_sink()) {
|
||||
internal_synced = 1;
|
||||
if(bt_sink[0] == '\0') {
|
||||
if(query_ev_sw(jack_fd, SW_HEADPHONE_INSERT, "name='Headphone Jack'"))
|
||||
handle_jack_insert(jack_fd);
|
||||
else
|
||||
sxmo_audio_cmd("apply", NULL);
|
||||
}
|
||||
}
|
||||
{
|
||||
char *const sb_argv[] = {
|
||||
(char *)"sxmo_hook_statusbar.sh", (char *)"volume", NULL
|
||||
@@ -367,6 +400,8 @@ static void dispatch_pactl_line(const char *line, char *prev_bt, size_t prev_bt_
|
||||
(strstr(line, "Event 'remove' on card") != NULL)) {
|
||||
char bt_sink[128] = "";
|
||||
find_bt_sink(bt_sink, sizeof(bt_sink));
|
||||
if(internal_synced && !has_internal_sink())
|
||||
internal_synced = 0;
|
||||
if(bt_sink[0] == '\0' && prev_bt[0] != '\0') {
|
||||
char cur_out[64] = "";
|
||||
prev_bt[0] = '\0';
|
||||
@@ -433,6 +468,7 @@ int main(void)
|
||||
else
|
||||
sxmo_audio_cmd("apply", NULL);
|
||||
}
|
||||
internal_synced = has_internal_sink();
|
||||
if(jack_fd < 0)
|
||||
jack_retry_at = now_ms() + 5000;
|
||||
|
||||
@@ -525,7 +561,7 @@ int main(void)
|
||||
while((nl = strchr(pactl_buf, '\n')) != NULL) {
|
||||
size_t rest;
|
||||
*nl = '\0';
|
||||
dispatch_pactl_line(pactl_buf, prev_bt, sizeof(prev_bt));
|
||||
dispatch_pactl_line(pactl_buf, prev_bt, sizeof(prev_bt), jack_fd);
|
||||
rest = (size_t)(pactl_buf + pactl_len - (nl + 1));
|
||||
memmove(pactl_buf, nl + 1, rest);
|
||||
pactl_len = rest;
|
||||
|
||||
Reference in new issue
Block a user