Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1704825 > unrolled thread
| Started by | Hans de Goede <hdegoede@redhat.com> |
|---|---|
| First post | 2017-08-06 14:40 +0200 |
| Last post | 2017-08-06 17:00 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 01/18] staging: typec: tcpm: Add get_usb2_current_limit tcpc_dev callback Hans de Goede <hdegoede@redhat.com> - 2017-08-06 14:40 +0200
Re: [PATCH 01/18] staging: typec: tcpm: Add get_usb2_current_limit tcpc_dev callback Guenter Roeck <linux@roeck-us.net> - 2017-08-06 16:20 +0200
Re: [PATCH 01/18] staging: typec: tcpm: Add get_usb2_current_limit tcpc_dev callback Hans de Goede <hdegoede@redhat.com> - 2017-08-06 16:30 +0200
Re: [PATCH 01/18] staging: typec: tcpm: Add get_usb2_current_limit tcpc_dev callback Guenter Roeck <linux@roeck-us.net> - 2017-08-06 17:00 +0200
| From | Hans de Goede <hdegoede@redhat.com> |
|---|---|
| Date | 2017-08-06 14:40 +0200 |
| Subject | [PATCH 01/18] staging: typec: tcpm: Add get_usb2_current_limit tcpc_dev callback |
| Message-ID | <ubt0C-2al-21@gated-at.bofh.it> |
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)
+ 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);
--
2.13.3
[toc] | [next] | [standalone]
| From | Guenter Roeck <linux@roeck-us.net> |
|---|---|
| Date | 2017-08-06 16:20 +0200 |
| Subject | Re: [PATCH 01/18] staging: typec: tcpm: Add get_usb2_current_limit tcpc_dev callback |
| Message-ID | <ubuzn-3il-5@gated-at.bofh.it> |
| In reply to | #1704825 |
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.
> + 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);
>
[toc] | [prev] | [next] | [standalone]
| From | Hans de Goede <hdegoede@redhat.com> |
|---|---|
| Date | 2017-08-06 16:30 +0200 |
| Subject | Re: [PATCH 01/18] staging: typec: tcpm: Add get_usb2_current_limit tcpc_dev callback |
| Message-ID | <ubuJ5-3lF-19@gated-at.bofh.it> |
| In reply to | #1704855 |
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.
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);
>>
>
[toc] | [prev] | [next] | [standalone]
| From | Guenter Roeck <linux@roeck-us.net> |
|---|---|
| Date | 2017-08-06 17:00 +0200 |
| Subject | Re: [PATCH 01/18] staging: typec: tcpm: Add get_usb2_current_limit tcpc_dev callback |
| Message-ID | <ubvc5-3xe-1@gated-at.bofh.it> |
| In reply to | #1704859 |
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);
>>>
>>
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web