pwm_test patch for 3.8

Hi, I have a patch for getting pwm_test.c (the user interface) to work with device tree. See attachment. It looks like the driver was started on, but not completed… I was told by Robert Nelson to submit it here, but he just sent me an email where he said that it had been committed, so I guess no action is necessary.

Also I have found a bug with the current implementation of ti_am335x_tscadc that makes the ADC stop working when an LCD display with a touch interface is connected. It gives weird values since the separation into FIFO0 and FIFO1 is not good. Searching for this on google revealed at least one other guy that had trouble with it… https://groups.google.com/forum/?fromgroups=#!topic/beagleboard/_46G9BwJuEE . He was using 3.2 so I guess the problem is there as well.

I tried emailing the guy the originally wrote the driver (Worked at TI), but no response yet.

Anyways, attached is a quick fix that at least checks the channel ID instead of assuming that the data in the FIFO is organized linearly. Hate to submit a quickfix patch, but perhaps it might offer some comfort for someone having trouble with LCD and ADC at the same time…

0009-fix-the-pwm_test-driver-to-work-with-device-tree.patch (5.81 KB)

quickfix-for-getting-right-adc-data-when-touch-display-is-connected.patch (1.49 KB)

I get null pointer errors with the attached version of this patch. Any thoughts?

root@beaglebone:/sys/devices/bone_capemgr.8# cat slots
0: 54:PF---
1: 55:PF---
2: 56:PF---
3: 57:PF---
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
6: ff:P-O-L Override Board Name,00A0,Override Manuf,cape-bone-iio
root@beaglebone:/sys/devices/bone_capemgr.8# echo pwm_P8_13 > slots
Connection to 192.168.2.222 closed.

logging back in and doing dmesg...
[ 5684.721107] bone-capemgr bone_capemgr.8: part_number 'pwm_P8_13',
version 'N/A'
[ 5684.721281] bone-capemgr bone_capemgr.8: slot #7: generic override
[ 5684.721332] bone-capemgr bone_capemgr.8: bone: Using override
eeprom data at slot 7
[ 5684.721383] bone-capemgr bone_capemgr.8: slot #7: 'Override Board
Name,00A0,Override Manuf,pwm_P8_13'
[ 5684.721659] bone-capemgr bone_capemgr.8: slot #7: Requesting part
number/version based 'pwm_P8_13-00A0.dtbo
[ 5684.721712] bone-capemgr bone_capemgr.8: slot #7: Requesting
firmware 'pwm_P8_13-00A0.dtbo' for board-name 'Override Board Name',
ve
rsion '00A0'
[ 5684.721764] bone-capemgr bone_capemgr.8: slot #7: dtbo
'pwm_P8_13-00A0.dtbo' loaded; converting to live tree
[ 5684.722237] bone-capemgr bone_capemgr.8: slot #7: #3 overlays
[ 5684.736633] ehrpwm 48304200.ehrpwm: unable to select pin group
[ 5684.736952] Unable to handle kernel NULL pointer dereference at
virtual address 00000008
[ 5684.745499] pgd = ddc50000
[ 5684.748362] [00000008] *pgd=9df10831, *pte=00000000, *ppte=00000000
[ 5684.755026] Internal error: Oops: 17 [#1] SMP THUMB2
[ 5684.760264] Modules linked in: bone_iio_helper ip_tables x_tables
libcomposite rfcomm ircomm_tty ircomm irda ipv6 hidp bluetooth rfk
ill autofs4
[ 5684.774026] CPU: 0 Not tainted (3.8.5-00532-g923a027 #5)
[ 5684.780024] PC is at __mutex_lock_slowpath+0x42/0x20c
[ 5684.785362] LR is at mutex_lock+0xf/0x20
[ 5684.789514] pc : [<c0372246>] lr : [<c037241f>] psr: 000001b3
[ 5684.789514] sp : ddf3fd60 ip : 00000000 fp : df744684
[ 5684.801611] r10: 00000000 r9 : df744684 r8 : 00000000
[ 5684.807124] r7 : dde1c040 r6 : 00000113 r5 : 00000008 r4 : 00000004
[ 5684.814007] r3 : 00000000 r2 : 00000000 r1 : ddf3fd60 r0 : 00000004
[ 5684.820895] Flags: nzcv IRQs off FIQs on Mode SVC_32 ISA Thumb
Segment user
[ 5684.828694] Control: 50c5387d Table: 9dc50019 DAC: 00000015
[ 5684.834758] Process sh (pid: 452, stack limit = 0xddf3e240)
[ 5684.840637] Stack: (0xddf3fd60 to 0xddf40000)
[ 5684.845255] fd60: c066337c 00000001 dd96771c 40000113 dd967680
00000004 00000004 00000100
[ 5684.853890] fd80: dd967600 00000000 df744684 00000000 df744684
c037241f 00000000 c01d04d3
[ 5684.862528] fda0: dd967610 dde6b950 00000000 c01d0323 c01d020f
dd967610 ddf3fde8 c02192d1
[ 5684.871165] fdc0: c0663420 c0219c03 c0219bf7 c02191bd c02192d1
dd967610 ddf3fde8 c02192d1
[ 5684.879801] fde0: 00000000 c0218387 df044498 df2d4204 dd967610
dd967610 00000000 dd967644
[ 5684.888437] fe00: 00000000 c0219125 00000001 80000000 c066aea8
dd967610 00000000 c0218b35
[ 5684.897073] fe20: dd967610 dd967618 00000000 c0217d2d 00000200
c064f390 00000000 c0030edf
[ 5684.905707] fe40: 00000000 dd967600 00000000 00000000 dd967600
00000000 00000000 00000000
[ 5684.914341] fe60: df744684 00000003 df744684 c02c7f93 00000000
dd92e200 00000000 00000000
[ 5684.922977] fe80: 00000001 c02c8c0d df74464c 00000000 00000001
df744600 df744654 c02c90fb
[ 5684.931613] fea0: ddbf1b80 df74464c ddf3fe94 dd9b2810 df10d410
df32a454 00000000 dd9b2a68
[ 5684.940249] fec0: df32a44c c0b0f440 ddbd2000 c0227861 dd9b2a31
dd9b2a52 00000004 dd92ec00
[ 5684.948885] fee0: c056ca4d 00000000 dd92ec00 00000000 df10d410
df32a410 dd9b2810 c0b0f440
[ 5684.957522] ff00: ddbd2000 c02282cd c0f83d90 c0f83d5c ddbd2000
c02280bd 0000000a df330288
[ 5684.966159] ff20: c0216e21 dde6bf40 dde6bf58 df10d418 00000000
c0216e2b ddf3ff80 c00e1e0f
[ 5684.974794] ff40: 0000000a df62b680 000d6408 c00e1d6d ddf3ff80
00000000 00000000 c00a72cd
[ 5684.983430] ff60: df62b680 000d6408 df62b680 00000000 000d6408
0000000a 00000000 c00a74db
[ 5684.992064] ff80: 00000000 00000000 0000000a 0000000a 000d6408
b6e82a80 00000004 c000bfc4
[ 5685.000699] ffa0: ddf3e000 c000be21 0000000a 000d6408 00000001
000d6408 0000000a 00000000
[ 5685.009333] ffc0: 0000000a 000d6408 b6e82a80 00000004 0000000a
0000000a 000d6408 00000000
[ 5685.017969] ffe0: 00000000 beb599b4 b6dbeb2c b6e1130c 600f0010
00000001 9fefe821 9fefec21
[ 5685.026628] [<c0372246>] (__mutex_lock_slowpath+0x42/0x20c) from
[<c037241f>] (mutex_lock+0xf/0x20)
[ 5685.036195] [<c037241f>] (mutex_lock+0xf/0x20) from [<c01d04d3>]
(pwmss_submodule_state_change+0x13/0x50)
[ 5685.046305] [<c01d04d3>] (pwmss_submodule_state_change+0x13/0x50)
from [<c01d0323>] (ehrpwm_pwm_probe+0x115/0x192)
[ 5685.057249] [<c01d0323>] (ehrpwm_pwm_probe+0x115/0x192) from
[<c0219c03>] (platform_drv_probe+0xd/0xe)
[ 5685.067088] [<c0219c03>] (platform_drv_probe+0xd/0xe) from
[<c02191bd>] (driver_probe_device+0x69/0x138)
[ 5685.077106] [<c02191bd>] (driver_probe_device+0x69/0x138) from
[<c0218387>] (bus_for_each_drv+0x27/0x48)
[ 5685.087119] [<c0218387>] (bus_for_each_drv+0x27/0x48) from
[<c0219125>] (device_attach+0x37/0x52)
[ 5685.096493] [<c0219125>] (device_attach+0x37/0x52) from
[<c0218b35>] (bus_probe_device+0x19/0x60)
[ 5685.105867] [<c0218b35>] (bus_probe_device+0x19/0x60) from
[<c0217d2d>] (device_add+0x2b9/0x3b0)
[ 5685.115158] [<c0217d2d>] (device_add+0x2b9/0x3b0) from [<c02c7f93>]
(of_platform_device_create_pdata+0x37/0x4c)
[ 5685.125819] [<c02c7f93>]
(of_platform_device_create_pdata+0x37/0x4c) from [<c02c8c0d>]
(of_overlay_device_entry_change.isra.0+0x55/0xd0)
[ 5685.138756] [<c02c8c0d>]
(of_overlay_device_entry_change.isra.0+0x55/0xd0) from [<c02c90fb>]
(of_overlay+0x93/0x10c)
[ 5685.149869] [<c02c90fb>] (of_overlay+0x93/0x10c) from [<c0227861>]
(bone_capemgr_load+0x1b9/0x294)
[ 5685.159335] [<c0227861>] (bone_capemgr_load+0x1b9/0x294) from
[<c02282cd>] (slots_store+0x211/0x250)
[ 5685.168981] [<c02282cd>] (slots_store+0x211/0x250) from
[<c0216e2b>] (dev_attr_store+0xb/0x12)
[ 5685.178091] [<c0216e2b>] (dev_attr_store+0xb/0x12) from
[<c00e1e0f>] (sysfs_write_file+0xa3/0xda)
[ 5685.187475] [<c00e1e0f>] (sysfs_write_file+0xa3/0xda) from
[<c00a72cd>] (vfs_write+0x5d/0x100)
[ 5685.196576] [<c00a72cd>] (vfs_write+0x5d/0x100) from [<c00a74db>]
(sys_write+0x27/0x44)
[ 5685.205045] [<c00a74db>] (sys_write+0x27/0x44) from [<c000be21>]
(ret_fast_syscall+0x1/0x46)
[ 5685.213955] Code: f3ef 8600 b672 1d25 (e855) 3f00
[ 5685.219023] ---[ end trace f560243930a1a678 ]---

0001-pwm_test-add-support-for-devicetree-overlay.patch (8.04 KB)

Not wanting to turn this into a code dump, but I made some changes to the pwm_test driver along these lines which also fixed some of the issues trying to be addressed here. It's fewer changes but does about the same things I believe.

pwm_test_improvements.patch (2.67 KB)

Attached it the patch that I think should work, but I get the error shown below. Normally for me, pwm_test just doesn’t have any entries.

http://hipstercircuits.com/enable-pwm-on-beaglebone-with-device-tree-overlays/ supposedly works, but I haven’t been able to reproduce it.

0001-pwm_test-add-support-for-devicetree-overlay.patch (8.04 KB)