lkml.org 
[lkml]   [2020]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/2] platform/chrome: cros_ec_typec: Add PM support
Hi Enric,

Thanks for reviewing the patch.

On Mon, Jun 29, 2020 at 3:51 AM Enric Balletbo i Serra
<enric.balletbo@collabora.com> wrote:
>
> 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 <pmalani@chromium.org>
> > ---
> > 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.

Done.

>
> > +{
> > + 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 ?

Done.

>
> > +{
> > + 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
>

Done.

> > +
> > 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

\
 
 \ /
  Last update: 2020-06-30 00:10    [W:0.042 / U:3.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site