From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752251AbdK1Jb0 (ORCPT ); Tue, 28 Nov 2017 04:31:26 -0500 Received: from mail1.bemta3.messagelabs.com ([195.245.230.164]:43507 "EHLO mail1.bemta3.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752226AbdK1JbW (ORCPT ); Tue, 28 Nov 2017 04:31:22 -0500 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNKsWRWlGSWpSXmKPExsUSt3Opse4zHdk ogzNvLS1uTz3JZPH633QWi+bF69ksulbvZLG4vGsOm8WiZa3MFk8WnmFyYPdYsKnUY97JQI/9 c9ewe3x8eovFY+f3BnaPz5vkAtiiWDPzkvIrElgz5j/4zFqwRbFi8qNWtgbGPwpdjJwcQgLLG CUmvigDsdkELCQmn3jA1sXIxSEi0M4o8WRJEyuIwyywlUmifcZU9i5GDg5hAWeJQ++UQBpEBF wk5m/fxgRhu0k8OHqLBcRmEVCVuL2hjxHE5hUIkDjfdQFsjpDAYiaJe9O6WEESnAIOEjMft4P ZjAKyEl8aVzOD2MwC4hK3nswHGyohICCxZM95ZghbVOLl43+sELa8xPZvv9khbHuJ1/fesUDY +hKPHj9ihLANJVZNOwAVN5c4tLyfBeR+ZgFNifW79CFWKUpM6X7IDnGnoMTJmU9YJjCKz0Jyx SyEjllIOmYh6VjAyLKKUaM4tagstUjX0FwvqSgzPaMkNzEzR9fQwFgvN7W4ODE9NScxqVgvOT 93EyMwihmAYAfjy9OehxglOZiURHkXZEtFCfEl5adUZiQWZ8QXleakFh9ilOHgUJLgvaAtGyU kWJSanlqRlpkDTCcwaQkOHiUR3vUgad7igsTc4sx0iNQpRmOOJ9fm/WXieDbzdQOzEEtefl6q lDjvRpBSAZDSjNI8uEGwNHeJUVZKmJcR6DQhnoLUotzMElT5V4ziHIxKwrzbQKbwZOaVwO17B XQKE9ApN/dLg5xSkoiQkmpgDFunmmmUvm3Jqv64+pNZD3ov7H++LJJ9xSZ5rZqYrS69C/4yei R4ZJyaflj75ikXI9WSc+wt7FO3JWfo1h67qqMS96Eue/qOzfa3Jt1/f9NcN37yU/PQOyHVSfO ZHX9PL+PIntQuukcg4YR7c7VZqXSsqGyuj2mu/eE/MmsntUcdfBMbf69WiaU4I9FQi7moOBEA R60KZW4DAAA= X-Env-Sender: Adam.Thomson.Opensource@diasemi.com X-Msg-Ref: server-13.tower-39.messagelabs.com!1511861478!117797532!1 X-Originating-IP: [94.185.165.51] X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked From: Adam Thomson To: Guenter Roeck , Badhri Jagan Sridharan , Adam Thomson CC: "heikki.krogerus@linux.intel.com" , "gregkh@linuxfoundation.org" , "dan.carpenter@oracle.com" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 2/2 v7] typec: tcpm: Only request matching pdos Thread-Topic: [PATCH 2/2 v7] typec: tcpm: Only request matching pdos Thread-Index: AQHTXnaaVwiVwD1IZUORgIX229NkPaMh0z+QgAdC4gCAAAgAAIAAe5wg Date: Tue, 28 Nov 2017 09:31:17 +0000 Message-ID: <2E89032DDAA8B9408CB92943514A0337014C1B164C@SW-EX-MBX01.diasemi.com> References: <20171116010156.25259-1-Badhri@google.com> <20171116010156.25259-2-Badhri@google.com> <2E89032DDAA8B9408CB92943514A0337014C1B0E02@SW-EX-MBX01.diasemi.com> <7db1c9f5-a621-d2b9-7400-c05ab2ffbb83@roeck-us.net> In-Reply-To: <7db1c9f5-a621-d2b9-7400-c05ab2ffbb83@roeck-us.net> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.20.24.43] x-kse-attachmentfiltering-interceptor-info: protection disabled x-kse-serverinfo: sw-ex-cashub02.diasemi.com, 9 x-kse-antivirus-interceptor-info: scan successful x-kse-antivirus-info: Clean, bases: 28/11/2017 07:45:00 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id vAS9VU9S008652 On 28 November 2017 02:07, Guenter Roeck wrote: > On 11/27/2017 05:38 PM, Badhri Jagan Sridharan wrote: > > On Thu, Nov 23, 2017 at 3:10 AM, Adam Thomson > > wrote: > >> On 16 November 2017 01:02, Badhri Jagan Sridharan wrote: > >> > >>> At present, TCPM code assumes that local device supports > >>> variable/batt pdos and always selects the pdo with highest > >>> possible power within the board limit. This assumption > >>> might not hold good for all devices. To overcome this, > >>> this patch makes TCPM only accept a source_pdo when there is > >>> a matching sink pdo. > >>> > >>> For Fixed pdos: The voltage should match between the > >>> incoming source_cap and the registered snk_pdo > >>> For Variable/Batt pdos: The incoming source_cap voltage > >>> range should fall within the registered snk_pdo's voltage > >>> range. > >>> > >>> Also, when the cap_mismatch bit is set, the max_power/current > >>> should be set to the max_current/power of the sink_pdo. > >>> This is according to: > >>> > >>> "If the Capability Mismatch bit is set to one > >>> The Maximum Operating Current/Power field may contain a value > >>> larger than the maximum current/power offered in the Source > >>> Capabilities message’s PDO as referenced by the Object position field. > >>> This enables the Sink to indicate that it requires more current/power > >>> than is being offered. If the Sink requires a different voltage this > >>> will be indicated by its Sink Capabilities message. > >> > >> Hi Badhri, > >> > >> I have some queries on this change. At the moment the src/snk PDOs are hard > >> coded in the relevant PD controller driver (e.g. fusb302.c), and the only way > >> to update these is to call the tcpm_update_source_capabilities() or > >> tcpm_update_sink_capabilities() functions. However there are no real world > > > > Good point ! But I dont see any code which calls this either. I believe > > Guenter added this. Guenter do you know ? > > > > A source might change its power capabilities dynamically. Practical example is > a system with two USB-C ports. If one is in use, it may support 3A output power. > If two are in use, it may support 1.5A each. This isn't currently used in the > kernel, but some of our devices have this behavior, so I thought it would be > prudent to have support for it. The same is true for a sink, which may change > its power requirements at runtime (same situation - a device is inserted at > the second USB port) and ask for more or less power. > > Is that a problem ? I won't object if you want to take it out because there is > no current user, but you should keep in mind that those are valid use cases, > and that the code should at least be extensible (ie the patch taking it away > should be revertible) to support those use cases. No, I have no desire to remove it and definitely see the valid use-cases. I was curious though as to where these functions might be called from within the kernel as wherever that is it will need to have the ability to retrieve the port instance to be able to call these functions.