Jetson TX2 - /usr/include/linux/pwm.h missing

I try to set the PWM output with the legacy functions like pwm_request(), pwm_enable().

On my target, there is no include file /usr/include/linux/pwm.h. Did I have to set the include in the Kernel .config file, or why is there no pwm.h header file in the folder? The file exists only on the host (Ubuntu 16.04).

Can I control the pwm only over sysfs?

Thanks in advance

hello p.enz,

may i have more details about your use-case?
for example, which module pwn functions you would like to control.
also, which JetPack release you’re working on?
thanks

Hi Chang,

following scenario.

Jetson TX2 on the devBoard.

Freshly builded kernel from Source LT28.1 with tegra18_defconfig.

PWM-chips (pwmchip0 - pwmchip3) are available and working with sysfs.

Now I want to access the pwm with the methodes in <linux/pwm.h>.
Is this possible, or did I have to use the sysfs variant?

There is no pwm.h in /usr/include/linux/.

Did I have to install a separate library or else?

The pwm.h file only appears in /usr/src/linux-headers-4.4.38-tegra/include/linux/ but if I simple copy the files, it doesn’t work.

Hope this information helps.

Perhaps there is a version mismatch. What package provides the file?

dpkg -S /usr/src/linux-headers-4.4.38-tegra/include/linux/pwm.h
dpkg -S /usr/include/linux/pwm.h

Also, browse the two files and see if version information shows a major version difference.

Hi Linuxdev,

unfortunaly there is no pwm.h in /usr/include/linux/
The file is only in /usr/src/linux-headers-4.4.38-tegra/include/linux/ but I don’t know why this is.

Files in “/usr/include” are usually from a “dev” version of software. For example, you might have support for running OpenGL applications…but there wouldn’t be any development headers unless you added the dev version of the OpenGL package.

The kernel itself will support certain system calls which an external library might depend on without any external user of that call unless you have installed something using it. For example, just because the kernel supports everything an OpenGL app needs it doesn’t mean you have installed any OpenGL libraries or apps.

You need to know what library your software is wanting to link against in order to know which dev/source package provides the headers on top of the actual libraries. The kernel version is for bare metal. More specifically, you need a “/usr/include/linux/pwm.h” dev package which provides the dev header matching your user space library, not a dev package for kernel space (the kernel source is the dev package for kernel space).

I don’t know what package wants pwm.h, but basically you need to research this to know where to get it…since it wants the “/usr/include” version, this says there is likely some library involved (if this were a kernel space driver you’d find it wants a kernel header version and not “/usr/include”).

hello p.enz,

which modules would you like to control via PWM?
BTW, could you refer to this topic to control them
[url]Can i control LCD1_BKLT_PWM? - Jetson TX2 - NVIDIA Developer Forums
thanks