From patchwork Mon Apr 17 15:17:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13214209 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02872C77B76 for ; Mon, 17 Apr 2023 15:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=DcctpmzIPtcKTOR9u3gJt+CxSAdBOCTxR022zTM/zqE=; b=nIyxDA9zlMG/I/ XMZ00jc0bB/DfoHYh4WkKTMccN9KksRPtJnE7oOgMe/sRZ1/sFtoBqBK1Hl0LEsX07ZJk19azvCZW L+SimQt9VaykLBTmAkvxmAk0SOyunhdllh3cl1gWD+6hEcothUikkXADDnA8Wo9MGcv3FZCafDnRO lwK+u6IGtrscV/C5b1nLEK8RGyHqcGeWqDrcRy0gbf//in7gLzeZ2q8jA+0Wztm2pc5gnuz/IG9G7 bf6zqsACIQHePKhXAUhzAr1jlnOo7o5gXqrEQ5MlowERXxWf4VQ8eEhFItXUN6GEklBzPnXapt3jS EB0zMnK1dzyenTIi9dQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1poQce-00GopE-0w; Mon, 17 Apr 2023 15:18:28 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1poQca-00Golh-2J for linux-arm-kernel@lists.infradead.org; Mon, 17 Apr 2023 15:18:26 +0000 Received: by mail-wm1-x329.google.com with SMTP id gw13so13984701wmb.3 for ; Mon, 17 Apr 2023 08:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681744694; x=1684336694; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=qYoLkAi32c0QgUmNBUHQGkHOtl/1ZnVGsu8NcSiTDC0=; b=KU3nXxB49MYxz6NPA6RChKt0/r7MfQr+owE3HJ2HUDtudOazz5mWdTxNU3VIul2sIP s30hOgiERyHsqmHenUT/fxUP8dYfpEZvcdPlV/odSBlpTHssPDnVOYFXy/0Zse2ieg/l hzyfMhRHI0mRdKpZj9r59lkjatKQQS06Xlt0PT8AX/P+CGVlIj6Vzl9Zu4/0/gTA1wpH iknFFf4MZ9QFXyQU/gcomdFNBW3nrv+ljpV2r0UOovcbBjASKvLeCMb6Kko7DkV1lvz4 mQSWj25BBl1T0WUuDj/v+fk3bKq73KqM45gOhCqpTLABAyimBUJVwXh8uuYWoOwLuUBu Y3cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681744694; x=1684336694; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qYoLkAi32c0QgUmNBUHQGkHOtl/1ZnVGsu8NcSiTDC0=; b=fakMGAXMhdLjTPaKZOWy/TyXWRjq+3CSR8nBvMzpugA1KtROCkYqPqQUzk62lPX/VF FmhDSXiRxDHKsSL1B4KeBBxIzT43KQUynZE/XqEfurPo1jIRm17TNzip3S1EBf62N3S8 9727+b0uTo1BYGOg+i8TnjUXjcPwAyGs0DffivQ68WdQVBFKaY5RqAreIzTH/n2WKKvx qbRedvckWzItsbM25M2TxjhQhapoiKds6jT+sU7BPQYIcXHY84dD2+Vl5qSFkM0gRayB q1WahrPw4v45XJpuyNsx4mtUpdCQroeUUgRbVNjiML39HG+ZfyeiPb9d+6BrM7hHtyQy g3lw== X-Gm-Message-State: AAQBX9cGh5Ud8haiSukKn67FyJadnG80Bdu6WiVWWJ33VgkORBcChpYk okz/GkUBsGZGUrML5KDczrA= X-Google-Smtp-Source: AKy350bqfgW5MuYrODX3oNWNi2JBQz51Xhd0/GLp2GsfxPJsPGIm0F2KWnJCW5PfzVaClkDWDx64uA== X-Received: by 2002:a05:600c:2105:b0:3f1:7581:bba3 with SMTP id u5-20020a05600c210500b003f17581bba3mr1699114wml.10.1681744694207; Mon, 17 Apr 2023 08:18:14 -0700 (PDT) Received: from localhost.localdomain (host-87-7-13-196.retail.telecomitalia.it. [87.7.13.196]) by smtp.googlemail.com with ESMTPSA id j15-20020a05600c1c0f00b003f173be2ccfsm3501354wms.2.2023.04.17.08.17.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 08:17:52 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Jonathan Corbet , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Pavel Machek , Lee Jones , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-leds@vger.kernel.org Subject: [net-next PATCH v7 00/16] net: Add basic LED support for switch/phy Date: Mon, 17 Apr 2023 17:17:22 +0200 Message-Id: <20230417151738.19426-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230417_081824_756433_1DDE5393 X-CRM114-Status: GOOD ( 26.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This is a continue of [1]. It was decided to take a more gradual approach to implement LEDs support for switch and phy starting with basic support and then implementing the hw control part when we have all the prereq done. This series implements only the brightness_set() and blink_set() ops. An example of switch implementation is done with qca8k. For PHY a more generic approach is used with implementing the LED support in PHY core and with the user (in this case marvell) adding all the required functions. Currently we set the default-state as "keep" to not change the default configuration of the declared LEDs since almost every switch have a default configuration. [1] https://lore.kernel.org/lkml/20230216013230.22978-1-ansuelsmth@gmail.com/ Changes in new series v7: - Drop ethernet-leds schema and add unevaluatedProperties to ethernet-controller and ethernet-phy schema - Drop function-enumerator binding from schema example and DT - Set devname_mandatory for qca8k leds and assign better name to LEDs using the format {slave_mii_bus id}:0{port number}:{color}:{function} - Add Documentation patch for Correct LEDs naming from Andrew - Changes in Andrew patch: - net: phy: Add a binding for PHY LEDs - Convert index from u32 to u8 - net: phy: phy_device: Call into the PHY driver to set LED brightness - Fixup kernel doc - Convert index from u32 to u8 - net: phy: marvell: Add software control of the LEDs - Convert index from u32 to u8 - net: phy: phy_device: Call into the PHY driver to set LED blinking - Kernel doc fix - Convert index from u32 to u8 - net: phy: marvell: Implement led_blink_set() - Convert index from u32 to u8 Changes in new series v6: - Add leds-ethernet.yaml to document reg in led node - Update ethernet-controller and ethernet-phy to follow new leds-ethernet schema - Fix comments in qca8k-leds.c (at least -> at most) (wrong GENMASK for led phy 0 and 4) - Add review and ack tag from Pavel Machek - Changes in Andrew patch: - leds: Provide stubs for when CLASS_LED & NEW_LEDS are disabled - Change LED_CLASS to NEW_LEDS for led_init_default_state_get() - net: phy: Add a binding for PHY LEDs - Add dependency on LED_CLASS - Drop review tag from Michal Kubiak (patch modified) Changes in new series v5: - Rebase everything on top of net-next/main - Add more info on LED probe fail for qca8k - Drop some additional raw number and move to define in qca8k header - Add additional info on LED mapping on qca8k regs - Checks port number in qca8k switch port parse - Changes in Andrew patch: - Add additional patch for stubs when CLASS_LED disabled - Drop CLASS_LED dependency for PHYLIB (to fix kbot errors reported) Changes in new series v4: - Changes in Andrew patch: - net: phy: Add a binding for PHY LEDs: - Rename phy_led: led_list to list - Rename phy_device: led_list to leds - Remove phy_leds_remove() since devm_ should do what is needed - Fixup documentation for struct phy_led - Fail probe on LED errors - net: phy: phy_device: Call into the PHY driver to set LED brightness - Moved phy_led::phydev from previous patch to here since it is first used here. - net: phy: marvell: Implement led_blink_set() - Use int instead of unsigned - net: phy: marvell: Add software control of the LEDs - Use int instead of unsigned - Add depends on LED_CLASS for qca8k Kconfig - Fix Makefile for qca8k as suggested - Move qca8k_setup_led_ctrl to separate header - Move Documentation from dsa-port to ethernet-controller - Drop trailing . from Andrew patch fro consistency Changes in new series v3: - Move QCA8K_LEDS Kconfig option from tristate to bool - Use new helper led_init_default_state_get for default-state in qca8k - Drop cled_qca8k_brightness_get() as there isn't a good way to describe the mode the led is currently in - Rework qca8k_led_brightness_get() to return true only when LED is set to always ON Changes in new series v2: - Add LEDs node for rb3011 - Fix rb3011 switch node unevaluated properties while running make dtbs_check - Fix a copypaste error in qca8k-leds.c for port 4 required shift - Drop phy-handle usage for qca8k and use qca8k_port_to_phy() - Add review tag from Andrew - Add Christian Marangi SOB in each Andrew patch - Add extra description for dsa-port stressing that PHY have no access and LED are controlled by the related MAC - Add missing additionalProperties for dsa-port.yaml and ethernet-phy.yaml Changes from the old v8 series: - Drop linux,default-trigger set to netdev. - Dropped every hw control related patch and implement only blink_set and brightness_set - Add default-state to "keep" for each LED node example Andrew Lunn (8): leds: Provide stubs for when CLASS_LED & NEW_LEDS are disabled net: phy: Add a binding for PHY LEDs net: phy: phy_device: Call into the PHY driver to set LED brightness net: phy: marvell: Add software control of the LEDs net: phy: phy_device: Call into the PHY driver to set LED blinking net: phy: marvell: Implement led_blink_set() arm: mvebu: dt: Add PHY LED support for 370-rd WAN port Documentation: LEDs: Describe good names for network LEDs Christian Marangi (8): net: dsa: qca8k: move qca8k_port_to_phy() to header net: dsa: qca8k: add LEDs basic support net: dsa: qca8k: add LEDs blink_set() support dt-bindings: net: ethernet-controller: Document support for LEDs node dt-bindings: net: dsa: qca8k: add LEDs definition example ARM: dts: qcom: ipq8064-rb3011: Drop unevaluated properties in switch nodes ARM: dts: qcom: ipq8064-rb3011: Add Switch LED for each port dt-bindings: net: phy: Document support for LEDs node .../devicetree/bindings/net/dsa/qca8k.yaml | 22 ++ .../bindings/net/ethernet-controller.yaml | 35 +++ .../devicetree/bindings/net/ethernet-phy.yaml | 43 +++ Documentation/leds/well-known-leds.txt | 30 ++ arch/arm/boot/dts/armada-370-rd.dts | 12 + arch/arm/boot/dts/qcom-ipq8064-rb3011.dts | 124 +++++++- drivers/net/dsa/qca/Kconfig | 8 + drivers/net/dsa/qca/Makefile | 3 + drivers/net/dsa/qca/qca8k-8xxx.c | 20 +- drivers/net/dsa/qca/qca8k-leds.c | 277 ++++++++++++++++++ drivers/net/dsa/qca/qca8k.h | 74 +++++ drivers/net/dsa/qca/qca8k_leds.h | 16 + drivers/net/phy/Kconfig | 1 + drivers/net/phy/marvell.c | 81 ++++- drivers/net/phy/phy_device.c | 103 +++++++ include/linux/leds.h | 18 ++ include/linux/phy.h | 41 +++ 17 files changed, 884 insertions(+), 24 deletions(-) create mode 100644 drivers/net/dsa/qca/qca8k-leds.c create mode 100644 drivers/net/dsa/qca/qca8k_leds.h