media: v4l: rcar_fdp1: Change platform dependency to ARCH_RENESAS
[linux/fpc-iii.git] / sound / soc / codecs / es7134.c
blob58515bb1a303655525ec2c259f4370f0868a0096
1 /*
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");
35 return -EINVAL;
38 return 0;
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",
47 .playback = {
48 .stream_name = "Playback",
49 .channels_min = 2,
50 .channels_max = 2,
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),
77 .idle_bias_on = 1,
78 .use_pmdown_time = 1,
79 .endianness = 1,
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,
87 &es7134_dai, 1);
90 #ifdef CONFIG_OF
91 static const struct of_device_id es7134_ids[] = {
92 { .compatible = "everest,es7134", },
93 { .compatible = "everest,es7144", },
94 { }
96 MODULE_DEVICE_TABLE(of, es7134_ids);
97 #endif
99 static struct platform_driver es7134_driver = {
100 .driver = {
101 .name = "es7134",
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");