2008-07-29 18:42:34 +08:00
|
|
|
/*
|
|
|
|
* ad1980.c -- ALSA Soc AD1980 codec support
|
|
|
|
*
|
|
|
|
* Copyright: Analog Device Inc.
|
|
|
|
* Author: Roy Huang <roy.huang@analog.com>
|
|
|
|
* Cliff Cai <cliff.cai@analog.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*/
|
|
|
|
|
2010-08-08 00:06:07 +08:00
|
|
|
/*
|
|
|
|
* WARNING:
|
|
|
|
*
|
|
|
|
* Because Analog Devices Inc. discontinued the ad1980 sound chip since
|
|
|
|
* Sep. 2009, this ad1980 driver is not maintained, tested and supported
|
|
|
|
* by ADI now.
|
|
|
|
*/
|
|
|
|
|
2008-07-29 18:42:34 +08:00
|
|
|
#include <linux/init.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 16:04:11 +08:00
|
|
|
#include <linux/slab.h>
|
2008-07-29 18:42:34 +08:00
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/device.h>
|
2014-11-19 02:45:53 +08:00
|
|
|
#include <linux/regmap.h>
|
2008-07-29 18:42:34 +08:00
|
|
|
#include <sound/core.h>
|
|
|
|
#include <sound/pcm.h>
|
|
|
|
#include <sound/ac97_codec.h>
|
|
|
|
#include <sound/initval.h>
|
|
|
|
#include <sound/soc.h>
|
|
|
|
|
2014-11-19 02:45:53 +08:00
|
|
|
static const struct reg_default ad1980_reg_defaults[] = {
|
|
|
|
{ 0x02, 0x8000 },
|
|
|
|
{ 0x04, 0x8000 },
|
|
|
|
{ 0x06, 0x8000 },
|
|
|
|
{ 0x0c, 0x8008 },
|
|
|
|
{ 0x0e, 0x8008 },
|
|
|
|
{ 0x10, 0x8808 },
|
|
|
|
{ 0x12, 0x8808 },
|
|
|
|
{ 0x16, 0x8808 },
|
|
|
|
{ 0x18, 0x8808 },
|
|
|
|
{ 0x1a, 0x0000 },
|
|
|
|
{ 0x1c, 0x8000 },
|
|
|
|
{ 0x20, 0x0000 },
|
|
|
|
{ 0x28, 0x03c7 },
|
|
|
|
{ 0x2c, 0xbb80 },
|
|
|
|
{ 0x2e, 0xbb80 },
|
|
|
|
{ 0x30, 0xbb80 },
|
|
|
|
{ 0x32, 0xbb80 },
|
|
|
|
{ 0x36, 0x8080 },
|
|
|
|
{ 0x38, 0x8080 },
|
|
|
|
{ 0x3a, 0x2000 },
|
|
|
|
{ 0x60, 0x0000 },
|
|
|
|
{ 0x62, 0x0000 },
|
|
|
|
{ 0x72, 0x0000 },
|
|
|
|
{ 0x74, 0x1001 },
|
|
|
|
{ 0x76, 0x0000 },
|
|
|
|
};
|
|
|
|
|
|
|
|
static bool ad1980_readable_reg(struct device *dev, unsigned int reg)
|
|
|
|
{
|
|
|
|
switch (reg) {
|
|
|
|
case AC97_RESET ... AC97_MASTER_MONO:
|
|
|
|
case AC97_PHONE ... AC97_CD:
|
|
|
|
case AC97_AUX ... AC97_GENERAL_PURPOSE:
|
|
|
|
case AC97_POWERDOWN ... AC97_PCM_LR_ADC_RATE:
|
|
|
|
case AC97_SPDIF:
|
|
|
|
case AC97_CODEC_CLASS_REV:
|
|
|
|
case AC97_PCI_SVID:
|
|
|
|
case AC97_AD_CODEC_CFG:
|
|
|
|
case AC97_AD_JACK_SPDIF:
|
|
|
|
case AC97_AD_SERIAL_CFG:
|
|
|
|
case AC97_VENDOR_ID1:
|
|
|
|
case AC97_VENDOR_ID2:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool ad1980_writeable_reg(struct device *dev, unsigned int reg)
|
|
|
|
{
|
|
|
|
switch (reg) {
|
|
|
|
case AC97_VENDOR_ID1:
|
|
|
|
case AC97_VENDOR_ID2:
|
|
|
|
return false;
|
|
|
|
default:
|
|
|
|
return ad1980_readable_reg(dev, reg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct regmap_config ad1980_regmap_config = {
|
|
|
|
.reg_bits = 16,
|
|
|
|
.reg_stride = 2,
|
|
|
|
.val_bits = 16,
|
|
|
|
.max_register = 0x7e,
|
|
|
|
.cache_type = REGCACHE_RBTREE,
|
|
|
|
|
|
|
|
.volatile_reg = regmap_ac97_default_volatile,
|
|
|
|
.readable_reg = ad1980_readable_reg,
|
|
|
|
.writeable_reg = ad1980_writeable_reg,
|
|
|
|
|
|
|
|
.reg_defaults = ad1980_reg_defaults,
|
|
|
|
.num_reg_defaults = ARRAY_SIZE(ad1980_reg_defaults),
|
2008-07-29 18:42:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char *ad1980_rec_sel[] = {"Mic", "CD", "NC", "AUX", "Line",
|
|
|
|
"Stereo Mix", "Mono Mix", "Phone"};
|
|
|
|
|
2014-02-18 16:56:40 +08:00
|
|
|
static SOC_ENUM_DOUBLE_DECL(ad1980_cap_src,
|
|
|
|
AC97_REC_SEL, 8, 0, ad1980_rec_sel);
|
2008-07-29 18:42:34 +08:00
|
|
|
|
|
|
|
static const struct snd_kcontrol_new ad1980_snd_ac97_controls[] = {
|
|
|
|
SOC_DOUBLE("Master Playback Volume", AC97_MASTER, 8, 0, 31, 1),
|
|
|
|
SOC_SINGLE("Master Playback Switch", AC97_MASTER, 15, 1, 1),
|
|
|
|
|
|
|
|
SOC_DOUBLE("Headphone Playback Volume", AC97_HEADPHONE, 8, 0, 31, 1),
|
|
|
|
SOC_SINGLE("Headphone Playback Switch", AC97_HEADPHONE, 15, 1, 1),
|
|
|
|
|
|
|
|
SOC_DOUBLE("PCM Playback Volume", AC97_PCM, 8, 0, 31, 1),
|
|
|
|
SOC_SINGLE("PCM Playback Switch", AC97_PCM, 15, 1, 1),
|
|
|
|
|
|
|
|
SOC_DOUBLE("PCM Capture Volume", AC97_REC_GAIN, 8, 0, 31, 0),
|
|
|
|
SOC_SINGLE("PCM Capture Switch", AC97_REC_GAIN, 15, 1, 1),
|
|
|
|
|
|
|
|
SOC_SINGLE("Mono Playback Volume", AC97_MASTER_MONO, 0, 31, 1),
|
|
|
|
SOC_SINGLE("Mono Playback Switch", AC97_MASTER_MONO, 15, 1, 1),
|
|
|
|
|
|
|
|
SOC_SINGLE("Phone Capture Volume", AC97_PHONE, 0, 31, 1),
|
|
|
|
SOC_SINGLE("Phone Capture Switch", AC97_PHONE, 15, 1, 1),
|
|
|
|
|
|
|
|
SOC_SINGLE("Mic Volume", AC97_MIC, 0, 31, 1),
|
|
|
|
SOC_SINGLE("Mic Switch", AC97_MIC, 15, 1, 1),
|
|
|
|
|
|
|
|
SOC_SINGLE("Stereo Mic Switch", AC97_AD_MISC, 6, 1, 0),
|
|
|
|
SOC_DOUBLE("Line HP Swap Switch", AC97_AD_MISC, 10, 5, 1, 0),
|
|
|
|
|
|
|
|
SOC_DOUBLE("Surround Playback Volume", AC97_SURROUND_MASTER, 8, 0, 31, 1),
|
|
|
|
SOC_DOUBLE("Surround Playback Switch", AC97_SURROUND_MASTER, 15, 7, 1, 1),
|
|
|
|
|
2008-11-18 16:18:16 +08:00
|
|
|
SOC_DOUBLE("Center/LFE Playback Volume", AC97_CENTER_LFE_MASTER, 8, 0, 31, 1),
|
|
|
|
SOC_DOUBLE("Center/LFE Playback Switch", AC97_CENTER_LFE_MASTER, 15, 7, 1, 1),
|
|
|
|
|
2008-07-29 18:42:34 +08:00
|
|
|
SOC_ENUM("Capture Source", ad1980_cap_src),
|
|
|
|
|
|
|
|
SOC_SINGLE("Mic Boost Switch", AC97_MIC, 6, 1, 0),
|
|
|
|
};
|
|
|
|
|
2013-08-07 06:51:12 +08:00
|
|
|
static const struct snd_soc_dapm_widget ad1980_dapm_widgets[] = {
|
|
|
|
SND_SOC_DAPM_INPUT("MIC1"),
|
|
|
|
SND_SOC_DAPM_INPUT("MIC2"),
|
|
|
|
SND_SOC_DAPM_INPUT("CD_L"),
|
|
|
|
SND_SOC_DAPM_INPUT("CD_R"),
|
|
|
|
SND_SOC_DAPM_INPUT("AUX_L"),
|
|
|
|
SND_SOC_DAPM_INPUT("AUX_R"),
|
|
|
|
SND_SOC_DAPM_INPUT("LINE_IN_L"),
|
|
|
|
SND_SOC_DAPM_INPUT("LINE_IN_R"),
|
|
|
|
|
|
|
|
SND_SOC_DAPM_OUTPUT("LFE_OUT"),
|
|
|
|
SND_SOC_DAPM_OUTPUT("CENTER_OUT"),
|
|
|
|
SND_SOC_DAPM_OUTPUT("LINE_OUT_L"),
|
|
|
|
SND_SOC_DAPM_OUTPUT("LINE_OUT_R"),
|
|
|
|
SND_SOC_DAPM_OUTPUT("MONO_OUT"),
|
|
|
|
SND_SOC_DAPM_OUTPUT("HP_OUT_L"),
|
|
|
|
SND_SOC_DAPM_OUTPUT("HP_OUT_R"),
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct snd_soc_dapm_route ad1980_dapm_routes[] = {
|
|
|
|
{ "Capture", NULL, "MIC1" },
|
|
|
|
{ "Capture", NULL, "MIC2" },
|
|
|
|
{ "Capture", NULL, "CD_L" },
|
|
|
|
{ "Capture", NULL, "CD_R" },
|
|
|
|
{ "Capture", NULL, "AUX_L" },
|
|
|
|
{ "Capture", NULL, "AUX_R" },
|
|
|
|
{ "Capture", NULL, "LINE_IN_L" },
|
|
|
|
{ "Capture", NULL, "LINE_IN_R" },
|
|
|
|
|
|
|
|
{ "LFE_OUT", NULL, "Playback" },
|
|
|
|
{ "CENTER_OUT", NULL, "Playback" },
|
|
|
|
{ "LINE_OUT_L", NULL, "Playback" },
|
|
|
|
{ "LINE_OUT_R", NULL, "Playback" },
|
|
|
|
{ "MONO_OUT", NULL, "Playback" },
|
|
|
|
{ "HP_OUT_L", NULL, "Playback" },
|
|
|
|
{ "HP_OUT_R", NULL, "Playback" },
|
|
|
|
};
|
|
|
|
|
2010-10-07 07:20:07 +08:00
|
|
|
static struct snd_soc_dai_driver ad1980_dai = {
|
2010-03-18 04:15:21 +08:00
|
|
|
.name = "ad1980-hifi",
|
2008-07-29 18:42:34 +08:00
|
|
|
.playback = {
|
|
|
|
.stream_name = "Playback",
|
|
|
|
.channels_min = 2,
|
2008-11-18 16:18:16 +08:00
|
|
|
.channels_max = 6,
|
2008-07-29 18:42:34 +08:00
|
|
|
.rates = SNDRV_PCM_RATE_48000,
|
2009-05-02 19:24:55 +08:00
|
|
|
.formats = SND_SOC_STD_AC97_FMTS, },
|
2008-07-29 18:42:34 +08:00
|
|
|
.capture = {
|
|
|
|
.stream_name = "Capture",
|
|
|
|
.channels_min = 2,
|
|
|
|
.channels_max = 2,
|
|
|
|
.rates = SNDRV_PCM_RATE_48000,
|
2009-05-02 19:24:55 +08:00
|
|
|
.formats = SND_SOC_STD_AC97_FMTS, },
|
2008-07-29 18:42:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static int ad1980_reset(struct snd_soc_codec *codec, int try_warm)
|
|
|
|
{
|
2014-11-11 05:41:53 +08:00
|
|
|
struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
|
2014-05-20 20:23:10 +08:00
|
|
|
unsigned int retry_cnt = 0;
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (try_warm && soc_ac97_ops->warm_reset) {
|
2014-11-11 05:41:53 +08:00
|
|
|
soc_ac97_ops->warm_reset(ac97);
|
2014-11-19 02:45:54 +08:00
|
|
|
if (snd_soc_read(codec, AC97_RESET) == 0x0090)
|
2014-05-20 20:23:10 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-11-11 05:41:53 +08:00
|
|
|
soc_ac97_ops->reset(ac97);
|
2014-05-20 20:23:10 +08:00
|
|
|
/*
|
|
|
|
* Set bit 16slot in register 74h, then every slot will has only
|
|
|
|
* 16 bits. This command is sent out in 20bit mode, in which
|
|
|
|
* case the first nibble of data is eaten by the addr. (Tag is
|
|
|
|
* always 16 bit)
|
|
|
|
*/
|
2014-11-19 02:45:54 +08:00
|
|
|
snd_soc_write(codec, AC97_AD_SERIAL_CFG, 0x9900);
|
2014-05-20 20:23:10 +08:00
|
|
|
|
2014-11-19 02:45:54 +08:00
|
|
|
if (snd_soc_read(codec, AC97_RESET) == 0x0090)
|
2014-05-20 20:23:10 +08:00
|
|
|
return 0;
|
|
|
|
} while (retry_cnt++ < 10);
|
2008-07-29 18:42:34 +08:00
|
|
|
|
2014-10-31 04:00:59 +08:00
|
|
|
dev_err(codec->dev, "Failed to reset: AC97 link error\n");
|
|
|
|
|
2008-07-29 18:42:34 +08:00
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
2010-03-18 04:15:21 +08:00
|
|
|
static int ad1980_soc_probe(struct snd_soc_codec *codec)
|
2008-07-29 18:42:34 +08:00
|
|
|
{
|
2014-11-11 05:41:53 +08:00
|
|
|
struct snd_ac97 *ac97;
|
2014-11-19 02:45:53 +08:00
|
|
|
struct regmap *regmap;
|
2010-03-18 04:15:21 +08:00
|
|
|
int ret;
|
2008-07-29 18:42:34 +08:00
|
|
|
u16 vendor_id2;
|
2008-11-18 16:18:16 +08:00
|
|
|
u16 ext_status;
|
2008-07-29 18:42:34 +08:00
|
|
|
|
2015-07-22 03:53:01 +08:00
|
|
|
ac97 = snd_soc_new_ac97_codec(codec, 0, 0);
|
2014-11-11 05:41:53 +08:00
|
|
|
if (IS_ERR(ac97)) {
|
|
|
|
ret = PTR_ERR(ac97);
|
|
|
|
dev_err(codec->dev, "Failed to register AC97 codec: %d\n", ret);
|
2010-03-18 04:15:21 +08:00
|
|
|
return ret;
|
2008-07-29 18:42:34 +08:00
|
|
|
}
|
|
|
|
|
2014-11-19 02:45:53 +08:00
|
|
|
regmap = regmap_init_ac97(ac97, &ad1980_regmap_config);
|
|
|
|
if (IS_ERR(regmap)) {
|
|
|
|
ret = PTR_ERR(regmap);
|
|
|
|
goto err_free_ac97;
|
|
|
|
}
|
|
|
|
|
|
|
|
snd_soc_codec_init_regmap(codec, regmap);
|
2014-11-11 05:41:53 +08:00
|
|
|
snd_soc_codec_set_drvdata(codec, ac97);
|
|
|
|
|
2008-07-29 18:42:34 +08:00
|
|
|
ret = ad1980_reset(codec, 0);
|
2014-10-31 04:00:59 +08:00
|
|
|
if (ret < 0)
|
2008-07-29 18:42:34 +08:00
|
|
|
goto reset_err;
|
|
|
|
|
|
|
|
/* Read out vendor ID to make sure it is ad1980 */
|
2014-11-19 02:45:54 +08:00
|
|
|
if (snd_soc_read(codec, AC97_VENDOR_ID1) != 0x4144) {
|
2011-09-06 10:37:48 +08:00
|
|
|
ret = -ENODEV;
|
2008-07-29 18:42:34 +08:00
|
|
|
goto reset_err;
|
2011-09-06 10:37:48 +08:00
|
|
|
}
|
2008-07-29 18:42:34 +08:00
|
|
|
|
2014-11-19 02:45:54 +08:00
|
|
|
vendor_id2 = snd_soc_read(codec, AC97_VENDOR_ID2);
|
2008-07-29 18:42:34 +08:00
|
|
|
|
|
|
|
if (vendor_id2 != 0x5370) {
|
2011-09-06 10:37:48 +08:00
|
|
|
if (vendor_id2 != 0x5374) {
|
|
|
|
ret = -ENODEV;
|
2008-07-29 18:42:34 +08:00
|
|
|
goto reset_err;
|
2011-09-06 10:37:48 +08:00
|
|
|
} else {
|
2014-10-31 04:00:59 +08:00
|
|
|
dev_warn(codec->dev,
|
|
|
|
"Found AD1981 - only 2/2 IN/OUT Channels supported\n");
|
2011-09-06 10:37:48 +08:00
|
|
|
}
|
2008-07-29 18:42:34 +08:00
|
|
|
}
|
|
|
|
|
2008-11-18 16:18:16 +08:00
|
|
|
/* unmute captures and playbacks volume */
|
2014-11-19 02:45:54 +08:00
|
|
|
snd_soc_write(codec, AC97_MASTER, 0x0000);
|
|
|
|
snd_soc_write(codec, AC97_PCM, 0x0000);
|
|
|
|
snd_soc_write(codec, AC97_REC_GAIN, 0x0000);
|
|
|
|
snd_soc_write(codec, AC97_CENTER_LFE_MASTER, 0x0000);
|
|
|
|
snd_soc_write(codec, AC97_SURROUND_MASTER, 0x0000);
|
2008-11-18 16:18:16 +08:00
|
|
|
|
|
|
|
/*power on LFE/CENTER/Surround DACs*/
|
2014-11-19 02:45:54 +08:00
|
|
|
ext_status = snd_soc_read(codec, AC97_EXTENDED_STATUS);
|
|
|
|
snd_soc_write(codec, AC97_EXTENDED_STATUS, ext_status&~0x3800);
|
2008-07-29 18:42:34 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
reset_err:
|
2014-11-19 02:45:53 +08:00
|
|
|
snd_soc_codec_exit_regmap(codec);
|
|
|
|
err_free_ac97:
|
2014-11-11 05:41:53 +08:00
|
|
|
snd_soc_free_ac97_codec(ac97);
|
2008-07-29 18:42:34 +08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-03-18 04:15:21 +08:00
|
|
|
static int ad1980_soc_remove(struct snd_soc_codec *codec)
|
2008-07-29 18:42:34 +08:00
|
|
|
{
|
2014-11-11 05:41:53 +08:00
|
|
|
struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
|
|
|
|
|
2014-11-19 02:45:53 +08:00
|
|
|
snd_soc_codec_exit_regmap(codec);
|
2014-11-11 05:41:53 +08:00
|
|
|
snd_soc_free_ac97_codec(ac97);
|
2008-07-29 18:42:34 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-03-18 04:15:21 +08:00
|
|
|
static struct snd_soc_codec_driver soc_codec_dev_ad1980 = {
|
2008-07-29 18:42:34 +08:00
|
|
|
.probe = ad1980_soc_probe,
|
|
|
|
.remove = ad1980_soc_remove,
|
2013-08-07 06:51:12 +08:00
|
|
|
|
2014-10-31 04:01:00 +08:00
|
|
|
.controls = ad1980_snd_ac97_controls,
|
|
|
|
.num_controls = ARRAY_SIZE(ad1980_snd_ac97_controls),
|
2013-08-07 06:51:12 +08:00
|
|
|
.dapm_widgets = ad1980_dapm_widgets,
|
|
|
|
.num_dapm_widgets = ARRAY_SIZE(ad1980_dapm_widgets),
|
|
|
|
.dapm_routes = ad1980_dapm_routes,
|
|
|
|
.num_dapm_routes = ARRAY_SIZE(ad1980_dapm_routes),
|
2008-07-29 18:42:34 +08:00
|
|
|
};
|
2010-03-18 04:15:21 +08:00
|
|
|
|
2012-12-07 22:26:37 +08:00
|
|
|
static int ad1980_probe(struct platform_device *pdev)
|
2010-03-18 04:15:21 +08:00
|
|
|
{
|
|
|
|
return snd_soc_register_codec(&pdev->dev,
|
|
|
|
&soc_codec_dev_ad1980, &ad1980_dai, 1);
|
|
|
|
}
|
|
|
|
|
2012-12-07 22:26:37 +08:00
|
|
|
static int ad1980_remove(struct platform_device *pdev)
|
2010-03-18 04:15:21 +08:00
|
|
|
{
|
|
|
|
snd_soc_unregister_codec(&pdev->dev);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct platform_driver ad1980_codec_driver = {
|
|
|
|
.driver = {
|
2011-03-27 12:44:13 +08:00
|
|
|
.name = "ad1980",
|
2010-03-18 04:15:21 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
.probe = ad1980_probe,
|
2012-12-07 22:26:37 +08:00
|
|
|
.remove = ad1980_remove,
|
2010-03-18 04:15:21 +08:00
|
|
|
};
|
|
|
|
|
2011-11-24 06:52:08 +08:00
|
|
|
module_platform_driver(ad1980_codec_driver);
|
2008-07-29 18:42:34 +08:00
|
|
|
|
2010-08-08 00:06:07 +08:00
|
|
|
MODULE_DESCRIPTION("ASoC ad1980 driver (Obsolete)");
|
2008-07-29 18:42:34 +08:00
|
|
|
MODULE_AUTHOR("Roy Huang, Cliff Cai");
|
|
|
|
MODULE_LICENSE("GPL");
|