Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp4826307rwj; Tue, 20 Dec 2022 15:49:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXu8FUn1HBBmmN4+KBp19GAT+VJiL2kzuAIP0yFSXmyzIbb2pAwaOA/1+XwLrtu5nKDV7fNf X-Received: by 2002:a05:6a20:d68f:b0:9d:efbf:48e7 with SMTP id it15-20020a056a20d68f00b0009defbf48e7mr87644pzb.43.1671580179607; Tue, 20 Dec 2022 15:49:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671580179; cv=none; d=google.com; s=arc-20160816; b=HcN8A5vBn4pyikXJD5rRe0PGwcUVd4M/4yj3UrUBGtQDxAZl8NHBjEA8jwgb2elPEH UI3v8CNTebs6orvZc1NQzMtWxdF+ybFE8rGxNOexq9+2wBVecFSXC+n45RiVb2fdek4V VUl+NF6uYWOlimkEhVCwZDyaEy9d7TDMxrHP6Uu1mRIPtV0tDNMr38FDUUlt9/F86Y5H fDp4HfzhGH/iKkjEcJ6tS+qiDnZ2GJpcVWI6NDdCwkJpueotdXUXj9yBg8dSCvTUkzRg 1dBJccu41Qpt4nXS5sV3Y/9/X4eQ3UOX9Vwc0a27v6rPnvlXJb4FmERF1fIeomSUJ/zS 8UNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=H+syPNoxSkSUhg/ESgG9XpHDiX6tgXxdYU9tU+g5JW4=; b=v/7KI7XWEi7ba6ZVSZifeXDm0/4XPnutsdpEUQLbDzNkuuCNCUa99NAfjAsam8OVix u7XkH7Mm0NnT5wocdB2UidXjNFyzIaDWsY21i3rdK8mpZmqtA7SxC2qtQJ9A//N0mh1N lBxhBOCqYaBm+WDZL5YmUTGaduDv/GOMAvcRffHYjEnzWyjSXYV7i68d5cAJD4EgO+BH 3DGpJ/fYWWOOVHz8rzoON5Ocsl6INW/Nq8zzp/LkhFoD2Ov8G/N+pcVujy5MQP/9r6JH gMHC+Gxe7t1uN69wscEK9lBgduK2A9wdib5YzG8eXXQj1D2UJH78QUygxKbjOgy7yXwA Hl/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=tljLNCO2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a170903240c00b001910b27870esi12160538plo.512.2022.12.20.15.49.30; Tue, 20 Dec 2022 15:49:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=tljLNCO2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234192AbiLTXLj (ORCPT + 68 others); Tue, 20 Dec 2022 18:11:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229756AbiLTXLg (ORCPT ); Tue, 20 Dec 2022 18:11:36 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 834E7BC2; Tue, 20 Dec 2022 15:11: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-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=H+syPNoxSkSUhg/ESgG9XpHDiX6tgXxdYU9tU+g5JW4=; b=tljLNCO2qtu4hke0pxGKosR0v+ 0dCr4/noa5t7/Jqg2s9PWmBO/7IcBx8UHnaGRckrcZmL6hTcT/a1GGTDNOhKHLALk43IJ5kTsTDcq NYQ+OHHlPluhTbiaG0JAjEHLZjO4+3G2uG8K5U6/MSSD/6q6zEkC7auF+COisq3ERzws=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1p7llS-00086B-33; Wed, 21 Dec 2022 00:11:14 +0100 Date: Wed, 21 Dec 2022 00:11:14 +0100 From: Andrew Lunn To: "Russell King (Oracle)" Cc: Christian Marangi , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , Pavel Machek , 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 10/11] net: dsa: qca8k: add LEDs support Message-ID: References: <20221214235438.30271-1-ansuelsmth@gmail.com> <20221214235438.30271-11-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > +qca8k_cled_trigger_offload(struct led_classdev *ldev, bool enable) > > +{ > > + struct qca8k_led *led = container_of(ldev, struct qca8k_led, cdev); > > + > > + struct qca8k_led_pattern_en reg_info; > > + struct qca8k_priv *priv = led->priv; > > + u32 val = QCA8K_LED_ALWAYS_OFF; > > + > > + qca8k_get_enable_led_reg(led->port_num, led->led_num, ®_info); > > + > > + if (enable) > > + val = QCA8K_LED_RULE_CONTROLLED; > > + > > + return regmap_update_bits(priv->regmap, reg_info.reg, > > + GENMASK(1, 0) << reg_info.shift, > > + val << reg_info.shift); > > 88e151x doesn't have the ability to change in this way - we have > a register with a 4-bit field which selects the LED mode from one > of many, or forces the LED on/off/hi-z/blink. > > Not specifically for this patch, but talking generally about this > approach, the other issue I forsee with this is that yes, 88e151x has > three LEDs, but the LED modes are also used to implement control > signals (e.g., on a SFP, LOS can be implemented by programming mode > 0 on LED2 (which makes it indicate link or not.) If we expose all the > LEDs we run the risk of the LED subsystem trampling over that > configuration and essentially messing up such modules. So the Marvell > PHY driver would need to know when it is appropriate to expose these > things to the LED subsystem. > > I guess doing it dependent on firmware description as you do in > this driver would work - if there's no firmware description, they're > not exposed. > I expect there will always be some sort of firmware involved, describing the hardware. Without that, we have no idea how many LEDs are actually connected to pins of the PHY, for example. I've not yet looked at this patchset in detail, but i hope the DT binding code is reusable, so all PHYs will have the same basic binding. Andrew