From owner-freebsd-hackers@freebsd.org Sat Nov 23 14:38:21 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7045A1B72AD for ; Sat, 23 Nov 2019 14:38:21 +0000 (UTC) (envelope-from freebsd-hackers@dino.sk) Received: from mailhost.netlabit.sk (mailhost.netlabit.sk [84.245.65.72]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47Kwrr0cL8z47Md for ; Sat, 23 Nov 2019 14:38:19 +0000 (UTC) (envelope-from freebsd-hackers@dino.sk) Received: from zeta.dino.sk (fw3.dino.sk [84.245.95.254]) (AUTH: LOGIN milan) by mailhost.netlabit.sk with ESMTPA; Sat, 23 Nov 2019 15:38:15 +0100 id 00F3A934.5DD94457.00008F89 Date: Sat, 23 Nov 2019 15:38:14 +0100 From: Milan Obuch To: freebsd-hackers@freebsd.org Subject: Where is GPIO pin name stored? Message-ID: <20191123153814.13a29e20@zeta.dino.sk> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i386-portbld-freebsd11.3) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47Kwrr0cL8z47Md X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd-hackers@dino.sk designates 84.245.65.72 as permitted sender) smtp.mailfrom=freebsd-hackers@dino.sk X-Spamd-Result: default: False [-4.09 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[dino.sk]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_TLS_LAST(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[72.65.245.84.list.dnswl.org : 127.0.10.0]; IP_SCORE(-2.79)[ip: (-7.85), ipnet: 84.245.64.0/18(-3.93), asn: 16160(-2.28), country: SK(0.09)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:16160, ipnet:84.245.64.0/18, country:SK]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 14:38:21 -0000 Hi, gpio controller has a device method, gpio_pin_getname, which sets name for any gpio pin this driver controlls. It is possible, however, to change this name with gpioctl invoked as gpioctl [ -f /dev/gpiocX ] -n and in gpio pin listing this new name is used subsequently. Where is this name stored? Is it possible to get this new, changed name somehow from driver programatically? I found the way it is done in gpioctl, but this is from upper layer (related to gpiobus - in sys/dev/gpio/gpiobus.c). I need it from lower layer. Looking in sys/dev/gpio/gpiobusvar.h, I think I need access to gpiobus_softc related to my gpio controller device... Use case: I implemented interrupt driver for my AXI GPIO core device. It does nothing special, just prints a line similar to gpio4: btns0 status 1 on console, in this case, when first button gets pressed. This could be changed to create a devd event so one could easily attach some event handling script via some /etc/devd.conf entry. It would be good to see this new name here as well. Regards, Milan