xref: /freebsd/sys/contrib/device-tree/src/arm64/renesas/white-hawk-ard-audio-da7212.dtso (revision ae5de77ed78ae54d86cead5604869212e8008e6b)
12846c905SEmmanuel Vadot// SPDX-License-Identifier: GPL-2.0
22846c905SEmmanuel Vadot/*
32846c905SEmmanuel Vadot * Device Tree Source for White Hawk (Single) board with ARD-AUDIO-DA7212 board
42846c905SEmmanuel Vadot *
52846c905SEmmanuel Vadot * You can find and buy "ARD-AUDIO-DA7212" at Digi-Key
62846c905SEmmanuel Vadot *
72846c905SEmmanuel Vadot *	https://www.digikey.jp/en/products/detail/ARD-AUDIO-DA7212/1564-1021-ND/5456357
82846c905SEmmanuel Vadot *
92846c905SEmmanuel Vadot * Copyright (C) 2022 Renesas Electronics Corp.
102846c905SEmmanuel Vadot *
112846c905SEmmanuel Vadot *
122846c905SEmmanuel Vadot * [Connection]
132846c905SEmmanuel Vadot *
142846c905SEmmanuel Vadot * White Hawk				ARD-AUDIO-DA7212
152846c905SEmmanuel Vadot * +----------------------------+
162846c905SEmmanuel Vadot * |CPU board			|
172846c905SEmmanuel Vadot * |				|
182846c905SEmmanuel Vadot * |CN40 (IO PIN HEADER)	|
192846c905SEmmanuel Vadot * |	AUDIO_CLKIN_V	  pin1  |<--\	+---------------+
202846c905SEmmanuel Vadot * |(*) GP1_25/SL_SW2_V	  pin2  |<--/	|J2		|
212846c905SEmmanuel Vadot * |	AUDIO_CLKOUT_V	  pin5  |<----->| pin7  MCLK	|
222846c905SEmmanuel Vadot * |	SSI_SCK_V	  pin9  |<----->| pin1  BCLK	|
232846c905SEmmanuel Vadot * |	SSI_WS_V	  pin13 |<----->| pin3  WCLK	|
242846c905SEmmanuel Vadot * |	SSI_SD_V	  pin15 |<----->| pin5  DATIN	| (@)
252846c905SEmmanuel Vadot * |				|   \-->| pin15 DATOUT	| [CAPTURE]
262846c905SEmmanuel Vadot * +----------------------------+	+---------------+
272846c905SEmmanuel Vadot * +----------------------------+
282846c905SEmmanuel Vadot * |Breakout board		|
292846c905SEmmanuel Vadot * |				|	+---------------+
302846c905SEmmanuel Vadot * |CN(30)34 (I2C CN)		|	|J1		|
312846c905SEmmanuel Vadot * |	I2C0_SCL	   pin3 |<----->| pin20 SCL	|
322846c905SEmmanuel Vadot * |	I2C0_SDA	   pin5 |<----->| pin18 SDA	|
332846c905SEmmanuel Vadot * |				|	+---------------+
342846c905SEmmanuel Vadot * |				|	+-----------------------+
352846c905SEmmanuel Vadot * |CN(300)4 (Power)	        |	|J7			|
362846c905SEmmanuel Vadot * |	3v3 (v)		   pin9 |<----->| pin4  / pin8  3.3v	|
372846c905SEmmanuel Vadot * |	GND (v)	    pin3 / pin4 |<----->| pin12 / pin14 GND	|
382846c905SEmmanuel Vadot * +----------------------------+	+-----------------------+
392846c905SEmmanuel Vadot * (*)	GP1_25/SL_SW2_V is used as TPU
402846c905SEmmanuel Vadot * (@)	Connect to pin5 (DATIN = playback) or pin15 (DATOUT = capture)
412846c905SEmmanuel Vadot * (v)	These are just sample pins. You can find many 3v3 / GND pins on
422846c905SEmmanuel Vadot *	White Hawk board, not only CN4. You can use other pins for it.
432846c905SEmmanuel Vadot *
442846c905SEmmanuel Vadot * [How to enable]
452846c905SEmmanuel Vadot *
462846c905SEmmanuel Vadot * You need these configs
472846c905SEmmanuel Vadot *
482846c905SEmmanuel Vadot *	CONFIG_PWM
492846c905SEmmanuel Vadot *	CONFIG_PWM_RENESAS_TPU
502846c905SEmmanuel Vadot *	CONFIG_COMMON_CLK_PWM
512846c905SEmmanuel Vadot *	CONFIG_SND_SOC_DA7213
522846c905SEmmanuel Vadot *
532846c905SEmmanuel Vadot * [How to use]
542846c905SEmmanuel Vadot *
552846c905SEmmanuel Vadot * 44.1kHz groups sound is available by default.
562846c905SEmmanuel Vadot * You need to update audio_clkin settings to switch to 48kHz groups sound.
572846c905SEmmanuel Vadot * see
582846c905SEmmanuel Vadot *	[(C) clock]
592846c905SEmmanuel Vadot *
602846c905SEmmanuel Vadot * You can use capture if you change the settings
612846c905SEmmanuel Vadot * see
622846c905SEmmanuel Vadot *	[CAPTURE]
632846c905SEmmanuel Vadot *
642846c905SEmmanuel Vadot * You need to setup Headphone
652846c905SEmmanuel Vadot *
662846c905SEmmanuel Vadot *	> amixer set "Headphone" 40%
672846c905SEmmanuel Vadot *	> amixer set "Headphone" on
682846c905SEmmanuel Vadot *	> amixer set "Mixout Left DAC Left" on
692846c905SEmmanuel Vadot *	> amixer set "Mixout Right DAC Right" on
702846c905SEmmanuel Vadot */
712846c905SEmmanuel Vadot
722846c905SEmmanuel Vadot/dts-v1/;
732846c905SEmmanuel Vadot/plugin/;
742846c905SEmmanuel Vadot#include <dt-bindings/clock/r8a779g0-cpg-mssr.h>
752846c905SEmmanuel Vadot
762846c905SEmmanuel Vadot&{/} {
772846c905SEmmanuel Vadot	sound_card: sound {
782846c905SEmmanuel Vadot		compatible = "audio-graph-card";
792846c905SEmmanuel Vadot		label = "rcar-sound";
802846c905SEmmanuel Vadot
812846c905SEmmanuel Vadot		dais = <&rsnd_port>;	/* DA7212 Audio Codec */
822846c905SEmmanuel Vadot	};
832846c905SEmmanuel Vadot
842846c905SEmmanuel Vadot	tpu_clk: tpu-clk {
852846c905SEmmanuel Vadot		compatible = "pwm-clock";
862846c905SEmmanuel Vadot		#clock-cells = <0>;
872846c905SEmmanuel Vadot
882846c905SEmmanuel Vadot		/* 44.1kHz groups [(C) clock] */
892846c905SEmmanuel Vadot		clock-frequency = <11289600>;
902846c905SEmmanuel Vadot		pwms = <&tpu 0 88 0>;	/* 1000000000 / 88 =~ 11289600 */
912846c905SEmmanuel Vadot
922846c905SEmmanuel Vadot		/* 48  kHz groups [(C) clock] */
932846c905SEmmanuel Vadot//		clock-frequency = <12288000>;
942846c905SEmmanuel Vadot//		pwms = <&tpu 0 81 0>;	/* 1000000000 / 81 =~ 12288000 */
952846c905SEmmanuel Vadot	};
962846c905SEmmanuel Vadot
972846c905SEmmanuel Vadot};
982846c905SEmmanuel Vadot
992846c905SEmmanuel Vadot&pfc {
1002846c905SEmmanuel Vadot	sound_pins: sound {
1012846c905SEmmanuel Vadot		groups = "ssi_ctrl", "ssi_data";
1022846c905SEmmanuel Vadot		function = "ssi";
1032846c905SEmmanuel Vadot	};
1042846c905SEmmanuel Vadot
1052846c905SEmmanuel Vadot	sound_clk_pins: sound-clk {
1062846c905SEmmanuel Vadot		groups = "audio_clkin", "audio_clkout";
1072846c905SEmmanuel Vadot		function = "audio_clk";
1082846c905SEmmanuel Vadot	};
1092846c905SEmmanuel Vadot
1102846c905SEmmanuel Vadot	tpu0_pins: tpu0 {
111*ae5de77eSEmmanuel Vadot		groups = "tpu_to0_b";
1122846c905SEmmanuel Vadot		function = "tpu";
1132846c905SEmmanuel Vadot	};
1142846c905SEmmanuel Vadot};
1152846c905SEmmanuel Vadot
1162846c905SEmmanuel Vadot&tpu {
1172846c905SEmmanuel Vadot	pinctrl-0 = <&tpu0_pins>;
1182846c905SEmmanuel Vadot	pinctrl-names = "default";
1192846c905SEmmanuel Vadot
1202846c905SEmmanuel Vadot	status = "okay";
1212846c905SEmmanuel Vadot};
1222846c905SEmmanuel Vadot
1232846c905SEmmanuel Vadot&i2c0 {
1242846c905SEmmanuel Vadot	#address-cells = <1>;
1252846c905SEmmanuel Vadot	#size-cells = <0>;
1262846c905SEmmanuel Vadot
1272846c905SEmmanuel Vadot	codec@1a {
1282846c905SEmmanuel Vadot		compatible = "dlg,da7212";
1292846c905SEmmanuel Vadot
1302846c905SEmmanuel Vadot		#sound-dai-cells = <0>;
1312846c905SEmmanuel Vadot		reg = <0x1a>;
1322846c905SEmmanuel Vadot
1332846c905SEmmanuel Vadot		clocks = <&rcar_sound>;
1342846c905SEmmanuel Vadot		clock-names = "mclk";
1352846c905SEmmanuel Vadot
1362846c905SEmmanuel Vadot		dlg,micbias1-lvl = <2500>;
1372846c905SEmmanuel Vadot		dlg,micbias2-lvl = <2500>;
1382846c905SEmmanuel Vadot		dlg,dmic-data-sel = "lrise_rfall";
1392846c905SEmmanuel Vadot		dlg,dmic-samplephase = "between_clkedge";
1402846c905SEmmanuel Vadot		dlg,dmic-clkrate = <3000000>;
1412846c905SEmmanuel Vadot
1422846c905SEmmanuel Vadot		VDDA-supply   = <&reg_1p8v>;
1432846c905SEmmanuel Vadot		VDDMIC-supply = <&reg_3p3v>;
1442846c905SEmmanuel Vadot		VDDIO-supply  = <&reg_3p3v>;
1452846c905SEmmanuel Vadot
1462846c905SEmmanuel Vadot		port {
1472846c905SEmmanuel Vadot			da7212_endpoint: endpoint {
1482846c905SEmmanuel Vadot				remote-endpoint = <&rsnd_endpoint>;
1492846c905SEmmanuel Vadot			};
1502846c905SEmmanuel Vadot		};
1512846c905SEmmanuel Vadot	};
1522846c905SEmmanuel Vadot};
1532846c905SEmmanuel Vadot
1542846c905SEmmanuel Vadot&rcar_sound {
1552846c905SEmmanuel Vadot	pinctrl-0 = <&sound_clk_pins>, <&sound_pins>;
1562846c905SEmmanuel Vadot	pinctrl-names = "default";
1572846c905SEmmanuel Vadot
1582846c905SEmmanuel Vadot	/* audio_clkout */
1592846c905SEmmanuel Vadot	clock-frequency = <5644800>; /* 44.1kHz groups [(C) clock] */
1602846c905SEmmanuel Vadot//	clock-frequency = <6144000>; /* 48  kHz groups [(C) clock] */
1612846c905SEmmanuel Vadot
1622846c905SEmmanuel Vadot	status = "okay";
1632846c905SEmmanuel Vadot
1642846c905SEmmanuel Vadot	/* Update <clkin> to <tpu_clk> */
1652846c905SEmmanuel Vadot	clocks = <&cpg CPG_MOD 2926>, <&cpg CPG_MOD 2927>, <&tpu_clk>;
1662846c905SEmmanuel Vadot
1672846c905SEmmanuel Vadot	ports {
1682846c905SEmmanuel Vadot		rsnd_port: port {
1692846c905SEmmanuel Vadot			rsnd_endpoint: endpoint {
1702846c905SEmmanuel Vadot				remote-endpoint = <&da7212_endpoint>;
1712846c905SEmmanuel Vadot
1722846c905SEmmanuel Vadot				dai-format = "i2s";
1732846c905SEmmanuel Vadot				bitclock-master = <&rsnd_endpoint>;
1742846c905SEmmanuel Vadot				frame-master = <&rsnd_endpoint>;
1752846c905SEmmanuel Vadot
1762846c905SEmmanuel Vadot				/* Mutually exclusive with 'capture' */
1772846c905SEmmanuel Vadot				playback = <&ssi0>;
1782846c905SEmmanuel Vadot				/* [CAPTURE] */
1792846c905SEmmanuel Vadot				/* capture = <&ssi0>; */
1802846c905SEmmanuel Vadot			};
1812846c905SEmmanuel Vadot		};
1822846c905SEmmanuel Vadot	};
1832846c905SEmmanuel Vadot};
184