Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4487370pxv; Tue, 29 Jun 2021 08:09:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLMLDDy4eJOeaMPlbE3vNMR/n2rOIF71CbY6aJkHYzibLRZSmCMvbF4jjdDyFCoOsuI3un X-Received: by 2002:a05:6402:2815:: with SMTP id h21mr42374625ede.150.1624979353196; Tue, 29 Jun 2021 08:09:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624979353; cv=none; d=google.com; s=arc-20160816; b=Qsr6jyz2Vvx7MjUNXmWQqzm863yOTr2GhOKQoA07MiEJSsX/NQquVk0Fj1rhGQiFR3 ApaN5kL25j5ic97U+X07Za/f5v2xqMclgAI1g66opmrtmaXlCGs8aC6GXVCzHr6G++zx vgkfbVNYglAy+wXukKV8+YgLXci4qT8+x15JA//+iz+wrrDmBCyxYL1yhuF/edv0k/x3 puB5L3dS+ziIsoVcCpBBUcNFRcE4UlC4KL8kBxJU+MHsboVTiHjvvCLh85w4imjO7VT5 ZpiMol9lpwm5MONbQ3F38vIBlgt11Q0oRKZa3TIpKCFuZlumVkm6Ui110uU8PNKV9ijm Ve1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=8jTk5ws3HCuCcjdefBLvacZd229nGiKNhYc4K5GWGoc=; b=jz0cJdOh4f+Pluwv8zUbL4uoPbEm4luI81VlGUrAFUgtS3gPhPm5si+U9xkN4pO1Ns L6xPObvnKhArCUJe11iOMMnyxPG4921zcyZ2IgukPZpwb8wszWJebddBkl1QMY7SSOq8 pAWJPApRHGE7sIGHOtx2BolOXOQHkmvZ1mPGAH20O4fXfOPtZJnwLWWDC48Hy+Vb+JJh UoiCP5V0UoiE/cqabdQGoejnJ1g0rSVwNgEbKd7RzNH//oWfPjRLA3lot+VOHMSyTqRs fCvx30bP/ycTeCH6OQKCBrTriBR1oAEWgo1Y4bVrjNXuPxUJ2SatSiWyEUBpUHMqj8WV 6/iA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f18si17086838ejq.333.2021.06.29.08.08.48; Tue, 29 Jun 2021 08:09:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234641AbhF2PJs (ORCPT + 99 others); Tue, 29 Jun 2021 11:09:48 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:60446 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234529AbhF2PJr (ORCPT ); Tue, 29 Jun 2021 11:09:47 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: aratiu) with ESMTPSA id 49F041F42FFF From: Adrian Ratiu To: Alex Bee Cc: Heiko Stuebner , jack@radxa.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Rob Herring Subject: Re: [PATCH] arm64: dts: rockchip: add rock-pi-4 analog audio In-Reply-To: <7f806d30-594e-2325-615a-8fee875c83a8@gmail.com> References: <20210628113033.9145-1-adrian.ratiu@collabora.com> <7f806d30-594e-2325-615a-8fee875c83a8@gmail.com> Date: Tue, 29 Jun 2021 18:07:15 +0300 Message-ID: <87eeck3e1o.fsf@ryzen9.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 Content-Type: text/plain; format=flowed Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alex, On Tue, 29 Jun 2021, Alex Bee wrote: > Hi Adrian, > > I've submitted similar patch already. Its part of [1] Thank you for pointing out your patch, I was not aware of it as it was not merged yet (I tested latest linux-next). It is a good sign that our code is almost identical except for the headphone detect pin which you mention. > > There is no headphone detection pin in the schematics, btw. > There are two reasons I added it: 1. The es8316 codec failed to probe() in my testing unless the irq was defined. That might have been due to me testing the codec directly with the simple card driver instead of the graph driver. Point 1 doesn't appear to be an issue anymore, the codec + graph driver probe correctly and audio supposedly (see below) works even without the irq. 2. I got the gpio bank 1 pin 0 location from various headphone detection commits in the vendor v4.4 kernel, like for example [1]. Are you 100% sure there is no hp detection pin wired on the rock-pi-4? Even if it might be missing from the schematics, the vendor driver code apparently defines and uses it? From booting with the irq defined I get the following in /proc/interrupts however I'm having an unrelated difficulty testing because the audio connector literally broke off the board like in [2]. 90: 1 0 0 0 0 rockchip_gpio_irq 0 Level es8316 Team Radxa was very nice in offering me a replacement but until that arrives I can't test this anymore. [1] https://github.com/radxa/kernel/commit/e945cad5c3ec82d171760465d3c7a84bb10ed1b7 [2] https://forum.radxa.com/t/audio-jack-broke-off/935 > [1] > https://patchwork.kernel.org/project/linux-rockchip/cover/20210618181256.27992-1-knaerzche@gmail.com/ > > Best, > > Alex > > Am 28.06.21 um 13:30 schrieb Adrian Ratiu: >> This adds the necessary pinctrl and nodes to enable the >> analog audio on rk3399 rock-pi-4 SBCs using the es8316 >> codec and the audio-graph-card driver. >> >> Signed-off-by: Adrian Ratiu >> --- >> .../boot/dts/rockchip/rk3399-rock-pi-4.dtsi | 38 +++++++++++++++++++ >> 1 file changed, 38 insertions(+) >> >> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi >> index b28888ea9262..77781d9150ac 100644 >> --- a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi >> +++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi >> @@ -128,6 +128,12 @@ vdd_log: vdd-log { >> regulator-max-microvolt = <1400000>; >> vin-supply = <&vcc5v0_sys>; >> }; >> + >> + sound { >> + compatible = "audio-graph-card"; >> + label = "rockchip,rk3399"; >> + dais = <&i2s0_p0>; >> + }; >> }; >> >> &cpu_l0 { >> @@ -422,6 +428,24 @@ &i2c1 { >> i2c-scl-rising-time-ns = <300>; >> i2c-scl-falling-time-ns = <15>; >> status = "okay"; >> + >> + es8316: codec@11 { >> + compatible = "everest,es8316"; >> + reg = <0x11>; >> + clocks = <&cru SCLK_I2S_8CH_OUT>; >> + clock-names = "mclk"; >> + pinctrl-names = "default"; >> + pinctrl-0 = <&hp_det_pin>; >> + interrupt-parent = <&gpio1>; >> + interrupts = ; >> + #sound-dai-cells = <0>; >> + >> + port { >> + es8316_p0_0: endpoint { >> + remote-endpoint = <&i2s0_p0_0>; >> + }; >> + }; >> + }; >> }; >> >> &i2c3 { >> @@ -441,6 +465,14 @@ &i2s0 { >> rockchip,capture-channels = <2>; >> rockchip,playback-channels = <2>; >> status = "okay"; >> + >> + i2s0_p0: port { >> + i2s0_p0_0: endpoint { >> + dai-format = "i2s"; >> + mclk-fs = <256>; >> + remote-endpoint = <&es8316_p0_0>; >> + }; >> + }; >> }; >> >> &i2s1 { >> @@ -556,6 +588,12 @@ wifi_host_wake_l: wifi-host-wake-l { >> rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; >> }; >> }; >> + >> + es8316 { >> + hp_det_pin: hp-det-pin { >> + rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>; >> + }; >> + }; >> }; >> >> &pwm2 {