From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C478CC43465 for ; Sun, 20 Sep 2020 09:59:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8FF0520866 for ; Sun, 20 Sep 2020 09:59:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726279AbgITJ71 (ORCPT ); Sun, 20 Sep 2020 05:59:27 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:40587 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726247AbgITJ71 (ORCPT ); Sun, 20 Sep 2020 05:59:27 -0400 Received: from desktop ([188.192.134.246]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N6KMR-1kZFwJ0L2f-016c45; Sun, 20 Sep 2020 11:59:22 +0200 From: "Adrian Schmutzler" To: "'Marek Behun'" Cc: References: <20200919192427.57033-1-freifunk@adrianschmutzler.de> <20200919223134.2371459c@nic.cz> <00b201d68ecd$8af46280$a0dd2780$@adrianschmutzler.de> <20200920002846.22a76e03@nic.cz> <00da01d68ed9$f967dfb0$ec379f10$@adrianschmutzler.de> <20200920020631.4d36b035@nic.cz> In-Reply-To: <20200920020631.4d36b035@nic.cz> Subject: RE: [PATCH v2 1/2] dt-bindings: leds: add LED_FUNCTION for wlan2g/wlan5g Date: Sun, 20 Sep 2020 11:59:21 +0200 Message-ID: <007001d68f34$b6bded20$2439c760$@adrianschmutzler.de> X-Mailer: Microsoft Outlook 15.0 MIME-Version: 1.0 Thread-Index: AQGSFnMYjThUUuTHNtoSB0At7TLDoAHNC5PSAQ0vuisBgw+zogG2Y78GANk1+gqpwtHd0A== Content-Language: de Content-Type: multipart/signed; boundary="=-=5lIhAUx7qlRoBM=-="; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Provags-ID: V03:K1:93Uu3zCZFTwZJMDrFIXVVj5ROA1QNviHbJCvDIC3V/qLZnFiIhh zz/MUCaghZOIwliEBCfgrxp0/+OY0/O4ObBRA4e3lURt4Y7zuoRXBp8fBdhCbEtEE5Wp+lw 0GiEJl5hkaDf7l6RXVdYEszM28k5/OYJdcZ35HrxdZZO8O/+pHllZzFaQMOWc3okiBivTdW /ofr+E6htAxuk71sCx+Bw== X-UI-Out-Filterresults: notjunk:1;V03:K0:1x3O5uZjzHM=:gLFC1rXm8uiOfXTpyTZQUl kDunW+asjMQFraMhMbEikMm+xmOt8xNfkbCy82yVqpKjUrePXPY/gClKcCommN9/ihn/FHTsN vQrU6IRULL9/kxJJU6CwOgc3FkLG6Yq3GFEck5qd5Qhs9Kjf5gHCOK5blyA64Vx1S2lMJ18ul 1k6o2H4wrX2Dc/VyEmUD/r5ThIC3Beq80D8OFpHIramPlem7aBTFURMhi5O3VEaNot159dTbU BJk7r+Ww/by2pKKVAPpbhp+X6Q9dsA1gNW9AoJSrzoW9n4tdpl2XjTq5Rd+PsF8kfA2Z3acIq SZ8BKNLhnP31E8kkNWoMgZbeGeCRRR8T2Xxf4Sy20f2tIis/RunDZ6FoxTsB4Qp14sHn2YvWf 0GnaYH9EbGnA6PYN11BFZzZBqlQ1cELfwC03j0ILsOJ+IwaJMS84VbbETXZ0x8vutdK95qbAn TO8B9kF2oh7yzjAz3QQnt0xqcdbab/U+q7U31oNdhgCx/s3sp5MBzOxbpZ7yX7FzLBWPqM+2a oBwuUVKS7GcaIYRK/69uG0+VkOY0fpyIVOMgPnIgzOQ9D8Cy1DtoeyXfwBW827GHu7ZBxgv3j 9zNvgYf7MytcHgTTrHUlIF1wElx2pElEhXMotMlVy7EZAAX17Cb/6u2PoxZSeCX7vjDj3orw/ ZifXDaVVJBD0C2S8IFHRJlC9Bs3BSJ/5y+7U84t4n/dz0syuNLhPh4jIIeYvxpCE71klnJIjs 8IniLvAAUvsd6PF0iv56+hZk/mS2TDGkwhyw/fa5Qv+LjDY2WhnjWEVrh/BvbSnnW2Jnvhj1C MD3HsBOy0/QZk+9ecrEs1+DurPXlL43An7zp6muOfLpdUtyDgkwxqfAkAQ8BgUEzkJ/4O30 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org This is a multipart message in MIME format. --=-=5lIhAUx7qlRoBM=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Marek Behun [mailto:marek.behun@nic.cz] > Sent: Sonntag, 20. September 2020 02:07 > To: Adrian Schmutzler > Cc: linux-leds@vger.kernel.org > Subject: Re: [PATCH v2 1/2] dt-bindings: leds: add LED_FUNCTION for > wlan2g/wlan5g >=20 > On Sun, 20 Sep 2020 01:09:49 +0200 > "Adrian Schmutzler" wrote: >=20 > > > > As far as I understand it, the color/function system does not > > > > provide a > > > comparable lever, as the final name is only constructed in led-core.c? > > > > > > > > > > The files in /sys/class/leds/ are symlinks. The actual files are in > > > /sys/devices/ somewhere. If you know the path of your LED in the > > > device hierarchy, you can find it that way. If your script can > > > access the LED by reading device-tree, you can implement your script > > > so that you can find the LED in the hiearchy in /sys/devices/ (or > > > simply byt reading where do the symlinks in /sys/class/leds/ point to= ). > > > > Thanks for that pointer; unfortunately though, I was only able to retri= eve > lists of leds in [device:]color:function syntax and lists of the DT nodes= , but > nothing where a single node from DT is linked or can be related to just o= ne of > the [device:]color:function identifiers. > > > > Best > > > > Adrian > > >=20 > Which driver is this? Normally there is of_node symlink in sysfs device > directory... This is ath79 target on OpenWrt master. I have an of_node symlink for the p= arent "leds" node, but not for the individual leds: root@OpenWrt:~# ls /sys/devices/ pci0000:00/ platform/ system/ virtual/ root@OpenWrt:~# ls /sys/devices/platform/ Fixed MDIO bus.0/ gpio-export/ reg-dummy/ uevent ahb/ keys/ regulatory.0/ usb-phy/ ath9k-leds/ leds/ serial8250/ root@OpenWrt:~# ls /sys/devices/platform/leds/ driver/ leds/ of_node/ uevent driver_override modalias subsystem/ root@OpenWrt:~# ls /sys/devices/platform/leds/leds/ green:status green:usb green:usb_1 green:wlan-1 green:wps root@OpenWrt:~# ls /sys/devices/platform/leds/leds/green\:status/ brightness device max_brightness subsystem trigger = uevent root@OpenWrt:~# cat /sys/devices/platform/leds/leds/green\:status/uevent OF_NAME=3Dsystem OF_FULLNAME=3D/leds/system OF_COMPATIBLE_N=3D0 root@OpenWrt:~# ls /sys/devices/platform/leds/of_node/ compatible name qss system usb1 usb2 wla= n2g root@OpenWrt:~# ls /sys/devices/platform/leds/of_node/system/ color default-state function gpios name In the meantime I found the reference in uevent above, but that's not reall= y convenient. I don't think we do anything special about leds here. The target has CONFIG= _LEDS_GPIO=3Dy set in config. Kernel 5.4.66. The configuration looks like this (enumerator on wlan2g was for testing onl= y; there is a separate ath9k-leds node which I ignored for this discussion): / { aliases { led-boot =3D &led_system; led-failsafe =3D &led_system; led-running =3D &led_system; led-upgrade =3D &led_system; }; leds { compatible =3D "gpio-leds"; wlan2g { function =3D LED_FUNCTION_WLAN; function-enumerator =3D <1>; color =3D ; gpios =3D <&gpio 13 GPIO_ACTIVE_LOW>; linux,default-trigger =3D "phy0tpt"; }; led_system: system { function =3D LED_FUNCTION_STATUS; color =3D ; gpios =3D <&gpio 14 GPIO_ACTIVE_LOW>; default-state =3D "on"; }; qss { label =3D "tp-link:green:qss"; function =3D LED_FUNCTION_WPS; color =3D ; gpios =3D <&gpio 15 GPIO_ACTIVE_LOW>; }; usb1 { function =3D LED_FUNCTION_USB; color =3D ; gpios =3D <&gpio 11 GPIO_ACTIVE_LOW>; trigger-sources =3D <&hub_port1>; linux,default-trigger =3D "usbport"; }; usb2 { function =3D LED_FUNCTION_USB; color =3D ; gpios =3D <&gpio 12 GPIO_ACTIVE_LOW>; trigger-sources =3D <&hub_port2>; linux,default-trigger =3D "usbport"; }; }; }; While I hacked together an ugly solution to exploit uevent (with recursive = grep ...), I'd really prefer a more convenient option so the "new" concept = doesn't turn into a drawback from the start. Thanks for your help so far! Best Adrian --=-=5lIhAUx7qlRoBM=-= Content-Type: application/pgp-signature; name="openpgp-digital-signature.asc" Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEESgN6p2H3WoMOAf81oNyKO7qxAnAFAl9nJ/MACgkQoNyKO7qx AnAfgQ//aF9PMvtlnMgy1fQ7Y0uGURcpca2X284N53gnAQq4K6Ypl3lBhwMuZ7bu iNbDv1TxcdtuKJ+F9K7iIPD4/miZ+Q/mXqZV7wtbzToY+nnBKADTwRmD/TEnKyJc 6dIcxd73q3T+64aB4B56STXhnsBYKN61QIcFd4r6SCgKqjBy9P5xD2bVZmDGNno2 spR4Fv7tPnvGqgnwmqkeMHAm6/tgcU9svq9zfLBco6M1mlBmqh3J6El6DddwwQQA ATw0pOaYCtG9oObr270/kOMZ/24YPTaS7Fka8hGAB1j+jGj0iy+FbJeTxv7WNZgQ TcXgIkaSizWFH4omahsKftw58Zmk7yZXqlrLCgUV5alXCPs+Z1DbWXtqkuBMf7Oj ONiNZx+g/5knruklZoL9t4oeieVtXRMF079/bPOgrt71ryNZiv5zjYhT2QEDdXAQ fsFBoh5Gd5ncMcIVZMoxo28i0dGHybg9Yy95bROX1yGC5TSHaVQpa6r9Lm88Drip nQsrb8nG2RKcvPAu3TGXfL+WVRCLyxrfMOiBeY4M8Tyvhh00b1nzBAKVw4upRxVk SQX8Ey4UGKboNi5AOhcP2gWnfEvInf+33N2BHQSuhZTdB1oeS/dwA1YZgXp9t/i1 9TpFaB74KdLJ5ZrjGTbP7SONXItq2k37Q/0hYoVhk6cddSN578Q= =Q2wW -----END PGP SIGNATURE----- --=-=5lIhAUx7qlRoBM=-=--