Lines Matching refs:plug

248 	/* Bind the port alt mode to the partner/plug alt mode. */
252 /* Bind the partner/plug alt mode to the port alt mode. */
254 struct typec_plug *plug = to_typec_plug(adev->dev.parent);
256 partner->plug[plug->index] = altmode;
275 struct typec_plug *plug = to_typec_plug(adev->dev.parent);
277 partner->plug[plug->index] = NULL;
289 * If a partner or cable plug executes Enter/Exit Mode command successfully, the
318 * Returns handle to the port that a cable plug or partner with @alt is
622 struct typec_plug *plug;
629 plug = to_typec_plug(dev);
630 num_altmodes = plug->num_altmodes;
961 struct typec_plug *plug = to_typec_plug(dev);
963 ida_destroy(&plug->mode_ids);
964 kfree(plug);
974 struct typec_plug *plug = to_typec_plug(kobj_to_dev(kobj));
977 if (plug->num_altmodes < 0)
1001 * typec_plug_set_num_altmodes - Set the number of available plug altmodes
1002 * @plug: The plug to be updated.
1006 * plug. This value is *not* enforced in alternate mode registration routines.
1008 * @plug.num_altmodes is set to -1 on plug registration, denoting that
1013 int typec_plug_set_num_altmodes(struct typec_plug *plug, int num_altmodes)
1020 plug->num_altmodes = num_altmodes;
1021 ret = sysfs_update_group(&plug->dev.kobj, &typec_plug_group);
1025 sysfs_notify(&plug->dev.kobj, NULL, "number_of_alternate_modes");
1026 kobject_uevent(&plug->dev.kobj, KOBJ_CHANGE);
1034 * @plug: USB Type-C Cable Plug that supports the alternate mode
1037 * This routine is used to register each alternate mode individually that @plug
1039 * the plug lists in response to Discover Modes command need to be listed in an
1045 typec_plug_register_altmode(struct typec_plug *plug,
1048 return typec_register_altmode(&plug->dev, desc);
1054 * @cable: USB Type-C Cable with the plug
1055 * @desc: Description of the cable plug
1058 * Cable Plug represents a plug with electronics in it that can response to USB
1061 * Returns handle to the cable plug on success or ERR_PTR on failure.
1066 struct typec_plug *plug;
1070 plug = kzalloc(sizeof(*plug), GFP_KERNEL);
1071 if (!plug)
1074 sprintf(name, "plug%d", desc->index);
1076 ida_init(&plug->mode_ids);
1077 plug->num_altmodes = -1;
1078 plug->index = desc->index;
1079 plug->dev.class = &typec_class;
1080 plug->dev.parent = &cable->dev;
1081 plug->dev.type = &typec_plug_dev_type;
1082 dev_set_name(&plug->dev, "%s-%s", dev_name(cable->dev.parent), name);
1084 ret = device_register(&plug->dev);
1086 dev_err(&cable->dev, "failed to register plug (%d)\n", ret);
1087 put_device(&plug->dev);
1091 return plug;
1097 * @plug: The cable plug to be unregistered
1101 void typec_unregister_plug(struct typec_plug *plug)
1103 if (!IS_ERR_OR_NULL(plug))
1104 device_unregister(&plug->dev);
1217 * parent for the optional cable plug devises.
2057 * typec_set_orientation - Set USB Type-C cable plug orientation
2059 * @orientation: USB Type-C cable plug orientation
2061 * Set cable plug orientation for @port.
2081 * typec_get_orientation - Get USB Type-C cable plug orientation
2084 * Get current cable plug orientation for @port.