I. MX6Q (TQIMX6Q/TQE9) Study Notes-New BSP audio card driver porting, tqimx6qtqe9
After the above transplantation, tqimx6q can drive the touch screen normally. In this article, we will transplant the sound card driver.
Write data through DTS
Because the sound card of tqimx6q is sgtl5000 chip, you can add the following content to dts according to the information of other development boards in the DTS directory:
/ {...regulators {...reg_3p3v: 3p3v {compatible = "regulator-fixed";regulator-name = "3P3V";regulator-min-microvolt = <3300000>;regulator-max-microvolt = <3300000>;regulator-always-on;};};...sound {compatible = "fsl,imx-audio-sgtl5000";model = "imx6q-sgtl5000";ssi-controller = <&ssi1>;audio-codec = <&codec>;audio-routing ="MIC_IN", "Mic Jack","Mic Jack", "Mic Bias","Headphone Jack", "HP_OUT";mux-int-port = <1>;mux-ext-port = <3>;};};...&i2c2 {clock-frequency = <100000>;pinctrl-names = "default";pinctrl-0 = <&pinctrl_i2c2_2>;status = "okay";codec: sgtl5000@0a {compatible = "fsl,sgtl5000";reg = <0x0a>;clocks = <&clks 201>;VDDA-supply = <®_3p3v>;VDDIO-supply = <®_3p3v>;VDDD-supply = <®_1p2v>;};};&ssi1 {fsl,mode = "i2s-slave";status = "okay";};&audmux {pinctrl-names = "default";pinctrl-0 = <&pinctrl_audmux_2>;status = "okay";};&iomuxc {pinctrl-names = "default";pinctrl-0 = <&pinctrl_hog>;...hog {pinctrl_hog: hoggrp-1 {fsl,pins = <MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x80000000>;};};};
Add the above content and re-compile and burn DTB.
Test Method
Of course, alsa-lib and alsa-utils are used for testing. The migration methods of related tools are as follows:
Step1. obtain and cross-compile alsa-lib:
wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.29.tar.bz2tar jxf alsa-lib-1.0.29.tar.bz2cd alsa-lib-1.0.29/configure --host=arm-linux-gnueabi --prefix=/mnt/usr/lib/alsa-libmakesudo make install
Step2. obtain and cross-compile alsa-utils:
wget ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.0.29.tar.bz2tar jxf alsa-utils-1.0.29.tar.bz2cd alsa-utils-1.0.29./configure --host=arm-linux-gnueabi --prefix=/usr/share/arm-alsa --with-alsa-inc-prefix=/usr/share/arm-alsa/include --with-alsa-prefix=/usr/share/arm-alsa/lib --disable-alsamixer --disable-xmltomake sudo make install
Step3. check whether cross-compilation is successful:
file aplay
If the display content is roughly as follows:
aplay: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=280644397dc85eaf1f1dc26b03be754ac4777cff, not stripped
Indicates that the cross-compilation is successful. The keyword is ARM.
Step 4. Copy the cross-compiled alsa to the root file system:
sudo cp /usr/share/arm-alsa/ /mnt/usr/share/ -rfasudo cp /usr/share/arm-alsa/* /mnt/ -rfasync
Next, you can start the development board with the new file system.
Step 5. Test the recording:
arecord -f dat test.wav
Execute the preceding commands and speak to the Development Board. After that, press ctrl + C to interrupt the recording.
Step 5. Play the recording:
aplay test.wav
If the above steps are correctly transplanted, you can hear what you said during the recording.
Start Log
The complete startup Log is as follows:
U-Boot 2013.04-04987-g98fdbdc-dirty (May 03 2015 - 11:46:24)CPU: Freescale i.MX6Q rev1.2 at 792 MHzCPU: Temperature 26 C, calibration data: 0x54e4bb69Reset cause: PORBoard: MX6Q/SDL-SabreSDI2C: readyDRAM: 1 GiBMMC: FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2No panel detected: default to Hannstar-XGADisplay: Hannstar-XGA (1024x768)In: serialOut: serialErr: serialmmc0 is current deviceNet: Phy not foundPHY reset timed outFEC [PRIME]Warning: failed to set MAC addressNormal BootHit any key to stop autoboot: 0 mmc0 is current deviceMMC read: dev # 0, block # 2048, count 12288 ... 12288 blocks read: OKMMC read: dev # 0, block # 20480, count 2048 ... 2048 blocks read: OK## Booting kernel from Legacy Image at 11ffffc0 ... Image Name: Linux-3.10.17-80739-g33597e3-dir Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 5289360 Bytes = 5 MiB Load Address: 12000000 Entry Point: 12000000 Verifying Checksum ... OK## Flattened Device Tree blob at 18000000 Booting using the fdt blob at 0x18000000 XIP Kernel Image ... OKOK Using Device Tree in place at 18000000, end 1800d14dStarting kernel ...Booting Linux on physical CPU 0x0Linux version 3.10.17-80739-g33597e3-dirty (lilianrong@lenovo) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1) ) #3 SMP PREEMPT Wed May 13 00:16:49 CST 2015CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7dCPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cacheMachine: Freescale i.MX6 Quad/DualLite (Device Tree), model: Freescale i.MX6 Quad TQIMX6Q Smart Device Boardcma: CMA: reserved 320 MiB at 3c000000Memory policy: ECC disabled, Data cache writeallocPERCPU: Embedded 8 pages/cpu @814fa000 s8896 r8192 d15680 u32768Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260096Kernel command line: noinitrd console=ttymxc0,115200 root=/dev/mmcblk0p1 rw rootfstype=ext4 init=/linuxrcPID hash table entries: 4096 (order: 2, 16384 bytes)Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)Memory: 1024MB = 1024MB totalMemory: 697784k/697784k available, 350792k reserved, 0K highmemVirtual kernel memory layout: vector : 0xffff0000 - 0xffff1000 ( 4 kB) fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) vmalloc : 0xc0800000 - 0xff000000 (1000 MB) lowmem : 0x80000000 - 0xc0000000 (1024 MB) pkmap : 0x7fe00000 - 0x80000000 ( 2 MB) modules : 0x7f000000 - 0x7fe00000 ( 14 MB) .text : 0x80008000 - 0x80be704c (12157 kB) .init : 0x80be8000 - 0x80c2a2c0 ( 265 kB) .data : 0x80c2c000 - 0x80c7c260 ( 321 kB) .bss : 0x80c7c260 - 0x80ce5434 ( 421 kB)SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1Preemptible hierarchical RCU implementation.NR_IRQS:16 nr_irqs:16 16L310 cache controller enabledl2x0: 16 ways, CACHE_ID 0x410000c7, AUX_CTRL 0x32070000, Cache size: 1048576 Bsched_clock: 32 bits at 3000kHz, resolution 333ns, wraps every 1431655msCPU identified as i.MX6Q, silicon rev 1.2Console: colour dummy device 80x30Calibrating delay loop... 1581.05 BogoMIPS (lpj=7905280)pid_max: default: 32768 minimum: 301Mount-cache hash table entries: 512CPU: Testing write buffer coherency: okCPU0: thread -1, cpu 0, socket 0, mpidr 80000000Setting up static identity map for 0x806106a8 - 0x80610700CPU1: Booted secondary processorCPU1: thread -1, cpu 1, socket 0, mpidr 80000001CPU2: Booted secondary processorCPU2: thread -1, cpu 2, socket 0, mpidr 80000002CPU3: Booted secondary processorCPU3: thread -1, cpu 3, socket 0, mpidr 80000003Brought up 4 CPUsSMP: Total of 4 processors activated (6324.22 BogoMIPS).CPU: All CPU(s) started in SVC mode.devtmpfs: initializedpinctrl core: initialized pinctrl subsystemregulator-dummy: no parametersNET: Registered protocol family 16DMA: preallocated 256 KiB pool for atomic coherent allocationsUse WDOG1 as reset sourcesyscon 20c8000.anatop: regmap [mem 0x020c8000-0x020c8fff] registeredvdd1p1: 800 <--> 1375 mV at 1125 mV vdd3p0: 2800 <--> 3150 mV at 3000 mV vdd2p5: 2000 <--> 2750 mV at 2425 mV cpu: 725 <--> 1450 mV at 1150 mV vddpu: 725 <--> 1450 mV vddsoc: 725 <--> 1450 mV at 1200 mV syscon 20e0000.iomuxc-gpr: regmap [mem 0x020e0000-0x020e0037] registeredsyscon 21bc000.ocotp-ctrl: regmap [mem 0x021bc000-0x021bffff] registeredhw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.hw-breakpoint: maximum watchpoint size is 4 bytes.imx6q-pinctrl 20e0000.iomuxc: initialized IMX pinctrl driverbio: create slab <bio-0> at 0mxs-dma 110000.dma-apbh: initializedusb_otg_vbus: 5000 mV mipi_dsi_pwr_on: no parameters3P3V: 3300 mV 1P2V: 1200 mV i2c-core: driver [max17135] using legacy suspend methodi2c-core: driver [max17135] using legacy resume methodSCSI subsystem initializedusbcore: registered new interface driver usbfsusbcore: registered new interface driver hubusbcore: registered new device driver usbi2c i2c-0: IMX I2C adapter registeredi2c i2c-1: IMX I2C adapter registeredLinux video capture interface: v2.00pps_core: LinuxPPS API ver. 1 registeredpps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>PTP clock support registeredimx-ipuv3 2400000.ipu: IPU DMFC NORMAL mode: 1(0~1), 5B(4,5), 5F(6,7)imx-ipuv3 2800000.ipu: IPU DMFC NORMAL mode: 1(0~1), 5B(4,5), 5F(6,7)MIPI CSI2 driver module loadedAdvanced Linux Sound Architecture Driver Initialized.cfg80211: Calling CRDA to update world regulatory domainSwitching to clocksource mxc_timer1NET: Registered protocol family 2TCP established hash table entries: 8192 (order: 4, 65536 bytes)TCP bind hash table entries: 8192 (order: 4, 65536 bytes)TCP: Hash tables configured (established 8192 bind 8192)TCP: reno registeredUDP hash table entries: 512 (order: 2, 16384 bytes)UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)NET: Registered protocol family 1RPC: Registered named UNIX socket transport module.RPC: Registered udp transport module.RPC: Registered tcp transport module.RPC: Registered tcp NFSv4.1 backchannel transport module.hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters availablepureg-dummy: no parametersimx6_busfreq busfreq.15: DDR medium rate not supported.Bus freq driver module loadedVFS: Disk quotas dquot_6.5.2Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)NFS: Registering the id_resolver key typeKey type id_resolver registeredKey type id_legacy registeredjffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.fuse init (API version 7.22)msgmni has been set to 2002io scheduler noop registeredio scheduler deadline registeredio scheduler cfq registered (default)imx-weim 21b8000.weim: WEIM driver registered.mxc_mipi_dsi 21e0000.mipi: i.MX MIPI DSI driver probedMIPI DSI driver module loadedmxc_sdc_fb fb.26: register mxc display driver lcdConsole: switching to colour frame buffer device 100x30imx-sdma 20ec000.sdma: no iram assigned, using external memimx-sdma 20ec000.sdma: loaded firmware 1.1imx-sdma 20ec000.sdma: initializedSerial: IMX driver2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 58) is a IMXconsole [ttymxc0] enabled21e8000.serial: ttymxc1 at MMIO 0x21e8000 (irq = 59) is a IMX21ec000.serial: ttymxc2 at MMIO 0x21ec000 (irq = 60) is a IMX21f0000.serial: ttymxc3 at MMIO 0x21f0000 (irq = 61) is a IMX21f4000.serial: ttymxc4 at MMIO 0x21f4000 (irq = 62) is a IMXserial: Freescale lpuart driver[drm] Initialized drm 1.1.0 20060810[drm] Initialized vivante 1.0.0 20120216 on minor 0brd: module loadedloop: module loadedCAN device driver interfaceflexcan 2090000.can: device registered (reg_base=c0a38000, irq=142)fec 2188000.ethernet (unregistered net_device): Invalid MAC address: 00:00:00:00:00:00fec 2188000.ethernet (unregistered net_device): Using random MAC address: c2:9c:30:14:aa:25libphy: fec_enet_mii_bus: probedfec 2188000.ethernet eth0: registered PHC device 0ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driverusbcore: registered new interface driver usb-storageci_hdrc ci_hdrc.1: doesn't support gadgetci_hdrc ci_hdrc.1: EHCI Host Controllerci_hdrc ci_hdrc.1: new USB bus registered, assigned bus number 1ci_hdrc ci_hdrc.1: USB 2.0 started, EHCI 1.00hub 1-0:1.0: USB hub foundhub 1-0:1.0: 1 port detectedmousedev: PS/2 mouse device common for all micei2c-core: driver [isl29023] using legacy suspend methodi2c-core: driver [isl29023] using legacy resume methodsnvs_rtc 20cc034.snvs-rtc-lp: rtc core: registered 20cc034.snvs-rtc-lp as rtc0i2c /dev entries driveri2c-core: driver [mag3110] using legacy suspend methodi2c-core: driver [mag3110] using legacy resume methodimx2-wdt 20bc000.wdog: IMX2+ Watchdog Timer enabled. timeout=60s (nowayout=0)cpuidle: using governor laddercpuidle: using governor menusdhci: Secure Digital Host Controller Interface driversdhci: Copyright(c) Pierre Ossmansdhci-pltfm: SDHCI platform and OF driver helpermmc0: no vqmmc regulator foundmmc0: no vmmc regulator foundmmc0: SDHCI controller on 2194000.usdhc [2194000.usdhc] using ADMAmmc1: no vqmmc regulator foundmmc1: no vmmc regulator foundmmc1: SDHCI controller on 219c000.usdhc [219c000.usdhc] using ADMAmmc0: new high speed SDHC card at address e624mmcblk0: mmc0:e624 SS08G 7.40 GiB mmcblk0: p1mmc1: BKOPS_EN bit is not setusb 1-1: new high-speed USB device number 2 using ci_hdrcmmc1: new high speed DDR MMC card at address 0001mmcblk1: mmc1:0001 008G92 7.28 GiB mmcblk1boot0: mmc1:0001 008G92 partition 1 4.00 MiBmmcblk1boot1: mmc1:0001 008G92 partition 2 4.00 MiBmmcblk1rpmb: mmc1:0001 008G92 partition 3 512 KiB mmcblk1: p1 mmcblk1boot1: unknown partition table mmcblk1boot0: unknown partition tablehub 1-1:1.0: USB hub foundhub 1-1:1.0: 4 ports detectedGalcore version 4.6.9.9754mxc_vdoa 21e4000.vdoa: i.MX Video Data Order Adapter(VDOA) driver probedmxc_asrc 2034000.asrc: mxc_asrc registeredmxc_vpu 2040000.vpu: VPU initializedleds-gpio gpio-leds.22: pins are not configured from the drivercaam 2100000.caam: device ID = 0x0a16010000000000 (Era -524)caam 2100000.caam: job rings = 2, qi = 0caam 2100000.caam: authenc-hmac-md5-cbc-aes-caamcaam 2100000.caam: authencesn-hmac-md5-cbc-aes-caamcaam 2100000.caam: authenc-hmac-sha1-cbc-aes-caamcaam 2100000.caam: authencesn-hmac-sha1-cbc-aes-caamcaam 2100000.caam: authenc-hmac-sha224-cbc-aes-caamcaam 2100000.caam: authencesn-hmac-sha224-cbc-aes-caamcaam 2100000.caam: authenc-hmac-sha256-cbc-aes-caamcaam 2100000.caam: authencesn-hmac-sha256-cbc-aes-caamcaam 2100000.caam: authenc-hmac-md5-cbc-des3_ede-caamcaam 2100000.caam: authencesn-hmac-md5-cbc-des3_ede-caamcaam 2100000.caam: authenc-hmac-sha1-cbc-des3_ede-caamcaam 2100000.caam: authencesn-hmac-sha1-cbc-des3_ede-caamcaam 2100000.caam: authenc-hmac-sha224-cbc-des3_ede-caamcaam 2100000.caam: authencesn-hmac-sha224-cbc-des3_ede-caamcaam 2100000.caam: authenc-hmac-sha256-cbc-des3_ede-caamcaam 2100000.caam: authencesn-hmac-sha256-cbc-des3_ede-caamcaam 2100000.caam: authenc-hmac-md5-cbc-des-caamcaam 2100000.caam: authencesn-hmac-md5-cbc-des-caamcaam 2100000.caam: authenc-hmac-sha1-cbc-des-caamcaam 2100000.caam: authencesn-hmac-sha1-cbc-des-caamcaam 2100000.caam: authenc-hmac-sha224-cbc-des-caamcaam 2100000.caam: authencesn-hmac-sha224-cbc-des-caamcaam 2100000.caam: authenc-hmac-sha256-cbc-des-caamcaam 2100000.caam: authencesn-hmac-sha256-cbc-des-caamcaam 2100000.caam: ecb-des-caamcaam 2100000.caam: ecb-arc4-caamcaam 2100000.caam: ecb-aes-caamcaam 2100000.caam: ctr-aes-caamcaam 2100000.caam: cbc-aes-caamcaam 2100000.caam: ecb-des3-caamcaam 2100000.caam: cbc-3des-caamcaam 2100000.caam: cbc-des-caamcaam 2100000.caam: fsl,sec-v4.0 algorithms registered in /proc/cryptoplatform 2101000.jr0: registering rng-caamplatform caam_sm: caam_sm_test: 8-byte key test match OKplatform caam_sm: caam_sm_test: 16-byte key test match OKplatform caam_sm: caam_sm_test: 32-byte key test match OKplatform caam_secvio.28: security violation service handlers armedusbcore: registered new interface driver usbhidusbhid: USB HID core driveri2c-core: driver [cs42888] using legacy suspend methodi2c-core: driver [cs42888] using legacy resume methodsgtl5000 1-000a: sgtl5000 revision 0x111-000a: 1200 mV normal sgtl5000 1-000a: Using internal LDO instead of VDDDimx-sgtl5000 sound.27: sgtl5000 <-> 2028000.ssi mapping okTCP: cubic registeredNET: Registered protocol family 10sit: IPv6 over IPv4 tunneling driverNET: Registered protocol family 17can: controller area network core (rev 20120528 abi 9)NET: Registered protocol family 29can: raw protocol (rev 20120528)can: broadcast manager protocol (rev 20120528 t)can: netlink gateway (rev 20130117) max_hops=18021q: 802.1Q VLAN Support v1.8Key type dns_resolver registeredVFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4input: gpio-keys.21 as /devices/soc0/gpio-keys.21/input/input0snvs_rtc 20cc034.snvs-rtc-lp: setting system clock to 1970-01-01 00:00:00 UTC (0)ALSA device list: #0: imx6q-sgtl5000EXT4-fs (mmcblk0p1): recovery completeEXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)VFS: Mounted root (ext4 filesystem) on device 179:1.devtmpfs: mountedFreeing unused kernel memory: 264K (80be8000 - 80c2a000)----------mount all..........----------Starting mdev......Please press Enter to activate this console. @tqimx6q #
So far, the tqimx6q audio card driver has been transplanted. If you have any questions, please leave a message.
Author: girlkoo
Link: http://blog.csdn.net/girlkoo/article/details/45853165