Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp310547rdb; Thu, 21 Dec 2023 09:43:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFBXfP1Y8FYgxuwVpDvrB5rbgf/j5mShnGDcF5V140elaCtPvUz/pBH8iewewjb8DB5JRqk X-Received: by 2002:a17:906:ae57:b0:a26:af2e:67ba with SMTP id lf23-20020a170906ae5700b00a26af2e67bamr45504ejb.157.1703180612957; Thu, 21 Dec 2023 09:43:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703180612; cv=none; d=google.com; s=arc-20160816; b=jQSK5hzoGarWjAaVUUYM/dbiop83ZE3uJstwxBEt0UovDBb89JWQRszczIvmMoYWKD PZg4ymdJzNraDQMA9Kt3E/PLs0bIL/O/95KUDeJTEo0bImDvLsoa1FWY4v2A1TCU9FOg 1GKYFdU+CQi7jVzf7O39SogubhfytkFH8qtcq8dEpWvvrT2NLpv8gferdKehbyIdW1ni HG2g2JWr2WwsCN+Fstqos8OVtPD7UW9qPDSvNnC0IkqL4VTlrWqiR6leSMa8GlTwzScI WBUwZ+oAglD1kh6oLm6MRxaVGQi7+cjztsvGg+6CBVms/c5wr1DFzhSr0FQ57Th2UCID UfOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:references:message-id:subject:cc:to:from:date; bh=IjDmr8RhwqJlF2vPH0eMYdpey5I3EQ5riqR9MJg/b0k=; fh=E3xNuxHJTYtyTNEcPOXTfAHL/yjAvHdrK/wyLbU3Hss=; b=oPEfQpcTURGD1udtGFYOG4bD3ANqsqLLR2wmQPLm43BEi1ZKPywb65VWFEqYpgDLKp sMm7rUMgEhC+CCDXiFMns0lydJw5C7j+f/m8vHcw7AXkX1/fwOfGTs8OvM3NuLOIp1UE 6mLDv7KBV90uglFu/qwLeKr+Zfh6Eg625De0PgRfitbkrQh3mMHab/xGe+Zvz54xxb/W lGOP6K8UXPDhbK2pyh6iiNGakWorUmIC3Nh8R8C54n2gNEZNLTbULNHSYgjE+98o71qJ kCK+fSLPwy63HK5DIzGevkfuYUL1RYnc1c47iXtbCgO6czWLNuJSicih5FBdaVR96vOb 0vYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-8872-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8872-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l22-20020a170907915600b00a269fa420c0si961257ejs.555.2023.12.21.09.43.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 09:43:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8872-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-8872-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8872-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3ACBA1F26819 for ; Thu, 21 Dec 2023 17:43:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B7F1A634E2; Thu, 21 Dec 2023 17:43:21 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1ECE5990A for ; Thu, 21 Dec 2023 17:43:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rGN4L-0005G0-4R; Thu, 21 Dec 2023 18:42:49 +0100 Received: from [2a0a:edc0:2:b01:1d::c0] (helo=ptx.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rGN4H-000ZrS-DK; Thu, 21 Dec 2023 18:42:46 +0100 Received: from ore by ptx.whiteo.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1rGN4I-008Aa1-DK; Thu, 21 Dec 2023 18:42:46 +0100 Date: Thu, 21 Dec 2023 18:42:46 +0100 From: Oleksij Rempel To: Mark Brown Cc: =?utf-8?B?S8O2cnk=?= Maincent , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Luis Chamberlain , Russ Weight , Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, Dent Project , Liam Girdwood Subject: Re: [PATCH net-next v2 8/8] net: pse-pd: Add PD692x0 PSE controller driver Message-ID: <20231221174246.GI1697233@pengutronix.de> References: <20231201-feature_poe-v2-8-56d8cac607fa@bootlin.com> <20231204225956.GG981228@pengutronix.de> <20231205064527.GJ981228@pengutronix.de> <4b96b8c8-7def-46e5-9c85-d9e925fb9251@sirena.org.uk> <20231205140203.GK981228@pengutronix.de> <88ed0c94-d052-4564-be0c-79a0f502eda8@sirena.org.uk> <20231221163610.47038996@kmaincent-XPS-13-7390> <20231221171000.45310167@kmaincent-XPS-13-7390> <501f671d-4e03-490b-a9d6-e1f39bb99115@sirena.org.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <501f671d-4e03-490b-a9d6-e1f39bb99115@sirena.org.uk> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org On Thu, Dec 21, 2023 at 04:20:10PM +0000, Mark Brown wrote: > On Thu, Dec 21, 2023 at 05:10:00PM +0100, Köry Maincent wrote: > > Mark Brown wrote: > > > On Thu, Dec 21, 2023 at 04:36:10PM +0100, Köry Maincent wrote: > > > > Mark Brown wrote: > > > > > > OK... I mean, if they're not using the regulator framework I'm not sure > > > > > it has much impact - there are plenty of internal regulators in devices > > > > > already so it wouldn't be *too* unusual other than the fact that AFAICT > > > > > this is somewhat split between devices within the subsystem? Neither of > > > > > the messages was super clear. > > > > > PSE Power Interface (which is kind of the RJ45 in PSE world) have similar > > > > functionalities as regulators. We wondered if registering a regulator for > > > > each PSE PI (RJ45 ports) is a good idea. The point is that the PSE > > > > controller driver will be its own regulator consumer. > > > > I can't find any example in Linux with such a case of a driver being a > > > > provider and a consumer of its own regulator. This idea of a regulator > > > > biting its own tail seems weird to me. Maybe it is better to implement the > > > > PSE functionalities even if they are like the regulator functionalities. > > > > Is it at all plausible that a system (perhaps an embedded one) might use > > > something other than PSE? > > > Do you mean to supply power to a RJ45 port? > > Whatever it is that PSE does. > > > This can be done with a simple regulator. In that case we use the pse_regulator > > driver which is a regulator consumer. > > I don't know about other cases. Oleksij do you? > > In that case it sounds like you need the split to allow people to > substitute in a non-PSE supply, and everything ought to be doing the > consumer thing? I decided and suggested to use regulator framework for following reasons: - The PSE is never a standalone controller. It is part of the system which includes Power Supply, which is providing power to the SoC and PSE. - One system may contain multiple PSEs, we need to use some framework outside of PSE to regulate consumer priorities based on available power budget. - a complex design may contain multiple hot swappable power supplies, we need to manage them and regulate power budget between multiple PSEs. - in many cases PSE is kind of PMIC with multiple channels and some extras: prioritization, classification of attached devices. I suggest to represent every channel as a regulator, since it allow us to reuse existing diagnostic interfaces. Since everything power related on a embedded system we already handle with regulator framework, so why not use it within PSE too? Here is an example of more or less complex system: +----------------------------------------------------------------+ | Ethernet Switch | | | | +-----------------+ +-----------------+ +-----------------+ | | | Power Supply 1 | | Power Supply 2 | | removed Supply 3| | | +--------+--------+ +--------+--------+ +--------+--------+ | | | |-------------------. | | +--------v--------+ +--------v--------+ +--------v--------+ | | | PSE Controller | | PSE Controller | | PSE Controller | | | | #1 | | #2 | | #3 | | | +----+++++--------+ +--------+--------+ +--------+--------+ | | ||||| | | | +-------|||||--------------------|--------------------|----------+ ||||| | | ||||| | | +-------....v--------------------v--------------------v---------+ | Powered Devices | | | | +--------+ +--------+ +--------+ +--------+ +-----+ | | Sensor | | Sensor | | Sensor | ... | Motor | | ... | | +--------+ +--------+ +--------+ +--------+ +-----+ | | +---------------------------------------------------------------+ How a PD reserves/communicates power budget on PSE PI (Power Interfaces)? There are 3 ways to reserve power budget for PD: - Level 1 classification. Done by PSE in cooperation with PD by firmware or can be done by Linux. Linux variant is currently not implemented. - Done over Link Layer Discovery Protocol (LLDP). In this case some user space application (lldp daemon) will tell kernel to reserve power on some specific port (PSE PI). - Set by user if all other ways fail or not implemented PD side may have similar kind of challenges. For example, if PSE notifies PD about reducing power budge for PD, PD may decide to reduce consumption by keeping system alive - turn of the motor, but keep sensors enabled. The main question is - how to represent a remote consumer (Powered Device)? It looks for me like having a dummy regulator consumer for each (PSE PI) withing the PSE framework is the simplest thing to do. User should enable this dummy consumer from user space by using already existing interface in case of PoDL - ETHTOOL_A_PODL_PSE_ADMIN_CONTROL or new interface for Clause 33 PSE. Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |