summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Li2017-03-08 10:05:54 -0600
committerPeter Li2017-03-08 10:05:54 -0600
commit33fa32531e0d041a5f42225ee120f6e5c2264545 (patch)
tree8594b7eaeb0408dfc1e03f72258c8044598e6b09
parent90332b7cfa0d05bf8a803397b65d7a4ca30bc590 (diff)
downloadtas2557-android-driver-33fa32531e0d041a5f42225ee120f6e5c2264545.tar.gz
tas2557-android-driver-33fa32531e0d041a5f42225ee120f6e5c2264545.tar.xz
tas2557-android-driver-33fa32531e0d041a5f42225ee120f6e5c2264545.zip
update power management
-rwxr-xr-xtas2557-regmap.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/tas2557-regmap.c b/tas2557-regmap.c
index 47478cb..f07043c 100755
--- a/tas2557-regmap.c
+++ b/tas2557-regmap.c
@@ -459,11 +459,12 @@ end:
459 return; 459 return;
460} 460}
461 461
462int tas2557_suspend(struct i2c_client *pClient, pm_message_t mesg) 462#ifdef CONFIG_PM_SLEEP
463static int tas2557_suspend(struct device *dev)
463{ 464{
464 struct tas2557_priv *pTAS2557 = i2c_get_clientdata(pClient); 465 struct tas2557_priv *pTAS2557 = dev_get_drvdata(dev);
465 466
466 dev_dbg(pTAS2557->dev, "%s, power status = %d\n", __func__, mesg.event); 467 dev_dbg(pTAS2557->dev, "%s\n", __func__);
467 if (hrtimer_active(&pTAS2557->mtimer)) { 468 if (hrtimer_active(&pTAS2557->mtimer)) {
468 dev_dbg(pTAS2557->dev, "cancel die temp timer\n"); 469 dev_dbg(pTAS2557->dev, "cancel die temp timer\n");
469 hrtimer_cancel(&pTAS2557->mtimer); 470 hrtimer_cancel(&pTAS2557->mtimer);
@@ -472,11 +473,12 @@ int tas2557_suspend(struct i2c_client *pClient, pm_message_t mesg)
472 return 0; 473 return 0;
473} 474}
474 475
475int tas2557_resume(struct i2c_client *pClient) 476static int tas2557_resume(struct device *dev)
476{ 477{
477 struct tas2557_priv *pTAS2557 = i2c_get_clientdata(pClient); 478 struct tas2557_priv *pTAS2557 = dev_get_drvdata(dev);
478 struct TProgram *pProgram; 479 struct TProgram *pProgram;
479 480
481 dev_dbg(pTAS2557->dev, "%s\n", __func__);
480 if (!pTAS2557->mpFirmware->mpPrograms) { 482 if (!pTAS2557->mpFirmware->mpPrograms) {
481 dev_dbg(pTAS2557->dev, "%s, firmware not loaded\n", __func__); 483 dev_dbg(pTAS2557->dev, "%s, firmware not loaded\n", __func__);
482 goto end; 484 goto end;
@@ -498,6 +500,7 @@ end:
498 500
499 return 0; 501 return 0;
500} 502}
503#endif
501 504
502static bool tas2557_volatile(struct device *pDev, unsigned int nRegister) 505static bool tas2557_volatile(struct device *pDev, unsigned int nRegister)
503{ 506{
@@ -685,10 +688,19 @@ static const struct of_device_id tas2557_of_match[] = {
685MODULE_DEVICE_TABLE(of, tas2557_of_match); 688MODULE_DEVICE_TABLE(of, tas2557_of_match);
686#endif 689#endif
687 690
691#ifdef CONFIG_PM_SLEEP
692static const struct dev_pm_ops tas2557_pm_ops = {
693 SET_SYSTEM_SLEEP_PM_OPS(tas2557_suspend, tas2557_resume)
694};
695#endif
696
688static struct i2c_driver tas2557_i2c_driver = { 697static struct i2c_driver tas2557_i2c_driver = {
689 .driver = { 698 .driver = {
690 .name = "tas2557", 699 .name = "tas2557",
691 .owner = THIS_MODULE, 700 .owner = THIS_MODULE,
701#ifdef CONFIG_PM_SLEEP
702 .pm = &tas2557_pm_ops,
703#endif
692#if defined(CONFIG_OF) 704#if defined(CONFIG_OF)
693 .of_match_table = of_match_ptr(tas2557_of_match), 705 .of_match_table = of_match_ptr(tas2557_of_match),
694#endif 706#endif
@@ -696,8 +708,6 @@ static struct i2c_driver tas2557_i2c_driver = {
696 .probe = tas2557_i2c_probe, 708 .probe = tas2557_i2c_probe,
697 .remove = tas2557_i2c_remove, 709 .remove = tas2557_i2c_remove,
698 .id_table = tas2557_i2c_id, 710 .id_table = tas2557_i2c_id,
699 .suspend = tas2557_suspend,
700 .resume = tas2557_resume,
701}; 711};
702 712
703module_i2c_driver(tas2557_i2c_driver); 713module_i2c_driver(tas2557_i2c_driver);