Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2012908lqb; Mon, 27 May 2024 05:17:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV/q/soLH+rQAnusa9VmVvO33lmHidLo5Tj4NY/VXEGx1WjUCqJNq7WkAuziWlnseO2M9oCnCy8mYZBD+hwFVp/duMxcC+Eh5iOHWthEQ== X-Google-Smtp-Source: AGHT+IGaQmp8MfoDY4oUySvizYlY2pr/WF/O/LzmuZhgaZyyIoS6zMwDf9ZC59h26gfRHWGUYJpV X-Received: by 2002:a05:6830:91e:b0:6f1:86e:e6f1 with SMTP id 46e09a7af769-6f8d0a86709mr11570553a34.17.1716812273020; Mon, 27 May 2024 05:17:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716812272; cv=pass; d=google.com; s=arc-20160816; b=kidEh4mwVRXuuKa/Tx3HZGnRls+TgOpHWDSufiadBoQayDavaKp+BPBN3K10B34F0J 7VNQQ11BaU7jNheJTpMhOpxfnzxxFPcrHZO/a9RYVqyhOaSe+cEZu85t1taBHkr4Cnr1 PnQInihLRCG0BWdGorduvZNrOd/1oACUNr9BXUKrqcqSvAkmIKj5NP2ZX9iTFIVyrOVP eCRHQUhb/vRx/0mnMPKkiywOAxS+0whtsxnbpmfh5vzXyHGerae/d1uVMlXESPHeryMr fYJGlvY424GMYK8U3bqTIa5yZsNyV1SV2MD9vce9gDthnhR5JlkU/wXTdmSiniPAdDPQ Qx3Q== 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=h/YBlMdEtrYE2ZiUWdmKg3aS5s55+2cChAcSsHt1oBE=; fh=6jdoPZKfaEp9nJnWp3I7a4fmbel8Doq5cGINJFPJzx0=; b=OlpYvHeYshXhfk4/vDxwtKsTqcl/+/h1mP11tr654AK+qD05grDnlcvIvbXrJnc9ad 8sr+HWE8fEDZi2dH2DXBPDe4WWgha+kQ/8ePkq9MDBSa++9HUyAv4fU8DxHLwcm3clkN fVUB2EEgEvdAaOduy+U4iX1ztzrDvirj4WA2oyt/leZLFOJLX6mMJ4gGc445CXwz+5R6 93L1QlGX7Y3CF8Gq2qDjwSJGJDVK+K/oetPDYYDMTLWaJg0qzBC5C1kxELO3i9VV0UrE 1JCom7tVZIwzs+71A41PFxzgfcXew7/jZcWmH+f/RyzxtlnJeCCj9xtXHYqBa4Py0VaF N/lg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kVO2pEnD; 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-190557-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190557-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 d75a77b69052e-43fb18c970bsi90011301cf.663.2024.05.27.05.17.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 05:17:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-190557-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=kVO2pEnD; 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-190557-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190557-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 B91291C20A25 for ; Mon, 27 May 2024 12:17:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E737215E5D9; Mon, 27 May 2024 12:17:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kVO2pEnD" 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 37B6613C3CA; Mon, 27 May 2024 12:17:08 +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=1716812230; cv=none; b=S9OWYQaf4uUHE+1lXKMLVhMNKhsvDgfpH/KUqvJXUj3YGxDOcXvt7CYpv2puqftjJL+7PQt89Utaby2OrhaJqcap2NE+ddiCmfReLJ7pnLoX0Qs+fBMb2uxpf8h9Bgu0Qs+0T/9Jzd8QGzsg3bmwiU5sErYrKanXIT38huTxjoI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716812230; c=relaxed/simple; bh=v7mwebxOX/a1s/ML0ZEls3SJ4IPgSe8KPM9vsKrPK9I=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=FS8xG5enWKMHCZkFqaXpAKqx8u0ZyY5RScgXgiksNxpVbEMk7kvuJw4AJdlDf0/acfLIWO2TMV1u/g6qi3bgCoQe80UYKPzhf8/6To54i7Gz2zhxnVhUjDk5i+7JulmYlxQp+e5m0+90Du90npW53LrOmRxLJgfQVaI0vlJbCas= 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=kVO2pEnD; 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=1716812228; x=1748348228; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=v7mwebxOX/a1s/ML0ZEls3SJ4IPgSe8KPM9vsKrPK9I=; b=kVO2pEnDjK9x6TH/ykKA6NnsnfD4DDNcIfUHHsP7VECYWIw74hhX/4b6 kRZq2VwflOUlrrPVjL4hP1pL6tciwyIfN/yVpd+/PWjewCsXAndy4TzHy EkzL5YvgvkME2ilE/eOPAMUXpFLLWwgltsnUj/yPKI2EXd8l3XCFMk/wg YRzNvW42nNAzMdKDK4GzGaUtgrOZ3f7HZOQmaOIuiBoGfUI7Msgr4cLVq /dpocrA4oku7upUFQC//9x5JvReZbISm0+47Jfatmc8wTJGRej61Pdubv J0lJC8Hp20B6cNaWdITb1mTgOb+YNJ0HT4sXpmPeHuQ6pm2x0HwffR9vD g==; X-CSE-ConnectionGUID: 57/v2V0xRy6xdyc7HNT0UA== X-CSE-MsgGUID: SOu1kKn8RUOUKHA7hloO1A== X-IronPort-AV: E=McAfee;i="6600,9927,11084"; a="24253945" X-IronPort-AV: E=Sophos;i="6.08,192,1712646000"; d="scan'208";a="24253945" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2024 05:17:08 -0700 X-CSE-ConnectionGUID: r5jiZ86jQhaITYpFAWV54g== X-CSE-MsgGUID: mgrFYRFzR2iM6Xu4Hio2ew== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,192,1712646000"; d="scan'208";a="39289986" Received: from wentongw-optiplex-8070.sh.intel.com ([10.239.154.12]) by fmviesa004.fm.intel.com with ESMTP; 27 May 2024 05:17:05 -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 v3] mei: vsc: Don't stop/restart mei device during system suspend/resume Date: Mon, 27 May 2024 20:38:35 +0800 Message-Id: <20240527123835.522384-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 --- Changes since v2: - add change log which is not covered by v2, and no code change Changes since v1: - correct Fixes commit id in commit message, and no code change --- 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