Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63f59b73 authored by Adam Thomson's avatar Adam Thomson Committed by Greg Kroah-Hartman
Browse files

dt-bindings: connector: Add support for USB-PD PPS APDOs to bindings



Add support for PPS APDOs to connector bindings so a port controller
can specify support for PPS, as per existing FIXED/BATT/VAR PDOs.

Signed-off-by: default avatarAdam Thomson <Adam.Thomson.Opensource@diasemi.com>
Reviewed-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1652a83f
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -29,15 +29,15 @@ Required properties for usb-c-connector with power delivery support:
  in "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.2
  in "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.2
  Source_Capabilities Message, the order of each entry(PDO) should follow
  Source_Capabilities Message, the order of each entry(PDO) should follow
  the PD spec chapter 6.4.1. Required for power source and power dual role.
  the PD spec chapter 6.4.1. Required for power source and power dual role.
  User can specify the source PDO array via PDO_FIXED/BATT/VAR() defined in
  User can specify the source PDO array via PDO_FIXED/BATT/VAR/PPS_APDO()
  dt-bindings/usb/pd.h.
  defined in dt-bindings/usb/pd.h.
- sink-pdos: An array of u32 with each entry providing supported power
- sink-pdos: An array of u32 with each entry providing supported power
  sink data object(PDO), the detailed bit definitions of PDO can be found
  sink data object(PDO), the detailed bit definitions of PDO can be found
  in "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.3
  in "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.3
  Sink Capabilities Message, the order of each entry(PDO) should follow
  Sink Capabilities Message, the order of each entry(PDO) should follow
  the PD spec chapter 6.4.1. Required for power sink and power dual role.
  the PD spec chapter 6.4.1. Required for power sink and power dual role.
  User can specify the sink PDO array via PDO_FIXED/BATT/VAR() defined in
  User can specify the sink PDO array via PDO_FIXED/BATT/VAR/PPS_APDO() defined
  dt-bindings/usb/pd.h.
  in dt-bindings/usb/pd.h.
- op-sink-microwatt: Sink required operating power in microwatt, if source
- op-sink-microwatt: Sink required operating power in microwatt, if source
  can't offer the power, Capability Mismatch is set. Required for power
  can't offer the power, Capability Mismatch is set. Required for power
  sink and power dual role.
  sink and power dual role.
+26 −0
Original line number Original line Diff line number Diff line
@@ -59,4 +59,30 @@
	(PDO_TYPE(PDO_TYPE_VAR) | PDO_VAR_MIN_VOLT(min_mv) |	\
	(PDO_TYPE(PDO_TYPE_VAR) | PDO_VAR_MIN_VOLT(min_mv) |	\
	 PDO_VAR_MAX_VOLT(max_mv) | PDO_VAR_MAX_CURR(max_ma))
	 PDO_VAR_MAX_VOLT(max_mv) | PDO_VAR_MAX_CURR(max_ma))


#define APDO_TYPE_PPS		0

#define PDO_APDO_TYPE_SHIFT	28	/* Only valid value currently is 0x0 - PPS */
#define PDO_APDO_TYPE_MASK	0x3

#define PDO_APDO_TYPE(t)	((t) << PDO_APDO_TYPE_SHIFT)

#define PDO_PPS_APDO_MAX_VOLT_SHIFT	17	/* 100mV units */
#define PDO_PPS_APDO_MIN_VOLT_SHIFT	8	/* 100mV units */
#define PDO_PPS_APDO_MAX_CURR_SHIFT	0	/* 50mA units */

#define PDO_PPS_APDO_VOLT_MASK	0xff
#define PDO_PPS_APDO_CURR_MASK	0x7f

#define PDO_PPS_APDO_MIN_VOLT(mv)	\
	((((mv) / 100) & PDO_PPS_APDO_VOLT_MASK) << PDO_PPS_APDO_MIN_VOLT_SHIFT)
#define PDO_PPS_APDO_MAX_VOLT(mv)	\
	((((mv) / 100) & PDO_PPS_APDO_VOLT_MASK) << PDO_PPS_APDO_MAX_VOLT_SHIFT)
#define PDO_PPS_APDO_MAX_CURR(ma)	\
	((((ma) / 50) & PDO_PPS_APDO_CURR_MASK) << PDO_PPS_APDO_MAX_CURR_SHIFT)

#define PDO_PPS_APDO(min_mv, max_mv, max_ma)					\
	(PDO_TYPE(PDO_TYPE_APDO) | PDO_APDO_TYPE(APDO_TYPE_PPS) |		\
	 PDO_PPS_APDO_MIN_VOLT(min_mv) | PDO_PPS_APDO_MAX_VOLT(max_mv) |	\
	 PDO_PPS_APDO_MAX_CURR(max_ma))

 #endif /* __DT_POWER_DELIVERY_H */
 #endif /* __DT_POWER_DELIVERY_H */