static void es705_alloc_slim_rx_chan(struct slim_device *sbdev) { struct es705_priv *es705_priv = slim_get_devicedata(sbdev); struct es705_slim_ch *rx = es705_priv->slim_rx; int i; int port_id; for (i = 0; i < ES705_SLIM_RX_PORTS; i++) { port_id = i; rx[i].ch_num = es705_slim_rx_port_to_ch[i]; slim_get_slaveport(sbdev->laddr, port_id, &rx[i].sph, SLIM_SINK); slim_query_ch(sbdev, rx[i].ch_num, &rx[i].ch_h); } }
static void escore_alloc_slim_tx_chan(struct escore_priv *escore_priv) { struct slim_device *sbdev = escore_priv->gen0_client; struct escore_slim_ch *tx = escore_priv->slim_tx; int i; int port_id; dev_dbg(&sbdev->dev, "%s()\n", __func__); for (i = 0; i < escore_priv->slim_tx_ports; i++) { port_id = i + 10; tx[i].ch_num = escore_priv->slim_tx_port_to_ch_map[i]; slim_get_slaveport(sbdev->laddr, port_id, &tx[i].sph, SLIM_SRC); slim_query_ch(sbdev, tx[i].ch_num, &tx[i].ch_h); } }
static int wcd9xxx_alloc_slim_sh_ch(struct wcd9xxx *wcd9xxx, u8 wcd9xxx_pgd_la, u32 cnt, struct wcd9xxx_ch *channels, u32 path) { int ret = 0; u32 ch_idx ; /* The slimbus channel allocation seem take longer time * so do the allocation up front to avoid delay in start of * playback */ pr_debug("%s: pgd_la[%d]\n", __func__, wcd9xxx_pgd_la); for (ch_idx = 0; ch_idx < cnt; ch_idx++) { ret = slim_get_slaveport(wcd9xxx_pgd_la, channels[ch_idx].port, &channels[ch_idx].sph, path); pr_debug("%s: pgd_la[%d] channels[%d].port[%d]\n" "channels[%d].sph[%d] path[%d]\n", __func__, wcd9xxx_pgd_la, ch_idx, channels[ch_idx].port, ch_idx, channels[ch_idx].sph, path); if (ret < 0) { pr_err("%s: slave port failure id[%d] ret[%d]\n", __func__, channels[ch_idx].ch_num, ret); goto err; } ret = slim_query_ch(wcd9xxx->slim, channels[ch_idx].ch_num, &channels[ch_idx].ch_h); if (ret < 0) { pr_err("%s: slim_query_ch failed ch-num[%d] ret[%d]\n", __func__, channels[ch_idx].ch_num, ret); goto err; } } err: return ret; }
static int wcd9xxx_alloc_slim_sh_ch_rx(struct wcd9xxx *wcd9xxx, u8 wcd9xxx_pgd_la) { int ret = 0; u8 ch_idx ; u16 slave_port_id = 0; struct wcd9xxx_slim_sch_rx *rx = sh_ch.rx; /* * DSP requires channel number to be between 128 and 255. */ pr_debug("%s: pgd_la[%d]\n", __func__, wcd9xxx_pgd_la); for (ch_idx = 0; ch_idx < sh_ch.number_of_rx_slave_dev_ports; ch_idx++) { slave_port_id = (ch_idx + sh_ch.rx_port_start_offset); rx[ch_idx].ch_num = slave_port_id + BASE_CH_NUM; ret = slim_get_slaveport(wcd9xxx_pgd_la, slave_port_id, &rx[ch_idx].sph, SLIM_SINK); if (ret < 0) { pr_err("%s: slave port failure id[%d] ret[%d]\n", __func__, slave_port_id, ret); goto err; } ret = slim_query_ch(wcd9xxx->slim, rx[ch_idx].ch_num, &rx[ch_idx].ch_h); if (ret < 0) { pr_err("%s: slim_query_ch failed ch-num[%d] ret[%d]\n", __func__, rx[ch_idx].ch_num, ret); goto err; } pr_debug("%s:ch_num=%d ch_h=%d sph=%d la=%d slave_port_id %d\n", __func__, rx[ch_idx].ch_num, rx[ch_idx].ch_h, rx[ch_idx].sph, wcd9xxx_pgd_la, slave_port_id); } err: return ret; }