Skip to content

Commit

Permalink
platform/chrome: cros_ec_typec: Make try power role optional
Browse files Browse the repository at this point in the history
Some boards prefer not to specify a try-power-role. Update the port
property parsing logic to not error out in case a try-power-role is not
specified.

Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Prashant Malani <pmalani@chromium.org>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/chrome-platform/20220127191659.3560810-1-pmalani@chromium.org/
  • Loading branch information
Prashant Malani committed Jan 31, 2022
1 parent 664de6a commit 53eeb07
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions drivers/platform/chrome/cros_ec_typec.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,18 @@ static int cros_typec_parse_port_props(struct typec_capability *cap,
return ret;
cap->data = ret;

/* Try-power-role is optional. */
ret = fwnode_property_read_string(fwnode, "try-power-role", &buf);
if (ret) {
dev_err(dev, "try-power-role not found: %d\n", ret);
return ret;
dev_warn(dev, "try-power-role not found: %d\n", ret);
cap->prefer_role = TYPEC_NO_PREFERRED_ROLE;
} else {
ret = typec_find_power_role(buf);
if (ret < 0)
return ret;
cap->prefer_role = ret;
}

ret = typec_find_power_role(buf);
if (ret < 0)
return ret;
cap->prefer_role = ret;

cap->fwnode = fwnode;

return 0;
Expand Down

0 comments on commit 53eeb07

Please sign in to comment.