Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3788392imm; Mon, 18 Jun 2018 04:11:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJDWkGmF/QX+l+M8ZrhdNGd/cndqcsKzKjCOkcqsLPEBH18ISs+KcBScq0MiAQStOM4l+wE X-Received: by 2002:a65:4287:: with SMTP id j7-v6mr10669129pgp.144.1529320310645; Mon, 18 Jun 2018 04:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529320310; cv=none; d=google.com; s=arc-20160816; b=R8ncrNNPx7pQ9XHyOarNkmhA8qVrz3iV37cQSJQB4lrNYAzhdFOJ6f95pTbFGg0QWe 7m7CikwAzCij+F8mFC9mp13bUy2dO8dmCMflgFS+XiW1OrtHwM5NMXKT4YasunTWVwPt IhWJhCdVXIZRuElpgfFZTKCOLzZNAo04dNNTf8i/YH5rvmRpLBSMvNhF9aQGDQ568V+u +KMfY/89hd1a9/fneQZQ4Dp2CkmVxL4j2Eg+ngB+pUk8wrFY741qZ+c/Ni8bhK+5e2j1 S4EEVRs3QEb4ne9tXWVbZJmKObVZmkEKlPtL8UzkCtOJmjf9j0R4jYNXVyQtlt00EZRV 4S1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=REpTGbxd3huG+Ef8hUdaPWYSnuttne7ptcxjk1JByMg=; b=TlQhpEpAh79uqUi/VoTAf8uXV2/C4cQJJXRieCLsgUzRHzdyrI+2URNUWYNFCJuQKZ KFweM2G1h4eFs+laIiIP8crZau6EOXiJkf+MEah6ZZYf3ToyMrS36k9gCBarBDIHWeQS WhSLiLcIABcPFKvMTLFCD/PaKBMMgo5uCTfh2hC142rOHU6YIwPDd5tER6KvkiZh7t7H L0xVcMuCPQew0ZTXivSDTJWdc3Ubfh1BIMb5XaEJpx+GWu0IYJd6gwfioskwp3Lp69Bu hg6NSVM+RHF0q+f3Hhqciffdm8AbPIAzwS4SSCqSSWzdysWOUHphnUf6t1IS/V1cqubn onpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j189-v6si11717099pgd.657.2018.06.18.04.11.36; Mon, 18 Jun 2018 04:11:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936113AbeFRLHp (ORCPT + 99 others); Mon, 18 Jun 2018 07:07:45 -0400 Received: from mga07.intel.com ([134.134.136.100]:43897 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936057AbeFRLHh (ORCPT ); Mon, 18 Jun 2018 07:07:37 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jun 2018 04:07:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,238,1526367600"; d="scan'208";a="64113342" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 18 Jun 2018 04:07:30 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id AABF7553; Mon, 18 Jun 2018 14:07:31 +0300 (EEST) From: Mika Westerberg To: linux-kernel@vger.kernel.org Cc: Andreas Noever , Michael Jamet , Yehezkel Bernat , Lukas Wunner , "Rafael J. Wysocki" , Christian Kellner , Mario Limonciello , Mika Westerberg Subject: [PATCH 4/5] thunderbolt: Use correct ICM commands in system suspend Date: Mon, 18 Jun 2018 14:07:30 +0300 Message-Id: <20180618110731.57427-5-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618110731.57427-1-mika.westerberg@linux.intel.com> References: <20180618110731.57427-1-mika.westerberg@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/thunderbolt/icm.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c index ad4eeaa59b16..5ed3f8a31b0a 100644 --- a/drivers/thunderbolt/icm.c +++ b/drivers/thunderbolt/icm.c @@ -60,6 +60,7 @@ * @is_supported: Checks if we can support ICM on this controller * @get_mode: Read and return the ICM firmware mode (optional) * @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 * @device_connected: Handle device connected ICM message * @device_disconnected: Handle device disconnected ICM message @@ -76,6 +77,7 @@ struct icm { bool (*is_supported)(struct tb *tb); int (*get_mode)(struct tb *tb); int (*get_route)(struct tb *tb, u8 link, u8 depth, u64 *route); + void (*save_devices)(struct tb *tb); int (*driver_ready)(struct tb *tb, enum tb_security_level *security_level, size_t *nboot_acl); @@ -258,6 +260,11 @@ static int icm_fr_get_route(struct tb *tb, u8 link, u8 depth, u64 *route) return ret; } +static void icm_fr_save_devices(struct tb *tb) +{ + nhi_mailbox_cmd(tb->nhi, NHI_MAILBOX_SAVE_DEVS, 0); +} + static int icm_fr_driver_ready(struct tb *tb, enum tb_security_level *security_level, size_t *nboot_acl) @@ -1665,13 +1672,12 @@ static int icm_driver_ready(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 (ret) - tb_info(tb, "Ignoring mailbox command error (%d) in %s\n", - ret, __func__); + if (icm->save_devices) + icm->save_devices(tb); + nhi_mailbox_cmd(tb->nhi, NHI_MAILBOX_DRV_UNLOADS, 0); return 0; } @@ -1879,6 +1885,7 @@ struct tb *icm_probe(struct tb_nhi *nhi) case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI: icm->is_supported = icm_fr_is_supported; icm->get_route = icm_fr_get_route; + icm->save_devices = icm_fr_save_devices; icm->driver_ready = icm_fr_driver_ready; icm->device_connected = icm_fr_device_connected; icm->device_disconnected = icm_fr_device_disconnected; @@ -1896,6 +1903,7 @@ struct tb *icm_probe(struct tb_nhi *nhi) icm->is_supported = icm_ar_is_supported; icm->get_mode = icm_ar_get_mode; icm->get_route = icm_ar_get_route; + icm->save_devices = icm_fr_save_devices; icm->driver_ready = icm_ar_driver_ready; icm->device_connected = icm_fr_device_connected; icm->device_disconnected = icm_fr_device_disconnected; -- 2.17.1