From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hugh Cole-Baker Subject: Re: [PATCH] arm64: dts: rockchip: add analog audio nodes on rk3399-rockpro64 Date: Wed, 13 Nov 2019 10:02:10 -0500 Message-ID: References: <20190907174833.19957-1-katsuhiro@katsuster.net> <81666aeb-f3d0-e653-6597-0711a05f9b8d@katsuster.net> <1ecd115a-1d33-020d-4a09-6fc451588920@katsuster.net> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Vasily Khoruzhick Cc: Katsuhiro Suzuki , linux-rockchip@lists.infradead.org, Heiko Stuebner , arm-linux , linux-kernel List-Id: linux-rockchip.vger.kernel.org > On 12 Nov 2019, at 14:46, Vasily Khoruzhick = wrote: >=20 > On Tue, Nov 12, 2019 at 10:34 AM Katsuhiro Suzuki > wrote: >>=20 >> On 2019/11/12 14:49, Vasily Khoruzhick wrote: >>> On Mon, Nov 11, 2019 at 9:43 PM Vasily Khoruzhick = wrote: >>>>=20 >>>> On Mon, Nov 11, 2019 at 9:34 PM Katsuhiro Suzuki >>>> wrote: >>>>>=20 >>>>> Hello Vasily, >>>>>=20 >>>>> Thank you for valuable information. >>>>>=20 >>>>> On 2019/11/12 4:25, Vasily Khoruzhick wrote: >>>>>> On Sun, Nov 10, 2019 at 9:40 PM Vasily Khoruzhick = wrote: >>>>>>>=20 >>>>>>> On Sun, Nov 10, 2019 at 7:30 PM Katsuhiro Suzuki >>>>>>> wrote: >>>>>>>>=20 >>>>>>>> Hello Vasily, >>>>>>>=20 >>>>>>> Hi Katsuhiro, >>>>>>>=20 >>>>>>> Thanks for response! >>>>>>=20 >>>>>> Looks like on my board codec sits at address 0x10, and according = to >>>>>> schematics that's what its address is supposed to be. >>>>>>=20 >>>>>> See http://files.pine64.org/doc/rockpro64/rockpro64_v21-SCH.pdf >>>>>>=20 >>>>>> Codec address is selected by pin CE of ES8316, and on rockpro64 = it >>>>>> goes to GND through R226. So address should be 0x10. >>>>>>=20 >>>>>=20 >>>>> Yes, I agree. The schematics both v2.0 and v2.1 say that ES8316 >>>>> address is 0x10. Thank you for pointing. >>>>>=20 >>>>> But I wonder that my RockPro64 behavior is strange, he is in = address >>>>> 0x11. (R226 on my board is broken...??) >>>>>=20 >>>>> root@rockpro64:~# i2cdetect 1 >>>>> WARNING! This program can confuse your I2C bus, cause data loss = and worse! >>>>> I will probe file /dev/i2c-1. >>>>> I will probe address range 0x03-0x77. >>>>> Continue? [Y/n] y >>>>> 0 1 2 3 4 5 6 7 8 9 a b c d e f >>>>> 00: -- -- -- -- -- -- -- -- -- -- -- -- -- >>>>> 10: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- >>>>> 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >>>>> 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >>>>> 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >>>>> 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >>>>> 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >>>>> 70: -- -- -- -- -- -- -- -- >>>>>=20 >>>>> I plan to check R226 resistance value to judge R226 is broken or = not >>>>> after return to home. And share the result with you. >>>>> Please give me a time. >>>>=20 >>>> Thanks for confirming that on your board it's on address 0x11. I >>>> checked with some other rockpro64 owners and they have it on 0x10, = but >>>> looks like we have boards with codec on different address in the = wild. >>>=20 >>> Another datapoint is that my board is 2.0. If yours is 2.1 it can be = a >>> difference between 2.0 and 2.1. >>>=20 >>=20 >> I'm using v2.1 board. >>=20 >>=20 >> I'll share the checking result. It's a little strange. >>=20 >> 1) Voltage of CE pin of ES8316 >>=20 >> It is 1.8V when booting linux-next kernel. >>=20 >>=20 >> 2) My board >>=20 >> I can't find no crack nor broken parts on my board. >>=20 >>=20 >> 2) R225, R226 >>=20 >> As you know, RockPro64 board has no silk print so we cannot know >> perfectly which resistance is R226. So this is my assumption. >>=20 >> PCIe, SD card slot >> (top) >> LAN (left)ES8316(right) USB, reset button >>=20 >> On the left space of ES8316 there is no resistance, only a pattern. >> This is maybe R225. And 10K resistance on the right side of a >> pattern. I assume this is R226. >>=20 >> If my assumption is correctly, board implementation and schematics >> are different. >>=20 >> schematics of v2.1 gets something wrong...?? >=20 > Guess we need few more RockPro64 v2.1 owners to confirm that it's > indeed the case. I also have a RockPro64 board v2.1, and my ES8316 codec is at address = 0x11. I'm using a kernel with Katsuhiro's patch and I can use alsamixer and = play sounds out of the analog jack. My i2cdetect output: root@kodi64:~# i2cdetect 1 WARNING! This program can confuse your I2C bus, cause data loss and = worse! I will probe file /dev/i2c-1. I will probe address range 0x03-0x77. Continue? [Y/n] 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- =E2=80=94 Regards, Hugh >=20 >>=20 >>>>> Best Regards, >>>>> Katsuhiro Suzuki >>>>>=20 >>>>>=20 >>>>>>>> Thank you for reporting. >>>>>>>>=20 >>>>>>>> On 2019/11/11 9:17, Vasily Khoruzhick wrote: >>>>>>>>> On Sat, Sep 7, 2019 at 10:48 AM Katsuhiro Suzuki >>>>>>>>> wrote: >>>>>>>>>>=20 >>>>>>>>>> This patch adds audio codec (Everest ES8316) and I2S audio = nodes for >>>>>>>>>> RK3399 RockPro64. >>>>>>>>>=20 >>>>>>>>> Hi Katsuhiro, >>>>>>>>>=20 >>>>>>>>> I tested your patch with my rockpro64 on 5.4-rc6 which has = your other >>>>>>>>> patches to es8316 driver, but apparently it doesn't work. >>>>>>>>>=20 >>>>>>>>> 'alsamixer' complains 'cannot load mixer controls: No such = device or >>>>>>>>> address' and if I try to play audio with mpg123 it pretends = that it >>>>>>>>> plays something but there's no sound. >>>>>>>>>=20 >>>>>>>>> Any idea what can be wrong? >>>>>>>>>=20 >>>>>>>>=20 >>>>>>>> Do you use defconfig? If so I guess we need turn on more = configs: >>>>>>>>=20 >>>>>>>> - simple-graph-card driver (CONFIG_SND_AUDIO_GRAPH_CARD) >>>>>>>> - ES8316 (SND_SOC_ES8316) >>>>>>>=20 >>>>>>> I have these enabled, card is present in /proc/asound/cards, but >>>>>>> alsamixer doesn't work with it. >>>>>>>=20 >>>>>>>> FYI) ASoC related status or logs in my environment as follows: >>>>>>>>=20 >>>>>>>> root@rockpro64:~# uname -a >>>>>>>> Linux rockpro64 5.4.0-rc6-next-20191108 #169 SMP PREEMPT Mon = Nov 11 12:21:44 JST 2019 aarch64 GNU/Linux >>>>>>>=20 >>>>>>> I'm running 5.4.0-rc6 (commit >>>>>>> 00aff6836241ae5654895dcea10e6d4fc5878ca6) with your patch = "arm64: dts: >>>>>>> rockchip: add analog audio nodes on rk3399-rockpro64" on top of = it. >>>>>>>=20 >>>>>>>> root@rockpro64:~# dmesg | grep -i asoc >>>>>>>> [ 21.509903] asoc-simple-card hdmi-sound: i2s-hifi <-> = ff8a0000.i2s mapping ok >>>>>>>> [ 21.510550] asoc-simple-card hdmi-sound: ASoC: no DMI vendor = name! >>>>>>>> [ 21.567906] asoc-audio-graph-card sound: ES8316 HiFi <-> = ff890000.i2s mapping ok >>>>>>>> [ 21.568565] asoc-audio-graph-card sound: ASoC: no DMI vendor = name! >>>>>>>=20 >>>>>>> Similar here: >>>>>>>=20 >>>>>>> [vasilykh@rockpro64 ~]$ dmesg | grep -i asoc >>>>>>> [ 15.627685] asoc-audio-graph-card sound: ES8316 HiFi <-> >>>>>>> ff890000.i2s mapping ok >>>>>>> [ 16.250196] asoc-simple-card hdmi-sound: i2s-hifi <-> = ff8a0000.i2s mapping ok >>>>>>>=20 >>>>>>>> root@rockpro64:~# cat /proc/asound/pcm >>>>>>>> 00-00: ff8a0000.i2s-i2s-hifi i2s-hifi-0 : ff8a0000.i2s-i2s-hifi = i2s-hifi-0 : playback 1 >>>>>>>> 01-00: ff890000.i2s-ES8316 HiFi ES8316 HiFi-0 : = ff890000.i2s-ES8316 HiFi ES8316 HiFi-0 : playback 1 : capture 1 >>>>>>>=20 >>>>>>> Same here: >>>>>>>=20 >>>>>>> [vasilykh@rockpro64 ~]$ cat /proc/asound/pcm >>>>>>> 00-00: ff890000.i2s-ES8316 HiFi ES8316 HiFi-0 : = ff890000.i2s-ES8316 >>>>>>> HiFi ES8316 HiFi-0 : playback 1 : capture 1 >>>>>>> 01-00: ff8a0000.i2s-i2s-hifi i2s-hifi-0 : ff8a0000.i2s-i2s-hifi >>>>>>> i2s-hifi-0 : playback >>>>>>>=20 >>>>>>>> root@rockpro64:~# cat /sys/kernel/debug/asoc/components >>>>>>>> hdmi-audio-codec.3.auto >>>>>>>> ff8a0000.i2s >>>>>>>> ff8a0000.i2s >>>>>>>> ff890000.i2s >>>>>>>> ff890000.i2s >>>>>>>> ff880000.i2s >>>>>>>> ff880000.i2s >>>>>>>> es8316.1-0011 >>>>>>>> snd-soc-dummy >>>>>>>> snd-soc-dummy >>>>>>>=20 >>>>>>> Same here. >>>>>>>=20 >>>>>>>> root@rockpro64:~# cat /sys/kernel/debug/asoc/dais >>>>>>>> i2s-hifi >>>>>>>> ff8a0000.i2s >>>>>>>> ff890000.i2s >>>>>>>> ff880000.i2s >>>>>>>> ES8316 HiFi >>>>>>>> snd-soc-dummy-dai >>>>>>>=20 >>>>>>> Same here. >>>>>>>=20 >>>>>>> Yet alsamixer doesn't work for me. It terminates with 'cannot = load >>>>>>> mixer controls: No such device or address'. Strace shows that = fails >>>>>>> here: >>>>>>>=20 >>>>>>> openat(AT_FDCWD, "/dev/snd/controlC0", O_RDWR|O_CLOEXEC) =3D 3 >>>>>>> fcntl(3, F_SETFD, FD_CLOEXEC) =3D 0 >>>>>>> ioctl(3, SNDRV_CTL_IOCTL_PVERSION, 0xfffffd3ad04c) =3D 0 >>>>>>> fcntl(3, F_GETFL) =3D 0x20002 (flags = O_RDWR|O_LARGEFILE) >>>>>>> fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK|O_LARGEFILE) =3D 0 >>>>>>> ioctl(3, SNDRV_CTL_IOCTL_ELEM_LIST, 0xfffffd3ad228) =3D 0 >>>>>>> ioctl(3, SNDRV_CTL_IOCTL_ELEM_LIST, 0xfffffd3ad228) =3D 0 >>>>>>> ioctl(3, SNDRV_CTL_IOCTL_ELEM_INFO, 0xfffffd3ace38) =3D 0 >>>>>>> ioctl(3, SNDRV_CTL_IOCTL_ELEM_READ, 0xfffffd3ac160) =3D -1 ENXIO = (No >>>>>>> such device or address) >>>>>>>=20 >>>>>>> Looks like it fails to talk to the codec? >>>>>>>=20 >>>>>>> mpg123 thinks that it's playing audio, but my headphones = connected to >>>>>>> 3.5mm output are silent. >>>>>>>=20 >>>>>>> Regards, >>>>>>> Vasily >>>>>>>=20 >>>>>>>=20 >>>>>>>> Best Regards, >>>>>>>> Katsuhiro Suzuki >>>>>>>>=20 >>>>>>>>=20 >>>>>>>>> Regards, >>>>>>>>> Vasily >>>>>>>>>=20 >>>>>>>>>> Signed-off-by: Katsuhiro Suzuki >>>>>>>>>> --- >>>>>>>>>> .../boot/dts/rockchip/rk3399-rockpro64.dts | 28 = +++++++++++++++++++ >>>>>>>>>> 1 file changed, 28 insertions(+) >>>>>>>>>>=20 >>>>>>>>>> diff --git = a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts = b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts >>>>>>>>>> index 0401d4ec1f45..8b1e6382b140 100644 >>>>>>>>>> --- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts >>>>>>>>>> +++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts >>>>>>>>>> @@ -81,6 +81,12 @@ >>>>>>>>>> reset-gpios =3D <&gpio0 RK_PB2 = GPIO_ACTIVE_LOW>; >>>>>>>>>> }; >>>>>>>>>>=20 >>>>>>>>>> + sound { >>>>>>>>>> + compatible =3D "audio-graph-card"; >>>>>>>>>> + label =3D "rockchip,rk3399"; >>>>>>>>>> + dais =3D <&i2s1_p0>; >>>>>>>>>> + }; >>>>>>>>>> + >>>>>>>>>> vcc12v_dcin: vcc12v-dcin { >>>>>>>>>> compatible =3D "regulator-fixed"; >>>>>>>>>> regulator-name =3D "vcc12v_dcin"; >>>>>>>>>> @@ -470,6 +476,20 @@ >>>>>>>>>> i2c-scl-rising-time-ns =3D <300>; >>>>>>>>>> i2c-scl-falling-time-ns =3D <15>; >>>>>>>>>> status =3D "okay"; >>>>>>>>>> + >>>>>>>>>> + es8316: codec@11 { >>>>>>>>>> + compatible =3D "everest,es8316"; >>>>>>>>>> + reg =3D <0x11>; >>>>>>>>>> + clocks =3D <&cru SCLK_I2S_8CH_OUT>; >>>>>>>>>> + clock-names =3D "mclk"; >>>>>>>>>> + #sound-dai-cells =3D <0>; >>>>>>>>>> + >>>>>>>>>> + port { >>>>>>>>>> + es8316_p0_0: endpoint { >>>>>>>>>> + remote-endpoint =3D = <&i2s1_p0_0>; >>>>>>>>>> + }; >>>>>>>>>> + }; >>>>>>>>>> + }; >>>>>>>>>> }; >>>>>>>>>>=20 >>>>>>>>>> &i2c3 { >>>>>>>>>> @@ -505,6 +525,14 @@ >>>>>>>>>> rockchip,playback-channels =3D <2>; >>>>>>>>>> rockchip,capture-channels =3D <2>; >>>>>>>>>> status =3D "okay"; >>>>>>>>>> + >>>>>>>>>> + i2s1_p0: port { >>>>>>>>>> + i2s1_p0_0: endpoint { >>>>>>>>>> + dai-format =3D "i2s"; >>>>>>>>>> + mclk-fs =3D <256>; >>>>>>>>>> + remote-endpoint =3D <&es8316_p0_0>; >>>>>>>>>> + }; >>>>>>>>>> + }; >>>>>>>>>> }; >>>>>>>>>>=20 >>>>>>>>>> &i2s2 { >>>>>>>>>> -- >>>>>>>>>> 2.23.0.rc1 >>>>>>>>>>=20 >>>>>>>>>>=20 >>>>>>>>>> _______________________________________________ >>>>>>>>>> linux-arm-kernel mailing list >>>>>>>>>> linux-arm-kernel@lists.infradead.org >>>>>>>>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >>>>>>>>>=20 >>>>>>>>=20 >>>>>>=20 >>>>>=20 >>>=20 >>=20 >=20 > _______________________________________________ > Linux-rockchip mailing list > Linux-rockchip@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-rockchip