Re: [PATCH v5 02/15] USB: typec: Add cmd timeout and response delay

From: Heikki Krogerus
Date: Mon Sep 18 2023 - 06:45:51 EST


On Sun, Sep 17, 2023 at 11:26:26AM -0400, Abdel Alkuor wrote:
> Some commands in tps25750 take longer than 1 second
> to complete, and some responses need some delay before
> the result becomes available.
>
> Signed-off-by: Abdel Alkuor <alkuor@xxxxxxxxx>
> ---
> drivers/usb/typec/tipd/core.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
> index 37b56ce75f39..a8aee4e1aeba 100644
> --- a/drivers/usb/typec/tipd/core.c
> +++ b/drivers/usb/typec/tipd/core.c
> @@ -284,7 +284,8 @@ static void tps6598x_disconnect(struct tps6598x *tps, u32 status)
>
> static int tps6598x_exec_cmd(struct tps6598x *tps, const char *cmd,
> size_t in_len, u8 *in_data,
> - size_t out_len, u8 *out_data)
> + size_t out_len, u8 *out_data,
> + u32 cmd_timeout_ms, u32 res_delay_ms)

It looks like 1s/0s is still the "default", so you could have just
made this old function a wrapper:

static int tps6598x_exec_cmd(struct tps6598x *tps, const char *cmd,
size_t in_len, u8 *in_data,
size_t out_len, u8 *out_data)
{
return tps6598x_exec_cmd_tmo(tps, cmd, in_len, in_data, out_len, out_data, 1000, 0);
}

thanks,

--
heikki