1 // SPDX-License-Identifier: GPL-2.0
3 * ASoC Driver for HiFiBerry DAC + DSP
5 * Author: Joerg Schambacher <joscha@schambacher.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
18 #include <linux/init.h>
19 #include <linux/module.h>
21 #include <linux/platform_device.h>
22 #include <sound/soc.h>
24 static struct snd_soc_component_driver dacplusdsp_component_driver;
26 static struct snd_soc_dai_driver dacplusdsp_dai = {
27 .name = "dacplusdsp-hifi",
29 .stream_name = "DAC+DSP Capture",
32 .rates = SNDRV_PCM_RATE_CONTINUOUS,
33 .formats = SNDRV_PCM_FMTBIT_S16_LE |
34 SNDRV_PCM_FMTBIT_S24_LE |
35 SNDRV_PCM_FMTBIT_S32_LE,
38 .stream_name = "DACP+DSP Playback",
41 .rates = SNDRV_PCM_RATE_CONTINUOUS,
42 .formats = SNDRV_PCM_FMTBIT_S16_LE |
43 SNDRV_PCM_FMTBIT_S24_LE |
44 SNDRV_PCM_FMTBIT_S32_LE,
49 static const struct of_device_id dacplusdsp_ids[] = {
51 .compatible = "hifiberry,dacplusdsp",
54 MODULE_DEVICE_TABLE(of, dacplusdsp_ids);
57 static int dacplusdsp_platform_probe(struct platform_device *pdev)
61 ret = snd_soc_register_component(&pdev->dev,
62 &dacplusdsp_component_driver, &dacplusdsp_dai, 1);
64 pr_alert("snd_soc_register_component failed\n");
71 static int dacplusdsp_platform_remove(struct platform_device *pdev)
73 snd_soc_unregister_component(&pdev->dev);
77 static struct platform_driver dacplusdsp_driver = {
79 .name = "hifiberry-dacplusdsp-codec",
80 .of_match_table = of_match_ptr(dacplusdsp_ids),
82 .probe = dacplusdsp_platform_probe,
83 .remove = dacplusdsp_platform_remove,
86 module_platform_driver(dacplusdsp_driver);
88 MODULE_AUTHOR("Joerg Schambacher <joerg@i2audio.com>");
89 MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+DSP");
90 MODULE_LICENSE("GPL v2");