コード例 #1
0
void rtac_add_adm_device(u32 port_id, u32 popp_id)
{
	u32 i = 0;
	pr_debug("%s\n", __func__);

	mutex_lock(&rtac_adm_mutex);
	if (rtac_adm_data.num_of_dev == RTAC_MAX_ACTIVE_DEVICES) {
		pr_err("%s, Can't add anymore RTAC devices!\n", __func__);
		goto done;
	}

	/* Check if device already added */
	if (rtac_adm_data.num_of_dev != 0) {
		for (; i < rtac_adm_data.num_of_dev; i++) {
			if (rtac_adm_data.device[i].afe_port == port_id)
				add_popp(i, port_id, popp_id);
				goto done;
		}
	}

	if (rtac_adm_data.device[i].num_of_popp == RTAC_MAX_ACTIVE_POPP) {
		pr_err("%s, Max POPP!\n", __func__);
		goto done;
	}

	/* Add device */
	rtac_adm_data.num_of_dev++;
	rtac_adm_data.device[i].afe_port = port_id;
	rtac_adm_data.device[i].copp = adm_get_copp_id(port_id);
	rtac_adm_data.device[i].popp[
		rtac_adm_data.device[i].num_of_popp++] = popp_id;
done:
	mutex_unlock(&rtac_adm_mutex);
	return;
}
コード例 #2
0
void rtac_add_adm_device(u32 port_id, u32 copp_id, u32 path_id, u32 popp_id)
{
	u32 i = 0;
	pr_debug("%s: port_id = %d, popp_id = %d\n", __func__, port_id,
		popp_id);

	mutex_lock(&rtac_adm_mutex);
	rtac_add_adm_device_v2(port_id, copp_id, path_id, popp_id);

	if (rtac_adm_data.num_of_dev == RTAC_MAX_ACTIVE_DEVICES) {
		pr_err("%s, Can't add anymore RTAC devices!\n", __func__);
		goto done;
	}

	
	if (rtac_adm_data.num_of_dev != 0) {
		for (; i < rtac_adm_data.num_of_dev; i++) {
			if (rtac_adm_data.device[i].afe_port == port_id &&
			    rtac_adm_data.device[i].copp == copp_id) {
				add_popp(i, port_id, popp_id);
				goto done;
			}
			if (rtac_adm_data.device[i].num_of_popp ==
						RTAC_MAX_ACTIVE_POPP) {
				pr_err("%s, Max POPP!\n", __func__);
				goto done;
			}
		}
	}

	
	rtac_adm_data.num_of_dev++;

	if (path_id == ADM_PATH_PLAYBACK)
		rtac_adm_data.device[i].topology_id =
						get_adm_rx_topology();
	else
		rtac_adm_data.device[i].topology_id =
						get_adm_tx_topology();
	rtac_adm_data.device[i].afe_port = port_id;
	rtac_adm_data.device[i].copp = copp_id;
	rtac_adm_data.device[i].popp[
		rtac_adm_data.device[i].num_of_popp++] = popp_id;
done:
	mutex_unlock(&rtac_adm_mutex);
	return;
}