static int audio_update_acdb(uint32_t adev, uint32_t acdb_id) { uint32_t sample_rate; int sz = -1; sample_rate = q6_device_to_rate(adev); if (q6_device_to_dir(adev) == Q6_RX) rx_acdb = acdb_id; else tx_acdb = acdb_id; if (acdb_id != 0) sz = acdb_get_config_table(acdb_id, sample_rate); if (sz <= 0) { acdb_id = q6_device_to_cad_id(adev); sz = acdb_get_config_table(acdb_id, sample_rate); if (sz <= 0) return -EINVAL; } audio_set_table(ac_control, adev, sz); return 0; }
static int audio_set_table(struct audio_client *ac, uint32_t device_id, int size) { struct adsp_set_dev_cfg_table_command rpc; memset(&rpc, 0, sizeof(rpc)); rpc.hdr.opcode = ADSP_AUDIO_IOCTL_SET_DEVICE_CONFIG_TABLE; if (q6_device_to_dir(device_id) == Q6_TX) rpc.hdr.data = tx_clk_freq; rpc.device_id = device_id; rpc.phys_addr = audio_phys; rpc.phys_size = size; rpc.phys_used = size; TRACE("control: set table %x\n", device_id); return audio_ioctl(ac, &rpc, sizeof(rpc)); }
int q6audio_do_routing(uint32_t device_id, uint32_t acdb_id) { if (q6audio_init()) return 0; mutex_lock(&audio_path_lock); switch(q6_device_to_dir(device_id)) { case Q6_RX: do_rx_routing(device_id, acdb_id); break; case Q6_TX: do_tx_routing(device_id, acdb_id); break; } mutex_unlock(&audio_path_lock); return 0; }
int q6audio_update_acdb(uint32_t id_src, uint32_t id_dst) { int res; if (q6audio_init()) return 0; mutex_lock(&audio_path_lock); res = audio_update_acdb(id_dst, id_src); if (res) goto done; if (q6_device_to_dir(id_dst) == Q6_RX) qdsp6_devchg_notify(ac_control, ADSP_AUDIO_RX_DEVICE, id_dst); else qdsp6_devchg_notify(ac_control, ADSP_AUDIO_TX_DEVICE, id_dst); qdsp6_standby(ac_control); qdsp6_start(ac_control); done: mutex_unlock(&audio_path_lock); return res; }