Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5603718rwb; Wed, 7 Sep 2022 05:31:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR4KwDS+vhXllNv39+VcqQXXjRa+97B1BDE/FHEL3OHAopRd+HxzAE4wEZjqfraKL96vcM8f X-Received: by 2002:a17:906:6086:b0:731:3970:48d0 with SMTP id t6-20020a170906608600b00731397048d0mr2190680ejj.16.1662553905483; Wed, 07 Sep 2022 05:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662553905; cv=none; d=google.com; s=arc-20160816; b=Xk+al6YKrjFod0w/07YnbMXTyig3JhCEzkGde7Lje4XscJyg3n9cOrLb0fSeTqTRm4 mvMnFG707HODqONvbeuY4LPj+rUe7DQ7SQ+jnEpfSuHT0zf8HhCEJDn5C8WtOu/rRVzu WgaE/CR8pyeLNE3dIa9alFLt7C/da7QZTRCTJEMyVuiIDj3xEOizmaVGZd+6L+LhZvsH C3DwffaEHr1dlr6ZIl1iknEhZlB1TS8QrXnKGd9Alt7LS74GtLWjoY0KB2m+wppanSlX 0MJPmRdzY6VR2MJYmBZ2133c7pl6jxE4oojTYsT6Vf7WLVbjq0X0MpXQwHMvSk2ttWtr uVtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MKUttLwWZhZMGJMAbSKGpqB7FTiZrmvLJ+of0b0GuCM=; b=fW5QjGljW8ni4eb5LofXp07SKhrTIL7GgIVDsVAxi/UHzqQYfWPKlzga+1mswlxD3v WqIA6MdNMyCovaYjm4RKi3HvPlHNDdugLUqtj/7dBG5oyjPqfeqFa+mJtd59kyQW3PEK M5DTRL16tqaErUmEvP4fF4gvQmRqdaoyb59iVuwDsUQjAV9iBONz8CGugZya4L6lefXl /tTofd9OtsHD9RyXYRS2YD45HVGzXOM0kJOf7NUMzKatT1KG+tU3lca2AfOI6MYrDa5M whsKBlxRnO4midlR6SNJcd910NdAwtO3n+plu9k5jNzucTjxYFNMnin1d9SBA5y8m/M2 riAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cOIQNhuw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ez3-20020a056402450300b0044ea701dba9si4736461edb.471.2022.09.07.05.31.18; Wed, 07 Sep 2022 05:31:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cOIQNhuw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230075AbiIGL41 (ORCPT + 99 others); Wed, 7 Sep 2022 07:56:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229915AbiIGL4X (ORCPT ); Wed, 7 Sep 2022 07:56:23 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA0D77FE40; Wed, 7 Sep 2022 04:56:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662551782; x=1694087782; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=I3n8tdgr/41V9HMQjef7gsGonwwy/i4gJxjnLqt2rlU=; b=cOIQNhuwTtYUo1nM/EHDaKnxfxQZCaVzfTxtrQL0Qe7d5mhf1vBj3rf5 P4MTtSOOunIeAqT3ifuEbv8ybMsmRB0797LgOSvGSxD2OXmnxsmismuRw 0Fgz7IV6XJNk14/nqycHUE5wqd1QYkctRuU2/N62mb3UP5+nj12EO88ag DP/PAQboaYEEczpQuJjB5GvEarzjVwK67f7mw0pNvoMfTbjcthDtazB/Z 5ny7Y9QeIw/TMiyfugE+dY7IC+oFBYNljMf9ig9ErsY+gerpeJXAfXakG 9JpQ32zfCH2WszdYoSyGuqZCRq/cj/F56pjt0X+w57X2R6U4VZN5jyYxO Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10462"; a="296851231" X-IronPort-AV: E=Sophos;i="5.93,296,1654585200"; d="scan'208";a="296851231" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 04:56:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,296,1654585200"; d="scan'208";a="756742687" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 07 Sep 2022 04:56:18 -0700 From: Heikki Krogerus To: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org, grzegorz.alibozek@gmail.com, bastian@rieck.me, andrew.co@free.fr, meven29@gmail.com, pchernik@gmail.com, jorge.cep.mart@gmail.com, danielmorgan@disroot.org, bernie@codewiz.org, saipavanchitta1998@gmail.com, rubin@starset.net, maniette@gmail.com, nate@kde.org Subject: [RFC PATCH 2/2] usb: typec: ucsi: acpi: Add PM hooks Date: Wed, 7 Sep 2022 14:56:26 +0300 Message-Id: <20220907115626.21976-3-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220907115626.21976-1-heikki.krogerus@linux.intel.com> References: <20220907115626.21976-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some systems notify the driver separately after resume if the state of the connection changed during suspend, but there is no way we can rely on that. Link: https://bugzilla.kernel.org/show_bug.cgi?id=210425 Fixes: a94ecde41f7e ("usb: typec: ucsi: ccg: enable runtime pm support") Cc: Signed-off-by: Heikki Krogerus --- drivers/usb/typec/ucsi/ucsi_acpi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c index 8873c1644a295..8c7008cc9942e 100644 --- a/drivers/usb/typec/ucsi/ucsi_acpi.c +++ b/drivers/usb/typec/ucsi/ucsi_acpi.c @@ -185,6 +185,20 @@ static int ucsi_acpi_remove(struct platform_device *pdev) return 0; } +static int ucsi_acpi_suspend(struct device *dev) +{ + return 0; +} + +static int ucsi_acpi_resume(struct device *dev) +{ + struct ucsi_acpi *ua = dev_get_drvdata(dev); + + return ucsi_resume(ua->ucsi); +} + +static DEFINE_SIMPLE_DEV_PM_OPS(ucsi_acpi_pm_ops, ucsi_acpi_suspend, ucsi_acpi_resume); + static const struct acpi_device_id ucsi_acpi_match[] = { { "PNP0CA0", 0 }, { }, @@ -194,6 +208,7 @@ MODULE_DEVICE_TABLE(acpi, ucsi_acpi_match); static struct platform_driver ucsi_acpi_platform_driver = { .driver = { .name = "ucsi_acpi", + .pm = pm_ptr(&ucsi_acpi_pm_ops), .acpi_match_table = ACPI_PTR(ucsi_acpi_match), }, .probe = ucsi_acpi_probe, -- 2.35.1