I want to say that I managed to get the pwm sound working.

I was wrong when I said that the pwm sound was on the pin P9.28, in fact, 
this pin is related to the i2s sound from the board that is actually 
connected to the HDMI ic for sound. This explains why the "sound" was very 
noise; I'm surprised that I could listen to it, it is a digital sound data. 
I think that with good filtering it is even possible to remove the noise 
part of it if you have a mono sound for a cheap sound, just thinking.... Or 
maybe just connect an i2s ic driver and have a good sound :)

Anyway, in this case, the pwmsp module was not even working. To solve this, 
and to not confuse, I added the following line to uEnv.txt:

disable_uboot_overlay_audio=1

This will disable the i2s sound. (I think)
I used the dtbo created from the dts that I attached in the previous 
message on uEnv.txt, and loaded the module with: 

sudo modprobe snd_pwmsp

My system was freezing when I tried to play any sound. I recompiled the pwmsp 
module with the debug option enabled, and I found that the problem was on the 
statement (atomic_set(&chip->timer_active, 1); of the file pwmsp_lib.c

This problem was fixed adding the line: pm_runtime_irq_safe(&pdev->dev); to the 
*drivers/pwm/pwm-tiehrpwm.c* (like here 
<https://github.com/JoelGoh92/linux-2/commit/d355c57f41e81fd0b346db9e7ce62d3a2ee8deb0>).
  I recompiled the kernel and the pwm sound worked. I don't know if the line 
added to the pwm driver of the board can 

impact in something else.








Em quarta-feira, 17 de julho de 2019 17:49:15 UTC+2, João Manoel escreveu:
>
> Hi,
>
> I'm trying to make the pwmsp driver work on my board. The driver is 
> compiled as a module on the kernel 4.14 by default
>
> https://github.com/beagleboard/linux/tree/4.14/sound/drivers/pwmsp
>
> I managed to make the driver work when I remove cape universal from 
> uEnv.txt (commenting the line #enable_uboot_cape_universal=1), the sound 
> is very noisy even with an RC low pass filter, but somehow it works. The 
> sound can be collected from pin P9.28, and it is recognized in ALSA as a 
> sound card.
>
> I have a LCD cape that I want to use, but when I connect my LCD to the 
> board the pwmsp driver doesn't load anymore. My LCD cape uses the same pin 
> P9.28 to control the brightness.
>
> I tried to recompile the dtbo used in my LCD removing the brightness 
> option leaving the pin completely free, but the pwmsp driver still not 
> loading, even when I force u-boot to not load the dtbo of the lcd (with 
> disable_uboot_overlay_addr0=1). I also tried to make my own dtbo file to 
> load the pwmsp driver but it also doesn't work, and the system crashes when 
> I try to play a sound.
>
> My question is how I change the PWM pin used by *pwmsp* to use as audio 
> output.
>
> My lcd module uses this dts:
>
>
> https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-CAPE-DISP-CT4-00A0.dts
>
> The dts that I tried to make to change the pwm port for pwmsp:
>
> /dts-v1/;
> /plugin/;
>
> / {
>         compatible = "ti,beaglebone", "ti,beaglebone-black";
>
>         /* identification */
>         part-number = "BB-SND-PWM1";
>         version = "00A0";
>
>         /* state the resources this cape uses */
>         exclusive-use =
>                 "P9.14",
>                 "P9.16";
>
>         /*
>          * Free up the pins used by the cape from the pinmux helpers.
>          */
>         fragment@0 {
>                 target = <&ocp>;
>                 __overlay__ {
>                         P9_14_pinmux { status = "disabled"; };  /* (U14) 
> gpmc_a2.ehrpwm1A */
>                         P9_16_pinmux { status = "disabled"; };  /* (T14) 
> gpmc_a3.ehrpwm1B */
>                 };
>         };
>
>         fragment@1 {
>                 target = <&am33xx_pinmux>;
>                 __overlay__ {
>                         bb_pwm1_pin: pinmux-pwm1-pin {
>                                 pinctrl-single,pins = <
>                                         0x48 0x06 /* (U14) 
> gpmc_a2.ehrpwm1A */
>                                         0x4c 0x06 /* (B17) 
> gpmc_a3.ehrpwm1B */
>                                 >;
>                         };
>                 };
>         };
>
>         fragment@2 {
>                 target = <&ocp>;
>                 __overlay__ {
>                         bb_pwm1_test_helper: bb_snd-pwm1 {
>                                 compatible = "bone-pinmux-helper";
>                                 pinctrl-names = "default";
>                                 pinctrl-0 = <&bb_pwm1_pin>;
>                                 status = "okay";
>                         };
>                 };
>         };
>
>         fragment@3 {
>                 target = <&epwmss1>;
>                 __overlay__ {
>                         status = "okay";
>                 };
>         };
>
>
>         fragment@4 {
>                 target = <&ehrpwm1>;
>                 __overlay__ {
>                         status = "okay";
>                 };
>         };
>
>         /*
>          * Load ALSA driver for piezo
>          */
>         fragment@5 {
>                 target-path="/";
>                 __overlay__ {
>                         sndpwm {
>                                 compatible = "snd-pwmsp";
>                                 pwms = <&ehrpwm1 1 0 0>;
>                                 status = "okay";
>                         };
>                 };
>         };
> };
>
> I couldn't find any documentation about this driver, and how to operate it.
>
> I'm using the kernel:
>
> Linux beaglebone 4.14.71-ti-r80 #1 SMP PREEMPT Fri Oct 5 23:50:11 UTC 2018 
> armv7l GNU/Linux
>
> Thanks a lot if someone can help me ;)
>
> Best regards,
>
>
>
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/8b5d8fbc-6107-4838-b4aa-ca3cf3060c4d%40googlegroups.com.

Reply via email to