2 * Copyright (c) 2017 BayLibre, SAS.
3 * Author: Jerome Brunet <jbrunet@baylibre.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 * The full GNU General Public License is included in this distribution
17 * in the file called COPYING.
20 #include <linux/module.h>
21 #include <sound/soc.h>
24 * The everest 7134 is a very simple DA converter with no register
27 static int es7134_set_fmt(struct snd_soc_dai
*codec_dai
, unsigned int fmt
)
29 fmt
&= (SND_SOC_DAIFMT_FORMAT_MASK
| SND_SOC_DAIFMT_INV_MASK
|
30 SND_SOC_DAIFMT_MASTER_MASK
);
32 if (fmt
!= (SND_SOC_DAIFMT_I2S
| SND_SOC_DAIFMT_NB_NF
|
33 SND_SOC_DAIFMT_CBS_CFS
)) {
34 dev_err(codec_dai
->dev
, "Invalid DAI format\n");
41 static const struct snd_soc_dai_ops es7134_dai_ops
= {
42 .set_fmt
= es7134_set_fmt
,
45 static struct snd_soc_dai_driver es7134_dai
= {
46 .name
= "es7134-hifi",
48 .stream_name
= "Playback",
51 .rates
= SNDRV_PCM_RATE_8000_192000
,
52 .formats
= (SNDRV_PCM_FMTBIT_S16_LE
|
53 SNDRV_PCM_FMTBIT_S18_3LE
|
54 SNDRV_PCM_FMTBIT_S20_3LE
|
55 SNDRV_PCM_FMTBIT_S24_3LE
|
56 SNDRV_PCM_FMTBIT_S24_LE
),
58 .ops
= &es7134_dai_ops
,
61 static const struct snd_soc_dapm_widget es7134_dapm_widgets
[] = {
62 SND_SOC_DAPM_OUTPUT("AOUTL"),
63 SND_SOC_DAPM_OUTPUT("AOUTR"),
64 SND_SOC_DAPM_DAC("DAC", "Playback", SND_SOC_NOPM
, 0, 0),
67 static const struct snd_soc_dapm_route es7134_dapm_routes
[] = {
68 { "AOUTL", NULL
, "DAC" },
69 { "AOUTR", NULL
, "DAC" },
72 static const struct snd_soc_component_driver es7134_component_driver
= {
73 .dapm_widgets
= es7134_dapm_widgets
,
74 .num_dapm_widgets
= ARRAY_SIZE(es7134_dapm_widgets
),
75 .dapm_routes
= es7134_dapm_routes
,
76 .num_dapm_routes
= ARRAY_SIZE(es7134_dapm_routes
),
80 .non_legacy_dai_naming
= 1,
83 static int es7134_probe(struct platform_device
*pdev
)
85 return devm_snd_soc_register_component(&pdev
->dev
,
86 &es7134_component_driver
,
91 static const struct of_device_id es7134_ids
[] = {
92 { .compatible
= "everest,es7134", },
93 { .compatible
= "everest,es7144", },
96 MODULE_DEVICE_TABLE(of
, es7134_ids
);
99 static struct platform_driver es7134_driver
= {
102 .of_match_table
= of_match_ptr(es7134_ids
),
104 .probe
= es7134_probe
,
107 module_platform_driver(es7134_driver
);
109 MODULE_DESCRIPTION("ASoC ES7134 audio codec driver");
110 MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
111 MODULE_LICENSE("GPL");