pvdmeer
Posts: 17
Joined: Mon Feb 22, 2016 10:29 am

PT8211 I2S ASOC driver

Tue Dec 20, 2016 9:01 pm

Hi!

I recently hacked the Hifiberry-DAC driver so that it would support the PT8211 16 bit stereo DAC. This works flawlessly, and it's damn easy to wire this up to the pi. I'd like to make this a real driver and contribute to rpi-linux repository. Unfortunately, when I change the name from snd-soc-hifiberry-dac.ko to snd-soc-pt8211.ko, it just refuses to work. Is this a driver tree issue? Can anybody help me? I'd like to contribute, especially since the PT8211 is so easy to work with and nice for beginners...

Cheers!

Pieter

rglenn
Posts: 1
Joined: Thu Mar 07, 2013 6:54 pm

Re: PT8211 I2S ASOC driver

Sat Feb 24, 2018 4:27 am

What changes did you have to make to the Hifiberry DAC driver to make it work? I'd really like to get one of these working on a Pi.

Thanks!

pvdmeer
Posts: 17
Joined: Mon Feb 22, 2016 10:29 am

Re: PT8211 I2S ASOC driver

Fri Mar 09, 2018 1:40 pm

you need to add a case in the switch statement for LEFT_JUSTIFIED mode, from the top of my head. but beware. the PT8211 is not a HIFI DAC, and without a really good LDO regulator it will sounds like S%%^T :D

bricolodu13
Posts: 32
Joined: Tue Aug 07, 2012 2:05 pm

Re: PT8211 I2S ASOC driver

Wed Apr 11, 2018 6:58 pm

Hello pvdmeer,

I have the same need for another Japanese format DAC.

Could you post your code ?

It would help.

Thank you,
Jean

pvdmeer
Posts: 17
Joined: Mon Feb 22, 2016 10:29 am

Re: PT8211 I2S ASOC driver

Wed Apr 11, 2018 7:21 pm

just check hifiberry_dac.c in the kernel sources and change:
.dai_fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,

notice the LEFT_J define in t here..

bcm2835-i2s.c needs an additional case in the switch:

switch (dev->fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S:
data_delay = 1;
break;
case SND_SOC_DAIFMT_LEFT_J:
data_delay = 0;
break;

that's all IIRC

HiassofT
Posts: 103
Joined: Fri Jun 30, 2017 10:07 pm

Re: PT8211 I2S ASOC driver

Thu Apr 12, 2018 8:14 am

No need to hack up any drivers, the 4.14 kernel in Raspbian has everything you need on board - support for I2S, justified and DSP formats, generic input and output codec drivers ("spdif transmitter/receiver") and support for simple audio card and the more modern audio graph card.

All you need to do is create a devicetree overlay:

Code: Select all

/*
 * Audio Graph Card overlay for generic DAC in left-justified mode
 *
 * compile with:
 * dtc [email protected] -H epapr -O dtb -o generic-lj.dtbo -Wno-unit_address_vs_reg generic-lj.dts
 * 
 */
/dts-v1/;
/plugin/;

/ {
	[email protected] {
		target = <&i2s>;
		__overlay__ {
			#sound-dai-cells = <0>;
			status = "okay";

			cpu_port: port {
				cpu_endpoint: endpoint {
					remote-endpoint = <&codec_endpoint>;
					dai-format = "left_j";
					bitclock-master;
					frame-master;
				};
			};
		};
	};

	[email protected] {
		target-path = "/";
		__overlay__ {
			spdif-transmitter {
				#address-cells = <0>;
				#size-cells = <0>;
				#sound-dai-cells = <0>;
				compatible = "linux,spdif-dit";
				status = "okay";

				codec_port: port {
					codec_endpoint: endpoint {
						remote-endpoint = <&cpu_endpoint>;
					};
				};
			};
		};
	};

	[email protected] {
		target = <&sound>;
		__overlay__ {
			compatible = "audio-graph-card";
			label = "GenericLJ";
			dais = <&cpu_port>;
			status = "okay";
		};
	};
};
Compile the overlay, copy it to /boot/overlays/ and then load it from config.txt or via the "dtoverlay" command.

so long,

Hias

bricolodu13
Posts: 32
Joined: Tue Aug 07, 2012 2:05 pm

Re: PT8211 I2S ASOC driver

Thu Apr 12, 2018 4:49 pm

Thank you pvdmeer,

Thank you Hias,

Hias, I get the board listed with your code, however I didn't tested it yet with the TDA1543A.
I don't understand though why you make reference to spdif as my dac is japanese format right justified.
I have changed your code from left justifed to right justified.

Best regards,

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: No registered users and 15 guests