Jump to content

nikkov

Members
  • Posts

    19
  • Joined

  • Last visited

Everything posted by nikkov

  1. Hi, I need to help for understandable how set right clock hierarchy for i2s bus with external master-clock signal. This mode supported rockchip processors (RK3328, RK3399) but there are very small information how it can do. Today we have out of box in armbian for Nanopi Neo3 working I2S with master-clock from PLL, but I want change master-clock source from PLL to external signal. In souce and clock debugfs I find that I2S1 ("i2s1_pre") can be clocked from 4 sources: clk_i2s1_div, clk_i2s1_frac, clkin_i2s1, xin12m. By default parent for i2s1_pre set to clk_i2s1_div, which have parent cpll. Hence we must change parent for i2s1_pre to clkin_i2s1, but clock clkin_i2s1 not exists. OK, I added clkin_i2s1 through overlay: /dts-v1/; /plugin/; / { compatible = "friendlyelec,nanopi-neo3", "rockchip,rk3328"; fragment@0 { target-path = "/"; __overlay__ { clk_i2s1: clk_i2s1 { compatible = "fixed-clock"; #clock-cells = <0>; clock-output-names = "clk_i2s1"; clock-frequency = <22579200>; }; }; }; }; and I see clkin_i2s1 in clock summary (fragments😞 enable prepare protect duty hardware clock count count count rate accuracy phase cycle enable ------------------------------------------------------------------------------------------------------- xin24m 10 10 0 24000000 0 0 50000 Y pll_cpll 1 1 0 1200000000 0 0 50000 Y cpll 8 13 0 1200000000 0 0 50000 Y clk_i2s1_div 0 0 0 75000000 0 0 50000 N i2s1_pre 0 0 0 75000000 0 0 50000 Y clk_i2s1 0 0 0 75000000 0 0 50000 N i2s1_out 0 0 0 75000000 0 0 50000 N clk_i2s1_frac 0 0 0 3750000 0 0 50000 N clkin_i2s1 0 0 0 22579200 0 0 50000 Y clock i2s1 described in rk3328.dtsi: i2s1: i2s@ff010000 { compatible = "rockchip,rk3328-i2s", "rockchip,rk3066-i2s"; ... clocks = <&cru SCLK_I2S1>, <&cru HCLK_I2S1_8CH>; clock-names = "i2s_clk", "i2s_hclk"; ... }; And now I must set parent for i2s1_pre to clkin_i2s1. Сan anyone help me with this? I tried use assigned-clocks/assigned-clock-parents but unsuccessfull.
  2. SPDIF may be enabled by simple overlay file with this content: /dts-v1/; /plugin/; / { compatible = "friendlyelec,nanopi-neo3", "rockchip,rk3328"; fragment@0 { target = <&spdif_out>; __overlay__ { status = "okay"; }; }; }; compile and install: sudo armbian-add-overlay spdif-out-enable.dts reboot and check: nik@nanopineo3:~$ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: I2S [I2S], device 0: ff010000.i2s-pcm5102a-hifi pcm5102a-hifi-0 [ff010000.i2s-pcm5102a-hifi pcm5102a-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: SPDIF [SPDIF], device 0: ff030000.spdif-dit-hifi dit-hifi-0 [ff030000.spdif-dit-hifi dit-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0
  3. Thank you for your time! If I understand correctly, I have to include my patch in one of this files: /build/patch/kernel/archive/sunxi-6.1/series.* or just put it to folder /build/patch/kernel/archive/sunxi-6.1/. Not a very clear approach, the previous one was more understandable, especially since the userpatches folder is still used.
  4. Is this option used to create a patch and apply it at the same time? I've only used it for making patches, not for building the kernel. That is, to build the kernel with my patch, I have to use this command: ./compile.sh BOARD=nanopineo BRANCH=current kernel-patch,kernel ?
  5. Hello, I try build kernel for NanopiNeo board with user kernel patch, but I don't understand with path needed put my patch. In previous version armbian's builds I just put files to userpatches/kernel/sunxi-current how it described in docs. But now with current version Armbian build system it's not working. I put my custom linux-sunxi-current.config to userpatches folder, my patch to userpatches/kernel/sunxi-current and try build kernel with command: ./compile.sh BOARD=nanopineo BRANCH=current kernel I see that linux-sunxi-current.config found and applied but not patch isn't.
  6. I'm confused, and I can't found source of problem. It's look like performance related issue, but I don't see any simptoms like high CPU loading. aplay is working fine, but mpd whith same file sometime working tens minutes fine, but sometime long time gets regulary underruns with constant period 11 second which one is independent of the sampling rate. Restarting mpd can sometimes solve the problem, sometimes not. This behaviour repeated on all audio devices - codec, spdif and i2s. I use many years old armbian version (with kernel 3.4.112) without any issue, but found it with new kernel. Can anyone show me the right direction?
  7. Hi, I'm working with mpd on armbian 20.02.0 with i2s device and found some problem: periodically sound is interrupted. I enable verbose logging in mpd and I get message: May 20 04:36 : alsa_output: Underrun on ALSA device "hw:0,0" May 20 04:36 : alsa_output: Underrun on ALSA device "hw:0,0" May 20 04:37 : alsa_output: Underrun on ALSA device "hw:0,0" This is not permanent and some time maybe work fine, but if it starts, messages go with an interval of 10-11 seconds until I restart mpd. I rebuilt armbian with enabled ALSA debug options CONFIG_SND_PCM_XRUN_DEBUG, CONFIG_SND_VERBOSE_PROCFS, CONFIG_SND_DEBUG and try again. This is result with my i2s card and echo 3 > /proc/asound/card0/pcm0p/xrun_debug May 20 03:30:59 localhost kernel: [ 1099.726101] i2s_clock_board: i2s_clock_board_trigger May 20 03:30:59 localhost kernel: [ 1099.726136] I2S Command State 0 May 20 03:30:59 localhost kernel: [ 1099.726200] asoc-simple-card sound_i2s: XRUN: pcmC1D0p:0 May 20 03:30:59 localhost kernel: [ 1099.726213] CPU: 0 PID: 1348 Comm: kworker/0:1 Tainted: G C O 5.4.18-sunxi #20.02.0 May 20 03:30:59 localhost kernel: [ 1099.726216] Hardware name: Allwinner sun7i (A20) Family May 20 03:30:59 localhost kernel: [ 1099.726239] Workqueue: events_freezable_power_ thermal_zone_device_check May 20 03:30:59 localhost kernel: [ 1099.726268] [<c010da8d>] (unwind_backtrace) from [<c010a0ad>] (show_stack+0x11/0x14) May 20 03:30:59 localhost kernel: [ 1099.726282] [<c010a0ad>] (show_stack) from [<c093704f>] (dump_stack+0x6f/0x7c) May 20 03:30:59 localhost kernel: [ 1099.726344] [<c093704f>] (dump_stack) from [<bf856305>] (__snd_pcm_xrun+0x101/0x108 [snd_pcm]) May 20 03:30:59 localhost kernel: [ 1099.726384] [<bf856305>] (__snd_pcm_xrun [snd_pcm]) from [<bf8563b3>] (snd_pcm_update_state+0xa7/0xac [snd_pcm]) May 20 03:30:59 localhost kernel: [ 1099.726420] [<bf8563b3>] (snd_pcm_update_state [snd_pcm]) from [<bf856549>] (snd_pcm_update_hw_ptr0+0x191/0x5a4 [snd_pcm]) May 20 03:30:59 localhost kernel: [ 1099.726455] [<bf856549>] (snd_pcm_update_hw_ptr0 [snd_pcm]) from [<bf8569a7>] (snd_pcm_period_elapsed+0x4b/0x90 [snd_pcm]) May 20 03:30:59 localhost kernel: [ 1099.726483] [<bf8569a7>] (snd_pcm_period_elapsed [snd_pcm]) from [<bf84928f>] (dmaengine_pcm_dma_complete+0x3b/0x3c [snd_pcm_dmaengine]) May 20 03:30:59 localhost kernel: [ 1099.726500] [<bf84928f>] (dmaengine_pcm_dma_complete [snd_pcm_dmaengine]) from [<c05f9fdf>] (vchan_complete+0x133/0x140) May 20 03:30:59 localhost kernel: [ 1099.726517] [<c05f9fdf>] (vchan_complete) from [<c0120413>] (tasklet_action_common.constprop.3+0x2f/0x80) May 20 03:30:59 localhost kernel: [ 1099.726531] [<c0120413>] (tasklet_action_common.constprop.3) from [<c01022f7>] (__do_softirq+0xdf/0x288) May 20 03:30:59 localhost kernel: [ 1099.726541] [<c01022f7>] (__do_softirq) from [<c0120333>] (irq_exit+0x7b/0x90) May 20 03:30:59 localhost kernel: [ 1099.726555] [<c0120333>] (irq_exit) from [<c0160233>] (__handle_domain_irq+0x47/0x84) May 20 03:30:59 localhost kernel: [ 1099.726570] [<c0160233>] (__handle_domain_irq) from [<c05ca5dd>] (gic_handle_irq+0x39/0x6c) May 20 03:30:59 localhost kernel: [ 1099.726581] [<c05ca5dd>] (gic_handle_irq) from [<c0101ae5>] (__irq_svc+0x65/0x94) May 20 03:30:59 localhost kernel: [ 1099.726586] Exception stack(0xedae7e30 to 0xedae7e78) May 20 03:30:59 localhost kernel: [ 1099.726593] 7e20: 00000fe0 00000006 fac81000 c010d0f1 May 20 03:30:59 localhost kernel: [ 1099.726603] 7e40: c1054fa8 332c1eac 00005dbf 0000008d 00000045 ecf17b54 c0c51994 1ffffc70 May 20 03:30:59 localhost kernel: [ 1099.726611] 7e60: ee405a78 edae7e80 c010d105 c0935016 200f0033 ffffffff May 20 03:30:59 localhost kernel: [ 1099.726626] [<c0101ae5>] (__irq_svc) from [<c0935016>] (__timer_delay+0x26/0x34) May 20 03:30:59 localhost kernel: [ 1099.726644] [<c0935016>] (__timer_delay) from [<bfa2d3c5>] (sun4i_gpadc_read+0x10d/0x15c [sun4i_gpadc_iio]) May 20 03:30:59 localhost kernel: [ 1099.726677] [<bfa2d3c5>] (sun4i_gpadc_read [sun4i_gpadc_iio]) from [<bfa2d4f5>] (sun4i_gpadc_temp_read+0x29/0x70 [sun4i_gpadc_iio]) May 20 03:30:59 localhost kernel: [ 1099.726691] [<bfa2d4f5>] (sun4i_gpadc_temp_read [sun4i_gpadc_iio]) from [<bfa2d561>] (sun4i_gpadc_get_temp+0x25/0x54 [sun4i_gpadc_iio]) May 20 03:30:59 localhost kernel: [ 1099.726703] [<bfa2d561>] (sun4i_gpadc_get_temp [sun4i_gpadc_iio]) from [<c07a456f>] (thermal_zone_get_temp+0x33/0x44) May 20 03:30:59 localhost kernel: [ 1099.726717] [<c07a456f>] (thermal_zone_get_temp) from [<c07a1e21>] (thermal_zone_device_update.part.4+0x21/0xe0) May 20 03:30:59 localhost kernel: [ 1099.726730] [<c07a1e21>] (thermal_zone_device_update.part.4) from [<c012f6d9>] (process_one_work+0x179/0x3cc) May 20 03:30:59 localhost kernel: [ 1099.726740] [<c012f6d9>] (process_one_work) from [<c012fa2f>] (worker_thread+0x103/0x410) May 20 03:30:59 localhost kernel: [ 1099.726752] [<c012fa2f>] (worker_thread) from [<c01340a5>] (kthread+0x109/0x10c) May 20 03:30:59 localhost kernel: [ 1099.726763] [<c01340a5>] (kthread) from [<c01010f9>] (ret_from_fork+0x11/0x38) May 20 03:30:59 localhost kernel: [ 1099.726767] Exception stack(0xedae7fb0 to 0xedae7ff8) May 20 03:30:59 localhost kernel: [ 1099.726773] 7fa0: 00000000 00000000 00000000 00000000 May 20 03:30:59 localhost kernel: [ 1099.726782] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 May 20 03:30:59 localhost kernel: [ 1099.726789] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 May 20 03:30:59 localhost kernel: [ 1099.812099] i2s_clock_board: i2s_clock_board_trigger May 20 03:30:59 localhost kernel: [ 1099.812156] I2S Command State 1 I changed device output to analog codec, rebooted and create armbianmonitor log. Messages about snd_pcm* like messages i2s device, but haven't messages about sun4i_gpadc*. I'm confused and don't know what make further. I played files from connected sata hdd and NAS, but it does not matter. And maybe this issue related kworker problem? Because I periodically see kworker/0:4-events_freezable_power_ in top
  8. I made some investigation and found that unstable phase is a consequence of sigma-delta modulation for audio PLL from this commit Sigma-delta modulation make more exact frequency but it leads variable phase of clocks. This means that with the kernel> 4.15 some codecs will not work, as they will not be able to synchronize with the clocks. My PCM5102A may work only with 48k, but not higher
  9. Hi, I try working with i2s driver on last armbian (5.99 kernel 4.19.84) with nanopi neo and found trouble with I2S clock - it has very excessive jitter (see attached screen from my oscilloscope). I use small dts overlay for enable i2s and mainline i2s code without changes and with changes from codekipper, nanopi neo and neo 2 with same result, but old armbian image 5.65 (4.14.17) working without problem. I also found a mention of a similar problem on forum volumio sun8i-h3-i2s0.dts /dts-v1/; /plugin/; / { compatible = "allwinner,sun8i-h3"; fragment@0 { target-path = "/"; __overlay__ { pcm5102a: pcm5102a { #sound-dai-cells = <0>; compatible = "ti,pcm5102a"; pcm510x,format = "i2s"; }; }; }; fragment@1 { target = <&i2s0>; __overlay__ { status = "okay"; pinctrl-0 = <&i2s0_pins>; sound-dai = <&pcm5102a>; pinctrl-names = "default"; }; }; fragment@2 { target-path = "/"; __overlay__ { sound_i2s { compatible = "simple-audio-card"; simple-audio-card,name = "I2S-master"; simple-audio-card,mclk-fs = <256>; simple-audio-card,format = "i2s"; status = "okay"; simple-audio-card,cpu { sound-dai = <&i2s0>; }; simple-audio-card,codec { sound-dai = <&pcm5102a>; }; }; }; }; };
  10. I checked your wip i2s driver code with my hardware and simple codec driver for my clock board. In function sun4i_i2s_set_clk_rate calculates lrck value as (clk_rate / rate / oversample_rate)*word_size and we have, eg (22579200 / 44100 / 128) * 16 = 64 of BCLKs within each channel. But in stereo i2s mode lrck value must be equal slot width. In stable version lrck fixed and equal 32. After I replace calculated value lrck to fixed 32 I successfully played 16/24 bit sample.
  11. Yes, I found this values in A20 user manual. But it's related only for master mode i2s which clocked by PLL, and can't used for external clock and slave mode bus. So we must check oversample value only for master mode!
  12. Yes, your debug output I see in kernel.log For full-fledged testing, I need to add a codec driver to specify the hardware modes for my clocks board: i2s mode; 32 bit frame size independents from sample size; divider for BCLK/LRCLK driven by GPIO. I'll try made this in near time.
  13. Quick info about testing. - nanopi neo - armbian image builded from github sources - i2s module by codekipper - overlay from codekipper's post (but simple-audio-card,mclk-fs = <128>). Because my clock board without pins control works on 176400 all test with this sample rate: aplay -c 2 -f S16_LE -r 176400 /dev/urandom - working and I see some data on dout pin aplay -c 2 -f S24_LE -r 176400 /dev/urandom - aplay: pcm_write:2011: write error: Input/output error aplay -c 2 -f S32_LE -r 176400 /dev/urandom - no error and zero data on dout pin
  14. OK, I'll built fresh armbian image for nanopi neo and can check your code. One question: why oversample rates started with 128 but not 64 (32 bit frame) or 32 (16 bit frame)?
  15. Thank you for information. I only now began to understand mainline driver. I have some hardware (cubietruck, nanopi neo and nanopi neo 2), clocks board (schematic attached) and simple logic analyzer. I can try testing your modification. neoclock - Project.pdf
  16. Slave mode assume that externals source of the bit- and lr-clocks controls by driver, but I can't saw where is it. And as I see mainline driver support only 16 bit sample. I worked with friendlyarm's variant because it was most complete. Now I want modify mainline driver for support 16/24 bit master/slave and test it on nanopi neo (2, air) and cubietruck.
  17. If you want get just play function, you can use my Volumio image for NanoPi-Neo. But unfortunately I now don't have experience with overlays now
  18. Not related to armbian, but I made some work with friendlyarm kernel 4.11.2 for support i2s driver for h3/h5 with support 16/24 bit master/slave mode i2s (link) and build Volumio image for nanopi neo (link). In future I want to get same in mainline kernel.
  19. In my latest patch fixed issue when change the track or seeking in the track only. I don't use SPDIF and I don't know exists this issue in original linux-sunxi sources or not. I have found swapping channels when recording, but I can't fix it yet.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines