Lines Matching refs:sdw
126 struct sdw_intel *sdw = s_file->private; in intel_reg_show() local
127 void __iomem *s = sdw->link_res->shim; in intel_reg_show()
128 void __iomem *a = sdw->link_res->alh; in intel_reg_show()
194 struct sdw_intel *sdw = data; in intel_set_m_datamode() local
195 struct sdw_bus *bus = &sdw->cdns.bus; in intel_set_m_datamode()
212 struct sdw_intel *sdw = data; in intel_set_s_datamode() local
213 struct sdw_bus *bus = &sdw->cdns.bus; in intel_set_s_datamode()
228 static void intel_debugfs_init(struct sdw_intel *sdw) in intel_debugfs_init() argument
230 struct dentry *root = sdw->cdns.bus.debugfs; in intel_debugfs_init()
235 sdw->debugfs = debugfs_create_dir("intel-sdw", root); in intel_debugfs_init()
237 debugfs_create_file("intel-registers", 0400, sdw->debugfs, sdw, in intel_debugfs_init()
240 debugfs_create_file("intel-m-datamode", 0200, sdw->debugfs, sdw, in intel_debugfs_init()
243 debugfs_create_file("intel-s-datamode", 0200, sdw->debugfs, sdw, in intel_debugfs_init()
246 sdw_cdns_debugfs_init(&sdw->cdns, sdw->debugfs); in intel_debugfs_init()
249 static void intel_debugfs_exit(struct sdw_intel *sdw) in intel_debugfs_exit() argument
251 debugfs_remove_recursive(sdw->debugfs); in intel_debugfs_exit()
254 static void intel_debugfs_init(struct sdw_intel *sdw) {} in intel_debugfs_init() argument
255 static void intel_debugfs_exit(struct sdw_intel *sdw) {} in intel_debugfs_exit() argument
262 static int intel_link_power_up(struct sdw_intel *sdw) in intel_link_power_up() argument
264 unsigned int link_id = sdw->instance; in intel_link_power_up()
265 void __iomem *shim = sdw->link_res->shim; in intel_link_power_up()
266 u32 *shim_mask = sdw->link_res->shim_mask; in intel_link_power_up()
267 struct sdw_bus *bus = &sdw->cdns.bus; in intel_link_power_up()
275 mutex_lock(sdw->link_res->shim_lock); in intel_link_power_up()
293 dev_dbg(sdw->cdns.dev, "%s: powering up all links\n", __func__); in intel_link_power_up()
296 dev_dbg(sdw->cdns.dev, in intel_link_power_up()
311 spa_mask = FIELD_PREP(SDW_SHIM_LCTL_SPA_MASK, sdw->link_res->link_mask); in intel_link_power_up()
312 cpa_mask = FIELD_PREP(SDW_SHIM_LCTL_CPA_MASK, sdw->link_res->link_mask); in intel_link_power_up()
318 dev_err(sdw->cdns.dev, "Failed to power up link: %d\n", ret); in intel_link_power_up()
326 dev_err(sdw->cdns.dev, in intel_link_power_up()
334 sdw->cdns.link_up = true; in intel_link_power_up()
336 mutex_unlock(sdw->link_res->shim_lock); in intel_link_power_up()
342 static void intel_shim_glue_to_master_ip(struct sdw_intel *sdw) in intel_shim_glue_to_master_ip() argument
344 void __iomem *shim = sdw->link_res->shim; in intel_shim_glue_to_master_ip()
345 unsigned int link_id = sdw->instance; in intel_shim_glue_to_master_ip()
372 static void intel_shim_master_ip_to_glue(struct sdw_intel *sdw) in intel_shim_master_ip_to_glue() argument
374 unsigned int link_id = sdw->instance; in intel_shim_master_ip_to_glue()
375 void __iomem *shim = sdw->link_res->shim; in intel_shim_master_ip_to_glue()
392 static int intel_shim_init(struct sdw_intel *sdw, bool clock_stop) in intel_shim_init() argument
394 void __iomem *shim = sdw->link_res->shim; in intel_shim_init()
395 unsigned int link_id = sdw->instance; in intel_shim_init()
399 mutex_lock(sdw->link_res->shim_lock); in intel_shim_init()
418 intel_shim_glue_to_master_ip(sdw); in intel_shim_init()
426 mutex_unlock(sdw->link_res->shim_lock); in intel_shim_init()
431 static void intel_shim_wake(struct sdw_intel *sdw, bool wake_enable) in intel_shim_wake() argument
433 void __iomem *shim = sdw->link_res->shim; in intel_shim_wake()
434 unsigned int link_id = sdw->instance; in intel_shim_wake()
437 mutex_lock(sdw->link_res->shim_lock); in intel_shim_wake()
454 mutex_unlock(sdw->link_res->shim_lock); in intel_shim_wake()
457 static int intel_link_power_down(struct sdw_intel *sdw) in intel_link_power_down() argument
460 unsigned int link_id = sdw->instance; in intel_link_power_down()
461 void __iomem *shim = sdw->link_res->shim; in intel_link_power_down()
462 u32 *shim_mask = sdw->link_res->shim_mask; in intel_link_power_down()
465 mutex_lock(sdw->link_res->shim_lock); in intel_link_power_down()
468 dev_err(sdw->cdns.dev, in intel_link_power_down()
471 sdw->cdns.link_up = false; in intel_link_power_down()
473 intel_shim_master_ip_to_glue(sdw); in intel_link_power_down()
479 dev_dbg(sdw->cdns.dev, "%s: powering down all links\n", __func__); in intel_link_power_down()
485 spa_mask = FIELD_PREP(SDW_SHIM_LCTL_SPA_MASK, ~sdw->link_res->link_mask); in intel_link_power_down()
486 cpa_mask = FIELD_PREP(SDW_SHIM_LCTL_CPA_MASK, sdw->link_res->link_mask); in intel_link_power_down()
492 dev_err(sdw->cdns.dev, "%s: could not power down link\n", __func__); in intel_link_power_down()
501 mutex_unlock(sdw->link_res->shim_lock); in intel_link_power_down()
506 static void intel_shim_sync_arm(struct sdw_intel *sdw) in intel_shim_sync_arm() argument
508 void __iomem *shim = sdw->link_res->shim; in intel_shim_sync_arm()
511 mutex_lock(sdw->link_res->shim_lock); in intel_shim_sync_arm()
515 sync_reg |= (SDW_SHIM_SYNC_CMDSYNC << sdw->instance); in intel_shim_sync_arm()
518 mutex_unlock(sdw->link_res->shim_lock); in intel_shim_sync_arm()
521 static int intel_shim_sync_go_unlocked(struct sdw_intel *sdw) in intel_shim_sync_go_unlocked() argument
523 void __iomem *shim = sdw->link_res->shim; in intel_shim_sync_go_unlocked()
541 dev_err(sdw->cdns.dev, "SyncGO clear failed: %d\n", ret); in intel_shim_sync_go_unlocked()
546 static int intel_shim_sync_go(struct sdw_intel *sdw) in intel_shim_sync_go() argument
550 mutex_lock(sdw->link_res->shim_lock); in intel_shim_sync_go()
552 ret = intel_shim_sync_go_unlocked(sdw); in intel_shim_sync_go()
554 mutex_unlock(sdw->link_res->shim_lock); in intel_shim_sync_go()
562 static void intel_pdi_init(struct sdw_intel *sdw, in intel_pdi_init() argument
565 void __iomem *shim = sdw->link_res->shim; in intel_pdi_init()
566 unsigned int link_id = sdw->instance; in intel_pdi_init()
576 dev_dbg(sdw->cdns.dev, "PCM cap bd:%d in:%d out:%d\n", in intel_pdi_init()
586 dev_dbg(sdw->cdns.dev, "PDM cap bd:%d in:%d out:%d\n", in intel_pdi_init()
591 intel_pdi_get_ch_cap(struct sdw_intel *sdw, unsigned int pdi_num, bool pcm) in intel_pdi_get_ch_cap() argument
593 void __iomem *shim = sdw->link_res->shim; in intel_pdi_get_ch_cap()
594 unsigned int link_id = sdw->instance; in intel_pdi_get_ch_cap()
620 static int intel_pdi_get_ch_update(struct sdw_intel *sdw, in intel_pdi_get_ch_update() argument
628 pdi->ch_count = intel_pdi_get_ch_cap(sdw, pdi->num, pcm); in intel_pdi_get_ch_update()
637 static int intel_pdi_stream_ch_update(struct sdw_intel *sdw, in intel_pdi_stream_ch_update() argument
640 intel_pdi_get_ch_update(sdw, stream->bd, stream->num_bd, in intel_pdi_stream_ch_update()
643 intel_pdi_get_ch_update(sdw, stream->in, stream->num_in, in intel_pdi_stream_ch_update()
646 intel_pdi_get_ch_update(sdw, stream->out, stream->num_out, in intel_pdi_stream_ch_update()
652 static int intel_pdi_ch_update(struct sdw_intel *sdw) in intel_pdi_ch_update() argument
655 intel_pdi_stream_ch_update(sdw, &sdw->cdns.pcm, true); in intel_pdi_ch_update()
656 intel_pdi_stream_ch_update(sdw, &sdw->cdns.pdm, false); in intel_pdi_ch_update()
662 intel_pdi_shim_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi) in intel_pdi_shim_configure() argument
664 void __iomem *shim = sdw->link_res->shim; in intel_pdi_shim_configure()
665 unsigned int link_id = sdw->instance; in intel_pdi_shim_configure()
693 intel_pdi_alh_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi) in intel_pdi_alh_configure() argument
695 void __iomem *alh = sdw->link_res->alh; in intel_pdi_alh_configure()
696 unsigned int link_id = sdw->instance; in intel_pdi_alh_configure()
713 static int intel_params_stream(struct sdw_intel *sdw, in intel_params_stream() argument
719 struct sdw_intel_link_res *res = sdw->link_res; in intel_params_stream()
734 static int intel_free_stream(struct sdw_intel *sdw, in intel_free_stream() argument
739 struct sdw_intel_link_res *res = sdw->link_res; in intel_free_stream()
760 struct sdw_intel *sdw = cdns_to_intel(cdns); in intel_pre_bank_switch() local
766 intel_shim_sync_arm(sdw); in intel_pre_bank_switch()
774 struct sdw_intel *sdw = cdns_to_intel(cdns); in intel_post_bank_switch() local
775 void __iomem *shim = sdw->link_res->shim; in intel_post_bank_switch()
782 mutex_lock(sdw->link_res->shim_lock); in intel_post_bank_switch()
800 ret = intel_shim_sync_go_unlocked(sdw); in intel_post_bank_switch()
802 mutex_unlock(sdw->link_res->shim_lock); in intel_post_bank_switch()
805 dev_err(sdw->cdns.dev, "Post bank switch failed: %d\n", ret); in intel_post_bank_switch()
836 struct sdw_intel *sdw = cdns_to_intel(cdns); in intel_hw_params() local
869 intel_pdi_shim_configure(sdw, pdi); in intel_hw_params()
870 intel_pdi_alh_configure(sdw, pdi); in intel_hw_params()
879 ret = intel_params_stream(sdw, substream, dai, params, in intel_hw_params()
880 sdw->instance, in intel_hw_params()
921 struct sdw_intel *sdw = cdns_to_intel(cdns); in intel_prepare() local
951 intel_pdi_shim_configure(sdw, dma->pdi); in intel_prepare()
952 intel_pdi_alh_configure(sdw, dma->pdi); in intel_prepare()
956 ret = intel_params_stream(sdw, substream, dai, in intel_prepare()
958 sdw->instance, in intel_prepare()
969 struct sdw_intel *sdw = cdns_to_intel(cdns); in intel_hw_free() local
990 ret = intel_free_stream(sdw, substream, dai, sdw->instance); in intel_hw_free()
1128 static int intel_register_dai(struct sdw_intel *sdw) in intel_register_dai() argument
1130 struct sdw_cdns *cdns = &sdw->cdns; in intel_register_dai()
1245 static int intel_init(struct sdw_intel *sdw) in intel_init() argument
1250 intel_link_power_up(sdw); in intel_init()
1252 clock_stop = sdw_cdns_is_clock_stop(&sdw->cdns); in intel_init()
1254 intel_shim_init(sdw, clock_stop); in intel_init()
1268 struct sdw_intel *sdw; in intel_link_probe() local
1273 sdw = devm_kzalloc(dev, sizeof(*sdw), GFP_KERNEL); in intel_link_probe()
1274 if (!sdw) in intel_link_probe()
1277 cdns = &sdw->cdns; in intel_link_probe()
1280 sdw->instance = auxdev->id; in intel_link_probe()
1281 sdw->link_res = &ldev->link_res; in intel_link_probe()
1283 cdns->registers = sdw->link_res->registers; in intel_link_probe()
1284 cdns->instance = sdw->instance; in intel_link_probe()
1299 sdw->cdns.bus.compute_params = sdw_compute_params; in intel_link_probe()
1325 struct sdw_intel *sdw = cdns_to_intel(cdns); in intel_link_startup() local
1335 sdw->instance); in intel_link_startup()
1356 ret = intel_init(sdw); in intel_link_startup()
1361 intel_pdi_init(sdw, &config); in intel_link_startup()
1366 intel_pdi_ch_update(sdw); in intel_link_startup()
1379 intel_shim_sync_arm(sdw); in intel_link_startup()
1394 ret = intel_shim_sync_go(sdw); in intel_link_startup()
1404 ret = intel_register_dai(sdw); in intel_link_startup()
1411 intel_debugfs_init(sdw); in intel_link_startup()
1424 clock_stop_quirks = sdw->link_res->clock_stop_quirks; in intel_link_startup()
1454 sdw->startup_done = true; in intel_link_startup()
1467 struct sdw_intel *sdw = cdns_to_intel(cdns); in intel_link_remove() local
1476 intel_debugfs_exit(sdw); in intel_link_remove()
1486 struct sdw_intel *sdw; in intel_link_process_wakeen_event() local
1491 sdw = dev_get_drvdata(dev); in intel_link_process_wakeen_event()
1492 bus = &sdw->cdns.bus; in intel_link_process_wakeen_event()
1494 if (bus->prop.hw_disabled || !sdw->startup_done) { in intel_link_process_wakeen_event()
1500 shim = sdw->link_res->shim; in intel_link_process_wakeen_event()
1503 if (!(wake_sts & BIT(sdw->instance))) in intel_link_process_wakeen_event()
1507 intel_shim_wake(sdw, false); in intel_link_process_wakeen_event()
1549 struct sdw_intel *sdw = cdns_to_intel(cdns); in intel_pm_prepare() local
1554 if (bus->prop.hw_disabled || !sdw->startup_done) { in intel_pm_prepare()
1560 clock_stop_quirks = sdw->link_res->clock_stop_quirks; in intel_pm_prepare()
1609 struct sdw_intel *sdw = cdns_to_intel(cdns); in intel_suspend() local
1614 if (bus->prop.hw_disabled || !sdw->startup_done) { in intel_suspend()
1623 clock_stop_quirks = sdw->link_res->clock_stop_quirks; in intel_suspend()
1635 intel_shim_wake(sdw, false); in intel_suspend()
1648 ret = intel_link_power_down(sdw); in intel_suspend()
1654 intel_shim_wake(sdw, false); in intel_suspend()
1662 struct sdw_intel *sdw = cdns_to_intel(cdns); in intel_suspend_runtime() local
1667 if (bus->prop.hw_disabled || !sdw->startup_done) { in intel_suspend_runtime()
1673 clock_stop_quirks = sdw->link_res->clock_stop_quirks; in intel_suspend_runtime()
1683 ret = intel_link_power_down(sdw); in intel_suspend_runtime()
1689 intel_shim_wake(sdw, false); in intel_suspend_runtime()
1707 ret = intel_link_power_down(sdw); in intel_suspend_runtime()
1713 intel_shim_wake(sdw, wake_enable); in intel_suspend_runtime()
1726 struct sdw_intel *sdw = cdns_to_intel(cdns); in intel_resume() local
1732 if (bus->prop.hw_disabled || !sdw->startup_done) { in intel_resume()
1756 ret = intel_init(sdw); in intel_resume()
1779 intel_shim_sync_arm(sdw); in intel_resume()
1781 ret = sdw_cdns_init(&sdw->cdns); in intel_resume()
1794 ret = intel_shim_sync_go(sdw); in intel_resume()
1821 struct sdw_intel *sdw = cdns_to_intel(cdns); in intel_resume_runtime() local
1830 if (bus->prop.hw_disabled || !sdw->startup_done) { in intel_resume_runtime()
1839 clock_stop_quirks = sdw->link_res->clock_stop_quirks; in intel_resume_runtime()
1842 ret = intel_init(sdw); in intel_resume_runtime()
1865 intel_shim_sync_arm(sdw); in intel_resume_runtime()
1867 ret = sdw_cdns_init(&sdw->cdns); in intel_resume_runtime()
1880 ret = intel_shim_sync_go(sdw); in intel_resume_runtime()
1890 ret = intel_init(sdw); in intel_resume_runtime()
1903 clock_stop0 = sdw_cdns_is_clock_stop(&sdw->cdns); in intel_resume_runtime()
1926 intel_shim_sync_arm(sdw); in intel_resume_runtime()
1931 sdw_cdns_init(&sdw->cdns); in intel_resume_runtime()
1955 ret = intel_shim_sync_go(sdw); in intel_resume_runtime()
1957 dev_err(sdw->cdns.dev, "sync go failed during resume\n"); in intel_resume_runtime()
1967 clock_stop0 = sdw_cdns_is_clock_stop(&sdw->cdns); in intel_resume_runtime()
1971 ret = intel_init(sdw); in intel_resume_runtime()