Lines Matching refs:alt

248 	/* Bind the port alt mode to the partner/plug alt mode. */
252 /* Bind the partner/plug alt mode to the port alt mode. */
316 * @alt: The Alternate Mode
318 * Returns handle to the port that a cable plug or partner with @alt is
321 struct typec_port *typec_altmode2port(struct typec_altmode *alt)
323 if (is_typec_plug(alt->dev.parent))
324 return to_typec_port(alt->dev.parent->parent->parent);
325 if (is_typec_partner(alt->dev.parent))
326 return to_typec_port(alt->dev.parent->parent);
327 if (is_typec_port(alt->dev.parent))
328 return to_typec_port(alt->dev.parent);
337 struct typec_altmode *alt = to_typec_altmode(dev);
339 return sprintf(buf, "0x%08x\n", alt->vdo);
346 struct typec_altmode *alt = to_typec_altmode(dev);
348 return sprintf(buf, "%s\n", alt->desc ? alt->desc : "");
355 struct typec_altmode *alt = to_typec_altmode(dev);
357 return sprintf(buf, "%s\n", alt->active ? "yes" : "no");
403 struct altmode *alt = to_altmode(to_typec_altmode(dev));
406 switch (alt->roles) {
500 struct altmode *alt = to_altmode(to_typec_altmode(dev));
503 typec_altmode_put_partner(alt);
505 altmode_id_remove(alt->adev.dev.parent, alt->id);
506 kfree(alt);
521 struct altmode *alt;
524 alt = kzalloc(sizeof(*alt), GFP_KERNEL);
525 if (!alt) {
530 alt->adev.svid = desc->svid;
531 alt->adev.mode = desc->mode;
532 alt->adev.vdo = desc->vdo;
533 alt->roles = desc->roles;
534 alt->id = id;
536 alt->attrs[0] = &dev_attr_vdo.attr;
537 alt->attrs[1] = &dev_attr_description.attr;
538 alt->attrs[2] = &dev_attr_active.attr;
541 alt->attrs[3] = &dev_attr_supported_roles.attr;
542 alt->adev.active = true; /* Enabled by default */
545 sprintf(alt->group_name, "mode%d", desc->mode);
546 alt->group.name = alt->group_name;
547 alt->group.attrs = alt->attrs;
548 alt->groups[0] = &alt->group;
550 alt->adev.dev.parent = parent;
551 alt->adev.dev.groups = alt->groups;
552 alt->adev.dev.type = &typec_altmode_dev_type;
553 dev_set_name(&alt->adev.dev, "%s.%u", dev_name(parent), id);
557 typec_altmode_set_partner(alt);
561 alt->adev.dev.bus = &typec_bus;
563 /* Plug alt modes need a class to generate udev events. */
565 alt->adev.dev.class = &typec_class;
567 ret = device_register(&alt->adev.dev);
571 put_device(&alt->adev.dev);
575 return &alt->adev;
2279 struct typec_altmode *alt;
2313 alt = typec_port_register_altmode(port, &desc);
2314 if (IS_ERR(alt)) {
2320 alt->ops = ops;
2321 typec_altmode_set_drvdata(alt, drvdata);
2322 altmodes[index] = alt;
2331 * @max_altmodes: The maximum number of alt modes supported by the port