Linux Audio

Check our new training course

Loading...
v6.13.7
 1// SPDX-License-Identifier: GPL-2.0-only
 2/*
 3 * Driver for the PCM5102A codec
 4 *
 5 * Author:	Florian Meier <florian.meier@koalo.de>
 6 *		Copyright 2013
 
 
 
 
 
 
 
 
 
 7 */
 8
 9#include <linux/init.h>
10#include <linux/module.h>
11#include <linux/platform_device.h>
12
13#include <sound/soc.h>
14
15static struct snd_soc_dai_driver pcm5102a_dai = {
16	.name = "pcm5102a-hifi",
17	.playback = {
18		.channels_min = 2,
19		.channels_max = 2,
20		.rates = SNDRV_PCM_RATE_8000_384000,
21		.formats = SNDRV_PCM_FMTBIT_S16_LE |
22			   SNDRV_PCM_FMTBIT_S24_LE |
23			   SNDRV_PCM_FMTBIT_S32_LE
24	},
25};
26
27static const struct snd_soc_component_driver soc_component_dev_pcm5102a = {
28	.idle_bias_on		= 1,
29	.use_pmdown_time	= 1,
30	.endianness		= 1,
31};
32
33static int pcm5102a_probe(struct platform_device *pdev)
34{
35	return devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_pcm5102a,
36			&pcm5102a_dai, 1);
37}
38
 
 
 
 
 
 
39static const struct of_device_id pcm5102a_of_match[] = {
40	{ .compatible = "ti,pcm5102a", },
41	{ }
42};
43MODULE_DEVICE_TABLE(of, pcm5102a_of_match);
44
45static struct platform_driver pcm5102a_codec_driver = {
46	.probe		= pcm5102a_probe,
 
47	.driver		= {
48		.name	= "pcm5102a-codec",
49		.of_match_table = pcm5102a_of_match,
50	},
51};
52
53module_platform_driver(pcm5102a_codec_driver);
54
55MODULE_DESCRIPTION("ASoC PCM5102A codec driver");
56MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
57MODULE_LICENSE("GPL v2");
v4.10.11
 
 1/*
 2 * Driver for the PCM5102A codec
 3 *
 4 * Author:	Florian Meier <florian.meier@koalo.de>
 5 *		Copyright 2013
 6 *
 7 * This program is free software; you can redistribute it and/or
 8 * modify it under the terms of the GNU General Public License
 9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 * General Public License for more details.
15 */
16
17#include <linux/init.h>
18#include <linux/module.h>
19#include <linux/platform_device.h>
20
21#include <sound/soc.h>
22
23static struct snd_soc_dai_driver pcm5102a_dai = {
24	.name = "pcm5102a-hifi",
25	.playback = {
26		.channels_min = 2,
27		.channels_max = 2,
28		.rates = SNDRV_PCM_RATE_8000_192000,
29		.formats = SNDRV_PCM_FMTBIT_S16_LE |
30			   SNDRV_PCM_FMTBIT_S24_LE |
31			   SNDRV_PCM_FMTBIT_S32_LE
32	},
33};
34
35static struct snd_soc_codec_driver soc_codec_dev_pcm5102a;
 
 
 
 
36
37static int pcm5102a_probe(struct platform_device *pdev)
38{
39	return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a,
40			&pcm5102a_dai, 1);
41}
42
43static int pcm5102a_remove(struct platform_device *pdev)
44{
45	snd_soc_unregister_codec(&pdev->dev);
46	return 0;
47}
48
49static const struct of_device_id pcm5102a_of_match[] = {
50	{ .compatible = "ti,pcm5102a", },
51	{ }
52};
53MODULE_DEVICE_TABLE(of, pcm5102a_of_match);
54
55static struct platform_driver pcm5102a_codec_driver = {
56	.probe		= pcm5102a_probe,
57	.remove		= pcm5102a_remove,
58	.driver		= {
59		.name	= "pcm5102a-codec",
60		.of_match_table = pcm5102a_of_match,
61	},
62};
63
64module_platform_driver(pcm5102a_codec_driver);
65
66MODULE_DESCRIPTION("ASoC PCM5102A codec driver");
67MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
68MODULE_LICENSE("GPL v2");