mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 23:13:01 +02:00
usb: typec: Only use SVID for matching altmodes
Mode in struct typec_altmode is used to indicate the index of the altmode on a port, partner or plug. It is used in enter mode VDMs but doesn't make much sense for matching against altmode drivers or for matching partner to port altmodes. Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Benson Leung <bleung@chromium.org> Link: https://lore.kernel.org/r/20241213153543.v5.1.Ie0d37646f18461234777d88b4c3e21faed92ed4f@changeid Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1ff24d40b3
commit
8541bf0239
|
@ -791,7 +791,7 @@ void dp_altmode_remove(struct typec_altmode *alt)
|
||||||
EXPORT_SYMBOL_GPL(dp_altmode_remove);
|
EXPORT_SYMBOL_GPL(dp_altmode_remove);
|
||||||
|
|
||||||
static const struct typec_device_id dp_typec_id[] = {
|
static const struct typec_device_id dp_typec_id[] = {
|
||||||
{ USB_TYPEC_DP_SID, USB_TYPEC_DP_MODE },
|
{ USB_TYPEC_DP_SID },
|
||||||
{ },
|
{ },
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(typec, dp_typec_id);
|
MODULE_DEVICE_TABLE(typec, dp_typec_id);
|
||||||
|
|
|
@ -24,7 +24,7 @@ static void nvidia_altmode_remove(struct typec_altmode *alt)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct typec_device_id nvidia_typec_id[] = {
|
static const struct typec_device_id nvidia_typec_id[] = {
|
||||||
{ USB_TYPEC_NVIDIA_VLINK_SID, TYPEC_ANY_MODE },
|
{ USB_TYPEC_NVIDIA_VLINK_SID },
|
||||||
{ },
|
{ },
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(typec, nvidia_typec_id);
|
MODULE_DEVICE_TABLE(typec, nvidia_typec_id);
|
||||||
|
|
|
@ -454,8 +454,7 @@ static int typec_match(struct device *dev, const struct device_driver *driver)
|
||||||
const struct typec_device_id *id;
|
const struct typec_device_id *id;
|
||||||
|
|
||||||
for (id = drv->id_table; id->svid; id++)
|
for (id = drv->id_table; id->svid; id++)
|
||||||
if (id->svid == altmode->svid &&
|
if (id->svid == altmode->svid)
|
||||||
(id->mode == TYPEC_ANY_MODE || id->mode == altmode->mode))
|
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -470,8 +469,7 @@ static int typec_uevent(const struct device *dev, struct kobj_uevent_env *env)
|
||||||
if (add_uevent_var(env, "MODE=%u", altmode->mode))
|
if (add_uevent_var(env, "MODE=%u", altmode->mode))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
return add_uevent_var(env, "MODALIAS=typec:id%04Xm%02X",
|
return add_uevent_var(env, "MODALIAS=typec:id%04X", altmode->svid);
|
||||||
altmode->svid, altmode->mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int typec_altmode_create_links(struct altmode *alt)
|
static int typec_altmode_create_links(struct altmode *alt)
|
||||||
|
|
|
@ -237,13 +237,13 @@ static int altmode_match(struct device *dev, void *data)
|
||||||
if (!is_typec_altmode(dev))
|
if (!is_typec_altmode(dev))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return ((adev->svid == id->svid) && (adev->mode == id->mode));
|
return (adev->svid == id->svid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void typec_altmode_set_partner(struct altmode *altmode)
|
static void typec_altmode_set_partner(struct altmode *altmode)
|
||||||
{
|
{
|
||||||
struct typec_altmode *adev = &altmode->adev;
|
struct typec_altmode *adev = &altmode->adev;
|
||||||
struct typec_device_id id = { adev->svid, adev->mode, };
|
struct typec_device_id id = { adev->svid };
|
||||||
struct typec_port *port = typec_altmode2port(adev);
|
struct typec_port *port = typec_altmode2port(adev);
|
||||||
struct altmode *partner;
|
struct altmode *partner;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
|
|
@ -237,7 +237,6 @@ int main(void)
|
||||||
|
|
||||||
DEVID(typec_device_id);
|
DEVID(typec_device_id);
|
||||||
DEVID_FIELD(typec_device_id, svid);
|
DEVID_FIELD(typec_device_id, svid);
|
||||||
DEVID_FIELD(typec_device_id, mode);
|
|
||||||
|
|
||||||
DEVID(tee_client_device_id);
|
DEVID(tee_client_device_id);
|
||||||
DEVID_FIELD(tee_client_device_id, uuid);
|
DEVID_FIELD(tee_client_device_id, uuid);
|
||||||
|
|
|
@ -1221,17 +1221,12 @@ static void do_tbsvc_entry(struct module *mod, void *symval)
|
||||||
module_alias_printf(mod, true, "tbsvc:%s", alias);
|
module_alias_printf(mod, true, "tbsvc:%s", alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Looks like: typec:idNmN */
|
/* Looks like: typec:idN */
|
||||||
static void do_typec_entry(struct module *mod, void *symval)
|
static void do_typec_entry(struct module *mod, void *symval)
|
||||||
{
|
{
|
||||||
char alias[256] = {};
|
|
||||||
|
|
||||||
DEF_FIELD(symval, typec_device_id, svid);
|
DEF_FIELD(symval, typec_device_id, svid);
|
||||||
DEF_FIELD(symval, typec_device_id, mode);
|
|
||||||
|
|
||||||
ADD(alias, "m", mode != TYPEC_ANY_MODE, mode);
|
module_alias_printf(mod, false, "typec:id%04X", svid);
|
||||||
|
|
||||||
module_alias_printf(mod, false, "typec:id%04X%s", svid, alias);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Looks like: tee:uuid */
|
/* Looks like: tee:uuid */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user