• Home
  • Raw
  • Download

Lines Matching +full:dai +full:- +full:links

1 // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
2 // Copyright(c) 2015-17 Intel Corporation.
32 timeout--; in intel_wait_bit()
36 return -EAGAIN; in intel_wait_bit()
68 return scnprintf(buf + pos, RD_BUF - pos, "%4x\t%4x\n", reg, value); in intel_sprintf()
73 struct sdw_intel *sdw = s_file->private; in intel_reg_show()
74 void __iomem *s = sdw->link_res->shim; in intel_reg_show()
75 void __iomem *a = sdw->link_res->alh; in intel_reg_show()
79 unsigned int links, reg; in intel_reg_show() local
83 return -ENOMEM; in intel_reg_show()
85 links = intel_readl(s, SDW_SHIM_LCAP) & SDW_SHIM_LCAP_LCOUNT_MASK; in intel_reg_show()
88 ret += scnprintf(buf + ret, RD_BUF - ret, "\nShim\n"); in intel_reg_show()
90 for (i = 0; i < links; i++) { in intel_reg_show()
95 for (i = 0; i < links; i++) { in intel_reg_show()
96 ret += scnprintf(buf + ret, RD_BUF - ret, "\nLink%d\n", i); in intel_reg_show()
104 ret += scnprintf(buf + ret, RD_BUF - ret, "\n PCMSyCH registers\n"); in intel_reg_show()
108 * cleanup to remove hard-coded Intel configurations in intel_reg_show()
117 ret += scnprintf(buf + ret, RD_BUF - ret, "\n IOCTL, CTMCTL\n"); in intel_reg_show()
123 ret += scnprintf(buf + ret, RD_BUF - ret, "\nWake registers\n"); in intel_reg_show()
127 ret += scnprintf(buf + ret, RD_BUF - ret, "\nALH STRMzCFG\n"); in intel_reg_show()
141 struct sdw_bus *bus = &sdw->cdns.bus; in intel_set_m_datamode()
144 return -EINVAL; in intel_set_m_datamode()
149 bus->params.m_data_mode = value; in intel_set_m_datamode()
159 struct sdw_bus *bus = &sdw->cdns.bus; in intel_set_s_datamode()
162 return -EINVAL; in intel_set_s_datamode()
167 bus->params.s_data_mode = value; in intel_set_s_datamode()
176 struct dentry *root = sdw->cdns.bus.debugfs; in intel_debugfs_init()
181 sdw->debugfs = debugfs_create_dir("intel-sdw", root); in intel_debugfs_init()
183 debugfs_create_file("intel-registers", 0400, sdw->debugfs, sdw, in intel_debugfs_init()
186 debugfs_create_file("intel-m-datamode", 0200, sdw->debugfs, sdw, in intel_debugfs_init()
189 debugfs_create_file("intel-s-datamode", 0200, sdw->debugfs, sdw, in intel_debugfs_init()
192 sdw_cdns_debugfs_init(&sdw->cdns, sdw->debugfs); in intel_debugfs_init()
197 debugfs_remove_recursive(sdw->debugfs); in intel_debugfs_exit()
210 void __iomem *shim = sdw->link_res->shim; in intel_shim_glue_to_master_ip()
211 unsigned int link_id = sdw->instance; in intel_shim_glue_to_master_ip()
240 unsigned int link_id = sdw->instance; in intel_shim_master_ip_to_glue()
241 void __iomem *shim = sdw->link_res->shim; in intel_shim_master_ip_to_glue()
261 void __iomem *shim = sdw->link_res->shim; in intel_shim_init()
262 unsigned int link_id = sdw->instance; in intel_shim_init()
297 shim = sdw->link_res->shim; in intel_shim_check_wake()
300 return wake_sts & BIT(sdw->instance); in intel_shim_check_wake()
305 void __iomem *shim = sdw->link_res->shim; in intel_shim_wake()
306 unsigned int link_id = sdw->instance; in intel_shim_wake()
309 mutex_lock(sdw->link_res->shim_lock); in intel_shim_wake()
326 mutex_unlock(sdw->link_res->shim_lock); in intel_shim_wake()
331 void __iomem *shim = sdw->link_res->shim; in intel_check_cmdsync_unlocked()
340 unsigned int link_id = sdw->instance; in intel_link_power_up()
341 void __iomem *shim = sdw->link_res->shim; in intel_link_power_up()
342 u32 *shim_mask = sdw->link_res->shim_mask; in intel_link_power_up()
343 struct sdw_bus *bus = &sdw->cdns.bus; in intel_link_power_up()
344 struct sdw_master_prop *prop = &bus->prop; in intel_link_power_up()
351 mutex_lock(sdw->link_res->shim_lock); in intel_link_power_up()
355 * to generate the SoundWire SSP - which defines a 'safe' in intel_link_power_up()
363 if (prop->mclk_freq % 6000000) in intel_link_power_up()
369 dev_dbg(sdw->cdns.dev, "powering up all links\n"); in intel_link_power_up()
372 dev_dbg(sdw->cdns.dev, in intel_link_power_up()
386 /* only power-up enabled links */ in intel_link_power_up()
387 spa_mask = FIELD_PREP(SDW_SHIM_LCTL_SPA_MASK, sdw->link_res->link_mask); in intel_link_power_up()
388 cpa_mask = FIELD_PREP(SDW_SHIM_LCTL_CPA_MASK, sdw->link_res->link_mask); in intel_link_power_up()
394 dev_err(sdw->cdns.dev, "Failed to power up link: %d\n", ret); in intel_link_power_up()
402 dev_err(sdw->cdns.dev, in intel_link_power_up()
410 sdw->cdns.link_up = true; in intel_link_power_up()
415 mutex_unlock(sdw->link_res->shim_lock); in intel_link_power_up()
423 unsigned int link_id = sdw->instance; in intel_link_power_down()
424 void __iomem *shim = sdw->link_res->shim; in intel_link_power_down()
425 u32 *shim_mask = sdw->link_res->shim_mask; in intel_link_power_down()
428 mutex_lock(sdw->link_res->shim_lock); in intel_link_power_down()
431 dev_err(sdw->cdns.dev, in intel_link_power_down()
432 "%s: Unbalanced power-up/down calls\n", __func__); in intel_link_power_down()
434 sdw->cdns.link_up = false; in intel_link_power_down()
442 dev_dbg(sdw->cdns.dev, "powering down all links\n"); in intel_link_power_down()
447 /* only power-down enabled links */ in intel_link_power_down()
448 spa_mask = FIELD_PREP(SDW_SHIM_LCTL_SPA_MASK, ~sdw->link_res->link_mask); in intel_link_power_down()
449 cpa_mask = FIELD_PREP(SDW_SHIM_LCTL_CPA_MASK, sdw->link_res->link_mask); in intel_link_power_down()
455 dev_err(sdw->cdns.dev, "%s: could not power down link\n", __func__); in intel_link_power_down()
458 * we leave the sdw->cdns.link_up flag as false since we've disabled in intel_link_power_down()
464 mutex_unlock(sdw->link_res->shim_lock); in intel_link_power_down()
471 void __iomem *shim = sdw->link_res->shim; in intel_shim_sync_arm()
474 mutex_lock(sdw->link_res->shim_lock); in intel_shim_sync_arm()
478 sync_reg |= (SDW_SHIM_SYNC_CMDSYNC << sdw->instance); in intel_shim_sync_arm()
481 mutex_unlock(sdw->link_res->shim_lock); in intel_shim_sync_arm()
486 void __iomem *shim = sdw->link_res->shim; in intel_shim_sync_go_unlocked()
508 mutex_lock(sdw->link_res->shim_lock); in intel_shim_sync_go()
512 mutex_unlock(sdw->link_res->shim_lock); in intel_shim_sync_go()
523 void __iomem *shim = sdw->link_res->shim; in intel_pdi_init()
524 unsigned int link_id = sdw->instance; in intel_pdi_init()
530 config->pcm_bd = FIELD_GET(SDW_SHIM_PCMSCAP_BSS, pcm_cap); in intel_pdi_init()
531 config->pcm_in = FIELD_GET(SDW_SHIM_PCMSCAP_ISS, pcm_cap); in intel_pdi_init()
532 config->pcm_out = FIELD_GET(SDW_SHIM_PCMSCAP_OSS, pcm_cap); in intel_pdi_init()
534 dev_dbg(sdw->cdns.dev, "PCM cap bd:%d in:%d out:%d\n", in intel_pdi_init()
535 config->pcm_bd, config->pcm_in, config->pcm_out); in intel_pdi_init()
541 void __iomem *shim = sdw->link_res->shim; in intel_pdi_get_ch_cap()
542 unsigned int link_id = sdw->instance; in intel_pdi_get_ch_cap()
570 pdi->ch_count = intel_pdi_get_ch_cap(sdw, pdi->num); in intel_pdi_get_ch_update()
571 ch_count += pdi->ch_count; in intel_pdi_get_ch_update()
582 intel_pdi_get_ch_update(sdw, stream->bd, stream->num_bd, in intel_pdi_stream_ch_update()
583 &stream->num_ch_bd); in intel_pdi_stream_ch_update()
585 intel_pdi_get_ch_update(sdw, stream->in, stream->num_in, in intel_pdi_stream_ch_update()
586 &stream->num_ch_in); in intel_pdi_stream_ch_update()
588 intel_pdi_get_ch_update(sdw, stream->out, stream->num_out, in intel_pdi_stream_ch_update()
589 &stream->num_ch_out); in intel_pdi_stream_ch_update()
597 void __iomem *shim = sdw->link_res->shim; in intel_pdi_shim_configure()
598 unsigned int link_id = sdw->instance; in intel_pdi_shim_configure()
602 pdi->intel_alh_id = (link_id * 16) + pdi->num + 3; in intel_pdi_shim_configure()
603 if (pdi->num >= 2) in intel_pdi_shim_configure()
604 pdi->intel_alh_id += 2; in intel_pdi_shim_configure()
610 if (pdi->type != SDW_STREAM_PCM) in intel_pdi_shim_configure()
613 if (pdi->dir == SDW_DATA_DIR_RX) in intel_pdi_shim_configure()
618 u32p_replace_bits(&pdi_conf, pdi->intel_alh_id, SDW_SHIM_PCMSYCM_STREAM); in intel_pdi_shim_configure()
619 u32p_replace_bits(&pdi_conf, pdi->l_ch_num, SDW_SHIM_PCMSYCM_LCHN); in intel_pdi_shim_configure()
620 u32p_replace_bits(&pdi_conf, pdi->h_ch_num, SDW_SHIM_PCMSYCM_HCHN); in intel_pdi_shim_configure()
622 intel_writew(shim, SDW_SHIM_PCMSYCHM(link_id, pdi->num), pdi_conf); in intel_pdi_shim_configure()
628 void __iomem *alh = sdw->link_res->alh; in intel_pdi_alh_configure()
629 unsigned int link_id = sdw->instance; in intel_pdi_alh_configure()
633 pdi->intel_alh_id = (link_id * 16) + pdi->num + 3; in intel_pdi_alh_configure()
634 if (pdi->num >= 2) in intel_pdi_alh_configure()
635 pdi->intel_alh_id += 2; in intel_pdi_alh_configure()
638 conf = intel_readl(alh, SDW_ALH_STRMZCFG(pdi->intel_alh_id)); in intel_pdi_alh_configure()
641 u32p_replace_bits(&conf, pdi->ch_count - 1, SDW_ALH_STRMZCFG_CHN); in intel_pdi_alh_configure()
643 intel_writel(alh, SDW_ALH_STRMZCFG(pdi->intel_alh_id), conf); in intel_pdi_alh_configure()
648 struct snd_soc_dai *dai, in intel_params_stream() argument
652 struct sdw_intel_link_res *res = sdw->link_res; in intel_params_stream()
656 params_data.dai = dai; in intel_params_stream()
661 if (res->ops && res->ops->params_stream && res->dev) in intel_params_stream()
662 return res->ops->params_stream(res->dev, in intel_params_stream()
664 return -EIO; in intel_params_stream()
668 * DAI routines
673 struct snd_soc_dai *dai) in intel_hw_params() argument
675 struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); in intel_hw_params()
684 dai_runtime = cdns->dai_runtime_array[dai->id]; in intel_hw_params()
686 return -EIO; in intel_hw_params()
689 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) in intel_hw_params()
694 pdi = sdw_cdns_alloc_pdi(cdns, &cdns->pcm, ch, dir, dai->id); in intel_hw_params()
697 ret = -EINVAL; in intel_hw_params()
701 /* do run-time configurations for SHIM, ALH and PDI/PORT */ in intel_hw_params()
707 dai_runtime->paused = false; in intel_hw_params()
708 dai_runtime->suspended = false; in intel_hw_params()
709 dai_runtime->pdi = pdi; in intel_hw_params()
712 ret = intel_params_stream(sdw, substream, dai, params, in intel_hw_params()
713 sdw->instance, in intel_hw_params()
714 pdi->intel_alh_id); in intel_hw_params()
721 sconfig.type = dai_runtime->stream_type; in intel_hw_params()
728 ret = -ENOMEM; in intel_hw_params()
732 pconfig->num = pdi->num; in intel_hw_params()
733 pconfig->ch_mask = (1 << ch) - 1; in intel_hw_params()
735 ret = sdw_stream_add_master(&cdns->bus, &sconfig, in intel_hw_params()
736 pconfig, 1, dai_runtime->stream); in intel_hw_params()
738 dev_err(cdns->dev, "add master to stream failed:%d\n", ret); in intel_hw_params()
746 struct snd_soc_dai *dai) in intel_prepare() argument
748 struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); in intel_prepare()
754 dai_runtime = cdns->dai_runtime_array[dai->id]; in intel_prepare()
756 dev_err(dai->dev, "failed to get dai runtime in %s\n", in intel_prepare()
758 return -EIO; in intel_prepare()
761 if (dai_runtime->suspended) { in intel_prepare()
765 hw_params = &rtd->dpcm[substream->stream].hw_params; in intel_prepare()
767 dai_runtime->suspended = false; in intel_prepare()
779 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) in intel_prepare()
784 intel_pdi_shim_configure(sdw, dai_runtime->pdi); in intel_prepare()
785 intel_pdi_alh_configure(sdw, dai_runtime->pdi); in intel_prepare()
786 sdw_cdns_config_stream(cdns, ch, dir, dai_runtime->pdi); in intel_prepare()
789 ret = intel_params_stream(sdw, substream, dai, in intel_prepare()
791 sdw->instance, in intel_prepare()
792 dai_runtime->pdi->intel_alh_id); in intel_prepare()
799 intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) in intel_hw_free() argument
801 struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); in intel_hw_free()
805 dai_runtime = cdns->dai_runtime_array[dai->id]; in intel_hw_free()
807 return -EIO; in intel_hw_free()
810 * The sdw stream state will transition to RELEASED when stream-> in intel_hw_free()
812 * DEPREPARED for the first cpu-dai and to RELEASED for the last in intel_hw_free()
813 * cpu-dai. in intel_hw_free()
815 ret = sdw_stream_remove_master(&cdns->bus, dai_runtime->stream); in intel_hw_free()
817 dev_err(dai->dev, "remove master from stream %s failed: %d\n", in intel_hw_free()
818 dai_runtime->stream->name, ret); in intel_hw_free()
822 dai_runtime->pdi = NULL; in intel_hw_free()
827 static int intel_pcm_set_sdw_stream(struct snd_soc_dai *dai, in intel_pcm_set_sdw_stream() argument
830 return cdns_set_sdw_stream(dai, stream, direction); in intel_pcm_set_sdw_stream()
833 static void *intel_get_sdw_stream(struct snd_soc_dai *dai, in intel_get_sdw_stream() argument
836 struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); in intel_get_sdw_stream()
839 dai_runtime = cdns->dai_runtime_array[dai->id]; in intel_get_sdw_stream()
841 return ERR_PTR(-EINVAL); in intel_get_sdw_stream()
843 return dai_runtime->stream; in intel_get_sdw_stream()
846 static int intel_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai) in intel_trigger() argument
848 struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); in intel_trigger()
852 dai_runtime = cdns->dai_runtime_array[dai->id]; in intel_trigger()
854 dev_err(dai->dev, "failed to get dai runtime in %s\n", in intel_trigger()
856 return -EIO; in intel_trigger()
869 dai_runtime->suspended = true; in intel_trigger()
874 dai_runtime->paused = true; in intel_trigger()
878 dai_runtime->paused = false; in intel_trigger()
897 ret = pm_runtime_resume(component->dev); in intel_component_probe()
898 if (ret < 0 && ret != -EACCES) in intel_component_probe()
906 struct snd_soc_dai *dai; in intel_component_dais_suspend() local
914 for_each_component_dais(component, dai) { in intel_component_dais_suspend()
915 struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); in intel_component_dais_suspend()
918 dai_runtime = cdns->dai_runtime_array[dai->id]; in intel_component_dais_suspend()
923 if (dai_runtime->suspended) in intel_component_dais_suspend()
926 if (dai_runtime->paused) in intel_component_dais_suspend()
927 dai_runtime->suspended = true; in intel_component_dais_suspend()
960 dais[i].name = devm_kasprintf(cdns->dev, GFP_KERNEL, in intel_create_dai()
962 cdns->instance, i); in intel_create_dai()
964 return -ENOMEM; in intel_create_dai()
986 struct sdw_cdns *cdns = &sdw->cdns; in intel_register_dai()
997 intel_pdi_stream_ch_update(sdw, &sdw->cdns.pcm); in intel_register_dai()
1000 num_dai = cdns->pcm.num_pdi; in intel_register_dai()
1002 dai_runtime_array = devm_kcalloc(cdns->dev, num_dai, in intel_register_dai()
1006 return -ENOMEM; in intel_register_dai()
1007 cdns->dai_runtime_array = dai_runtime_array; in intel_register_dai()
1009 dais = devm_kcalloc(cdns->dev, num_dai, sizeof(*dais), GFP_KERNEL); in intel_register_dai()
1011 return -ENOMEM; in intel_register_dai()
1014 stream = &cdns->pcm; in intel_register_dai()
1016 ret = intel_create_dai(cdns, dais, INTEL_PDI_IN, cdns->pcm.num_in, in intel_register_dai()
1017 off, stream->num_ch_in); in intel_register_dai()
1021 off += cdns->pcm.num_in; in intel_register_dai()
1022 ret = intel_create_dai(cdns, dais, INTEL_PDI_OUT, cdns->pcm.num_out, in intel_register_dai()
1023 off, stream->num_ch_out); in intel_register_dai()
1027 off += cdns->pcm.num_out; in intel_register_dai()
1028 ret = intel_create_dai(cdns, dais, INTEL_PDI_BD, cdns->pcm.num_bd, in intel_register_dai()
1029 off, stream->num_ch_bd); in intel_register_dai()
1033 return devm_snd_soc_register_component(cdns->dev, &dai_component, in intel_register_dai()