summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0063-beaglebone-dvi-cape-audio-hacks.patch
blob: f429e74fff634a88daf2f0e2367af252b673e26e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
From 81ca4844089a80e1b1a285ce661f662a04312e81 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Wed, 23 May 2012 15:51:12 +0200
Subject: [PATCH 63/79] beaglebone: dvi cape audio hacks

---
 arch/arm/mach-omap2/board-am335xevm.c |   72 ++++++++++++++++++++++++++-------
 arch/arm/mach-omap2/devices.c         |    2 +-
 sound/soc/codecs/tlv320aic3x.c        |    2 +-
 sound/soc/davinci/davinci-evm.c       |    7 ++--
 4 files changed, 64 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index e8ce381..1f2d1fd 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -43,6 +43,8 @@
 #include <linux/can/platform/mcp251x.h>
 #include <linux/input/ti_tscadc.h>
 
+#include <sound/tlv320aic3x.h>
+
 /* LCD controller is similar to DA850 */
 #include <video/da8xx-fb.h>
 
@@ -315,7 +317,7 @@ static struct tsc_data bone_touchscreen_data  = {
 };
 
 static u8 am335x_iis_serializer_direction1[] = {
-	INACTIVE_MODE,	INACTIVE_MODE,	TX_MODE,	RX_MODE,
+	INACTIVE_MODE,	INACTIVE_MODE,	RX_MODE,	TX_MODE,
 	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
 	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
 	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
@@ -334,6 +336,19 @@ static struct snd_platform_data am335x_evm_snd_data1 = {
 	.rxnumevt	= 1,
 };
 
+static struct snd_platform_data bone_snd_data1 = {
+	.tx_dma_offset	= 0x46000000,	/* McASP0*/
+	.rx_dma_offset	= 0x46000000,
+	.op_mode	= DAVINCI_MCASP_IIS_MODE,
+	.num_serializer	= ARRAY_SIZE(am335x_iis_serializer_direction1),
+	.tdm_slots	= 2,
+	.serial_dir	= am335x_iis_serializer_direction1,
+	.asp_chan_q	= EVENTQ_2,
+	.version	= MCASP_VERSION_3,
+	.txnumevt	= 1,
+	.rxnumevt	= 1,
+};
+
 static struct omap2_hsmmc_info am335x_mmc[] __initdata = {
 	{
 		.mmc            = 1,
@@ -796,11 +811,18 @@ static struct pinmux_config mcasp1_pin_mux[] = {
 	{"mii1_crs.mcasp1_aclkx", OMAP_MUX_MODE4 | AM33XX_PIN_INPUT_PULLDOWN},
 	{"mii1_rxerr.mcasp1_fsx", OMAP_MUX_MODE4 | AM33XX_PIN_INPUT_PULLDOWN},
 	{"mii1_col.mcasp1_axr2", OMAP_MUX_MODE4 | AM33XX_PIN_INPUT_PULLDOWN},
-	{"rmii1_refclk.mcasp1_axr3", OMAP_MUX_MODE4 |
-						AM33XX_PIN_INPUT_PULLDOWN},
+	{"rmii1_refclk.mcasp1_axr3", OMAP_MUX_MODE4 | AM33XX_PIN_INPUT_PULLDOWN},
 	{NULL, 0},
 };
 
+/* Module pin mux for mcasp0 */
+static struct pinmux_config mcasp0_pin_mux[] = {
+	{"mcasp0_aclkx.mcasp0_aclkx", OMAP_MUX_MODE0 |AM33XX_PIN_INPUT_PULLDOWN},
+	{"mcasp0_fsx.mcasp0_fsx", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLDOWN},
+	{"mcasp0_ahclkr.mcasp0_axr2", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLDOWN},
+	{"mcasp0_ahclkx.mcasp0_axr3", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLDOWN},
+	{NULL, 0},
+};
 
 /* Module pin mux for mmc0 */
 static struct pinmux_config mmc0_pin_mux[] = {
@@ -1956,6 +1978,15 @@ static void evm_nand_init(int evm_id, int profile)
 	omap_init_elm();
 }
 
+static struct regulator_consumer_supply bone_audio_supplies[] = {
+        /* tlv320aic3x analog supplies */
+        REGULATOR_SUPPLY("AVDD", "3-001b"),
+        REGULATOR_SUPPLY("DRVDD", "3-001b"),
+        /* tlv320aic3x digital supplies */
+        REGULATOR_SUPPLY("IOVDD", "3-001b"),
+        REGULATOR_SUPPLY("DVDD", "3-001b"),
+};
+
 /* TPS65217 voltage regulator support */
 
 /* 1.8V */
@@ -2229,6 +2260,25 @@ static void tt3201_init(int evm_id, int profile)
 	am33xx_d_can_init(1);
 }
 
+/* Setup McASP 1 */
+static void mcasp1_init(int evm_id, int profile)
+{
+	/* Configure McASP */
+	setup_pin_mux(mcasp1_pin_mux);
+	am335x_register_mcasp(&am335x_evm_snd_data1, 1);
+	return;
+}
+
+/* Setup McASP 0 */
+static void mcasp0_init(int evm_id, int profile)
+{
+	printk("Beaglebone cape: mcasp0 init\n");
+	/* Configure McASP */
+	setup_pin_mux(mcasp0_pin_mux);
+	am335x_register_mcasp(&bone_snd_data1, 0);
+	return;
+}
+
 static const char* cape_pins[] = {
 /*
   From SRM RevA5.0.1:
@@ -2567,7 +2617,8 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context
 		
 		beaglebone_leds_free = 0;
 		dvileds_init(0,0);
-		
+		mcasp0_init(0,0);
+	
 		if (!strncmp("00A1", cape_config.version, 4) || !strncmp("000A", cape_config.version, 4)) {
 			pr_info("BeagleBone cape: DVI init for revision A1 or older\n");
 			setup_pin_mux(dvia1_pin_mux);
@@ -2715,6 +2766,9 @@ static struct at24_platform_data cape_eeprom_info = {
 };
 
 static struct i2c_board_info __initdata cape_i2c_boardinfo[] = {
+	{
+		I2C_BOARD_INFO("tlv320aic3x", 0x1b),
+	},
         {
                 I2C_BOARD_INFO("24c256", 0x54),
                 .platform_data  = &cape_eeprom_info,
@@ -2741,16 +2795,6 @@ static void i2c2_init(int evm_id, int profile)
         return;
 }
 
-
-/* Setup McASP 1 */
-static void mcasp1_init(int evm_id, int profile)
-{
-	/* Configure McASP */
-	setup_pin_mux(mcasp1_pin_mux);
-	am335x_register_mcasp(&am335x_evm_snd_data1, 1);
-	return;
-}
-
 static void mmc1_init(int evm_id, int profile)
 {
 	setup_pin_mux(mmc1_pin_mux);
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 9e029da..41c9b0f 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -218,7 +218,6 @@ int __init am335x_register_mcasp(struct snd_platform_data *pdata, int ctrl_nr)
 			dev_name, oh->name);
 	return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
 }
-
 #else
 int __init am335x_register_mcasp(struct snd_platform_data *pdata, int ctrl_nr)
 {
@@ -234,6 +233,7 @@ struct platform_device am33xx_pcm_device = {
 
 static void am33xx_init_pcm(void)
 {
+	printk("cape: pcm register");
 	platform_device_register(&am33xx_pcm_device);
 }
 
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index cdb473c..5567756 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -52,7 +52,7 @@
 
 #include "tlv320aic3x.h"
 
-#define AIC3X_NUM_SUPPLIES	4
+#define AIC3X_NUM_SUPPLIES	0
 static const char *aic3x_supply_names[AIC3X_NUM_SUPPLIES] = {
 	"IOVDD",	/* I/O Voltage */
 	"DVDD",		/* Digital Core Voltage */
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index f6a62c3..7ad7b37 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -244,9 +244,9 @@ static struct snd_soc_dai_link da850_evm_dai = {
 static struct snd_soc_dai_link am335x_evm_dai = {
 	.name = "TLV320AIC3X",
 	.stream_name = "AIC3X",
-	.cpu_dai_name = "davinci-mcasp.1",
+	.cpu_dai_name = "davinci-mcasp.0",
 	.codec_dai_name = "tlv320aic3x-hifi",
-	.codec_name = "tlv320aic3x-codec.2-001b",
+	.codec_name = "tlv320aic3x-codec.3-001b",
 	.platform_name = "davinci-pcm-audio",
 	.init = evm_aic3x_init,
 	.ops = &evm_ops,
@@ -331,8 +331,9 @@ static int __init evm_init(void)
 		return -EINVAL;
 
 	evm_snd_device = platform_device_alloc("soc-audio", index);
-	if (!evm_snd_device)
+	if (!evm_snd_device) {
 		return -ENOMEM;
+	}
 
 	platform_set_drvdata(evm_snd_device, evm_snd_dev_data);
 	ret = platform_device_add(evm_snd_device);
-- 
1.7.10