Johannes Stezenbach | ec3ea54 | 2011-06-22 14:59:25 +0200 | [diff] [blame] | 1 | /* |
| 2 | * sound/soc/codecs/wm8782.c |
| 3 | * simple, strap-pin configured 24bit 2ch ADC |
| 4 | * |
| 5 | * Copyright: 2011 Raumfeld GmbH |
| 6 | * Author: Johannes Stezenbach <js@sig21.net> |
| 7 | * |
| 8 | * based on ad73311.c |
| 9 | * Copyright: Analog Device Inc. |
| 10 | * Author: Cliff Cai <cliff.cai@analog.com> |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify it |
| 13 | * under the terms of the GNU General Public License as published by the |
| 14 | * Free Software Foundation; either version 2 of the License, or (at your |
| 15 | * option) any later version. |
| 16 | */ |
| 17 | |
| 18 | #include <linux/init.h> |
| 19 | #include <linux/slab.h> |
| 20 | #include <linux/module.h> |
| 21 | #include <linux/kernel.h> |
| 22 | #include <linux/device.h> |
| 23 | #include <sound/core.h> |
| 24 | #include <sound/pcm.h> |
| 25 | #include <sound/ac97_codec.h> |
| 26 | #include <sound/initval.h> |
| 27 | #include <sound/soc.h> |
| 28 | |
Mark Brown | 226059e | 2013-08-18 18:36:06 +0100 | [diff] [blame] | 29 | static const struct snd_soc_dapm_widget wm8782_dapm_widgets[] = { |
| 30 | SND_SOC_DAPM_INPUT("AINL"), |
| 31 | SND_SOC_DAPM_INPUT("AINR"), |
| 32 | }; |
| 33 | |
| 34 | static const struct snd_soc_dapm_route wm8782_dapm_routes[] = { |
| 35 | { "Capture", NULL, "AINL" }, |
| 36 | { "Capture", NULL, "AINR" }, |
| 37 | }; |
| 38 | |
Johannes Stezenbach | ec3ea54 | 2011-06-22 14:59:25 +0200 | [diff] [blame] | 39 | static struct snd_soc_dai_driver wm8782_dai = { |
| 40 | .name = "wm8782", |
| 41 | .capture = { |
| 42 | .stream_name = "Capture", |
| 43 | .channels_min = 2, |
| 44 | .channels_max = 2, |
| 45 | /* For configurations with FSAMPEN=0 */ |
| 46 | .rates = SNDRV_PCM_RATE_8000_48000, |
| 47 | .formats = SNDRV_PCM_FMTBIT_S16_LE | |
| 48 | SNDRV_PCM_FMTBIT_S20_3LE | |
| 49 | SNDRV_PCM_FMTBIT_S24_LE, |
| 50 | }, |
| 51 | }; |
| 52 | |
Mark Brown | 226059e | 2013-08-18 18:36:06 +0100 | [diff] [blame] | 53 | static struct snd_soc_codec_driver soc_codec_dev_wm8782 = { |
| 54 | .dapm_widgets = wm8782_dapm_widgets, |
| 55 | .num_dapm_widgets = ARRAY_SIZE(wm8782_dapm_widgets), |
| 56 | .dapm_routes = wm8782_dapm_routes, |
| 57 | .num_dapm_routes = ARRAY_SIZE(wm8782_dapm_routes), |
| 58 | }; |
Johannes Stezenbach | ec3ea54 | 2011-06-22 14:59:25 +0200 | [diff] [blame] | 59 | |
Bill Pemberton | 7a79e94 | 2012-12-07 09:26:37 -0500 | [diff] [blame] | 60 | static int wm8782_probe(struct platform_device *pdev) |
Johannes Stezenbach | ec3ea54 | 2011-06-22 14:59:25 +0200 | [diff] [blame] | 61 | { |
| 62 | return snd_soc_register_codec(&pdev->dev, |
| 63 | &soc_codec_dev_wm8782, &wm8782_dai, 1); |
| 64 | } |
| 65 | |
Bill Pemberton | 7a79e94 | 2012-12-07 09:26:37 -0500 | [diff] [blame] | 66 | static int wm8782_remove(struct platform_device *pdev) |
Johannes Stezenbach | ec3ea54 | 2011-06-22 14:59:25 +0200 | [diff] [blame] | 67 | { |
| 68 | snd_soc_unregister_codec(&pdev->dev); |
| 69 | return 0; |
| 70 | } |
| 71 | |
| 72 | static struct platform_driver wm8782_codec_driver = { |
| 73 | .driver = { |
| 74 | .name = "wm8782", |
| 75 | .owner = THIS_MODULE, |
| 76 | }, |
| 77 | .probe = wm8782_probe, |
Bill Pemberton | 7a79e94 | 2012-12-07 09:26:37 -0500 | [diff] [blame] | 78 | .remove = wm8782_remove, |
Johannes Stezenbach | ec3ea54 | 2011-06-22 14:59:25 +0200 | [diff] [blame] | 79 | }; |
| 80 | |
Mark Brown | 5bbcc3c | 2011-11-23 22:52:08 +0000 | [diff] [blame] | 81 | module_platform_driver(wm8782_codec_driver); |
Johannes Stezenbach | ec3ea54 | 2011-06-22 14:59:25 +0200 | [diff] [blame] | 82 | |
| 83 | MODULE_DESCRIPTION("ASoC WM8782 driver"); |
| 84 | MODULE_AUTHOR("Johannes Stezenbach <js@sig21.net>"); |
| 85 | MODULE_LICENSE("GPL"); |