Lines Matching refs:sdw
19 #include <linux/soundwire/sdw.h>
199 struct sdw_intel *sdw = s_file->private;
200 void __iomem *s = sdw->link_res->shim;
201 void __iomem *a = sdw->link_res->alh;
267 struct sdw_intel *sdw = data;
268 struct sdw_bus *bus = &sdw->cdns.bus;
285 struct sdw_intel *sdw = data;
286 struct sdw_bus *bus = &sdw->cdns.bus;
301 static void intel_debugfs_init(struct sdw_intel *sdw)
303 struct dentry *root = sdw->cdns.bus.debugfs;
308 sdw->debugfs = debugfs_create_dir("intel-sdw", root);
310 debugfs_create_file("intel-registers", 0400, sdw->debugfs, sdw,
313 debugfs_create_file("intel-m-datamode", 0200, sdw->debugfs, sdw,
316 debugfs_create_file("intel-s-datamode", 0200, sdw->debugfs, sdw,
319 sdw_cdns_debugfs_init(&sdw->cdns, sdw->debugfs);
322 static void intel_debugfs_exit(struct sdw_intel *sdw)
324 debugfs_remove_recursive(sdw->debugfs);
327 static void intel_debugfs_init(struct sdw_intel *sdw) {}
328 static void intel_debugfs_exit(struct sdw_intel *sdw) {}
335 static int intel_link_power_up(struct sdw_intel *sdw)
337 unsigned int link_id = sdw->instance;
338 void __iomem *shim = sdw->link_res->shim;
339 u32 *shim_mask = sdw->link_res->shim_mask;
340 struct sdw_bus *bus = &sdw->cdns.bus;
348 mutex_lock(sdw->link_res->shim_lock);
366 dev_dbg(sdw->cdns.dev, "%s: powering up all links\n", __func__);
369 dev_dbg(sdw->cdns.dev,
384 spa_mask = FIELD_PREP(SDW_SHIM_LCTL_SPA_MASK, sdw->link_res->link_mask);
385 cpa_mask = FIELD_PREP(SDW_SHIM_LCTL_CPA_MASK, sdw->link_res->link_mask);
391 dev_err(sdw->cdns.dev, "Failed to power up link: %d\n", ret);
399 dev_err(sdw->cdns.dev,
407 sdw->cdns.link_up = true;
409 mutex_unlock(sdw->link_res->shim_lock);
415 static void intel_shim_glue_to_master_ip(struct sdw_intel *sdw)
417 void __iomem *shim = sdw->link_res->shim;
418 unsigned int link_id = sdw->instance;
445 static void intel_shim_master_ip_to_glue(struct sdw_intel *sdw)
447 unsigned int link_id = sdw->instance;
448 void __iomem *shim = sdw->link_res->shim;
465 static int intel_shim_init(struct sdw_intel *sdw, bool clock_stop)
467 void __iomem *shim = sdw->link_res->shim;
468 unsigned int link_id = sdw->instance;
472 mutex_lock(sdw->link_res->shim_lock);
491 intel_shim_glue_to_master_ip(sdw);
499 mutex_unlock(sdw->link_res->shim_lock);
504 static void intel_shim_wake(struct sdw_intel *sdw, bool wake_enable)
506 void __iomem *shim = sdw->link_res->shim;
507 unsigned int link_id = sdw->instance;
510 mutex_lock(sdw->link_res->shim_lock);
527 mutex_unlock(sdw->link_res->shim_lock);
530 static int intel_link_power_down(struct sdw_intel *sdw)
533 unsigned int link_id = sdw->instance;
534 void __iomem *shim = sdw->link_res->shim;
535 u32 *shim_mask = sdw->link_res->shim_mask;
538 mutex_lock(sdw->link_res->shim_lock);
541 dev_err(sdw->cdns.dev,
544 sdw->cdns.link_up = false;
546 intel_shim_master_ip_to_glue(sdw);
552 dev_dbg(sdw->cdns.dev, "%s: powering down all links\n", __func__);
558 spa_mask = FIELD_PREP(SDW_SHIM_LCTL_SPA_MASK, ~sdw->link_res->link_mask);
559 cpa_mask = FIELD_PREP(SDW_SHIM_LCTL_CPA_MASK, sdw->link_res->link_mask);
565 dev_err(sdw->cdns.dev, "%s: could not power down link\n", __func__);
568 * we leave the sdw->cdns.link_up flag as false since we've disabled
576 mutex_unlock(sdw->link_res->shim_lock);
581 static void intel_shim_sync_arm(struct sdw_intel *sdw)
583 void __iomem *shim = sdw->link_res->shim;
586 mutex_lock(sdw->link_res->shim_lock);
590 sync_reg |= (SDW_SHIM_SYNC_CMDSYNC << sdw->instance);
593 mutex_unlock(sdw->link_res->shim_lock);
596 static int intel_shim_sync_go_unlocked(struct sdw_intel *sdw)
598 void __iomem *shim = sdw->link_res->shim;
616 dev_err(sdw->cdns.dev, "SyncGO clear failed: %d\n", ret);
621 static int intel_shim_sync_go(struct sdw_intel *sdw)
625 mutex_lock(sdw->link_res->shim_lock);
627 ret = intel_shim_sync_go_unlocked(sdw);
629 mutex_unlock(sdw->link_res->shim_lock);
637 static void intel_pdi_init(struct sdw_intel *sdw,
640 void __iomem *shim = sdw->link_res->shim;
641 unsigned int link_id = sdw->instance;
651 dev_dbg(sdw->cdns.dev, "PCM cap bd:%d in:%d out:%d\n",
661 dev_dbg(sdw->cdns.dev, "PDM cap bd:%d in:%d out:%d\n",
666 intel_pdi_get_ch_cap(struct sdw_intel *sdw, unsigned int pdi_num, bool pcm)
668 void __iomem *shim = sdw->link_res->shim;
669 unsigned int link_id = sdw->instance;
695 static int intel_pdi_get_ch_update(struct sdw_intel *sdw,
703 pdi->ch_count = intel_pdi_get_ch_cap(sdw, pdi->num, pcm);
712 static int intel_pdi_stream_ch_update(struct sdw_intel *sdw,
715 intel_pdi_get_ch_update(sdw, stream->bd, stream->num_bd,
718 intel_pdi_get_ch_update(sdw, stream->in, stream->num_in,
721 intel_pdi_get_ch_update(sdw, stream->out, stream->num_out,
727 static int intel_pdi_ch_update(struct sdw_intel *sdw)
730 intel_pdi_stream_ch_update(sdw, &sdw->cdns.pcm, true);
731 intel_pdi_stream_ch_update(sdw, &sdw->cdns.pdm, false);
737 intel_pdi_shim_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi)
739 void __iomem *shim = sdw->link_res->shim;
740 unsigned int link_id = sdw->instance;
768 intel_pdi_alh_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi)
770 void __iomem *alh = sdw->link_res->alh;
771 unsigned int link_id = sdw->instance;
788 static int intel_params_stream(struct sdw_intel *sdw,
794 struct sdw_intel_link_res *res = sdw->link_res;
809 static int intel_free_stream(struct sdw_intel *sdw,
814 struct sdw_intel_link_res *res = sdw->link_res;
835 struct sdw_intel *sdw = cdns_to_intel(cdns);
841 intel_shim_sync_arm(sdw);
849 struct sdw_intel *sdw = cdns_to_intel(cdns);
850 void __iomem *shim = sdw->link_res->shim;
857 mutex_lock(sdw->link_res->shim_lock);
875 ret = intel_shim_sync_go_unlocked(sdw);
877 mutex_unlock(sdw->link_res->shim_lock);
880 dev_err(sdw->cdns.dev, "Post bank switch failed: %d\n", ret);
911 struct sdw_intel *sdw = cdns_to_intel(cdns);
944 intel_pdi_shim_configure(sdw, pdi);
945 intel_pdi_alh_configure(sdw, pdi);
954 ret = intel_params_stream(sdw, substream, dai, params,
955 sdw->instance,
996 struct sdw_intel *sdw = cdns_to_intel(cdns);
1026 intel_pdi_shim_configure(sdw, dma->pdi);
1027 intel_pdi_alh_configure(sdw, dma->pdi);
1031 ret = intel_params_stream(sdw, substream, dai,
1033 sdw->instance,
1044 struct sdw_intel *sdw = cdns_to_intel(cdns);
1053 * The sdw stream state will transition to RELEASED when stream->
1065 ret = intel_free_stream(sdw, substream, dai, sdw->instance);
1203 static int intel_register_dai(struct sdw_intel *sdw)
1205 struct sdw_cdns *cdns = &sdw->cdns;
1270 "mipi-sdw-link-%d-subproperties", bus->link_id);
1279 "intel-sdw-ip-clock",
1316 static int intel_init(struct sdw_intel *sdw)
1321 intel_link_power_up(sdw);
1323 clock_stop = sdw_cdns_is_clock_stop(&sdw->cdns);
1325 intel_shim_init(sdw, clock_stop);
1336 struct sdw_intel *sdw;
1341 sdw = devm_kzalloc(dev, sizeof(*sdw), GFP_KERNEL);
1342 if (!sdw)
1345 cdns = &sdw->cdns;
1348 sdw->instance = pdev->id;
1349 sdw->link_res = dev_get_platdata(dev);
1351 cdns->registers = sdw->link_res->registers;
1352 cdns->instance = sdw->instance;
1367 sdw->cdns.bus.compute_params = sdw_compute_params;
1393 struct sdw_intel *sdw = cdns_to_intel(cdns);
1403 sdw->instance);
1424 ret = intel_init(sdw);
1429 intel_pdi_init(sdw, &config);
1434 intel_pdi_ch_update(sdw);
1447 intel_shim_sync_arm(sdw);
1462 ret = intel_shim_sync_go(sdw);
1470 ret = intel_register_dai(sdw);
1476 intel_debugfs_init(sdw);
1489 clock_stop_quirks = sdw->link_res->clock_stop_quirks;
1531 struct sdw_intel *sdw = cdns_to_intel(cdns);
1540 intel_debugfs_exit(sdw);
1552 struct sdw_intel *sdw;
1557 sdw = platform_get_drvdata(pdev);
1558 bus = &sdw->cdns.bus;
1565 shim = sdw->link_res->shim;
1568 if (!(wake_sts & BIT(sdw->instance)))
1572 intel_shim_wake(sdw, false);
1595 struct sdw_intel *sdw = cdns_to_intel(cdns);
1609 clock_stop_quirks = sdw->link_res->clock_stop_quirks;
1623 intel_shim_wake(sdw, false);
1635 ret = intel_link_power_down(sdw);
1641 intel_shim_wake(sdw, false);
1649 struct sdw_intel *sdw = cdns_to_intel(cdns);
1660 clock_stop_quirks = sdw->link_res->clock_stop_quirks;
1670 ret = intel_link_power_down(sdw);
1676 intel_shim_wake(sdw, false);
1692 ret = intel_link_power_down(sdw);
1698 intel_shim_wake(sdw, true);
1711 struct sdw_intel *sdw = cdns_to_intel(cdns);
1741 ret = intel_init(sdw);
1764 intel_shim_sync_arm(sdw);
1766 ret = sdw_cdns_init(&sdw->cdns);
1779 ret = intel_shim_sync_go(sdw);
1804 struct sdw_intel *sdw = cdns_to_intel(cdns);
1822 clock_stop_quirks = sdw->link_res->clock_stop_quirks;
1825 ret = intel_init(sdw);
1848 intel_shim_sync_arm(sdw);
1850 ret = sdw_cdns_init(&sdw->cdns);
1863 ret = intel_shim_sync_go(sdw);
1870 ret = intel_init(sdw);
1883 clock_stop0 = sdw_cdns_is_clock_stop(&sdw->cdns);
1906 intel_shim_sync_arm(sdw);
1911 sdw_cdns_init(&sdw->cdns);
1935 ret = intel_shim_sync_go(sdw);
1937 dev_err(sdw->cdns.dev, "sync go failed during resume\n");
1944 clock_stop0 = sdw_cdns_is_clock_stop(&sdw->cdns);
1948 ret = intel_init(sdw);
1985 .name = "intel-sdw",
1993 MODULE_ALIAS("platform:intel-sdw");