Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3054701ybt; Mon, 29 Jun 2020 14:05:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9mrcj053Gv6lc7RzROd6cTtBiqw7fI+ksRpzEjeFM2RsA+AS6mrlnQ+X3CIkrZOiZYcTK X-Received: by 2002:a50:f058:: with SMTP id u24mr19732655edl.351.1593464704390; Mon, 29 Jun 2020 14:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593464704; cv=none; d=google.com; s=arc-20160816; b=t/5S+Qq/AR5lnRZ4TYON5frki9k0wVBemnY2fcYNSMMqsw3jO4yOG4RN5w/F+fzC4e Ab1HBhzgWHgCXvI2QPkBoD9067uqhQ8rWnXIDZl+BBayz+990oT79e/TEOodENDENNXX wI0aeQeZT5OxZ29G5YJ1bd323h1LV9MSOYlHr0VRtj3rdgBegcVhjjvAsR6qy3edPudN yqyczW8GG7BIjdtQVdIBLtuOOUC51Zm8ahWVfsn4FNpJJA1Ub6hiWPbw2CgRN7V5Aj2a Z9iu+coBFqOtXEbahjvTZnp5HjgvjdTOscHhFVBmT3uNllkHLC8lNcLiMi3lmfCyNA50 VxoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=udp1vyVwpstUp7h61vugCs6J6DYuTrkDmvVFsfgtQBM=; b=YtwtWllv+FZTuL86WHiHq4YEYgqy/M9md0ngi+TAOwg+43otd+OqWQFlJZ6i9AFgC+ 2MtSPlHaTLS5cUKYsK9iVbqBjAaBW9EVaC3oJnT4tlw738Kf9gL6awz1LPf75sfo+iBZ /cwoRY7cpZXatQwnhiLWdkRev4KHU/ujNbgfKGVR1AAJhAEW0LA+eJIaH1bUELoQ8J08 Fu/KGEpAkNeckXt+ynOsIIvAZLMO/q1c14x8q0b7cBnAKtwIhthl6yK6w4G84l25Rttk hWvUYyOZclPgQflpBZYI3ujtxnPN3SSQNNrV48h1vZxN6EYJJEqyAAD4NuGdodjNJO28 /AHg== 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=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g22si324307edj.310.2020.06.29.14.04.41; Mon, 29 Jun 2020 14:05:04 -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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390139AbgF2VBh (ORCPT + 99 others); Mon, 29 Jun 2020 17:01:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731193AbgF2TM5 (ORCPT ); Mon, 29 Jun 2020 15:12:57 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A84BC008627 for ; Mon, 29 Jun 2020 03:51:26 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 06A662A1309 Subject: Re: [PATCH 2/2] platform/chrome: cros_ec_typec: Add PM support To: Prashant Malani , linux-kernel@vger.kernel.org Cc: heikki.krogerus@linux.intel.com, Benson Leung , Guenter Roeck References: <20200627045840.1314019-1-pmalani@chromium.org> <20200627045840.1314019-2-pmalani@chromium.org> From: Enric Balletbo i Serra Message-ID: Date: Mon, 29 Jun 2020 12:51:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200627045840.1314019-2-pmalani@chromium.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Prashant, Thank you for the patch. On 27/6/20 6:58, 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 > --- > drivers/platform/chrome/cros_ec_typec.c | 34 +++++++++++++++++++++++++ > 1 file changed, 34 insertions(+) > > diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c > index 630170fb2cbe..68f15a47450c 100644 > --- a/drivers/platform/chrome/cros_ec_typec.c > +++ b/drivers/platform/chrome/cros_ec_typec.c > @@ -725,11 +725,45 @@ static int cros_typec_probe(struct platform_device *pdev) > return ret; > } > > +#ifdef CONFIG_PM_SLEEP > + > +static int cros_typec_suspend(struct device *dev) I'd prefer if you can mark these function as __maybe_unused (to avoid the compiler warning) rather than wrapping it in a preprocessor conditional, it makes the code a bit more simple. > +{ > + struct cros_typec_data *typec = dev_get_drvdata(dev); > + > + cancel_work_sync(&typec->port_work); > + > + return 0; > +} > + > +static int cros_typec_resume(struct device *dev) __maybe_unused ? > +{ > + 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) > +}; > + > +#define DEV_PM_OPS (&cros_typec_pm_ops) > + > +#else > + > +#define DEV_PM_OPS NULL > + > +#endif /* CONFIG_PM_SLEEP */ and remove the ifdefy > + > 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 = DEV_PM_OPS, .pm = &cros_typec_pm_ops, > }, > .probe = cros_typec_probe, > }; > Thanks, Enric