Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37620C636D0 for ; Sun, 29 Jan 2023 22:02:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235359AbjA2WCi (ORCPT ); Sun, 29 Jan 2023 17:02:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235341AbjA2WCg (ORCPT ); Sun, 29 Jan 2023 17:02:36 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E7B51BD8; Sun, 29 Jan 2023 14:02:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=2VZqotSR2lcZ3Dqkc+ZPLDnCbVMn7GmMbsJnsslN+nA=; b=QG Mef1rPPK4SyrXTuHq3+GPkt5WTiWRS13HdWbmvwL9QoPD43ZWNXw5N9nCiKx1VWDptux1FNnaoqjJ PbWlhmo+zcFqlzWY+GR54vFg4EfZTNa9PVMP6/h6q0BgRM4Ko+DzeHYo/3utp7e6Glk8+r8CDuqKq aRI9TgjG5RoSRPo=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pMFkd-003WUU-Os; Sun, 29 Jan 2023 23:02:15 +0100 Date: Sun, 29 Jan 2023 23:02:15 +0100 From: Andrew Lunn To: Sander Vanheule Cc: Christian Marangi , Rob Herring , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Krzysztof Kozlowski , Jonathan Corbet , Pavel Machek , "Russell King (Oracle)" , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-leds@vger.kernel.org, Tim Harvey , Alexander Stein , Rasmus Villemoes Subject: Re: [PATCH v7 11/11] dt-bindings: net: dsa: qca8k: add LEDs definition example Message-ID: References: <20221214235438.30271-1-ansuelsmth@gmail.com> <20221214235438.30271-12-ansuelsmth@gmail.com> <20221220173958.GA784285-robh@kernel.org> <63a30221.050a0220.16e5f.653a@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > This is an example of the dt implemented on a real device. > > > > ????????????????mdio { > > ????????????????????????#address-cells = <1>; > > ????????????????????????#size-cells = <0>; > > > > ????????????????????????phy_port1: phy@0 { > > ????????????????????????????????reg = <0>; > > > > ????????????????????????????????leds { > > ????????????????????????????????????????#address-cells = <1>; > > ????????????????????????????????????????#size-cells = <0>; > [...] > > ????????????????????????????????}; > > ????????????????????????}; > [...] > > ????????????????}; > > > > In the following implementation. Each port have 2 leds attached (out of > > 3) one white and one amber. The driver parse the reg and calculate the > > offset to set the correct option with the regs by also checking the phy > > number. > > With switch silicon allowing user control of the LEDs, vendors can (and will) > use the switch's LED peripheral to drive other LEDs (or worse). E.g. on a Cisco > SG220-26 switch, using a Realtek RTL8382 SoC, the LEDs associated with some > unused switch ports are used to display a global device status. My concern here > is that one would have to specify switch ports, that aren't connected to > anything, just to describe those non-ethernet LEDs. Note that the binding is adding properties to the PHY nodes, not the switch port nodes. Is this how the RTL8382 works? Marvell Switches have LED registers which are not in the PHY register space. But the point is, the PHYs will probe if listed. They don't have to have a MAC pointing to them with a phandle. So the phydev will exist, and that should be enough to get the LED class device registered. If there is basic on/off support, that should be enough for you to attach the Morse code panic trigger, the heartbeat handler, or any other LED trigger. Andrew