Add chvgpio driver for gpio present of Intel z8000 series (Cherry View) SOC
ClosedPublic

Authored by thj on Nov 14 2017, 2:53 PM.

Details

Summary

Add chvgpio that supports the gpio driver found on Intel z8000 series system on chips.
This driver is based on the chvgpio driver from OpenBSD heavily refactored to match
FreeBSD gpio subsystem.

This revision does not support the interupt mechanisms on the gpio controller. The
hardware I have requires other devices drivers before I will be able to test these.

There is a test program here:
https://github.com/adventureloop/gpdpocket/blob/master/gpdfand.sh

that controls the gpio connect fan in my Cherryview laptop (GPD Pocket)

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
thj created this revision.Nov 14 2017, 2:53 PM
thj created this object with visibility "thj (Tom Jones)".
thj changed the visibility from "thj (Tom Jones)" to "Public (No Login Required)".
thj added a reviewer: gonzo.Nov 16 2017, 7:35 AM

Is the name correct?

https://ark.intel.com/search?q=Cherry+View -- nothing found.
https://ark.intel.com/search?q=Atom+Z8 -- finds several "Processor X Series" chips; click one, and it lists the codename as "Cherry Trail".

thj added a comment.Nov 17 2017, 10:04 AM

Is the name correct?

https://ark.intel.com/search?q=Cherry+View -- nothing found.
https://ark.intel.com/search?q=Atom+Z8 -- finds several "Processor X Series" chips; click one, and it lists the codename as "Cherry Trail".

I think this is particularly confusing. My understanding is that Intel changed the platform code name from Cherry Trail to 'Products formerly Cherry Trail' as seen here:
https://ark.intel.com/products/codename/46629/Cherry-Trail

The other implementations of this gpio controller refer to the codename as CherryView (sans space) as can be seen here:
https://github.com/torvalds/linux/blob/master/drivers/pinctrl/intel/pinctrl-cherryview.c
https://github.com/openbsd/src/blob/master/sys/dev/acpi/chvgpio.c

With OpenBSD using CherryView in the man page for the device:
https://man.openbsd.org/chvgpio.4

I don't really know which is the correct name to use with these devices, but I would favour consistency across platforms.
I would like to keep the driver name inline with OpenBSD so that the same devices attach on the same hardware.

wblock added a subscriber: wblock.Nov 17 2017, 4:26 PM
wblock added inline comments.
share/man/man4/chvgpio.4
38 ↗(On Diff #35234)

This will read a little weird: "The chvgpio is a driver..."

I suggest removing "The".

39 ↗(On Diff #35234)
is a driver for the GPIO controller in Intel's Cherry View System on Chip
42 ↗(On Diff #35234)
The Cherry View...
44 ↗(On Diff #35234)

Needs markup on the device name, possibly .Pa:

All but VIRTUAL are exposed to userland as
.Pa /dev/gpiocN ,
where N is 0-3.
thj updated this revision to Diff 35385.Nov 17 2017, 6:48 PM

Remove #if 0'd code.

Update chvgpio.4 based on comments.

thj marked 4 inline comments as done.Nov 17 2017, 6:49 PM
wblock added inline comments.Nov 17 2017, 7:50 PM
share/man/man4/chvgpio.4
41 ↗(On Diff #35385)

This still needs a "The" at the beginning of the sentence.

The Cherry View SoC has 5 banks of GPIO pins, NORTH, EAST, SOUTHEAST, SOUTHWEST and
thj updated this revision to Diff 35389.Nov 17 2017, 8:11 PM

Add leading 'The'

thj marked an inline comment as done.Nov 17 2017, 8:12 PM
thj added a reviewer: gavin.Nov 29 2017, 11:47 AM
gonzo accepted this revision.Dec 5 2017, 12:30 AM

Code part looks good to me

This revision is now accepted and ready to land.Dec 5 2017, 12:30 AM
This revision was automatically updated to reflect the committed changes.