diff mbox series

[1/4] extcon: Add USB VBUS properties

Message ID 20200914164639.1487650-2-angus@akkea.ca
State New
Headers show
Series RFC: USB C extcon patchset for the tps6598x | expand

Commit Message

Angus Ainslie Sept. 14, 2020, 4:46 p.m. UTC
USB type C, USB BC1.2 and USB power delivery allow different voltages
and currents for VBUS so we need these additional properties.

Also USB type C allows separate device and power roles so add a VBUS SRC
property.

Signed-off-by: Angus Ainslie <angus@akkea.ca>
---
 include/linux/extcon.h | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Comments

Chanwoo Choi Sept. 15, 2020, 1:40 a.m. UTC | #1
Hi,

On 9/15/20 1:46 AM, Angus Ainslie wrote:
> USB type C, USB BC1.2 and USB power delivery allow different voltages

> and currents for VBUS so we need these additional properties.

> 

> Also USB type C allows separate device and power roles so add a VBUS SRC

> property.

> 

> Signed-off-by: Angus Ainslie <angus@akkea.ca>

> ---

>  include/linux/extcon.h | 17 ++++++++++++++++-

>  1 file changed, 16 insertions(+), 1 deletion(-)

> 

> diff --git a/include/linux/extcon.h b/include/linux/extcon.h

> index fd183fb9c20f..c4d48f4f74c4 100644

> --- a/include/linux/extcon.h

> +++ b/include/linux/extcon.h

> @@ -117,14 +117,29 @@

>   * @type:       integer (intval)

>   * @value:      0 (USB/USB2) or 1 (USB3)

>   * @default:    0 (USB/USB2)

> + * - EXTCON_PROP_USB_VBUS_SRC


Could you explain more correct meaning of both sink and source?

> + * @type:	integer (intval)

> + * @value:	0 (sink) or 1 (source)

> + * @default:	0 (sink)

> + * - EXTCON_PROP_USB_VBUS_VOLTAGE

> + * @type:	integer (intval)

> + * @value:	negotiated vbus voltage in mV

> + * @default:	5000


Could you suggest the data why do you set default value as 5000?

> + * - EXTCON_PROP_USB_VBUS_CURRENT

> + * @type:	integer (intval)

> + * @value:	negotiated vbus current in mA

> + * @default:	100


ditto. Why default value is 100?

>   *

>   */

>  #define EXTCON_PROP_USB_VBUS		0

>  #define EXTCON_PROP_USB_TYPEC_POLARITY	1

>  #define EXTCON_PROP_USB_SS		2

> +#define EXTCON_PROP_USB_VBUS_SRC	3

> +#define EXTCON_PROP_USB_VBUS_VOLTAGE	4

> +#define EXTCON_PROP_USB_VBUS_CURRENT	5

>  

>  #define EXTCON_PROP_USB_MIN		0

> -#define EXTCON_PROP_USB_MAX		2

> +#define EXTCON_PROP_USB_MAX		5

>  #define EXTCON_PROP_USB_CNT	(EXTCON_PROP_USB_MAX - EXTCON_PROP_USB_MIN + 1)

>  

>  /* Properties of EXTCON_TYPE_CHG. */

> 



-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
Angus Ainslie Sept. 15, 2020, 1:31 p.m. UTC | #2
Hi,

On 2020-09-14 18:40, Chanwoo Choi wrote:
> Hi,

> 

> On 9/15/20 1:46 AM, Angus Ainslie wrote:

>> USB type C, USB BC1.2 and USB power delivery allow different voltages

>> and currents for VBUS so we need these additional properties.

>> 

>> Also USB type C allows separate device and power roles so add a VBUS 

>> SRC

>> property.

>> 

>> Signed-off-by: Angus Ainslie <angus@akkea.ca>

>> ---

>>  include/linux/extcon.h | 17 ++++++++++++++++-

>>  1 file changed, 16 insertions(+), 1 deletion(-)

>> 

>> diff --git a/include/linux/extcon.h b/include/linux/extcon.h

>> index fd183fb9c20f..c4d48f4f74c4 100644

>> --- a/include/linux/extcon.h

>> +++ b/include/linux/extcon.h

>> @@ -117,14 +117,29 @@

>>   * @type:       integer (intval)

>>   * @value:      0 (USB/USB2) or 1 (USB3)

>>   * @default:    0 (USB/USB2)

>> + * - EXTCON_PROP_USB_VBUS_SRC

> 

> Could you explain more correct meaning of both sink and source?

> 


Sure I can add some comments.

>> + * @type:	integer (intval)

>> + * @value:	0 (sink) or 1 (source)

>> + * @default:	0 (sink)

>> + * - EXTCON_PROP_USB_VBUS_VOLTAGE

>> + * @type:	integer (intval)

>> + * @value:	negotiated vbus voltage in mV

>> + * @default:	5000

> 

> Could you suggest the data why do you set default value as 5000?

> 


The lowest USB VBUS is 5V so I can add that to the comments.

>> + * - EXTCON_PROP_USB_VBUS_CURRENT

>> + * @type:	integer (intval)

>> + * @value:	negotiated vbus current in mA

>> + * @default:	100

> 

> ditto. Why default value is 100?

> 


USB spec says that until the current is negotiated the max that anything 
can draw is 100mA. I can add a comment to that effect.

Thanks
Angus

>>   *

>>   */

>>  #define EXTCON_PROP_USB_VBUS		0

>>  #define EXTCON_PROP_USB_TYPEC_POLARITY	1

>>  #define EXTCON_PROP_USB_SS		2

>> +#define EXTCON_PROP_USB_VBUS_SRC	3

>> +#define EXTCON_PROP_USB_VBUS_VOLTAGE	4

>> +#define EXTCON_PROP_USB_VBUS_CURRENT	5

>> 

>>  #define EXTCON_PROP_USB_MIN		0

>> -#define EXTCON_PROP_USB_MAX		2

>> +#define EXTCON_PROP_USB_MAX		5

>>  #define EXTCON_PROP_USB_CNT	(EXTCON_PROP_USB_MAX - 

>> EXTCON_PROP_USB_MIN + 1)

>> 

>>  /* Properties of EXTCON_TYPE_CHG. */

>>
diff mbox series

Patch

diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index fd183fb9c20f..c4d48f4f74c4 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -117,14 +117,29 @@ 
  * @type:       integer (intval)
  * @value:      0 (USB/USB2) or 1 (USB3)
  * @default:    0 (USB/USB2)
+ * - EXTCON_PROP_USB_VBUS_SRC
+ * @type:	integer (intval)
+ * @value:	0 (sink) or 1 (source)
+ * @default:	0 (sink)
+ * - EXTCON_PROP_USB_VBUS_VOLTAGE
+ * @type:	integer (intval)
+ * @value:	negotiated vbus voltage in mV
+ * @default:	5000
+ * - EXTCON_PROP_USB_VBUS_CURRENT
+ * @type:	integer (intval)
+ * @value:	negotiated vbus current in mA
+ * @default:	100
  *
  */
 #define EXTCON_PROP_USB_VBUS		0
 #define EXTCON_PROP_USB_TYPEC_POLARITY	1
 #define EXTCON_PROP_USB_SS		2
+#define EXTCON_PROP_USB_VBUS_SRC	3
+#define EXTCON_PROP_USB_VBUS_VOLTAGE	4
+#define EXTCON_PROP_USB_VBUS_CURRENT	5
 
 #define EXTCON_PROP_USB_MIN		0
-#define EXTCON_PROP_USB_MAX		2
+#define EXTCON_PROP_USB_MAX		5
 #define EXTCON_PROP_USB_CNT	(EXTCON_PROP_USB_MAX - EXTCON_PROP_USB_MIN + 1)
 
 /* Properties of EXTCON_TYPE_CHG. */