Skip to content

Commit 5012965

Browse files
jfischer-nokartben
authored andcommitted
drivers: uhc_virtual: fix SOF timer handling
Do not necessarily call k_timer_init() in the uhc_bus_resume() implementation. Restart SOF timer after bus reset and in uhc_sof_enable() implementation. Signed-off-by: Johann Fischer <[email protected]>
1 parent 6e6c816 commit 5012965

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/usb/uhc/uhc_virtual.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,10 @@ static void uhc_vrt_uvb_cb(const void *const vrt_priv,
406406

407407
static int uhc_vrt_sof_enable(const struct device *dev)
408408
{
409-
/* TODO */
409+
struct uhc_vrt_data *priv = uhc_get_private(dev);
410+
411+
k_timer_start(&priv->sof_timer, K_MSEC(1), K_MSEC(1));
412+
410413
return 0;
411414
}
412415

@@ -423,17 +426,21 @@ static int uhc_vrt_bus_suspend(const struct device *dev)
423426
static int uhc_vrt_bus_reset(const struct device *dev)
424427
{
425428
struct uhc_vrt_data *priv = uhc_get_private(dev);
429+
int ret;
426430

427431
k_timer_stop(&priv->sof_timer);
432+
ret = uvb_advert(priv->host_node, UVB_EVT_RESET, NULL);
433+
/* TDRSTR */
434+
k_msleep(50);
435+
k_timer_start(&priv->sof_timer, K_MSEC(1), K_MSEC(1));
428436

429-
return uvb_advert(priv->host_node, UVB_EVT_RESET, NULL);
437+
return ret;
430438
}
431439

432440
static int uhc_vrt_bus_resume(const struct device *dev)
433441
{
434442
struct uhc_vrt_data *priv = uhc_get_private(dev);
435443

436-
k_timer_init(&priv->sof_timer, sof_timer_handler, NULL);
437444
k_timer_start(&priv->sof_timer, K_MSEC(1), K_MSEC(1));
438445

439446
return uvb_advert(priv->host_node, UVB_EVT_RESUME, NULL);

0 commit comments

Comments
 (0)