Message ID | 875yckands.wl-kuninori.morimoto.gx@renesas.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Series | arm64: dts: renesas: add V4H White Hawk Sound support | expand |
Hi Morimoto-san, On Thu, Feb 2, 2023 at 2:04 AM Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> wrote: > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > > These adds R-Car Sound support for WhiteHawk board using ARD-AUDIO-DA7212 > external audio board. > > Signed-off-by: Linh Phung <linh.phung.jy@renesas.com> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Thanks for your patch! > --- /dev/null > +++ b/arch/arm64/boot/dts/renesas/r8a779g0-white-hawk-ard-audio-da7212.dts > @@ -0,0 +1,194 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Device Tree Source for the White Hawk boards with R-Car V4H + ARD-AUDIO-DA7212 Board > + * > + * You can find and buy "ARD-AUDIO-DA7212" at Digi-Key > + * > + * https://www.digikey.jp/en/products/detail/ARD-AUDIO-DA7212/1564-1021-ND/5456357?curr=usd&utm_campaign=buynow&utm_medium=aggregator&utm_source=octopart Please drop the question mark and everything after it from the URL. > + * [Connection] > + * > + * White Hawk ARD-AUDIO-DA7212 > + * +----------------------------+ > + * |CPU board | > + * | | > + * |CN40 (IO PIN HEADER) | > + * | AUDIO_CLKIN_V pin1 |<--\ +---------------+ > + * |(*) GP1_25/SL_SW2_V pin2 |<--/ |J2 | > + * | AUDIO_CLKOUT_V pin5 |<----->| pin7 MCLK | > + * | SSI_SCK_V pin9 |<----->| pin1 BCLK | > + * | SSI_WS_V pin13 |<----->| pin3 WCLK | > + * | SSI_SD_V pin15 |<----->| pin5 DATIN | (@) > + * | | \-->| pin15 DATOUT | [CAPTURE] > + * +----------------------------+ +---------------+ > + * (*) GP1_25/SL_SW2_V is used as TPU > + * (@) Connect to pin5 (DATIN = playback) or pin15 (DATOUT = capture) > + * > + * +----------------------------+ > + * |Breakout board | > + * | | +---------------+ > + * |CN34 (I2C CN) | |J1 | > + * | I2C0_SCL pin3 |<----->| pin20 SCL | > + * | I2C0_SDA pin5 |<----->| pin18 SDA | > + * +----------------------------+ +--->| pin14 GND | > + * | +---------------+ > + * +----------------------------+ | > + * |Switch Board | | > + * | | | +---------------+ > + * |CN5 GND |<-+ |J7 | Probably it would be more logical to wire GND to pin 14 of J7 (which is the power connector) instead? Doesn't matter much though, as all GND signals are connected to each other. > + * | 3v3 |<----->| pin8 (+3.3v) | Do you need the Switch Board? GND and SPI_D1.8V/3.3V and I2C_D1.8V/3.3V (which are 3.3V by default) are available on CN40 and CN34 above, too. > +/dts-v1/; > +#include "r8a779g0-white-hawk.dts" Please do not include "r8a779g0-white-hawk.dts", but make this file a .dtso (DTS overlay) instead, cfr. salvator-panel-aa104xd12.dtso. > +&i2c0 { > + da7212: codec@1a { > + compatible = "dlg,da7212"; > + > + #sound-dai-cells = <0>; > + #address-cells = <1>; > + #size-cells = <0>; > + > + reg = <0x1a>; > + > + clocks = <&rcar_sound>; > + clock-names = "mclk"; > + > + dlg,micbias1-lvl = <2500>; > + dlg,micbias2-lvl = <2500>; > + dlg,dmic-data-sel = "lrise_rfall"; > + dlg,dmic-samplephase = "between_clkedge"; > + dlg,dmic-clkrate = <3000000>; > + > + VDDA-supply = <®_1p8v>; > + VDDSP-supply = <®_5p0v>; As the wiring above does not provide VDD_SP (which is fine if the speaker is not connected), you can drop VDDSP-supply, and [PATCH 6/9] providing reg_5p0v. FTR, "VDDSP-supply" is not documented in the DA7212 DT bindings. > + VDDMIC-supply = <®_3p3v>; > + VDDIO-supply = <®_3p3v>; > + > + port@0 { > + da7212_endpoint: endpoint { > + remote-endpoint = <&rsnd_endpoint>; > + }; > + }; > + }; > +}; Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi Geert > > + * You can find and buy "ARD-AUDIO-DA7212" at Digi-Key > > + * > > + * https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.digikey.jp%2Fen%2Fproducts%2Fdetail%2FARD-AUDIO-DA7212%2F1564-1021-ND%2F5456357%3Fcurr%3Dusd%26utm_campaign%3Dbuynow%26utm_medium%3Daggregator%26utm_source%3Doctopart&data=05%7C01%7Ckuninori.morimoto.gx%40renesas.com%7C809b5824f9e74675c42708db0b6b633c%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C638116328075928235%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=LuhLL%2BL0O5NaBHeocnJ%2FHDVEZ1PC8FYyY1gNErCrDEA%3D&reserved=0 > > Please drop the question mark and everything after it from the URL. Thank you pointing it ! Will do in v2 > > + * +----------------------------+ | > > + * |Switch Board | | > > + * | | | +---------------+ > > + * |CN5 GND |<-+ |J7 | > > Probably it would be more logical to wire GND to pin 14 of J7 (which > is the power connector) instead? > Doesn't matter much though, as all GND signals are connected to > each other. > > > + * | 3v3 |<----->| pin8 (+3.3v) | > > Do you need the Switch Board? > GND and SPI_D1.8V/3.3V and I2C_D1.8V/3.3V (which are 3.3V by default) > are available on CN40 and CN34 above, too. I double checked around here, and noticed some miss on it. Thank you for pointing it. I will fixup in v2. About power, indeed we can find many 3v3 / GND pins on WhiteHawk. But to keep simple Image I will use similar style, but will add small explanation for it on v2. > > +/dts-v1/; > > +#include "r8a779g0-white-hawk.dts" > > Please do not include "r8a779g0-white-hawk.dts", but make this file > a .dtso (DTS overlay) instead, cfr. salvator-panel-aa104xd12.dtso. OK, I see. Will do in v2 > > + VDDA-supply = <®_1p8v>; > > + VDDSP-supply = <®_5p0v>; > > As the wiring above does not provide VDD_SP (which is fine if the > speaker is not connected), you can drop VDDSP-supply, and [PATCH 6/9] > providing reg_5p0v. > > FTR, "VDDSP-supply" is not documented in the DA7212 DT bindings. Thank you for pointing it. I didn't noticed about it, will fix in v2. And as you mentioned, we can remove [6/9] patch. Thank you for your help !! Best regards --- Kuninori Morimoto
diff --git a/arch/arm64/boot/dts/renesas/Makefile b/arch/arm64/boot/dts/renesas/Makefile index 0699b51c1247..df80c30e03ce 100644 --- a/arch/arm64/boot/dts/renesas/Makefile +++ b/arch/arm64/boot/dts/renesas/Makefile @@ -67,6 +67,7 @@ dtb-$(CONFIG_ARCH_R8A779A0) += r8a779a0-falcon.dtb dtb-$(CONFIG_ARCH_R8A779F0) += r8a779f0-spider.dtb dtb-$(CONFIG_ARCH_R8A779G0) += r8a779g0-white-hawk.dtb +dtb-$(CONFIG_ARCH_R8A779G0) += r8a779g0-white-hawk-ard-audio-da7212.dtb dtb-$(CONFIG_ARCH_R8A77951) += r8a779m1-salvator-xs.dtb dtb-$(CONFIG_ARCH_R8A77951) += r8a779m1-ulcb.dtb diff --git a/arch/arm64/boot/dts/renesas/r8a779g0-white-hawk-ard-audio-da7212.dts b/arch/arm64/boot/dts/renesas/r8a779g0-white-hawk-ard-audio-da7212.dts new file mode 100644 index 000000000000..25c89217c122 --- /dev/null +++ b/arch/arm64/boot/dts/renesas/r8a779g0-white-hawk-ard-audio-da7212.dts @@ -0,0 +1,194 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree Source for the White Hawk boards with R-Car V4H + ARD-AUDIO-DA7212 Board + * + * You can find and buy "ARD-AUDIO-DA7212" at Digi-Key + * + * https://www.digikey.jp/en/products/detail/ARD-AUDIO-DA7212/1564-1021-ND/5456357?curr=usd&utm_campaign=buynow&utm_medium=aggregator&utm_source=octopart + * + * [Connection] + * + * White Hawk ARD-AUDIO-DA7212 + * +----------------------------+ + * |CPU board | + * | | + * |CN40 (IO PIN HEADER) | + * | AUDIO_CLKIN_V pin1 |<--\ +---------------+ + * |(*) GP1_25/SL_SW2_V pin2 |<--/ |J2 | + * | AUDIO_CLKOUT_V pin5 |<----->| pin7 MCLK | + * | SSI_SCK_V pin9 |<----->| pin1 BCLK | + * | SSI_WS_V pin13 |<----->| pin3 WCLK | + * | SSI_SD_V pin15 |<----->| pin5 DATIN | (@) + * | | \-->| pin15 DATOUT | [CAPTURE] + * +----------------------------+ +---------------+ + * (*) GP1_25/SL_SW2_V is used as TPU + * (@) Connect to pin5 (DATIN = playback) or pin15 (DATOUT = capture) + * + * +----------------------------+ + * |Breakout board | + * | | +---------------+ + * |CN34 (I2C CN) | |J1 | + * | I2C0_SCL pin3 |<----->| pin20 SCL | + * | I2C0_SDA pin5 |<----->| pin18 SDA | + * +----------------------------+ +--->| pin14 GND | + * | +---------------+ + * +----------------------------+ | + * |Switch Board | | + * | | | +---------------+ + * |CN5 GND |<-+ |J7 | + * | 3v3 |<----->| pin8 (+3.3v) | + * +----------------------------+ +---------------+ + * + * [How to enable] + * + * You need these configs + * + * CONFIG_PWM_RENESAS_TPU + * CONFIG_SND_SOC_DA7213 + * + * [How to use] + * + * You need setup audio_clkin (see [(C) clock]). + * And set TPU from user space. + * Let's use duty_cycle = 50% here. + * + * For 44.1kHz (= 11289600 Hz) (= audio_clkin) + * 1000000000 / 11289600 = 88.577 = period + * + * echo 0 > /sys/class/pwm/pwmchip0/export + * echo 88 > /sys/class/pwm/pwmchip0/pwm0/period + * echo 44 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle + * echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable + * + * > aplay 22050.wav + * > aplay 44100.wav + * > aplay 88200.wav + * + * For 48kHz (= 12288000 Hz) (= audio_clkin) + * 1000000000 / 12288000 = 81.380 = period + * + * echo 0 > /sys/class/pwm/pwmchip0/export + * echo 82 > /sys/class/pwm/pwmchip0/pwm0/period + * echo 41 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle + * echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable + * + * > aplay 24000.wav + * > aplay 48000.wav + * > aplay 95000.wav + * + * You need to setup Headphone + * + * > amixer set "Headphone" 40% + * > amixer set "Headphone" on + * > amixer set "Mixout Left DAC Left" on + * > amixer set "Mixout Right DAC Right" on + * + * You can use capture (see [CAPTURE]) + * + * Copyright (C) 2022 Renesas Electronics Corp. + */ + +/dts-v1/; +#include "r8a779g0-white-hawk.dts" + +/ { + sound_card: sound { + compatible = "audio-graph-card"; + label = "rcar-sound"; + + dais = <&rsnd_port0>; /* DA7212 Audio Codec */ + }; +}; + +&pfc { + sound_pins: sound { + groups = "ssi_ctrl", "ssi_data"; + function = "ssi"; + }; + + sound_clk_pins: sound_clk { + groups = "audio_clkin", "audio_clkout"; + function = "audio_clk"; + }; + + tpu0_pins: tpu0 { + groups = "tpu_to0_a"; + function = "tpu"; + }; +}; + +&tpu { + pinctrl-0 = <&tpu0_pins>; + pinctrl-names = "default"; + + status = "okay"; +}; + +&i2c0 { + da7212: codec@1a { + compatible = "dlg,da7212"; + + #sound-dai-cells = <0>; + #address-cells = <1>; + #size-cells = <0>; + + reg = <0x1a>; + + clocks = <&rcar_sound>; + clock-names = "mclk"; + + dlg,micbias1-lvl = <2500>; + dlg,micbias2-lvl = <2500>; + dlg,dmic-data-sel = "lrise_rfall"; + dlg,dmic-samplephase = "between_clkedge"; + dlg,dmic-clkrate = <3000000>; + + VDDA-supply = <®_1p8v>; + VDDSP-supply = <®_5p0v>; + VDDMIC-supply = <®_3p3v>; + VDDIO-supply = <®_3p3v>; + + port@0 { + da7212_endpoint: endpoint { + remote-endpoint = <&rsnd_endpoint>; + }; + }; + }; +}; + +&audio_clkin { + clock-frequency = <11289600>; /* 44.1kHz groups [(C) clock] */ +// clock-frequency = <12288000>; /* 48 kHz groups [(C) clock] */ +}; + +&rcar_sound { + pinctrl-0 = <&sound_clk_pins>, <&sound_pins>; + pinctrl-names = "default"; + + /* Single DAI */ + #sound-dai-cells = <0>; + + /* audio_clkout */ + #clock-cells = <0>; + clock-frequency = <5644800>; /* 44.1kHz groups [(C) clock] */ +// clock-frequency = <6144000>; /* 48 kHz groups [(C) clock] */ + + status = "okay"; + + ports { + rsnd_port0: port@0 { + rsnd_endpoint: endpoint { + remote-endpoint = <&da7212_endpoint>; + + dai-format = "i2s"; + bitclock-master = <&rsnd_endpoint>; + frame-master = <&rsnd_endpoint>; + + /* Please use exclusively to the 'capture' */ + playback = <&ssi0>; + /* [CAPTURE] */ + /* capture = <&ssi0>; */ + }; + }; + }; +};