Neil Jones | 89933de | 2009-11-02 15:14:17 +0000 | [diff] [blame] | 1 | /* |
| 2 | * wm8727.c |
| 3 | * |
| 4 | * Created on: 15-Oct-2009 |
| 5 | * Author: neil.jones@imgtec.com |
| 6 | * |
| 7 | * Copyright (C) 2009 Imagination Technologies Ltd. |
| 8 | * |
| 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. |
| 13 | */ |
| 14 | |
| 15 | #include <linux/init.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 16 | #include <linux/slab.h> |
Neil Jones | 89933de | 2009-11-02 15:14:17 +0000 | [diff] [blame] | 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> |
| 25 | |
Neil Jones | 89933de | 2009-11-02 15:14:17 +0000 | [diff] [blame] | 26 | /* |
| 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 |
| 29 | */ |
| 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) |
| 33 | |
| 34 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 35 | static struct snd_soc_dai_driver wm8727_dai = { |
| 36 | .name = "wm8727-hifi", |
Neil Jones | 89933de | 2009-11-02 15:14:17 +0000 | [diff] [blame] | 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, |
| 43 | }, |
| 44 | }; |
Neil Jones | 89933de | 2009-11-02 15:14:17 +0000 | [diff] [blame] | 45 | |
Mark Brown | 48bd347 | 2010-08-12 15:02:36 +0100 | [diff] [blame] | 46 | static struct snd_soc_codec_driver soc_codec_dev_wm8727; |
Mark Brown | cce2e9d | 2009-12-08 21:50:01 +0000 | [diff] [blame] | 47 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 48 | static __devinit int wm8727_probe(struct platform_device *pdev) |
Neil Jones | 89933de | 2009-11-02 15:14:17 +0000 | [diff] [blame] | 49 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 50 | return snd_soc_register_codec(&pdev->dev, |
| 51 | &soc_codec_dev_wm8727, &wm8727_dai, 1); |
Neil Jones | 89933de | 2009-11-02 15:14:17 +0000 | [diff] [blame] | 52 | } |
| 53 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 54 | static int __devexit wm8727_remove(struct platform_device *pdev) |
Neil Jones | 89933de | 2009-11-02 15:14:17 +0000 | [diff] [blame] | 55 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 56 | snd_soc_unregister_codec(&pdev->dev); |
Neil Jones | 89933de | 2009-11-02 15:14:17 +0000 | [diff] [blame] | 57 | return 0; |
| 58 | } |
| 59 | |
Mark Brown | 529697c | 2009-11-03 22:13:30 +0000 | [diff] [blame] | 60 | static struct platform_driver wm8727_codec_driver = { |
Neil Jones | 89933de | 2009-11-02 15:14:17 +0000 | [diff] [blame] | 61 | .driver = { |
Mark Brown | 091edcc | 2011-12-02 22:08:49 +0000 | [diff] [blame] | 62 | .name = "wm8727", |
Neil Jones | 89933de | 2009-11-02 15:14:17 +0000 | [diff] [blame] | 63 | .owner = THIS_MODULE, |
| 64 | }, |
| 65 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 66 | .probe = wm8727_probe, |
| 67 | .remove = __devexit_p(wm8727_remove), |
Neil Jones | 89933de | 2009-11-02 15:14:17 +0000 | [diff] [blame] | 68 | }; |
| 69 | |
Mark Brown | 5bbcc3c | 2011-11-23 22:52:08 +0000 | [diff] [blame] | 70 | module_platform_driver(wm8727_codec_driver); |
Neil Jones | 89933de | 2009-11-02 15:14:17 +0000 | [diff] [blame] | 71 | |
| 72 | MODULE_DESCRIPTION("ASoC wm8727 driver"); |
| 73 | MODULE_AUTHOR("Neil Jones"); |
| 74 | MODULE_LICENSE("GPL"); |