Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4573255pxb; Thu, 14 Oct 2021 07:53:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv75SmVwPuKn0jrPFQ2/gUQUPO3m5ODqhiPkzYwEqxozaFF8cldZd9eebRPQRbUbkJhRV9 X-Received: by 2002:a17:906:1cd1:: with SMTP id i17mr4378974ejh.205.1634223193808; Thu, 14 Oct 2021 07:53:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634223193; cv=none; d=google.com; s=arc-20160816; b=KucPVXl9CkWBWbb0key4PcSbJe44SG3t/iT7pVWhhkPG/ITBYXvkNNVOM4EyRbHVe5 XpQpexr0rHtWvXGoU7bAe363PYD3jfwLSCx7Yrq6dqXtBsFeLcBrI1ccxtHIn5zp6gEW xHirjxubcYoS/vuV6kWFi5JEwhProlfrrW5iY7IIdeysSMCa+IpCjPSA+o8hsOfQUjWx 0sawY8M/eLGx54iChZ/OEebJHH4LPT57l1hx5s48eWQlWy6ty7q2VU9VJOfPlFZQvLS6 Zw+6I/uo9YxlqCMFMbiJbk+b5gqMkx9SuBVLD91cD3QIIVsMQN1+Y1rfF9TjiwzLXseb hh9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=SrjWs31NN1GXcGduVZrVYgvpTd/RLstqiTowRUbJLk4=; b=Pin2TfIHezZjZjliQq5pKWsmzK+rEwcQGaPW1WmJYVVQ/woLVl/R2BFI/WhK/VT4K+ A5sFO8xAIKLz8d8H20uxSBSeSlzgXxwC81WeMaPD9EIeYo5DFScHJexVL1vBdrjaS7fV SLn2xc2M0TnzLF6DP1uje5vu0tG/XCMBUzOelNOvcx+5PjK25Mcr/aHC7iqq5L9Gx5+r dSCCtv5uZnJl37agGDlUPv1G9qr+nxTOcIOVhOIPe08ClJr8VpN6SVCmjWAH/eCDjaNn 4qta6oY1V++IFppXiquA2ScPX7R1yRzjDBY2FIl2qbn2YniEreRQ4yVEKxX4Ye2xGDxH 2KYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q49C3Rwq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ka7si3819114ejc.664.2021.10.14.07.52.49; Thu, 14 Oct 2021 07:53:13 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q49C3Rwq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230386AbhJNMAz (ORCPT + 99 others); Thu, 14 Oct 2021 08:00:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:57188 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230080AbhJNMAy (ORCPT ); Thu, 14 Oct 2021 08:00:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 326E960BD3; Thu, 14 Oct 2021 11:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634212730; bh=Oui10MkUZm/crpdoOrZ3ozxUHKzPdQEL7AlhQ8R675Y=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Q49C3RwqQC7F6HavHPN+uRkVi/fsecm3XXv8aXcaQZxrBVOMDR6uCdii+9bV1mEKN +YW4suBNflX4qGV44IqjW3FZx6O3zvmfhaV0acFTlnuTPzwf3gvXOc5w/cA4jHi+M1 jogi6naNWIJ9Z/TQS0pBlUtwmrUH2sMNwOJb8ju7X4Z4tRefXNxA6bWO6R1TbA/GTy 2lhyBIBfrFVKyCEEBS3NmYh1bDe3i7qBEIN4fA5UcI/eGTS3iNONGJR4QUDASH7k1a kJva1EYTeFratntuqWqsjs2lc6zUL1wn2azovXIEBfaY5X+B5gyX+SYUnLlgriINr0 H1+Pxgc1EIVRA== Date: Thu, 14 Oct 2021 13:58:44 +0200 From: Marek =?UTF-8?B?QmVow7pu?= To: Alexander Dahl Cc: Pavel Machek , devicetree@vger.kernel.org, linux-leds@vger.kernel.org, Andrew Lunn , robh+dt@kernel.org, Jacek Anaszewski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij Subject: Re: [PATCH 2/3] dt-bindings: leds: Add `excludes` property Message-ID: <20211014135844.440e4e19@dellmb> In-Reply-To: References: <20211013204424.10961-1-kabel@kernel.org> <20211013204424.10961-2-kabel@kernel.org> <20211014102918.GA21116@duo.ucw.cz> <20211014124309.10b42043@dellmb> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 14 Oct 2021 13:30:39 +0200 Alexander Dahl wrote: > Hei hei, >=20 > Am Thu, Oct 14, 2021 at 12:43:09PM +0200 schrieb Marek Beh=C3=BAn: > > On Thu, 14 Oct 2021 12:29:18 +0200 > > Pavel Machek wrote: > > =20 > > > Hi! > > > =20 > > > > Some RJ-45 connectors have LEDs wired in the following way: > > > >=20 > > > > LED1 > > > > +--|>|--+ > > > > | | > > > > A---+--|<|--+---B > > > > LED2 > > > >=20 > > > > With + on A and - on B, LED1 is ON and LED2 is OFF. Inverting > > > > the polarity turns LED1 OFF and LED2 ON. > > > >=20 > > > > So these LEDs exclude each other. > > > >=20 > > > > Add new `excludes` property to the LED binding. The property is > > > > a phandle-array to all the other LEDs that are excluded by this > > > > LED. =20 > > >=20 > > > I don't think this belongs to the LED binding. > > >=20 > > > This is controller limitation, and the driver handling the > > > controller needs to know about it... so it does not need to learn > > > that from the LED binding. =20 > >=20 > > It's not necessarily a controller limitation, rather a limitation of > > the board (or ethernet connector, in the case of LEDs on an ethernet > > connector). =20 >=20 > Such LEDs are not limited to PHYs or ethernet connectors. There is > hardware with such dual color LEDs connected to GPIO pins (either > directly to the SoC or through some GPIO expander like an 74hc595 > shift register). That mail points to such hardware: >=20 > https://www.spinics.net/lists/linux-leds/msg11847.html >=20 > I asked about how this can be modelled back in 2019 and it was also > discussed last year: >=20 > https://www.spinics.net/lists/linux-leds/msg11665.html > https://lore.kernel.org/linux-leds/2315048.uTtSMl1LR1@ada/ >=20 > The "solution" back when I first asked was treating them as ordinary > GPIO-LEDs and ignore the "exclusion topic" which means in practice the > LED goes OFF if both pins are ON (high) at the same time, which works > well enough in practice. >=20 > > But I guess we could instead document this property in the ethernet > > PHY controller binding for a given PHY. =20 >=20 > Because such LEDs are not restricted to ethernet PHYs, but can also be > used with GPIOs from the hardware point of view, I would not put it > there. >=20 > Furthermore I would not view this as a restriction of the gpio-leds > controller, but it's a property of the LEDs itself or the way they are > wired to the board. >=20 > This could (or should as Pavel suggested back in 2019) be put to a new > driver, at least for the GPIO case, but it would need some kind of new > binding anyways. With that in mind I consider the proposed binding to > be well comprehensible for a human reader/writer. >=20 > I'm sorry, I did not have leisure time to implement such a driver yet. > Breadboard hardware for that still waiting in the drawer. :-/ That's why I think we need the `excludes` property. On the sw side, it should work like this: $ cd /sys/class/leds $ echo 1 >LED1/brightness $ cat LED1/brightness LED2/brightness 1 0 $ echo 1 >LED2/brightness $ cat LED1/brightness LED2/brightness 0 1 The drivers could also implement brightness_hw_changed for these LEDs. Marek