public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Labelling GPIOs for sysfs access?
@ 2016-02-25 20:47 Stuart Longland
  0 siblings, 0 replies; only message in thread
From: Stuart Longland @ 2016-02-25 20:47 UTC (permalink / raw)
  To: linux-kernel

Hi all,

I've been porting the mainline Linux kernel to the Technologic Systems
TS-7670 industrial computers which are based on the Freescale i.MX286 SoC.

I've had to make a couple of hacks to get things working, my code is at
https://github.com/vrtsystems/linux/tree/ts7670-4.4.1

Right now, there's a couple of GPIO lines for controlling power to
things like RS-232 and CANBus transceivers.  The RS-485 port on these
devices also has a couple of pins that are connected to a CPU-controlled
MOSFET to allow turning an external device on/off.

Previously I used the generic GPIO sysfs interface.  This worked well,
but the names suddenly changed on me and so now my scripts don't work.
It's also not that user friendly.

Implementing a kernel driver is doable, but all I'm doing is just
repeating work that the sysfs GPIO interface does already.  Currently
I'm doing it with the "LEDs" framework, since they'll have a consistent
name -- users can for example, turn the RS-232 transceivers off by
setting /sys/class/leds/rs232_en/brightness to 0.  It's controlled by
device tree.

(Better in the case of RS-232, would be to have the port automatically
turn the transceivers on.  I managed to get the CANBus side to do that.)

Is there some sort of mechanism by which GPIO lines could be clearly
labelled to present a consistent interface in sysfs between kernel
revisions?

Regards,
-- 
     _ ___             Stuart Longland - Systems Engineer
\  /|_) |                           T: +61 7 3535 9619
 \/ | \ |     38b Douglas Street    F: +61 7 3535 9699
   SYSTEMS    Milton QLD 4064       http://www.vrt.com.au

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-02-25 20:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-25 20:47 Labelling GPIOs for sysfs access? Stuart Longland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox