diff options
| author | Oder Chiou <oder_chiou@realtek.com> | 2014-05-26 08:32:33 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@linaro.org> | 2014-06-01 15:18:21 -0400 |
| commit | 0e826e86726423df5c3841d0a34a2edcd64a93e2 (patch) | |
| tree | 62a33da41748ab5709f8b6e0d199e3a82e709d8a | |
| parent | 15f78ea67fa712392daebc262821d9fe29705cfa (diff) | |
ASoC: add RT5677 CODEC driver
This patch adds the Realtek ALC5677 codec driver.
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
| -rw-r--r-- | include/sound/rt5677.h | 21 | ||||
| -rw-r--r-- | sound/soc/codecs/Kconfig | 4 | ||||
| -rw-r--r-- | sound/soc/codecs/Makefile | 2 | ||||
| -rw-r--r-- | sound/soc/codecs/rt5677.c | 3498 | ||||
| -rw-r--r-- | sound/soc/codecs/rt5677.h | 1451 |
5 files changed, 4976 insertions, 0 deletions
diff --git a/include/sound/rt5677.h b/include/sound/rt5677.h new file mode 100644 index 000000000000..3da14313bcfc --- /dev/null +++ b/include/sound/rt5677.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* | ||
| 2 | * linux/sound/rt5677.h -- Platform data for RT5677 | ||
| 3 | * | ||
| 4 | * Copyright 2013 Realtek Semiconductor Corp. | ||
| 5 | * Author: Oder Chiou <oder_chiou@realtek.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef __LINUX_SND_RT5677_H | ||
| 13 | #define __LINUX_SND_RT5677_H | ||
| 14 | |||
| 15 | struct rt5677_platform_data { | ||
| 16 | /* IN1 IN2 can optionally be differential */ | ||
| 17 | bool in1_diff; | ||
| 18 | bool in2_diff; | ||
| 19 | }; | ||
| 20 | |||
| 21 | #endif | ||
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index d29f19b44638..34422dc1e951 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
| @@ -73,6 +73,7 @@ config SND_SOC_ALL_CODECS | |||
| 73 | select SND_SOC_RT5640 if I2C | 73 | select SND_SOC_RT5640 if I2C |
| 74 | select SND_SOC_RT5645 if I2C | 74 | select SND_SOC_RT5645 if I2C |
| 75 | select SND_SOC_RT5651 if I2C | 75 | select SND_SOC_RT5651 if I2C |
| 76 | select SND_SOC_RT5677 if I2C | ||
| 76 | select SND_SOC_SGTL5000 if I2C | 77 | select SND_SOC_SGTL5000 if I2C |
| 77 | select SND_SOC_SI476X if MFD_SI476X_CORE | 78 | select SND_SOC_SI476X if MFD_SI476X_CORE |
| 78 | select SND_SOC_SIRF_AUDIO_CODEC | 79 | select SND_SOC_SIRF_AUDIO_CODEC |
| @@ -404,6 +405,9 @@ config SND_SOC_RT5645 | |||
| 404 | config SND_SOC_RT5651 | 405 | config SND_SOC_RT5651 |
| 405 | tristate | 406 | tristate |
| 406 | 407 | ||
| 408 | config SND_SOC_RT5677 | ||
| 409 | tristate | ||
| 410 | |||
| 407 | #Freescale sgtl5000 codec | 411 | #Freescale sgtl5000 codec |
| 408 | config SND_SOC_SGTL5000 | 412 | config SND_SOC_SGTL5000 |
| 409 | tristate "Freescale SGTL5000 CODEC" | 413 | tristate "Freescale SGTL5000 CODEC" |
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index a3d12b4af1e7..397f18f3a9f9 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile | |||
| @@ -62,6 +62,7 @@ snd-soc-rt5631-objs := rt5631.o | |||
| 62 | snd-soc-rt5640-objs := rt5640.o | 62 | snd-soc-rt5640-objs := rt5640.o |
| 63 | snd-soc-rt5645-objs := rt5645.o | 63 | snd-soc-rt5645-objs := rt5645.o |
| 64 | snd-soc-rt5651-objs := rt5651.o | 64 | snd-soc-rt5651-objs := rt5651.o |
| 65 | snd-soc-rt5677-objs := rt5677.o | ||
| 65 | snd-soc-sgtl5000-objs := sgtl5000.o | 66 | snd-soc-sgtl5000-objs := sgtl5000.o |
| 66 | snd-soc-alc5623-objs := alc5623.o | 67 | snd-soc-alc5623-objs := alc5623.o |
| 67 | snd-soc-alc5632-objs := alc5632.o | 68 | snd-soc-alc5632-objs := alc5632.o |
| @@ -215,6 +216,7 @@ obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o | |||
| 215 | obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o | 216 | obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o |
| 216 | obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o | 217 | obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o |
| 217 | obj-$(CONFIG_SND_SOC_RT5651) += snd-soc-rt5651.o | 218 | obj-$(CONFIG_SND_SOC_RT5651) += snd-soc-rt5651.o |
| 219 | obj-$(CONFIG_SND_SOC_RT5677) += snd-soc-rt5677.o | ||
| 218 | obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o | 220 | obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o |
| 219 | obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o | 221 | obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o |
| 220 | obj-$(CONFIG_SND_SOC_SI476X) += snd-soc-si476x.o | 222 | obj-$(CONFIG_SND_SOC_SI476X) += snd-soc-si476x.o |
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c new file mode 100644 index 000000000000..833231e27340 --- /dev/null +++ b/sound/soc/codecs/rt5677.c | |||
| @@ -0,0 +1,3498 @@ | |||
| 1 | /* | ||
| 2 | * rt5677.c -- RT5677 ALSA SoC audio codec driver | ||
| 3 | * | ||
| 4 | * Copyright 2013 Realtek Semiconductor Corp. | ||
| 5 | * Author: Oder Chiou <oder_chiou@realtek.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/fs.h> | ||
| 13 | #include <linux/module.h> | ||
| 14 | #include <linux/moduleparam.h> | ||
| 15 | #include <linux/init.h> | ||
| 16 | #include <linux/delay.h> | ||
| 17 | #include <linux/pm.h> | ||
| 18 | #include <linux/regmap.h> | ||
| 19 | #include <linux/i2c.h> | ||
| 20 | #include <linux/platform_device.h> | ||
| 21 | #include <linux/spi/spi.h> | ||
| 22 | #include <sound/core.h> | ||
| 23 | #include <sound/pcm.h> | ||
| 24 | #include <sound/pcm_params.h> | ||
| 25 | #include <sound/soc.h> | ||
| 26 | #include <sound/soc-dapm.h> | ||
| 27 | #include <sound/initval.h> | ||
| 28 | #include <sound/tlv.h> | ||
| 29 | |||
| 30 | #include "rt5677.h" | ||
| 31 | |||
| 32 | #define RT5677_DEVICE_ID 0x6327 | ||
| 33 | |||
| 34 | #define RT5677_PR_RANGE_BASE (0xff + 1) | ||
| 35 | #define RT5677_PR_SPACING 0x100 | ||
| 36 | |||
| 37 | #define RT5677_PR_BASE (RT5677_PR_RANGE_BASE + (0 * RT5677_PR_SPACING)) | ||
| 38 | |||
| 39 | static const struct regmap_range_cfg rt5677_ranges[] = { | ||
| 40 | { | ||
| 41 | .name = "PR", | ||
| 42 | .range_min = RT5677_PR_BASE, | ||
| 43 | .range_max = RT5677_PR_BASE + 0xfd, | ||
| 44 | .selector_reg = RT5677_PRIV_INDEX, | ||
| 45 | .selector_mask = 0xff, | ||
| 46 | .selector_shift = 0x0, | ||
| 47 | .window_start = RT5677_PRIV_DATA, | ||
| 48 | .window_len = 0x1, | ||
| 49 | }, | ||
| 50 | }; | ||
| 51 | |||
| 52 | static const struct reg_default init_list[] = { | ||
| 53 | {RT5677_PR_BASE + 0x3d, 0x364d}, | ||
| 54 | {RT5677_PR_BASE + 0x17, 0x4fc0}, | ||
| 55 | {RT5677_PR_BASE + 0x13, 0x0312}, | ||
| 56 | {RT5677_PR_BASE + 0x1e, 0x0000}, | ||
| 57 | {RT5677_PR_BASE + 0x12, 0x0eaa}, | ||
| 58 | {RT5677_PR_BASE + 0x14, 0x018a}, | ||
| 59 | }; | ||
| 60 | #define RT5677_INIT_REG_LEN ARRAY_SIZE(init_list) | ||
| 61 | |||
| 62 | static const struct reg_default rt5677_reg[] = { | ||
| 63 | {RT5677_RESET , 0x0000}, | ||
| 64 | {RT5677_LOUT1 , 0xa800}, | ||
| 65 | {RT5677_IN1 , 0x0000}, | ||
| 66 | {RT5677_MICBIAS , 0x0000}, | ||
| 67 | {RT5677_SLIMBUS_PARAM , 0x0000}, | ||
| 68 | {RT5677_SLIMBUS_RX , 0x0000}, | ||
| 69 | {RT5677_SLIMBUS_CTRL , 0x0000}, | ||
| 70 | {RT5677_SIDETONE_CTRL , 0x000b}, | ||
| 71 | {RT5677_ANA_DAC1_2_3_SRC , 0x0000}, | ||
| 72 | {RT5677_IF_DSP_DAC3_4_MIXER , 0x1111}, | ||
| 73 | {RT5677_DAC4_DIG_VOL , 0xafaf}, | ||
| 74 | {RT5677_DAC3_DIG_VOL , 0xafaf}, | ||
| 75 | {RT5677_DAC1_DIG_VOL , 0xafaf}, | ||
| 76 | {RT5677_DAC2_DIG_VOL , 0xafaf}, | ||
| 77 | {RT5677_IF_DSP_DAC2_MIXER , 0x0011}, | ||
| 78 | {RT5677_STO1_ADC_DIG_VOL , 0x2f2f}, | ||
| 79 | {RT5677_MONO_ADC_DIG_VOL , 0x2f2f}, | ||
| 80 | {RT5677_STO1_2_ADC_BST , 0x0000}, | ||
| 81 | {RT5677_STO2_ADC_DIG_VOL , 0x2f2f}, | ||
| 82 | {RT5677_ADC_BST_CTRL2 , 0x0000}, | ||
| 83 | {RT5677_STO3_4_ADC_BST , 0x0000}, | ||
| 84 | {RT5677_STO3_ADC_DIG_VOL , 0x2f2f}, | ||
| 85 | {RT5677_STO4_ADC_DIG_VOL , 0x2f2f}, | ||
| 86 | {RT5677_STO4_ADC_MIXER , 0xd4c0}, | ||
| 87 | {RT5677_STO3_ADC_MIXER , 0xd4c0}, | ||
| 88 | {RT5677_STO2_ADC_MIXER , 0xd4c0}, | ||
| 89 | {RT5677_STO1_ADC_MIXER , 0xd4c0}, | ||
| 90 | {RT5677_MONO_ADC_MIXER , 0xd4d1}, | ||
| 91 | {RT5677_ADC_IF_DSP_DAC1_MIXER , 0x8080}, | ||
| 92 | {RT5677_STO1_DAC_MIXER , 0xaaaa}, | ||
| 93 | {RT5677_MONO_DAC_MIXER , 0xaaaa}, | ||
| 94 | {RT5677_DD1_MIXER , 0xaaaa}, | ||
| 95 | {RT5677_DD2_MIXER , 0xaaaa}, | ||
| 96 | {RT5677_IF3_DATA , 0x0000}, | ||
| 97 | {RT5677_IF4_DATA , 0x0000}, | ||
| 98 | {RT5677_PDM_OUT_CTRL , 0x8888}, | ||
| 99 | {RT5677_PDM_DATA_CTRL1 , 0x0000}, | ||
| 100 | {RT5677_PDM_DATA_CTRL2 , 0x0000}, | ||
| 101 | {RT5677_PDM1_DATA_CTRL2 , 0x0000}, | ||
| 102 | {RT5677_PDM1_DATA_CTRL3 , 0x0000}, | ||
| 103 | {RT5677_PDM1_DATA_CTRL4 , 0x0000}, | ||
| 104 | {RT5677_PDM2_DATA_CTRL2 , 0x0000}, | ||
| 105 | {RT5677_PDM2_DATA_CTRL3 , 0x0000}, | ||
| 106 | {RT5677_PDM2_DATA_CTRL4 , 0x0000}, | ||
| 107 | {RT5677_TDM1_CTRL1 , 0x0300}, | ||
| 108 | {RT5677_TDM1_CTRL2 , 0x0000}, | ||
| 109 | {RT5677_TDM1_CTRL3 , 0x4000}, | ||
| 110 | {RT5677_TDM1_CTRL4 , 0x0123}, | ||
| 111 | {RT5677_TDM1_CTRL5 , 0x4567}, | ||
| 112 | {RT5677_TDM2_CTRL1 , 0x0300}, | ||
| 113 | {RT5677_TDM2_CTRL2 , 0x0000}, | ||
| 114 | {RT5677_TDM2_CTRL3 , 0x4000}, | ||
| 115 | {RT5677_TDM2_CTRL4 , 0x0123}, | ||
| 116 | {RT5677_TDM2_CTRL5 , 0x4567}, | ||
| 117 | {RT5677_I2C_MASTER_CTRL1 , 0x0001}, | ||
| 118 | {RT5677_I2C_MASTER_CTRL2 , 0x0000}, | ||
| 119 | {RT5677_I2C_MASTER_CTRL3 , 0x0000}, | ||
| 120 | {RT5677_I2C_MASTER_CTRL4 , 0x0000}, | ||
| 121 | {RT5677_I2C_MASTER_CTRL5 , 0x0000}, | ||
| 122 | {RT5677_I2C_MASTER_CTRL6 , 0x0000}, | ||
| 123 | {RT5677_I2C_MASTER_CTRL7 , 0x0000}, | ||
| 124 | {RT5677_I2C_MASTER_CTRL8 , 0x0000}, | ||
| 125 | {RT5677_DMIC_CTRL1 , 0x1505}, | ||
| 126 | {RT5677_DMIC_CTRL2 , 0x0055}, | ||
| 127 | {RT5677_HAP_GENE_CTRL1 , 0x0111}, | ||
| 128 | {RT5677_HAP_GENE_CTRL2 , 0x0064}, | ||
| 129 | {RT5677_HAP_GENE_CTRL3 , 0xef0e}, | ||
| 130 | {RT5677_HAP_GENE_CTRL4 , 0xf0f0}, | ||
| 131 | {RT5677_HAP_GENE_CTRL5 , 0xef0e}, | ||
| 132 | {RT5677_HAP_GENE_CTRL6 , 0xf0f0}, | ||
| 133 | {RT5677_HAP_GENE_CTRL7 , 0xef0e}, | ||
| 134 | {RT5677_HAP_GENE_CTRL8 , 0x | ||
