Lines Matching +full:spdif +full:- +full:mclk
1 // SPDX-License-Identifier: GPL-2.0-only
15 #include <sound/soc-dapm.h>
20 /* sysconf 5041: Audio-Gue-Control */
22 /* sysconf 5042: Audio-DAC-Control */
34 /* SPDIF definitions */
54 int mclk; member
59 int mclk; member
77 struct sti_spdif_audio spdif; member
88 status = regmap_read(drvdata->dac.regmap, reg, &val); in sti_sas_read_reg()
100 return regmap_write(drvdata->dac.regmap, reg, value); in sti_sas_write_reg()
108 * DAC and SPDIF are activated by default in sti_sas_init_sas_registers()
112 /* Initialise bi-phase formatter to disabled */ in sti_sas_init_sas_registers()
117 /* Initialise bi-phase formatter idle value to 0 */ in sti_sas_init_sas_registers()
121 dev_err(component->dev, "Failed to update SPDIF registers\n"); in sti_sas_init_sas_registers()
141 dev_err(component->dev, "Failed to update DAC registers\n"); in sti_sas_init_sas_registers()
155 dev_err(dai->component->dev, in sti_sas_dac_set_fmt()
158 return -EINVAL; in sti_sas_dac_set_fmt()
180 struct snd_soc_component *component = dai->component; in stih407_sas_dac_mute()
194 * SPDIF
200 dev_err(dai->component->dev, in sti_sas_spdif_set_fmt()
203 return -EINVAL; in sti_sas_spdif_set_fmt()
218 struct snd_soc_component *component = dai->component; in sti_sas_spdif_trigger()
234 return -EINVAL; in sti_sas_spdif_trigger()
252 * get MCLK input frequency to check that MCLK-FS ratio is coherent
257 struct snd_soc_component *component = dai->component; in sti_sas_set_sysclk()
258 struct sti_sas_data *drvdata = dev_get_drvdata(component->dev); in sti_sas_set_sysclk()
264 return -EINVAL; in sti_sas_set_sysclk()
266 switch (dai->id) { in sti_sas_set_sysclk()
268 drvdata->spdif.mclk = freq; in sti_sas_set_sysclk()
272 drvdata->dac.mclk = freq; in sti_sas_set_sysclk()
282 struct snd_soc_component *component = dai->component; in sti_sas_prepare()
283 struct sti_sas_data *drvdata = dev_get_drvdata(component->dev); in sti_sas_prepare()
284 struct snd_pcm_runtime *runtime = substream->runtime; in sti_sas_prepare()
286 switch (dai->id) { in sti_sas_prepare()
288 if ((drvdata->spdif.mclk / runtime->rate) != 128) { in sti_sas_prepare()
289 dev_err(component->dev, "unexpected mclk-fs ratio\n"); in sti_sas_prepare()
290 return -EINVAL; in sti_sas_prepare()
294 if ((drvdata->dac.mclk / runtime->rate) != 256) { in sti_sas_prepare()
295 dev_err(component->dev, "unexpected mclk-fs ratio\n"); in sti_sas_prepare()
296 return -EINVAL; in sti_sas_prepare()
335 .name = "sas-dai-spdif-out",
358 .name = "sas-dai-dac",
374 struct sti_sas_data *drvdata = dev_get_drvdata(component->dev); in sti_sas_resume()
384 struct sti_sas_data *drvdata = dev_get_drvdata(component->dev); in sti_sas_component_probe()
399 .compatible = "st,stih407-sas-codec",
408 struct device_node *pnode = pdev->dev.of_node; in sti_sas_driver_probe()
413 drvdata = devm_kzalloc(&pdev->dev, sizeof(struct sti_sas_data), in sti_sas_driver_probe()
416 return -ENOMEM; in sti_sas_driver_probe()
420 if (!of_id->data) { in sti_sas_driver_probe()
421 dev_err(&pdev->dev, "data associated to device is missing\n"); in sti_sas_driver_probe()
422 return -EINVAL; in sti_sas_driver_probe()
425 drvdata->dev_data = (struct sti_sas_dev_data *)of_id->data; in sti_sas_driver_probe()
428 drvdata->dev = &pdev->dev; in sti_sas_driver_probe()
430 /* Request the DAC & SPDIF registers memory region */ in sti_sas_driver_probe()
431 drvdata->dac.virt_regmap = devm_regmap_init(&pdev->dev, NULL, drvdata, in sti_sas_driver_probe()
432 drvdata->dev_data->regmap); in sti_sas_driver_probe()
433 if (IS_ERR(drvdata->dac.virt_regmap)) { in sti_sas_driver_probe()
434 dev_err(&pdev->dev, "audio registers not enabled\n"); in sti_sas_driver_probe()
435 return PTR_ERR(drvdata->dac.virt_regmap); in sti_sas_driver_probe()
439 drvdata->dac.regmap = in sti_sas_driver_probe()
441 if (IS_ERR(drvdata->dac.regmap)) { in sti_sas_driver_probe()
442 dev_err(&pdev->dev, "syscon registers not available\n"); in sti_sas_driver_probe()
443 return PTR_ERR(drvdata->dac.regmap); in sti_sas_driver_probe()
445 drvdata->spdif.regmap = drvdata->dac.regmap; in sti_sas_driver_probe()
447 sti_sas_dai[STI_SAS_DAI_ANALOG_OUT].ops = drvdata->dev_data->dac_ops; in sti_sas_driver_probe()
450 sti_sas_driver.dapm_widgets = drvdata->dev_data->dapm_widgets; in sti_sas_driver_probe()
451 sti_sas_driver.num_dapm_widgets = drvdata->dev_data->num_dapm_widgets; in sti_sas_driver_probe()
453 sti_sas_driver.dapm_routes = drvdata->dev_data->dapm_routes; in sti_sas_driver_probe()
454 sti_sas_driver.num_dapm_routes = drvdata->dev_data->num_dapm_routes; in sti_sas_driver_probe()
457 dev_set_drvdata(&pdev->dev, drvdata); in sti_sas_driver_probe()
459 return devm_snd_soc_register_component(&pdev->dev, &sti_sas_driver, in sti_sas_driver_probe()
466 .name = "sti-sas-codec",