Lines Matching +full:loongson +full:- +full:audio
1 // SPDX-License-Identifier: GPL-2.0
3 // Loongson ASoC Audio Machine driver
5 // Copyright (C) 2023 Loongson Technology Corporation Limited
6 // Author: Yingkun Meng <mengyingkun@loongson.cn>
11 #include <sound/soc-acpi.h>
27 struct loongson_card_data *ls_card = snd_soc_card_get_drvdata(rtd->card); in loongson_card_hw_params()
32 if (!ls_card->mclk_fs) in loongson_card_hw_params()
35 mclk = ls_card->mclk_fs * params_rate(params); in loongson_card_hw_params()
38 dev_err(codec_dai->dev, "cpu_dai clock not set\n"); in loongson_card_hw_params()
44 dev_err(codec_dai->dev, "codec_dai clock not set\n"); in loongson_card_hw_params()
56 DAILINK_COMP_ARRAY(COMP_CPU("loongson-i2s")),
62 .name = "Loongson Audio Port",
63 .stream_name = "Loongson Audio",
74 struct fwnode_handle *fwnode = card->dev->fwnode; in loongson_card_acpi_find_device()
81 dev_err(card->dev, "No matching phy in ACPI table\n"); in loongson_card_acpi_find_device()
90 struct snd_soc_card *card = &data->snd_card; in loongson_card_parse_acpi()
99 return -ENOENT; in loongson_card_parse_acpi()
103 return -EPROBE_DEFER; in loongson_card_parse_acpi()
108 return -ENOENT; in loongson_card_parse_acpi()
109 snprintf(codec_name, sizeof(codec_name), "i2c-%s", acpi_dev_name(adev)); in loongson_card_parse_acpi()
111 device_property_read_string(card->dev, "codec-dai-name", &codec_dai_name); in loongson_card_parse_acpi()
113 for (i = 0; i < card->num_links; i++) { in loongson_card_parse_acpi()
114 loongson_dai_links[i].platforms->name = dev_name(phy_dev); in loongson_card_parse_acpi()
115 loongson_dai_links[i].codecs->name = codec_name; in loongson_card_parse_acpi()
116 loongson_dai_links[i].codecs->dai_name = codec_dai_name; in loongson_card_parse_acpi()
125 struct snd_soc_card *card = &data->snd_card; in loongson_card_parse_of()
126 struct device *dev = card->dev; in loongson_card_parse_of()
129 cpu = of_get_child_by_name(dev->of_node, "cpu"); in loongson_card_parse_of()
132 return -EINVAL; in loongson_card_parse_of()
134 codec = of_get_child_by_name(dev->of_node, "codec"); in loongson_card_parse_of()
136 dev_err(dev, "audio-codec property missing or invalid\n"); in loongson_card_parse_of()
138 return -EINVAL; in loongson_card_parse_of()
141 for (i = 0; i < card->num_links; i++) { in loongson_card_parse_of()
147 loongson_dai_links[i].platforms->of_node = loongson_dai_links[i].cpus->of_node; in loongson_card_parse_of()
170 struct device *dev = &pdev->dev; in loongson_asoc_card_probe()
176 return -ENOMEM; in loongson_asoc_card_probe()
178 card = &ls_priv->snd_card; in loongson_asoc_card_probe()
180 card->dev = dev; in loongson_asoc_card_probe()
181 card->owner = THIS_MODULE; in loongson_asoc_card_probe()
182 card->dai_link = loongson_dai_links; in loongson_asoc_card_probe()
183 card->num_links = ARRAY_SIZE(loongson_dai_links); in loongson_asoc_card_probe()
186 ret = device_property_read_string(dev, "model", &card->name); in loongson_asoc_card_probe()
190 ret = device_property_read_u32(dev, "mclk-fs", &ls_priv->mclk_fs); in loongson_asoc_card_probe()
192 return dev_err_probe(dev, ret, "Error parsing mclk-fs\n"); in loongson_asoc_card_probe()
203 { .compatible = "loongson,ls-audio-card" },
211 .name = "loongson-asoc-card",
218 MODULE_DESCRIPTION("Loongson ASoc Sound Card driver");
219 MODULE_AUTHOR("Loongson Technology Corporation Limited");