Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp204914pjb; Thu, 16 Jul 2020 11:58:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5OY15Fl20yb0wbpq4asXBZwQflVWSJdP7C5Lc1kYmm/mUfI116U1iLA+3tD3z9//jkkyj X-Received: by 2002:a17:906:488:: with SMTP id f8mr4963078eja.215.1594925910088; Thu, 16 Jul 2020 11:58:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594925910; cv=none; d=google.com; s=arc-20160816; b=xk8j//2oHKpK2cL+pisrPHttl4gTMGeMhVHyeJgiZEKUIIkEXlHo3MzaT0FermJWU3 /1/cK+ERgBGm3SUTYUgkJZGmi2Zo8sNspiR7dJ/lUFxqt6cJwZzm0Aamri8hTmaXG41X y7h8t3R9SxxlPIJPZCjXBmfk9NySk7rOGsQsGoKvvV6Jhr6neIRNW5wvgazsvtcIXgWa OYz/voNYBFkluctN2nXj8iOlLJhaLH5nZFvnsFFjVBHn+LBqgPH16l1yG6wHIEbII4gD JeykdbXPA0dDMOFxQtkuxUROjwLBkFI5hgu9ijrqpjXfzrkdY8qPEAmA4j0aQh5Q65G8 gdDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=IMuLih2JdGN1HcEyWX3xxgq6efxkCqKGfdgqLRgDRgM=; b=os190/PXURXnDFit1Ymr/9c9PQIQ/QUNFh3Q9xYFTaWCx4B9mTb+1EM9IkI+SMN5MG K/6LNWRb2/knD8LK2hhbcWAQejXwzlN/SfV1xiB46KmjTU1wWcz/D3Fy7x0oyIaDKFx4 12qLEXO8b2bEH845SRUqtB0C5vbnWjT6/ZpJeF4Pyy7RdTJRpJrk7QSWCsRgFcgcPnjt mD5KXkwJMbStK1Ycw/MI3kQ5+WR06+IdMnRQfJDeYvFMckKmmhuM0oE0tpeYOUytQJ7T s8xBLTKZSSPqszp4PAHWwVZgWvIW1U/qQHYVHvqsWjvm1Cez5s3z6Hd8wfa+Jc8+Xerk hggg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dh2si3642252edb.55.2020.07.16.11.58.06; Thu, 16 Jul 2020 11:58:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729458AbgGPS5D (ORCPT + 99 others); Thu, 16 Jul 2020 14:57:03 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:39326 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728163AbgGPS5D (ORCPT ); Thu, 16 Jul 2020 14:57:03 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1jw93n-005UW2-Ba; Thu, 16 Jul 2020 20:56:47 +0200 Date: Thu, 16 Jul 2020 20:56:47 +0200 From: Andrew Lunn To: Marek =?iso-8859-1?Q?Beh=FAn?= Cc: linux-leds@vger.kernel.org, Pavel Machek , jacek.anaszewski@gmail.com, Dan Murphy , =?utf-8?Q?Ond=C5=99ej?= Jirman , netdev@vger.kernel.org, Russell King , Thomas Petazzoni , Gregory Clement , linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC leds + net-next 0/3] Add support for LEDs on Marvell PHYs Message-ID: <20200716185647.GA1308244@lunn.ch> References: <20200716171730.13227-1-marek.behun@nic.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200716171730.13227-1-marek.behun@nic.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 16, 2020 at 07:17:27PM +0200, Marek Beh?n wrote: > Hello, > > this RFC series should apply on both net-next/master and Pavel's > linux-leds/for-master tree. > > This adds support for LED's connected to some Marvell PHYs. > > LEDs are specified via device-tree. Example: Hi Marek I've been playing with something similar, off and on, mostly off. Take a look at https://github.com/lunn/linux v5.4-rc6-hw-led-triggers The binding i have is pretty much the same, since we are both following the common LED binding. I see no problems with this. > This is achieved by extending the LED trigger API with LED-private triggers. > The proposal for this is based on work by Ondrej and Pavel. So what i did here was allow triggers to be registered against a specific LED. The /sys/class/leds//trigger lists both the generic triggers and the triggers for this specific LED. Phylib can then register a trigger for each blink reason that specific LED can perform. Which does result in a lot of triggers. Especially when you start talking about a 10 port switch each with 2 LEDs. I still have some open issues... 1) Polarity. It would be nice to be able to configure the polarity of the LED in the bindings. 2) PHY LEDs which are not actually part of the PHY. Most of the Marvell Ethernet switches have inbuilt PHYs, which are driven by the Marvell PHY driver. The Marvell PHY driver has no idea the PHY is inside a switch, it is just a PHY. However, the LEDs are not controlled via PHY registers, but Switch registers. So the switch driver is going to end up controlling these LEDs. It would be good to be able to share as much code as possible, keep the naming consistent, and keep the user API the same. 3) Some PHYs cannot control the LEDs independently. Or they have modes which configure two or more LEDs. The Marvell PHYs are like this. There are something like ~10 blink modes which are independent. And then there are 4 modes which control multiple LEDs. There is no simple way to support this with Linux LEDs which assume the LEDs are fully independent. I suspect we simply cannot support these combined modes. As a PHY maintainer, i would like to see a solution which makes use of Linux LEDs. I don't really care who's code it is, and feel free to borrow my code, or ideas, or ignore it. Andrew