How to call Linux kernel driver functions from a userspace program?
<p><strong>How can I write a C program (in userspace) to call functions that are part of a kernel driver? If it's not possible to do directly, how else do I do it?</strong></p>

<p>CONTEXT: I am trying to use the PWM pins of my single-board computer (Intel NUC DE3815TYBE) so that I can control fans. A linux driver called pwm_lpss allows control of these pins (driver developed by Intel, source code <a href="https://github.com/torvalds/linux/blob/master/drivers/pwm/pwm-lpss.c" rel="nofollow">here</a>). I have verified that this driver is installed by using the <code>lsmod</code> command. Here is the driver information after typing <code>modinfo pwm_lpss</code>:</p>

<pre><code>filename:       /lib/modules/3.19.0-25-generic/kernel/drivers/pwm/pwm-lpss.ko
license:        GPL v2
author:         Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
description:    PWM driver for Intel LPSS
srcversion:     44AA14AF3E2F96C813770A8
depends:
intree:         Y
vermagic:       3.19.0-25-generic SMP mod_unload modversions
signer:         Magrathea: Glacier signing key
sig_key:        6A:AA:11:D1:8C:2D:3A:40:B1:B4:DB:E5:BF:8A:D6:56:DD:F5:18:38
sig_hashalgo:   sha512
</code></pre>

<p>So I know where the driver module is (the <code>pwm-lpss.ko</code> file) and I have the source code which I know has a function in it called <code>pwm_lpss_config()</code> that I'd like to use. How do I call the function from my userspace C program? How would I go about #including it? Or is this not possible to do from userspace?</p>

<p>Unfortunately Intel has provided zero documentation for how to use this driver. I thought drivers normally map their functionality to some user-accessible file. I was able to find some PWM-related files after some digging, but I haven't been able to find a file that looks like it can set PWM duty cycle/frequency.</p>