Lines Matching +full:ports +full:- +full:hstop

1 // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
2 // Copyright(c) 2015-17 Intel Corporation.
33 #define CDNS_IP_MCP_CONFIG 0x0 /* IP offset added at run-time */
50 #define CDNS_IP_MCP_CONTROL 0x4 /* IP offset added at run-time */
58 #define CDNS_IP_MCP_CMDCTRL 0x8 /* IP offset added at run-time */
133 #define CDNS_IP_MCP_CMD_BASE 0x80 /* IP offset added at run-time */
134 #define CDNS_IP_MCP_RESP_BASE 0x80 /* IP offset added at run-time */
206 return readl(cdns->registers + offset); in cdns_readl()
211 writel(value, cdns->registers + offset); in cdns_writel()
216 return cdns_readl(cdns, cdns->ip_offset + offset); in cdns_ip_readl()
221 return cdns_writel(cdns, cdns->ip_offset + offset, value); in cdns_ip_writel()
237 cdns_updatel(cdns, cdns->ip_offset + offset, mask, val); in cdns_ip_updatel()
247 reg_read = readl(cdns->registers + offset); in cdns_set_wait()
251 timeout--; in cdns_set_wait()
255 return -ETIMEDOUT; in cdns_set_wait()
260 writel(value, cdns->registers + offset); in cdns_clear_bit()
275 dev_err(cdns->dev, "Cannot program MCP_CONFIG_UPDATE in ClockStopMode\n"); in cdns_config_update()
276 return -EINVAL; in cdns_config_update()
282 dev_err(cdns->dev, "Config update timedout\n"); in cdns_config_update()
288 * sdw_cdns_config_update() - Update configurations
299 * sdw_cdns_config_update_set_wait() - wait until configuration update bit is self-cleared
320 return scnprintf(buf + pos, RD_BUF - pos, in cdns_sprintf()
326 struct sdw_cdns *cdns = s->private; in cdns_reg_show()
333 return -ENOMEM; in cdns_reg_show()
336 ret += scnprintf(buf + ret, RD_BUF - ret, "\nMCP Registers\n"); in cdns_reg_show()
341 ret += scnprintf(buf + ret, RD_BUF - ret, in cdns_reg_show()
347 ret += scnprintf(buf + ret, RD_BUF - ret, in cdns_reg_show()
354 ret += scnprintf(buf + ret, RD_BUF - ret, in cdns_reg_show()
357 num_ports = cdns->num_ports; in cdns_reg_show()
360 ret += scnprintf(buf + ret, RD_BUF - ret, in cdns_reg_show()
361 "\nDP-%d\n", i); in cdns_reg_show()
367 ret += scnprintf(buf + ret, RD_BUF - ret, in cdns_reg_show()
370 ret += scnprintf(buf + ret, RD_BUF - ret, in cdns_reg_show()
371 "\nDP-%d\n", i); in cdns_reg_show()
378 ret += scnprintf(buf + ret, RD_BUF - ret, in cdns_reg_show()
384 ret += scnprintf(buf + ret, RD_BUF - ret, in cdns_reg_show()
387 /* number of PDI and ports is interchangeable */ in cdns_reg_show()
403 return -EINVAL; in cdns_hw_reset()
410 dev_dbg(cdns->dev, "link hw_reset done: %d\n", ret); in cdns_hw_reset()
424 return -EINVAL; in cdns_parity_error_injection()
426 bus = &cdns->bus; in cdns_parity_error_injection()
430 * Slave devices will re-attach and be re-enumerated. in cdns_parity_error_injection()
432 ret = pm_runtime_resume_and_get(bus->dev); in cdns_parity_error_injection()
433 if (ret < 0 && ret != -EACCES) { in cdns_parity_error_injection()
434 dev_err_ratelimited(cdns->dev, in cdns_parity_error_injection()
450 mutex_lock(&bus->bus_lock); in cdns_parity_error_injection()
463 ret = sdw_bread_no_pm_unlocked(&cdns->bus, 0xf, SDW_SCP_DEVID_0); in cdns_parity_error_injection()
464 dev_info(cdns->dev, "parity error injection, read: %d\n", ret); in cdns_parity_error_injection()
481 mutex_unlock(&bus->bus_lock); in cdns_parity_error_injection()
487 pm_runtime_mark_last_busy(bus->dev); in cdns_parity_error_injection()
488 pm_runtime_put_autosuspend(bus->dev); in cdns_parity_error_injection()
499 unsigned int pdi_out_num = cdns->pcm.num_bd + cdns->pcm.num_out; in cdns_set_pdi_loopback_source()
502 return -EINVAL; in cdns_set_pdi_loopback_source()
507 cdns->pdi_loopback_source = value; in cdns_set_pdi_loopback_source()
516 unsigned int pdi_in_num = cdns->pcm.num_bd + cdns->pcm.num_in; in cdns_set_pdi_loopback_target()
519 return -EINVAL; in cdns_set_pdi_loopback_target()
524 cdns->pdi_loopback_target = value; in cdns_set_pdi_loopback_target()
531 * sdw_cdns_debugfs_init() - Cadence debugfs init
537 debugfs_create_file("cdns-registers", 0400, root, cdns, &cdns_reg_fops); in sdw_cdns_debugfs_init()
539 debugfs_create_file("cdns-hw-reset", 0200, root, cdns, in sdw_cdns_debugfs_init()
542 debugfs_create_file("cdns-parity-error-injection", 0200, root, cdns, in sdw_cdns_debugfs_init()
545 cdns->pdi_loopback_source = -1; in sdw_cdns_debugfs_init()
546 cdns->pdi_loopback_target = -1; in sdw_cdns_debugfs_init()
548 debugfs_create_file("cdns-pdi-loopback-source", 0200, root, cdns, in sdw_cdns_debugfs_init()
551 debugfs_create_file("cdns-pdi-loopback-target", 0200, root, cdns, in sdw_cdns_debugfs_init()
571 if (!(cdns->response_buf[i] & CDNS_MCP_RESP_ACK)) { in cdns_fill_msg_resp()
573 dev_vdbg(cdns->dev, "Msg Ack not received, cmd %d\n", i); in cdns_fill_msg_resp()
575 if (cdns->response_buf[i] & CDNS_MCP_RESP_NACK) { in cdns_fill_msg_resp()
577 dev_err_ratelimited(cdns->dev, "Msg NACK received, cmd %d\n", i); in cdns_fill_msg_resp()
582 dev_err_ratelimited(cdns->dev, "Msg NACKed for Slave %d\n", msg->dev_num); in cdns_fill_msg_resp()
587 dev_dbg_ratelimited(cdns->dev, "Msg ignored for Slave %d\n", msg->dev_num); in cdns_fill_msg_resp()
591 if (msg->flags == SDW_MSG_FLAG_READ) { in cdns_fill_msg_resp()
594 msg->buf[i + offset] = FIELD_GET(CDNS_MCP_RESP_RDATA, in cdns_fill_msg_resp()
595 cdns->response_buf[i]); in cdns_fill_msg_resp()
607 BUILD_BUG_ON(ARRAY_SIZE(cdns->response_buf) < CDNS_MCP_CMD_LEN + 2); in cdns_read_response()
611 if (num_resp > ARRAY_SIZE(cdns->response_buf)) { in cdns_read_response()
612 dev_warn(cdns->dev, "RX AVAIL %d too long\n", num_resp); in cdns_read_response()
613 num_resp = ARRAY_SIZE(cdns->response_buf); in cdns_read_response()
619 cdns->response_buf[i] = cdns_ip_readl(cdns, cmd_base); in cdns_read_response()
633 if (cdns->msg_count != count) { in _cdns_xfer_msg()
635 cdns->msg_count = count; in _cdns_xfer_msg()
639 addr = msg->addr + offset; in _cdns_xfer_msg()
642 data = FIELD_PREP(CDNS_MCP_CMD_DEV_ADDR, msg->dev_num); in _cdns_xfer_msg()
647 if (msg->flags == SDW_MSG_FLAG_WRITE) in _cdns_xfer_msg()
648 data |= msg->buf[i + offset]; in _cdns_xfer_msg()
650 data |= FIELD_PREP(CDNS_MCP_CMD_SSP_TAG, msg->ssp_sync); in _cdns_xfer_msg()
659 time = wait_for_completion_timeout(&cdns->tx_complete, in _cdns_xfer_msg()
662 dev_err(cdns->dev, "IO transfer timed out, cmd %d device %d addr %x len %d\n", in _cdns_xfer_msg()
663 cmd, msg->dev_num, msg->addr, msg->len); in _cdns_xfer_msg()
664 msg->len = 0; in _cdns_xfer_msg()
684 if (cdns->msg_count != CDNS_SCP_RX_FIFOLEVEL) { in cdns_program_scp_addr()
686 cdns->msg_count = CDNS_SCP_RX_FIFOLEVEL; in cdns_program_scp_addr()
689 data[0] = FIELD_PREP(CDNS_MCP_CMD_DEV_ADDR, msg->dev_num); in cdns_program_scp_addr()
696 data[0] |= msg->addr_page1; in cdns_program_scp_addr()
697 data[1] |= msg->addr_page2; in cdns_program_scp_addr()
704 time = wait_for_completion_timeout(&cdns->tx_complete, in cdns_program_scp_addr()
707 dev_err(cdns->dev, "SCP Msg trf timed out\n"); in cdns_program_scp_addr()
708 msg->len = 0; in cdns_program_scp_addr()
714 if (!(cdns->response_buf[i] & CDNS_MCP_RESP_ACK)) { in cdns_program_scp_addr()
716 dev_err(cdns->dev, "Program SCP Ack not received\n"); in cdns_program_scp_addr()
717 if (cdns->response_buf[i] & CDNS_MCP_RESP_NACK) { in cdns_program_scp_addr()
719 dev_err(cdns->dev, "Program SCP NACK received\n"); in cdns_program_scp_addr()
726 dev_err_ratelimited(cdns->dev, in cdns_program_scp_addr()
727 "SCP_addrpage NACKed for Slave %d\n", msg->dev_num); in cdns_program_scp_addr()
732 dev_dbg_ratelimited(cdns->dev, in cdns_program_scp_addr()
733 "SCP_addrpage ignored for Slave %d\n", msg->dev_num); in cdns_program_scp_addr()
744 if (msg->page) { in cdns_prep_msg()
747 msg->len = 0; in cdns_prep_msg()
752 switch (msg->flags) { in cdns_prep_msg()
762 dev_err(cdns->dev, "Invalid msg cmd: %d\n", msg->flags); in cdns_prep_msg()
763 return -EINVAL; in cdns_prep_msg()
779 for (i = 0; i < msg->len / CDNS_MCP_CMD_LEN; i++) { in cdns_xfer_msg()
786 if (!(msg->len % CDNS_MCP_CMD_LEN)) in cdns_xfer_msg()
790 msg->len % CDNS_MCP_CMD_LEN, false); in cdns_xfer_msg()
798 struct sdw_defer *defer = &bus->defer_msg; in cdns_xfer_msg_defer()
799 struct sdw_msg *msg = defer->msg; in cdns_xfer_msg_defer()
803 if (msg->len > 1) in cdns_xfer_msg_defer()
804 return -ENOTSUPP; in cdns_xfer_msg_defer()
810 return _cdns_xfer_msg(cdns, msg, cmd, 0, msg->len, true); in cdns_xfer_msg_defer()
896 mutex_lock(&cdns->status_update_lock); in cdns_update_slave_status()
897 ret = sdw_handle_slave_status(&cdns->bus, status); in cdns_update_slave_status()
898 mutex_unlock(&cdns->status_update_lock); in cdns_update_slave_status()
906 * sdw_cdns_irq() - Cadence interrupt handler
916 if (!cdns->link_up) in sdw_cdns_irq()
929 struct sdw_bus *bus = &cdns->bus; in sdw_cdns_irq()
930 struct sdw_defer *defer = &bus->defer_msg; in sdw_cdns_irq()
934 if (defer && defer->msg) { in sdw_cdns_irq()
935 cdns_fill_msg_resp(cdns, defer->msg, in sdw_cdns_irq()
936 defer->length, 0); in sdw_cdns_irq()
937 complete(&defer->complete); in sdw_cdns_irq()
939 complete(&cdns->tx_complete); in sdw_cdns_irq()
945 dev_err_ratelimited(cdns->dev, "Parity error\n"); in sdw_cdns_irq()
950 dev_err_ratelimited(cdns->dev, "Bus clash for control word\n"); in sdw_cdns_irq()
958 dev_err_ratelimited(cdns->dev, "Bus clash for data word\n"); in sdw_cdns_irq()
961 if (cdns->bus.params.m_data_mode != SDW_PORT_DATA_MODE_NORMAL && in sdw_cdns_irq()
965 /* just log which ports report an error */ in sdw_cdns_irq()
967 dev_err_ratelimited(cdns->dev, "DP interrupt: PortIntStat %8x\n", in sdw_cdns_irq()
988 if (cdns->interrupt_enabled) in sdw_cdns_irq()
989 schedule_work(&cdns->work); in sdw_cdns_irq()
1011 dev_dbg(cdns->dev, "Peripheral %d status: %d\n", i, status[i]); in cdns_check_attached_status_dwork()
1015 mutex_lock(&cdns->status_update_lock); in cdns_check_attached_status_dwork()
1016 ret = sdw_handle_slave_status(&cdns->bus, status); in cdns_check_attached_status_dwork()
1017 mutex_unlock(&cdns->status_update_lock); in cdns_check_attached_status_dwork()
1019 dev_err(cdns->dev, "%s: sdw_handle_slave_status failed: %d\n", __func__, ret); in cdns_check_attached_status_dwork()
1023 * cdns_update_slave_status_work - update slave status in a work since we will need to handle
1048 * bits that re-assert. in cdns_update_slave_status_work()
1056 dev_dbg_ratelimited(cdns->dev, "Slave status change: 0x%llx\n", slave_intstat); in cdns_update_slave_status_work()
1069 * the deviceB never being detected - until a change of status in cdns_update_slave_status_work()
1072 * To avoid this race condition, re-check if any device0 needs in cdns_update_slave_status_work()
1074 * ALERTS since they are not allowed until a non-zero in cdns_update_slave_status_work()
1078 * #0 there could be status changes on other devices - these must in cdns_update_slave_status_work()
1088 dev_dbg_ratelimited(cdns->dev, in cdns_update_slave_status_work()
1094 dev_err_ratelimited(cdns->dev, in cdns_update_slave_status_work()
1106 /* paranoia check to make sure self-cleared bits are indeed cleared */
1122 dev_err(cdns->dev, "%s failed: IP_MCP_CONTROL_SW_RST is not cleared\n", string); in sdw_cdns_check_self_clearing_bits()
1128 dev_err(cdns->dev, "%s failed: MCP_CONTROL_CMD_RST is not cleared\n", string); in sdw_cdns_check_self_clearing_bits()
1130 dev_err(cdns->dev, "%s failed: MCP_CONTROL_SOFT_RST is not cleared\n", string); in sdw_cdns_check_self_clearing_bits()
1132 dev_err(cdns->dev, "%s failed: MCP_CONTROL_CLK_STOP_CLR is not cleared\n", string); in sdw_cdns_check_self_clearing_bits()
1136 dev_err(cdns->dev, "%s failed: MCP_CONFIG_UPDATE_BIT is not cleared\n", string); in sdw_cdns_check_self_clearing_bits()
1141 dev_err(cdns->dev, "%s failed: MCP_CONTROL_HW_RST is not cleared\n", string); in sdw_cdns_check_self_clearing_bits()
1145 dev_dbg(cdns->dev, "%s: MCP_CONTROL_HW_RST is not cleared at iteration %d\n", string, i); in sdw_cdns_check_self_clearing_bits()
1160 * sdw_cdns_exit_reset() - Program reset parameters and start bus operations
1178 * cdns_enable_slave_interrupts() - Enable SDW slave interrupts
1196 * sdw_cdns_enable_interrupt() - Enable SDW interrupts
1220 if (cdns->bus.params.m_data_mode != SDW_PORT_DATA_MODE_NORMAL) in sdw_cdns_enable_interrupt()
1245 cdns->interrupt_enabled = state; in sdw_cdns_enable_interrupt()
1248 * Complete any on-going status updates before updating masks, in sdw_cdns_enable_interrupt()
1257 cancel_work_sync(&cdns->work); in sdw_cdns_enable_interrupt()
1277 pdi = devm_kcalloc(cdns->dev, num, sizeof(*pdi), GFP_KERNEL); in cdns_allocate_pdi()
1279 return -ENOMEM; in cdns_allocate_pdi()
1290 * sdw_cdns_pdi_init() - PDI initialization routine
1301 cdns->pcm.num_bd = config.pcm_bd; in sdw_cdns_pdi_init()
1302 cdns->pcm.num_in = config.pcm_in; in sdw_cdns_pdi_init()
1303 cdns->pcm.num_out = config.pcm_out; in sdw_cdns_pdi_init()
1306 stream = &cdns->pcm; in sdw_cdns_pdi_init()
1309 ret = cdns_allocate_pdi(cdns, &stream->bd, stream->num_bd); in sdw_cdns_pdi_init()
1313 ret = cdns_allocate_pdi(cdns, &stream->in, stream->num_in); in sdw_cdns_pdi_init()
1317 ret = cdns_allocate_pdi(cdns, &stream->out, stream->num_out); in sdw_cdns_pdi_init()
1322 stream->num_pdi = stream->num_bd + stream->num_in + stream->num_out; in sdw_cdns_pdi_init()
1323 cdns->num_ports = stream->num_pdi; in sdw_cdns_pdi_init()
1346 struct sdw_bus *bus = &cdns->bus; in cdns_init_clock_ctrl()
1347 struct sdw_master_prop *prop = &bus->prop; in cdns_init_clock_ctrl()
1352 dev_dbg(cdns->dev, "mclk %d max %d row %d col %d\n", in cdns_init_clock_ctrl()
1353 prop->mclk_freq, in cdns_init_clock_ctrl()
1354 prop->max_clk_freq, in cdns_init_clock_ctrl()
1355 prop->default_row, in cdns_init_clock_ctrl()
1356 prop->default_col); in cdns_init_clock_ctrl()
1359 divider = (prop->mclk_freq / prop->max_clk_freq) - 1; in cdns_init_clock_ctrl()
1370 val = cdns_set_initial_frame_shape(prop->default_row, in cdns_init_clock_ctrl()
1371 prop->default_col); in cdns_init_clock_ctrl()
1375 ssp_interval = prop->default_frame_rate / SDW_CADENCE_GSYNC_HZ; in cdns_init_clock_ctrl()
1381 * sdw_cdns_init() - Cadence initialization
1393 cdns->msg_count = cdns_readl(cdns, CDNS_MCP_FIFOLEVEL); in sdw_cdns_init()
1424 if (cdns->bus.multi_link) in sdw_cdns_init()
1425 /* Set Multi-master mode to take gsync into account */ in sdw_cdns_init()
1441 struct sdw_master_prop *prop = &bus->prop; in cdns_bus_conf()
1446 if (!params->curr_dr_freq) { in cdns_bus_conf()
1447 dev_err(cdns->dev, "NULL curr_dr_freq\n"); in cdns_bus_conf()
1448 return -EINVAL; in cdns_bus_conf()
1451 divider = prop->mclk_freq * SDW_DOUBLE_RATE_FACTOR / in cdns_bus_conf()
1452 params->curr_dr_freq; in cdns_bus_conf()
1453 divider--; /* divider is 1/(N+1) */ in cdns_bus_conf()
1455 if (params->next_bank) in cdns_bus_conf()
1472 int target_num = p_params->num; in cdns_port_params()
1473 int source_num = p_params->num; in cdns_port_params()
1477 if (target_num == cdns->pdi_loopback_target && in cdns_port_params()
1478 cdns->pdi_loopback_source != -1) { in cdns_port_params()
1479 source_num = cdns->pdi_loopback_source; in cdns_port_params()
1495 u32p_replace_bits(&dpn_config, p_params->bps - 1, CDNS_DPN_CONFIG_WL); in cdns_port_params()
1496 u32p_replace_bits(&dpn_config, p_params->flow_mode, CDNS_DPN_CONFIG_PORT_FLOW); in cdns_port_params()
1497 u32p_replace_bits(&dpn_config, p_params->data_mode, CDNS_DPN_CONFIG_PORT_DAT); in cdns_port_params()
1522 int source_num = t_params->port_num; in cdns_transport_params()
1523 int target_num = t_params->port_num; in cdns_transport_params()
1526 if (target_num == cdns->pdi_loopback_target && in cdns_transport_params()
1527 cdns->pdi_loopback_source != -1) { in cdns_transport_params()
1528 source_num = cdns->pdi_loopback_source; in cdns_transport_params()
1534 * both PCM and PDM ports. in cdns_transport_params()
1562 u32p_replace_bits(&dpn_config, t_params->blk_grp_ctrl, CDNS_DPN_CONFIG_BGC); in cdns_transport_params()
1563 u32p_replace_bits(&dpn_config, t_params->blk_pkg_mode, CDNS_DPN_CONFIG_BPM); in cdns_transport_params()
1569 u32p_replace_bits(&dpn_offsetctrl, t_params->offset1, CDNS_DPN_OFFSET_CTRL_1); in cdns_transport_params()
1570 u32p_replace_bits(&dpn_offsetctrl, t_params->offset2, CDNS_DPN_OFFSET_CTRL_2); in cdns_transport_params()
1578 u32p_replace_bits(&dpn_hctrl, t_params->hstart, CDNS_DPN_HCTRL_HSTART); in cdns_transport_params()
1579 u32p_replace_bits(&dpn_hctrl, t_params->hstop, CDNS_DPN_HCTRL_HSTOP); in cdns_transport_params()
1580 u32p_replace_bits(&dpn_hctrl, t_params->lane_ctrl, CDNS_DPN_HCTRL_LCTRL); in cdns_transport_params()
1587 dpn_samplectrl = t_params->sample_interval - 1; in cdns_transport_params()
1602 dpn_chnen_off = CDNS_DPN_B1_CH_EN(enable_ch->port_num); in cdns_port_enable()
1604 dpn_chnen_off = CDNS_DPN_B0_CH_EN(enable_ch->port_num); in cdns_port_enable()
1606 ch_mask = enable_ch->ch_mask * enable_ch->enable; in cdns_port_enable()
1645 dev_dbg(cdns->dev, "Clock is already stopped\n"); in sdw_cdns_clock_stop()
1658 * master into a state in which it ignores wake-up trials in sdw_cdns_clock_stop()
1666 list_for_each_entry(slave, &cdns->bus.slaves, node) { in sdw_cdns_clock_stop()
1667 if (slave->status == SDW_SLAVE_ATTACHED || in sdw_cdns_clock_stop()
1668 slave->status == SDW_SLAVE_ALERT) { in sdw_cdns_clock_stop()
1677 dev_err(cdns->dev, "%s: config_update failed\n", __func__); in sdw_cdns_clock_stop()
1683 ret = sdw_bus_prep_clk_stop(&cdns->bus); in sdw_cdns_clock_stop()
1684 if (ret < 0 && ret != -ENODATA) { in sdw_cdns_clock_stop()
1685 dev_err(cdns->dev, "prepare clock stop failed %d\n", ret); in sdw_cdns_clock_stop()
1694 ret = sdw_bus_clk_stop(&cdns->bus); in sdw_cdns_clock_stop()
1695 if (ret < 0 && slave_present && ret != -ENODATA) { in sdw_cdns_clock_stop()
1696 dev_err(cdns->dev, "bus clock stop failed %d\n", ret); in sdw_cdns_clock_stop()
1704 dev_err(cdns->dev, "Clock stop failed %d\n", ret); in sdw_cdns_clock_stop()
1715 * may require a Severe Reset and re-enumeration after a wake.
1727 dev_err(cdns->dev, "Couldn't exit from clock stop\n"); in sdw_cdns_clock_restart()
1733 dev_err(cdns->dev, "clock stop exit failed %d\n", ret); in sdw_cdns_clock_restart()
1752 dev_err(cdns->dev, "%s: config_update failed\n", __func__); in sdw_cdns_clock_restart()
1756 ret = sdw_bus_exit_clk_stop(&cdns->bus); in sdw_cdns_clock_restart()
1758 dev_err(cdns->dev, "bus failed to exit clock stop %d\n", ret); in sdw_cdns_clock_restart()
1766 * sdw_cdns_probe() - Cadence probe routine
1771 init_completion(&cdns->tx_complete); in sdw_cdns_probe()
1772 cdns->bus.port_ops = &cdns_port_ops; in sdw_cdns_probe()
1774 mutex_init(&cdns->status_update_lock); in sdw_cdns_probe()
1776 INIT_WORK(&cdns->work, cdns_update_slave_status_work); in sdw_cdns_probe()
1777 INIT_DELAYED_WORK(&cdns->attach_dwork, cdns_check_attached_status_dwork); in sdw_cdns_probe()
1789 dai_runtime = cdns->dai_runtime_array[dai->id]; in cdns_set_sdw_stream()
1794 dev_err(dai->dev, in cdns_set_sdw_stream()
1796 dai->name); in cdns_set_sdw_stream()
1797 return -EINVAL; in cdns_set_sdw_stream()
1803 return -ENOMEM; in cdns_set_sdw_stream()
1805 dai_runtime->stream_type = SDW_STREAM_PCM; in cdns_set_sdw_stream()
1807 dai_runtime->bus = &cdns->bus; in cdns_set_sdw_stream()
1808 dai_runtime->link_id = cdns->instance; in cdns_set_sdw_stream()
1810 dai_runtime->stream = stream; in cdns_set_sdw_stream()
1811 dai_runtime->direction = direction; in cdns_set_sdw_stream()
1813 cdns->dai_runtime_array[dai->id] = dai_runtime; in cdns_set_sdw_stream()
1817 dev_err(dai->dev, in cdns_set_sdw_stream()
1819 dai->name); in cdns_set_sdw_stream()
1820 return -EINVAL; in cdns_set_sdw_stream()
1825 cdns->dai_runtime_array[dai->id] = NULL; in cdns_set_sdw_stream()
1832 * cdns_find_pdi() - Find a free PDI
1872 if (cdns->bus.params.m_data_mode != SDW_PORT_DATA_MODE_NORMAL) in sdw_cdns_config_stream()
1875 offset = CDNS_PORTCTRL + pdi->num * CDNS_PORT_OFFSET; in sdw_cdns_config_stream()
1880 val = pdi->num; in sdw_cdns_config_stream()
1882 val |= FIELD_PREP(CDNS_PDI_CONFIG_CHANNEL, (1 << ch) - 1); in sdw_cdns_config_stream()
1883 cdns_writel(cdns, CDNS_PDI_CONFIG(pdi->num), val); in sdw_cdns_config_stream()
1888 * sdw_cdns_alloc_pdi() - Allocate a PDI
1903 pdi = cdns_find_pdi(cdns, stream->num_in, stream->in, in sdw_cdns_alloc_pdi()
1906 pdi = cdns_find_pdi(cdns, stream->num_out, stream->out, in sdw_cdns_alloc_pdi()
1909 /* check if we found a PDI, else find in bi-directional */ in sdw_cdns_alloc_pdi()
1911 pdi = cdns_find_pdi(cdns, stream->num_bd, stream->bd, in sdw_cdns_alloc_pdi()
1915 pdi->l_ch_num = 0; in sdw_cdns_alloc_pdi()
1916 pdi->h_ch_num = ch - 1; in sdw_cdns_alloc_pdi()
1917 pdi->dir = dir; in sdw_cdns_alloc_pdi()
1918 pdi->ch_count = ch; in sdw_cdns_alloc_pdi()