public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stuart Longland <stuartl@vrt.com.au>
To: linux-kernel@vger.kernel.org
Subject: Labelling GPIOs for sysfs access?
Date: Fri, 26 Feb 2016 06:47:00 +1000	[thread overview]
Message-ID: <56CF6844.2070802@vrt.com.au> (raw)

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

                 reply	other threads:[~2016-02-25 20:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56CF6844.2070802@vrt.com.au \
    --to=stuartl@vrt.com.au \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox