Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp7352lqo; Wed, 15 May 2024 18:33:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU8fFKGGX34+vjRgt9Bw6muEZ5x2vhs6vSD+D2ZKwNix3o/VFa4n16DvV51qeSLj4MwLVKV9OnkRdA66WqjdZYH8UeEbiwbEugdKkTqVA== X-Google-Smtp-Source: AGHT+IHzJ4bs75PagF1M0XrHHqDUvzacuFaye0/8nXtgGd1z9YjiHgK+Q3QH2+VOKOodVRSVHk9I X-Received: by 2002:a17:906:29cf:b0:a59:ab57:7413 with SMTP id a640c23a62f3a-a5a2d680d65mr1049444766b.73.1715823209391; Wed, 15 May 2024 18:33:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715823209; cv=pass; d=google.com; s=arc-20160816; b=gb97z/lnCv+nbdYX3w+QHyMPwtsLUH5JFVjlMzO2Ofxr/FIt0PJ3hd5qorTjSspX7/ rtr09UERgqPhPHMhyZQKDQ/VTs5Ifum75jiDnfELt/VDb8aYOmAB9gkNgRBUl+zdRTZ6 5OUciekSYnrXDyD5tjv087HJrUAqw5YNi+DC9KZ67wclH7mQgl6K/e07puzeKqm7w8+T /BZA81PFJhQ5zyimtNiglkj14Rkeqc+6XA1FRyXFukjuRAGxXoklYdOo1vYWX8ch7weD 0qqdh8K04aL3UhmV3em0XXhHjnYqWUJqrjHqjFEIkGfXFV0TCgrMjkNlZ6lChG0vnrZp sn4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=DEQoKiV/NYceNsmUWMvPVMAKKThHH4nVklJ9PVQVIlI=; fh=bThrsKpckkRCT/vlqjCUU4BimTH7D9xKkW9kJFd97oo=; b=R1xKG8Hrkf8Qn1q/wxxxV3jycclYHTPlP4Dz/MaQbvE5VpHzglzP2xOegKTrQ/qWtW bflOJyS/OzcCsDoP5kzlYWkiN1OITyCmlfcsoBbbU0CshRKBLDHXKtKAcg146BbIRbW8 8bTUF6vYWsn9b7Q6f2XrPb9WxM1Cd7FvgWBvbcZThKTB0Ez7GY03WwdD5y62vPbu1PW7 IpJq/fGwHYsFywRgTxiobbaP2B//HBLvrTcsLyEn9yUM8XHhVqHlPiSVPOnSlgLmSjb0 PD163yKJY/WaWC7OdXTr7ZkFei/Rgkx+05toOnQ2AJc4DNgmS5fjuoHp7kwYfSJx+W9t m1eA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LwEaGJP6; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-180548-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180548-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17ba3b76si832138766b.631.2024.05.15.18.33.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 18:33:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180548-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LwEaGJP6; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-180548-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180548-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 274BB1F22138 for ; Thu, 16 May 2024 01:33:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BEBB0138C; Thu, 16 May 2024 01:33:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="LwEaGJP6" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73DE2EBB; Thu, 16 May 2024 01:33:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715823201; cv=none; b=T+RHPn9M27XXexQYOV4GbwjFOA80Z6Ad3jfabZTtjHT2BIkn2u9Kti++j+l8Z/kDKA0TcKNB+BhzoksqnRqMtNGDJU4m7L6c0cewSHdjOcmWedoJAW9k+QvcKJN6FBSFJZYjwnooF7tQ1MuF7g+2xtmVZbZn+8PtNK8UOiDJNI0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715823201; c=relaxed/simple; bh=L/MSeE85WwDv+k9wnUzILdJTM7kfnpnvNhjH6yhtOPw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ZSGDvD2X0kOHFPGEDJQRkIv8ozDtB7tIa5jFKDhenenOWTQ5JYJP+u3GR9+nP+OvLcTXxltVHY8jjph+OqJOp9+UsyDXxE3q48yMOGV5tig1+gQ6LS1TJTKSCorkPd3ABAUllr8eGzvU7poSTxtibCN09kmWrOeTp03Js0KKNB0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=LwEaGJP6; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715823200; x=1747359200; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=L/MSeE85WwDv+k9wnUzILdJTM7kfnpnvNhjH6yhtOPw=; b=LwEaGJP60KYbkjK36GlxJyLswavXQtapRPu92PeLejKGcvecuJOmKY2G dCaJwVigubM04DJ1YvX4Qdt8hSc0m8FZlhjwEp+ZgyIOnU3v6j43GrUSy rw/Xsh9s50SzRDTVJwzwu2jS4tH3DbQhP4qAkmVkhJCpYNUSyeCR0uyXY +DGvAlmroobBXbmOPsGlAjiNnl3FDfUebKaYCm3chl7cRd4Tkz1UmfjGl 0pMlN6MN6oc3RhNOXSShju8yYNcmenoHK61XRQl0z2kHqChr+A4T4qrQ1 RGI14TaU90AhAkMDshujj6Q4LBspCz3uR9+acCLdyV/4PBfqgcBm26gxP w==; X-CSE-ConnectionGUID: jz019q2SQsK2VkUMwAJW7w== X-CSE-MsgGUID: QCi6LtSgRtu5p1lSByaB7A== X-IronPort-AV: E=McAfee;i="6600,9927,11074"; a="15686570" X-IronPort-AV: E=Sophos;i="6.08,163,1712646000"; d="scan'208";a="15686570" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 May 2024 18:33:19 -0700 X-CSE-ConnectionGUID: sRUhUOvISA6D5GZbceR8Hw== X-CSE-MsgGUID: zYNpDQmeRn+ekVV0I9yNSQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,163,1712646000"; d="scan'208";a="35977510" Received: from wentongw-optiplex-8070.sh.intel.com ([10.239.154.12]) by orviesa003.jf.intel.com with ESMTP; 15 May 2024 18:33:17 -0700 From: Wentong Wu To: sakari.ailus@linux.intel.com, tomas.winkler@intel.com, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, hao.yao@intel.com, Wentong Wu , stable@vger.kernel.org, Jason Chen Subject: [PATCH] mei: vsc: Don't stop/restart mei device during system suspend/resume Date: Thu, 16 May 2024 09:54:00 +0800 Message-Id: <20240516015400.3281634-1-wentong.wu@intel.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The dynamically created mei client device (mei csi) is used as one V4L2 sub device of the whole video pipeline, and the V4L2 connection graph is built by software node. The mei_stop() and mei_restart() will delete the old mei csi client device and create a new mei client device, which will cause the software node information saved in old mei csi device lost and the whole video pipeline will be broken. Removing mei_stop()/mei_restart() during system suspend/resume can fix the issue above and won't impact hardware actual power saving logic. Fixes: 386a766c4169 ("mei: Add MEI hardware support for IVSC device") Cc: stable@vger.kernel.org # for 6.8+ Reported-by: Hao Yao Signed-off-by: Wentong Wu Tested-by: Jason Chen --- drivers/misc/mei/platform-vsc.c | 39 +++++++++++++-------------------- 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/drivers/misc/mei/platform-vsc.c b/drivers/misc/mei/platform-vsc.c index b543e6b9f3cf..1ec65d87488a 100644 --- a/drivers/misc/mei/platform-vsc.c +++ b/drivers/misc/mei/platform-vsc.c @@ -399,41 +399,32 @@ static void mei_vsc_remove(struct platform_device *pdev) static int mei_vsc_suspend(struct device *dev) { - struct mei_device *mei_dev = dev_get_drvdata(dev); - struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev); + struct mei_device *mei_dev; + int ret = 0; - mei_stop(mei_dev); + mei_dev = dev_get_drvdata(dev); + if (!mei_dev) + return -ENODEV; - mei_disable_interrupts(mei_dev); + mutex_lock(&mei_dev->device_lock); - vsc_tp_free_irq(hw->tp); + if (!mei_write_is_idle(mei_dev)) + ret = -EAGAIN; - return 0; + mutex_unlock(&mei_dev->device_lock); + + return ret; } static int mei_vsc_resume(struct device *dev) { - struct mei_device *mei_dev = dev_get_drvdata(dev); - struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev); - int ret; - - ret = vsc_tp_request_irq(hw->tp); - if (ret) - return ret; - - ret = mei_restart(mei_dev); - if (ret) - goto err_free; + struct mei_device *mei_dev; - /* start timer if stopped in suspend */ - schedule_delayed_work(&mei_dev->timer_work, HZ); + mei_dev = dev_get_drvdata(dev); + if (!mei_dev) + return -ENODEV; return 0; - -err_free: - vsc_tp_free_irq(hw->tp); - - return ret; } static DEFINE_SIMPLE_DEV_PM_OPS(mei_vsc_pm_ops, mei_vsc_suspend, mei_vsc_resume); -- 2.34.1