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=-8.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham 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 F330BC433E0 for ; Sat, 25 Jul 2020 09:37:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C34CB206EB for ; Sat, 25 Jul 2020 09:37:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726593AbgGYJhD convert rfc822-to-8bit (ORCPT ); Sat, 25 Jul 2020 05:37:03 -0400 Received: from lists.nic.cz ([217.31.204.67]:52132 "EHLO mail.nic.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726434AbgGYJhD (ORCPT ); Sat, 25 Jul 2020 05:37:03 -0400 Received: from localhost (unknown [IPv6:2a0e:b107:ae1:0:3e97:eff:fe61:c680]) by mail.nic.cz (Postfix) with ESMTPSA id 0DC9314095F; Sat, 25 Jul 2020 11:37:01 +0200 (CEST) Date: Sat, 25 Jul 2020 11:37:00 +0200 From: Marek Behun To: Pavel Machek Cc: netdev@vger.kernel.org, linux-leds@vger.kernel.org, jacek.anaszewski@gmail.com, Dan Murphy , =?UTF-8?B?T25k?= =?UTF-8?B?xZllag==?= Jirman , Russell King , Thomas Petazzoni , Gregory Clement , Andrew Lunn , linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC leds + net-next v3 1/2] net: phy: add API for LEDs controlled by PHY HW Message-ID: <20200725113700.7472dcd3@nic.cz> In-Reply-To: <20200725092124.GA29492@amd> References: <20200724164603.29148-1-marek.behun@nic.cz> <20200724164603.29148-2-marek.behun@nic.cz> <20200725092124.GA29492@amd> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Virus-Scanned: clamav-milter 0.102.2 at mail X-Virus-Status: Clean Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org On Sat, 25 Jul 2020 11:21:24 +0200 Pavel Machek wrote: > Hi! > > > Many PHYs support various HW control modes for LEDs connected directly > > to them. > > > > This code adds a new private LED trigger called phydev-hw-mode. When > > this trigger is enabled for a LED, the various HW control modes which > > the PHY supports for given LED can be get/set via hw_mode sysfs file. > > > > A PHY driver wishing to utilize this API needs to register the LEDs on > > its own and set the .trigger_type member of LED classdev to > > &phy_hw_led_trig_type. It also needs to implement the methods > > .led_iter_hw_mode, .led_set_hw_mode and .led_get_hw_mode in struct > > phydev. > > > > Signed-off-by: Marek BehĂșn > > Nothing too wrong. > > New sysfs file will require documentation. > > Plus I wonder: should we have single hw_mode file? It seems many > different "bits" fit inside. Would it be possible to split it further, > and have bits saying: > > "I want the LED to be on if link is 10Mbps". > "I want the LED to be on if link is 100Mbps". > "I want the LED to be on if link is 1000Mbps". > "I want the LED to blink on tx". > "I want the LED to blink on rx". > > ? I don't think this is possible. Only specific combinations are possible on Marvell PHYs. There is no HW control mode which would do, for example: - ON when linked to 100Mbps - BLINK when receive PHYs from other vendors can different mode sets. Marek > + { "1Gbps/100Mbps/10Mbps", { 0x2, -1, -1, -1, -1, > + { "1Gbps", { 0x7, -1, -1, -1, -1, > + { "100Mbps-fiber", { -1, 0x5, -1, -1, -1, > + { "100Mbps-10Mbps", { -1, 0x5, -1, -1, -1, > + { "1Gbps-100Mbps", { -1, 0x6, -1, -1, -1, > + { "1Gbps-10Mbps", { -1, -1, 0x6, 0x6, -1, > + { "100Mbps", { -1, 0x7, -1, -1, -1, > + { "10Mbps", { -1, -1, 0x7, -1, -1, > > Best regards, > Pavel >