From: Guenter Roeck <linux@roeck-us.net>
To: Hans de Goede <hdegoede@redhat.com>,
Darren Hart <dvhart@infradead.org>,
Andy Shevchenko <andy@infradead.org>,
Wolfram Sang <wsa@the-dreams.de>,
Sebastian Reichel <sre@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
Liam Breck <liam@networkimprov.net>,
Tony Lindgren <tony@atomide.com>,
linux-pm@vger.kernel.org, devel@driverdev.osuosl.org
Subject: Re: [PATCH 01/18] staging: typec: tcpm: Add get_usb2_current_limit tcpc_dev callback
Date: Sun, 6 Aug 2017 07:52:26 -0700 [thread overview]
Message-ID: <b733b70d-b858-257a-e3db-9b267ada43d9@roeck-us.net> (raw)
In-Reply-To: <5c9f12b9-f121-d33d-33eb-922e9ddbd43c@redhat.com>
On 08/06/2017 07:29 AM, Hans de Goede wrote:
> Hi,
>
> On 06-08-17 16:18, Guenter Roeck wrote:
>> On 08/06/2017 05:35 AM, Hans de Goede wrote:
>>> A Rp signalling the default current limit indicates that we're possibly
>>> connected to an USB2 power-source. In some cases the type-c
>>> port-controller may provide the capability to detect the current-limit
>>> for USB2 power-sources (through e.g. BC1.2 detection).
>>>
>>> This commit adds an optional get_usb2_current_limit tcpc_dev callback
>>> which allows the port-controller to return the detected current-limit
>>> if the CC pin is pulled up with Rp.
>>>
>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>> ---
>>> drivers/staging/typec/tcpm.c | 5 ++++-
>>> drivers/staging/typec/tcpm.h | 1 +
>>> 2 files changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
>>> index 20eb4ebcf8c3..9f5adace4309 100644
>>> --- a/drivers/staging/typec/tcpm.c
>>> +++ b/drivers/staging/typec/tcpm.c
>>> @@ -660,7 +660,10 @@ static u32 tcpm_get_current_limit(struct tcpm_port *port)
>>> break;
>>> case TYPEC_CC_RP_DEF:
>>> default:
>>> - limit = 0;
>>> + if (port->tcpc->get_usb2_current_limit)
>>
>> I think this callback should just be get_current_limit.
>
> This is only used in the Rp-def case, which usually indicates being connected
> with an A->C cable to a USB-2 device and the intend is for the callback to
> implement some USB-2 specific method to detect the supported current-limit,
> hence the name. If you prefer to name it just get_current_limit I can
> change it for v2, but IMHO the usb2 part of the name is important as this
> will not get called when USB-PD negotiation is used, nor when Rp has the Rp15
> or Rp30 values.
>
As you say, it gets called in the Rp-def case, which can be set anytime.
I'd rather have a generic name and explain in tcpm.h as part of the API
description when it is used/called.
Note that it is also called in SNK_DISCOVERY if cc=Rp-def to calculate
and set the initial current limit, even with pd.
Thanks,
Guenter
> Regards,
>
> Hans
>
>
>
>>
>>> + limit = port->tcpc->get_usb2_current_limit(port->tcpc);
>>> + else
>>> + limit = 0;
>>> break;
>>> }
>>> diff --git a/drivers/staging/typec/tcpm.h b/drivers/staging/typec/tcpm.h
>>> index 19c307d31a5a..01b7d89379a3 100644
>>> --- a/drivers/staging/typec/tcpm.h
>>> +++ b/drivers/staging/typec/tcpm.h
>>> @@ -108,6 +108,7 @@ struct tcpc_dev {
>>> int (*init)(struct tcpc_dev *dev);
>>> int (*get_vbus)(struct tcpc_dev *dev);
>>> + int (*get_usb2_current_limit)(struct tcpc_dev *dev); /* Optional */
>>> int (*set_cc)(struct tcpc_dev *dev, enum typec_cc_status cc);
>>> int (*get_cc)(struct tcpc_dev *dev, enum typec_cc_status *cc1,
>>> enum typec_cc_status *cc2);
>>>
>>
>
next prev parent reply other threads:[~2017-08-06 14:52 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-06 12:35 [PATCH 00/18] Hookup typec power-negotation to the PMIC and charger Hans de Goede
2017-08-06 12:35 ` [PATCH 01/18] staging: typec: tcpm: Add get_usb2_current_limit tcpc_dev callback Hans de Goede
2017-08-06 14:18 ` Guenter Roeck
2017-08-06 14:29 ` Hans de Goede
2017-08-06 14:52 ` Guenter Roeck [this message]
2017-08-06 12:35 ` [PATCH 02/18] staging: typec: tcpm: Add extcon helper functions for USB2 current limit detect Hans de Goede
2017-08-06 14:07 ` Guenter Roeck
2017-08-06 12:35 ` [PATCH 03/18] staging: typec: tcpm: Split tcpm code into tcpm-core.c and tcpm-helpers.c Hans de Goede
2017-08-06 12:35 ` [PATCH 04/18] staging: typec: tcpm: Add helpers for exporting current-limit through a psy Hans de Goede
2017-08-06 14:13 ` Guenter Roeck
2017-08-06 14:21 ` Hans de Goede
2017-08-06 14:41 ` Guenter Roeck
2017-08-06 12:35 ` [PATCH 05/18] staging: typec: fusb302: Set max supply voltage to 5V Hans de Goede
2017-08-06 12:35 ` [PATCH 06/18] staging: typec: fusb302: Get max snk mv/ma/mw from device-properties Hans de Goede
2017-08-06 14:03 ` Guenter Roeck
2017-08-06 12:35 ` [PATCH 07/18] staging: typec: fusb302: Use client->irq as irq if set Hans de Goede
2017-08-06 12:35 ` [PATCH 08/18] staging: typec: fusb302: Add support for USB2 charger detection through extcon Hans de Goede
2017-08-06 14:22 ` Guenter Roeck
2017-08-06 14:36 ` Hans de Goede
2017-08-06 14:58 ` Guenter Roeck
2017-08-06 12:35 ` [PATCH 09/18] staging: typec: fusb302: Use tcpm_set_current_limit_psy Hans de Goede
2017-08-06 14:24 ` Guenter Roeck
2017-08-06 12:35 ` [PATCH 10/18] staging: typec: fusb302: Add support for fcs, vbus-regulator-name device-property Hans de Goede
2017-08-06 14:30 ` [PATCH 10/18] staging: typec: fusb302: Add support for fcs,vbus-regulator-name device-property Guenter Roeck
2017-08-06 14:52 ` Hans de Goede
2017-08-06 15:20 ` Guenter Roeck
2017-08-06 15:44 ` Hans de Goede
2017-08-07 11:10 ` Mark Brown
2017-08-07 14:41 ` Hans de Goede
2017-08-07 15:41 ` Mark Brown
2017-08-07 19:20 ` Hans de Goede
2017-08-08 9:39 ` Mark Brown
[not found] ` <0b75c318-0f71-c536-7c7f-9ba16b215690@redhat.com>
[not found] ` <20170808144217.c2fm25uge75p4lo2@sirena.org.uk>
2017-08-08 20:53 ` Hans de Goede
2017-08-06 12:35 ` [PATCH 11/18] power: supply: Fix power_supply_am_i_supplied to return -ENODEV when apropriate Hans de Goede
2017-08-06 14:31 ` Guenter Roeck
2017-08-06 14:54 ` Hans de Goede
2017-08-06 12:35 ` [PATCH 12/18] power: supply: Add power_supply_set_input_current_limit_from_supplier helper Hans de Goede
2017-08-06 12:35 ` [PATCH 13/18] power: supply: bq24190_charger: Export 5V boost converter as regulator Hans de Goede
2017-08-08 4:15 ` Tony Lindgren
2017-08-08 8:39 ` Liam Breck
2017-08-08 9:00 ` Hans de Goede
2017-08-08 18:57 ` Liam Breck
2017-08-08 21:09 ` Hans de Goede
2017-08-06 12:35 ` [PATCH 14/18] power: supply: bq24190_charger: Add input_current_limit property Hans de Goede
2017-08-06 12:35 ` [PATCH 15/18] power: supply: bq24190_charger: Get input_current_limit from our supplier Hans de Goede
2017-08-08 8:24 ` Liam Breck
2017-08-08 9:11 ` Hans de Goede
2017-08-06 12:35 ` [PATCH 16/18] power: supply: bq24190_charger: Remove extcon handling Hans de Goede
2017-08-08 8:27 ` Liam Breck
2017-08-08 9:12 ` Hans de Goede
2017-08-06 12:35 ` [PATCH 17/18] platform/x86: intel_cht_int33fe Update fusb302 type string, add properties Hans de Goede
2017-08-06 12:35 ` [PATCH 18/18] i2c-cht-wc: Add device-properties for fusb302 integration Hans de Goede
2017-08-06 14:35 ` Guenter Roeck
2017-08-06 15:05 ` Hans de Goede
2017-08-06 16:29 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b733b70d-b858-257a-e3db-9b267ada43d9@roeck-us.net \
--to=linux@roeck-us.net \
--cc=andy@infradead.org \
--cc=devel@driverdev.osuosl.org \
--cc=dvhart@infradead.org \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=liam@networkimprov.net \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=sre@kernel.org \
--cc=tony@atomide.com \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).