From patchwork Thu Jan 9 03:55:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guan-Yu Lin X-Patchwork-Id: 13932000 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFF5F165F09 for ; Thu, 9 Jan 2025 03:56:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736395007; cv=none; b=L5dhVwYU6Ko/zo2UMfnqvdjzLGRq/iSJwTwD4vFWxQr+M1O7HX7RiIPtWVasd/PELv84D9HrUiHoZH+l+EDf4TJZsoX1suogl+bYHhNDwZp5rE0N3fkIjoEStaluKIgkrppmC2pNOq9R1kgNdG2qeqFn0cleBIJrPtyxNuxl1Ck= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736395007; c=relaxed/simple; bh=U8jc42PW7/ktoftpSHk8MRrsiNyFroAZ122yKoykeWk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=uODKlLSPd3ug33ymqDEbsLVaZkXziqRGJfZLYhl6gu4sWHqX8N8izz/EapDRNV4zsMVX/hQa6cLsduKJ/Wxv5waRESNK3Z3a+ctCeKr3tw4luUkRvSwN3kDv8m4EYY1E0AVn5mjq5GlhGQE/IMzesyt5abwBPs3BCGHu4IiqfQw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--guanyulin.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=FsCXlOsc; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--guanyulin.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FsCXlOsc" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2164861e1feso7315995ad.1 for ; Wed, 08 Jan 2025 19:56:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736395004; x=1736999804; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=kLfOoQDnujr5A1F2r70MA5lfjVLn4qtfns7H9XAvRjU=; b=FsCXlOscOAAOE66PSUT71F7aMzd0jILLTAlrO3XI4vKV4sDpqmoQcdH+r/iXKdt5me STuRQ4pLHDhwebDpOiSwMpG5V4Mfu1KDwUBDzUrQAfRzYdTnnHnquHdrNY5LASX2xQLO JlVPruqY4j8f0mRgEY3jtR7pHXnjLeqblIQVmbbpIzoJ4vDZhJGiPEXFJIBrd1TrE0d2 w/6Rg7AlF0A+SftpR9/SMuzxci1zZNahofP0Zzp0OihusG588ClSJAdsOU0jb6HnAKeu zKWyCi5bVoChQOFrsO/LZOGMyBkWM55iaujmk74oY8RsIHOuKiKXCdyNn8oHC4t7h7nd 9TjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736395004; x=1736999804; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kLfOoQDnujr5A1F2r70MA5lfjVLn4qtfns7H9XAvRjU=; b=Tv4Y8iYuaDznv3NQMk2dz+AQqRZ6bTSSCG8eXAYakoPCmM0eQobS/DEp4oBWZX9rBa aPErZMgcAOlfF9rzIL9zVyMFzGI++HW4rgIm89dStRS4u0h71/WQ1/if+PjCKc1leOr3 Ynl6pS7vZotSEhmSwCEIqPjtCAWTWofOQJSWr5LZLIEDVYOpEL80wy7WXLMFW85rNoyy y4zm2ebNP0EyQmMRanl1oXDRlxI6NKT5ZFvdZVymYK13DS/ZCFBPAheUeiEVhippXAN+ yhWFc7oQRtdXEdwKo8g83gpiMBl0xHjpJPtyoPHZSsyp3JCtJfDie2fybMFHRoqG9GxX l3rg== X-Forwarded-Encrypted: i=1; AJvYcCUEIgl9A/tuHJuynV+FtqHYSg01p4nOXsE7WcE1LCF685JHTdtUHlPcxTKmMUu+DsnTJECy6z06x50+zw==@vger.kernel.org X-Gm-Message-State: AOJu0YxLJknv8XZseWkpAPJOa3AKyFkyrwZJnifyTy8pu9duvInzFOAo 9M08CDwW5snb8d9iR/cNE3X3duO3QKdqn0iUG1pQc8h+Sz6+F6S+6goivU3Y9Mi+Z3cuJopaL+v ALK3Jsmk0+U6+sg== X-Google-Smtp-Source: AGHT+IHGWPQ97evR6CX9zmw6SJkm14AscRbwGnyXik8xyoj2Fb/TGu2ud6/l7gVV23yEO+9v9zzFyVQSJlVKoKg= X-Received: from pgg14.prod.google.com ([2002:a05:6a02:4d8e:b0:845:b983:9e34]) (user=guanyulin job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:101a:b0:1e1:aba4:2095 with SMTP id adf61e73a8af0-1e88d0bb4bfmr10227278637.32.1736395004396; Wed, 08 Jan 2025 19:56:44 -0800 (PST) Date: Thu, 9 Jan 2025 03:55:06 +0000 In-Reply-To: <20250109035605.1486717-1-guanyulin@google.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250109035605.1486717-1-guanyulin@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Message-ID: <20250109035605.1486717-3-guanyulin@google.com> Subject: [PATCH v7 2/5] usb: xhci-plat: separate dev_pm_ops for each pm_event From: Guan-Yu Lin To: gregkh@linuxfoundation.org, Thinh.Nguyen@synopsys.com, mathias.nyman@intel.com, stern@rowland.harvard.edu, perex@perex.cz, tiwai@suse.com, sumit.garg@linaro.org, kekrby@gmail.com, oneukum@suse.com, ricardo@marliere.net, lijiayi@kylinos.cn, quic_jjohnson@quicinc.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, Guan-Yu Lin Separate dev_pm_ops for different power events such as suspend, thaw, and hibernation. This is crucial when xhci-plat driver needs to adapt its behavior based on different power state changes. Signed-off-by: Guan-Yu Lin --- drivers/usb/host/xhci-plat.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 3acdbbd9aea3..b676d4dbcec1 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -450,7 +450,7 @@ void xhci_plat_remove(struct platform_device *dev) } EXPORT_SYMBOL_GPL(xhci_plat_remove); -static int xhci_plat_suspend(struct device *dev) +static int xhci_plat_suspend_common(struct device *dev, struct pm_message pmsg) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct xhci_hcd *xhci = hcd_to_xhci(hcd); @@ -478,6 +478,21 @@ static int xhci_plat_suspend(struct device *dev) return 0; } +static int xhci_plat_suspend(struct device *dev) +{ + return xhci_plat_suspend_common(dev, PMSG_SUSPEND); +} + +static int xhci_plat_freeze(struct device *dev) +{ + return xhci_plat_suspend_common(dev, PMSG_FREEZE); +} + +static int xhci_plat_poweroff(struct device *dev) +{ + return xhci_plat_suspend_common(dev, PMSG_HIBERNATE); +} + static int xhci_plat_resume_common(struct device *dev, struct pm_message pmsg) { struct usb_hcd *hcd = dev_get_drvdata(dev); @@ -524,6 +539,11 @@ static int xhci_plat_resume(struct device *dev) return xhci_plat_resume_common(dev, PMSG_RESUME); } +static int xhci_plat_thaw(struct device *dev) +{ + return xhci_plat_resume_common(dev, PMSG_THAW); +} + static int xhci_plat_restore(struct device *dev) { return xhci_plat_resume_common(dev, PMSG_RESTORE); @@ -553,9 +573,9 @@ static int __maybe_unused xhci_plat_runtime_resume(struct device *dev) const struct dev_pm_ops xhci_plat_pm_ops = { .suspend = pm_sleep_ptr(xhci_plat_suspend), .resume = pm_sleep_ptr(xhci_plat_resume), - .freeze = pm_sleep_ptr(xhci_plat_suspend), - .thaw = pm_sleep_ptr(xhci_plat_resume), - .poweroff = pm_sleep_ptr(xhci_plat_suspend), + .freeze = pm_sleep_ptr(xhci_plat_freeze), + .thaw = pm_sleep_ptr(xhci_plat_thaw), + .poweroff = pm_sleep_ptr(xhci_plat_poweroff), .restore = pm_sleep_ptr(xhci_plat_restore), SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend,