Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp90155lqa; Fri, 26 Apr 2024 15:41:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUj9Gu+hy2jsnnEQJm4Vcno5A9GivPkigs1PytRy4OtA5cOKPejq0uNdIwv3upKdYUd7SYfjJsoHvwsW3F2c/NQYbDEwFf7107dcgtS5w== X-Google-Smtp-Source: AGHT+IE3KXW4frk8HsGCJqkUzV4MEECtn1hDXMDPYCiWGJINMSU6UgIw4IeuIopvWqAV7admNKUz X-Received: by 2002:adf:ed07:0:b0:34a:3254:23e0 with SMTP id a7-20020adfed07000000b0034a325423e0mr2399685wro.44.1714171315789; Fri, 26 Apr 2024 15:41:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714171315; cv=pass; d=google.com; s=arc-20160816; b=07XNe09GQCLpUXYRs4nNCpyp7rZKCTZqlzGUL/wB/NXPVTvqKkwMVlgx5SFMKpBvzV u7i6HYOlKfuZs4pT0oLhV5ynBQ9T8X/V5fIREAniGpLI9UeumsnOgRwIKJSUiTzoYQBT lJtU9KwMvgktgwcajvgkN7pSmPOZCMnUfQQGXDShT4VDZd3Wb7qFkISMUh5hi5Ji+O43 v0E2gyvRJ5E0g0/9/yDecA7IccqBbu808ovqeF5CdyX5aXqzmUYhyazsVNVSs8ysYoJs xz8lpSbCIR3zfpGc2rfGLM3RPRonMbLOFEf2eri+YH6MeHRWpBkINzA2cfEBcR7Lu16Q 5isg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PvZ/i9r3FVZj4alsX5Jepp4+7BJpXMZbt0ExU5aF+ZA=; fh=/9j7Sa0wSAFsaImenPHFo1dN3KFPq7s3l31jNDrOUCE=; b=snkRFoSZ7oanpmkecckmpWdTAmjDsG9+cg+MbsvXo0aJa1pd+zaXDYETA4osgKPEnJ 7zdnoDDBPsg0PBBAitIKYzVbWV/vLJazUc6fX7coGCL9tUoZvNg3r36HESwEbQo1Ubrq hj1kFNoakP2tv270wHzPBNEkJLdoL8BrpljI5QPEzvmkeHq2QZkD8JR+8qM8OBkSebPN 891NgKfhhWbeqo9YDk26jOGrOh5mcgXGjbW618UF+lXjs1FtZii21dNxkGz7Z04y4m5n SdYvxMPn+bqQM4t+rXns/IlBo7m0xJ08QpJncBondFCmXUq8E+2hiHgYgM03/PZ7WmDy r79Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=GXA1OfOh; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-160747-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160747-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id p11-20020a17090628cb00b00a587bd41203si5237580ejd.763.2024.04.26.15.41.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 15:41:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160747-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; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=GXA1OfOh; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-160747-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160747-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch 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 3D6921F23474 for ; Fri, 26 Apr 2024 22:41:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E7003BBEB; Fri, 26 Apr 2024 22:41:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="GXA1OfOh" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (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 D4A953BBC5; Fri, 26 Apr 2024 22:41:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714171288; cv=none; b=VB49P8naaYzLQ6c+k1U0DTmsKroFjRepoF1dtuTkFVWqlPwvf6UZMfEs2GRlSRN5ebpbFt5wfl5EDCGqdYLQQzIuqgELhXoYWqFQyM9inOcuPFmziUM50cgBgljcPcdTFjX3nAwK0FtdmwJ3lucHSZB8ws1DYb8yXRAkbIejVww= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714171288; c=relaxed/simple; bh=vZKtcZYVRAMqBRpL0CJRuYdyohcVXJMTXBSs6eu/1IA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Y/rxLYbSN4xoYbvwEFtQEazL1dq/xMeVmSFUQeIUMjmQJMieLxldwMoN9gWJ7FH9I8bDGGKi9lgOUJ7DaZB4WiAVqO/ihb93oKCsOBpjgVA+dfyaJfBX7phfqRVMMmD7vbZnEBoq4JUsSF28EZgF/3Rlxq68MeND4Li9Arwko9c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=GXA1OfOh; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch 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=PvZ/i9r3FVZj4alsX5Jepp4+7BJpXMZbt0ExU5aF+ZA=; b=GXA1OfOhyUuYOMS8rX51yQ4NhB z0hxpeeaMdcTn9AximebwffapVKvVhe0+re2LV01QBKHyKpnfNnyAqGLCeIWK81gaKXHGRebrhVlQ KxfQUGehYjbphUEPtYqV20wCd9+ki+82VuPOmUFwau9etZMnCIdc0+1g/lsrT7huCqg4=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1s0UFr-00E75d-Un; Sat, 27 Apr 2024 00:41:19 +0200 Date: Sat, 27 Apr 2024 00:41:19 +0200 From: Andrew Lunn To: Kory Maincent Cc: Oleksij Rempel , Mark Brown , Kyle Swenson , Liam Girdwood , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Thomas Petazzoni Subject: Re: PoE complex usage of regulator API Message-ID: <57a79abd-722c-4907-b0e7-2396392ae675@lunn.ch> References: <20240426124253.56fd0933@kmaincent-XPS-13-7390> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240426124253.56fd0933@kmaincent-XPS-13-7390> > Let's begin simple, in PSE world we are more talking about power. > Would it be ok to add a regulator_get/set_power_limit() and > regulator_get_power() callback to regulator API. Would regulator API have > interest to such callbacks? Could you define this API in more details. I'm assuming this is mostly about book keeping? When a regulator is created, we want to say is can deliver up to X Kilowatts. We then want to allocate power to ports. So there needs to be a call asking it to allocate part of X to a consumer, which could fail if there is not sufficient power budget left. And there needs to be a call to release such an allocation. We are probably not so much interested in what the actual current power draw is, assuming there is no wish to over provision? There is in theory a potential second user of this. Intel have been looking at power control for SFPs. Typically they are guaranteed a minimum of 1.5W. However, they can operate at higher power classes. You can have boards with multiple SFPs, with a theoretical maximum power draw more than what the supply can supply. So you need similar sort of power budget book keeping to allocate power to an SFP cage before telling the SFP module it can swap to a higher power class. I say this is theoretical, because the device Intel is working on has this hidden away in firmware. But maybe sometime in the future somebody will want Linux doing this. Andrew