From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751596AbcBYU42 (ORCPT ); Thu, 25 Feb 2016 15:56:28 -0500 Received: from bne-eth.vrt.com.au ([103.225.70.82]:40410 "EHLO bne.vrt.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751243AbcBYU41 (ORCPT ); Thu, 25 Feb 2016 15:56:27 -0500 X-Greylist: delayed 497 seconds by postgrey-1.27 at vger.kernel.org; Thu, 25 Feb 2016 15:56:26 EST To: linux-kernel@vger.kernel.org From: Stuart Longland Subject: Labelling GPIOs for sysfs access? Openpgp: id=9804EB67F91461DE967DA1B04DFA191410BDE3B7; url=http://stuartl.longlandclan.yi.org/key.asc X-Enigmail-Draft-Status: N1110 Organization: VRT Systems Message-ID: <56CF6844.2070802@vrt.com.au> Date: Fri, 26 Feb 2016 06:47:00 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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