Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp1005834lqp; Thu, 23 May 2024 06:40:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU6rgnctZSo3EI4Ldp6iF7nAL0rI77VdP7vZIPJAMq7kpbo4MMRnqOWGwkW7D934zd7V+VqDdVRoTvQi64GMt+J3ThTHIQZz7yNMnrfFA== X-Google-Smtp-Source: AGHT+IFxrq/l3OVt1bkLj0Cfl+mLAFF7TCD4MTCGzrz6YiREqcwCCYkDUsejyY1AooJPq8PbLYP9 X-Received: by 2002:ae9:e019:0:b0:793:1a75:1777 with SMTP id af79cd13be357-7949943d8b1mr548841985a.23.1716471630459; Thu, 23 May 2024 06:40:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716471630; cv=pass; d=google.com; s=arc-20160816; b=PwOF+Eq/gFQZIYg5ipR69n8953lgmQaQ1KqRc++C6TTfusL3F7MqJJ4B2iYtY6iBl4 pjx7Loc42eGAKMJat7Qvkg8WSdWcWydyMcuDjlhdztQNhR8wHLK9FYqOrMJW+PLJs5V0 9pJeF95hRTK4s6CGr2JU7KdTmyrCs2nH/uPQEFHJE7NfSaqImGDWvVgc9Hwr7fk4y5rt KxEoliEvG7XV41RUiHttrzlcaKx9+0MtnPGAUnQmHNnuOY+f4oOwCRz7lMgR7Vqfg/7t io7dpk5+KB8nYHkeKsoLyYrQ7jt5j3Cfa+HsoWfa9USeKLGM1f3gdIjJEPiEsoeT8ja/ 002A== 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=9e5GibDWgmAkizOAdzyIlsBbzaIB8w6okuqrwziib3o=; fh=6jdoPZKfaEp9nJnWp3I7a4fmbel8Doq5cGINJFPJzx0=; b=itSAKl2hWsdq9Mywf6EiTqPHgI6p2uKZrq/0MYJRXvq3k14JYRV+b6FMF9HWikBcXQ 0GfzlFyI8Nq8UyMEsHbOsXCmcKiDTD8otmqg0QYyGLhi1WO11vWwuCB/c98MAJM8tfeG vvAgD/cils0pZZSJVcjgewgyq0dV0kP+udrMgD3T0WX6QZAgKKpV9c8HOz9t7ppajdcb +B9SKNOlJj0/U6On0Jh3eUWiXbFX5kq7ApeAPMsSW0aGNgV2A2E9Eij4ayeLka2GnqSZ eLF0/q/9mMCwMIZZY7+0B2C3BJdF7E4ByxQpJLKUO+CI+d18pYdT8rz+bK6wySX2Vx4M tolg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NbVM5iVJ; 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-187589-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187589-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-792dc25d4a8si54043585a.285.2024.05.23.06.40.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 06:40:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187589-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NbVM5iVJ; 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-187589-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187589-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 2A50B1C22543 for ; Thu, 23 May 2024 13:40:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D2E9A14A606; Thu, 23 May 2024 13:40:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="NbVM5iVJ" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 C8D7F1E495; Thu, 23 May 2024 13:40:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716471624; cv=none; b=jtQ+BinNaxNqEbYqB9/voHwLwEzbNuAeq84DP7Xm+3g7t0gVN7g8F8qdCySyKFW6dbjMTA21nf4Dep8pJXKMgW+cgcN4rLWDbNZRj26KkjfojJspLKn6S6e8TCUM/Zmnhuyh8qbIILMqWQF8ptWVRNrc3przfKHCasCaRQkqhRc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716471624; c=relaxed/simple; bh=eYAHQBTLuS0nAWdW8Q2PeqwvoBoaWkUHPFim7U0bnT8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=nlaAsqb8r6Fo3MOFY7IYSLsDUJj6kF4YseeGwPffgveItI2zkeJZ+6/ES/QsOyJEDkYaOpvJPr+ocgAy6SKFRK/D1A45l6Yrlb0ACd+t1EttzmbYVt6mjlgtLizYVNs35ZFzBxwuQtM3QHUadGIIXRQ4PgjcbIeSQ+j9VxKBe+E= 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=NbVM5iVJ; arc=none smtp.client-ip=198.175.65.13 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=1716471622; x=1748007622; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=eYAHQBTLuS0nAWdW8Q2PeqwvoBoaWkUHPFim7U0bnT8=; b=NbVM5iVJ21Cn7uvEH/Q52QaPZsG2z2aN7gSNDoFPRGy/Yce9RApr3gTT SI547g6nbyrC8rdsKSnnmH2YXYncgMdfL49V2EoOPVLutxbvq22ReXUt+ zaQ6LXwIxoqNyLEXUViIosrhq2LucNc6U7U1oIcmTCTxBuOHkT2YZCoy7 VYLgIlpq5o3qbT8zmAKDFLN7J8uoW8X0y4L5qgm69kADofNyqBQvbMQgd uHBi7e3scN61vGQZzIwREPEMhI+J/OfRc4/zDHpiJcthzEuSGO0EOTJrQ qmHOGeLyFGQf0gtUDEsnv6RlltkgDNafhpnhVj9fN9In7MqoqsCJcHaNR Q==; X-CSE-ConnectionGUID: tdhyFOJYQvucsnR46v9GCQ== X-CSE-MsgGUID: d76Qtnz4ROaRtpbHFF6CZA== X-IronPort-AV: E=McAfee;i="6600,9927,11081"; a="23922490" X-IronPort-AV: E=Sophos;i="6.08,182,1712646000"; d="scan'208";a="23922490" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2024 06:40:20 -0700 X-CSE-ConnectionGUID: 60SQMP+GThCQJ+N0T81BXA== X-CSE-MsgGUID: 2UzRAYvsQhem3VM7pfn3oA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,182,1712646000"; d="scan'208";a="33740010" Received: from wentongw-optiplex-8070.sh.intel.com ([10.239.154.12]) by fmviesa009.fm.intel.com with ESMTP; 23 May 2024 06:40:18 -0700 From: Wentong Wu To: sakari.ailus@linux.intel.com, tomas.winkler@intel.com, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Wentong Wu , stable@vger.kernel.org, Hao Yao , Jason Chen Subject: [PATCH v2] mei: vsc: Don't stop/restart mei device during system suspend/resume Date: Thu, 23 May 2024 22:01:34 +0800 Message-Id: <20240523140134.506033-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: f6085a96c973 ("mei: vsc: Unregister interrupt handler for system suspend") Cc: stable@vger.kernel.org # for 6.8+ Reported-by: Hao Yao Signed-off-by: Wentong Wu Reviewed-by: Sakari Ailus Tested-by: Jason Chen Tested-by: Sakari Ailus --- 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