Title: [8257] trunk/sound/soc/codecs: task[#5856]add AD74111 support,merge the code to ad73311
- Revision
- 8257
- Author
- cliff
- Date
- 2010-01-28 21:46:43 -0500 (Thu, 28 Jan 2010)
Log Message
task[#5856]add AD74111 support,merge the code to ad73311
Modified Paths
Diff
Modified: trunk/sound/soc/codecs/ad73311.c (8256 => 8257)
--- trunk/sound/soc/codecs/ad73311.c 2010-01-29 01:47:11 UTC (rev 8256)
+++ trunk/sound/soc/codecs/ad73311.c 2010-01-29 02:46:43 UTC (rev 8257)
@@ -1,5 +1,5 @@
/*
- * ad73311.c -- ALSA Soc AD73311 codec support
+ * ad73311.c -- ALSA Soc AD73311/AD74111 codec support
*
* Copyright: Analog Device Inc.
* Author: Cliff Cai <[email protected]>
@@ -20,10 +20,16 @@
#include <sound/initval.h>
#include <sound/soc.h>
+#if defined(CONFIG_SND_SOC_AD73311)
+#define DRV_NAME "AD73311"
+#elif defined(CONFIG_SND_SOC_AD74111)
+#define DRV_NAME "AD74111"
+#endif
+
#include "ad73311.h"
struct snd_soc_dai ad73311_dai = {
- .name = "AD73311",
+ .name = "DRV_NAME",
.playback = {
.stream_name = "Playback",
.channels_min = 1,
@@ -49,7 +55,7 @@
if (codec == NULL)
return -ENOMEM;
mutex_init(&codec->mutex);
- codec->name = "AD73311";
+ codec->name = "DRV_NAME";
codec->dev = &pdev->dev;
codec->owner = THIS_MODULE;
codec->dai = &ad73311_dai;
@@ -61,13 +67,13 @@
/* register pcms */
ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
if (ret < 0) {
- printk(KERN_ERR "ad73311: failed to create pcms\n");
+ printk(KERN_ERR "%s: failed to create pcms\n", DRV_NAME);
goto pcm_err;
}
ret = snd_soc_init_card(socdev);
if (ret < 0) {
- printk(KERN_ERR "ad73311: failed to register card\n");
+ printk(KERN_ERR "%s: failed to register card\n", DRV_NAME);
goto register_err;
}
@@ -111,6 +117,6 @@
}
module_exit(ad73311_exit);
-MODULE_DESCRIPTION("ASoC ad73311 driver");
+MODULE_DESCRIPTION("ASoC ad73311/ad74111 driver");
MODULE_AUTHOR("Cliff Cai ");
MODULE_LICENSE("GPL");
Modified: trunk/sound/soc/codecs/ad73311.h (8256 => 8257)
--- trunk/sound/soc/codecs/ad73311.h 2010-01-29 01:47:11 UTC (rev 8256)
+++ trunk/sound/soc/codecs/ad73311.h 2010-01-29 02:46:43 UTC (rev 8257)
@@ -31,6 +31,8 @@
#ifndef __AD73311_H__
#define __AD73311_H__
+#if defined(CONFIG_SND_SOC_AD73311)
+
#define AD_CONTROL 0x8000
#define AD_DATA 0x0000
#define AD_READ 0x4000
@@ -85,6 +87,61 @@
#define REGF_INV (1 << 6)
#define REGF_ALB (1 << 7)
+#elif defined(CONFIG_SND_SOC_AD74111)
+
+#define AD_READ 0x0000
+#define AD_WRITE 0x8000
+
+/* Control register A */
+#define CTRL_REG_A (0 << 11)
+
+#define REGA_REFAMP (1 << 2)
+#define REGA_REF (1 << 3)
+#define REGA_DAC (1 << 4)
+#define REGA_ADC (1 << 5)
+#define REGA_ADC_INPAMP (1 << 6)
+
+/* Control register B */
+#define CTRL_REG_B (1 << 11)
+
+#define REGB_FCLKDIV(x) (x & 0x3)
+#define REGB_SCLKDIV(x) ((x & 0x3) << 2)
+#define REGB_TCLKDIV(x) ((x & 0x3) << 4)
+
+/* Control register C */
+#define CTRL_REG_C (2 << 11)
+
+#define REGC_ADC_HP (1 << 0)
+#define REGC_DAC_DEEMPH(x) ((x & 0x3) << 1)
+#define REGC_LG_DELAY (1 << 3)
+#define REGC_WORD_WIDTH(x) ((x & 0x3) << 4)
+
+/* Control register D */
+#define CTRL_REG_D (3 << 11)
+
+#define REGD_MASTER (1 << 0)
+#define REGD_FDCLK (1 << 1)
+#define REGD_DSP_MODE (1 << 2)
+#define REGD_MIX_MODE (1 << 3)
+#define REGD_MFS (1 << 9)
+
+/* Control register E */
+#define CTRL_REG_E (4 << 11)
+
+#define REGE_DAC_MUTE (1 << 0)
+#define REGE_ADC_MUTE (1 << 1)
+#define REGE_ADC_GAIN(x) ((x & 0x7) << 2)
+#define REGE_ADC_PEAKEN (1 << 5)
+
+/* Control register F */
+#define CTRL_REG_F (5 << 11)
+#define REGF_DAC_VOL(x) (x & 0x3F)
+
+/* Control register G */
+#define CTRL_REG_F (6 << 11)
+#define REGF_DAC_VOL(x) (x & 0x1FF)
+#endif
+
extern struct snd_soc_dai ad73311_dai;
extern struct snd_soc_codec_device soc_codec_dev_ad73311;
#endif
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits