Commit d04522fa authored by Mika Westerberg's avatar Mika Westerberg Committed by Greg Kroah-Hartman

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: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 84db6858
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
* @is_supported: Checks if we can support ICM on this controller * @is_supported: Checks if we can support ICM on this controller
* @get_mode: Read and return the ICM firmware mode (optional) * @get_mode: Read and return the ICM firmware mode (optional)
* @get_route: Find a route string for given switch * @get_route: Find a route string for given switch
* @save_devices: Ask ICM to save devices to ACL when suspending (optional)
* @driver_ready: Send driver ready message to ICM * @driver_ready: Send driver ready message to ICM
* @device_connected: Handle device connected ICM message * @device_connected: Handle device connected ICM message
* @device_disconnected: Handle device disconnected ICM message * @device_disconnected: Handle device disconnected ICM message
...@@ -76,6 +77,7 @@ struct icm { ...@@ -76,6 +77,7 @@ struct icm {
bool (*is_supported)(struct tb *tb); bool (*is_supported)(struct tb *tb);
int (*get_mode)(struct tb *tb); int (*get_mode)(struct tb *tb);
int (*get_route)(struct tb *tb, u8 link, u8 depth, u64 *route); int (*get_route)(struct tb *tb, u8 link, u8 depth, u64 *route);
void (*save_devices)(struct tb *tb);
int (*driver_ready)(struct tb *tb, int (*driver_ready)(struct tb *tb,
enum tb_security_level *security_level, enum tb_security_level *security_level,
size_t *nboot_acl); size_t *nboot_acl);
...@@ -258,6 +260,11 @@ static int icm_fr_get_route(struct tb *tb, u8 link, u8 depth, u64 *route) ...@@ -258,6 +260,11 @@ static int icm_fr_get_route(struct tb *tb, u8 link, u8 depth, u64 *route)
return ret; return ret;
} }
static void icm_fr_save_devices(struct tb *tb)
{
nhi_mailbox_cmd(tb->nhi, NHI_MAILBOX_SAVE_DEVS, 0);
}
static int static int
icm_fr_driver_ready(struct tb *tb, enum tb_security_level *security_level, icm_fr_driver_ready(struct tb *tb, enum tb_security_level *security_level,
size_t *nboot_acl) size_t *nboot_acl)
...@@ -1665,13 +1672,12 @@ static int icm_driver_ready(struct tb *tb) ...@@ -1665,13 +1672,12 @@ static int icm_driver_ready(struct tb *tb)
static int icm_suspend(struct tb *tb) static int icm_suspend(struct tb *tb)
{ {
int ret; struct icm *icm = tb_priv(tb);
ret = nhi_mailbox_cmd(tb->nhi, NHI_MAILBOX_SAVE_DEVS, 0); if (icm->save_devices)
if (ret) icm->save_devices(tb);
tb_info(tb, "Ignoring mailbox command error (%d) in %s\n",
ret, __func__);
nhi_mailbox_cmd(tb->nhi, NHI_MAILBOX_DRV_UNLOADS, 0);
return 0; return 0;
} }
...@@ -1879,6 +1885,7 @@ struct tb *icm_probe(struct tb_nhi *nhi) ...@@ -1879,6 +1885,7 @@ struct tb *icm_probe(struct tb_nhi *nhi)
case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI: case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI:
icm->is_supported = icm_fr_is_supported; icm->is_supported = icm_fr_is_supported;
icm->get_route = icm_fr_get_route; icm->get_route = icm_fr_get_route;
icm->save_devices = icm_fr_save_devices;
icm->driver_ready = icm_fr_driver_ready; icm->driver_ready = icm_fr_driver_ready;
icm->device_connected = icm_fr_device_connected; icm->device_connected = icm_fr_device_connected;
icm->device_disconnected = icm_fr_device_disconnected; icm->device_disconnected = icm_fr_device_disconnected;
...@@ -1896,6 +1903,7 @@ struct tb *icm_probe(struct tb_nhi *nhi) ...@@ -1896,6 +1903,7 @@ struct tb *icm_probe(struct tb_nhi *nhi)
icm->is_supported = icm_ar_is_supported; icm->is_supported = icm_ar_is_supported;
icm->get_mode = icm_ar_get_mode; icm->get_mode = icm_ar_get_mode;
icm->get_route = icm_ar_get_route; icm->get_route = icm_ar_get_route;
icm->save_devices = icm_fr_save_devices;
icm->driver_ready = icm_ar_driver_ready; icm->driver_ready = icm_ar_driver_ready;
icm->device_connected = icm_fr_device_connected; icm->device_connected = icm_fr_device_connected;
icm->device_disconnected = icm_fr_device_disconnected; icm->device_disconnected = icm_fr_device_disconnected;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment