Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3618547ybt; Tue, 30 Jun 2020 07:24:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+5Dd4mK8dpbepqcly/ReTVAvAVEZ4FN9mVQ6QOnMLMLhXaJ2dft8jGigLDh87VWKdBAs2 X-Received: by 2002:a17:907:2489:: with SMTP id zg9mr17339315ejb.48.1593527077576; Tue, 30 Jun 2020 07:24:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593527077; cv=none; d=google.com; s=arc-20160816; b=oky/LcGRHN32ooZMCPONAcKo9HK4riZ9tppnLa2P/uXg45oskSd/5vCF1tcVe6PABm +0W0JnmviLllDZzCgelHYIgrNJ9Dms5xoMhHVFtpG6vlgU3uNjCFRs5v6se3Nr19TKZI NFHEoH1m/aPGa58beQru4ihwSCLWbmhDNoDZ0AEOF+uPq90Tuy1m+DfBv6AO6fiX8CT+ ZOj2jGtJHIep+yeKbzeYLHmJuWUxS+ATmFvhgAJcqfi7ET4LSsuShV0GrfTtSqirYA9F Y4oq8dTbIBZSAcuIh0rvslrHLmMkpIrVkn0x7FCN8vCvc/r/JIOmd8sUFrdCTuv5i8mq qgxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=DH52hmjlJu4+tmYSHNwdpjlEwj2eJVpdPFmKhPY/OLY=; b=FthXFtHIy443vqOWlNv9KYYRCAF5GRpev3t9dQhqMl8aiwQSCR32xVPWNPtU1gMM55 0aKC1LWSCh1CsC0gLxHIeL/Qf/Xzp0DACus0cmJM1NnjyJ+8ZwWGFb2ir+ODmMcODK5L 5/1qkTCubsHhMaf6eHB+dTb+XnwHGqkFIlYazWjHLR1jpjA0WrbwFlPKpRGsrjYjgh8l LpQPvctu+aCTO+4Sbc4cnSFBymefPIhGoDTTVYfifLKA2VNiqKvGTObaaECTKZ+rCpPT fe38pEOy85+mNBbUXG3MGyBiv7HP7/i8nn9g5SjmKSpdpvtzoV5ZDliYvH98IrooQQSN gYjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn14si2310434ejc.414.2020.06.30.07.24.14; Tue, 30 Jun 2020 07:24:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388797AbgF3OXo (ORCPT + 99 others); Tue, 30 Jun 2020 10:23:44 -0400 Received: from mga03.intel.com ([134.134.136.65]:25713 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726796AbgF3OXo (ORCPT ); Tue, 30 Jun 2020 10:23:44 -0400 IronPort-SDR: BO+84pG9wX0V3yzmmBnaBG0J22TZtWHaDhQIUAiYWtSB30VOp3x6SljS199lm0i3BZpnrNThAj jIl2ztrXk3Zg== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="146226364" X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="146226364" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2020 07:23:42 -0700 IronPort-SDR: 8/vYlNUih71TH5mZdt+Sy56pLFMlWldhDqN48xdbXSa5o0JjX1wFk0EcNTCgIuUdA7Mw7lMcxc 7Tz6uW4WBHYQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="386709302" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 30 Jun 2020 07:23:40 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Tue, 30 Jun 2020 17:23:39 +0300 Date: Tue, 30 Jun 2020 17:23:39 +0300 From: Heikki Krogerus To: Prashant Malani Cc: linux-kernel@vger.kernel.org, Guenter Roeck , Benson Leung , Enric Balletbo i Serra Subject: Re: [PATCH v4 2/2] platform/chrome: cros_ec_typec: Add PM support Message-ID: <20200630142339.GE856968@kuha.fi.intel.com> References: <20200629211329.2185342-1-pmalani@chromium.org> <20200629211329.2185342-2-pmalani@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200629211329.2185342-2-pmalani@chromium.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 29, 2020 at 02:13:29PM -0700, Prashant Malani wrote: > Define basic suspend resume functions for cros-ec-typec. On suspend, we > simply ensure that any pending port update work is completed, and on > resume, we re-poll the port state to account for any > changes/disconnections that might have occurred during suspend. > > Signed-off-by: Prashant Malani > Reviewed-by: Guenter Roeck Reviewed-by: Heikki Krogerus > --- > > Changes in v4: > - No changes (added Reviewed-by received in v3). > > Changes in v3: > - Remove superfluous DEV_PM_OPS #define. > > Changes in v2: > - Remove #ifdef-ery, add __maybe_unused tag to functions. > > drivers/platform/chrome/cros_ec_typec.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c > index 69c4118e280c..cb95d190f06a 100644 > --- a/drivers/platform/chrome/cros_ec_typec.c > +++ b/drivers/platform/chrome/cros_ec_typec.c > @@ -720,11 +720,35 @@ static int cros_typec_probe(struct platform_device *pdev) > return ret; > } > > +static int __maybe_unused cros_typec_suspend(struct device *dev) > +{ > + struct cros_typec_data *typec = dev_get_drvdata(dev); > + > + cancel_work_sync(&typec->port_work); > + > + return 0; > +} > + > +static int __maybe_unused cros_typec_resume(struct device *dev) > +{ > + struct cros_typec_data *typec = dev_get_drvdata(dev); > + > + /* Refresh port state. */ > + schedule_work(&typec->port_work); > + > + return 0; > +} > + > +static const struct dev_pm_ops cros_typec_pm_ops = { > + SET_SYSTEM_SLEEP_PM_OPS(cros_typec_suspend, cros_typec_resume) > +}; > + > static struct platform_driver cros_typec_driver = { > .driver = { > .name = DRV_NAME, > .acpi_match_table = ACPI_PTR(cros_typec_acpi_id), > .of_match_table = of_match_ptr(cros_typec_of_match), > + .pm = &cros_typec_pm_ops, > }, > .probe = cros_typec_probe, > }; thanks, -- heikki