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 in warrior branch. #100

Closed xlla closed 4 years ago

xlla commented 4 years ago

please add some usage of pwm in acpi kernel, then we can driver dc motor and make more fun.

xlla commented 4 years ago

When I try to switch GP182 soc mode to pwm, a kernel panic occur.

root@edison:~# echo GP182 1 > /sys/kernel/debug/pinctrl_pinmux/pinmux
[  254.743653] BUG: unable to handle page fault for address: 38315000
[  254.749977] #PF: supervisor read access in kernel mode
[  254.755228] #PF: error_code(0x0000) - not-present page
[  254.760478] *pde = 00000000 
[  254.763430] Oops: 0000 [#1] SMP
[  254.766652] CPU: 0 PID: 652 Comm: sh Tainted: G        WC        5.5.0-edison-acpi-standard #1
[  254.775450] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48
[  254.784442] EIP: __kmalloc+0x85/0x210
[  254.788194] Code: c0 0f 85 1e 01 00 00 8b 07 64 8b 50 04 64 03 05 cc b2 85 ca 8b 08 89 4d f0 85 c9 0f 84 54 01 00 00 8b 75 f0 8b 47 14 8d 4a 01 <8b> 1c 06 89 f0 8b 37 64 0f c7 0e 75 d0 8b 47 14 0f 18 04 03 3e 8d
[  254.807374] EAX: 00000000 EBX: 00000dc0 ECX: 000022cb EDX: 000022ca
[  254.813782] ESI: 38315000 EDI: f6001e40 EBP: f48dfe78 ESP: f48dfe5c
[  254.820188] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010206
[  254.827128] CR0: 80050033 CR2: 38315000 CR3: 34672000 CR4: 001006d0
[  254.833529] Call Trace:
[  254.836043]  ? mrfld_pinctrl_pinmux_set+0x4f/0x1bc
[  254.840950]  mrfld_pinctrl_pinmux_set+0x4f/0x1bc
[  254.845677]  ? mrfld_pin_dbg_show+0xa0/0xa0
[  254.849961]  full_proxy_write+0x3e/0x70
[  254.853886]  ? full_proxy_poll+0x60/0x60
[  254.857900]  __vfs_write+0x2b/0x1d0
[  254.861473]  ? selinux_file_permission+0xf5/0x120
[  254.866288]  ? security_file_permission+0x2c/0x100
[  254.871190]  ? __switch_to_asm+0x28/0x50
[  254.875202]  ? __switch_to_asm+0x34/0x50
[  254.879214]  ? rw_verify_area+0x55/0x100
[  254.883228]  vfs_write+0x8f/0x1a0
[  254.886621]  ksys_write+0x4e/0xd0
[  254.890014]  sys_write+0x11/0x20
[  254.893318]  do_fast_syscall_32+0x7a/0x280
[  254.897512]  entry_SYSENTER_32+0xa5/0xf8
[  254.901525] EIP: 0xb7f378e5
[  254.904389] Code: e8 1c 00 00 00 89 d3 eb cf 8d 74 26 00 b8 40 42 0f 00 eb b5 8b 04 24 c3 8b 1c 24 c3 8b 3c 24 c3 90 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d 76 00 58 b8 77 00 00 00 cd 80 90 8d 76
[  254.923574] EAX: ffffffda EBX: 00000001 ECX: 01d40510 EDX: 00000008
[  254.929980] ESI: 01d40510 EDI: 00000008 EBP: b7efdd40 ESP: bfaaf1c0
[  254.936398] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b EFLAGS: 00000246
[  254.943334] Modules linked in: leds_gpio fb_ssd1331(C) fbtft(C) ti_ads7950 industrialio_triggered_buffer kfifo_buf rfcomm iptable_nat bnep spi_pxa2xx_platform dw_dmac usb_f_mass_storage usb_f_rndis u_ether usb_f_acm u_serial libcomposite pwm_lpss_pci pwm_lpss snd_sof_pci snd_sof_intel_byt intel_mrfld_adc snd_sof_intel_hda_common intel_mrfld_pwrbtn snd_sof_intel_ipc snd_sof snd_sof_xtensa_dsp snd_soc_acpi_intel_match snd_soc_acpi spi_pxa2xx_pci brcmfmac brcmutil hci_uart btbcm mmc_block extcon_intel_mrfld intel_soc_pmic_mrfld sdhci_pci cqhci sdhci led_class mmc_core
[  254.994552] CR2: 0000000038315000
[  254.998090] ---[ end trace 7f0f5a483eafb431 ]---
[  255.002879] EIP: __kmalloc+0x85/0x210
[  255.006669] Code: c0 0f 85 1e 01 00 00 8b 07 64 8b 50 04 64 03 05 cc b2 85 ca 8b 08 89 4d f0 85 c9 0f 84 54 01 00 00 8b 75 f0 8b 47 14 8d 4a 01 <8b> 1c 06 89 f0 8b 37 64 0f c7 0e 75 d0 8b 47 14 0f 18 04 03 3e 8d
[  255.025883] EAX: 00000000 EBX: 00000dc0 ECX: 000022cb EDX: 000022ca
[  255.032322] ESI: 38315000 EDI: f6001e40 EBP: f48dfe78 ESP: f48dfe5c
[  255.038762] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010206
[  255.045733] CR0: 80050033 CR2: 38315000 CR3: 34672000 CR4: 001006d0
[  255.153016] BUG: unable to handle page fault for address: 38315000
[  255.159346] #PF: supervisor read access in kernel mode
[  255.164597] #PF: error_code(0x0000) - not-present page
[  255.169847] *pde = 00000000 
[  255.172800] Oops: 0000 [#2] SMP
[  255.176023] CPU: 0 PID: 635 Comm: login Tainted: G      D WC        5.5.0-edison-acpi-standard #1
[  255.185090] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48
[  255.194080] EIP: __kmalloc_track_caller+0x82/0x210
[  255.198982] Code: c0 0f 85 21 01 00 00 8b 07 64 8b 50 04 64 03 05 cc b2 85 ca 8b 08 89 4d f0 85 c9 0f 84 57 01 00 00 8b 75 f0 8b 47 14 8d 4a 01 <8b> 1c 06 89 f0 8b 37 64 0f c7 0e 75 d0 8b 47 14 0f 18 04 03 3e 8d
[  255.218161] EAX: 00000000 EBX: 00000a20 ECX: 000022cb EDX: 000022ca
[  255.224567] ESI: 38315000 EDI: f6001e40 EBP: f4bd7d98 ESP: f4bd7d7c
[  255.230974] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010206
[  255.237909] CR0: 80050033 CR2: 38315000 CR3: 3577a000 CR4: 001006d0
[  255.244312] Call Trace:
[  255.246827]  ? security_sid_to_context_core.isra.16+0x59/0x100
[  255.252799]  kmemdup+0x16/0x30
[  255.255931]  security_sid_to_context_core.isra.16+0x59/0x100
[  255.261722]  security_sid_to_context+0x1b/0x20
[  255.266272]  selinux_socket_getpeersec_stream+0x53/0xe0
[  255.271617]  ? selinux_sk_free_security+0x30/0x30
[  255.276435]  security_socket_getpeersec_stream+0x33/0x60
[  255.281876]  sock_getsockopt+0x960/0xdf0
[  255.285897]  ? unix_seqpacket_sendmsg+0x60/0x60
[  255.290536]  ? __sys_connect_file+0x53/0x70
[  255.294818]  ? selinux_socket_shutdown+0x20/0x20
[  255.299542]  ? selinux_socket_getsockopt+0x10/0x20
[  255.304447]  __sys_getsockopt+0xf5/0x110
[  255.308467]  sys_socketcall+0x2de/0x330
[  255.312394]  do_fast_syscall_32+0x7a/0x280
[  255.316590]  entry_SYSENTER_32+0xa5/0xf8
[  255.320602] EIP: 0xb7fa48e5
[  255.323464] Code: e8 1c 00 00 00 89 d3 eb cf 8d 74 26 00 b8 40 42 0f 00 eb b5 8b 04 24 c3 8b 1c 24 c3 8b 3c 24 c3 90 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d 76 00 58 b8 77 00 00 00 cd 80 90 8d 76
[  255.342643] EAX: ffffffda EBX: 0000000f ECX: bf8a1c1c EDX: 00000000
[  255.349047] ESI: 00000004 EDI: 00953f30 EBP: bf8a1c78 ESP: bf8a1c00
[  255.355454] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b EFLAGS: 00000282
[  255.362394] Modules linked in: leds_gpio fb_ssd1331(C) fbtft(C) ti_ads7950 industrialio_triggered_buffer kfifo_buf rfcomm iptable_nat bnep spi_pxa2xx_platform dw_dmac usb_f_mass_storage usb_f_rndis u_ether usb_f_acm u_serial libcomposite pwm_lpss_pci pwm_lpss snd_sof_pci snd_sof_intel_byt intel_mrfld_adc snd_sof_intel_hda_common intel_mrfld_pwrbtn snd_sof_intel_ipc snd_sof snd_sof_xtensa_dsp snd_soc_acpi_intel_match snd_soc_acpi spi_pxa2xx_pci brcmfmac brcmutil hci_uart btbcm mmc_block extcon_intel_mrfld intel_soc_pmic_mrfld sdhci_pci cqhci sdhci led_class mmc_core
[  255.413611] CR2: 0000000038315000
[  255.417130] ---[ end trace 7f0f5a483eafb432 ]---
[  255.421908] EIP: __kmalloc+0x85/0x210
[  255.425700] Code: c0 0f 85 1e 01 00 00 8b 07 64 8b 50 04 64 03 05 cc b2 85 ca 8b 08 89 4d f0 85 c9 0f 84 54 01 00 00 8b 75 f0 8b 47 14 8d 4a 01 <8b> 1c 06 89 f0 8b 37 64 0f c7 0e 75 d0 8b 47 14 0f 18 04 03 3e 8d
[  255.444917] EAX: 00000000 EBX: 00000dc0 ECX: 000022cb EDX: 000022ca
[  255.451358] ESI: 38315000 EDI: f6001e40 EBP: f48dfe78 ESP: f48dfe5c
[  255.457799] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010206
[  255.464771] CR0: 80050033 CR2: 38315000 CR3: 3577a000 CR4: 001006d0
[  255.474914] BUG: unable to handle page fault for address: 38315000
[  255.481253] #PF: supervisor read access in kernel mode
[  255.486504] #PF: error_code(0x0000) - not-present page
[  255.491755] *pde = 00000000 
[  255.494706] Oops: 0000 [#3] SMP
[  255.497927] CPU: 0 PID: 1 Comm: systemd Tainted: G      D WC        5.5.0-edison-acpi-standard #1
[  255.506990] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48
[  255.515983] EIP: kmem_cache_alloc_trace+0x64/0x1b0
[  255.520887] Code: c0 0f 85 3f 01 00 00 8b 07 64 8b 50 04 64 03 05 cc b2 85 ca 8b 08 89 4d f0 85 c9 0f 84 35 01 00 00 8b 75 f0 8b 47 14 8d 4a 01 <8b> 1c 06 89 f0 8b 37 64 0f c7 0e 75 d0 8b 47 14 0f 18 04 03 3e 8d
[  255.540066] EAX: 00000000 EBX: 00008cc0 ECX: 000022cb EDX: 000022ca
[  255.546470] ESI: 38315000 EDI: f6001e40 EBP: f60c5d58 ESP: f60c5d3c
[  255.552876] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010206
[  255.559811] CR0: 80050033 CR2: 38315000 CR3: 34fee000 CR4: 001006d0
[  255.566213] Call Trace:
[  255.568726]  ? tty_ldisc_get.part.7+0x76/0x90
[  255.573183]  tty_ldisc_get.part.7+0x76/0x90
[  255.577466]  tty_ldisc_init+0xd/0x20
[  255.581128]  alloc_tty_struct+0x48/0x1f0
[  255.585141]  tty_init_dev+0x39/0x1b0
[  255.588803]  ? _cond_resched+0x12/0x30
[  255.592638]  tty_open+0x27e/0x460
[  255.596035]  chrdev_open+0x82/0x180
[  255.599606]  do_dentry_open+0x135/0x3c0
[  255.603531]  ? cdev_put.part.3+0x20/0x20
[  255.607547]  vfs_open+0x20/0x30
[  255.610766]  path_openat+0x28b/0x11a0
[  255.614521]  do_filp_open+0x65/0xd0
[  255.618094]  ? __remove_hrtimer+0x2e/0x60
[  255.622201]  ? _cond_resched+0x12/0x30
[  255.626043]  ? __alloc_fd+0x2e/0x140
[  255.629705]  do_sys_open+0x16d/0x200
[  255.633365]  ? sys_rt_sigaction+0xad/0xf0
[  255.637471]  sys_openat+0x16/0x20
[  255.640864]  do_fast_syscall_32+0x7a/0x280
[  255.645057]  entry_SYSENTER_32+0xa5/0xf8
[  255.649068] EIP: 0xb7fa68e5
[  255.651933] Code: e8 1c 00 00 00 89 d3 eb cf 8d 74 26 00 b8 40 42 0f 00 eb b5 8b 04 24 c3 8b 1c 24 c3 8b 3c 24 c3 90 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d 76 00 58 b8 77 00 00 00 cd 80 90 8d 76
[  255.671111] EAX: ffffffda EBX: ffffff9c ECX: 00624700 EDX: 00088902
[  255.677517] ESI: 00000000 EDI: b7c91e48 EBP: 00000000 ESP: bfd54220
[  255.683924] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b EFLAGS: 00000286
[  255.690859] Modules linked in: leds_gpio fb_ssd1331(C) fbtft(C) ti_ads7950 industrialio_triggered_buffer kfifo_buf rfcomm iptable_nat bnep spi_pxa2xx_platform dw_dmac usb_f_mass_storage usb_f_rndis u_ether usb_f_acm u_serial libcomposite pwm_lpss_pci pwm_lpss snd_sof_pci snd_sof_intel_byt intel_mrfld_adc snd_sof_intel_hda_common intel_mrfld_pwrbtn snd_sof_intel_ipc snd_sof snd_sof_xtensa_dsp snd_soc_acpi_intel_match snd_soc_acpi spi_pxa2xx_pci brcmfmac brcmutil hci_uart btbcm mmc_block extcon_intel_mrfld intel_soc_pmic_mrfld sdhci_pci cqhci sdhci led_class mmc_core
[  255.742075] CR2: 0000000038315000
[  255.745644] ---[ end trace 7f0f5a483eafb433 ]---
[  255.750464] EIP: __kmalloc+0x85/0x210
[  255.754301] Code: c0 0f 85 1e 01 00 00 8b 07 64 8b 50 04 64 03 05 cc b2 85 ca 8b 08 89 4d f0 85 c9 0f 84 54 01 00 00 8b 75 f0 8b 47 14 8d 4a 01 <8b> 1c 06 89 f0 8b 37 64 0f c7 0e 75 d0 8b 47 14 0f 18 04 03 3e 8d
[  255.773572] EAX: 00000000 EBX: 00000dc0 ECX: 000022cb EDX: 000022ca
[  255.780031] ESI: 38315000 EDI: f6001e40 EBP: f48dfe78 ESP: f48dfe5c
[  255.786487] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010206
[  255.793477] CR0: 80050033 CR2: 38315000 CR3: 34fee000 CR4: 001006d0
[  255.799975] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
[  255.807830] Kernel Offset: 0x8000000 from 0xc1000000 (relocation range: 0xc0000000-0xf77fdfff)
[  255.816638] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009 ]---

FATAL: read from port failed: Device not configured
Skipping tty reset...

xlla commented 4 years ago

pwm is work.

shawnhsoia97 commented 3 years ago

Hi @xlla, I also want to set PWM mode, but I have not found /sys/kernel/debug/pinctrl_pinmux/pinmux in my kernel (branch zeus). 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, , ) { 12 }
    })
    Method (_CRS, 0, NotSerialized)
    {
        Return (RBUF)
    }
}

Please, Could you tell me how to use PWM? I need to switch GP12 to PWM mode1. Thank you.

andy-shev commented 2 years ago

Hi @xlla, I also want to set PWM mode, but I have not found /sys/kernel/debug/pinctrl_pinmux/pinmux in my kernel (branch zeus). Please, Could you tell me how to use PWM? I need to switch GP12 to PWM mode1.

@shawnhsoia97, @xlla had been active almost couple of years ago and here is their branch with the experimental patches: https://github.com/xlla/linux/commits/eds-acpi-5.5.0-v1. We are free to accept the cleaned up version of the pinmux support (note there is some development regarding this feature in upstream as well in a similar way). So, feel free to take these and update, we will review and merge in the kernel in meta-intel-edison.