全志F1C100S做的一个桌面小功放,主要结构为F1C100S(Linux)+RTL8189ETV(SDIO WIFI模块)+BM64(双模蓝牙模块)+TAS5805M+3 Rotary Encoder + 12 RGB LED

主要功能

支持的功能列表

1.BT Audio(BM64)
2.BLE APP(BM64)
3.Airplay(WIFI)
4.DLNA(WIFI)
5.RCA(Line in)
6.USB Audio(USB Gadget Audio)
7.Web Server(websocket通信)
8.FM(WIFI,暂未实现)
9.语音合成(WIFI,暂未实现)

供电方式

整机供电由typec线供电,通过诱骗方式使充电器输出12V,系统可支持5–20V电源输入

控制方式

控制方式由顶部3个带按钮的编码器,下边由SPI驱动的12颗RGB灯做为背光构成,此外还可以通过BLE APP(android)和WebPage控制

功放部分

功放部分为TAS5805M 这颗芯片用于桌面小音箱再合适不过了,音质也非常OK,简单设置几个寄存器即可,当然也可以通过TI的PPC3软件进行配置,这个去TI官网申请即可,采样率支持最高192K

原理图sch.pdf喇叭LMS曲线.xlsxLMS SPL曲线.png

构建Linux系统

基于buildroot来构建uboot+Kernel+rootfs,Flash是W25Q128 16M rootfs 采用Squarefs+jeff2+overlay

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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
系统启动日志
U-Boot SPL 2020.07 (Dec 16 2022 - 09:22:38 +0800)
DRAM: 32 MiB
Trying to boot from sunxi SPI


U-Boot 2020.07 (Dec 16 2022 - 09:22:38 +0800) Allwinner Technology

CPU: Allwinner F Series (SUNIV)
Model: Desktop Music Box By:87000013
DRAM: 32 MiB
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
SF: Detected w25q128 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
device 0 offset 0x80000, size 0x500000
SF: 5242880 bytes @ 0x80000 Read: OK
## Loading kernel from FIT Image at 81000000 ...
Using 'conf@0' configuration
Trying 'kernel@0' kernel subimage
Description: Linux kernel
Type: Kernel Image
Compression: uncompressed
Data Start: 0x810000cc
Data Size: 4677768 Bytes = 4.5 MiB
Architecture: ARM
OS: Linux
Load Address: 0x80000000
Entry Point: 0x80000000
Hash algo: crc32
Hash value: d838cd44
Verifying Hash Integrity ... crc32+ OK
## Loading fdt from FIT Image at 81000000 ...
Using 'conf@0' configuration
Trying 'fdt@0' fdt subimage
Description: Flattened Device Tree blob
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0x81476238
Data Size: 18900 Bytes = 18.5 KiB
Architecture: ARM
Hash algo: crc32
Hash value: f0247b04
Verifying Hash Integrity ... crc32+ OK
Booting using the fdt blob at 0x81476238
Loading Kernel Image
Loading Device Tree to 817f8000, end 817ff9d3 ... OK

Starting kernel ...

[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.4.99 (sonavox@SOMRT1A) (gcc version 8.4.0 (Buildroot -g21de572-dirty)) #127 Wed Dec 14 10:02:03 CST 2022
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] OF: fdt: Machine model: Desktop Music Box By:87000013
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] cma: Failed to reserve 16 MiB
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 8128
[ 0.000000] Kernel command line: console=ttyS0,115200 rootwait init=/preinit root=/dev/mtdblock2 rootfstype=squashfs overlayfsdev=/dev/mtdblock3 net.ifnames=0 vt.global_cursor_default=0
[ 0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 21536K/32768K available (7168K kernel code, 321K rwdata, 1736K rodata, 1024K init, 247K bss, 11232K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] random: get_random_bytes called from start_kernel+0x254/0x444 with crng_init=0
[ 0.000036] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000102] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000612] Console: colour dummy device 80x30
[ 0.000693] Calibrating delay loop... 358.80 BogoMIPS (lpj=1794048)
[ 0.050219] pid_max: default: 32768 minimum: 301
[ 0.050554] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.050586] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.051903] CPU: Testing write buffer coherency: ok
[ 0.053448] Setting up static identity map for 0x80100000 - 0x80100058
[ 0.054407] devtmpfs: initialized
[ 0.062793] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.062842] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[ 0.063052] pinctrl core: initialized pinctrl subsystem
[ 0.064787] NET: Registered protocol family 16
[ 0.065999] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.067638] cpuidle: using governor menu
[ 0.111210] SCSI subsystem initialized
[ 0.111571] usbcore: registered new interface driver usbfs
[ 0.111711] usbcore: registered new interface driver hub
[ 0.111831] usbcore: registered new device driver usb
[ 0.112635] Advanced Linux Sound Architecture Driver Initialized.
[ 0.115161] clocksource: Switched to clocksource timer
[ 0.141052] NET: Registered protocol family 2
[ 0.142055] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.142111] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.142147] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.142178] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.142398] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 0.142441] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 0.142846] NET: Registered protocol family 1
[ 0.144048] RPC: Registered named UNIX socket transport module.
[ 0.144077] RPC: Registered udp transport module.
[ 0.144087] RPC: Registered tcp transport module.
[ 0.144096] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.146063] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.147558] Initialise system trusted keyrings
[ 0.148015] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[ 0.161944] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.163804] NFS: Registering the id_resolver key type
[ 0.163888] Key type id_resolver registered
[ 0.163904] Key type id_legacy registered
[ 0.163940] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 0.164019] jffs2: version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
[ 0.228516] Key type asymmetric registered
[ 0.228545] Asymmetric key parser 'x509' registered
[ 0.228683] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.228702] io scheduler mq-deadline registered
[ 0.228714] io scheduler kyber registered
[ 0.239035] suniv-f1c100s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.257073] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.261762] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pe not found, using dummy regulator
[ 0.262943] printk: console [ttyS0] disabled
[ 0.283181] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 27, base_baud = 6250000) is a 16550A
[ 0.718091] printk: console [ttyS0] enabled
[ 0.723236] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pa not found, using dummy regulator
[ 0.754760] 1c25400.serial: ttyS1 at MMIO 0x1c25400 (irq = 28, base_baud = 6250000) is a 16550A
[ 0.765290] st: Version 20160209, fixed bufsize 32768, s/g segs 256
[ 0.772001] SCSI Media Changer driver v0.25
[ 0.777589] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pc not found, using dummy regulator
[ 0.790186] spi-nor spi0.0: w25q128 (16384 Kbytes)
[ 0.795032] 4 fixed-partitions partitions found on MTD device spi0.0
[ 0.801455] Creating 4 MTD partitions on "spi0.0":
[ 0.806290] 0x000000000000-0x000000080000 : "u-boot"
[ 0.814206] 0x000000080000-0x000000580000 : "kernel"
[ 0.822181] 0x000000580000-0x000000f80000 : "rom"
[ 0.829901] 0x000000e00000-0x000001000000 : "overlay"
[ 0.841590] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.848212] ehci-platform: EHCI generic platform driver
[ 0.853701] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.859985] ohci-platform: OHCI generic platform driver
[ 0.866303] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[ 0.878120] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[ 0.884444] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[ 0.892800] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.04
[ 0.901128] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 0.908371] usb usb1: Product: MUSB HDRC host driver
[ 0.913326] usb usb1: Manufacturer: Linux 5.4.99 musb-hcd
[ 0.918738] usb usb1: SerialNumber: musb-hdrc.1.auto
[ 0.925087] hub 1-0:1.0: USB hub found
[ 0.929049] hub 1-0:1.0: 1 port detected
[ 0.937113] i2c /dev entries driver
[ 0.941105] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pd not found, using dummy regulator
[ 0.955330] rtc-pcf8563 0-0051: low voltage detected, date/time is not reliable.
[ 0.963191] rtc-pcf8563 0-0051: registered as rtc0
[ 0.970537] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[ 0.980048] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pf not found, using dummy regulator
[ 1.017455] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
[ 1.026497] ledtrig-cpu: registered to indicate activity on CPUs
[ 1.032951] hidraw: raw HID events driver (C) Jiri Kosina
[ 1.038762] usbcore: registered new interface driver usbhid
[ 1.044321] usbhid: USB HID core driver
[ 1.052411] debugfs: Directory '1c23c00.codec' with parent 'F1C100s Audio Codec' already present!
[ 1.064401] sun4i-codec 1c23c00.codec: Codec <-> 1c23c00.codec mapping ok
[ 1.076362] NET: Registered protocol family 17
[ 1.081181] Key type dns_resolver registered
[ 1.086651] Loading compiled-in X.509 certificates
[ 1.102160] asoc-simple-card sound_i2s: pcm5102a-hifi <-> 1c22000.i2s mapping ok
[ 1.112941] rtc-pcf8563 0-0051: low voltage detected, date/time is not reliable.
[ 1.120436] rtc-pcf8563 0-0051: hctosys: unable to read the hardware clock
[ 1.127818] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 1.141924] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 1.149080] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 1.157813] cfg80211: failed to load regulatory.db
[ 1.162776] ALSA device list:
[ 1.165850] #0: F1C100s Audio Codec
[ 1.169508] #1: 1c22000.i2s-pcm5102a-hifi
[ 1.175750] random: fast init done
[ 1.182755] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[ 1.194801] devtmpfs: mounted
[ 1.201081] Freeing unused kernel memory: 1024K
[ 1.205805] Run /preinit as init process
[ 1.257421] mmc0: new high speed SDIO card at address 0001
[ 1.302001] random: crng init done
[ 1.308462] bFWReady == _FALSE call reset 8051...
[ 1.984419] overlayfs: upper fs does not support tmpfile.
[ 1.989923] overlayfs: upper fs does not support xattr, falling back to index=off and metacopy=off.
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Starting mdev... OK

Initializing random number generator: OK
Saving random seed: OK
Starting network: OK
Start App...
BuildDate:Dec 28 2022 15:56:07
self pid:126
Welcome to Desktop MusicBox
Jamstack-lite login:
config -> wifi_ssid:Luxul1750_2.4G
config -> wifi_psk:sonavox168
config -> master volume:66
config -> input:1
config -> btn_vol_color:0xff0000
config -> btn_gain_color:0xff00
config -> btn_fx_color:0x00ff
config parse ok
Successfully initialized wpa_supplicant
waitting for wifi connected...
udhcpc: started, v1.31.1
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending select for 192.168.6.195
udhcpc: lease of 192.168.6.195 obtained, lease time 43200
deleting routers
adding dns 192.168.6.1
addr:192.168.6.195
local ip:192.168.6.195
wifi connected! ip:192.168.6.195
shairport-sync -a jamstack-lite started.
3bb5 2 webserver.c:97:web_socket_thread Mongoose version : v7.8
3bc2 2 webserver.c:98:web_socket_thread Listening on : ws://192.168.6.195:8000
3bc3 2 webserver.c:99:web_socket_thread Web root : [./www]
start init system.
Init system gpio.
spi mode: 0
bits per word: 8
max speed: 8000000 Hz (8000 KHz)
key init start
key init ok
fcntl=0
fd->open=49
/dev/ttyS1 init ok! err:0
Request USB 12V Voltage
Enable AMP Power Supply
Power ON CODEC with GPIO PE6
Tas5805 init completed!
Volume = 66% map ->0x77
switch audio source to STREAM
Updated configuration successfully written to: sys.cfg
save config ok.

设备树配置如下:主要是F1C100S的I2S,SPI,UART,这几个外设主要是用于驱动Linux SoundCard,RGB灯,BM64蓝牙模块,编码器部分驱动功能不符合需求,故放在应用层驱动,编码器需要实现,正转,反转,单击,双击,三击,长按

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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
完整的设备树,有需要的可以参考一下
// SPDX-License-Identifier: (GPL-2.0+ OR X11)

/dts-v1/;
#include "suniv-f1c100s.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
/ {
model = "Desktop Music Box By:87000013";
compatible = "allwinner,suniv-f1c200s",
"allwinner,suniv-f1c100s";

chosen {

#address-cells = <1>;
#size-cells = <1>;
ranges;

bootargs = "console=ttyS0,115200 rootwait init=/preinit root=/dev/mtdblock2 rootfstype=squashfs overlayfsdev=/dev/mtdblock3";
/*
simplefb_lcd: framebuffer-lcd0 {
compatible = "allwinner,simple-framebuffer",
"simple-framebuffer";
format = "r5g6b5";
width = <800>;
height = <480>;
stride = <1600>;
allwinner,pipeline = "de_be0-lcd0";
clocks = <&ccu CLK_BUS_DE_BE>, <&ccu CLK_DE_BE>,
<&ccu CLK_DRAM_DE_BE>, <&ccu CLK_BUS_LCD>,
<&ccu CLK_TCON>;
status = "okay";
};
*/
};
/*
panel: panel {
compatible = "bananapi,s070wv20-ct16", "simple-panel";
#address-cells = <1>;
#size-cells = <0>;
power-supply = <&reg_vcc3v3>;
port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;

panel_input: endpoint@0 {
reg = <0>;
remote-endpoint = <&tcon0_out_lcd>;
};
};
};

*/

pcm5102a: pcm510x {
compatible = "ti,pcm5102a";
pcm510x,format = "i2s";
#sound-dai-cells = <0>;
};

sound_i2s {
compatible = "simple-audio-card";
simple-audio,name="I2S-master";
simple-audio-card,format = "i2s";
simple-audio-card,mclk-fs = <128>;

status = "okay";

simple-audio-card,cpu {
sound-dai = <&i2s0>;
};

simple-audio-card,codec {
sound-dai = <&pcm5102a>;
};
};

leds {
compatible = "gpio-leds";

led0 {
function = LED_FUNCTION_STATUS;
linux,default-trigger = "heartbeat";
gpios = <&pio 3 1 GPIO_ACTIVE_LOW>;//PD1 LED
default-state = "on";
status = "okay";
};
};
ir_gpio {
compatible = "gpio-ir-receiver";
gpios = <&pio 4 11 GPIO_ACTIVE_LOW>; /* PE11 */
/*active_low = <1>;*/
linux,rc-map-name = "rc-tevii-nec";
status = "disabled";
};


backlight: backlight {
compatible = "pwm-backlight";
brightness-levels = < 0 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 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255>;

default-brightness-level = <200>;
pwms = <&pwm 1 5000000 0>;//5000000为默认周期ns
//enable-gpios = <&pio 5 6 0>;
//post-pwm-on-delay-ms = <10>;
//pwm-off-delay-ms = <10>;

status = "disabled";
};

rotary_vol {
compatible = "rotary-encoder";
pinctrl-names = "default";
status = "disabled";
gpios = <&pio 3 18 GPIO_ACTIVE_LOW>, <&pio 3 13 GPIO_ACTIVE_LOW>;
linux,axis = <0>;
rotary-encoder,encoding = "gray";
rotary-encoder,relative-axis;
};
rotary_gain {
compatible = "rotary-encoder";
pinctrl-names = "default";
status = "disabled";
gpios = <&pio 3 15 GPIO_ACTIVE_LOW>, <&pio 3 19 GPIO_ACTIVE_LOW>;
linux,axis = <0>;
rotary-encoder,encoding = "gray";
rotary-encoder,relative-axis;
};
rotary_fx {
compatible = "rotary-encoder";
pinctrl-names = "default";
status = "disabled";
gpios = <&pio 3 21 GPIO_ACTIVE_LOW>, <&pio 3 16 GPIO_ACTIVE_LOW>;
linux,axis = <0>;
rotary-encoder,encoding = "gray";
rotary-encoder,relative-axis;
};
rotary_btns{
compatible = "gpio-keys";
pinctrl-names = "default";
autorepeat = <1>;
label = "rotary_btns";
status = "disabled";
btn_vol{
label = "btn_vol";
gpios = <&pio 3 17 GPIO_ACTIVE_LOW>;
linux,code = <KEY_UP>;
};
btn_gain{
label = "btn_gain";
gpios = <&pio 3 14 GPIO_ACTIVE_LOW>;
linux,code = <KEY_DOWN>;
};
btn_fx{
label = "btn_fx";
gpios = <&pio 3 20 GPIO_ACTIVE_LOW>;
linux,code = <KEY_LEFT>;
};

};

reg_vcc3v3: vcc3v3 {
compatible = "regulator-fixed";
regulator-name = "vcc3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
status = "okay";
};


amp_pwr:v_pwr {
compatible = "regulator-fixed";
regulator-name = "amp_power";
regulator-min-microvolt = <12000000>;
regulator-max-microvolt = <12000000>;

//gpio = <&pio 4 6 GPIO_ACTIVE_HIGH>;
//startup-delay-us = <70000>;
//enable-active-high;
//regulator-boot-on;
status = "disabled";
};
};

&i2s0 {
pinctrl-0 = <&i2s_pd_pins>;
pinctrl-names = "default";
power-supply = <&reg_vcc3v3>;
sound-dai = <&pcm5102a>;
status = "okay";
};
&pwm {
pinctrl-names = "default";
pinctrl-0 = <&pwm1_pe_pins>;
status = "disabled";
};



&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pd_pins>;
status = "okay";

rtp@48 {
compatible = "ti,tsc2007";
reg = <0x48>;
interrupt-parent = <&pio>;
interrupts = <4 5 IRQ_TYPE_EDGE_FALLING>;
gpios = <&pio 4 5 GPIO_ACTIVE_LOW>;
pendown-gpio = <&pio 4 5 GPIO_ACTIVE_LOW>;
ti,x-plate-ohms = <660>;
wakeup-source;
status = "disabled";
};
/*
pcm5121: pcm5121@4c {
compatible = "ti,pcm5121";
reg = <0x4c>;
#sound-dai-cells = <0>;
AVDD-supply = <&reg_vcc3v3>;
DVDD-supply = <&reg_vcc3v3>;
CPVDD-supply = <&reg_vcc3v3>;
status = "disabled";
};

tas5805m: tas5805m@2c {
compatible = "ti,tas5805m";
reg = <0x2c>;
#sound-dai-cells = <0>;
pvdd-supply = <&amp_pwr>;
pinctrl-names = "default";
pdn-gpios = <&pio 3 3 GPIO_ACTIVE_LOW>;
ti,dsp-config-name = "default_192kHz";
status = "okay";
};
*/
rtc@51 {
compatible = "nxp,pcf8563";
reg = <0x51>;
status = "okay";
};
};

&spi1{
status = "okay";
spidev@0{
compatible = "rohm,dh2228fv";
spi-max-frequency = <50000000>;
reg = <0>;
status = "okay";
};
};

&spi0 {
status = "okay";
power-supply = <&reg_vcc3v3>;
spi-nor@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "winbond,w25q128", "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
status = "okay";

partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
//512KB
partition@0 {
label = "u-boot";
reg = <0x000000 0x80000>;
read-only;
};

partition@1 {
label = "kernel";
reg = <0x80000 0x500000>;
read-only;
};
partition@2 {
label = "rom";
reg = <0x580000 0xa00000>;
read-only;
};

partition@3 {
label = "overlay";
reg = <0xe00000 0x200000>;
};

};
};

spi-nand@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "spi-nand";
reg = <0>;
spi-max-frequency = <50000000>;
status = "disabled";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

partition@0 {
label = "u-boot";
reg = <0x000000 0x100000>;
read-only;
};

partition@1 {
label = "kernel";
reg = <0x100000 0x500000>;
read-only;
};

partition@2 {
label = "rom";
reg = <0x600000 0x2a00000>;
read-only;
};

partition@3 {
label = "vendor";
reg = <0x3000000 0x1000000>;
};

partition@4 {
label = "overlay";
reg = <0x4000000 0x3000000>;
};
};
};
};



&cir{

pinctrl-names = "default";
pinctrl-0 = <&cir_pins_a>;
linux,rc-map-name = "rc-nec-remote";
status = "disabled";
};




&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pe_pins>;
status = "okay";
};

&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&uart1_pa_pins>;
status = "okay";
};
&mmc0 {
power-supply = <&reg_vcc3v3>;
status = "okay";
broken-cd;
};

&otg_sram {
status = "okay";
};

&usb_otg {
dr_mode = "otg";/* 三个可选项: otg / host / peripheral 我在这里指定为host模式*/
status = "okay";
};

&usbphy {
usb0_id_det = <&pio 4 2 GPIO_ACTIVE_HIGH>; /* PE2 */
status = "okay";
};

&cedar_ve {
status = "disabled";
};

&ion {
status = "disabled";
};

&de {
status = "disabled";
};

&fe0 {
status = "disabled";
};

&be0 {
status = "disabled";
};

&tve0 {
status = "disabled";
};
/*
&tcon0 {
pinctrl-names = "default";
pinctrl-0 = <&lcd_rgb565_pins>;
status = "disabled";
};

&tcon0_out {
tcon0_out_lcd: endpoint@0 {
reg = <0>;
remote-endpoint = <&panel_input>;
};
};
*/
&codec {
allwinner,audio-routing =
"Headphone", "HP",
"Headphone", "HPCOM",
"LINEIN", "Line In",
"FMINL", "Left FM In",
"FMINR", "Right FM In",
"MIC", "Mic";
status = "okay";
};


&lradc {
vref-supply = <&reg_vcc3v0>;
status = "disabled";

button-200 {
label = "PageDown";
linux,code = <KEY_PAGEDOWN>;
channel = <0>;
voltage = <200000>;
};
button-400 {
label = "Right";
linux,code = <KEY_RIGHT>;
channel = <0>;
voltage = <400000>;
};



button-600 {
label = "Enter";
linux,code = <KEY_ENTER>;
channel = <0>;
voltage = <600000>;
};


button-800 {
label = "Left";
linux,code = <KEY_LEFT>;
channel = <0>;
voltage = <800000>;
};
button-1000 {
label = "PageUp";
linux,code = <KEY_PAGEUP>;
channel = <0>;
voltage = <1000000>;
};
};

软件编写

使用/dev/ttyS1与BM64模块通信

使用/dev/spidev1.0与RGB灯通信

使用GPIOD操作GPIO来检测按键及编码器

使用/dev/i2c-0与TAS5805M,PCF8563通信

I2S(16BIT 44.1K-192K)信号与BM64(24BIT 48K)信号进入TAS5805M功放

整机组装调试