return ret;
}
+static void ucsi_orientation(struct ucsi_connector *con)
+{
+ if (con->ucsi->version < UCSI_VERSION_2_0)
+ return;
+
+ if (!UCSI_CONSTAT(con, CONNECTED)) {
+ typec_set_orientation(con->port, TYPEC_ORIENTATION_NONE);
+ return;
+ }
+
+ switch (UCSI_CONSTAT(con, ORIENTATION)) {
+ case UCSI_CONSTAT_ORIENTATION_NORMAL:
+ typec_set_orientation(con->port, TYPEC_ORIENTATION_NORMAL);
+ break;
+ case UCSI_CONSTAT_ORIENTATION_REVERSE:
+ typec_set_orientation(con->port, TYPEC_ORIENTATION_REVERSE);
+ break;
+ default:
+ break;
+ }
+}
+
static void ucsi_pwr_opmode_change(struct ucsi_connector *con)
{
switch (UCSI_CONSTAT(con, PWR_OPMODE)) {
typec_set_pwr_role(con->port, role);
ucsi_port_psy_changed(con);
ucsi_partner_change(con);
+ ucsi_orientation(con);
if (UCSI_CONSTAT(con, CONNECTED)) {
ucsi_register_partner(con);
typec_set_pwr_role(con->port, UCSI_CONSTAT(con, PWR_DIR));
ucsi_register_partner(con);
ucsi_pwr_opmode_change(con);
+ ucsi_orientation(con);
ucsi_port_psy_changed(con);
if (con->ucsi->cap.features & UCSI_CAP_GET_PD_MESSAGE)
ucsi_get_partner_identity(con);
#define UCSI_CONSTAT_BC_SLOW_CHARGING 2
#define UCSI_CONSTAT_BC_TRICKLE_CHARGING 3
#define UCSI_CONSTAT_PD_VERSION_V1_2 UCSI_DECLARE_BITFIELD_V1_2(70, 16)
+#define UCSI_CONSTAT_ORIENTATION UCSI_DECLARE_BITFIELD_V2_0(86, 1)
+#define UCSI_CONSTAT_ORIENTATION_NORMAL 0
+#define UCSI_CONSTAT_ORIENTATION_REVERSE 1
#define UCSI_CONSTAT_SINK_PATH_STATUS_V2_0 UCSI_DECLARE_BITFIELD_V2_0(87, 1)
#define UCSI_CONSTAT_SINK_PATH_DISABLED 0
#define UCSI_CONSTAT_SINK_PATH_ENABLED 1