Lines Matching defs:con

33 static int ucsi_psy_get_scope(struct ucsi_connector *con,
37 struct device *dev = con->ucsi->dev;
44 if (con->ucsi->cap.attributes & mask)
53 static int ucsi_psy_get_online(struct ucsi_connector *con,
57 if (con->status.flags & UCSI_CONSTAT_CONNECTED &&
58 (con->status.flags & UCSI_CONSTAT_PWR_DIR) == TYPEC_SINK)
63 static int ucsi_psy_get_voltage_min(struct ucsi_connector *con,
68 switch (UCSI_CONSTAT_PWR_OPMODE(con->status.flags)) {
70 pdo = con->src_pdos[0];
86 static int ucsi_psy_get_voltage_max(struct ucsi_connector *con,
91 switch (UCSI_CONSTAT_PWR_OPMODE(con->status.flags)) {
93 if (con->num_pdos > 0) {
94 pdo = con->src_pdos[con->num_pdos - 1];
113 static int ucsi_psy_get_voltage_now(struct ucsi_connector *con,
119 switch (UCSI_CONSTAT_PWR_OPMODE(con->status.flags)) {
121 index = rdo_index(con->rdo);
123 pdo = con->src_pdos[index - 1];
142 static int ucsi_psy_get_current_max(struct ucsi_connector *con,
147 switch (UCSI_CONSTAT_PWR_OPMODE(con->status.flags)) {
149 if (con->num_pdos > 0) {
150 pdo = con->src_pdos[con->num_pdos - 1];
172 static int ucsi_psy_get_current_now(struct ucsi_connector *con,
175 u16 flags = con->status.flags;
178 val->intval = rdo_op_current(con->rdo) * 1000;
184 static int ucsi_psy_get_usb_type(struct ucsi_connector *con,
187 u16 flags = con->status.flags;
201 struct ucsi_connector *con = power_supply_get_drvdata(psy);
205 return ucsi_psy_get_usb_type(con, val);
207 return ucsi_psy_get_online(con, val);
209 return ucsi_psy_get_voltage_min(con, val);
211 return ucsi_psy_get_voltage_max(con, val);
213 return ucsi_psy_get_voltage_now(con, val);
215 return ucsi_psy_get_current_max(con, val);
217 return ucsi_psy_get_current_now(con, val);
219 return ucsi_psy_get_scope(con, val);
231 int ucsi_register_port_psy(struct ucsi_connector *con)
234 struct device *dev = con->ucsi->dev;
237 psy_cfg.drv_data = con;
241 dev_name(dev), con->num);
245 con->psy_desc.name = psy_name;
246 con->psy_desc.type = POWER_SUPPLY_TYPE_USB;
247 con->psy_desc.usb_types = ucsi_psy_usb_types;
248 con->psy_desc.num_usb_types = ARRAY_SIZE(ucsi_psy_usb_types);
249 con->psy_desc.properties = ucsi_psy_props;
250 con->psy_desc.num_properties = ARRAY_SIZE(ucsi_psy_props);
251 con->psy_desc.get_property = ucsi_psy_get_prop;
253 con->psy = power_supply_register(dev, &con->psy_desc, &psy_cfg);
255 return PTR_ERR_OR_ZERO(con->psy);
258 void ucsi_unregister_port_psy(struct ucsi_connector *con)
260 if (IS_ERR_OR_NULL(con->psy))
263 power_supply_unregister(con->psy);
264 con->psy = NULL;
267 void ucsi_port_psy_changed(struct ucsi_connector *con)
269 if (IS_ERR_OR_NULL(con->psy))
272 power_supply_changed(con->psy);