platform/chrome: cros_typec_switch: Check for retimer flag

Not all ports have retimers. Only register a retimer switch if the
"retimer-switch" property is present for that port's mux
device.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20230104060846.112216-2-pmalani@chromium.org
This commit is contained in:
Prashant Malani 2023-01-04 06:08:45 +00:00
parent ef9c00dbd3
commit 441529bed4

View file

@ -246,13 +246,15 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata)
port->port_num = index;
sdata->ports[index] = port;
ret = cros_typec_register_retimer(port, fwnode);
if (ret) {
dev_err(dev, "Retimer switch register failed\n");
goto err_switch;
}
if (fwnode_property_present(fwnode, "retimer-switch")) {
ret = cros_typec_register_retimer(port, fwnode);
if (ret) {
dev_err(dev, "Retimer switch register failed\n");
goto err_switch;
}
dev_dbg(dev, "Retimer switch registered for index %llu\n", index);
dev_dbg(dev, "Retimer switch registered for index %llu\n", index);
}
if (!fwnode_property_present(fwnode, "mode-switch"))
continue;