edison-fw / meta-intel-edison

Here is the meta-intel-edison that builds, tries to stay up to date. Master is based on Yocto Poky Gatesgarth LTS 5.10.yy vanilla kernels. It builds a 32bit kernel (Gatesgarth branch 64bit) with ACPI enabled and corresponding rootfs. Telegram group: https://t.me/IntelEdison Web-site:
https://edison-fw.github.io/meta-intel-edison/
MIT License
60 stars 37 forks source link

How to use PWM mode? #130

Closed shawnhsoia97 closed 3 years ago

shawnhsoia97 commented 3 years ago

Hi @htot , I want to set PWM mode. I tried used below code in my .asl files and use /sys/class/pwm class test , but which is not effect.

External (_SB_.PCI0.PWM0, DeviceObj)

Scope (\_SB.PCI0.PWM0)
{
    Name (RBUF, ResourceTemplate ()
    {
        PinFunction(Exclusive, PullUp, 0x0001,
            "\\_SB.FLIS", 0, ResourceConsumer, , ) { 144 }
    })
    Method (_CRS, 0, NotSerialized)
    {
        Return (RBUF)
    }
}

Please, Could you tell me how to use PWM? I need to switch GP12 to PWM mode1. By the way I use in branch zeus ,and that not use Arduino development board. Thank you.

htot commented 3 years ago

What do you mean zeus does not use Arduino board?

We have this https://github.com/edison-fw/meta-acpi/blob/a48a1c514978038ba17c115c94845341ffb91d54/recipes-bsp/acpi-tables/samples/edison/arduino.asli#L1131

Scope (\_SB.PCI0.PWM0)
{
    Name (RBUF, ResourceTemplate ()
    {
        PinFunction(Exclusive, PullUp, 0x0001,
            "\\_SB.FLIS", 0, ResourceConsumer, , ) { 144 }
        PinFunction(Exclusive, PullUp, 0x0001,
            "\\_SB.FLIS", 0, ResourceConsumer, , ) { 145 }
        PinFunction(Exclusive, PullUp, 0x0001,
            "\\_SB.FLIS", 0, ResourceConsumer, , ) { 132 }
        PinFunction(Exclusive, PullUp, 0x0001,
            "\\_SB.FLIS", 0, ResourceConsumer, , ) { 133 }
    })
    Method (_CRS, 0, NotSerialized)
    {
        Return (RBUF)
    }
}
shawnhsoia97 commented 3 years ago

What do you mean zeus does not use Arduino board?

My mean is only use GPIO of Edison , and I did not develop on Arduino board.

We have this https://github.com/edison-fw/meta-acpi/blob/a48a1c514978038ba17c115c94845341ffb91d54/recipes-bsp/acpi-tables/samples/edison/arduino.asli#L1131

Scope (\_SB.PCI0.PWM0)
{
    Name (RBUF, ResourceTemplate ()
    {
        PinFunction(Exclusive, PullUp, 0x0001,
            "\\_SB.FLIS", 0, ResourceConsumer, , ) { 144 }
        PinFunction(Exclusive, PullUp, 0x0001,
            "\\_SB.FLIS", 0, ResourceConsumer, , ) { 145 }
        PinFunction(Exclusive, PullUp, 0x0001,
            "\\_SB.FLIS", 0, ResourceConsumer, , ) { 132 }
        PinFunction(Exclusive, PullUp, 0x0001,
            "\\_SB.FLIS", 0, ResourceConsumer, , ) { 133 }
    })
    Method (_CRS, 0, NotSerialized)
    {
        Return (RBUF)
    }
}

Yes , I did follow this example , but I use control pwm based on pwm class (e.g. /sys/class/pwm/pwmchip0/pwm0) that is no PWM signal created on pwm0(GP12).

htot commented 3 years ago

I see, it appears you are right. The pin mode needs to be set and there is no infrastructure for that yet. For now there is hack floating around that you might try. It sets the pin modes when the pwm driver is probed, maybe it works for you?

shawnhsoia97 commented 3 years ago

Thank your help ! I appreciate that. This works for me. The pwm driver has been correctly probed.

andy-shev commented 2 years ago

Also possible to do this via @xlla patches as pointed out here https://github.com/edison-fw/meta-intel-edison/issues/100.