mirror of
https://github.com/torvalds/linux.git
synced 2026-10-10 12:28:02 +02:00
usb: typec: ps883x: fix configuration error handling
Propagate errors to the consumers when configuring the retimer so that
they can act on any failures as intended, for example:
ps883x_retimer 2-0008: failed to write conn_status_0: -5
pmic_glink_altmode.pmic_glink_altmode pmic_glink.altmode.0: failed to setup retimer to DP: -5
Fixes: 257a087c8b ("usb: typec: Add support for Parade PS8830 Type-C Retimer")
Cc: Abel Vesa <abel.vesa@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20250218152933.22992-4-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9e7968c442
commit
21b1aea451
|
|
@ -58,12 +58,31 @@ struct ps883x_retimer {
|
|||
unsigned int svid;
|
||||
};
|
||||
|
||||
static void ps883x_configure(struct ps883x_retimer *retimer, int cfg0,
|
||||
int cfg1, int cfg2)
|
||||
static int ps883x_configure(struct ps883x_retimer *retimer, int cfg0,
|
||||
int cfg1, int cfg2)
|
||||
{
|
||||
regmap_write(retimer->regmap, REG_USB_PORT_CONN_STATUS_0, cfg0);
|
||||
regmap_write(retimer->regmap, REG_USB_PORT_CONN_STATUS_1, cfg1);
|
||||
regmap_write(retimer->regmap, REG_USB_PORT_CONN_STATUS_2, cfg2);
|
||||
struct device *dev = &retimer->client->dev;
|
||||
int ret;
|
||||
|
||||
ret = regmap_write(retimer->regmap, REG_USB_PORT_CONN_STATUS_0, cfg0);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to write conn_status_0: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = regmap_write(retimer->regmap, REG_USB_PORT_CONN_STATUS_1, cfg1);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to write conn_status_1: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = regmap_write(retimer->regmap, REG_USB_PORT_CONN_STATUS_2, cfg2);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to write conn_status_2: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ps883x_set(struct ps883x_retimer *retimer)
|
||||
|
|
@ -74,8 +93,7 @@ static int ps883x_set(struct ps883x_retimer *retimer)
|
|||
|
||||
if (retimer->orientation == TYPEC_ORIENTATION_NONE ||
|
||||
retimer->mode == TYPEC_STATE_SAFE) {
|
||||
ps883x_configure(retimer, cfg0, cfg1, cfg2);
|
||||
return 0;
|
||||
return ps883x_configure(retimer, cfg0, cfg1, cfg2);
|
||||
}
|
||||
|
||||
if (retimer->mode != TYPEC_STATE_USB && retimer->svid != USB_TYPEC_DP_SID)
|
||||
|
|
@ -113,9 +131,7 @@ static int ps883x_set(struct ps883x_retimer *retimer)
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
ps883x_configure(retimer, cfg0, cfg1, cfg2);
|
||||
|
||||
return 0;
|
||||
return ps883x_configure(retimer, cfg0, cfg1, cfg2);
|
||||
}
|
||||
|
||||
static int ps883x_sw_set(struct typec_switch_dev *sw,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user