Skip to content

Commit 20b7368

Browse files
Prashant MalaniEnric Balletbo i Serra
authored andcommitted
platform/chrome: cros_ec_typec: Add PM support
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 <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Signed-off-by: Enric Balletbo i Serra <[email protected]>
1 parent 83cbc69 commit 20b7368

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

drivers/platform/chrome/cros_ec_typec.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,11 +720,35 @@ static int cros_typec_probe(struct platform_device *pdev)
720720
return ret;
721721
}
722722

723+
static int __maybe_unused cros_typec_suspend(struct device *dev)
724+
{
725+
struct cros_typec_data *typec = dev_get_drvdata(dev);
726+
727+
cancel_work_sync(&typec->port_work);
728+
729+
return 0;
730+
}
731+
732+
static int __maybe_unused cros_typec_resume(struct device *dev)
733+
{
734+
struct cros_typec_data *typec = dev_get_drvdata(dev);
735+
736+
/* Refresh port state. */
737+
schedule_work(&typec->port_work);
738+
739+
return 0;
740+
}
741+
742+
static const struct dev_pm_ops cros_typec_pm_ops = {
743+
SET_SYSTEM_SLEEP_PM_OPS(cros_typec_suspend, cros_typec_resume)
744+
};
745+
723746
static struct platform_driver cros_typec_driver = {
724747
.driver = {
725748
.name = DRV_NAME,
726749
.acpi_match_table = ACPI_PTR(cros_typec_acpi_id),
727750
.of_match_table = of_match_ptr(cros_typec_of_match),
751+
.pm = &cros_typec_pm_ops,
728752
},
729753
.probe = cros_typec_probe,
730754
};

0 commit comments

Comments
 (0)