1/*
2 * Copyright (C) 2018 Logic PD, Inc - http://www.logicpd.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <dt-bindings/input/input.h>
10
11/ {
12	codec1 {
13		compatible = "simple-audio-card";
14		simple-audio-card,name = "tlv320aic23-hifi";
15
16		simple-audio-card,widgets =
17			"Microphone", "Mic In",
18			"Line", "Line In",
19			"Line", "Line Out";
20
21		simple-audio-card,routing =
22			"Line Out", "LOUT",
23			"Line Out", "ROUT",
24			"LLINEIN", "Line In",
25			"RLINEIN", "Line In",
26			"MICIN", "Mic In";
27
28		simple-audio-card,format = "i2s";
29		simple-audio-card,bitclock-master = <&sound_master>;
30		simple-audio-card,frame-master = <&sound_master>;
31
32		simple-audio-card,cpu {
33			sound-dai = <&mcbsp1>;
34		};
35
36		sound_master: simple-audio-card,codec {
37			sound-dai = <&tlv320aic23_1>;
38			system-clock-frequency = <12000000>;
39		};
40	};
41
42	codec2 {
43		compatible = "simple-audio-card";
44		simple-audio-card,name = "tlv320aic23-hifi";
45
46		simple-audio-card,widgets =
47			"Microphone", "Mic In",
48			"Line", "Line In",
49			"Line", "Line Out";
50
51		simple-audio-card,routing =
52			"Line Out", "LOUT",
53			"Line Out", "ROUT",
54			"LLINEIN", "Line In",
55			"RLINEIN", "Line In",
56			"MICIN", "Mic In";
57
58		simple-audio-card,format = "i2s";
59		simple-audio-card,bitclock-master = <&sound_master2>;
60		simple-audio-card,frame-master = <&sound_master2>;
61
62		simple-audio-card,cpu {
63			sound-dai = <&mcbsp2>;
64		};
65
66		sound_master2: simple-audio-card,codec {
67			sound-dai = <&tlv320aic23_2>;
68			system-clock-frequency = <12000000>;
69		};
70	};
71
72	expander-keys {
73		compatible = "gpio-keys-polled";
74		poll-interval = <100>;
75
76		record {
77			label = "Record";
78			/* linux,code = <BTN_0>; */
79			gpios = <&tca6416_2 15 GPIO_ACTIVE_LOW>;
80		};
81
82		play {
83			label = "Play";
84			linux,code = <KEY_PLAY>;
85			gpios = <&tca6416_2 14 GPIO_ACTIVE_LOW>;
86		};
87
88		Stop {
89			label = "Stop";
90			linux,code = <KEY_STOP>;
91			gpios = <&tca6416_2 13 GPIO_ACTIVE_LOW>;
92		};
93
94		fwd {
95			label = "FWD";
96			linux,code = <KEY_FASTFORWARD>;
97			gpios = <&tca6416_2 12 GPIO_ACTIVE_LOW>;
98		};
99
100		rwd {
101			label = "RWD";
102			linux,code = <KEY_REWIND>;
103			gpios = <&tca6416_2 11 GPIO_ACTIVE_LOW>;
104		};
105
106		shift {
107			label = "Shift";
108			linux,code = <KEY_LEFTSHIFT>;
109			gpios = <&tca6416_2 10 GPIO_ACTIVE_LOW>;
110		};
111
112		Mode {
113			label = "Mode";
114			linux,code = <BTN_MODE>;
115			gpios = <&tca6416_2 9 GPIO_ACTIVE_LOW>;
116		};
117
118		Menu {
119			label = "Menu";
120			linux,code = <KEY_MENU>;
121			gpios = <&tca6416_2 8 GPIO_ACTIVE_LOW>;
122		};
123
124		Up {
125			label = "Up";
126			linux,code = <KEY_UP>;
127			gpios = <&tca6416_2 7 GPIO_ACTIVE_LOW>;
128		};
129
130		Down {
131			label = "Down";
132			linux,code = <KEY_DOWN>;
133			gpios = <&tca6416_2 6 GPIO_ACTIVE_LOW>;
134		};
135	};
136};
137
138&i2c2 {
139	/* Audio codecs */
140	tlv320aic23_1: codec@1a {
141		compatible = "ti,tlv320aic23";
142		reg = <0x1a>;
143		#sound-dai-cells= <0>;
144		status = "okay";
145	};
146
147	tlv320aic23_2: codec@1b {
148		compatible = "ti,tlv320aic23";
149		reg = <0x1b>;
150		#sound-dai-cells= <0>;
151		status = "okay";
152	};
153};
154
155&i2c3 {
156	/* Audio codecs */
157	tlv320aic23_3: codec@1a {
158		compatible = "ti,tlv320aic23";
159		reg = <0x1a>;
160		#sound-dai-cells= <0>;
161		status = "okay";
162	};
163
164	/* GPIO Expanders */
165	tca6416_2: gpio@20 {
166		compatible = "ti,tca6416";
167		reg = <0x20>;
168		gpio-controller;
169		#gpio-cells = <2>;
170		vcc-supply = <&vdd_io_reg>;
171	};
172
173	tca6416_3: gpio@21 {
174		compatible = "ti,tca6416";
175		reg = <0x21>;
176		gpio-controller;
177		#gpio-cells = <2>;
178		vcc-supply = <&vdd_io_reg>;
179	};
180
181	/* TVP5146 Analog Video decoder input */
182	tvp5146@5c {
183		compatible = "ti,tvp5146m2";
184		reg = <0x5c>;
185	};
186};
187
188&mcbsp1 {
189	status = "ok";
190	#sound-dai-cells = <0>;
191	pinctrl-names = "default";
192	pinctrl-0 = <&mcbsp1_pins>;
193};
194
195&mcbsp2 {
196	status = "ok";
197	#sound-dai-cells = <0>;
198	pinctrl-names = "default";
199	pinctrl-0 = <&mcbsp2_pins>;
200};
201
202&omap3_pmx_core {
203	mcbsp1_pins: pinmux_mcbsp1_pins {
204		pinctrl-single,pins = <
205			OMAP3_CORE1_IOPAD(0x2190, PIN_OUTPUT | MUX_MODE0)	/* mcbsp1_dx.mcbsp1_dx */
206			OMAP3_CORE1_IOPAD(0x2192, PIN_INPUT | MUX_MODE0)	/* mcbsp1_dx.mcbsp1_dr */
207			OMAP3_CORE1_IOPAD(0x2196, PIN_INPUT | MUX_MODE0)	/* mcbsp_clks.mcbsp1_fsx */
208			OMAP3_CORE1_IOPAD(0x2198, PIN_INPUT | MUX_MODE0)	/* mcbsp1_clkx.mcbsp1_clkx */
209		>;
210	};
211
212	mcbsp2_pins: pinmux_mcbsp2_pins {
213		pinctrl-single,pins = <
214			OMAP3_CORE1_IOPAD(0x213c, PIN_INPUT | MUX_MODE0)	/* mcbsp2_fsx.mcbsp2_fsx */
215			OMAP3_CORE1_IOPAD(0x213e, PIN_INPUT | MUX_MODE0)	/* mcbsp2_clkx.mcbsp2_clkx */
216			OMAP3_CORE1_IOPAD(0x2140, PIN_INPUT | MUX_MODE0)	/* mcbsp2_dr.mcbsp2.dr */
217			OMAP3_CORE1_IOPAD(0x2142, PIN_OUTPUT | MUX_MODE0)	/* mcbsp2_dx.mcbsp2_dx */
218		>;
219	};
220};
221