]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Rework pwmbus and pwmc so that each child will handle a single PWM channel.
authorian <ian@FreeBSD.org>
Sun, 16 Jun 2019 19:44:42 +0000 (19:44 +0000)
committerian <ian@FreeBSD.org>
Sun, 16 Jun 2019 19:44:42 +0000 (19:44 +0000)
commit1fabfc2338dd16d5c36afae4627d713a1320c2c3
treec86430705e016e0bf53f71e92d3a588d9c4abea3
parent023908374d2b98d659620a3c8c6f01e29ef36f38
Rework pwmbus and pwmc so that each child will handle a single PWM channel.

Previously, there was a pwmc instance for each instance of pwm hardware
regardless of how many pwm channels that hardware supported.  Now there
will be a pwmc instance for each channel when the hardware supports
multiple channels.  With a separate instance for each channel, we can have
"named channels" in userland by making devfs alias entries in /dev/pwm.

These changes add support for ivars to pwmbus, and use an ivar to track the
channel number for each child.  It also adds support for hinted children.

In pwmc, the driver checks for a label hint, and if present, it's used to
create an alias for the cdev in /dev/pwm.  It's not anticipated that hints
will be heavily used, but it's easy to do and allows quick ad-hoc creation
of named channels from userland by using kenv to create hint.pwmc.N.label=
hints.  Upcoming changes will add FDT support, and most labels will
probably be specified that way.
sys/dev/pwm/pwmbus.c
sys/dev/pwm/pwmbus.h [new file with mode: 0644]
sys/dev/pwm/pwmc.c