FreeBSD/src 187f36e (r349430)etc/mtree BSD.include.dist, include Makefile

MFC r343826, r346698, r349057-r349060, r349073-r349077, r349080-r349086, r349088,
    r349091-r349097, r349115, r349119, r349130-r349132, r349143-r349145,
    r349164-r349168, r349174, r349269-r349273

r343826 by yuripv:
pwm.8: fix markup in synopsis, add -f description

r346698 by manu:
arm: allwinner: aw_pwm: compile it as module too

r349057:
Allow pwm(9) components to be selected individually, while 'device pwm'
still includes it all.

r349058:
In detach(), check for failure of bus_generic_detach(), only release
resources if they got allocated (because detach() gets called from attach()
to handle various failures), and delete the pwmbus child if it got created.

r349059:
Don't call pwmbus_attach_bus(), because it may not be present if this
driver is compiled into the kernel but pwmbus will be loaded as a module
when needed (and because of that, pwmbus_attach_bus() is going away in
the near future).  Instead, just directly do what that function did:
register the fdt xfef handle, and attach the pwmbus.

r349060:
Handle failure to enable the clock or obtain its frequency.

r349073:
Do not include pwm.h here, it is purely a userland interface file containing
ioctl defintions for the pwmc driver. It is not part of the pwmbus interface.

r349074:
Move/rename the sys/pwm.h header file to dev/pwm/pwmc.h.  The file contains
ioctl definitions and related datatypes that allow userland control of pwm
hardware via the pwmc device.  The new name and location better reflects its
assocation with a single device driver.

r349075:
Remove pwmbus_attach_bus(), it no longer has any callers.  Also remove a
couple prototypes for functions that never existed (and never will).

r349076:
Use device_delete_children() instead of a locally-rolled copy of it that
leaks the device-list memory.

r349077:
Add a missing #include.  I suspect this used to get included via some header
pollution that was cleaned up recently, and this file got missed in the
cleanup because it's not attached to the build unless you specifically
request this device in a custom kernel config.

r349080:
Make pwmbus driver and devclass vars static; they're not mentioned in any
header file, so they can't be used outside this file anyway.

r349081:
Unwrap prototype lines so that return type and function name are on the
same line.  No functional changes.

r349082:
Spell unsigned int as u_int and channel as chan; eliminates the need to wrap
some long lines.

r349083:
Give the aw_pwm driver a module version.

r349084:
Rename the channel_max method to channel_count, because that's what it's
returning.  (If the channel count is 2, then the max channel number is 1.)

r349085:
Destroy the cdev on device detach.  Also, make the driver and devclass
static, because nothing outside this file needs them.

r349086:
Restructure the pwm device hirearchy and interfaces.

The pwm and pwmbus interfaces were nearly identical, this merges them into a
single pwmbus interface.  The pwmbus driver now implements the pwmbus
interface by simply passing all calls through to its parent (the hardware
driver).  The channel_count method moves from pwm to pwmbus, and the
get_bus method is deleted (just no longer needed).

The net effect is that the interface for doing pwm stuff is now the same
regardless of whether you're a child of pwmbus, or some random driver
elsewhere in the hierarchy that is bypassing the pwmbus layer and is talking
directly to the hardware driver via cross-hierarchy connections established
using fdt data.

The pwmc driver is now a child of pwmbus, instead of being its sibling
(that's why the get_bus method is no longer needed; pwmc now gets the
device_t of the bus using device_get_parent()).

r349088:
Make pwm channel numbers unsigned.

r349091:
The pwm interface was replaced with pwmbus, include the right header file.

r349092:
Make channel number unsigned, and spell unsigned int u_int.  This should
have been part of r349088.

r349093:
This code no longer uses fdt/ofw stuff, no need to include ofw headers.

r349094:
Add module makefiles for pwm.

r349095:
Split the dtb MODULES_EXTRA line to a series of += lines, making it easier
to maintain and keep in alphabetical order, and paving the way for adding
some other modules that aren't dtb-related.

r349096:
Add module makefiles for Texas Instruments ARM SoCs.

The natural place to look for them based on how other SoCs are organized
would be sys/modules/ti, but that's already taken.  Drop a clue into
modules/ti/Makefile directing people to modules/arm_ti if they're looking
for ARM modules.

r349097:
Build SoC-specific modules with GENERIC for the SoCs that have them.

r349115:
Rename pwmbus.h to ofw_pwm.h, because after all the recent changes, there
is nothing left in the file that related to pwmbus at all.  It just contains
prototypes for the functions implemented in dev/pwm.ofw_pwm.c, so name it
accordingly and fix the include protect wrappers to match.

A new pwmbus.h will be coming along in a future commit.

r349119:
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.

r349130:
Add ofw_pwmbus to enumerate pwmbus devices on systems configured with fdt
data.  Also, add fdt support to pwmc.

r349131:
Implement the ofw_bus_get_node method in aw_pwm(4) so that ofw_pwmbus can
find its metadata for instantiating children.

r349132:
Add back a const qualifier I somehow fumbled away between test-building
and committing recent changes.

r349143:
Put the pwmc cdev filenames under the pwm directory along with any label
names.  I.e., everything related to pwm now goes in /dev/pwm.  This will
make it easier for userland tools to turn an unqualified name into a fully
qualified pathname, whether it's the base pwmcX.Y name or a label name.

r349144:
Follow changes in the pwmc(4) driver in relation to device filenames.

The driver now names its cdev nodes pwmcX.Y where X is unit number and
Y is the channel within that unit.  Change the default device name from
pwmc0 to pwmc0.0.  The driver now puts cdev files and label aliases in
the /dev/pwm directory, so allow the user to provide unqualified names
with -f and automatically prepend the /dev/pwm part for them.

Update the examples in the manpage to show the new device name format
and location within /dev/pwm.

r349145:
Put periods at the ends of argument descriptions.  Explain the relationship
between the period and duty arguments.

r349164:
Remove everything related to channels from the pwmc public interface, now
that there is a pwmc(4) instance per channel and the channel number is
maintained as a driver ivar rather than being passed in from userland.

r349165:
Explain the relationship between PWM hardware channels being controlled and
pwmc(4) device filenames.  Also, use uppercase PWM when the term is being
used as an acronym, and expand the acronym where it's first used.

r349166:
Rearrange the argument checking and processing so that enable and disable
can be combined with configuring the period and duty cycle (the same ioctl
sets all 3 values at once, so there's no reason to require the user to run
the program twice to get all 3 things set).

r349167:
Oops, it seems I left out the word 'cycle', fix it.

r349168:
Add a pwmc(4) manpage.

r349174:
Handle labels specified with hints even on FDT systems.  Hints are the
easiest thing for a user to control (via loader.conf or kenv+kldload), so
handle them in addition to any label specified via the FDT data.

r349269:
Some mundane tweaks and cleanups to help de-clutter the diffs of some
upcoming functional changes.

Add an ofw_compat_data table for probing compat strings, and use it to add
PNP data.  Remove some stray semicolons at the end of macro definitions,
and add a PWM_LOCK_ASSERT macro to round out the usual suite.  Move the
device_t and driver_methods structs to the end of the file.  Tweak comments.

r349270:
Add support for the PWM(9) API.  This allows configuring the pwm output using
pwm(9), but also maintains the historical sysctl config interface for
compatiblity with existing apps.  The two config systems are not compatible
with each other; if you use both interfaces to change configurations you're
likely to end up with incorrect output or none at all.

r349271:
Catch up with recent changes in pwmbus(9).  The pwm(9) and pwmbus(9)
interfaces were unified into pwmbus(9), and the PWMBUS_CHANNEL_MAX method
was renamed PWMBUS_CHANNEL_COUNT.  The pwmbus_attach_bus() function just
went away completely.  Also, fix a few typos such as s/is/if/.

r349272:
Do some general cleanup and light wordsmithing.

Sort methods alphabetically.  Wrap long lines.  Start sentences on a new
line.  Remove contractions (not because it's a good idea, just to silence
igor).  Add some explanation of the units for the period and duty arguments
and the convention for channel numbers.

r349273:
Add pwm to the armv7 GENERIC kernel, it's now used by TI and Allwinner.
DeltaFile
+290-18sys/arm/ti/am335x/am335x_ehrpwm.c
+169-120sys/dev/pwm/pwmbus.c
+223-0sys/dev/pwm/ofw_pwmbus.c
+212-0share/man/man4/pwmc.4
+61-78usr.sbin/pwm/pwm.c
+79-29sys/dev/pwm/pwmc.c
+0-106sys/dev/pwm/pwm_if.m
+61-39usr.sbin/pwm/pwm.8
+0-93share/man/man9/pwm.9
+58-32sys/arm/allwinner/aw_pwm.c
+51-36share/man/man9/pwmbus.9
+37-28sys/dev/pwm/pwmbus.h
+55-0sys/dev/pwm/ofw_pwm.h
+0-53sys/sys/pwm.h
+51-0sys/dev/pwm/pwmc.h
+16-12sys/dev/pwm/pwmbus_if.m
+20-0sys/modules/pwm/pwmbus/Makefile
+18-0sys/modules/pwm/pwmc/Makefile
+16-1sys/arm/conf/GENERIC
+16-0sys/modules/arm_ti/am335x_ehrpwm/Makefile
+15-0sys/modules/allwinner/aw_pwm/Makefile
+14-0sys/modules/arm_ti/ti_i2c/Makefile
+1-9sys/dev/pwm/ofw_pwm.c
+5-5sys/conf/files
+9-0sys/modules/pwm/Makefile
+9-0sys/modules/arm_ti/Makefile
+2-2include/Makefile
+2-0sys/modules/ti/Makefile
+1-1share/man/man9/Makefile
+2-0etc/mtree/BSD.include.dist
+1-0sys/modules/Makefile
+1-0sys/arm/ti/am335x/am335x_dmtpps.c
+1-0share/man/man4/Makefile
+1-0sys/modules/allwinner/Makefile
+1,497-66234 files

UnifiedSplitRaw