Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4592174pxv; Tue, 29 Jun 2021 10:32:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqdzt9NZTkn4ZN0kbRnMM9+q4E0+VJ6WX1mRsZmwCKEQv8AaB8YrU4mbUkM3FZ1wxE2Umt X-Received: by 2002:a92:c78d:: with SMTP id c13mr23733299ilk.11.1624987947220; Tue, 29 Jun 2021 10:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624987947; cv=none; d=google.com; s=arc-20160816; b=qhk5wxDPFxZGN2EcuELuFZmuqn7gES2aqF7iGJ5xfhZf0HRFXFOeN1P4Jl9lc03Q1Y SN6m47Wyk0uQ09bcSIRlM1vrtUtNheE5SDB5iZLtNwCcGwt81u6kvO98YPmfSoaYF/WY 41s5qPgFfn3o8Lw2K8LUQsagmSJIh+gOWiNy3AkFW6K/kUbX8TGBiuIMc4BNYJ6S8yyx pBojU+ywNHV7S8h0nNvBV//FgBk96tNZfaTPFfHvfKsHJUEKcVnqnrQTVwZ0C/NQrfgH DHngGFi8BOaqjzTu+kgJv5uE1cgZ1fp4XtJGH5g2wUX7+V3P01atNzzXksfbfmbalvuR CfHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:user-agent:subject :message-id:mime-version:to:cc:date:in-reply-to:from; bh=IExN6ZJ3lTmeEMzCIJ7ncdsClFUmO2Ju1twDBT8Hx5g=; b=gZAnEnusfj8iNP48pO51Hae0MK6ksIg6dL2Pxt/88Tw14TGCDBBNZuCjvx3qSSpTsm Dk6LgfwI/kE2+Tu5KWaDIC1kR1jcYak0VRwHkBS0Y9VMBJ5Oyqi8egc5RDPxHsFaMLbR olPvT33Kt4JD6yF3OBTpYBdTXXRSmNZWF66PYFIyaiHc61jj+qHwwnN30CB98WB4B4iC 2lT8Qszqs3mkDQFBXVbTmkKwkbeXKWne9OiRcIWvryIEFnWyBbLQj9uHE1FntcrRISFi DtWqW0l8ZarMrM1ObTdy+EKbJ1cCsz0raVDKYHZV0eaBvpvOcsSUveTmfNONQC1VXEY2 I2Lw== 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 w4si24313922iov.14.2021.06.29.10.32.12; Tue, 29 Jun 2021 10:32:27 -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 S234481AbhF2RdS convert rfc822-to-8bit (ORCPT + 99 others); Tue, 29 Jun 2021 13:33:18 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:33974 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234182AbhF2RdS (ORCPT ); Tue, 29 Jun 2021 13:33:18 -0400 Received: from chickenburger.collabora.co.uk (chickenburger.collabora.co.uk [46.235.227.242]) by bhuna.collabora.co.uk (Postfix) with ESMTP id 223B51F42F26; Tue, 29 Jun 2021 18:30:49 +0100 (BST) From: "Adrian Ratiu" In-Reply-To: Content-Type: text/plain; charset="utf-8" X-Forward: 188.24.96.153 Date: Tue, 29 Jun 2021 18:30:49 +0100 Cc: "Robin Murphy" , "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" To: "Alex Bee" MIME-Version: 1.0 Message-ID: <131f-60db5900-1d-7b1f8480@92301631> Subject: =?utf-8?q?Re=3A?= [PATCH] =?utf-8?q?arm64=3A?==?utf-8?q?_dts=3A?= =?utf-8?q?_rockchip=3A?= add rock-pi-4 analog audio User-Agent: SOGoMail 5.0.1 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, June 29, 2021 20:04 EEST, Alex Bee wrote: > Hi Adrian, Hi Robin > Am 29.06.21 um 17:42 schrieb Robin Murphy: > > On 2021-06-29 16:07, Adrian Ratiu wrote: > >> 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. > I guess that just a "warning" that doesn't mean the driver failed to > probe. (It the same for RockPro64, for example - where the interrupt > line isn't connected as well) > >> > >> 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? > > > > FWIW according to the schematics it *is* wired up on the Model C board, > > but not on the Model A or B. > > > Thanks for the pointer, I did look at v1.3 only, tbh. > > I'm not sure I understand why we should pull up this pin. > > Shouldn't we better use hp-det-gpio property of audio-graph-card to make > real use of this pin? That sounds like the best way forward, only on the model / revision which actually has the pin connected. > > > Robin. > > > >>  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 > According to the Model C schematics the codec interrupt (HP_INT) is > connected to GPIO1_PA1 (in contrast to GPIO1_PA0 which is used for hp > detection). > > If you're OK I'll update my series and add those pins for Model C only > (and will request the schematics of A+ and B+ which seem not to be > published yet to check out what the manufacturer decided for those variants) Yes, thank you very much! Please CC me on the new series, hopefully I can provide a tested-by if I receive the fixed HW by then. Adrian > > Alex > >> > >> 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 { > >> > >> _______________________________________________ > >> Linux-rockchip mailing list > >> Linux-rockchip@lists.infradead.org > >> http://lists.infradead.org/mailman/listinfo/linux-rockchip > > > > _______________________________________________ > > Linux-rockchip mailing list > > Linux-rockchip@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-rockchip >