Any chance you can post a schematic on GitHub or the like, for
complete-ness?

I managed to just buzz out each pin from the audio codec to the header,
then connected the relevant ones to the header on the OPi :-). Shame the
OPiPC2 doesn't break out all of the I2S pins -- should have made sure
rather than trusting their claim of Pi2 compatibility! Doh!

On 16 December 2017 at 12:18, Matt Flax <[email protected]> wrote:

>
> On 16/12/17 17:10, Code Kipper wrote:
>
>> On 16 December 2017 at 02:03, Matt Flax <[email protected]> wrote:
>>
>>>
>>> On 16/12/17 06:47, Code Kipper wrote:
>>>
>>>> On 15 December 2017 at 20:05, Chris Obbard <[email protected]> wrote:
>>>>
>>>>> Thanks Chen-Yu, that patch was literally what I was about to write
>>>>> myself
>>>>> (but in a more spagetti-like way).
>>>>>
>>>>> root@orangepi:~# speaker-test -D hw:1 -c 2
>>>>>> speaker-test 1.1.3
>>>>>> Playback device is hw:1
>>>>>> Stream parameters are 48000Hz, S16_LE, 2 channels
>>>>>> Using 16 octaves of pink noise
>>>>>> Rate set to 48000Hz (requested 48000Hz)
>>>>>> Buffer size range from 128 to 131072
>>>>>> Period size range from 64 to 16384
>>>>>> Using max buffer size 131072
>>>>>> Periods = 4
>>>>>> Unable to set hw params for playback: Invalid argument
>>>>>> Setting of hwparams failed: Invalid argument
>>>>>>
>>>>>
>>>>>
>>>>> dmesg:
>>>>>
>>>>>> [  395.364594] sun4i-i2s 1c22000.i2s: Unsupported oversample rate:
>>>>>> 2083
>>>>>> [  395.370978] sun4i-i2s 1c22000.i2s: ASoC: can't set 1c22000.i2s hw
>>>>>> params: -22
>>>>>>
>>>>>
>>>>>
>>>>> cheers!
>>>>>
>>>> Hi Chris,
>>>> I've just retired from playing with my audio injector..it's no longer
>>>> barfing but nothing is playing at the moment. Do you see any clocking
>>>> on the BLCK or LRCLK?, I've yet to see anything coming off the pins.
>>>> I'll have another play tomorrow but at the moment all that I've really
>>>> changed is that I not longer do the mclk and blck div calculations in
>>>> sun4i_i2s_set_clk_rate as this is for the internal pll.
>>>> CK
>>>>
>>>
>>> Just wanted to see if it were possible to setup as codec master, which
>>> would
>>> generate the clocks from the wm8731 chip.
>>> This is done here :
>>> https://github.com/raspberrypi/linux/blob/rpi-4.9.y/sound/
>>> soc/bcm/audioinjector-pi-soundcard.c#L84
>>>
>>> snd_soc_dai_set_sysclk(rtd->codec_dai, WM8731_SYSCLK_XTAL, 12000000,
>>> SND_SOC_CLOCK_IN);
>>>
>> Hi Max,
>> yeah I've seen this example before and was in the process of adding
>> some debugging in the wm8731 driver.
>>
>>> The flag WM8731_SYSCLK_XTAL sets the wm8731->sysclk_type variable here :
>>> https://github.com/raspberrypi/linux/blob/rpi-4.9.y/sound/
>>> soc/codecs/wm8731.c#L396
>>>
>>> Which returns true in wm8731_check_osc:
>>> https://github.com/raspberrypi/linux/blob/rpi-4.9.y/sound/
>>> soc/codecs/wm8731.c#L220
>>>
>>> Which enables the osc in the dapm route :
>>> https://github.com/raspberrypi/linux/blob/rpi-4.9.y/sound/
>>> soc/codecs/wm8731.c#L224
>>>
>>>
>>> You will notice that WM8731_SYSCLK_XTAL == 1 here :
>>> https://github.com/raspberrypi/linux/blob/rpi-4.9.y/sound/
>>> soc/codecs/wm8731.h#L34
>>>
>>> Has this been correctly set in your simple card device tree ?
>>>
>> I'll have a look later today, thanks for the description of the clock
>> setups.
>>
>> My board is plugged directly into the header for the Orange Pi 2(looks
>> to be pin compatible with the RPi2 header), other than the i2s and
>> power pins what pins are used by your board?
>>
>
> Only the I2C pins - nothing esoteric !
>
>
> BR,
>> CK
>>
>>> Matt
>>>
>>>
>>> On 14 December 2017 at 07:34, Chen-Yu Tsai <[email protected]> wrote:
>>>>>
>>>>>> On Thu, Dec 14, 2017 at 3:22 PM, Chris Obbard <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> Had a tiny bit of time this morning, had to give it a go. But no joy.
>>>>>>>
>>>>>>> root@orangepi:~# speaker-test --device hw:1 --channels 2
>>>>>>>> speaker-test 1.1.3
>>>>>>>> Playback device is hw:1
>>>>>>>> Stream parameters are 48000Hz, S16_LE, 2 channels
>>>>>>>> Using 16 octaves of pink noise
>>>>>>>> Rate set to 48000Hz (requested 48000Hz)
>>>>>>>> Buffer size range from 128 to 131072
>>>>>>>> Period size range from 64 to 16384
>>>>>>>> Using max buffer size 131072
>>>>>>>> Periods = 4
>>>>>>>> Unable to set hw params for playback: Invalid argument
>>>>>>>> Setting of hwparams failed: Invalid argument
>>>>>>>>
>>>>>>>
>>>>>>> Will start delving into the I2S driver later this eve...
>>>>>>>
>>>>>> Could you try applying the patch I just sent:
>>>>>>
>>>>>>      https://patchwork.kernel.org/patch/10111589/
>>>>>>
>>>>>> This should give you some information about why "set hw params"
>>>>>> failed.
>>>>>>
>>>>>> ChenYu
>>>>>>
>>>>>> Cheers!
>>>>>>>
>>>>>>>
>>>>>>> On 14 December 2017 at 06:46, Code Kipper <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> On 13 December 2017 at 21:51, Chris Obbard <[email protected]>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Hi CK,
>>>>>>>>>
>>>>>>>>> That worked! Thanks.
>>>>>>>>>
>>>>>>>>> Here's the desg output now, all looks OK:
>>>>>>>>>
>>>>>>>>>> [    5.364112] wm8731 0-001a: Assuming static MCLK
>>>>>>>>>> [    5.368716] wm8731 0-001a: 0-001a supply AVDD not found, using
>>>>>>>>>> dummy
>>>>>>>>>> regulator
>>>>>>>>>> [    5.376037] wm8731 0-001a: 0-001a supply HPVDD not found, using
>>>>>>>>>> dummy
>>>>>>>>>> regulator
>>>>>>>>>> [    5.383089] sun4i-codec 1c22c00.codec: ASoC:
>>>>>>>>>> codec-analog@1f015c0
>>>>>>>>>> not
>>>>>>>>>> registered
>>>>>>>>>> [    5.383098] sun4i-codec 1c22c00.codec: Failed to register our
>>>>>>>>>> card
>>>>>>>>>> [    5.397183] wm8731 0-001a: 0-001a supply DCVDD not found, using
>>>>>>>>>> dummy
>>>>>>>>>> regulator
>>>>>>>>>> [    5.404775] wm8731 0-001a: 0-001a supply DBVDD not found, using
>>>>>>>>>> dummy
>>>>>>>>>> regulator
>>>>>>>>>> [    5.413332] sun4i-codec 1c22c00.codec: Codec <-> 1c22c00.codec
>>>>>>>>>> mapping
>>>>>>>>>> ok
>>>>>>>>>> [    5.420312] sun4i-codec 1c22c00.codec: ASoC: no DMI vendor
>>>>>>>>>> name!
>>>>>>>>>> [    5.445524] asoc-simple-card sound: wm8731-hifi <-> 1c22000.i2s
>>>>>>>>>> mapping
>>>>>>>>>> ok
>>>>>>>>>> [    5.452773] asoc-simple-card sound: ASoC: no DMI vendor name!
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> The card is now detected by alsa (I also have a USB card plugged
>>>>>>>>> in):
>>>>>>>>>
>>>>>>>>>> root@orangepi:~# aplay -l
>>>>>>>>>>
>>>>>>>>>> **** List of PLAYBACK Hardware Devices ****
>>>>>>>>>> card 0: Codec [H3 Audio Codec], device 0: CDC PCM Codec-0 []
>>>>>>>>>>     Subdevices: 1/1
>>>>>>>>>>     Subdevice #0: subdevice #0
>>>>>>>>>> card 1: audio [AudioInjector audio], device 0:
>>>>>>>>>> 1c22000.i2s-wm8731-hifi
>>>>>>>>>> wm8731-hifi-0 []
>>>>>>>>>>     Subdevices: 1/1
>>>>>>>>>>     Subdevice #0: subdevice #0
>>>>>>>>>> card 2: CODEC [USB AUDIO  CODEC], device 0: USB Audio [USB Audio]
>>>>>>>>>>     Subdevices: 1/1
>>>>>>>>>>     Subdevice #0: subdevice #0
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> & I can access Alsamixer to set settings over the already connected
>>>>>>>>> I2C
>>>>>>>>> bus.
>>>>>>>>>
>>>>>>>>> But when it comes to playing a media file fails (seems to work OK
>>>>>>>>> with
>>>>>>>>> USB
>>>>>>>>> card):
>>>>>>>>>
>>>>>>>>>> root@orangepi:~# speaker-test --device hw:1
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> speaker-test 1.1.3
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Playback device is hw:1
>>>>>>>>>>
>>>>>>>>>> Stream parameters are 48000Hz, S16_LE, 1 channels
>>>>>>>>>>
>>>>>>>>>> Using 16 octaves of pink noise
>>>>>>>>>>
>>>>>>>>>> Channels count (1) not available for playbacks: Invalid argument
>>>>>>>>>>
>>>>>>>>>> Setting of hwparams failed: Invalid argument
>>>>>>>>>>
>>>>>>>>> you will need to use speaker-test --device hw:1 -c 2
>>>>>>>>
>>>>>>>> I will look tomorrow (with a scope) for any sign of twiddling on the
>>>>>>>>> I2S
>>>>>>>>> pins, but I doubt it...
>>>>>>>>>
>>>>>>>> Have hope?...if you don't hear anything initially can you change
>>>>>>>> what
>>>>>>>> is being written to SUN8I_I2S_FMT0_LRCK_PERIOD to 125.
>>>>>>>> CK
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Here's my DTS entry (copied from your WIP branch):
>>>>>>>>>
>>>>>>>>>>           sound {
>>>>>>>>>>                   compatible = "simple-audio-card";
>>>>>>>>>>                   simple-audio-card,name = "AudioInjector audio";
>>>>>>>>>>                   simple-audio-card,format = "i2s";
>>>>>>>>>>                   simple-audio-card,bitclock-master =
>>>>>>>>>> <&codec_master>;
>>>>>>>>>>                   simple-audio-card,frame-master =
>>>>>>>>>> <&codec_master>;
>>>>>>>>>>                   simple-audio-card,widgets =
>>>>>>>>>>                                           "Headphone", "Headphone
>>>>>>>>>> Jack",
>>>>>>>>>>                                           "Microphone",
>>>>>>>>>> "Microphone
>>>>>>>>>> Jack",
>>>>>>>>>>                                           "Line", "Line Jack";
>>>>>>>>>>                   simple-audio-card,routing =
>>>>>>>>>>                                           "Headphone Jack",
>>>>>>>>>> "RHPOUT",
>>>>>>>>>>                                           "Headphone Jack",
>>>>>>>>>> "LHPOUT",
>>>>>>>>>>                                           "LLINEIN", "Line Jack",
>>>>>>>>>>                                           "MICIN", "Mic Bias",
>>>>>>>>>>                                           "Mic Bias", "Microphone
>>>>>>>>>> Jack";
>>>>>>>>>>                   simple-audio-card,cpu {
>>>>>>>>>>                           sound-dai = <&i2s0>;
>>>>>>>>>>                   };
>>>>>>>>>>                   codec_master: simple-audio-card,codec {
>>>>>>>>>>                           sound-dai = <&wm8731>;
>>>>>>>>>>                           system-clock-frequency = <12000000>;
>>>>>>>>>>                   };
>>>>>>>>>>           };
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Cheers!
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 13 December 2017 at 09:57, Code Kipper <[email protected]>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> is CONFIG_DMA_SUN6I=y set in the .config(It isn't by default)?
>>>>>>>>>> CK
>>>>>>>>>>
>>>>>>>>>> On 12 December 2017 at 20:11, Chris Obbard <[email protected]>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> So finally tonight I managed to connect up the Audioinjector to
>>>>>>>>>>> the
>>>>>>>>>>> correct
>>>>>>>>>>> pins on the Orangepi PC2.
>>>>>>>>>>>
>>>>>>>>>>> It seems to be talking over i2c to the wm8731 OK, but fails to
>>>>>>>>>>> setup
>>>>>>>>>>> using
>>>>>>>>>>> DMAEngine?
>>>>>>>>>>>
>>>>>>>>>>> Here's the relevant parts of dmesg:
>>>>>>>>>>>
>>>>>>>>>>> [    0.000000] Linux version 4.15.0-rc2-gbd0835a69-dirty
>>>>>>>>>>>> (chris@sunxi-build) (gcc version 7.2.0 (Debian 7.2.0-11)) #5
>>>>>>>>>>>> SMP
>>>>>>>>>>>> PREEMPT Mon
>>>>>>>>>>>> Dec 11 18:35:03 GMT 2017
>>>>>>>>>>>> [    0.000000] Machine model: Xunlong Orange Pi PC 2
>>>>>>>>>>>> [    2.001533] ALSA device list:
>>>>>>>>>>>> [    2.004504]   No soundcards found.
>>>>>>>>>>>> [    7.954144] sun4i-i2s 1c22000.i2s: Could not register PCM
>>>>>>>>>>>> [    7.972456] sun4i-codec 1c22c00.codec: Failed to register
>>>>>>>>>>>> against
>>>>>>>>>>>> DMAEngine
>>>>>>>>>>>> [    8.000740] wm8731 0-001a: Assuming static MCLK
>>>>>>>>>>>> [    8.005336] wm8731 0-001a: 0-001a supply AVDD not found,
>>>>>>>>>>>> using
>>>>>>>>>>>> dummy
>>>>>>>>>>>> regulator
>>>>>>>>>>>> [    8.012660] wm8731 0-001a: 0-001a supply HPVDD not found,
>>>>>>>>>>>> using
>>>>>>>>>>>> dummy
>>>>>>>>>>>> regulator
>>>>>>>>>>>> [    8.020087] wm8731 0-001a: 0-001a supply DCVDD not found,
>>>>>>>>>>>> using
>>>>>>>>>>>> dummy
>>>>>>>>>>>> regulator
>>>>>>>>>>>> [    8.020157] sun4i-i2s 1c22000.i2s: Could not register PCM
>>>>>>>>>>>> [    8.021684] sun4i-codec 1c22c00.codec: Failed to register
>>>>>>>>>>>> against
>>>>>>>>>>>> DMAEngine
>>>>>>>>>>>> [    8.039901] wm8731 0-001a: 0-001a supply DBVDD not found,
>>>>>>>>>>>> using
>>>>>>>>>>>> dummy
>>>>>>>>>>>> regulator
>>>>>>>>>>>> [    8.051789] sun4i-i2s 1c22000.i2s: Could not register PCM
>>>>>>>>>>>> [    8.059306] sun4i-codec 1c22c00.codec: Failed to register
>>>>>>>>>>>> against
>>>>>>>>>>>> DMAEngine
>>>>>>>>>>>> [    8.697652] sun4i-i2s 1c22000.i2s: Could not register PCM
>>>>>>>>>>>> [    8.708108] sun4i-codec 1c22c00.codec: Failed to register
>>>>>>>>>>>> against
>>>>>>>>>>>> DMAEngine
>>>>>>>>>>>> [    8.718261] sun4i-i2s 1c22000.i2s: Could not register PCM
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 12 December 2017 at 06:23, Code Kipper <[email protected]>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> I don't understand why they changed the header on the newer
>>>>>>>>>>>> boards
>>>>>>>>>>>> away from something that was raspberry pi compatible, the only
>>>>>>>>>>>> thing
>>>>>>>>>>>> in common now is that they are 40 pins. I have a audio injector
>>>>>>>>>>>> in
>>>>>>>>>>>> the
>>>>>>>>>>>> post on its way to me; but I'm pretty sure as it generates the
>>>>>>>>>>>> clocks
>>>>>>>>>>>> that there will need to be some work to get it working.
>>>>>>>>>>>>
>>>>>>>>>>>> CK
>>>>>>>>>>>>
>>>>>>>>>>>> On 11 December 2017 at 20:41, Chris Obbard <[email protected]>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi CK,
>>>>>>>>>>>>>
>>>>>>>>>>>>> I have added the simple-soundcard node and the other relevant
>>>>>>>>>>>>> stuff
>>>>>>>>>>>>> in
>>>>>>>>>>>>> the
>>>>>>>>>>>>> DTS and all seems to be OK.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Looks like the GPIO header on Orange Pi PC2 doesn't have access
>>>>>>>>>>>>> to
>>>>>>>>>>>>> PCM0_DOUT
>>>>>>>>>>>>> (or PCM0_MCLK, but that doesn't matter so much), so I'm at a
>>>>>>>>>>>>> stand-still
>>>>>>>>>>>>> until I can de-solder the resistor attached to the status LED.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> I am testing with the AudioInjector Stereo, I was hoping it
>>>>>>>>>>>>> would
>>>>>>>>>>>>> be
>>>>>>>>>>>>> a
>>>>>>>>>>>>> simple case of just plugging the Pi HAT in, but it never seems
>>>>>>>>>>>>> to
>>>>>>>>>>>>> be
>>>>>>>>>>>>> as
>>>>>>>>>>>>> simple as that :-).
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Will keep you updated with progress.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Cheers!
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 11 December 2017 at 13:16, Code Kipper
>>>>>>>>>>>>> <[email protected]>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi Chris.
>>>>>>>>>>>>>> H5 support went in with the H3 so it should work. You will
>>>>>>>>>>>>>> need
>>>>>>>>>>>>>> to
>>>>>>>>>>>>>> make dts changes or overlays for the devices that you're
>>>>>>>>>>>>>> using.
>>>>>>>>>>>>>> CK
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 11 December 2017 at 12:41, Chris Obbard <[email protected]
>>>>>>>>>>>>>> >
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hey
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I am looking into the H5 i2s mainline support, can anyone
>>>>>>>>>>>>>>> update
>>>>>>>>>>>>>>> me
>>>>>>>>>>>>>>> on
>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>> status of this, point me to a wip branch or patch?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Cheers!
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>>>>>>> Google
>>>>>>>>>>>>>>> Groups
>>>>>>>>>>>>>>> "linux-sunxi" group.
>>>>>>>>>>>>>>> To unsubscribe from this group and stop receiving emails
>>>>>>>>>>>>>>> from
>>>>>>>>>>>>>>> it,
>>>>>>>>>>>>>>> send
>>>>>>>>>>>>>>> an
>>>>>>>>>>>>>>> email to [email protected].
>>>>>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups
>>>>>>> "linux-sunxi" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send
>>>>>>> an
>>>>>>> email to [email protected].
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to