Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-btrfs-devel.git] / sound / soc / codecs / wm8727.c
blob7488082851191ce120a8a66fd8704b53613b8189
1 /*
2 * wm8727.c
4 * Created on: 15-Oct-2009
5 * Author: neil.jones@imgtec.com
7 * Copyright (C) 2009 Imagination Technologies Ltd.
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
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>
27 * Note this is a simple chip with no configuration interface, sample rate is
28 * determined automatically by examining the Master clock and Bit clock ratios
30 #define WM8727_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
31 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |\
32 SNDRV_PCM_RATE_192000)
35 static struct snd_soc_dai_driver wm8727_dai = {
36 .name = "wm8727-hifi",
37 .playback = {
38 .stream_name = "Playback",
39 .channels_min = 2,
40 .channels_max = 2,
41 .rates = WM8727_RATES,
42 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
46 static struct snd_soc_codec_driver soc_codec_dev_wm8727;
48 static __devinit int wm8727_probe(struct platform_device *pdev)
50 return snd_soc_register_codec(&pdev->dev,
51 &soc_codec_dev_wm8727, &wm8727_dai, 1);
54 static int __devexit wm8727_remove(struct platform_device *pdev)
56 snd_soc_unregister_codec(&pdev->dev);
57 return 0;
60 static struct platform_driver wm8727_codec_driver = {
61 .driver = {
62 .name = "wm8727-codec",
63 .owner = THIS_MODULE,
66 .probe = wm8727_probe,
67 .remove = __devexit_p(wm8727_remove),
70 static int __init wm8727_init(void)
72 return platform_driver_register(&wm8727_codec_driver);
74 module_init(wm8727_init);
76 static void __exit wm8727_exit(void)
78 platform_driver_unregister(&wm8727_codec_driver);
80 module_exit(wm8727_exit);
82 MODULE_DESCRIPTION("ASoC wm8727 driver");
83 MODULE_AUTHOR("Neil Jones");
84 MODULE_LICENSE("GPL");