2 * This is a simple driver for the GTM601 Voice PCM interface
4 * Copyright (C) 2015 Goldelico GmbH
6 * Author: Marek Belisko <marek@goldelico.com>
8 * Based on wm8727.c driver
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
15 #include <linux/init.h>
16 #include <linux/slab.h>
17 #include <linux/module.h>
18 #include <linux/kernel.h>
19 #include <linux/device.h>
20 #include <sound/core.h>
21 #include <sound/pcm.h>
22 #include <sound/ac97_codec.h>
23 #include <sound/initval.h>
24 #include <sound/soc.h>
26 static const struct snd_soc_dapm_widget gtm601_dapm_widgets
[] = {
27 SND_SOC_DAPM_OUTPUT("AOUT"),
28 SND_SOC_DAPM_INPUT("AIN"),
31 static const struct snd_soc_dapm_route gtm601_dapm_routes
[] = {
32 { "AOUT", NULL
, "Playback" },
33 { "Capture", NULL
, "AIN" },
36 static struct snd_soc_dai_driver gtm601_dai
= {
39 .stream_name
= "Playback",
42 .rates
= SNDRV_PCM_RATE_8000
,
43 .formats
= SNDRV_PCM_FMTBIT_S16_LE
,
46 .stream_name
= "Capture",
49 .rates
= SNDRV_PCM_RATE_8000
,
50 .formats
= SNDRV_PCM_FMTBIT_S16_LE
,
54 static const struct snd_soc_codec_driver soc_codec_dev_gtm601
= {
56 .dapm_widgets
= gtm601_dapm_widgets
,
57 .num_dapm_widgets
= ARRAY_SIZE(gtm601_dapm_widgets
),
58 .dapm_routes
= gtm601_dapm_routes
,
59 .num_dapm_routes
= ARRAY_SIZE(gtm601_dapm_routes
),
63 static int gtm601_platform_probe(struct platform_device
*pdev
)
65 return snd_soc_register_codec(&pdev
->dev
,
66 &soc_codec_dev_gtm601
, >m601_dai
, 1);
69 static int gtm601_platform_remove(struct platform_device
*pdev
)
71 snd_soc_unregister_codec(&pdev
->dev
);
75 #if defined(CONFIG_OF)
76 static const struct of_device_id gtm601_codec_of_match
[] = {
77 { .compatible
= "option,gtm601", },
80 MODULE_DEVICE_TABLE(of
, gtm601_codec_of_match
);
83 static struct platform_driver gtm601_codec_driver
= {
86 .of_match_table
= of_match_ptr(gtm601_codec_of_match
),
88 .probe
= gtm601_platform_probe
,
89 .remove
= gtm601_platform_remove
,
92 module_platform_driver(gtm601_codec_driver
);
94 MODULE_DESCRIPTION("ASoC gtm601 driver");
95 MODULE_AUTHOR("Marek Belisko <marek@goldelico.com>");
96 MODULE_LICENSE("GPL");
97 MODULE_ALIAS("platform:gtm601");