Skip to content

Commit d04522f

Browse files
westerigregkh
authored andcommitted
thunderbolt: Use correct ICM commands in system suspend
The correct way to put the ICM into suspend state is to send it NHI_MAILBOX_DRV_UNLOADS mailbox command. NHI_MAILBOX_SAVE_DEVS is not needed on Intel Titan Ridge so we can skip it. Signed-off-by: Mika Westerberg <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 84db685 commit d04522f

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

drivers/thunderbolt/icm.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
* @is_supported: Checks if we can support ICM on this controller
6161
* @get_mode: Read and return the ICM firmware mode (optional)
6262
* @get_route: Find a route string for given switch
63+
* @save_devices: Ask ICM to save devices to ACL when suspending (optional)
6364
* @driver_ready: Send driver ready message to ICM
6465
* @device_connected: Handle device connected ICM message
6566
* @device_disconnected: Handle device disconnected ICM message
@@ -76,6 +77,7 @@ struct icm {
7677
bool (*is_supported)(struct tb *tb);
7778
int (*get_mode)(struct tb *tb);
7879
int (*get_route)(struct tb *tb, u8 link, u8 depth, u64 *route);
80+
void (*save_devices)(struct tb *tb);
7981
int (*driver_ready)(struct tb *tb,
8082
enum tb_security_level *security_level,
8183
size_t *nboot_acl);
@@ -258,6 +260,11 @@ static int icm_fr_get_route(struct tb *tb, u8 link, u8 depth, u64 *route)
258260
return ret;
259261
}
260262

263+
static void icm_fr_save_devices(struct tb *tb)
264+
{
265+
nhi_mailbox_cmd(tb->nhi, NHI_MAILBOX_SAVE_DEVS, 0);
266+
}
267+
261268
static int
262269
icm_fr_driver_ready(struct tb *tb, enum tb_security_level *security_level,
263270
size_t *nboot_acl)
@@ -1665,13 +1672,12 @@ static int icm_driver_ready(struct tb *tb)
16651672

16661673
static int icm_suspend(struct tb *tb)
16671674
{
1668-
int ret;
1675+
struct icm *icm = tb_priv(tb);
16691676

1670-
ret = nhi_mailbox_cmd(tb->nhi, NHI_MAILBOX_SAVE_DEVS, 0);
1671-
if (ret)
1672-
tb_info(tb, "Ignoring mailbox command error (%d) in %s\n",
1673-
ret, __func__);
1677+
if (icm->save_devices)
1678+
icm->save_devices(tb);
16741679

1680+
nhi_mailbox_cmd(tb->nhi, NHI_MAILBOX_DRV_UNLOADS, 0);
16751681
return 0;
16761682
}
16771683

@@ -1879,6 +1885,7 @@ struct tb *icm_probe(struct tb_nhi *nhi)
18791885
case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI:
18801886
icm->is_supported = icm_fr_is_supported;
18811887
icm->get_route = icm_fr_get_route;
1888+
icm->save_devices = icm_fr_save_devices;
18821889
icm->driver_ready = icm_fr_driver_ready;
18831890
icm->device_connected = icm_fr_device_connected;
18841891
icm->device_disconnected = icm_fr_device_disconnected;
@@ -1896,6 +1903,7 @@ struct tb *icm_probe(struct tb_nhi *nhi)
18961903
icm->is_supported = icm_ar_is_supported;
18971904
icm->get_mode = icm_ar_get_mode;
18981905
icm->get_route = icm_ar_get_route;
1906+
icm->save_devices = icm_fr_save_devices;
18991907
icm->driver_ready = icm_ar_driver_ready;
19001908
icm->device_connected = icm_fr_device_connected;
19011909
icm->device_disconnected = icm_fr_device_disconnected;

0 commit comments

Comments
 (0)