Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp235773pxb; Mon, 13 Sep 2021 17:58:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJsPkktGLkYrJS4hkOZHUBM5Ysk7+ZtH55C4De4eIxcn4j6vcrK+Q0LLwhiXvc562jKi7B X-Received: by 2002:a92:3012:: with SMTP id x18mr10439162ile.249.1631581112813; Mon, 13 Sep 2021 17:58:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631581112; cv=none; d=google.com; s=arc-20160816; b=URDMza3k+OVE6R6B4eJXnTw3W7nWsCKMFM2exhOz864lvRz7An4NN0mY/9O2H2v73B dS80w1U0rsOh3Z+dQj3tni4cEnHLEeS/mhOZG72l5+8MvRUPHSS57n80SbOn8sN5ATlM yt1dBU3ueUuJu9kcuX/+EEBWKxk9J8LPpCjb1FOCARJel6LcxYSLnR6JtCzkmQYtQCX/ AQMymoHlzOuulx08M0QO1FKnDYvGDPjDn9TbEqKGaztz4htGQwh0rZLCLT97N9mwYyjZ 8pQQ6pwTowpljEWCKzVV8KjWZL9Umv2FNijDtXDxBp4y2wOaA/++4U107cBMWnqmMgIx JAPg== 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=t8tfRr4pDfwNBQ7+2uutj5zJKW753YHlsVVOI6R4V1g=; b=ZsaPUkTpbDIL5iCqWcmGRuQIhBf0fF+YYA3IRcsvYGxYIuRPWFkamwK0WLDcyDGW/j JVaIkdrAuuOb5+Mattq18yH9EB4q/gB1rl/KQUIkgo/RZoENmbd3ABU1r7g0teT8veRb Jsr4BqfhgPAhWKwATyTV2ExOVPjupRlI7Cfkx6Tk442pUaYqrOihT4O8SjWjSC7s8PYm DNLDO3Ak47hLrV6RMNIT9e030ErKLydquJnt67sU1ImDOfy9UYV43xSfvZHV2qMboQX2 UrO541ELT7EKKV6m/MLsyu+bgP329Jkb4RcV2/DiXVCHcwAboI2M5JMF04PD73WaVJg3 Mcog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=SsiOFCJ6; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z17si8076696ils.47.2021.09.13.17.58.21; Mon, 13 Sep 2021 17:58:32 -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=@google.com header.s=20210112 header.b=SsiOFCJ6; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236024AbhIMTcX (ORCPT + 99 others); Mon, 13 Sep 2021 15:32:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239505AbhIMTcW (ORCPT ); Mon, 13 Sep 2021 15:32:22 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7667BC061760 for ; Mon, 13 Sep 2021 12:31:06 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id f21so4302971plb.4 for ; Mon, 13 Sep 2021 12:31:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=t8tfRr4pDfwNBQ7+2uutj5zJKW753YHlsVVOI6R4V1g=; b=SsiOFCJ61FtdyEwlHuuUPngVYXdsKbEzdCt0gPMgprmMChpMxdMnX02ut+TP+jS5wY jMF3dwWGOVCP+DRWrobbuKP5oamplIR5xnKsq4GAs1bZHSQn1SCTUGhsUlqSXuqU+qzG c1i/CiVL0T34mL+WEqkCKmAgiL17FLGPaBmunrrcqcoSSfrbATEIZzjqfAeYtiEKiuyy 8Ycy3Ep3pkfNBZ3QG08EcilnQpmqjotvFGWcvrR3rjL8S3KYFwqGdVK878yfoRwo0lYa ELWeakQGKAVw29XZfobwozmMZBsZgACMCPc3lCLLQlpK1ITY1wH4ekjAFicLvfFbcUBm md4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=t8tfRr4pDfwNBQ7+2uutj5zJKW753YHlsVVOI6R4V1g=; b=44y4n2z1BfIQngW+sfxQgSSCOtFpW2vOa892ICboFk+7spioEPY8yfv5aB3GinlCtI NbNN4s7HBV/YW0aZ4YipziXPMBnRKXs4XZyU9AvGsDXUQom3lgtAXX1FvYWAbWaxkWAu MUi//dw0m/I9a+SJmpf4fMVF7cqjT/04OwPDKkF4se2evaYqrxzJCZrFqLwXvINtPAKL AHbUpYbhEmaol4UvWD1WlHZRn0aLgANX5XFGzBjvoxfFYfW45xFcQJPuhk+XHLSSLgYh WTcLFwxClDfgp1X0xM9n+axSNdH0nx+XU0nk41dCG7JlMH7rHYh/4tAYBK+OQFQpcEEH EzEA== X-Gm-Message-State: AOAM532kXleG51TdRto25WrpEKW08pukBU1LgKm/px0Lw4s2l7YoFHRC aqjGJGZ9eWRdyyhwTc4RqsGcuHLQ5jcZlA== X-Received: by 2002:a17:903:2c2:b029:101:9c88:d928 with SMTP id s2-20020a17090302c2b02901019c88d928mr11767178plk.62.1631561465400; Mon, 13 Sep 2021 12:31:05 -0700 (PDT) Received: from google.com ([2620:15c:202:201:7b92:14a1:4f7c:6560]) by smtp.gmail.com with ESMTPSA id j17sm8126169pfn.148.2021.09.13.12.31.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 12:31:04 -0700 (PDT) Date: Mon, 13 Sep 2021 12:30:58 -0700 From: Benson Leung To: Adam Thomson Cc: Heikki Krogerus , Prashant Malani , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , "linux-pm@vger.kernel.org" , "bleung@chromium.org" , "badhri@google.com" , Greg Kroah-Hartman , Sebastian Reichel , Guenter Roeck Subject: Re: [RFC PATCH 2/3] power: supply: Add support for PDOs props Message-ID: References: <20210902213500.3795948-1-pmalani@chromium.org> <20210902213500.3795948-3-pmalani@chromium.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="EwOD/L4uVEvwhlPZ" Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --EwOD/L4uVEvwhlPZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Adam and Heikki, On Mon, Sep 13, 2021 at 03:15:46PM +0000, Adam Thomson wrote: > On 13 September 2021 14:30, Heikki Krogerus wrote: > > > > My plan is to register a separate power supply for each PDO. So for > > every source PDO and every sink PDO a port has in its capabilities, > > you'll have a separate power supply registered, and the same for the > > partner when it's connected. With every connection there should always > > be one active (online) source psy and active sink psy (if the port is > > source, one of the port's source psys will be active and the partner > > will have the active sink psy, or vise versa - depending on the role). > > > > Each PDO represents a "Power Supply" so to me that approach just > > makes the most sense. It will require a bit of work in kernel, however > > in user space it should mean that we only have a single new attribute > > file for the power supplies named "pdo" that returns a single PDO. > > > > Let me know if you guys see any obvious problems with the idea. > > Otherwise, that is how we really need to do this. That will make > > things much more clear in user space. I have a feeling it will make > > things easier in kernel as well in the long run. > > > > Adding Adam and Guenter. It would be good if you guys could comment > > the idea as well. >=20 > Hi Heikki, >=20 > Thanks for CCing me. My two pence worth is that I always envisaged the PSY > representation as being 1 PSY for 1 power source. I consider this in a > similar manner to the Regulator framework, where 1 regulator can support = a range > of voltages and currents, but this is covered by 1 regulator instance as = it's > just a single output. For USB-PD we have a number of options for voltage/= current > combos, including PPS which is even lower granularity, but it's still onl= y one > port. I get the feeling that having PSY instances for each and every PDO = might > be a little confusing and these will never be concurrent. >=20 > However, I'd be keen to understand further and see what restrictions/issu= es are > currently present as I probably don't have a complete view of this right = now. I > wouldn't want to dismiss something out of turn, especially when you obvio= usly > have good reason to suggest such an approach. I thought of one more potential downside to one-psy-per-pdo: Remember that a source or sink's Capabilities may dynamically change without a port disconnect, and this could make one-psy-per-pdo much more chatty with power supply deletions and re-registrations on load balancing events. At basically any time, a power source may send a new SRC_CAP to the sink wh= ich adjusts, deletes, or adds to the list of PDOs, without the connection state machine registering a disconnect. In a real world case, I have a charger in my kitchen that has 2 USB-C ports and supports a total of 30W output. When one device is plugged in: 5V 3A, 9V 3A, 15V 2A However, when two devices are plugged in, each sees: 5V 3A The load balancing event would result in two power supply deletions, whereas if it were a single psy per power supply (incorporating the list of PDO cho= ices) it would just be a single PROP_CHANGED event. It seems cleaner to me to have deletions and additions only possible when t= he thing is unplugged or plugged. Thanks, Benson --=20 Benson Leung Staff Software Engineer Chrome OS Kernel Google Inc. bleung@google.com Chromium OS Project bleung@chromium.org --EwOD/L4uVEvwhlPZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQCtZK6p/AktxXfkOlzbaomhzOwwgUCYT+m8gAKCRBzbaomhzOw wtH2APoDV1gSfN+pPGCY8Vu2eranOxsb9iPXHEdCwBTAw09zaQEAsWkCmW/nU+5k DKM6H/4JTFwKE559RgzaBiVpAFgzaAo= =etoe -----END PGP SIGNATURE----- --EwOD/L4uVEvwhlPZ--